DV Plotting XSect: Difference between revisions

From New IAC Wiki
Jump to navigation Jump to search
Vanwdani (talk | contribs)
No edit summary
Vanwdani (talk | contribs)
No edit summary
Line 95: Line 95:
A data file is created with the differential cross-section for the scattering angle theta, by increments of 1
A data file is created with the differential cross-section for the scattering angle theta, by increments of 1
<pre>
<pre>
0  90.000000 0.000017 
90.000000      0.000008
4 91.000000 0.000017 
  90.500000      0.000008
  8 92.000000 0.000017 
  91.000000     0.000008
  12 93.000000 0.000017  
  91.500000      0.000008
16 94.000000 0.000017  
  92.000000     0.000008
20 95.000000 0.000017  
  92.500000      0.000008
24 96.000000 0.000017  
  93.000000     0.000008
28 97.000000 0.000017  
  93.500000      0.000008
32 98.000000 0.000017  
  94.000000     0.000008
36 99.000000 0.000018  
  94.500000      0.000008
40 100.000000 0.000018
  95.000000     0.000008
  44 101.000000 0.000018
  95.500000      0.000009
  48 102.000000 0.000019
  96.000000     0.000009
  52 103.000000 0.000019
  96.500000      0.000009
  56 104.000000 0.000019
  97.000000     0.000009
  60 105.000000 0.000020
  97.500000      0.000009
  64 106.000000 0.000020
  98.000000     0.000009
  68 107.000000 0.000021
  98.500000      0.000009
  72 108.000000 0.000022
  99.000000     0.000009
  76 109.000000 0.000022
  99.500000      0.000009
  80  110.000000 0.000023
  100.000000     0.000009
  84 111.000000 0.000024
  100.500000    0.000009
  88 112.000000 0.000025
  101.000000     0.000009
  92 113.000000 0.000025
  101.500000    0.000009
  96 114.000000 0.000026
  102.000000     0.000009
  100 115.000000 0.000028
  102.500000    0.000009
  104 116.000000 0.000029
  103.000000     0.000010
  108 117.000000 0.000030
  103.500000    0.000010
  112 118.000000 0.000031
  104.000000     0.000010
  116 119.000000 0.000033
  104.500000    0.000010
  120 120.000000 0.000035
  105.000000     0.000010
  124 121.000000 0.000036
  105.500000    0.000010
  128 122.000000 0.000038
  106.000000     0.000010
  132 123.000000 0.000040
  106.500000    0.000010
  136 124.000000 0.000043
  107.000000     0.000010
  140 125.000000 0.000045
  107.500000    0.000011
  144 126.000000 0.000048
  108.000000     0.000011
  148 127.000000 0.000051
  108.500000    0.000011
  152 128.000000 0.000054
  109.000000     0.000011
  156  129.000000 0.000058
  109.500000    0.000011
  160 130.000000 0.000062
110.000000     0.000011
  164 131.000000 0.000067
  110.500000    0.000012
  168 132.000000 0.000072
  111.000000     0.000012
  172 133.000000 0.000077
  111.500000    0.000012
  176 134.000000 0.000083
  112.000000     0.000012
  180 135.000000 0.000090
  112.500000    0.000013
  184 136.000000 0.000097
  113.000000     0.000013
  188 137.000000 0.000106
  113.500000    0.000013
  192 138.000000 0.000115
  114.000000     0.000013
  196 139.000000 0.000126
  114.500000    0.000014
  200 140.000000 0.000138
  115.000000     0.000014
  204 141.000000 0.000152
  115.500000    0.000014
  208 142.000000 0.000167
  116.000000     0.000014
  212 143.000000 0.000185
  116.500000    0.000015
  216 144.000000 0.000205
  117.000000     0.000015
  220 145.000000 0.000228
  117.500000    0.000015
  224 146.000000 0.000254
  118.000000     0.000016
  228 147.000000 0.000285
  118.500000    0.000016
  232  148.000000 0.000321
  119.000000     0.000016
  236 149.000000 0.000362
  119.500000    0.000017
  240 150.000000 0.000411
  120.000000     0.000017
  244 151.000000 0.000468
  120.500000    0.000018
  248 152.000000 0.000537
  121.000000     0.000018
  252 153.000000 0.000618
  121.500000    0.000019
  256 154.000000 0.000716
  122.000000     0.000019
  260 155.000000 0.000834
  122.500000    0.000020
  264 156.000000 0.000978
  123.000000     0.000020
  123.500000    0.000021
  124.000000     0.000021
  124.500000    0.000022
  125.000000     0.000023
  125.500000    0.000023
  126.000000     0.000024
  126.500000    0.000025
  127.000000     0.000026
  127.500000    0.000026
  128.000000     0.000027
  128.500000    0.000028
