StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TSkimPionEvent.cxx
1 // Implementation file for SkimPionEvent and components
2 
3 #include "TSkimPionEvent.h"
4 
5 ClassImp(TSkimPionEvent)
6 ClassImp(TSkimPionCandidate)
7 ClassImp(THit)
8 
9 
10 TClonesArray* TSkimPionEvent::aSkimPionCandidates = 0;
11 TClonesArray* TSkimPionEvent::aHits = 0;
12 
13 // TSkimPionEvent class
14 
16  if (!aSkimPionCandidates) aSkimPionCandidates = new TClonesArray("TSkimPionCandidate", 50);
17  m_SkimPionCandidates = aSkimPionCandidates;
18  if (!aHits) aHits = new TClonesArray("THit", 50);
19  m_Hits = aHits;
20  m_EventNo = 0;
21  m_RunNo = 0;
22  m_FillNo = 0;
23  m_VertexZ = 0;
24  m_IsMB = 0;
25  m_IsHTTPL2 = 0;
26  m_IsHTTPL2_Test = 0;
27  m_IsSoftHTTPL2 = 0;
28  m_IsSoftMB = 0;
29  m_HiTowerAdc6Bit = 0;
30  m_BEMCPoints = 0;
31  m_PrescaleMB = 0;
32  m_PrescaleHTTPL2 = 0;
33  m_PrescaleHTTPL2_Test = 0;
34  m_BBCTrig = 0;
35  m_NPi0Candidates = 0;
36  m_NHits = 0;
37  m_BunchX48 = 0;
38  m_BunchX7 = 0;
39  m_SpinBit4 = 0;
40  m_MaskedXing = 0;
41  m_ValidSpin = 0;
42  m_PolLong = 0;
43  m_DbSpinBit = 0;
44  m_BBCVertexZ = 0;
45  m_OnlyBBCVtx = 0;
46  m_BBCTimeBin = 0;
47 }
48 
49 TSkimPionEvent::~TSkimPionEvent() {
50  Clear();
51 }
52 
53 void TSkimPionEvent::Clear(const Option_t*) {
54  //cout << "Clearing TSkimPionEvent..." << endl;
55  m_EventNo = 0;
56  m_RunNo = 0;
57  m_FillNo = 0;
58  m_VertexZ = 0;
59  m_IsMB = 0;
60  m_IsHTTPL2 = 0;
61  m_IsHTTPL2_Test = 0;
62  m_IsSoftHTTPL2 = 0;
63  m_IsSoftMB = 0;
64  m_HiTowerAdc6Bit = 0;
65  m_BEMCPoints = 0;
66  m_PrescaleMB = 0;
67  m_PrescaleHTTPL2 = 0;
68  m_PrescaleHTTPL2_Test = 0;
69  m_BBCTrig = 0;
70  m_NPi0Candidates = 0;
71  m_NHits = 0;
72  m_BunchX48 = 0;
73  m_BunchX7 = 0;
74  m_SpinBit4 = 0;
75  m_MaskedXing = 0;
76  m_ValidSpin = 0;
77  m_PolLong = 0;
78  m_DbSpinBit = 0;
79  m_BBCVertexZ = 0;
80  m_OnlyBBCVtx = 0;
81  m_BBCTimeBin = 0;
82  m_SkimPionCandidates->Clear();
83  m_Hits->Clear();
84  //cout << "Clear done!" << endl;
85 }
86 void TSkimPionEvent::Reset(Option_t * /*option*/)
87 {
88  // Static function to reset all static objects for this event
89 
90  delete aSkimPionCandidates;
91  aSkimPionCandidates = 0;
92  delete aHits;
93  aHits = 0;
94 }
95 
96 
97 TSkimPionCandidate* TSkimPionEvent::AddSkimPionCandidate(TSkimPionCandidate& cand) {
98  //cout << "Adding SkimPion candidate after " << m_NSkimPionCandidates << endl;
99  TClonesArray &aCand = *m_SkimPionCandidates;
100  TSkimPionCandidate *piCand = new(aCand[m_NPi0Candidates++]) TSkimPionCandidate(cand);
101  //cout << "Added Candidate " << m_NSkimPionCandidates << endl;
102  return piCand;
103 }
104 
105 
106 THit* TSkimPionEvent::AddHit(THit& cand) {
107  //cout << "Adding SkimPion candidate after " << m_NSkimPionCandidates << endl;
108  TClonesArray &aCand = *m_Hits;
109  THit *piCand = new(aCand[m_NHits++]) THit(cand);
110  //cout << "Added Candidate " << m_NSkimPionCandidates << endl;
111  return piCand;
112 }
113 
114 
115 TSkimPionCandidate::TSkimPionCandidate() : TObject(){
116  m_Pt = m_Mass = 0;
117 }
118 
119 TSkimPionCandidate::TSkimPionCandidate(const TSkimPionCandidate& orig) : TObject(orig) {
120  // copy a SkimPionCandidate
121  m_Pt = orig.m_Pt;
122  m_Mass = orig.m_Mass;
123  m_Eta = orig.m_Eta;
124  m_Phi = orig.m_Phi;
125  m_Asymmetry = orig.m_Asymmetry;
126  m_CosAngle = orig.m_CosAngle;
127  m_TowerId1 = orig.m_TowerId1;
128  m_TowerId2 = orig.m_TowerId2;
129  m_ChargedAssociation1 = orig.m_ChargedAssociation1;
130  m_ChargedAssociation2 = orig.m_ChargedAssociation2;
131  m_SMDFlagg1 = orig.m_SMDFlagg1;
132  m_SMDFlagg2 = orig.m_SMDFlagg2;
133  m_Energy1 = orig.m_Energy1;
134  m_Energy2 = orig.m_Energy2;
135  m_TowerEnergy1 = orig.m_TowerEnergy1;
136  m_TowerEnergy2 = orig.m_TowerEnergy2;
137  m_SMDe1 = orig.m_SMDe1;
138  m_SMDp1 = orig.m_SMDp1;
139  m_SMDe2 = orig.m_SMDe2;
140  m_SMDp2 = orig.m_SMDp2;
141  m_Phi1 = orig.m_Phi1;
142  m_Eta1 = orig.m_Eta1;
143  m_Phi2 = orig.m_Phi2;
144  m_Eta2 = orig.m_Eta2;
145 }
146 
147 void TSkimPionCandidate::SetAll(Float_t data[24]) {
148  m_Pt = data[0];
149  m_Mass = data[1];
150  m_Eta = data[2];
151  m_Phi = data[3];
152  m_Asymmetry = data[4];
153  m_CosAngle = data[5];
154  m_TowerId1 = data[6];
155  m_TowerId2 = data[7];
156  m_ChargedAssociation1 = (Int_t) data[8];
157  m_ChargedAssociation2 = (Int_t) data[9];
158  m_SMDFlagg1 = (Int_t)data[10];
159  m_SMDFlagg2 = (Int_t)data[11];
160  m_Energy1 = data[12];
161  m_Energy2 = data[13];
162  m_TowerEnergy1 = data[14];
163  m_TowerEnergy2 = data[15];
164  m_SMDe1 = data[16];
165  m_SMDp1 = data[17];
166  m_SMDe2 = data[18];
167  m_SMDp2 = data[19];
168  m_Eta1 = data[20];
169  m_Phi1 = data[21];
170  m_Eta2 = data[22];
171  m_Phi2 = data[23];
172 
173 }
174 
175 THit::THit() : TObject() {
176  m_X = 0;
177  m_Y = 0;
178  m_Z = 0;
179  m_Id = 0;
180  m_Energy = 0;
181  m_Pt = 0;
182  m_NTracks = 0;
183  m_SMDFlag = 0;
184  m_EnergySMDe = 0;
185  m_EnergySMDp = 0;
186  m_EnergyTower = 0;
187  m_SizeSMDe = 0;
188  m_SizeSMDp = 0;
189  m_SizeTower = 0;
190  m_Phi = 0;
191  m_Eta = 0;
192 }
193 
194 THit::THit(const THit& orig) : TObject(orig) {
195  m_X = orig.m_X;
196  m_Y = orig.m_Y;
197  m_Z = orig.m_Z;
198  m_Id = orig.m_Id;
199  m_Energy = orig.m_Energy;
200  m_Pt = orig.m_Pt;
201  m_NTracks = orig.m_NTracks;
202  m_SMDFlag = orig.m_SMDFlag;
203  m_EnergySMDe = orig.m_EnergySMDe;
204  m_EnergySMDp = orig.m_EnergySMDp;
205  m_EnergyTower = orig.m_EnergyTower;
206  m_SizeSMDe = orig.m_SizeSMDe;
207  m_SizeSMDp = orig.m_SizeSMDp;
208  m_SizeTower = orig.m_SizeTower;
209  m_Phi = orig.m_Phi;
210  m_Eta = orig.m_Eta;
211 }
212 
213 void THit::SetAll(Float_t data[16]) {
214  m_X = data[0];
215  m_Y = data[1];
216  m_Z = data[2];
217  m_Id = (Int_t) data[3];
218  m_Energy = data[4];
219  m_Pt = data[5];
220  m_NTracks = (Int_t) data[6];
221  m_SMDFlag = (Int_t) data[7];
222  m_EnergySMDe = data[8];
223  m_EnergySMDp = data[9];
224  m_EnergyTower = data[10];
225  m_SizeSMDe = data[11];
226  m_SizeSMDp = data[12];
227  m_SizeTower = data[13];
228  m_Phi = data[14];
229  m_Eta = data[15];
230 }