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"
44 : AliAnalysisTaskSE(name),
45 fAcceptFastCluster(kTRUE),
47 fTrackMultEtaCut(0.8),
49 fOutputContainer(0x0),
50 fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
52 fCurrFileName(0), fCheckMCCrossSection(kFALSE),
53 fUseAliCentrality(kFALSE), fCentralityClass(
"V0M"),
55 fhXVertex(0), fhYVertex(0), fhZVertex(0),
56 fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0),
57 fhCentrality(0), fhEventPlaneAngle(0),
58 fh1Xsec(0), fh1Trials(0)
60 DefineOutput(1, TList::Class());
67 : AliAnalysisTaskSE(
"DefaultAnalysis_AliAnalysisTaskCounter"),
68 fAcceptFastCluster(kTRUE),
70 fTrackMultEtaCut(0.8),
72 fOutputContainer(0x0),
73 fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
75 fCurrFileName(0), fCheckMCCrossSection(kFALSE),
76 fUseAliCentrality(kFALSE), fCentralityClass(
"V0M"),
78 fhXVertex(0), fhYVertex(0), fhZVertex(0),
79 fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0),
80 fhCentrality(0), fhEventPlaneAngle(0),
81 fh1Xsec(0), fh1Trials(0)
90 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode())
return;
113 fh1Xsec =
new TH1F(
"hXsec",
"xsec from pyxsec.root",1,0,1);
114 fh1Xsec->GetXaxis()->SetBinLabel(1,
"<#sigma>");
117 fh1Trials =
new TH1F(
"hTrials",
"trials root file",1,0,1);
118 fh1Trials->GetXaxis()->SetBinLabel(1,
"#sum{ntrials}");
122 fhZVertex =
new TH1F(
"hZVertex",
" Z vertex distribution" , 200 , -50 , 50 ) ;
126 fhZGoodVertex =
new TH1F(
"hZGoodVertex",
" Good Z vertex distribution" , 200 , -50 , 50 ) ;
130 fhXVertex =
new TH1F(
"hXVertex",
" X vertex distribution" , 200 , -2 , 2 ) ;
134 fhXGoodVertex =
new TH1F(
"hXGoodVertex",
" Good X vertex distribution" , 200 , -2 , 2 ) ;
138 fhYVertex =
new TH1F(
"hYVertex",
" Y vertex distribution" , 200 , -2 , 2 ) ;
142 fhYGoodVertex =
new TH1F(
"hYGoodVertex",
" Good Y vertex distribution" , 200 , -2 , 2 ) ;
146 fhCentrality =
new TH1F(
"hCentrality",
"Number of events in centrality bin, |vz|<10 cm, method <V0M> ",100,0.,100.) ;
150 fhEventPlaneAngle=
new TH1F(
"hEventPlaneAngle",
"Number of events in event plane, |vz|<10 cm, method <V0> ",100,0.,TMath::Pi()) ;
154 fhNEvents =
new TH1I(
"hNEvents",
"Number of analyzed events", 21, 0, 21) ;
157 fhNEvents->GetXaxis()->SetBinLabel(1 ,
"1 = PS");
158 fhNEvents->GetXaxis()->SetBinLabel(2 ,
"2 = 1 & ESD");
159 fhNEvents->GetXaxis()->SetBinLabel(3 ,
"3 = 2 & |Z|<10");
160 fhNEvents->GetXaxis()->SetBinLabel(4 ,
"4 = 2 & !track?");
161 fhNEvents->GetXaxis()->SetBinLabel(5 ,
"5 = 3 & 4");
162 fhNEvents->GetXaxis()->SetBinLabel(6 ,
"6 = 2 & V0AND");
163 fhNEvents->GetXaxis()->SetBinLabel(7 ,
"7 = 3 & 6");
164 fhNEvents->GetXaxis()->SetBinLabel(8 ,
"8 = 4 & 6");
165 fhNEvents->GetXaxis()->SetBinLabel(9 ,
"9 = 5 & 6");
166 fhNEvents->GetXaxis()->SetBinLabel(10,
"10 = 2 & not pileup");
167 fhNEvents->GetXaxis()->SetBinLabel(11,
"11 = 2 & good vertex");
168 fhNEvents->GetXaxis()->SetBinLabel(12,
"12 = 3 & 11");
169 fhNEvents->GetXaxis()->SetBinLabel(13,
"13 = 4 & 11");
170 fhNEvents->GetXaxis()->SetBinLabel(14,
"14 = 6 & 11");
171 fhNEvents->GetXaxis()->SetBinLabel(15,
"15 = 9 & 11");
172 fhNEvents->GetXaxis()->SetBinLabel(16,
"16 = 10 & 11");
173 fhNEvents->GetXaxis()->SetBinLabel(17,
"17 = 6 & 10");
174 fhNEvents->GetXaxis()->SetBinLabel(18,
"18 = Reject EMCAL 1");
175 fhNEvents->GetXaxis()->SetBinLabel(19,
"19 = 18 & 3");
176 fhNEvents->GetXaxis()->SetBinLabel(20,
"20 = Reject EMCAL 2");
177 fhNEvents->GetXaxis()->SetBinLabel(21,
"21 = 20 & 3");
201 AliVEvent *
event = InputEvent();
202 AliESDEvent * esdevent =
dynamic_cast<AliESDEvent*
> (event);
203 AliAODEvent * aodevent =
dynamic_cast<AliAODEvent*
> (event);
206 if (!TGeoGlobalMagField::Instance()->GetField() && esdevent) esdevent->InitMagneticField();
208 TString triggerclasses =
event->GetFiredTriggerClasses();
212 if (triggerclasses.Contains(
"FAST") && !triggerclasses.Contains(
"ALL") && !
fAcceptFastCluster)
221 Bool_t bSelectVZ = kFALSE;
222 Bool_t bV0AND = kFALSE;
223 Bool_t bPileup = kFALSE;
224 Bool_t bGoodV = kFALSE;
225 Bool_t bSelectTrack = kFALSE;
232 event->GetPrimaryVertex()->GetXYZ(v) ;
247 Int_t nTracks =
event->GetNumberOfTracks() ;
248 for (Int_t itrack = 0; itrack < nTracks; itrack++)
250 AliVTrack * track = (AliVTrack*)event->GetTrack(itrack) ;
253 if(esdevent && !
fESDtrackCuts->AcceptTrack((AliESDtrack*)track))
continue;
256 if(aodevent && !((AliAODTrack*)track)->IsHybridGlobalConstrainedGlobal())
continue ;
269 bSelectTrack = kTRUE;
279 AliVVZERO* v0 = fInputEvent->GetVZEROData();
280 bV0AND = ((v0->GetV0ADecision()==1) && (v0->GetV0CDecision()==1));
287 if (bSelectVZ && bSelectTrack)
fhNEvents->Fill(8.5);
293 bPileup =
event->IsPileupFromSPD(3, 0.8, 3., 2., 5.);
308 if(TMath::Abs(v[0]) < 1.e-6 &&
309 TMath::Abs(v[1]) < 1.e-6 &&
310 TMath::Abs(v[2]) < 1.e-6) bGoodV = kFALSE;
322 if(bSelectVZ && bSelectTrack && bV0AND)
326 if(TMath::Abs(v[2]) < 10.)
335 AliMultSelection* multSelection = (AliMultSelection * ) fInputEvent->FindListObject(
"MultSelection") ;
339 if(InputEvent()->GetEventplane())
341 Float_t ep = InputEvent()->GetEventplane()->GetEventplane(
"V0", InputEvent());
355 Bool_t bEMCALRejected = kFALSE;
356 for (Int_t i = 0; i < InputEvent()->GetNumberOfCaloClusters(); i++)
358 AliVCluster *clus = InputEvent()->GetCaloCluster(i);
361 if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200)
368 bEMCALRejected = kTRUE;
380 for(Int_t icell = 0; icell <
event->GetEMCALCells()->GetNumberOfCells(); icell++)
382 if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 &&
event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==3) ncellsSM3++;
383 if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 &&
event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==4) ncellsSM4++;
387 if(triggerclasses.Contains(
"EMC")) ncellcut = 35;
389 if( ncellsSM3 >= ncellcut || ncellsSM4 >= 100 )
410 AliESDEvent * esdevent =
dynamic_cast<AliESDEvent*
> (InputEvent());
411 AliAODEvent * aodevent =
dynamic_cast<AliAODEvent*
> (InputEvent());
415 if(esdevent->GetPrimaryVertex()->GetNContributors() > 0)
420 if(esdevent->GetPrimaryVertex()->GetNContributors() < 1)
423 if(esdevent->GetPrimaryVertexSPD()->GetNContributors() > 0)
428 if(esdevent->GetPrimaryVertexSPD()->GetNContributors() < 1)
436 if (aodevent->GetPrimaryVertex() != NULL)
438 if(aodevent->GetPrimaryVertex()->GetNContributors() > 0)
444 if(aodevent->GetPrimaryVertexSPD() != NULL)
446 if(aodevent->GetPrimaryVertexSPD()->GetNContributors() > 0)
452 AliWarning(Form(
"Number of contributors from bad vertex type:: %s",aodevent->GetPrimaryVertex()->GetName()));
468 AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
469 AliInputEventHandler *inputH =
dynamic_cast<AliInputEventHandler*
>(am->GetInputEventHandler());
471 TH2F *histStat =
dynamic_cast<TH2F*
>(inputH->GetStatistics());
472 TH2F *histBin0 =
dynamic_cast<TH2F*
>(inputH->GetStatistics(
"BIN0"));
476 else AliInfo(
"Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists");
495 Float_t xsection = 0;
499 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
500 if(!tree)
return kFALSE;
502 TFile *curfile = tree->GetCurrentFile();
504 if(!curfile)
return kFALSE;
512 AliInfo(Form(
"%s%d No Histogram fh1Xsec",(
char*)__FILE__,__LINE__));
518 if(!ok)
return kFALSE;
520 fh1Xsec->Fill(
"<#sigma>",xsection);
523 Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
525 if(trials >= nEntries && nEntries > 0.)
fAvgTrials = trials/nEntries;
529 AliInfo(Form(
"xs %f, trial %f, avg trials %f\n",xsection,trials,
fAvgTrials));
531 AliDebug(1,Form(
"Reading File %s",fInputHandler->GetTree()->GetCurrentFile()->GetName()));
549 if(file.Contains(
"root_archive.zip#"))
551 Ssiz_t pos1 = file.Index(
"root_archive",12,0,TString::kExact);
552 Ssiz_t pos = file.Index(
"#",1,pos1,TString::kExact);
553 Ssiz_t pos2 = file.Index(
".root",5,TString::kExact);
554 file.Replace(pos+1,pos2-pos1,
"");
559 file.ReplaceAll(
gSystem->BaseName(file.Data()),
"");
564 TFile *fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec.root"));
568 fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec_hists.root"));
577 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
584 TList *
list =
dynamic_cast<TList*
>(key->ReadObj());
591 xsec = ((TProfile*)list->FindObject(
"h1Xsec")) ->GetBinContent(1);
592 trials = ((TH1F*) list->FindObject(
"h1Trials"))->GetBinContent(1);
598 TTree *xtree = (TTree*)fxsec->Get(
"Xsection");
606 Double_t xsection = 0;
607 xtree->SetBranchAddress(
"xsection",&xsection);
608 xtree->SetBranchAddress(
"ntrials",&ntrials);
virtual void UserExec(Option_t *option)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
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.
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.