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"
43 : AliAnalysisTaskSE(name),
44 fAcceptFastCluster(kTRUE),
46 fTrackMultEtaCut(0.8),
48 fOutputContainer(0x0),
49 fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
51 fCurrFileName(0), fCheckMCCrossSection(kFALSE),
53 fhXVertex(0), fhYVertex(0), fhZVertex(0),
54 fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0),
55 fhCentrality(0), fhEventPlaneAngle(0),
56 fh1Xsec(0), fh1Trials(0)
58 DefineOutput(1, TList::Class());
65 : AliAnalysisTaskSE(
"DefaultAnalysis_AliAnalysisTaskCounter"),
66 fAcceptFastCluster(kTRUE),
68 fTrackMultEtaCut(0.8),
70 fOutputContainer(0x0),
71 fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
73 fCurrFileName(0), fCheckMCCrossSection(kFALSE),
75 fhXVertex(0), fhYVertex(0), fhZVertex(0),
76 fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0),
77 fhCentrality(0), fhEventPlaneAngle(0),
78 fh1Xsec(0), fh1Trials(0)
80 DefineOutput(1, TList::Class());
88 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode())
return;
111 fh1Xsec =
new TH1F(
"hXsec",
"xsec from pyxsec.root",1,0,1);
112 fh1Xsec->GetXaxis()->SetBinLabel(1,
"<#sigma>");
115 fh1Trials =
new TH1F(
"hTrials",
"trials root file",1,0,1);
116 fh1Trials->GetXaxis()->SetBinLabel(1,
"#sum{ntrials}");
120 fhZVertex =
new TH1F(
"hZVertex",
" Z vertex distribution" , 200 , -50 , 50 ) ;
124 fhZGoodVertex =
new TH1F(
"hZGoodVertex",
" Good Z vertex distribution" , 200 , -50 , 50 ) ;
128 fhXVertex =
new TH1F(
"hXVertex",
" X vertex distribution" , 200 , -2 , 2 ) ;
132 fhXGoodVertex =
new TH1F(
"hXGoodVertex",
" Good X vertex distribution" , 200 , -2 , 2 ) ;
136 fhYVertex =
new TH1F(
"hYVertex",
" Y vertex distribution" , 200 , -2 , 2 ) ;
140 fhYGoodVertex =
new TH1F(
"hYGoodVertex",
" Good Y vertex distribution" , 200 , -2 , 2 ) ;
144 fhCentrality =
new TH1F(
"hCentrality",
"Number of events in centrality bin, |vz|<10 cm, method <V0M> ",100,0.,100.) ;
148 fhEventPlaneAngle=
new TH1F(
"hEventPlaneAngle",
"Number of events in event plane, |vz|<10 cm, method <V0> ",100,0.,TMath::Pi()) ;
152 fhNEvents =
new TH1I(
"hNEvents",
"Number of analyzed events", 21, 0, 21) ;
155 fhNEvents->GetXaxis()->SetBinLabel(1 ,
"1 = PS");
156 fhNEvents->GetXaxis()->SetBinLabel(2 ,
"2 = 1 & ESD");
157 fhNEvents->GetXaxis()->SetBinLabel(3 ,
"3 = 2 & |Z|<10");
158 fhNEvents->GetXaxis()->SetBinLabel(4 ,
"4 = 2 & !track?");
159 fhNEvents->GetXaxis()->SetBinLabel(5 ,
"5 = 3 & 4");
160 fhNEvents->GetXaxis()->SetBinLabel(6 ,
"6 = 2 & V0AND");
161 fhNEvents->GetXaxis()->SetBinLabel(7 ,
"7 = 3 & 6");
162 fhNEvents->GetXaxis()->SetBinLabel(8 ,
"8 = 4 & 6");
163 fhNEvents->GetXaxis()->SetBinLabel(9 ,
"9 = 5 & 6");
164 fhNEvents->GetXaxis()->SetBinLabel(10,
"10 = 2 & not pileup");
165 fhNEvents->GetXaxis()->SetBinLabel(11,
"11 = 2 & good vertex");
166 fhNEvents->GetXaxis()->SetBinLabel(12,
"12 = 3 & 11");
167 fhNEvents->GetXaxis()->SetBinLabel(13,
"13 = 4 & 11");
168 fhNEvents->GetXaxis()->SetBinLabel(14,
"14 = 6 & 11");
169 fhNEvents->GetXaxis()->SetBinLabel(15,
"15 = 9 & 11");
170 fhNEvents->GetXaxis()->SetBinLabel(16,
"16 = 10 & 11");
171 fhNEvents->GetXaxis()->SetBinLabel(17,
"17 = 6 & 10");
172 fhNEvents->GetXaxis()->SetBinLabel(18,
"18 = Reject EMCAL 1");
173 fhNEvents->GetXaxis()->SetBinLabel(19,
"19 = 18 & 3");
174 fhNEvents->GetXaxis()->SetBinLabel(20,
"20 = Reject EMCAL 2");
175 fhNEvents->GetXaxis()->SetBinLabel(21,
"21 = 20 & 3");
199 AliVEvent *
event = InputEvent();
200 AliESDEvent * esdevent =
dynamic_cast<AliESDEvent*
> (event);
201 AliAODEvent * aodevent =
dynamic_cast<AliAODEvent*
> (event);
204 if (!TGeoGlobalMagField::Instance()->GetField() && esdevent) esdevent->InitMagneticField();
206 TString triggerclasses =
event->GetFiredTriggerClasses();
210 if (triggerclasses.Contains(
"FAST") && !triggerclasses.Contains(
"ALL") && !
fAcceptFastCluster)
219 Bool_t bSelectVZ = kFALSE;
220 Bool_t bV0AND = kFALSE;
221 Bool_t bPileup = kFALSE;
222 Bool_t bGoodV = kFALSE;
223 Bool_t bSelectTrack = kFALSE;
230 event->GetPrimaryVertex()->GetXYZ(v) ;
245 Int_t nTracks =
event->GetNumberOfTracks() ;
246 for (Int_t itrack = 0; itrack < nTracks; itrack++)
248 AliVTrack * track = (AliVTrack*)event->GetTrack(itrack) ;
251 if(esdevent && !
fESDtrackCuts->AcceptTrack((AliESDtrack*)track))
continue;
254 if(aodevent && !((AliAODTrack*)track)->IsHybridGlobalConstrainedGlobal())
continue ;
267 bSelectTrack = kTRUE;
277 AliVVZERO* v0 = fInputEvent->GetVZEROData();
278 bV0AND = ((v0->GetV0ADecision()==1) && (v0->GetV0CDecision()==1));
285 if (bSelectVZ && bSelectTrack)
fhNEvents->Fill(8.5);
291 bPileup =
event->IsPileupFromSPD(3, 0.8, 3., 2., 5.);
306 if(TMath::Abs(v[0]) < 1.e-6 &&
307 TMath::Abs(v[1]) < 1.e-6 &&
308 TMath::Abs(v[2]) < 1.e-6) bGoodV = kFALSE;
320 if(bSelectVZ && bSelectTrack && bV0AND)
324 if(TMath::Abs(v[2]) < 10.)
326 if(InputEvent()->GetCentrality())
327 fhCentrality->Fill(InputEvent()->GetCentrality()->GetCentralityPercentile(
"V0M"));
329 if(InputEvent()->GetEventplane())
331 Float_t ep = InputEvent()->GetEventplane()->GetEventplane(
"V0", InputEvent());
345 Bool_t bEMCALRejected = kFALSE;
346 for (Int_t i = 0; i < InputEvent()->GetNumberOfCaloClusters(); i++)
348 AliVCluster *clus = InputEvent()->GetCaloCluster(i);
351 if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200)
358 bEMCALRejected = kTRUE;
370 for(Int_t icell = 0; icell <
event->GetEMCALCells()->GetNumberOfCells(); icell++)
372 if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 &&
event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==3) ncellsSM3++;
373 if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 &&
event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==4) ncellsSM4++;
377 if(triggerclasses.Contains(
"EMC")) ncellcut = 35;
379 if( ncellsSM3 >= ncellcut || ncellsSM4 >= 100 )
400 AliESDEvent * esdevent =
dynamic_cast<AliESDEvent*
> (InputEvent());
401 AliAODEvent * aodevent =
dynamic_cast<AliAODEvent*
> (InputEvent());
405 if(esdevent->GetPrimaryVertex()->GetNContributors() > 0)
410 if(esdevent->GetPrimaryVertex()->GetNContributors() < 1)
413 if(esdevent->GetPrimaryVertexSPD()->GetNContributors() > 0)
418 if(esdevent->GetPrimaryVertexSPD()->GetNContributors() < 1)
426 if (aodevent->GetPrimaryVertex() != NULL)
428 if(aodevent->GetPrimaryVertex()->GetNContributors() > 0)
434 if(aodevent->GetPrimaryVertexSPD() != NULL)
436 if(aodevent->GetPrimaryVertexSPD()->GetNContributors() > 0)
442 AliWarning(Form(
"Number of contributors from bad vertex type:: %s",aodevent->GetPrimaryVertex()->GetName()));
458 AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
459 AliInputEventHandler *inputH =
dynamic_cast<AliInputEventHandler*
>(am->GetInputEventHandler());
461 TH2F *histStat =
dynamic_cast<TH2F*
>(inputH->GetStatistics());
462 TH2F *histBin0 =
dynamic_cast<TH2F*
>(inputH->GetStatistics(
"BIN0"));
466 else AliInfo(
"Stat histogram not available check, \n if ESDs, that AliPhysicsSelection was on, \n if AODs, if EventStat_temp.root exists");
485 Float_t xsection = 0;
489 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
490 if(!tree)
return kFALSE;
492 TFile *curfile = tree->GetCurrentFile();
494 if(!curfile)
return kFALSE;
502 AliInfo(Form(
"%s%d No Histogram fh1Xsec",(
char*)__FILE__,__LINE__));
508 if(!ok)
return kFALSE;
510 fh1Xsec->Fill(
"<#sigma>",xsection);
513 Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
515 if(trials >= nEntries && nEntries > 0.)
fAvgTrials = trials/nEntries;
519 AliInfo(Form(
"xs %f, trial %f, avg trials %f\n",xsection,trials,
fAvgTrials));
521 AliDebug(1,Form(
"Reading File %s",fInputHandler->GetTree()->GetCurrentFile()->GetName()));
539 if(file.Contains(
"root_archive.zip#"))
541 Ssiz_t pos1 = file.Index(
"root_archive",12,0,TString::kExact);
542 Ssiz_t pos = file.Index(
"#",1,pos1,TString::kExact);
543 Ssiz_t pos2 = file.Index(
".root",5,TString::kExact);
544 file.Replace(pos+1,pos2-pos1,
"");
549 file.ReplaceAll(gSystem->BaseName(file.Data()),
"");
554 TFile *fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec.root"));
558 fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec_hists.root"));
567 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
574 TList *
list =
dynamic_cast<TList*
>(key->ReadObj());
581 xsec = ((TProfile*)list->FindObject(
"h1Xsec")) ->GetBinContent(1);
582 trials = ((TH1F*) list->FindObject(
"h1Trials"))->GetBinContent(1);
588 TTree *xtree = (TTree*)fxsec->Get(
"Xsection");
596 Double_t xsection = 0;
597 xtree->SetBranchAddress(
"xsection",&xsection);
598 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.
TH1F * fhZGoodVertex
! Z Vertex distribution, after event selection.
AliESDtrackCuts * fESDtrackCuts
Track cut.
AliAnalysisTaskCounter()
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.
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.