129.000000     0.000029
  129.500000    0.000030
  130.000000     0.000031
  130.500000    0.000032
  131.000000     0.000033
  131.500000    0.000035
  132.000000     0.000036
  132.500000    0.000037
  133.000000     0.000039
  133.500000    0.000040
  134.000000     0.000042
  134.500000    0.000043
  135.000000     0.000045
  135.500000    0.000047
  136.000000     0.000049
  136.500000    0.000051
  137.000000     0.000053
  137.500000    0.000056
  138.000000     0.000058
  138.500000    0.000061
  139.000000     0.000063
  139.500000    0.000066
  140.000000     0.000070
  140.500000    0.000073
  141.000000     0.000076
  141.500000    0.000080
  142.000000     0.000084
  142.500000    0.000088
  143.000000     0.000093
  143.500000    0.000098
  144.000000     0.000103
  144.500000    0.000109
  145.000000     0.000115
  145.500000    0.000121
  146.000000     0.000128
  146.500000    0.000136
  147.000000     0.000144
  147.500000    0.000152
148.000000     0.000162
  148.500000    0.000172
  149.000000     0.000183
  149.500000    0.000195
  150.000000     0.000208
  150.500000    0.000221
  151.000000     0.000237
  151.500000    0.000253
  152.000000     0.000271
  152.500000    0.000291
  153.000000     0.000312
  153.500000    0.000336
  154.000000     0.000362
  154.500000    0.000391
  155.000000     0.000422
  155.500000    0.000457
156.000000    0.000495
  156.500000    0.000538
157.000000    0.000586
157.500000    0.000639
158.000000    0.000698
158.500000    0.000764
159.000000    0.000838
159.500000    0.000922
160.000000    0.001016
160.500000    0.001123
161.000000    0.001245
161.500000    0.001383
162.000000    0.001542
162.500000    0.001724
163.000000    0.001934
163.500000    0.002177
164.000000    0.002460
164.500000    0.002791
165.000000    0.003179
165.500000    0.003638
166.000000    0.004183
166.500000    0.004834
167.000000    0.005618
167.500000    0.006568
168.000000    0.007727
168.500000    0.009156
169.000000    0.010931
169.500000    0.013159
170.000000    0.015986
170.500000    0.019616
171.000000    0.024340
171.500000    0.030579
172.000000    0.038953
172.500000    0.050406
173.000000    0.066401
173.500000    0.089281
174.000000    0.122933
174.500000    0.174058
175.000000    0.254769
175.500000    0.388214
176.000000     0.621708
176.500000    1.060403
177.000000    1.964202
177.500000    4.072398
178.000000    9.941240
178.500000    31.416433
179.000000    159.035599
179.500000    2544.472656
180.000000    inf
</pre>
</pre>

Revision as of 17:35, 28 June 2016

