1 ///////////////////////////////////////////////////////////////////////////
3 // AliFemtoEvent: hold the information specific to the event and a //
5 // AliFemtoEvent is the "transient microDST" Objects of this class are //
6 // generated from the input data by a Reader, and then presented to //
7 // the Cuts of the various active Analyses. //
9 ///////////////////////////////////////////////////////////////////////////
10 #include "AliFemtoEvent.h"
11 #include "AliFemtoTrack.h"
12 #include "AliFemtoV0.h"
13 #include "AliFemtoXi.h"
14 #include "AliFemtoKink.h"
15 #include "AliFemtoTrackCut.h"
16 #include "AliFemtoV0Cut.h"
17 #include "AliFemtoXiCut.h"
18 #include "AliFemtoKinkCut.h"
19 #include "PhysicalConstants.h"
20 #include "SystemOfUnits.h"
21 #include "AliEventplane.h"
23 // Mike removed all of the AliFemtoTTree stuff here 21apr2006 - it was not used for a long time.
26 AliFemtoEvent::AliFemtoEvent():
33 fEstimateTracklets(0),
40 fIsCollisionCandidate(kTRUE),
55 fReactionPlaneAngle(0),
58 // Default constructor
59 fPrimVertPos[0]=-999.0;
60 fPrimVertPos[1]=-999.0;
61 fPrimVertPos[2]=-999.0;
62 fPrimVertCov[0]=0.000000000001;
63 fPrimVertCov[1]=0.000000000001;
64 fPrimVertCov[2]=0.000000000001;
65 fPrimVertCov[3]=0.000000000001;
66 fPrimVertCov[4]=0.000000000001;
67 fPrimVertCov[5]=0.000000000001;
68 fTrackCollection = new AliFemtoTrackCollection;
69 fV0Collection = new AliFemtoV0Collection;
70 fXiCollection = new AliFemtoXiCollection;
71 fKinkCollection = new AliFemtoKinkCollection;
75 AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoXiCut* xCut, AliFemtoKinkCut* kCut):
82 fEstimateTracklets(0),
89 fIsCollisionCandidate(kTRUE),
104 fReactionPlaneAngle(0),
106 { // copy constructor with track and v0 cuts
107 //cout << "AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev, AliFemtoTrackCut* tCut, AliFemtoV0Cut* vCut, AliFemtoV0Cut* kCut)" << endl;
108 fEventNumber = ev.fEventNumber;
109 fRunNumber = ev.fRunNumber;
111 SetPrimVertCov(ev.PrimVertCov());
113 fZDCN1Energy=ev.fZDCN1Energy;
114 fZDCP1Energy=ev.fZDCP1Energy;
115 fZDCN2Energy=ev.fZDCN2Energy;
116 fZDCP2Energy=ev.fZDCP2Energy;
117 fZDCEMEnergy=ev.fZDCEMEnergy;
118 fZDCParticipants=ev.fZDCParticipants;
119 fNumberOfTracks = ev.fNumberOfTracks;
120 fNormalizedMult = ev.fNormalizedMult;
121 fEstimateITSTPC = ev.fEstimateITSTPC;
122 fEstimateTracklets = ev.fEstimateTracklets;
123 fEstimateITSPure = ev.fEstimateITSPure;
124 fCentralityV0 = ev.fCentralityV0;
125 fCentralityFMD = ev.fCentralityFMD;
126 fCentralitySPD1 = ev.fCentralitySPD1;
127 fCentralityTrk = ev.fCentralityTrk;
128 fMagneticField= ev.fMagneticField;
129 fIsCollisionCandidate = ev.fIsCollisionCandidate;
131 fTriggerMask=ev.fTriggerMask; // Trigger Type (mask)
132 fTriggerCluster=ev.fTriggerCluster;
133 fReactionPlaneAngle=ev.fReactionPlaneAngle;
136 // create collections
137 fTrackCollection = new AliFemtoTrackCollection;
138 fV0Collection = new AliFemtoV0Collection;
139 fXiCollection = new AliFemtoXiCollection;
140 fKinkCollection = new AliFemtoKinkCollection;
141 // copy track collection
142 for ( AliFemtoTrackIterator tIter=ev.fTrackCollection->begin(); tIter!=ev.fTrackCollection->end(); tIter++) {
143 if ( !tCut || tCut->Pass(*tIter) ) {
144 AliFemtoTrack* trackCopy = new AliFemtoTrack(**tIter);
145 fTrackCollection->push_back(trackCopy);
148 // copy v0 collection
149 for ( AliFemtoV0Iterator vIter=ev.fV0Collection->begin(); vIter!=ev.fV0Collection->end(); vIter++) {
150 if ( !vCut || vCut->Pass(*vIter) ) {
151 AliFemtoV0* v0Copy = new AliFemtoV0(**vIter);
152 fV0Collection->push_back(v0Copy);
155 // copy xi collection
156 for ( AliFemtoXiIterator xIter=ev.fXiCollection->begin(); xIter!=ev.fXiCollection->end(); xIter++) {
157 if ( !xCut || xCut->Pass(*xIter) ) {
158 AliFemtoXi* xiCopy = new AliFemtoXi(**xIter);
159 fXiCollection->push_back(xiCopy);
162 // copy kink collection
163 for ( AliFemtoKinkIterator kIter=ev.fKinkCollection->begin(); kIter!=ev.fKinkCollection->end(); kIter++) {
164 if ( !kCut || kCut->Pass(*kIter) ) {
165 //cout << " kinkCut passed " << endl;
166 AliFemtoKink* kinkCopy = new AliFemtoKink(**kIter);
167 fKinkCollection->push_back(kinkCopy);
171 //___________________
172 AliFemtoEvent::AliFemtoEvent(const AliFemtoEvent& ev):
179 fEstimateTracklets(0),
186 fIsCollisionCandidate(kTRUE),
201 fReactionPlaneAngle(0),
205 fEventNumber = ev.fEventNumber;
206 fRunNumber = ev.fRunNumber;
208 SetPrimVertCov(ev.PrimVertCov());
210 fZDCN1Energy=ev.fZDCN1Energy;
211 fZDCP1Energy=ev.fZDCP1Energy;
212 fZDCN2Energy=ev.fZDCN2Energy;
213 fZDCP2Energy=ev.fZDCP2Energy;
214 fZDCEMEnergy=ev.fZDCEMEnergy;
215 fZDCParticipants=ev.fZDCParticipants;
216 fNumberOfTracks = ev.fNumberOfTracks;
217 fEstimateITSTPC = ev.fEstimateITSTPC;
218 fEstimateTracklets = ev.fEstimateTracklets;
219 fEstimateITSPure = ev.fEstimateITSPure;
220 fCentralityV0 = ev.fCentralityV0;
221 fCentralityFMD = ev.fCentralityFMD;
222 fCentralitySPD1 = ev.fCentralitySPD1;
223 fCentralityTrk = ev.fCentralityTrk;
224 fMagneticField= ev.fMagneticField;
225 fIsCollisionCandidate = ev.fIsCollisionCandidate;
226 fTriggerMask=ev.fTriggerMask; // Trigger Type (mask)
227 fTriggerCluster=ev.fTriggerCluster;
228 fReactionPlaneAngle=ev.fReactionPlaneAngle;
230 // create collections
231 fTrackCollection = new AliFemtoTrackCollection;
232 fV0Collection = new AliFemtoV0Collection;
233 fXiCollection = new AliFemtoXiCollection;
234 fKinkCollection = new AliFemtoKinkCollection;
235 // copy track collection
236 for ( AliFemtoTrackIterator tIter=ev.fTrackCollection->begin(); tIter!=ev.fTrackCollection->end(); tIter++) {
237 AliFemtoTrack* trackCopy = new AliFemtoTrack(**tIter);
238 fTrackCollection->push_back(trackCopy);
240 // copy v0 collection
241 for ( AliFemtoV0Iterator vIter=ev.fV0Collection->begin(); vIter!=ev.fV0Collection->end(); vIter++) {
242 AliFemtoV0* v0Copy = new AliFemtoV0(**vIter);
243 fV0Collection->push_back(v0Copy);
245 // copy xi collection
246 for ( AliFemtoXiIterator xIter=ev.fXiCollection->begin(); xIter!=ev.fXiCollection->end(); xIter++) {
247 AliFemtoXi* xiCopy = new AliFemtoXi(**xIter);
248 fXiCollection->push_back(xiCopy);
250 // copy kink collection
251 for ( AliFemtoKinkIterator kIter=ev.fKinkCollection->begin(); kIter!=ev.fKinkCollection->end(); kIter++) {
252 //cout << " kinkCut passed " << endl;
253 AliFemtoKink* kinkCopy = new AliFemtoKink(**kIter);
254 fKinkCollection->push_back(kinkCopy);
257 //______________________________
258 AliFemtoEvent& AliFemtoEvent::operator=(const AliFemtoEvent& aEvent)
260 // assignment operator
264 fEventNumber = aEvent.fEventNumber;
265 fRunNumber = aEvent.fRunNumber;
267 fZDCN1Energy=aEvent.fZDCN1Energy;
268 fZDCP1Energy=aEvent.fZDCP1Energy;
269 fZDCN2Energy=aEvent.fZDCN2Energy;
270 fZDCP2Energy=aEvent.fZDCP2Energy;
271 fZDCEMEnergy=aEvent.fZDCEMEnergy;
272 fZDCParticipants=aEvent.fZDCParticipants;
273 fNumberOfTracks = aEvent.fNumberOfTracks;
274 fEstimateITSTPC = aEvent.fEstimateITSTPC;
275 fEstimateTracklets = aEvent.fEstimateTracklets;
276 fEstimateITSPure = aEvent.fEstimateITSPure;
277 fCentralityV0 = aEvent.fCentralityV0;
278 fCentralityFMD = aEvent.fCentralityFMD;
279 fCentralitySPD1 = aEvent.fCentralitySPD1;
280 fCentralityTrk = aEvent.fCentralityTrk;
281 fNormalizedMult = aEvent.fNormalizedMult;
282 fEstimateITSTPC = aEvent.fEstimateITSTPC;
283 fEstimateTracklets = aEvent.fEstimateTracklets;
284 fEstimateITSPure = aEvent.fEstimateITSPure;
285 fMagneticField= aEvent.fMagneticField;
286 fIsCollisionCandidate = aEvent.fIsCollisionCandidate;
288 fTriggerMask=aEvent.fTriggerMask; // Trigger Type (mask)
289 fTriggerCluster=aEvent.fTriggerCluster;
290 fReactionPlaneAngle=aEvent.fReactionPlaneAngle;
292 if (fTrackCollection) {
293 for (AliFemtoTrackIterator iter=fTrackCollection->begin();iter!=fTrackCollection->end();iter++){
296 fTrackCollection->clear();
297 delete fTrackCollection;
299 fTrackCollection = new AliFemtoTrackCollection;
302 for (AliFemtoV0Iterator tV0iter=fV0Collection->begin();tV0iter!=fV0Collection->end();tV0iter++){
304 }//added by M Chojnacki To avodid memory leak
305 fV0Collection->clear();
306 delete fV0Collection;
309 fV0Collection = new AliFemtoV0Collection;
312 for (AliFemtoXiIterator tXiIter=fXiCollection->begin();tXiIter!=fXiCollection->end();tXiIter++){
315 fXiCollection->clear();
316 delete fXiCollection;
318 fXiCollection = new AliFemtoXiCollection;
320 if (fKinkCollection) {
321 for (AliFemtoKinkIterator kinkIter=fKinkCollection->begin();kinkIter!=fKinkCollection->end();kinkIter++){
324 fKinkCollection->clear();
325 delete fKinkCollection;
327 fKinkCollection = new AliFemtoKinkCollection;
329 // copy track collection
330 for ( AliFemtoTrackIterator tIter=aEvent.fTrackCollection->begin(); tIter!=aEvent.fTrackCollection->end(); tIter++) {
331 AliFemtoTrack* trackCopy = new AliFemtoTrack(**tIter);
332 fTrackCollection->push_back(trackCopy);
334 // copy v0 collection
335 for ( AliFemtoV0Iterator vIter=aEvent.fV0Collection->begin(); vIter!=aEvent.fV0Collection->end(); vIter++) {
336 AliFemtoV0* v0Copy = new AliFemtoV0(**vIter);
337 fV0Collection->push_back(v0Copy);
339 // copy xi collection
340 for ( AliFemtoXiIterator xIter=aEvent.fXiCollection->begin(); xIter!=aEvent.fXiCollection->end(); xIter++) {
341 AliFemtoXi* xiCopy = new AliFemtoXi(**xIter);
342 fXiCollection->push_back(xiCopy);
344 // copy kink collection
345 for ( AliFemtoKinkIterator kIter=aEvent.fKinkCollection->begin(); kIter!=aEvent.fKinkCollection->end(); kIter++) {
346 AliFemtoKink* kinkCopy = new AliFemtoKink(**kIter);
347 fKinkCollection->push_back(kinkCopy);
353 //___________________
354 AliFemtoEvent::~AliFemtoEvent(){
357 cout << " AliFemtoEvent::~AliFemtoEvent() " << endl;
359 for (AliFemtoTrackIterator iter=fTrackCollection->begin();iter!=fTrackCollection->end();iter++){
362 fTrackCollection->clear();
363 delete fTrackCollection;
364 //must do the same for the V0 collection
365 for (AliFemtoV0Iterator tV0iter=fV0Collection->begin();tV0iter!=fV0Collection->end();tV0iter++){
367 }//added by M Chojnacki To avodid memory leak
368 fV0Collection->clear();
369 delete fV0Collection;
370 //must do the same for the Xi collection
371 for (AliFemtoXiIterator tXiIter=fXiCollection->begin();tXiIter!=fXiCollection->end();tXiIter++){
374 fXiCollection->clear();
375 delete fXiCollection;
376 //must do the same for the Kink collection
377 for (AliFemtoKinkIterator kinkIter=fKinkCollection->begin();kinkIter!=fKinkCollection->end();kinkIter++){
380 fKinkCollection->clear();
381 delete fKinkCollection;
383 //___________________
387 void AliFemtoEvent::SetEventNumber(const unsigned short& event){fEventNumber = event;}
388 void AliFemtoEvent::SetRunNumber(const int& runNum){fRunNumber = runNum;}
391 void AliFemtoEvent::SetZDCN1Energy(const float& aZDCN1Energy){fZDCN1Energy=aZDCN1Energy;}
392 void AliFemtoEvent::SetZDCP1Energy(const float& aZDCP1Energy){fZDCP1Energy=aZDCP1Energy;}
393 void AliFemtoEvent::SetZDCN2Energy(const float& aZDCN2Energy){fZDCN2Energy=aZDCN2Energy;}
394 void AliFemtoEvent::SetZDCP2Energy(const float& aZDCP2Energy){fZDCP2Energy=aZDCP2Energy;}
395 void AliFemtoEvent::SetZDCEMEnergy(const float& aZDCEMEnergy){fZDCEMEnergy=aZDCEMEnergy;}
396 void AliFemtoEvent::SetZDCParticipants(const unsigned int& aZDCParticipants){fZDCParticipants=aZDCParticipants;}
398 void AliFemtoEvent::SetNumberOfTracks(const unsigned short& tracks){fNumberOfTracks = tracks;}
399 void AliFemtoEvent::SetNormalizedMult(const int& i){fNormalizedMult = i;}
400 void AliFemtoEvent::SetSPDMult(const int& i){fSPDMult = i;}
402 void AliFemtoEvent::SetPrimVertPos(const AliFemtoThreeVector& vp){fPrimVertPos = vp;}
403 void AliFemtoEvent::SetPrimVertCov(const double* v){
404 fPrimVertCov[0] = v[0];
405 fPrimVertCov[1] = v[1];
406 fPrimVertCov[2] = v[2];
407 fPrimVertCov[3] = v[3];
408 fPrimVertCov[4] = v[4];
409 fPrimVertCov[5] = v[5];
411 void AliFemtoEvent::SetMagneticField(const double& magF){fMagneticField = magF;}
412 void AliFemtoEvent::SetIsCollisionCandidate(const bool& is){fIsCollisionCandidate = is;}
414 void AliFemtoEvent::SetTriggerMask(const unsigned long int& aTriggerMask) {fTriggerMask=aTriggerMask;}
415 void AliFemtoEvent::SetTriggerCluster(const unsigned char& aTriggerCluster) {fTriggerCluster=aTriggerCluster;}
418 unsigned short AliFemtoEvent::EventNumber() const {return fEventNumber;}
419 int AliFemtoEvent::RunNumber() const {return fRunNumber;}
423 unsigned short AliFemtoEvent::NumberOfTracks() const {return fNumberOfTracks;}
425 AliFemtoV0Collection* AliFemtoEvent::V0Collection() const {return fV0Collection;}
426 AliFemtoXiCollection* AliFemtoEvent::XiCollection() const {return fXiCollection;}
427 AliFemtoKinkCollection* AliFemtoEvent::KinkCollection() const {return fKinkCollection;}
428 AliFemtoTrackCollection* AliFemtoEvent::TrackCollection() const {return fTrackCollection;}
429 AliFemtoThreeVector AliFemtoEvent::PrimVertPos() const {return fPrimVertPos;}
430 const double* AliFemtoEvent::PrimVertCov() const {return fPrimVertCov;}
431 double AliFemtoEvent::MagneticField() const {return fMagneticField;}
432 unsigned long int AliFemtoEvent::TriggerMask() const {return fTriggerMask;}
433 unsigned char AliFemtoEvent::TriggerCluster() const {return fTriggerCluster;}
434 bool AliFemtoEvent::IsCollisionCandidate() const {return fIsCollisionCandidate;}
437 float AliFemtoEvent::ZDCN1Energy() const {return fZDCN1Energy;}
438 float AliFemtoEvent::ZDCP1Energy() const {return fZDCP1Energy;}
439 float AliFemtoEvent::ZDCN2Energy() const {return fZDCN2Energy;}
440 float AliFemtoEvent::ZDCP2Energy() const {return fZDCP2Energy;}
441 float AliFemtoEvent::ZDCEMEnergy() const {return fZDCEMEnergy;}
442 unsigned int AliFemtoEvent::ZDCParticipants() const {return fZDCParticipants;}
444 void AliFemtoEvent::SetReactionPlaneAngle(const float& a) { fReactionPlaneAngle = a;}
445 float AliFemtoEvent::ReactionPlaneAngle() const { return fReactionPlaneAngle; }
446 void AliFemtoEvent::SetEP(AliEventplane* ep) { fEP = ep;}
447 AliEventplane* AliFemtoEvent::EP() const {return fEP; }
449 //----------------------------- below here is only for star
451 int AliFemtoEvent::UncorrectedNumberOfNegativePrimaries() const
453 return NumberOfTracks()/2;
456 int AliFemtoEvent::SPDMultiplicity() const
461 int AliFemtoEvent::UncorrectedNumberOfPrimaries() const
463 if (fNormalizedMult < -1) {
464 // Count number of normalized charged tracks
465 Int_t tNormTrackCount = 0;
466 for (AliFemtoTrackIterator iter=fTrackCollection->begin();iter!=fTrackCollection->end();iter++){
467 if (!((*iter)->Flags()&(AliFemtoTrack::kTPCrefit))) continue;
468 if ((*iter)->TPCncls() < 50) continue;
469 if ((*iter)->TPCchi2()/(*iter)->TPCncls() > 60.0) continue;
470 if ((*iter)->ImpactD() > 6.0) continue;
471 if ((*iter)->ImpactZ() > 6.0) continue;
472 if (fabs((*iter)->P().PseudoRapidity()) > 0.9) continue;
476 return tNormTrackCount;
479 return fNormalizedMult;
480 // return NumberOfTracks();
483 unsigned short AliFemtoEvent::MultiplicityEstimateITSTPC() const
485 return fEstimateITSTPC;
488 unsigned short AliFemtoEvent::MultiplicityEstimateTracklets() const
490 return fEstimateTracklets;
493 unsigned short AliFemtoEvent::MultiplicityEstimateITSPure() const
495 return fEstimateITSPure;
498 void AliFemtoEvent::SetMultiplicityEstimateITSTPC(const unsigned short &s)
503 void AliFemtoEvent::SetMultiplicityEstimateTracklets(const unsigned short &s)
505 fEstimateTracklets = s;
508 void AliFemtoEvent::SetMultiplicityEstimateITSPure(const unsigned short &s)
510 fEstimateITSPure = s;
513 void AliFemtoEvent::SetCentralityV0(const float &c)
518 void AliFemtoEvent::SetCentralityFMD(const float &c)
523 void AliFemtoEvent::SetCentralitySPD1(const float &c)
528 void AliFemtoEvent::SetCentralityTrk(const float &c)
533 float AliFemtoEvent::CentralityV0() const
535 return fCentralityV0;
538 float AliFemtoEvent::CentralityFMD() const
540 return fCentralityFMD;
543 float AliFemtoEvent::CentralitySPD1() const
545 return fCentralitySPD1;
548 float AliFemtoEvent::CentralityTrk() const
550 return fCentralityTrk;