1 ////////////////////////////////////////////////////////////////////////////
3 // AliFemtoAnalysisReactionPlane - Femtoscopic analysis which mixes event //
4 // with respect to the z position of the primary vertex and event total //
5 // multiplicity and uses only events in certain reaction plane angle bin //
7 ////////////////////////////////////////////////////////////////////////////
9 #include "AliFemtoAnalysisAzimuthal.h"
13 #include "AliFemtoParticleCollection.h"
14 #include "AliFemtoTrackCut.h"
15 #include "AliFemtoV0Cut.h"
16 #include "AliFemtoPairCut.h"
18 #include "AliFemtoKinkCut.h"
19 #include "AliFemtoPicoEventCollectionVector.h"
20 #include "AliFemtoPicoEventCollectionVectorHideAway.h"
23 ClassImp(AliFemtoAnalysisAzimuthal)
26 extern void FillHbtParticleCollection(AliFemtoParticleCut* partCut,
27 AliFemtoEvent* hbtEvent,
28 AliFemtoParticleCollection* partCollection);
31 //____________________________
32 AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(unsigned int binsVertex, double minVertex, double maxVertex,
33 unsigned int binsMult, double minMult, double maxMult, unsigned short binsRP)
37 fVertexZBins(binsVertex),
46 // mControlSwitch = 0;
47 fCorrFctnCollection= 0;
48 fCorrFctnCollection = new AliFemtoCorrFctnCollection;
49 fVertexZ[0] = minVertex;
50 fVertexZ[1] = maxVertex;
53 if (fMixingBuffer) delete fMixingBuffer;
54 fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
55 fMultBins,fMult[0],fMult[1],
56 fRPBins,0.0,TMath::Pi());
59 //____________________________
61 AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) :
62 AliFemtoSimpleAnalysis(),
65 fVertexZBins(a.fVertexZBins),
68 fMultBins(a.fMultBins) ,
75 fCorrFctnCollection= 0;
76 fCorrFctnCollection = new AliFemtoCorrFctnCollection;
77 fVertexZ[0] = a.fVertexZ[0];
78 fVertexZ[1] = a.fVertexZ[1];
79 fMult[0] = a.fMult[0];
80 fMult[1] = a.fMult[1];
81 if (fMixingBuffer) delete fMixingBuffer;
82 fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
83 fMultBins,fMult[0],fMult[1],
84 fRPBins,0.0,TMath::Pi());
85 // find the right event cut
86 fEventCut = a.fEventCut->Clone();
87 // find the right femto particle cut
88 fFemtoParticleCut = a.fFemtoParticleCut->Clone();
89 // find the right flow particle cut
90 fFlowParticleCut = a.fFlowParticleCut->Clone();
91 // find the right pair cut
92 fPairCut = a.fPairCut->Clone();
95 SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
96 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - event cut set " << endl;
98 if ( fFemtoParticleCut ) {
99 SetFirstParticleCut(fFemtoParticleCut); // this will set the myAnalysis pointer inside the cut
100 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - femto particle cut set " << endl;
102 if ( fFlowParticleCut ) {
103 SetSecondParticleCut(fFlowParticleCut); // this will set the myAnalysis pointer inside the cut
104 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - flow particle cut set " << endl;
107 SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
108 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - pair cut set " << endl;
111 AliFemtoCorrFctnIterator iter;
112 for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
113 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - looking for correlation functions " << endl;
114 AliFemtoCorrFctn* fctn = (*iter)->Clone();
115 if (fctn) AddCorrFctn(fctn);
116 else cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - correlation function not found " << endl;
118 fNumEventsToMix = a.fNumEventsToMix;
119 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - analysis copied " << endl;
122 AliFemtoAnalysisAzimuthal& AliFemtoAnalysisAzimuthal::operator=(const AliFemtoAnalysisAzimuthal& a)
124 // Assignment operator
128 fCorrFctnCollection= 0;
129 fCorrFctnCollection = new AliFemtoCorrFctnCollection;
130 fVertexZ[0] = a.fVertexZ[0];
131 fVertexZ[1] = a.fVertexZ[1];
132 fMult[0] = a.fMult[0];
133 fMult[1] = a.fMult[1];
134 if (fMixingBuffer) delete fMixingBuffer;
135 fPicoEventCollectionVectorHideAway = new AliFemtoPicoEventCollectionVectorHideAway(fVertexZBins,fVertexZ[0],fVertexZ[1],
136 fMultBins,fMult[0],fMult[1],
137 fRPBins,0.0,TMath::Pi());
138 // find the right event cut
139 fEventCut = a.fEventCut->Clone();
140 // find the right femto particle cut
141 fFemtoParticleCut = a.fFemtoParticleCut->Clone();
142 // find the right flow particle cut
143 fFlowParticleCut = a.fFlowParticleCut->Clone();
144 // find the right pair cut
145 fPairCut = a.fPairCut->Clone();
148 SetEventCut(fEventCut); // this will set the myAnalysis pointer inside the cut
149 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - event cut set " << endl;
151 if ( fFemtoParticleCut ) {
152 SetFirstParticleCut(fFemtoParticleCut); // this will set the myAnalysis pointer inside the cut
153 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - femto particle cut set " << endl;
155 if ( fFlowParticleCut ) {
156 SetSecondParticleCut(fFlowParticleCut); // this will set the myAnalysis pointer inside the cut
157 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - flow particle cut set " << endl;
160 SetPairCut(fPairCut); // this will set the myAnalysis pointer inside the cut
161 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - pair cut set " << endl;
164 AliFemtoCorrFctnIterator iter;
165 for (iter=a.fCorrFctnCollection->begin(); iter!=a.fCorrFctnCollection->end();iter++){
166 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - looking for correlation functions " << endl;
167 AliFemtoCorrFctn* fctn = (*iter)->Clone();
168 if (fctn) AddCorrFctn(fctn);
169 else cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - correlation function not found " << endl;
171 fNumEventsToMix = a.fNumEventsToMix;
172 cout << " AliFemtoAnalysisAzimuthal::AliFemtoAnalysisAzimuthal(const AliFemtoAnalysisAzimuthal& a) - analysis copied " << endl;
178 //____________________________
179 AliFemtoAnalysisAzimuthal::~AliFemtoAnalysisAzimuthal(){
180 // now delete every PicoEvent in the EventMixingBuffer and then the Buffer itself
181 delete fPicoEventCollectionVectorHideAway;
184 //_________________________
185 void AliFemtoAnalysisAzimuthal::ProcessEvent(const AliFemtoEvent* hbtEvent) {
186 // Perform event processing in bins of z vertex, multiplicity and Reaction Plane angle
187 // cout << " AliFemtoAnalysisAzimuthal::ProcessEvent(const AliFemtoEvent* hbtEvent) " << endl;
189 //****from AliFemtoSimpleAnalysis****
191 fPicoEvent=0; // we will get a new pico event, if not prevent corr. fctn to access old pico event
195 fFemtoParticleCut->EventBegin(hbtEvent);
196 fFlowParticleCut->EventBegin(hbtEvent);
197 fPairCut->EventBegin(hbtEvent);
199 for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
200 (*iter)->EventBegin(hbtEvent);
203 // event cut and event cut monitor
204 bool tmpPassEvent = fEventCut->Pass(hbtEvent);
206 fEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
208 fPicoEvent = new AliFemtoPicoEvent; // this is what we will make pairs from and put in Mixing Buffer, no memory leak. we will delete picoevents when they come out of the mixing buffer
209 FillHbtParticleCollection(fFemtoParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->FirstParticleCollection());
210 FillHbtParticleCollection(fFlowParticleCut,(AliFemtoEvent*)hbtEvent,fPicoEvent->SecondParticleCollection());
212 // get right mixing buffer
213 double vertexZ = hbtEvent->PrimVertPos().z();
214 double mult = hbtEvent->UncorrectedNumberOfPrimaries();
215 TVector2 tQ = GetQVector(fPicoEvent->SecondParticleCollection());
216 double tPsi=tQ.Phi()/2.;
217 if (tPsi > TMath::Pi()) tPsi -= TMath::Pi();
219 fMixingBuffer = fPicoEventCollectionVectorHideAway->PicoEventCollection(vertexZ,mult,fPsi);
220 if (!fMixingBuffer) {
221 if ( vertexZ < fVertexZ[0] ) fUnderFlowVertexZ++;
222 if ( vertexZ > fVertexZ[1] ) fOverFlowVertexZ++;
223 if ( mult < fMult[0] ) fUnderFlowMult++;
224 if ( mult > fMult[1] ) fOverFlowMult++;
228 //cout << "#particles in Collection: " << fPicoEvent->FirstParticleCollection()->size() << endl;
230 //switch which allows only using events with ParticleCollections containing a minimum number of entries
231 if (fPicoEvent->FirstParticleCollection()->size() >= fMinSizePartCollection ) {
232 fEventCut->FillCutMonitor(hbtEvent, tmpPassEvent);
235 //------ Make real pairs (assume identical) ------//
236 MakePairs("real", fPicoEvent->FirstParticleCollection() );
237 //cout << "AliFemtoAnalysisAzimuthal::ProcessEvent() - reals done ";
239 //---- Make pairs for mixed events, looping over events in mixingBuffer ----//
240 AliFemtoPicoEvent* storedEvent;
241 AliFemtoPicoEventIterator fPicoEventIter;
242 for (fPicoEventIter=MixingBuffer()->begin();fPicoEventIter!=MixingBuffer()->end();fPicoEventIter++){
243 storedEvent = *fPicoEventIter;
244 MakePairs("mixed",fPicoEvent->FirstParticleCollection(),
245 storedEvent->FirstParticleCollection() );
247 //cout << " - mixed done " << endl;
249 //--------- If mixing buffer is full, delete oldest event ---------//
250 if ( MixingBufferFull() ) {
251 delete MixingBuffer()->back();
252 MixingBuffer()->pop_back();
255 //-------- Add current event (fPicoEvent) to mixing buffer --------//
256 MixingBuffer()->push_front(fPicoEvent);
258 } // if ParticleCollections are big enough (mal jun2002)
260 fEventCut->FillCutMonitor(hbtEvent, !tmpPassEvent);
264 // if currentEvent is accepted by currentAnalysis cleanup for EbyE
265 fFemtoParticleCut->EventEnd(hbtEvent);
266 fFlowParticleCut->EventEnd(hbtEvent);
267 fPairCut->EventEnd(hbtEvent);
268 for (AliFemtoCorrFctnIterator iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
269 (*iter)->EventEnd(hbtEvent);
273 //_______________________________________________________________________________
274 void AliFemtoAnalysisAzimuthal::MakePairs(const char* typeIn, AliFemtoParticleCollection *partCollection1,
275 AliFemtoParticleCollection *partCollection2){
276 // Build pairs, check pair cuts, and call CFs' AddRealPair() or AddMixedPair() methods.
277 // If no second particle collection is specfied, make pairs within first particle collection.
279 string type = typeIn;
281 // int swpart = ((long int) partCollection1) % 2;
282 int swpart = fNeventsProcessed % 2;
284 AliFemtoPair* tPair = new AliFemtoPair;
285 AliFemtoCorrFctnIterator tCorrFctnIter;
286 AliFemtoParticleIterator tPartIter1, tPartIter2;
288 AliFemtoParticleIterator tStartOuterLoop = partCollection1->begin(); // always
289 AliFemtoParticleIterator tEndOuterLoop = partCollection1->end(); // will be one less if identical
290 AliFemtoParticleIterator tStartInnerLoop;
291 AliFemtoParticleIterator tEndInnerLoop;
292 if (partCollection2) { // Two collections:
293 tStartInnerLoop = partCollection2->begin(); // Full inner & outer loops
294 tEndInnerLoop = partCollection2->end();
296 else { // One collection:
297 tEndOuterLoop--; // Outer loop goes to next-to-last particle
298 tEndInnerLoop = partCollection1->end() ; // Inner loop goes to last particle
300 for (tPartIter1=tStartOuterLoop;tPartIter1!=tEndOuterLoop;tPartIter1++) {
301 if (!partCollection2){
302 tStartInnerLoop = tPartIter1;
305 tPair->SetTrack1(*tPartIter1);
306 for (tPartIter2 = tStartInnerLoop; tPartIter2!=tEndInnerLoop;tPartIter2++) {
307 tPair->SetTrack2(*tPartIter2);
309 //For getting the pair angle wrt EP
311 TVector2 tQ, tQVector;
312 float tPsi=0, mQx=0, mQy=0, PairAngleEP=0;
313 tQ = GetQVector(partCollection1);
315 mQx = tQ.X() - cos(2*(tPair->Track1()->FourMomentum().Phi()))*(tPair->Track1()->Track()->Pt()) - cos(2*(tPair->Track2()->FourMomentum().Phi()))*(tPair->Track2()->Track()->Pt());
316 mQy = tQ.Y() - sin(2*(tPair->Track1()->FourMomentum().Phi()))*(tPair->Track1()->Track()->Pt()) - sin(2*(tPair->Track2()->FourMomentum().Phi()))*(tPair->Track2()->Track()->Pt());
318 tQVector.Set(mQx,mQy);
320 tPsi=tQVector.Phi()/2.;
321 if (tPsi > TMath::Pi()) tPsi -= TMath::Pi();
323 PairAngleEP = (tPair->EmissionAngle() - tPsi);
324 tPair->SetPairAngleEP(PairAngleEP);
327 if (type == "mixed"){
328 float tPsi1=0, tPsi2=0, mQx1=0, mQx2=0,mQy1=0, mQy2=0, px1=0, px2=0, py1=0, py2=0, PairAngleEP=0;
329 TVector2 tQ1, tQ2, tQVector1, tQVector2, tP;
331 tQ1 = GetQVector(partCollection1);
332 tQ2 = GetQVector(partCollection2);
334 mQx1 = tQ1.X() - cos(2*(tPair->Track1()->FourMomentum().Phi()))*(tPair->Track1()->Track()->Pt());
335 mQx2 = tQ2.X() - cos(2*(tPair->Track2()->FourMomentum().Phi()))*(tPair->Track2()->Track()->Pt());
336 mQy1 = tQ1.Y() - sin(2*(tPair->Track1()->FourMomentum().Phi()))*(tPair->Track1()->Track()->Pt());
337 mQy2 = tQ2.Y() - sin(2*(tPair->Track2()->FourMomentum().Phi()))*(tPair->Track2()->Track()->Pt());
339 tQVector1.Set(mQx1,mQy1);
340 tQVector2.Set(mQx2,mQy2);
342 tPsi1=tQVector1.Phi()/2.;
343 if (tPsi1 > TMath::Pi()) tPsi1 -= TMath::Pi();
345 tPsi2=tQVector2.Phi()/2.;
346 if (tPsi2 > TMath::Pi()) tPsi2 -= TMath::Pi();
348 px1 = (tPair->Track1()->Track()->Pt())*cos(tPair->Track1()->FourMomentum().Phi() - tPsi1);
349 px2 = (tPair->Track2()->Track()->Pt())*cos(tPair->Track2()->FourMomentum().Phi() - tPsi2);
350 py1 = (tPair->Track1()->Track()->Pt())*sin(tPair->Track1()->FourMomentum().Phi() - tPsi1);
351 py2 = (tPair->Track2()->Track()->Pt())*sin(tPair->Track2()->FourMomentum().Phi() - tPsi2);
353 tP.Set(px1+px2, py1+py2);
354 PairAngleEP = tP.Phi();
356 tPair->SetPairAngleEP(PairAngleEP);
359 // The following lines have to be uncommented if you want pairCutMonitors
360 // they are not in for speed reasons
361 // bool tmpPassPair = fPairCut->Pass(tPair);
362 // fPairCut->FillCutMonitor(tPair, tmpPassPair);
363 // if ( tmpPassPair )
365 //---- If pair passes cut, loop over CF's and add pair to real/mixed ----//
367 if (!partCollection2) {
369 tPair->SetTrack1(*tPartIter2);
370 tPair->SetTrack2(*tPartIter1);
374 tPair->SetTrack1(*tPartIter1);
375 tPair->SetTrack2(*tPartIter2);
381 if (fPairCut->Pass(tPair)){
382 for (tCorrFctnIter=fCorrFctnCollection->begin();
383 tCorrFctnIter!=fCorrFctnCollection->end();tCorrFctnIter++){
384 AliFemtoCorrFctn* tCorrFctn = *tCorrFctnIter;
386 tCorrFctn->AddRealPair(tPair);
387 else if(type == "mixed")
388 tCorrFctn->AddMixedPair(tPair);
390 cout << "Problem with pair type, type = " << type.c_str() << endl;
393 } // loop over second particle
394 } // loop over first particle
399 //_____________________________________________
400 TVector2 AliFemtoAnalysisAzimuthal::GetQVector(AliFemtoParticleCollection* particlecollection){
405 if (!particlecollection) {
410 AliFemtoParticle* flowparticle;
411 AliFemtoParticleIterator pIter;
412 AliFemtoParticleIterator startLoop = particlecollection->begin();
413 AliFemtoParticleIterator endLoop = particlecollection->end();
414 for (pIter=startLoop;pIter!=endLoop;pIter++){
415 flowparticle = *pIter;
416 mQx += (cos(2*flowparticle->FourMomentum().Phi()))*(flowparticle->Track()->Pt());
417 mQy += (sin(2*flowparticle->FourMomentum().Phi()))*(flowparticle->Track()->Pt());
424 //__________________________________________________
425 double AliFemtoAnalysisAzimuthal::GetCurrentReactionPlane()
430 //_________________________
431 TList* AliFemtoAnalysisAzimuthal::GetOutputList()
433 // Collect the list of output objects to be written
435 TList *tOutputList = new TList();
436 TList *p1Cut = fFemtoParticleCut->GetOutputList();
438 TListIter nextp1(p1Cut);
439 while (TObject *obj = nextp1.Next()) {
440 tOutputList->Add(obj);
443 TList *pairCut = fPairCut->GetOutputList();
445 TIter nextpair(pairCut);
446 while (TObject *obj = nextpair()) {
447 tOutputList->Add(obj);
450 TList *eventCut = fEventCut->GetOutputList();
452 TIter nextevent(eventCut);
453 while (TObject *obj = nextevent()) {
454 tOutputList->Add(obj);
457 AliFemtoCorrFctnIterator iter;
458 for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){
459 TList *tListCf = (*iter)->GetOutputList();
461 TIter nextListCf(tListCf);
462 while (TObject *obj = nextListCf()) {
463 tOutputList->Add(obj);