Creating a program called MollerDiffXSect.c

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main()
{
float angle,dSigma_dOmega;
double alpha=7.2973525664e-3;
double E_CM=53e6;                                               //CM E for 11GeV incident electrons

                /* using equation from Landau-Lifshitz & Azfar */
                /* units in MeV */
                for(angle=90;angle<=180; angle=angle+.5)
//                for(angle=90;angle<=180; angle=angle+1)

                        {
                        dSigma_dOmega=(alpha*(3+cos(angle*3.14159265359/180)*cos(angle*3.14159265359/180)));
                        dSigma_dOmega=dSigma_dOmega*dSigma_dOmega;

                        dSigma_dOmega=dSigma_dOmega/(4*E_CM*E_CM*sin(angle*3.14159265359/180)*sin(angle*3.14159265359/180)
                                *sin(angle*3.14159265359/180)*sin(angle*3.14159265359/180));
                        dSigma_dOmega=dSigma_dOmega*1e18;
                        dSigma_dOmega=dSigma_dOmega*.3892e-3;   //barns
                        dSigma_dOmega=dSigma_dOmega/2;          //2 electrons for LH2
                        fprintf(stdout," %f\t%f\n", angle, dSigma_dOmega);
                        }

}

Creating a Makefile with contents:

CC = gcc
DiffXSect: MollerDiffXSect.o
        $(CC) $(CFLAGS) MollerDiffXSect.o  -lm -o DiffXSect
MollerDiffXSect.o: MollerDiffXSect.c
        $(CC)  $(CFLAGS) -c MollerDiffXSect.c


The program can be run with the commands:

make DiffXSect
./DiffXSect >DiffXSect.dat

This creates a data file with the scattering angle theta and the corresponding theoretical Moller differential cross-section for said angle. A c++ macro can be written to input this into root

void MollerDiffXSect2Root()
{
    struct evt_t
        {
                Int_t event;
                Float_t Angle, dSigma_dOmega;
        };
  ifstream in;
  in.open("DiffXSect.dat");
  evt_t evt;
  Int_t nlines=0;

  int count=0;
  TFile *f = new TFile("DiffXSect.root","RECREATE");

  TTree *tree = new TTree("DiffXSect","Moller Diff Xsect");

  TH1F *Th=new TH1F("Theory","Theoretical Differential Cross Section",360,90,180);

  tree->Branch("evt",&evt.event,"event/F:Angle/F:dSigma_dOmega");
  while(in.good())
        {
                evt.event=nlines;
                in >> evt.Angle >> evt.dSigma_dOmega;
                        if(nlines==count)
                        {
                                printf( " %d  %f %f\n",evt.event, evt.Angle, evt.dSigma_dOmega);
                                count=count+4;
                        }
                 nlines++;
                tree->Fill();
                Th->Fill(evt.Angle,evt.dSigma_dOmega);
}
 tree->Print();
 tree->Write();
 f->Write();
 in.close();
 delete tree;
 delete f;
}

A data file is created with the differential cross-section for the scattering angle theta, by increments of 1

90.000000      0.000008
 90.500000      0.000008
 91.000000      0.000008
 91.500000      0.000008
 92.000000      0.000008
 92.500000      0.000008
 93.000000      0.000008
 93.500000      0.000008
 94.000000      0.000008
 94.500000      0.000008
 95.000000      0.000008
 95.500000      0.000009
 96.000000      0.000009
 96.500000      0.000009
 97.000000      0.000009
 97.500000      0.000009
 98.000000      0.000009
 98.500000      0.000009
 99.000000      0.000009
 99.500000      0.000009
 100.000000     0.000009
 100.500000     0.000009
 101.000000     0.000009
 101.500000     0.000009
 102.000000     0.000009
 102.500000     0.000009
 103.000000     0.000010
 103.500000     0.000010
 104.000000     0.000010
 104.500000     0.000010
 105.000000     0.000010
 105.500000     0.000010
 106.000000     0.000010
 106.500000     0.000010
 107.000000     0.000010
 107.500000     0.000011
 108.000000     0.000011
 108.500000     0.000011
 109.000000     0.000011
 109.500000     0.000011
