]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/Infrastructure/AliFemtoEvent.cxx
e5a3461f0d61ce8e1bb6e0c80c5b248e91cce172
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / Infrastructure / AliFemtoEvent.cxx
1 /***************************************************************************
2  *
3  * $Id$
4  *
5  * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: AliFemtoMaker package
9  *   HbtEvent is the "transient microDST"  Objects of this class are
10  *   generated from the input data by a Reader, and then presented to
11  *   the Cuts of the various active Analyses.
12  *
13  ***************************************************************************
14  *
15  * $Log$
16  * Revision 1.2  2007-04-03 16:00:08  mchojnacki
17  * Changes to iprove memory managing
18  *
19  * Revision 1.1.1.1  2007/03/07 10:14:49  mchojnacki
20  * First version on CVS
21  *
22  * Revision 1.23  2005/08/19 21:19:11  chajecki
23  * line 326: the same change as in line 235
24  *
25  * Revision 1.22  2005/08/19 11:33:31  chajecki
26  * fix due to the last changes in MuDst
27  * line 235: TClonesArray* tracks=0; to TObjArray* tracks=0;
28  * see for more details:
29  * http://www.star.bnl.gov/HyperNews-star/protected/get/starsoft/5949.html
30  *
31  * Revision 1.21  2003/09/02 17:58:32  perev
32  * gcc 3.2 updates + WarnOff
33  *
34  * Revision 1.20  2003/01/31 19:43:20  magestro
35  * several casts added to remove compiler warnings
36  *
37  * Revision 1.19  2003/01/17 16:46:58  mercedes
38  * StMuEvent::refMult() added
39  *
40  * Revision 1.18  2002/11/19 23:27:37  renault
41  * New event constructor to find V0 daughters informations(helix for average
42  * separation calculation)
43  *
44  * Revision 1.17  2002/03/21 18:49:31  laue
45  * updated for new MuDst reader
46  *
47  * Revision 1.16  2001/12/06 16:47:13  laue
48  * l3 trigger algorithm added
49  *
50  * Revision 1.15  2001/11/14 21:07:21  lisa
51  * Fixed several small things (mostly discarded const) that caused fatal errors with gcc2.95.3
52  *
53  * Revision 1.14  2001/09/05 20:41:42  laue
54  * Updates of the hbtMuDstTree microDSTs
55  *
56  * Revision 1.13  2001/07/20 20:03:53  rcwells
57  * Added pT weighting and moved event angle cal. to event cut
58  *
59  * Revision 1.12  2001/06/23 21:55:17  laue
60  * AliFemtoCheckPdgIdList can take can not check for mother,particle,daughter
61  * Some output turned off
62  *
63  * Revision 1.11  2001/06/21 19:15:45  laue
64  * Modified fiels:
65  *   CTH.h : new constructor added
66  *   AliFemtoEvent, AliFemtoKink, AliFemtoTrack : constructors from the persistent
67  *                                   (TTree) classes added
68  *   AliFemtoLikeSignAnalysis : minor changes, for debugging
69  *   AliFemtoTypes: split into different files
70  * Added files: for the new TTree muDst's
71  *   StExceptions.cxx StExceptions.h AliFemtoEnumeration.h
72  *   AliFemtoHelix.h AliFemtoHisto.h AliFemtoString.h AliFemtoTFile.h
73  *   AliFemtoTTreeEvent.cxx AliFemtoTTreeEvent.h AliFemtoTTreeKink.cxx
74  *   AliFemtoTTreeKink.h AliFemtoTTreeTrack.cxx AliFemtoTTreeTrack.h
75  *   AliFemtoTTreeV0.cxx AliFemtoTTreeV0.h AliFemtoVector.h
76  *
77  * Revision 1.10  2001/05/15 15:30:16  rcwells
78  * Added magnetic field to AliFemtoEvent
79  *
80  * Revision 1.9  2000/08/31 22:31:31  laue
81  * AliFemtoAnalysis: output changed (a little bit less)
82  * AliFemtoEvent: new version, members for reference mult added
83  * AliFemtoIOBinary: new IO for new AliFemtoEvent version
84  * AliFemtoTypes: TTree typedef to AliFemtoTTree added
85  * AliFemtoVertexAnalysis: overflow and underflow added
86  *
87  * Revision 1.8  2000/07/16 21:38:22  laue
88  * AliFemtoCoulomb.cxx AliFemtoSectoredAnalysis.cxx : updated for standalone version
89  * AliFemtoV0.cc AliFemtoV0.h : some cast to prevent compiling warnings
90  * AliFemtoParticle.cc AliFemtoParticle.h : pointers mTrack,mV0 initialized to 0
91  * AliFemtoIOBinary.cc : some printouts in #ifdef STHBTDEBUG
92  * AliFemtoEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
93  *                 solution
94  *
95  * Revision 1.7  2000/05/25 21:54:16  laue
96  * RotateZ implemented. Rotates momentum and helix around the z axis
97  *
98  * Revision 1.5  2000/02/18 21:32:23  laue
99  * franksTrackCut changed. If mCharge is set to '0' there will be no cut
100  * on charge. This is important for front-loaded cuts.
101  *
102  * copy constructor implemented for AliFemtoEvent, AliFemtoTrack and AliFemtoV0.
103  *
104  * franks1HistoD.cxx franks1HistoD.h franks2HistoD.cxx franks2HistoD.h
105  * removed. We can now (CC5 on Solaris) use the versions (no D)
106  *
107  * Revision 1.4  1999/09/16 18:47:59  lisa
108  * replace placeholder HbtV0Track stuff with Helens AliFemtoV0 classes
109  *
110  * Revision 1.3  1999/07/27 10:47:04  lisa
111  * now works in dev on linux and solaris - mistake in deleting picoEvents fixed
112  *
113  * Revision 1.2  1999/07/19 14:24:05  hardtke
114  * modifications to implement uDST
115  *
116  * Revision 1.1.1.1  1999/06/29 16:02:57  lisa
117  * Installation of AliFemtoMaker
118  *
119  **************************************************************************/
120
121 #include "Infrastructure/AliFemtoEvent.h"
122 #include "Infrastructure/AliFemtoTrack.h"
123 #include "Infrastructure/AliFemtoV0.h"
124 #include "Infrastructure/AliFemtoXi.h"
125 #include "Infrastructure/AliFemtoKink.h"
126 #include "Base/AliFemtoTrackCut.h"
127 #include "Base/AliFemtoV0Cut.h"
128 #include "Base/AliFemtoXiCut.h"
129 #include "Base/AliFemtoKinkCut.h"
130 #include "PhysicalConstants.h"
131 #include "SystemOfUnits.h"
132
133 // Mike removed all of the AliFemtoTTree stuff here 21apr2006 - it was not used for a long time.
134
135
136
137 //___________________
138 AliFemtoEvent::AliFemtoEvent(){
139   fPrimVertPos[0]=-999.0;
140   fPrimVertPos[1]=-999.0;
141   fPrimVertPos[2]=-999.0;
142   fTrackCollection = new AliFemtoTrackCollection;
143   fV0Collection = new AliFemtoV0Collection;
144   fXiCollection = new AliFemtoXiCollection;
145   fKinkCollection = new AliFemtoKinkCollection;
146   fMagneticField=0.0;
147 }
148 //___________________
149 AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoXiCut* xCut, AliFemtoKinkCut* kCut){ // copy constructor with track and v0 cuts
150   //cout << "AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoV0Cut* kCut)" << endl;
151   fEventNumber = ev.fEventNumber;
152   fRunNumber = ev.fRunNumber;
153   
154   fZDCN1Energy=ev.fZDCN1Energy;     
155   fZDCP1Energy=ev.fZDCP1Energy;      
156   fZDCN2Energy=ev.fZDCN2Energy;      
157   fZDCP2Energy=ev.fZDCP2Energy;      
158   fZDCEMEnergy=ev.fZDCEMEnergy;
159   fZDCParticipants=ev.fZDCParticipants;
160   fNumberOfTracks = ev.fNumberOfTracks;
161   fMagneticField= ev.fMagneticField;
162   
163   fTriggerMask=ev.fTriggerMask;     // Trigger Type (mask)
164   fTriggerCluster=ev.fTriggerCluster;
165   // create collections
166   fTrackCollection = new AliFemtoTrackCollection;
167   fV0Collection = new AliFemtoV0Collection;
168   fXiCollection = new AliFemtoXiCollection;
169   fKinkCollection = new AliFemtoKinkCollection;
170   // copy track collection  
171   for ( AliFemtoTrackIterator tIter=ev.fTrackCollection->begin(); tIter!=ev.fTrackCollection->end(); tIter++) {
172     if ( !tCut || tCut->Pass(*tIter) ) {
173       AliFemtoTrack* trackCopy = new AliFemtoTrack(**tIter);
174       fTrackCollection->push_back(trackCopy);
175     }
176   }
177   // copy v0 collection
178   for ( AliFemtoV0Iterator vIter=ev.fV0Collection->begin(); vIter!=ev.fV0Collection->end(); vIter++) {
179     if ( !vCut || vCut->Pass(*vIter) ) {
180       AliFemtoV0* v0Copy = new AliFemtoV0(**vIter);
181       fV0Collection->push_back(v0Copy);
182     }
183   }
184   // copy xi collection
185   for ( AliFemtoXiIterator xIter=ev.fXiCollection->begin(); xIter!=ev.fXiCollection->end(); xIter++) {
186     if ( !xCut || xCut->Pass(*xIter) ) {
187       AliFemtoXi* xiCopy = new AliFemtoXi(**xIter);
188       fXiCollection->push_back(xiCopy);
189     }
190   }
191   // copy kink collection  
192   for ( AliFemtoKinkIterator kIter=ev.fKinkCollection->begin(); kIter!=ev.fKinkCollection->end(); kIter++) {
193     if ( !kCut || kCut->Pass(*kIter) ) {
194       //cout << " kinkCut passed " << endl;
195       AliFemtoKink* kinkCopy = new AliFemtoKink(**kIter);
196       fKinkCollection->push_back(kinkCopy);
197     }
198   }
199 }
200 //___________________
201 AliFemtoEvent::~AliFemtoEvent(){
202 #ifdef STHBTDEBUG
203   cout << " AliFemtoEvent::~AliFemtoEvent() " << endl;
204 #endif
205   for (AliFemtoTrackIterator iter=fTrackCollection->begin();iter!=fTrackCollection->end();iter++){
206     delete *iter;
207   }
208   fTrackCollection->clear();
209   delete fTrackCollection;
210   //must do the same for the V0 collection
211   for (AliFemtoV0Iterator V0iter=fV0Collection->begin();V0iter!=fV0Collection->end();V0iter++){
212     delete *V0iter;
213   }//added by M Chojnacki To avodid memory leak 
214   fV0Collection->clear();
215   delete fV0Collection;
216   //must do the same for the Xi collection
217   for (AliFemtoXiIterator XiIter=fXiCollection->begin();XiIter!=fXiCollection->end();XiIter++){
218     delete *XiIter;
219   }
220   fXiCollection->clear();
221   delete fXiCollection;
222   //must do the same for the Kink collection
223   for (AliFemtoKinkIterator kinkIter=fKinkCollection->begin();kinkIter!=fKinkCollection->end();kinkIter++){
224     delete *kinkIter;
225   }
226   fKinkCollection->clear();
227   delete fKinkCollection;
228 }
229 //___________________
230
231
232
233 void AliFemtoEvent::SetEventNumber(const unsigned short& event){fEventNumber = event;}
234 void AliFemtoEvent::SetRunNumber(const int& runNum){fRunNumber = runNum;}
235
236
237 void AliFemtoEvent::SetZDCN1Energy(const float& ZDCN1Energy){fZDCN1Energy=ZDCN1Energy;}
238 void AliFemtoEvent::SetZDCP1Energy(const float& ZDCP1Energy){fZDCP1Energy=ZDCP1Energy;}      
239 void AliFemtoEvent::SetZDCN2Energy(const float& ZDCN2Energy){fZDCN2Energy=ZDCN2Energy;}      
240 void AliFemtoEvent::SetZDCP2Energy(const float& ZDCP2Energy){fZDCP2Energy=ZDCP2Energy;}      
241 void AliFemtoEvent::SetZDCEMEnergy(const float& ZDCEMEnergy){fZDCEMEnergy=ZDCEMEnergy;}    
242 void AliFemtoEvent::SetZDCParticipants(const unsigned int& ZDCParticipants){fZDCParticipants=ZDCParticipants;}
243     
244
245 void AliFemtoEvent::SetNumberOfTracks(const unsigned short& tracks){fNumberOfTracks = tracks;}
246
247
248
249 void AliFemtoEvent::SetPrimVertPos(const AliFemtoThreeVector& vp){fPrimVertPos = vp;}
250 void AliFemtoEvent::SetMagneticField(const double& magF){fMagneticField = magF;}
251
252 void AliFemtoEvent::SetTriggerMask(const unsigned long int& TriggerMask) {fTriggerMask=TriggerMask;}
253 void AliFemtoEvent::SetTriggerCluster(const unsigned char& TriggerCluster) {fTriggerCluster=TriggerCluster;}
254
255
256 unsigned short AliFemtoEvent::EventNumber() const {return fEventNumber;}
257 int            AliFemtoEvent::RunNumber() const {return fRunNumber;}
258
259
260
261 unsigned short AliFemtoEvent::NumberOfTracks() const {return fNumberOfTracks;}
262
263 AliFemtoV0Collection* AliFemtoEvent::V0Collection() const {return fV0Collection;}
264 AliFemtoXiCollection* AliFemtoEvent::XiCollection() const {return fXiCollection;}
265 AliFemtoKinkCollection* AliFemtoEvent::KinkCollection() const {return fKinkCollection;}
266 AliFemtoTrackCollection* AliFemtoEvent::TrackCollection() const {return fTrackCollection;}
267 AliFemtoThreeVector AliFemtoEvent::PrimVertPos() const {return fPrimVertPos;}
268 double AliFemtoEvent::MagneticField() const {return fMagneticField;}
269 unsigned long int AliFemtoEvent::TriggerMask() const {return fTriggerMask;}
270 unsigned char AliFemtoEvent::TriggerCluster() const {return fTriggerCluster;}
271
272
273 float AliFemtoEvent::ZDCN1Energy() const {return fZDCN1Energy;}       
274 float AliFemtoEvent::ZDCP1Energy() const {return fZDCP1Energy;}       
275 float AliFemtoEvent::ZDCN2Energy() const {return fZDCN2Energy;}       
276 float AliFemtoEvent::ZDCP2Energy() const {return fZDCP2Energy;}       
277 float AliFemtoEvent::ZDCEMEnergy() const {return fZDCEMEnergy;}   
278 unsigned int  AliFemtoEvent::ZDCParticipants() const {return fZDCParticipants;}
279
280 //----------------------------- below here is only for star
281
282 double AliFemtoEvent::UncorrectedNumberOfNegativePrimaries() const
283 {
284   return NumberOfTracks()/2;
285 }
286
287 double AliFemtoEvent::UncorrectedNumberOfPrimaries() const
288 {
289   return NumberOfTracks();
290 }
291
292