16 #include <TClonesArray.h>
27 #include "AliAODEvent.h"
28 #include "AliAnalysisManager.h"
29 #include "AliCentrality.h"
30 #include "AliEMCALGeometry.h"
31 #include "AliESDEvent.h"
33 #include "AliEventplane.h"
34 #include "AliInputEventHandler.h"
36 #include "AliMCParticle.h"
37 #include "AliVCluster.h"
38 #include "AliVEventHandler.h"
39 #include "AliVParticle.h"
40 #include "AliAODTrack.h"
41 #include "AliVCaloTrigger.h"
42 #include "AliGenPythiaEventHeader.h"
43 #include "AliAODMCHeader.h"
44 #include "AliMCEvent.h"
45 #include "AliEMCALTriggerPatchInfo.h"
47 #include "AliMultSelection.h"
63 fGeneralHistograms(kFALSE),
65 fNeedEmcalGeom(kTRUE),
67 fUseNewCentralityEstimation(kFALSE),
71 fCaloTriggerPatchInfoName(),
75 fTriggerSelectionBitMap(0),
83 fMinPtTrackInEmcal(0),
84 fSelectPtHardBin(-999),
85 fAcceptedTriggerClasses(),
86 fRejectedTriggerClasses(),
87 fLocalInitialized(kFALSE),
100 fFiredTriggerBitMap(0),
101 fFiredTriggerClasses(),
110 fHistTrialsAfterSel(0),
111 fHistEventsAfterSel(0),
112 fHistXsectionAfterSel(0),
120 fHistEventRejection(0),
121 fHistTriggerClasses(0)
130 fParticleCollArray.SetOwner(kTRUE);
131 fClusterCollArray.SetOwner(kTRUE);
147 fGeneralHistograms(kFALSE),
149 fNeedEmcalGeom(kTRUE),
151 fUseNewCentralityEstimation(kFALSE),
155 fCaloTriggerPatchInfoName(),
157 fParticleCollArray(),
159 fTriggerSelectionBitMap(0),
167 fMinPtTrackInEmcal(0),
168 fSelectPtHardBin(-999),
169 fAcceptedTriggerClasses(),
170 fRejectedTriggerClasses(),
171 fLocalInitialized(kFALSE),
176 fTriggerPatchInfo(0),
184 fFiredTriggerBitMap(0),
185 fFiredTriggerClasses(),
194 fHistTrialsAfterSel(0),
195 fHistEventsAfterSel(0),
196 fHistXsectionAfterSel(0),
204 fHistEventRejection(0),
205 fHistTriggerClasses(0)
217 DefineOutput(1, TList::Class());
251 AliVEventHandler *evhand = mgr->GetInputEventHandler();
253 if (evhand->InheritsFrom(
"AliESDInputHandler")) {
261 AliError(
"Event handler not found!");
265 AliError(
"Analysis manager not found!");
297 fHistTrials =
new TH1F(
"fHistTrials",
"fHistTrials", 11, 0, 11);
298 fHistTrials->GetXaxis()->SetTitle(
"p_{T} hard bin");
302 fHistEvents =
new TH1F(
"fHistEvents",
"fHistEvents", 11, 0, 11);
303 fHistEvents->GetXaxis()->SetTitle(
"p_{T} hard bin");
307 fHistXsection =
new TProfile(
"fHistXsection",
"fHistXsection", 11, 0, 11);
312 const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234};
313 const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000};
315 for (
Int_t i = 1; i < 12; i++) {
316 fHistTrialsAfterSel->GetXaxis()->SetBinLabel(i, Form(
"%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
317 fHistEventsAfterSel->GetXaxis()->SetBinLabel(i, Form(
"%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
319 fHistTrials->GetXaxis()->SetBinLabel(i, Form(
"%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
320 fHistXsection->GetXaxis()->SetBinLabel(i, Form(
"%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
321 fHistEvents->GetXaxis()->SetBinLabel(i, Form(
"%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
324 fHistPtHard =
new TH1F(
"fHistPtHard",
"fHistPtHard", 250, 0, 1000);
325 fHistPtHard->GetXaxis()->SetTitle(
"p_{T,hard} (GeV/c)");
330 fHistZVertex =
new TH1F(
"fHistZVertex",
"Z vertex position", 60, -30, 30);
336 fHistCentrality =
new TH1F(
"fHistCentrality",
"Event centrality distribution", 200, 0, 100);
341 fHistEventPlane =
new TH1F(
"fHistEventPlane",
"Event plane", 120, -TMath::Pi(), TMath::Pi());
348 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
371 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
416 TObjArray* triggerClasses = InputEvent()->GetFiredTriggerClasses().Tokenize(
" ");
417 TIter next(triggerClasses);
418 TObjString* triggerClass = 0;
419 while ((triggerClass = static_cast<TObjString*>(next()))) {
422 delete triggerClasses;
503 if (file.Contains(
".zip#")) {
504 Ssiz_t pos1 = file.Index(
"root_archive",12,0,TString::kExact);
505 Ssiz_t pos = file.Index(
"#",1,pos1,TString::kExact);
506 Ssiz_t pos2 = file.Index(
".root",5,TString::kExact);
507 file.Replace(pos+1,pos2-pos1,
"");
510 file.ReplaceAll(
gSystem->BaseName(file.Data()),
"");
512 AliDebug(1,Form(
"File name: %s",file.Data()));
517 strPthard.Remove(strPthard.Last(
'/'));
518 strPthard.Remove(strPthard.Last(
'/'));
519 if (strPthard.Contains(
"AOD")) strPthard.Remove(strPthard.Last(
'/'));
520 strPthard.Remove(0,strPthard.Last(
'/')+1);
521 if (strPthard.IsDec())
522 pthard = strPthard.Atoi();
524 AliWarning(Form(
"Could not extract file number from path %s", strPthard.Data()));
527 TFile *fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec.root"));
531 fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec_hists.root"));
537 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
547 fXsec = ((TProfile*)list->FindObject(
"h1Xsec"))->GetBinContent(1);
548 fTrials = ((TH1F*)list->FindObject(
"h1Trials"))->GetBinContent(1);
552 TTree *xtree = (
TTree*)fxsec->Get(
"Xsection");
559 xtree->SetBranchAddress(
"xsection",&xsection);
560 xtree->SetBranchAddress(
"ntrials",&ntrials);
587 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
589 AliError(Form(
"%s - UserNotify: No current tree!",GetName()));
597 TFile *curfile = tree->GetCurrentFile();
599 AliError(Form(
"%s - UserNotify: No current file!",GetName()));
604 if (chain) tree = chain->GetTree();
610 if (!res)
return kTRUE;
632 AliError(Form(
"%s: Could not retrieve event! Returning!", GetName()));
637 fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->
GetRunNumber());
639 AliFatal(Form(
"%s: Can not get EMCal geometry instance. If you do not need the EMCal geometry, disable it by setting task->SetNeedEmcalGeometry(kFALSE).", GetName()));
647 cont->SetArray(InputEvent());
653 cont->SetArray(InputEvent());
659 AliError(Form(
"%s: Could not retrieve cells %s!", GetName(),
fCaloCellsName.Data()));
667 AliError(Form(
"%s: Could not retrieve calo triggers %s!", GetName(),
fCaloTriggersName.Data()));
696 const AliESDRun *run = esd->GetESDRun();
697 TString beamType = run->GetBeamType();
698 if (beamType ==
"p-p")
700 else if (beamType ==
"A-A")
702 else if (beamType ==
"p-A")
707 Int_t runNumber = InputEvent()->GetRunNumber();
708 if ((runNumber >= 136851 && runNumber <= 139517) ||
709 (runNumber >= 166529 && runNumber <= 170593)) {
711 }
else if ((runNumber>=188365 && runNumber <= 188366) ||
712 (runNumber >= 195344 && runNumber <= 196608)) {
748 Bool_t acceptedTrgClassFound = kFALSE;
752 while ((obj = acceptedTrigger())) {
754 acceptedTrgClassFound = kTRUE;
759 if (!acceptedTrgClassFound) {
768 while ((obj = rejectedTrigger())) {
777 if (fCent < fMinCent || fCent >
fMaxCent) {
789 if (vz < fMinVz || vz >
fMaxVz) {
796 Double_t dvertex = TMath::Abs(vz-vzSPD);
806 Bool_t trackInEmcalOk = kFALSE;
808 for (
Int_t i = 0; i < ntracks; i++) {
813 Double_t phiMin =
fGeom->GetArm1PhiMin() * TMath::DegToRad();
814 Double_t phiMax =
fGeom->GetArm1PhiMax() * TMath::DegToRad();
815 Int_t runNumber = InputEvent()->GetRunNumber();
816 if (runNumber>=177295 && runNumber<=197470) {
818 phiMax = TMath::Pi();
821 if (track->Eta() <
fGeom->GetArm1EtaMin() || track->Eta() >
fGeom->GetArm1EtaMax() || track->Phi() < phiMin || track->Phi() > phiMax)
824 trackInEmcalOk = kTRUE;
828 if (!trackInEmcalOk) {
835 Int_t nTracksAcc = 0;
837 for (
Int_t i = 0; i < ntracks; i++) {
871 TClonesArray *arr = 0;
873 if (!sname.IsNull()) {
874 arr =
dynamic_cast<TClonesArray*
>(InputEvent()->FindListObject(sname));
876 AliWarning(Form(
"%s: Could not retrieve array with name %s!", GetName(), name));
886 TString objname(arr->GetClass()->GetName());
888 if (!cls.InheritsFrom(clname)) {
889 AliWarning(Form(
"%s: Objects of type %s in %s are not inherited from %s!",
890 GetName(), cls.GetName(), name, clname));
918 fFiredTriggerBitMap =
static_cast<AliVAODHeader*
>(InputEvent()->GetHeader())->GetOfflineTrigger();
921 const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
927 const AliVVertex *vertSPD = InputEvent()->GetPrimaryVertexSPD();
937 AliMultSelection *MultSelection =
static_cast<AliMultSelection*
>(InputEvent()->FindListObject(
"MultSelection"));
939 fCent = MultSelection->GetMultiplicityPercentile(
fCentEst.Data());
942 AliWarning(Form(
"%s: Could not retrieve centrality information! Assuming 99", GetName()));
946 AliCentrality *aliCent = InputEvent()->GetCentrality();
951 AliWarning(Form(
"%s: Could not retrieve centrality information! Assuming 99", GetName()));
961 AliWarning(Form(
"%s: Negative centrality: %f. Assuming 99", GetName(),
fCent));
970 else if (
fCent > 90) {
975 AliWarning(Form(
"%s: Negative centrality: %f. Assuming 99", GetName(),
fCent));
988 AliWarning(Form(
"%s: fCentBin too large: cent = %f fCentBin = %d. Assuming 99", GetName(),
fCent,
fCentBin));
993 AliEventplane *aliEP = InputEvent()->GetEventplane();
995 fEPV0 = aliEP->GetEventplane(
"V0" ,InputEvent());
996 fEPV0A = aliEP->GetEventplane(
"V0A",InputEvent());
997 fEPV0C = aliEP->GetEventplane(
"V0C",InputEvent());
999 AliWarning(Form(
"%s: Could not retrieve event plane information!", GetName()));
1010 fPythiaHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(MCEvent()->GenEventHeader());
1013 AliAODMCHeader* aodMCH =
dynamic_cast<AliAODMCHeader*
>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1016 for (
UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1017 fPythiaHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(aodMCH->GetCocktailHeader(i));
1027 const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234};
1028 const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000};
1039 AliEmcalContainer* cont = 0;
1042 while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))) cont->NextEvent();
1045 while ((cont = static_cast<AliParticleContainer*>(nextClusColl()))) cont->NextEvent();
1059 if (
TString(n).IsNull())
return 0;
1077 if (
TString(n).IsNull())
return 0;
1095 if (
TString(n).IsNull())
return 0;
1113 if (
TString(n).IsNull())
return 0;
1175 if (!(InputEvent()->FindListObject(obj->GetName()))) {
1176 InputEvent()->AddObject(obj);
1180 AliFatal(Form(
"%s: Container with name %s already present. Aborting", GetName(), obj->GetName()));
1196 AliWarning(Form(
"%s - AliAnalysisTaskEmcalBase::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
1203 if (part->Phi() > minPhi && part->Phi() < maxPhi) {
1213 axis->SetBinLabel(1,
"NullObject");
1214 axis->SetBinLabel(2,
"Pt");
1215 axis->SetBinLabel(3,
"Acceptance");
1216 axis->SetBinLabel(4,
"MCLabel");
1217 axis->SetBinLabel(5,
"BitMap");
1218 axis->SetBinLabel(6,
"HF cut");
1219 axis->SetBinLabel(7,
"Bit6");
1220 axis->SetBinLabel(8,
"NotHybridTrack");
1221 axis->SetBinLabel(9,
"MCFlag");
1222 axis->SetBinLabel(10,
"MCGenerator");
1223 axis->SetBinLabel(11,
"ChargeCut");
1224 axis->SetBinLabel(12,
"MinDistanceTPCSectorEdge");
1225 axis->SetBinLabel(13,
"Bit12");
1226 axis->SetBinLabel(14,
"IsEMCal");
1227 axis->SetBinLabel(15,
"Time");
1228 axis->SetBinLabel(16,
"Energy");
1229 axis->SetBinLabel(17,
"ExoticCut");
1230 axis->SetBinLabel(18,
"Bit17");
1231 axis->SetBinLabel(19,
"Area");
1232 axis->SetBinLabel(20,
"AreaEmc");
1233 axis->SetBinLabel(21,
"ZLeadingCh");
1234 axis->SetBinLabel(22,
"ZLeadingEmc");
1235 axis->SetBinLabel(23,
"NEF");
1236 axis->SetBinLabel(24,
"MinLeadPt");
1237 axis->SetBinLabel(25,
"MaxTrackPt");
1238 axis->SetBinLabel(26,
"MaxClusterPt");
1239 axis->SetBinLabel(27,
"Flavour");
1240 axis->SetBinLabel(28,
"TagStatus");
1241 axis->SetBinLabel(29,
"MinNConstituents");
1242 axis->SetBinLabel(30,
"Bit29");
1243 axis->SetBinLabel(31,
"Bit30");
1244 axis->SetBinLabel(32,
"Bit31");
1255 TVector3 vect1(part1->Px(), part1->Py(), part1->Pz());
1256 TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1257 Double_t z = (vect1 * vect2) / (vect2 * vect2);
1269 TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1270 Double_t z = (vect1 * vect2) / (vect2 * vect2);
1289 Double_t veta = t->GetTrackEtaOnEMCal();
1290 Double_t vphi = t->GetTrackPhiOnEMCal();
1293 v->GetPosition(pos);
1298 phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
1309 if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
1311 else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
1313 else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
1332 if (aodTrack->TestFilterBit(filterBit1)) {
1335 else if (aodTrack->TestFilterBit(filterBit2)) {
1336 if ((aodTrack->GetStatus()&AliVTrack::kITSrefit)!=0) {
1358 if ((runnumber >= 136833 && runnumber <= 139517) ||
1359 (runnumber >= 167693 && runnumber <= 170593) ||
1360 (runnumber >= 244824 && runnumber <= 246994)) {
1363 else if ((runnumber > 188356 && runnumber <= 188503) ||
1364 (runnumber >= 195164 && runnumber <= 197388) ||
1365 (runnumber >= 265077 && runnumber <= 999999)) {
void SetRejectionReasonLabels(TAxis *axis)
Double_t fVertexSPD[3]
!event Svertex
void UserCreateOutputObjects()
TString fCaloTriggersName
name of calo triggers collection
TObjArray fAcceptedTriggerClasses
list of accepted trigger classes
Int_t fNcentBins
how many centrality bins
AliEMCALGeometry * fGeom
!emcal geometry
EBeamType_t fBeamType
!event beam type
TList * fOutput
!output list
TClonesArray * GetArrayFromEvent(const char *name, const char *clname=0)
Double_t fPtHard
!event pt hard
TObjArray fClusterCollArray
cluster collection array
Float_t fXsection
!x-section from pythia header
Double_t fEPV0A
!event plane V0A
Double_t fEPV0
!event plane V0
TH1 * fHistEventCount
!incoming and selected events
TObjArray fRejectedTriggerClasses
list of accepted trigger classes
Int_t fNTrials
!event trials
TObjArray fParticleCollArray
particle/track collection array
Int_t GetNParticles() const
Container with name, TClonesArray and cuts for particles.
Double_t fZvertexDiff
upper limit for distance between primary and SPD vertex
AliTrackContainer * AddTrackContainer(const char *n)
TString fCaloTriggerPatchInfoName
trigger patch info array name
Double_t fMinVz
min vertex for event selection
TProfile * fHistXsectionAfterSel
!x section from pythia header
void UserExec(Option_t *option)
TString fCentEst
name of the centrality estimator
virtual Bool_t FillGeneralHistograms()
UInt_t fTriggerSelectionBitMap
trigger selection bit map
TH1 * fHistCentrality
!event centrality distribution
static Byte_t GetTrackType(const AliVTrack *t)
virtual ~AliAnalysisTaskEmcalLight()
TH1 * fHistTriggerClasses
!number of events in each trigger class
TString fCaloCellsName
name of calo cell collection
TH1 * fHistEvents
!total number of events per pt hard bin
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
Double_t fMinCent
min centrality for event selection
Double_t fMinPtTrack
cut on track pt in event selection
virtual Bool_t FillHistograms()
Container for particles within the EMCAL framework.
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal
EBeamType_t fForceBeamType
forced beam type
virtual Bool_t IsEventSelected()
AliVCaloCells * fCaloCells
!cells
AliClusterContainer * AddClusterContainer(const char *n)
Bool_t fCreateHisto
whether or not create histograms
TH1 * fHistEventRejection
!book keep reasons for rejecting event
TH1 * fHistTrials
!trials from pyxsec.root
TString fFiredTriggerClasses
!trigger classes fired by the current event
Base task in the EMCAL framework (lighter version of AliAnalysisTaskEmcal)
EBeamType_t GetBeamType()
Double_t fVertex[3]
!event vertex
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Int_t fPtHardBin
!event pt hard bin
virtual AliVParticle * GetAcceptParticle(Int_t i=-1) const
Bool_t fIsPythia
if it is a PYTHIA production
TProfile * fHistXsection
!x section from pyxsec.root
Int_t fCentBin
!event centrality bin
Int_t fSelectPtHardBin
select one pt hard bin for analysis
TH1 * fHistEventsAfterSel
!total number of events per pt hard bin after selection
Double_t fMaxCent
max centrality for event selection
ULong_t fFiredTriggerBitMap
!bit map of fired triggers
virtual Bool_t RetrieveEventObjects()
Int_t fNVertSPDCont
!event SPD vertex number of contributors
Double_t fMinPtTrackInEmcal
min pt track in emcal
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
Bool_t fLocalInitialized
!whether or not the task has been already initialized
static EBeamType_t BeamTypeFromRunNumber(Int_t runnumber)
Int_t fMinNTrack
minimum nr of tracks in event with pT>fTrackPtCut
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Int_t fNVertCont
!event vertex number of contributors
AliMCParticleContainer * AddMCParticleContainer(const char *n)
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
Int_t GetRunNumber(TString)
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
TH1 * fHistPtHard
!pt hard distribution
AliAnalysisTaskEmcalLight()
TH1 * fHistTrialsAfterSel
!total number of trials per pt hard bin after selection
TH1 * fHistEventPlane
!event plane distribution
EBeamType_t
Switch for the beam type.
AliVCaloTrigger * fCaloTriggers
!calo triggers
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.
TH1 * fHistZVertex
!z vertex position
AliParticleContainer * AddParticleContainer(const char *n)
Double_t fMaxVz
max vertex for event selection
Double_t fCent
!event centrality
Double_t fEPV0C
!event plane V0C
Bool_t fUseNewCentralityEstimation
Use new centrality estimation (for 2015 data)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
TList * OpenFile(const char *fname)
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)
EDataType_t fDataType
!data type (ESD or AOD)