13 #include "TStopwatch.h"
16 #include "AliAnalysisTask.h"
17 #include "AliAnalysisManager.h"
18 #include "AliTracker.h"
19 #include "AliESDEvent.h"
20 #include "AliESDInputHandler.h"
22 #include "AliMCEvent.h"
23 #include "AliMCEventHandler.h"
24 #include "AliESDtrackCuts.h"
25 #include "AliKineTrackCuts.h"
26 #include "AliMCParticle.h"
27 #include "AliESDVZERO.h"
28 #include "AliAnalysisTaskHIMultCorr.h"
29 #include "AliCentrality.h"
31 #include "AliESDVZERO.h"
32 #include "AliTriggerAnalysis.h"
33 #include "AliMultiplicity.h"
35 #include "AliMultiplicityCorrelations.h"
37 // Task for HI Multiplicity correlation checks
38 // Author: Jochen Thaeder <jochen@thaeder.de>
40 ClassImp(AliAnalysisTaskHIMultCorr)
42 #define USE_STREAMER 0
45 * ---------------------------------------------------------------------------------
46 * Constructor / Destructor
47 * ---------------------------------------------------------------------------------
50 //________________________________________________________________________
51 AliAnalysisTaskHIMultCorr::AliAnalysisTaskHIMultCorr(const char *name) :
52 AliAnalysisTaskSE(name),
57 fESD(NULL), fESDTrackCuts(NULL), fESDTrackCuts2(NULL),
60 fCentralitySPDBin(-1),
61 fCentralityVZEROBin(-1),
63 fCentralityVZERO(-1.),
65 fTriggerAnalysis(NULL),
67 fCorrObjCent0(NULL), fCorrObjCent1(NULL), fCorrObjCent2(NULL) {
71 fpcstream = new TTreeSRedirector("eventInfoCorr.root");
74 // Output slot #1 writes into a TList container
75 DefineOutput(1, TList::Class());
78 //________________________________________________________________________
79 AliAnalysisTaskHIMultCorr::~AliAnalysisTaskHIMultCorr() {
83 delete fTriggerAnalysis;
84 fTriggerAnalysis = NULL;
95 * ---------------------------------------------------------------------------------
97 * ---------------------------------------------------------------------------------
100 //________________________________________________________________________
101 void AliAnalysisTaskHIMultCorr::UserCreateOutputObjects() {
105 Bool_t oldStatus = TH1::AddDirectoryStatus();
106 TH1::AddDirectory(kFALSE);
108 fOutList = new TList;
109 fOutList->SetName(GetName()) ;
110 fOutList->SetOwner(kTRUE) ;
112 fTriggerAnalysis = new AliTriggerAnalysis;
114 // ------------------------------------------------------------------
116 // ------------------------------------------------------------------
118 fCorrObj = new AliMultiplicityCorrelations;
119 fCorrObj->Initialize("All");
120 fOutList->Add(fCorrObj->GetHistList());
122 fCorrObjCent0 = new AliMultiplicityCorrelations;
123 fCorrObjCent0->Initialize("Cent_0-5");
124 // fCorrObjCent0->SetCleanSample(1700.,2900.); // Cleaning of Sample
125 fOutList->Add(fCorrObjCent0->GetHistList());
127 fCorrObjCent1 = new AliMultiplicityCorrelations;
128 fCorrObjCent1->Initialize("Cent_80-90");
129 fOutList->Add(fCorrObjCent1->GetHistList());
131 fCorrObjCent2 = new AliMultiplicityCorrelations;
132 fCorrObjCent2->Initialize("Cent_70-80");
133 // fCorrObjCent2->SetCleanSample(0.,180.); // Cleaning of Sample
134 fOutList->Add(fCorrObjCent2->GetHistList());
138 fCorrObjCent0->SetIsMC();
139 fCorrObjCent1->SetIsMC();
140 fCorrObjCent2->SetIsMC();
144 fCorrObj->SetESDTrackCuts(fESDTrackCuts);
145 fCorrObjCent0->SetESDTrackCuts(fESDTrackCuts);
146 fCorrObjCent1->SetESDTrackCuts(fESDTrackCuts);
147 fCorrObjCent2->SetESDTrackCuts(fESDTrackCuts);
150 AliError("No ESD trackCuts!!");
152 if (fESDTrackCuts2) {
153 fCorrObj->SetESDTrackCuts2(fESDTrackCuts2);
154 fCorrObjCent0->SetESDTrackCuts2(fESDTrackCuts2);
155 fCorrObjCent1->SetESDTrackCuts2(fESDTrackCuts2);
156 fCorrObjCent2->SetESDTrackCuts2(fESDTrackCuts2);
159 // ------------------------------------------------------------------
160 // -- Centrality Distributions
161 // ------------------------------------------------------------------
163 fOutList->Add(new TH1F("fVZEROCentrality", "VZERO Centrality Distribution;Centrality;N_{Events}", 102,0.,101.));
164 fOutList->Add(new TH1F("fVZEROCentralityBin","VZERO Centrality Bin Distribution;Centrality;N_{Events}", 102,0.,101.));
166 fOutList->Add(new TH1F("fSPDCentrality", "SPD Centrality Distribution;Centrality;N_{Events}", 102,0.,101.));
167 fOutList->Add(new TH1F("fSPDCentralityBin","SPD Centrality Bin Distribution;Centrality;N_{Events}", 102,0.,101.));
169 fOutList->Add(new TH2F("fCorrCentrality",
170 "Centrality - SPD vs VZERO;Centrality_{SPD};Centrality_{VZERO}", 102,0.,101., 102,0.,101.));
171 fOutList->Add(new TH2F("fCorrCentralityBin",
172 "Centrality Bin - SPD vs VZERO;Centrality_{SPD};Centrality_{VZERO}", 102,0.,101., 102,0.,101.));
174 // ------------------------------------------------------------------
175 // -- Vertex : TPC - Tracks
176 // ------------------------------------------------------------------
178 fOutList->Add(new TH2F("fCorrVertexTracks",
179 "Tracks Vertex - Status vs Contributers;Status;N_{contributers}", 2,-1.,3., 500,0.,3000.));
180 fOutList->Add(new TH2F("fCrossCorrVertexTracks",
181 "Tracks Vertex - TPC Status vs Contributers;Status;N_{contributers}", 2,-1.,3., 500,0.,3000.));
183 fOutList->Add(new TH2F("fCorrVertexTPC",
184 "TPC Vertex - Status vs Contributers;Status;N_{contributers}", 2,-1.,3., 500,0.,3000.));
185 fOutList->Add(new TH2F("fCrossCorrVertexTPC",
186 "TPC Vertex - Tracks Status vs Contributers;Status;N_{contributers}", 2,-1.,3., 500,0.,3000.));
188 fOutList->Add(new TH2F("fCorrVertexNCont",
189 "N Contributers - Vertex Tracks vs Vertex TPC;N_{contributers}^{Tracks};N_{contributers}^{TPC}",
190 500,0.,3000., 500,0.,3000.));
192 fOutList->Add(new TH1F("fDeltaVx","Vertex Tracks - Vertex TPC #Deltax;#Delta X [cm]", 201,-10.,10.));
193 fOutList->Add(new TH1F("fDeltaVy","Vertex Tracks - Vertex TPC #Deltay;#Delta Y [cm]", 201,-10.,10.));
194 fOutList->Add(new TH1F("fDeltaVz","Vertex Tracks - Vertex TPC #Deltaz;#Delta z [cm]", 201,-10.,10.));
196 // ------------------------------------------------------------------
197 // -- Vertex Z : TPC - Tracks - SPD
198 // ------------------------------------------------------------------
200 fOutList->Add(new TH2F("fVzTPCvsSPD",
201 "Z - Vertex TPC vs Vertex SPD;Vz_{TPC} [cm];Vz_{SPD} [cm]", 401,-20.,20., 401,-20.,20.));
202 fOutList->Add(new TH2F("fVzTPCvsTracks",
203 "Z - Vertex TPC vs Vertex Tracks;Vz_{TPC} [cm];Vz_{Tracks} [cm]", 401,-20.,20., 401,-20.,20.));
204 fOutList->Add(new TH2F("fVzSPDvsTracks",
205 "Z - Vertex SPD vs Vertex Tracks;Vz_{SPD} [cm];Vz_{Tracks} [cm]", 401,-20.,20., 401,-20.,20.));
207 // ------------------------------------------------------------------
209 // ------------------------------------------------------------------
211 fOutList->Add(new TH1F("fHStat","Cut statistics", 20,0.,19));
212 fHStat = dynamic_cast<TH1F*>(fOutList->Last());
214 TH1::AddDirectory(oldStatus);
217 //________________________________________________________________________
218 void AliAnalysisTaskHIMultCorr::UserExec(Option_t *) {
219 // Called for each event
231 if ( !SetupEvent() ) {
233 (*fpcstream) <<"event"<<
234 "nTracksTPC=" << i1 <<
238 "v0Corr=" << f3 << "\n";
243 // -- Centrality dependence
244 // --------------------------
245 if (fCentralityBin < 0) {
247 (*fpcstream) <<"event"<<
248 "nTracksTPC=" << i1 <<
252 "v0Corr=" << f3 << "\n";
258 // ------------------
260 if (fCorrObj) iResult = fCorrObj->ProcessEvent(fESD);
263 (*fpcstream) <<"event"<<
264 "nTracksTPC=" << i1 <<
268 "v0Corr=" << f3 << "\n";
273 // -- After "Jochen's cut"
277 if (fCentralityBin == 0 && fCorrObjCent0) fCorrObjCent0->ProcessEvent(fESD);
278 else if (fCentralityBin == 80 && fCorrObjCent1) fCorrObjCent1->ProcessEvent(fESD);
279 else if (fCentralityBin == 70 && fCorrObjCent2) fCorrObjCent2->ProcessEvent(fESD);
281 // -- Marian's Streamer
282 // ----------------------
285 i1 = fCorrObj->GetNTracksTPC();
286 i2 = fCorrObj->GetNTracks();
287 f1 = fCorrObj->GetVZEROA();
288 f2 = fCorrObj->GetVZEROC();
289 f3 = fCorrObj->GetVZEROCorr();
292 (*fpcstream) <<"event"<<
293 "nTracksTPC=" << i1 <<
297 "v0Corr=" << f3 << "\n";
300 // -- Post output data
301 // ---------------------
302 PostData(1,fOutList);
308 * ---------------------------------------------------------------------------------
309 * Setup Methods - private
310 * ---------------------------------------------------------------------------------
313 //________________________________________________________________________
314 Bool_t AliAnalysisTaskHIMultCorr::SetupEvent() {
315 // Setup Reading of event
317 Bool_t aCuts[] = {kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE, kFALSE};
319 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
321 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
323 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>
324 (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
326 AliError("Could not get ESDInputHandler");
330 fESD = esdH->GetEvent();
332 AliError("fESD not available");
336 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
337 // -- Check object existence
338 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
340 const AliESDVertex* vtxESD = fESD->GetPrimaryVertexTracks();
341 const AliESDVertex* vtxESDTPC = fESD->GetPrimaryVertexTPC();
342 const AliESDVertex* vtxESDSPD = fESD->GetPrimaryVertexSPD();
343 const AliMultiplicity* multESD = fESD->GetMultiplicity();
346 AliError("No Tracks Vertex");
351 AliError("No TPC Vertex");
356 AliError("No SPD Vertex");
361 AliError("No Multiplicity");
365 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
366 // -- After Physics Selection;
367 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
371 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
373 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
376 if (!fTriggerAnalysis->ZDCTimeTrigger(fESD))
380 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
381 // -- Francesco Prino cut's
382 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
384 if (!vtxESDTPC->GetStatus())
387 if( vtxESDTPC->GetNContributors() < (-10.+0.25*multESD->GetNumberOfITSClusters(0)) )
390 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
391 // -- Vertex Cuts - Tracks
392 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
394 // if (!vtxESD->GetStatus())
397 if(vtxESDTPC->GetZv() > fMaxVertexZ || vtxESDTPC->GetZv() < (-1.*fMaxVertexZ))
400 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
402 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
404 if (GetCentralityBin() < 0)
407 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
408 // -- Marian's debug streamer
409 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
411 // TFile *inFile=(dynamic_cast<TChain*>(GetInputData(0)))->GetCurrentFile();
412 // TString fileName(inFile->GetName());
413 static Int_t runNo = fESD->GetRunNumber();
414 static UInt_t tt = fESD->GetTimeStamp();
415 static Float_t zvTPC = vtxESDTPC->GetZv();
416 static Float_t zvSPD = vtxESDSPD->GetZv();
417 static Float_t zvTra = vtxESD->GetZv();
418 static Int_t ncontTPCV = vtxESDTPC->GetNContributors();
419 static Int_t ncontSPDV = vtxESDSPD->GetNContributors();
420 static Int_t ncontTraV = vtxESD->GetNContributors();
421 static Bool_t cutPrino = aCuts[3];
422 static Bool_t cutZDCTi = aCuts[1];
423 static Int_t spd1 = multESD->GetNumberOfITSClusters(0);
424 static Int_t spd2 = multESD->GetNumberOfITSClusters(1);
426 (*fpcstream) << "event" <<
427 "run=" << runNo << //runNo
429 // "fname=" << fileName <<
430 // "eventNr=" << eventNumber<<
431 "zvTPC=" << zvTPC << //zvertex TPC
432 "zvSPD=" << zvSPD << //zvertex SPD
433 "zvTra=" << zvTra << //zvertex Tracks
434 "ncontTPCV"<< ncontTPCV << // N contributors to TPC vtx
435 "ncontSPDV"<< ncontSPDV << // N contributors to SPD vtx
436 "ncontTraV"<< ncontTraV << // N contributors to Tracks vtx
437 "cutPrino="<< cutPrino << //francecos cut
438 "cutZDCTi="<< cutZDCTi << //zdctiming cut
439 "spd1=" << spd1 << // N clus in SPD0
440 "spd2=" << spd2 << // N clus in SPD1
441 "centSPD=" << fCentralitySPD <<
442 "centSPDB="<< fCentralitySPDBin <<
443 "centV0=" << fCentralityVZERO <<
444 "centV0B=" << fCentralityVZEROBin;
446 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
447 // -- Fill statistics / reject event
448 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
450 Bool_t isRejected = kFALSE;
452 for (Int_t idx = 0; idx < 7; ++idx) {
459 for (Int_t idx = 0; idx < 7; ++idx) {
462 fHStat->Fill(10+idx);
468 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
469 // -- Fill Centrality Histograms
470 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
472 (static_cast<TH1F*>(fOutList->FindObject("fVZEROCentrality")))->Fill(fCentralityVZERO);
473 (static_cast<TH1F*>(fOutList->FindObject("fVZEROCentralityBin")))->Fill(fCentralityVZEROBin);
475 (static_cast<TH1F*>(fOutList->FindObject("fSPDCentrality")))->Fill(fCentralitySPD);
476 (static_cast<TH1F*>(fOutList->FindObject("fSPDCentralityBin")))->Fill(fCentralitySPDBin);
478 (static_cast<TH2F*>(fOutList->FindObject("fCorrCentrality")))->Fill(fCentralitySPD,fCentralityVZERO);
479 (static_cast<TH2F*>(fOutList->FindObject("fCorrCentralityBin")))->Fill(fCentralitySPDBin,fCentralityVZEROBin);
481 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
482 // -- Fill Vertex Histograms
483 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
485 (static_cast<TH2F*>(fOutList->FindObject("fCorrVertexTracks")))->Fill(vtxESD->GetStatus(),vtxESD->GetNContributors());
486 (static_cast<TH2F*>(fOutList->FindObject("fCorrVertexTPC")))->Fill(vtxESDTPC->GetStatus(),vtxESDTPC->GetNContributors());
487 (static_cast<TH2F*>(fOutList->FindObject("fCrossCorrVertexTracks")))->Fill(vtxESDTPC->GetStatus(),vtxESD->GetNContributors());
488 (static_cast<TH2F*>(fOutList->FindObject("fCrossCorrVertexTPC")))->Fill(vtxESD->GetStatus(),vtxESDTPC->GetNContributors());
489 (static_cast<TH2F*>(fOutList->FindObject("fCorrVertexNCont")))->Fill(vtxESD->GetNContributors(),vtxESDTPC->GetNContributors());
491 (static_cast<TH1F*>(fOutList->FindObject("fDeltaVx")))->Fill(vtxESD->GetXv() - vtxESDTPC->GetXv());
492 (static_cast<TH1F*>(fOutList->FindObject("fDeltaVy")))->Fill(vtxESD->GetYv() - vtxESDTPC->GetYv());
493 (static_cast<TH1F*>(fOutList->FindObject("fDeltaVz")))->Fill(vtxESD->GetZv() - vtxESDTPC->GetZv());
495 (static_cast<TH2F*>(fOutList->FindObject("fVzTPCvsSPD")))->Fill(vtxESDTPC->GetZv(),vtxESDSPD->GetZv());
496 (static_cast<TH2F*>(fOutList->FindObject("fVzTPCvsTracks")))->Fill(vtxESDTPC->GetZv(),vtxESD->GetZv());
497 (static_cast<TH2F*>(fOutList->FindObject("fVzSPDvsTracks")))->Fill(vtxESDSPD->GetZv(),vtxESD->GetZv());
499 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
504 //________________________________________________________________________
505 Int_t AliAnalysisTaskHIMultCorr::GetCentralityBin(){
506 // Get Centrality bin
510 if (fUseCentralitySel == 0)
511 return fCentralityBin;
513 AliCentrality *esdCentrality = fESD->GetCentrality();
514 fCentralityVZERO = esdCentrality->GetCentralityPercentile("V0M");
515 fCentralitySPD = esdCentrality->GetCentralityPercentile("CL1");
517 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
519 fCentralityVZEROBin = esdCentrality->GetCentralityClass10("V0M")*10;
520 if (fCentralityVZEROBin == 0 && esdCentrality->GetCentralityClass5("V0M") == 1)
521 fCentralityVZEROBin = 5;
523 fCentralitySPDBin = esdCentrality->GetCentralityClass10("CL1")*10;
524 if (fCentralitySPDBin == 0 && esdCentrality->GetCentralityClass5("CL1") == 1)
525 fCentralitySPDBin = 5;
527 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
529 if ( fUseCentralitySel == 1 )
530 fCentralityBin = fCentralityVZEROBin;
531 else if ( fUseCentralitySel == 2 )
532 fCentralityBin = fCentralitySPDBin;
534 if ( fCentralityBin == 100 )
537 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
539 return fCentralityBin;
542 //________________________________________________________________________
543 void AliAnalysisTaskHIMultCorr::Terminate(Option_t *){
546 if (fpcstream) fpcstream->GetFile()->Write();