21 #include <TProfile2D.h>
23 #include <TClonesArray.h>
24 #include <TGeoGlobalMagField.h>
25 #include "AliAODHeader.h"
27 #include "AliESDEvent.h"
28 #include "AliAODEvent.h"
29 #include "AliESDtrackCuts.h"
30 #include "AliAnalysisManager.h"
31 #include "AliInputEventHandler.h"
32 #include "AliMultSelection.h"
33 #include "AliGenPythiaEventHeader.h"
34 #include "AliMCEvent.h"
35 #include "AliAODMCHeader.h"
48 fAcceptFastCluster(kTRUE),
50 fTrackMultEtaCut(0.8),
52 fOutputContainer(0x0),
53 fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
55 fCurrFileName(0), fCheckMCCrossSection(kFALSE),
56 fUseAliCentrality(kFALSE), fCentralityClass(
"V0M"),
58 fhXVertex(0), fhYVertex(0), fhZVertex(0),
59 fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0),
60 fhCentrality(0), fhEventPlaneAngle(0),
61 fh1Xsec(0), fh1Trials(0)
63 DefineOutput(1, TList::Class());
71 fAcceptFastCluster(kTRUE),
73 fTrackMultEtaCut(0.8),
75 fOutputContainer(0x0),
76 fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
78 fCurrFileName(0), fCheckMCCrossSection(kFALSE),
79 fUseAliCentrality(kFALSE), fCentralityClass(
"V0M"),
81 fhXVertex(0), fhYVertex(0), fhZVertex(0),
82 fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0),
83 fhCentrality(0), fhEventPlaneAngle(0),
84 fh1Xsec(0), fh1Trials(0)
93 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode())
return;
116 fh1Xsec =
new TH1F(
"hXsec",
"xsec from pyxsec.root",1,0,1);
117 fh1Xsec->GetXaxis()->SetBinLabel(1,
"<#sigma>");
120 fh1Trials =
new TH1F(
"hTrials",
"trials root file",1,0,1);
121 fh1Trials->GetXaxis()->SetBinLabel(1,
"#sum{ntrials}");
125 fhZVertex =
new TH1F(
"hZVertex",
" Z vertex distribution" , 200 , -50 , 50 ) ;
129 fhZGoodVertex =
new TH1F(
"hZGoodVertex",
" Good Z vertex distribution" , 200 , -50 , 50 ) ;
133 fhXVertex =
new TH1F(
"hXVertex",
" X vertex distribution" , 200 , -2 , 2 ) ;
137 fhXGoodVertex =
new TH1F(
"hXGoodVertex",
" Good X vertex distribution" , 200 , -2 , 2 ) ;
141 fhYVertex =
new TH1F(
"hYVertex",
" Y vertex distribution" , 200 , -2 , 2 ) ;
145 fhYGoodVertex =
new TH1F(
"hYGoodVertex",
" Good Y vertex distribution" , 200 , -2 , 2 ) ;
149 fhCentrality =
new TH1F(
"hCentrality",
"Number of events in centrality bin, |vz|<10 cm, method <V0M> ",100,0.,100.) ;
153 fhEventPlaneAngle=
new TH1F(
"hEventPlaneAngle",
"Number of events in event plane, |vz|<10 cm, method <V0> ",100,0.,TMath::Pi()) ;
157 fhNEvents =
new TH1I(
"hNEvents",
"Number of analyzed events", 21, 0, 21) ;
160 fhNEvents->GetXaxis()->SetBinLabel(1 ,
"1 = PS");
161 fhNEvents->GetXaxis()->SetBinLabel(2 ,
"2 = 1 & ESD");
162 fhNEvents->GetXaxis()->SetBinLabel(3 ,
"3 = 2 & |Z|<10");
163 fhNEvents->GetXaxis()->SetBinLabel(4 ,
"4 = 2 & !track?");
164 fhNEvents->GetXaxis()->SetBinLabel(5 ,
"5 = 3 & 4");
165 fhNEvents->GetXaxis()->SetBinLabel(6 ,
"6 = 2 & V0AND");
166 fhNEvents->GetXaxis()->SetBinLabel(7 ,
"7 = 3 & 6");
167 fhNEvents->GetXaxis()->SetBinLabel(8 ,
"8 = 4 & 6");
168 fhNEvents->GetXaxis()->SetBinLabel(9 ,
"9 = 5 & 6");
169 fhNEvents->GetXaxis()->SetBinLabel(10,
"10 = 2 & not pileup");
170 fhNEvents->GetXaxis()->SetBinLabel(11,
"11 = 2 & good vertex");
171 fhNEvents->GetXaxis()->SetBinLabel(12,
"12 = 3 & 11");
172 fhNEvents->GetXaxis()->SetBinLabel(13,
"13 = 4 & 11");
173 fhNEvents->GetXaxis()->SetBinLabel(14,
"14 = 6 & 11");
174 fhNEvents->GetXaxis()->SetBinLabel(15,
"15 = 9 & 11");
175 fhNEvents->GetXaxis()->SetBinLabel(16,
"16 = 10 & 11");
176 fhNEvents->GetXaxis()->SetBinLabel(17,
"17 = 6 & 10");
177 fhNEvents->GetXaxis()->SetBinLabel(18,
"18 = Reject EMCAL 1");
178 fhNEvents->GetXaxis()->SetBinLabel(19,
"19 = 18 & 3");
179 fhNEvents->GetXaxis()->SetBinLabel(20,
"20 = Reject EMCAL 2");
180 fhNEvents->GetXaxis()->SetBinLabel(21,
"21 = 20 & 3");
204 AliVEvent *
event = InputEvent();
209 if (!TGeoGlobalMagField::Instance()->GetField() && esdevent) esdevent->InitMagneticField();
211 TString triggerclasses =
event->GetFiredTriggerClasses();
215 if (triggerclasses.Contains(
"FAST") && !triggerclasses.Contains(
"ALL") && !
fAcceptFastCluster)
224 Bool_t bSelectVZ = kFALSE;
228 Bool_t bSelectTrack = kFALSE;
235 event->GetPrimaryVertex()->GetXYZ(v) ;
250 Int_t nTracks =
event->GetNumberOfTracks() ;
251 for (
Int_t itrack = 0; itrack < nTracks; itrack++)
253 AliVTrack * track = (AliVTrack*)event->GetTrack(itrack) ;
256 if(esdevent && !
fESDtrackCuts->AcceptTrack((AliESDtrack*)track))
continue;
259 if(aodevent && !((AliAODTrack*)track)->IsHybridGlobalConstrainedGlobal())
continue ;
272 bSelectTrack = kTRUE;
282 AliVVZERO* v0 = fInputEvent->GetVZEROData();
283 bV0AND = ((v0->GetV0ADecision()==1) && (v0->GetV0CDecision()==1));
290 if (bSelectVZ && bSelectTrack)
fhNEvents->Fill(8.5);
296 bPileup =
event->IsPileupFromSPD(3, 0.8, 3., 2., 5.);
311 if(TMath::Abs(v[0]) < 1.e-6 &&
312 TMath::Abs(v[1]) < 1.e-6 &&
313 TMath::Abs(v[2]) < 1.e-6) bGoodV = kFALSE;
325 if(bSelectVZ && bSelectTrack && bV0AND)
329 if(TMath::Abs(v[2]) < 10.)
338 AliMultSelection* multSelection = (AliMultSelection * ) fInputEvent->FindListObject(
"MultSelection") ;
342 if(InputEvent()->GetEventplane())
344 Float_t ep = InputEvent()->GetEventplane()->GetEventplane(
"V0", InputEvent());
358 Bool_t bEMCALRejected = kFALSE;
359 for (
Int_t i = 0; i < InputEvent()->GetNumberOfCaloClusters(); i++)
361 AliVCluster *clus = InputEvent()->GetCaloCluster(i);
364 if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200)
371 bEMCALRejected = kTRUE;
383 for(
Int_t icell = 0; icell <
event->GetEMCALCells()->GetNumberOfCells(); icell++)
385 if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 &&
event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==3) ncellsSM3++;
386 if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 &&
event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==4) ncellsSM4++;
390 if(triggerclasses.Contains(
"EMC")) ncellcut = 35;
392 if( ncellsSM3 >= ncellcut || ncellsSM4 >= 100 )
418 if(esdevent->GetPrimaryVertex()->GetNContributors() > 0)
423 if(esdevent->GetPrimaryVertex()->GetNContributors() < 1)
426 if(esdevent->GetPrimaryVertexSPD()->GetNContributors() > 0)
431 if(esdevent->GetPrimaryVertexSPD()->GetNContributors() < 1)
439 if (aodevent->GetPrimaryVertex() != NULL)
441 if(aodevent->GetPrimaryVertex()->GetNContributors() > 0)
447 if(aodevent->GetPrimaryVertexSPD() != NULL)
449 if(aodevent->GetPrimaryVertexSPD()->GetNContributors() > 0)
455 AliWarning(Form(
"Number of contributors from bad vertex type:: %s",aodevent->GetPrimaryVertex()->GetName()));
472 AliInputEventHandler *inputH =
dynamic_cast<AliInputEventHandler*
>(am->GetInputEventHandler());
474 TH2F *histStat =
dynamic_cast<TH2F*
>(inputH->GetStatistics());
475 TH2F *histBin0 =
dynamic_cast<TH2F*
>(inputH->GetStatistics(
"BIN0"));
479 else AliInfo(
"Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists");
502 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
503 if(!tree)
return kFALSE;
505 TFile *curfile = tree->GetCurrentFile();
507 if(!curfile)
return kFALSE;
515 AliInfo(Form(
"%s%d No Histogram fh1Xsec",(
char*)__FILE__,__LINE__));
523 if(!ok || xsection==0){
526 AliGenPythiaEventHeader *fPythiaHeader=0;
528 AliAODMCHeader* aodMCH =
dynamic_cast<AliAODMCHeader*
>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
531 for (
UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
532 fPythiaHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(aodMCH->GetCocktailHeader(i));
533 if (fPythiaHeader)
break;
538 AliError(Form(
"No pythia header found"));
544 pthard = fPythiaHeader->GetPtHard();
545 xsection = fPythiaHeader->GetXsection();
546 trials = fPythiaHeader->Trials();
548 fh1Xsec->Fill(
"<#sigma>",xsection);
551 AliInfo(Form(
"xs %f, trial %f, pt hard %f\n",xsection,trials, pthard));
558 fh1Xsec->Fill(
"<#sigma>",xsection);
563 if(trials >= nEntries && nEntries > 0.)
fAvgTrials = trials/nEntries;
567 AliInfo(Form(
"xs %f, trial %f, avg trials %f\n",xsection,trials,
fAvgTrials));
569 AliDebug(1,Form(
"Reading File %s",fInputHandler->GetTree()->GetCurrentFile()->GetName()));
589 if(file.Contains(
"root_archive.zip#"))
591 Ssiz_t pos1 = file.Index(
"root_archive",12,0,TString::kExact);
592 Ssiz_t pos = file.Index(
"#",1,pos1,TString::kExact);
593 Ssiz_t pos2 = file.Index(
".root",5,TString::kExact);
594 file.Replace(pos+1,pos2-pos1,
"");
599 file.ReplaceAll(
gSystem->BaseName(file.Data()),
"");
604 TFile *fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec.root"));
608 fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec_hists.root"));
617 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
631 xsec = ((TProfile*)list->FindObject(
"h1Xsec")) ->GetBinContent(1);
632 trials = ((TH1F*) list->FindObject(
"h1Trials"))->GetBinContent(1);
638 TTree *xtree = (
TTree*)fxsec->Get(
"Xsection");
647 xtree->SetBranchAddress(
"xsection",&xsection);
648 xtree->SetBranchAddress(
"ntrials",&ntrials);
virtual void UserExec(Option_t *option)
Bool_t CheckForPrimaryVertex()
Count events with different selection criteria.
virtual void UserCreateOutputObjects()
Init histogram pointers and add them to container.
TH1F * fhXGoodVertex
! X Vertex distribution, after event selection.
virtual void FinishTaskOutput()
Put in the output some event summary histograms.
static Bool_t PythiaInfoFromFile(TString currFile, Float_t &xsec, Float_t &trials)
TH1F * fhZVertex
! Z Vertex distribution.
TString fCurrFileName
Current file path name.
TH1F * fhCentrality
! Centrality.
Bool_t fAcceptFastCluster
Accept events from fast cluster, exclude these events for LHC11a.
Float_t fZVertexCut
Z vertex cut.
Float_t fTrackMultEtaCut
Track multiplicity eta cut.
TString fCentralityClass
Multiplicity percentile/centrality estimator, for ex. V0M.
TH1F * fhZGoodVertex
! Z Vertex distribution, after event selection.
AliESDtrackCuts * fESDtrackCuts
Track cut.
AliAnalysisTaskCounter()
Default Constructor.
virtual ~AliAnalysisTaskCounter()
Destructor.
Bool_t fCheckMCCrossSection
Retrieve from the pyxsec.root file only if requested.
TH1F * fh1Xsec
! Cross section in PYTHIA.
TH1F * fhYVertex
! Y Vertex distribution.
TH1I * fhNEvents
! Events that delivers the analysis frame after different assumptions.
TList * fOutputContainer
! Histogram container.
TH1F * fhYGoodVertex
! Y Vertex distribution, after event selection.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Bool_t fUseAliCentrality
Use the centrality estimator from AliCentrality or AliMultSelection.
TH1F * fhXVertex
! X Vertex distribution.
TH1F * fh1Trials
! Number of event trials in PYTHIA.
TH1F * fhEventPlaneAngle
! Event plane angle.
Float_t fAvgTrials
Average number of event trials.