110.000000     0.000011
 110.500000     0.000012
 111.000000     0.000012
 111.500000     0.000012
 112.000000     0.000012
 112.500000     0.000013
 113.000000     0.000013
 113.500000     0.000013
 114.000000     0.000013
 114.500000     0.000014
 115.000000     0.000014
 115.500000     0.000014
 116.000000     0.000014
 116.500000     0.000015
 117.000000     0.000015
 117.500000     0.000015
 118.000000     0.000016
 118.500000     0.000016
 119.000000     0.000016
 119.500000     0.000017
 120.000000     0.000017
 120.500000     0.000018
 121.000000     0.000018
 121.500000     0.000019
 122.000000     0.000019
 122.500000     0.000020
 123.000000     0.000020
 123.500000     0.000021
 124.000000     0.000021
 124.500000     0.000022
 125.000000     0.000023
 125.500000     0.000023
 126.000000     0.000024
 126.500000     0.000025
 127.000000     0.000026
 127.500000     0.000026
 128.000000     0.000027
 128.500000     0.000028
129.000000     0.000029
 129.500000     0.000030
 130.000000     0.000031
 130.500000     0.000032
 131.000000     0.000033
 131.500000     0.000035
 132.000000     0.000036
 132.500000     0.000037
 133.000000     0.000039
 133.500000     0.000040
 134.000000     0.000042
 134.500000     0.000043
 135.000000     0.000045
 135.500000     0.000047
 136.000000     0.000049
 136.500000     0.000051
 137.000000     0.000053
 137.500000     0.000056
 138.000000     0.000058
 138.500000     0.000061
 139.000000     0.000063
 139.500000     0.000066
 140.000000     0.000070
 140.500000     0.000073
 141.000000     0.000076
 141.500000     0.000080
 142.000000     0.000084
 142.500000     0.000088
 143.000000     0.000093
 143.500000     0.000098
 144.000000     0.000103
 144.500000     0.000109
 145.000000     0.000115
 145.500000     0.000121
 146.000000     0.000128
 146.500000     0.000136
 147.000000     0.000144
 147.500000     0.000152
148.000000     0.000162
 148.500000     0.000172
 149.000000     0.000183
 149.500000     0.000195
 150.000000     0.000208
 150.500000     0.000221
 151.000000     0.000237
 151.500000     0.000253
 152.000000     0.000271
 152.500000     0.000291
 153.000000     0.000312
 153.500000     0.000336
 154.000000     0.000362
 154.500000     0.000391
 155.000000     0.000422
 155.500000     0.000457
 156.000000     0.000495
 156.500000     0.000538
 157.000000     0.000586
 157.500000     0.000639
 158.000000     0.000698
 158.500000     0.000764
 159.000000     0.000838
 159.500000     0.000922
 160.000000     0.001016
 160.500000     0.001123
 161.000000     0.001245
 161.500000     0.001383
 162.000000     0.001542
 162.500000     0.001724
 163.000000     0.001934
 163.500000     0.002177
 164.000000     0.002460
 164.500000     0.002791
 165.000000     0.003179
 165.500000     0.003638
 166.000000     0.004183
 166.500000     0.004834
167.000000     0.005618
 167.500000     0.006568
 168.000000     0.007727
 168.500000     0.009156
 169.000000     0.010931
 169.500000     0.013159
 170.000000     0.015986
 170.500000     0.019616
 171.000000     0.024340
 171.500000     0.030579
 172.000000     0.038953
 172.500000     0.050406
 173.000000     0.066401
 173.500000     0.089281
 174.000000     0.122933
 174.500000     0.174058
 175.000000     0.254769
 175.500000     0.388214
 176.000000     0.621708
 176.500000     1.060403
 177.000000     1.964202
 177.500000     4.072398
 178.000000     9.941240
 178.500000     31.416433
 179.000000     159.035599
 179.500000     2544.472656
 180.000000     inf