1 | #include "MMcEvt.hxx"
|
---|
2 |
|
---|
3 | #include <iostream.h>
|
---|
4 | #include <fstream.h>
|
---|
5 |
|
---|
6 |
|
---|
7 | //==========
|
---|
8 | // MMcEvt
|
---|
9 | //
|
---|
10 | // This class handles and contains the MonteCarlo information
|
---|
11 | // with which the events have been generated
|
---|
12 | // This information exists for each event.
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 | ClassImp(MMcEvt);
|
---|
17 |
|
---|
18 |
|
---|
19 |
|
---|
20 | MMcEvt::MMcEvt() {
|
---|
21 | //
|
---|
22 | // default constructor
|
---|
23 | // set all values to zero
|
---|
24 | fName = "MMcEvt";
|
---|
25 | fTitle = "Event info from Monte Carlo";
|
---|
26 |
|
---|
27 | fPartId = 0 ;
|
---|
28 | fEnergy = 0. ;
|
---|
29 |
|
---|
30 | fTheta = 0. ;
|
---|
31 | fPhi = 0. ;
|
---|
32 |
|
---|
33 | fCoreD = 0. ;
|
---|
34 | fCoreX = 0. ;
|
---|
35 | fCoreY = 0. ;
|
---|
36 | fImpact = 0. ;
|
---|
37 |
|
---|
38 | fPhotIni = 0 ;
|
---|
39 | fPassPhotAtm = 0 ;
|
---|
40 | fPassPhotRef = 0 ;
|
---|
41 | fPassPhotCone = 0 ;
|
---|
42 | fPhotElfromShower = 0 ;
|
---|
43 | fPhotElinCamera = 0 ;
|
---|
44 | }
|
---|
45 |
|
---|
46 | MMcEvt::MMcEvt( UShort_t usPId,
|
---|
47 | Float_t fEner,
|
---|
48 | Float_t fThet,
|
---|
49 | Float_t fPhii,
|
---|
50 | Float_t fCorD,
|
---|
51 | Float_t fCorX,
|
---|
52 | Float_t fCorY,
|
---|
53 | Float_t fImpa,
|
---|
54 | UInt_t uiPin,
|
---|
55 | UInt_t uiPat,
|
---|
56 | UInt_t uiPre,
|
---|
57 | UInt_t uiPco,
|
---|
58 | UInt_t uiPelS,
|
---|
59 | UInt_t uiPelC ) {
|
---|
60 |
|
---|
61 | fName = "MMcEvt";
|
---|
62 | fTitle = "Event info from Monte Carlo";
|
---|
63 | //
|
---|
64 | // constuctor II
|
---|
65 | //
|
---|
66 | // All datamembers are parameters.
|
---|
67 | //
|
---|
68 | // Don't use this memberfunction in analysis
|
---|
69 | //
|
---|
70 |
|
---|
71 | fPartId = usPId ;
|
---|
72 | fEnergy = fEner ;
|
---|
73 |
|
---|
74 | fTheta = fThet ;
|
---|
75 | fPhi = fPhii ;
|
---|
76 |
|
---|
77 | fCoreD = fCorD ;
|
---|
78 | fCoreX = fCorX ;
|
---|
79 | fCoreY = fCorY ;
|
---|
80 | fImpact = fImpa ;
|
---|
81 |
|
---|
82 | fPhotIni = uiPin ;
|
---|
83 | fPassPhotAtm = uiPat ;
|
---|
84 | fPassPhotRef = uiPre ;
|
---|
85 | fPassPhotCone = uiPco ;
|
---|
86 | fPhotElfromShower = uiPelS ;
|
---|
87 | fPhotElinCamera = uiPelC ;
|
---|
88 | }
|
---|
89 |
|
---|
90 |
|
---|
91 |
|
---|
92 | MMcEvt::~MMcEvt() {
|
---|
93 | //
|
---|
94 | // default destructor
|
---|
95 | //
|
---|
96 | }
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 | void MMcEvt::Clear(Option_t *opt) {
|
---|
102 | //
|
---|
103 | //
|
---|
104 | // reset all values to zero
|
---|
105 |
|
---|
106 | fPartId = 0 ;
|
---|
107 | fEnergy = 0. ;
|
---|
108 |
|
---|
109 | fTheta = 0. ;
|
---|
110 | fPhi = 0. ;
|
---|
111 |
|
---|
112 | fCoreD = 0. ;
|
---|
113 | fCoreX = 0. ;
|
---|
114 | fCoreY = 0. ;
|
---|
115 | fImpact = 0. ;
|
---|
116 |
|
---|
117 | fPhotIni = 0 ;
|
---|
118 | fPassPhotAtm = 0 ;
|
---|
119 | fPassPhotRef = 0 ;
|
---|
120 | fPassPhotCone = 0 ;
|
---|
121 | fPhotElfromShower = 0 ;
|
---|
122 | fPhotElinCamera = 0 ;
|
---|
123 | }
|
---|
124 |
|
---|
125 | void MMcEvt::Fill( UShort_t usPId,
|
---|
126 | Float_t fEner,
|
---|
127 | Float_t fThet,
|
---|
128 | Float_t fPhii,
|
---|
129 | Float_t fCorD,
|
---|
130 | Float_t fCorX,
|
---|
131 | Float_t fCorY,
|
---|
132 | Float_t fImpa,
|
---|
133 | UInt_t uiPin,
|
---|
134 | UInt_t uiPat,
|
---|
135 | UInt_t uiPre,
|
---|
136 | UInt_t uiPco,
|
---|
137 | UInt_t uiPelS,
|
---|
138 | UInt_t uiPelC ) {
|
---|
139 | //
|
---|
140 | // All datamembers are filled with the correspondin parameters.
|
---|
141 | //
|
---|
142 | // Don't use this memberfunction in analysis
|
---|
143 | //
|
---|
144 |
|
---|
145 | fPartId = usPId ;
|
---|
146 | fEnergy = fEner ;
|
---|
147 |
|
---|
148 | fTheta = fThet ;
|
---|
149 | fPhi = fPhii ;
|
---|
150 |
|
---|
151 | fCoreD = fCorD ;
|
---|
152 | fCoreX = fCorX ;
|
---|
153 | fCoreY = fCorY ;
|
---|
154 | fImpact = fImpa ;
|
---|
155 |
|
---|
156 | fPhotIni = uiPin ;
|
---|
157 | fPassPhotAtm = fPhotIni-uiPat ;
|
---|
158 | fPassPhotRef = fPassPhotAtm-uiPre ;
|
---|
159 | fPassPhotCone = uiPco ;
|
---|
160 | fPhotElfromShower = uiPelS ;
|
---|
161 | fPhotElinCamera = uiPelC ;
|
---|
162 | }
|
---|
163 |
|
---|
164 | /*
|
---|
165 | void MMcEvt::AsciiWrite(ofstream &fout) const
|
---|
166 | {
|
---|
167 | fout << fEnergy << " ";
|
---|
168 | fout << fTheta ;
|
---|
169 | }
|
---|
170 | */
|
---|
171 |
|
---|
172 | // --------------------------------------------------------------------------
|
---|
173 | //
|
---|
174 | // Print the contents of the container.
|
---|
175 | //
|
---|
176 | // if you specify an option only the requested data members are printed:
|
---|
177 | // allowed options are:
|
---|
178 | // id, energy, impact
|
---|
179 | //
|
---|
180 | void MMcEvt::Print(Option_t *opt) const
|
---|
181 | {
|
---|
182 | //
|
---|
183 | // print out the data member on screen
|
---|
184 | //
|
---|
185 | TString str(opt);
|
---|
186 | if (str.IsNull())
|
---|
187 | {
|
---|
188 | cout << endl;
|
---|
189 | cout << "Monte Carlo output:" << endl;
|
---|
190 | cout << " Particle Id: ";
|
---|
191 | switch(fPartId)
|
---|
192 | {
|
---|
193 | case kGAMMA:
|
---|
194 | cout << "Gamma" << endl;
|
---|
195 | break;
|
---|
196 | case kPROTON:
|
---|
197 | cout << "Proton" << endl;
|
---|
198 | break;
|
---|
199 | case kHELIUM:
|
---|
200 | cout << "Helium" << endl;
|
---|
201 | break;
|
---|
202 | }
|
---|
203 | cout << " Energy: " << fEnergy << "GeV" << endl;
|
---|
204 | cout << " Impactpar.: " << fImpact/100 << "m" << endl;
|
---|
205 | cout << " Photoelectrons: " << fPhotElfromShower << endl;
|
---|
206 | cout << endl;
|
---|
207 | return;
|
---|
208 | }
|
---|
209 | if (str.Contains("id", TString::kIgnoreCase))
|
---|
210 | switch(fPartId)
|
---|
211 | {
|
---|
212 | case kGAMMA:
|
---|
213 | cout << "Particle: Gamma" << endl;
|
---|
214 | break;
|
---|
215 | case kPROTON:
|
---|
216 | cout << "Particle: Proton" << endl;
|
---|
217 | break;
|
---|
218 | case kHELIUM:
|
---|
219 | cout << "Particle: Helium" << endl;
|
---|
220 | break;
|
---|
221 | }
|
---|
222 | if (str.Contains("energy", TString::kIgnoreCase))
|
---|
223 | cout << "Energy: " << fEnergy << "GeV" << endl;
|
---|
224 | if (str.Contains("impact", TString::kIgnoreCase))
|
---|
225 | cout << "Impact: " << fImpact << "cm" << endl;
|
---|
226 | }
|
---|