source: trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.cxx@ 1544

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