19 #include <TClonesArray.h> 22 #include <TObjString.h> 31 #include "AliAnalysisUtils.h" 32 #include "AliAODEvent.h" 33 #include "AliAODMCHeader.h" 34 #include "AliAODTrack.h" 35 #include "AliAnalysisManager.h" 36 #include "AliCentrality.h" 38 #include "AliEMCALGeometry.h" 40 #include "AliEMCALTriggerPatchInfo.h" 41 #include "AliESDEvent.h" 42 #include "AliAODInputHandler.h" 43 #include "AliESDInputHandler.h" 44 #include "AliEventplane.h" 45 #include "AliGenPythiaEventHeader.h" 46 #include "AliGenHerwigEventHeader.h" 47 #include "AliInputEventHandler.h" 49 #include "AliMCEvent.h" 50 #include "AliMCParticle.h" 51 #include "AliMultiInputEventHandler.h" 52 #include "AliMultSelection.h" 54 #include "AliVCaloTrigger.h" 55 #include "AliVCluster.h" 56 #include "AliVEventHandler.h" 57 #include "AliVParticle.h" 58 #include "AliNanoAODHeader.h" 71 fGeneralHistograms(kFALSE),
72 fLocalInitialized(kFALSE),
77 fCaloTriggerPatchInfoName(),
85 fUseAliAnaUtils(kFALSE),
86 fRejectPileup(kFALSE),
87 fTklVsClusSPDCut(kFALSE),
88 fOffTrigger(AliVEvent::kAny),
90 fMinBiasRefTrigger(
"CINT7-B-NOPF-ALLNOTRD"),
95 fMinPtTrackInEmcal(0),
96 fEventPlaneVsEmcal(-1),
100 fRecycleUnusedEmbeddedEventsMode(false),
104 fGetPtHardBinFromName(kTRUE),
105 fSelectPtHardBin(-999),
109 fNeedEmcalGeom(kTRUE),
110 fParticleCollArray(),
113 fEMCalTriggerMode(kOverlapWithLowThreshold),
114 fUseNewCentralityEstimation(kFALSE),
115 fGeneratePythiaInfoObject(kFALSE),
116 fUsePtHardBinScaling(kFALSE),
117 fUseXsecFromHeader(kFALSE),
118 fMCRejectFilter(kFALSE),
119 fCountDownscaleCorrectedEvents(kFALSE),
120 fPtHardAndJetPtFactor(0.),
121 fPtHardAndClusterPtFactor(0.),
122 fPtHardAndTrackPtFactor(0.),
144 fPtHardBinGlobal(-1),
145 fPtHardInitialized(false),
155 fHistXsectionAfterSel(
nullptr),
161 fHistPtHardCorrGlobal(
nullptr),
168 fHistTriggerClassesCorr(
nullptr)
294 DefineOutput(1, AliEmcalList::Class());
309 else AliError(Form(
"%s in SetClusPtCut(...): container %d not found",GetName(),c));
316 else AliError(Form(
"%s in SetClusTimeCut(...): container %d not found",GetName(),c));
323 else AliError(Form(
"%s in SetTrackPtCut(...): container %d not found",GetName(),c));
332 else AliError(Form(
"%s in SetTrackPtCut(...): container %d not found",GetName(),c));
339 else AliError(Form(
"%s in SetTrackPhiLimits(...): container %d not found",GetName(),c));
346 AliVEventHandler *evhand = mgr->GetInputEventHandler();
348 if (evhand->InheritsFrom(
"AliESDInputHandler")) {
356 AliError(
"Event handler not found!");
360 AliError(
"Analysis manager not found!");
394 fHistTrials->GetXaxis()->SetTitle(
"p_{T} hard bin");
399 fHistEvents->GetXaxis()->SetTitle(
"p_{T} hard bin");
409 Bool_t binningAvailable =
false;
411 AliInfoStream() <<
"Using custom pt-hard binning" << std::endl;
413 else AliErrorStream() <<
"Pt-hard binning (" <<
fPtHardBinning.GetSize() -1 <<
") does not match the amount of bins (" <<
fNPtHardBins <<
")" << std::endl;
417 AliInfoStream() <<
"11 pt-hard bins - fall back to default binning for bin labels" << std::endl;
418 const Int_t kDefaultPtHardBinning[12] = {0,5,11,21,36,57, 84,117,152,191,234,1000000};
421 binningAvailable =
true;
423 AliErrorStream() <<
"No default binning available for " <<
fNPtHardBins <<
" pt-hard bins - bin labels will not be set." << std::endl;
427 if(binningAvailable){
438 AliErrorStream() <<
"No suitable binning available - skipping bin labels" << std::endl;
443 fHistPtHard->GetXaxis()->SetTitle(
"p_{T,hard} (GeV/c)");
464 fHistZVertex =
new TH1F(
"fHistZVertex",
"Z vertex position", 60, -30, 30);
470 fHistCentrality =
new TH1F(
"fHistCentrality",
"Event centrality distribution", 200, 0, 100);
475 fHistEventPlane =
new TH1F(
"fHistEventPlane",
"Event plane", 120, -TMath::Pi(), TMath::Pi());
482 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2) 506 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2) 515 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2) 557 std::unique_ptr<TObjArray> triggerClasses(InputEvent()->GetFiredTriggerClasses().Tokenize(
" "));
558 TObjString* triggerClass(
nullptr);
559 for(
auto trg : *triggerClasses){
560 triggerClass =
static_cast<TObjString*
>(trg);
585 if (embeddingHelper && embeddingHelper->EmbeddedEventUsed() ==
false) {
618 AliDebugStream(1) <<
"Fallback to cross section from pythia header required" << std::endl;
664 AliWarning(
"AliAnalysisTaskEmcal::AcceptCluster method is deprecated. Please use GetCusterContainer(c)->AcceptCluster(clus).");
666 if (!clus)
return kFALSE;
670 AliError(Form(
"%s:Container %d not found",GetName(),c));
673 UInt_t rejectionReason = 0;
679 AliWarning(
"AliAnalysisTaskEmcal::AcceptTrack method is deprecated. Please use GetParticleContainer(c)->AcceptParticle(clus).");
681 if (!track)
return kFALSE;
685 AliError(Form(
"%s:Container %d not found",GetName(),c));
689 UInt_t rejectionReason = 0;
701 std::unique_ptr<TObjArray> walk(file.Tokenize(
"/"));
703 TString &tok =
static_cast<TObjString *
>(t)->String();
704 if(tok.Contains(
".zip")){
706 Int_t pos = archivetype.Index(
".zip");
707 archivetype.Replace(pos, archivetype.Length() - pos,
"");
710 if(archivetype.Length()){
711 AliDebugStream(1) <<
"Auto-detected archive type " << archivetype << std::endl;
712 Ssiz_t pos1 = file.Index(archivetype,archivetype.Length(),0,TString::kExact);
713 Ssiz_t pos = file.Index(
"#",1,pos1,TString::kExact);
714 Ssiz_t pos2 = file.Index(
".root",5,TString::kExact);
715 file.Replace(pos+1,pos2-pos1,
"");
718 file.ReplaceAll(
gSystem->BaseName(file.Data()),
"");
720 AliDebugStream(1) <<
"File name: " << file << std::endl;
725 if(file.Contains(
"__alice")){
727 Int_t pos = tmp.Index(
"__alice");
728 tmp.Replace(0, pos,
"");
729 tmp.ReplaceAll(
"__",
"/");
732 std::unique_ptr<TObjArray> toks(tmp.Tokenize(
"/"));
733 TString tag =
"_" + archivetype;
735 TString &path =
static_cast<TObjString *
>(t)->String();
736 if(path.Contains(tag)){
737 Int_t posTag = path.Index(tag);
738 path.Replace(posTag, path.Length() - posTag,
"");
740 virtualFileName +=
"/" + path;
743 virtualFileName =
file;
746 AliDebugStream(1) <<
"Physical file name " << file <<
", virtual file name " << virtualFileName << std::endl;
749 TString strPthard(virtualFileName);
772 bool binfound =
false;
773 std::unique_ptr<TObjArray> tokens(strPthard.Tokenize(
"/"));
774 for(
auto t : *tokens) {
775 TString &tok =
static_cast<TObjString *
>(t)->String();
777 Int_t number = tok.Atoi();
778 if(number > 2000 && number < 3000){
781 }
else if(number == fInputHandler->GetEvent()->GetRunNumber()){
795 AliErrorStream() <<
"Could not extract file number from path " << strPthard << std::endl;
797 AliInfoStream() <<
"Auto-detecting pt-hard bin " << pthard << std::endl;
800 AliInfoStream() <<
"File: " << file << std::endl;
803 std::unique_ptr<TFile> fxsec(TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec.root")));
807 fxsec = std::unique_ptr<TFile>(TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec_hists.root")));
809 AliErrorStream() <<
"Failed reading cross section from file " << file << std::endl;
815 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
816 if (!key)
return kFALSE;
817 TList *list =
dynamic_cast<TList*
>(key->ReadObj());
818 if (!list)
return kFALSE;
819 TProfile *xSecHist =
static_cast<TProfile*
>(list->FindObject(
"h1Xsec"));
821 if(!xSecHist->GetEntries()) {
823 AliErrorStream() <<
"No cross section information available in file " << fxsec->GetName() <<
" - fall back to cross section in PYTHIA header" << std::endl;
827 fXsec = xSecHist->GetBinContent(1);
828 if(!fXsec) AliErrorStream() << GetName() <<
": Cross section 0 for file " << file << std::endl;
831 fTrials = ((TH1F*)list->FindObject(
"h1Trials"))->GetBinContent(1);
834 TTree *xtree = (
TTree*)fxsec->Get(
"Xsection");
835 if (!xtree)
return kFALSE;
838 xtree->SetBranchAddress(
"xsection",&xsection);
839 xtree->SetBranchAddress(
"ntrials",&ntrials);
858 AliInfoStream() <<
"FileChanged called for run " << InputEvent()->GetRunNumber() << std::endl;
860 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
862 AliErrorStream() << GetName() <<
" - FileChanged: No current tree!" << std::endl;
868 Int_t pthardbin = -1;
870 TFile *curfile = tree->GetCurrentFile();
872 AliErrorStream() << GetName() <<
" - FileChanged: No current file!" << std::endl;
877 if (chain) tree = chain->GetTree();
894 AliErrorStream() << GetName() <<
": Invalid global pt-hard bin " << pthardbin <<
" detected" << std::endl;
899 AliDebugStream(1) <<
"Using cross section from file pyxsec.root" << std::endl;
912 AliError(Form(
"%s: Could not retrieve parton infos! %s!", GetName(),
fPythiaInfoName.Data()));
921 AliError(Form(
"%s: Could not retrieve event! Returning!", GetName()));
928 fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->
GetRunNumber());
930 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()));
942 AliWarning(
"Could not set event plane limits because EMCal geometry was not loaded!");
955 AliError(Form(
"%s: Could not retrieve first track branch!", GetName()));
969 AliError(Form(
"%s: Could not retrieve first cluster branch!", GetName()));
977 AliError(Form(
"%s: Could not retrieve cells %s!", GetName(),
fCaloCellsName.Data()));
985 AliError(Form(
"%s: Could not retrieve calo triggers %s!", GetName(),
fCaloTriggersName.Data()));
1009 const AliESDRun *run = esd->GetESDRun();
1010 TString beamType = run->GetBeamType();
1011 if (beamType ==
"p-p")
1013 else if (beamType ==
"A-A")
1015 else if (beamType ==
"p-A")
1020 Int_t runNumber = InputEvent()->GetRunNumber();
1022 if ((runNumber >= 136833 && runNumber <= 139517) ||
1023 (runNumber >= 167693 && runNumber <= 170593) ||
1024 (runNumber >= 244824 && runNumber <= 246994)) {
1026 }
else if ((runNumber >= 188356 && runNumber <= 188366) ||
1027 (runNumber >= 195164 && runNumber <= 197388) ||
1028 (runNumber >= 265015 && runNumber <= 267166)) {
1050 AliEMCALTriggerPatchInfo *patch;
1051 for (
Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1053 if (patch->IsGammaHigh()) nG1++;
1054 if (patch->IsGammaLow()) nG2++;
1055 if (patch->IsJetHigh()) nJ1++;
1056 if (patch->IsJetLow()) nJ2++;
1057 if (patch->IsLevel0()) nL0++;
1060 AliDebug(2,
"Patch summary: ");
1061 AliDebug(2, Form(
"Number of patches: %d", nPatch));
1062 AliDebug(2, Form(
"Jet: low[%d], high[%d]" ,nJ2, nJ1));
1063 AliDebug(2, Form(
"Gamma: low[%d], high[%d]" ,nG2, nG1));
1066 if (nL0>0) SETBIT(triggers,
kL0);
1067 if (nG1>0) SETBIT(triggers,
kG1);
1068 if (nG2>0) SETBIT(triggers,
kG2);
1069 if (nJ1>0) SETBIT(triggers,
kJ1);
1070 if (nJ2>0) SETBIT(triggers,
kJ2);
1078 AliWarning(Form(
"%s: Requesting undefined trigger type!", GetName()));
1090 AliDebugStream(1) <<
"Using default event selection" << std::endl;
1095 res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1099 res = ((AliVAODHeader*)aev->GetHeader())->GetOfflineTrigger();
1121 if (fCent<fMinCent || fCent>
fMaxCent) {
1157 if (vz < fMinVz || vz >
fMaxVz) {
1164 Double_t dvertex = TMath::Abs(vz-vzSPD);
1174 Bool_t trackInEmcalOk = kFALSE;
1176 for (
Int_t i = 0; i < ntracks; i++) {
1183 Int_t runNumber = InputEvent()->GetRunNumber();
1184 if (runNumber>=177295 && runNumber<=197470) {
1186 phiMax = TMath::Pi();
1189 if (track->Eta() <
fGeom->GetArm1EtaMin() || track->Eta() >
fGeom->GetArm1EtaMax() || track->Phi() < phiMin || track->Phi() >
phiMax)
1192 trackInEmcalOk = kTRUE;
1196 if (!trackInEmcalOk) {
1203 Int_t nTracksAcc = 0;
1205 for (
Int_t i = 0; i < ntracks; i++) {
1246 AliDebugStream(1) <<
"Using default trigger selection" << std::endl;
1248 TString fired = InputEvent()->GetFiredTriggerClasses();
1249 if (!fired.Contains(
"-B-"))
return kFALSE;
1251 std::unique_ptr<TObjArray> arr(
fTrigClass.Tokenize(
"|"));
1252 if (!arr)
return kFALSE;
1254 for (
Int_t i=0;i<arr->GetEntriesFast();++i) {
1259 TString objStr = obj->GetName();
1261 (objStr.Contains(
"J1") || objStr.Contains(
"J2") || objStr.Contains(
"G1") || objStr.Contains(
"G2"))) {
1266 if(objStr.Contains(
"G")) {
1270 if(objStr.Contains(trigType2) && fired.Contains(trigType2.Data())) {
1273 }
else if(objStr.Contains(trigType1) && fired.Contains(trigType1.Data()) && !fired.Contains(trigType2.Data())) {
1281 if (fired.Contains(obj->GetName())) {
1287 if (!match)
return kFALSE;
1302 AliDebug(1,Form(
"Njets: %d, pT Hard %f",nTriggerJets,
fPtHard));
1305 for (
Int_t ijet = 0; ijet< nTriggerJets; ijet++) {
1308 jet.SetPxPyPzE(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
1310 AliDebug(1,Form(
"jet %d; pycell jet pT %f",ijet, jet.Pt()));
1314 AliInfo(Form(
"Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
fPtHard, jet.Pt(),
fPtHardAndJetPtFactor));
1324 if ((
Bool_t)mccluscont) {
1325 for (
auto cluster : mccluscont->all()) {
1326 Float_t ecluster = cluster->E();
1340 if ((
Bool_t)mcpartcont) {
1341 for (
auto mctrack : mcpartcont->
all()) {
1342 Float_t trackpt = mctrack->Pt();
1357 TClonesArray *arr = 0;
1359 if (!sname.IsNull()) {
1360 arr =
dynamic_cast<TClonesArray*
>(InputEvent()->FindListObject(sname));
1362 AliWarning(Form(
"%s: Could not retrieve array with name %s!", GetName(), name));
1372 TString objname(arr->GetClass()->GetName());
1373 TClass cls(objname);
1374 if (!cls.InheritsFrom(clname)) {
1375 AliWarning(Form(
"%s: Objects of type %s in %s are not inherited from %s!",
1376 GetName(), cls.GetName(), name, clname));
1398 const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
1404 const AliVVertex *vertSPD = InputEvent()->GetPrimaryVertexSPD();
1411 TObject * header = InputEvent()->GetHeader();
1414 if (header->InheritsFrom(
"AliNanoAODStorage")){
1415 AliNanoAODHeader *nanoHead = (AliNanoAODHeader*)header;
1418 AliMultSelection *MultSelection =
static_cast<AliMultSelection*
>(InputEvent()->FindListObject(
"MultSelection"));
1419 if (MultSelection) {
1420 fCent = MultSelection->GetMultiplicityPercentile(
fCentEst.Data());
1423 AliWarning(Form(
"%s: Could not retrieve centrality information! Assuming 99", GetName()));
1428 if (header->InheritsFrom(
"AliNanoAODStorage")){
1429 AliNanoAODHeader *nanoHead = (AliNanoAODHeader*)header;
1432 AliCentrality *aliCent = InputEvent()->GetCentrality();
1437 AliWarning(Form(
"%s: Could not retrieve centrality information! Assuming 99", GetName()));
1448 AliWarning(Form(
"%s: Negative centrality: %f. Assuming 99", GetName(),
fCent));
1457 else if (
fCent > 90) {
1462 AliWarning(Form(
"%s: Negative centrality: %f. Assuming 99", GetName(),
fCent));
1475 AliWarning(Form(
"%s: fCentBin too large: cent = %f fCentBin = %d. Assuming 99", GetName(),
fCent,
fCentBin));
1479 if (header->InheritsFrom(
"AliNanoAODStorage")){
1480 AliNanoAODHeader *nanoHead = (AliNanoAODHeader*)header;
1481 fEPV0=nanoHead->GetVar(nanoHead->GetVarIndex(
"cstEvPlaneV0"));
1482 fEPV0A=nanoHead->GetVar(nanoHead->GetVarIndex(
"cstEvPlaneV0A"));
1483 fEPV0C=nanoHead->GetVar(nanoHead->GetVarIndex(
"cstEvPlaneV0C"));
1485 AliEventplane *aliEP = InputEvent()->GetEventplane();
1487 fEPV0 = aliEP->GetEventplane(
"V0" ,InputEvent());
1488 fEPV0A = aliEP->GetEventplane(
"V0A",InputEvent());
1489 fEPV0C = aliEP->GetEventplane(
"V0C",InputEvent());
1491 AliWarning(Form(
"%s: Could not retrieve event plane information!", GetName()));
1502 fPythiaHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(MCEvent()->GenEventHeader());
1505 AliAODMCHeader* aodMCH =
dynamic_cast<AliAODMCHeader*
>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1508 for (
UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1509 fPythiaHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(aodMCH->GetCocktailHeader(i));
1534 AliErrorStream() << GetName() <<
": Mismatch in pt-hard bin determination. Local: " <<
fPtHardBin <<
", Global: " <<
fPtHardBinGlobal << std::endl;
1544 fHerwigHeader =
dynamic_cast<AliGenHerwigEventHeader*
>(MCEvent()->GenEventHeader());
1548 AliAODMCHeader* aodMCH =
dynamic_cast<AliAODMCHeader*
>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1551 for (
UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1552 fHerwigHeader =
dynamic_cast<AliGenHerwigEventHeader*
>(aodMCH->GetCocktailHeader(i));
1580 AliEmcalContainer* cont = 0;
1583 while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))){
1584 cont->NextEvent(InputEvent());
1588 while ((cont = static_cast<AliParticleContainer*>(nextClusColl()))){
1589 cont->NextEvent(InputEvent());
1597 if (
TString(n).IsNull())
return 0;
1608 if (
TString(n).IsNull())
return 0;
1619 if (
TString(n).IsNull())
return 0;
1630 if (
TString(n).IsNull())
return 0;
1669 AliError(Form(
"%s: Particle container %d not found",GetName(),i));
1672 TString contName = cont->GetArrayName();
1673 return cont->GetArray();
1680 AliError(Form(
"%s:Cluster container %d not found",GetName(),i));
1683 return cont->GetArray();
1691 AliError(Form(
"%s: Particle container %d not found",GetName(),c));
1703 AliError(Form(
"%s: Cluster container %d not found",GetName(),c));
1715 AliError(Form(
"%s: Particle container %d not found",GetName(),i));
1718 return cont->GetNEntries();
1725 AliError(Form(
"%s: Cluster container %d not found",GetName(),i));
1728 return cont->GetNEntries();
1735 AliError(Form(
"%s: fTriggerPatchInfo not available",GetName()));
1743 AliEMCALTriggerPatchInfo *patch(NULL), *selected(NULL);
1744 for (
Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1747 if (patch->IsMainTrigger()) {
1748 if(doSimpleOffline){
1749 if(patch->IsOfflineSimple()){
1753 if(patch->IsLevel0()) selected = patch;
1756 if(patch->IsJetHighSimple() || patch->IsJetLowSimple()){
1757 if(!selected) selected = patch;
1758 else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1762 if(patch->IsGammaHighSimple() || patch->IsGammaLowSimple()){
1763 if(!selected) selected = patch;
1764 else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1768 AliError(
"Untreated case: Main Patch is recalculated; should be in 'else' branch");
1774 if(patch->IsLevel0()) selected = patch;
1777 if(patch->IsJetHigh() || patch->IsJetLow()){
1778 if(!selected) selected = patch;
1779 else if (patch->GetADCAmp() > selected->GetADCAmp())
1784 if(patch->IsGammaHigh() || patch->IsGammaLow()){
1785 if(!selected) selected = patch;
1786 else if (patch->GetADCAmp() > selected->GetADCAmp())
1791 AliError(
"Untreated case: Main Patch is recalculated; should be in 'else' branch");
1797 if (doSimpleOffline && patch->IsOfflineSimple()) {
1798 if(!selected) selected = patch;
1799 else if (patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp())
1802 else if (!doSimpleOffline && !patch->IsOfflineSimple()) {
1803 if(!selected) selected = patch;
1804 else if (patch->GetADCAmp() > selected->GetADCAmp())
1814 if (!(InputEvent()->FindListObject(obj->GetName()))) {
1815 InputEvent()->AddObject(obj);
1819 AliFatal(Form(
"%s: Container with name %s already present. Aborting", GetName(), obj->GetName()));
1828 AliWarning(Form(
"%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
1835 if (part->Phi() > minPhi && part->Phi() < maxPhi) {
1845 axis->SetBinLabel(1,
"NullObject");
1846 axis->SetBinLabel(2,
"Pt");
1847 axis->SetBinLabel(3,
"Acceptance");
1848 axis->SetBinLabel(4,
"MCLabel");
1849 axis->SetBinLabel(5,
"BitMap");
1850 axis->SetBinLabel(6,
"HF cut");
1851 axis->SetBinLabel(7,
"Bit6");
1852 axis->SetBinLabel(8,
"NotHybridTrack");
1853 axis->SetBinLabel(9,
"MCFlag");
1854 axis->SetBinLabel(10,
"MCGenerator");
1855 axis->SetBinLabel(11,
"ChargeCut");
1856 axis->SetBinLabel(12,
"MinDistanceTPCSectorEdge");
1857 axis->SetBinLabel(13,
"Bit12");
1858 axis->SetBinLabel(14,
"IsEMCal");
1859 axis->SetBinLabel(15,
"Time");
1860 axis->SetBinLabel(16,
"Energy");
1861 axis->SetBinLabel(17,
"ExoticCut");
1862 axis->SetBinLabel(18,
"Bit17");
1863 axis->SetBinLabel(19,
"Area");
1864 axis->SetBinLabel(20,
"AreaEmc");
1865 axis->SetBinLabel(21,
"ZLeadingCh");
1866 axis->SetBinLabel(22,
"ZLeadingEmc");
1867 axis->SetBinLabel(23,
"NEF");
1868 axis->SetBinLabel(24,
"MinLeadPt");
1869 axis->SetBinLabel(25,
"MaxTrackPt");
1870 axis->SetBinLabel(26,
"MaxClusterPt");
1871 axis->SetBinLabel(27,
"Flavour");
1872 axis->SetBinLabel(28,
"TagStatus");
1873 axis->SetBinLabel(29,
"MinNConstituents");
1874 axis->SetBinLabel(30,
"Bit29");
1875 axis->SetBinLabel(31,
"Bit30");
1876 axis->SetBinLabel(32,
"Bit31");
1881 TVector3 vect1(part1->Px(), part1->Py(), part1->Pz());
1882 TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1883 Double_t z = (vect1 * vect2) / (vect2 * vect2);
1889 TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1890 Double_t z = (vect1 * vect2) / (vect2 * vect2);
1901 Double_t veta = t->GetTrackEtaOnEMCal();
1902 Double_t vphi = t->GetTrackPhiOnEMCal();
1905 v->GetPosition(pos);
1910 phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
1916 if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
1918 else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
1920 else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
1930 if (aodTrack->TestFilterBit(filterBit1)) {
1933 else if (aodTrack->TestFilterBit(filterBit2)) {
1934 if ((aodTrack->GetStatus()&AliVTrack::kITSrefit)!=0) {
1954 AliStack*
stack = mcEvent->Stack();
1956 const Int_t nprim = stack->GetNprimary();
1958 if (nprim < 8)
return;
1960 TParticle *part6 = stack->Particle(6);
1961 TParticle *part7 = stack->Particle(7);
1969 AliGenPythiaEventHeader *pythiaGenHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(mcEvent->GenEventHeader());
1970 if(pythiaGenHeader){
1979 ::Error(
"AddAODHandler",
"No analysis manager to connect to.");
1983 AliAODInputHandler* aodHandler =
new AliAODInputHandler();
1985 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
1986 if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
1987 AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
1988 multiInputHandler->AddInputEventHandler(aodHandler);
1991 if (!inputHandler) {
1992 mgr->SetInputEventHandler(aodHandler);
1995 ::Error(
"AddAODHandler",
"inputHandler is NOT null. AOD handler was NOT added !!!");
2007 ::Error(
"AddESDHandler",
"No analysis manager to connect to.");
2011 AliESDInputHandler *esdHandler =
new AliESDInputHandler();
2013 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
2014 if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
2015 AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2016 multiInputHandler->AddInputEventHandler(esdHandler);
2019 if (!inputHandler) {
2020 mgr->SetInputEventHandler(esdHandler);
2023 ::Error(
"AddESDHandler",
"inputHandler is NOT null. ESD handler was NOT added !!!");
virtual Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
Bool_t fGeneratePythiaInfoObject
Generate Pythia info object.
TObjArray fClusterCollArray
cluster collection array
Int_t fNVertSPDCont
!event SPD vertex number of contributors
void SetParticlePtCut(Double_t cut)
Bool_t fIsPythia
trigger, if it is a PYTHIA production
void SetParton7(Float_t pt, Float_t eta, Float_t phi, Float_t mass=0)
TH2 * fHistPtHardBinCorr
!Correlation between global and local (per-event) -hard bin
TH1 * fHistTrials
!trials from pyxsec.root
Bool_t fPtHardInitialized
!flag whether the -hard bin was initialized, purely for internal processing
void SetArray(const AliVEvent *event)
EMCAL Level1 gamma trigger, low threshold.
AliEmcalPythiaInfo * fPythiaInfo
!event parton info
Bool_t AcceptTrack(AliVParticle *track, Int_t c=0) const
ULong_t GetTriggerList()
Get list of selected triggers of the given event.
Int_t fPtHardBinGlobal
!event -hard bin, detected from filename
EMCAL Level1 jet trigger, low threshold.
Bool_t HasTriggerType(TriggerType triggersel)
Check if event has a given trigger type.
Int_t fNTrials
!event trials
UInt_t fOffTrigger
offline trigger for event selection
Double_t fVertexSPD[3]
!event Svertex
Double_t fMinCent
min centrality for event selection
Double_t fTrackPtCut
cut on track pt in event selection
Bool_t fRecycleUnusedEmbeddedEventsMode
Allows the recycling of embedded events which fail internal event selection. See the embedding helper...
Recalculated jet trigger patch; does not need to be above trigger threshold.
Base task in the EMCAL framework.
Bool_t fLocalInitialized
whether or not the task has been already initialized
Bool_t fUsePtHardBinScaling
Use -hard bin scaling in merging.
TH2 * fHistPtHardCorrGlobal
!Correlation between -hard value and global bin
void SetPartonFlag7(Int_t flag7)
Container with name, TClonesArray and cuts for particles.
Bool_t fUseXsecFromHeader
! Use cross section from header instead of pyxsec.root (purely transient)
void SetTrackPtCut(Double_t cut, Int_t c=0)
Apply cut on the transverse momentum of all tracks in the track container with index c...
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
Calculate and difference between a track (t) and a cluster (c).
Double_t fMinBinPt
min pt in histograms
Double_t fEPV0
!event plane V0
static AliEmcalDownscaleFactorsOCDB * Instance()
Int_t fNPtHardBins
Number of -hard bins in the dataset.
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
Declaration of class AliAnalysisTaskEmcalEmbeddingHelper.
Bool_t AcceptCluster(AliVCluster *clus, Int_t c=0) const
Cluster selection.
virtual void UserExecOnce()
Task initializations handled in user tasks.
Int_t fCentBin
!event centrality bin
virtual Bool_t IsTriggerSelected()
Selection of a hardware trigger.
TH1 * fHistEventsAfterSel
!total number of events per pt hard bin after selection
Double_t GetDownscaleFactorForTriggerClass(const TString &trigger) const
const AliMCParticleIterableContainer all() const
Float_t fPtHardAndClusterPtFactor
Factor between ptHard and cluster pT to reject/accept event.
Double_t fMinPtTrackInEmcal
min pt track in emcal
TH1 * fHistEventPlane
!event plane distribution
TH1 * fHistEvents
!total number of events per pt hard bin
void SetClusPtCut(Double_t cut, Int_t c=0)
Apply cut on for all clusters in container with index c.
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
Double_t fEPV0C
!event plane V0C
void SetParton6(Float_t pt, Float_t eta, Float_t phi, Float_t mass=0)
TH1 * fHistCentrality
!event centrality distribution
Container for particles within the EMCAL framework.
Bool_t fIsEmbedded
trigger, embedded signal
TObjArray fParticleCollArray
particle/track collection array
BeamType
Switch for the beam type.
void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0)
Apply cut on the pseudorapidity of the all tracks in the track container with index c...
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
Level1 jet trigger patch.
TProfile * fHistXsectionAfterSel
!x section from pythia header
TriggerType
Switch for EMCAL trigger types.
Bool_t CheckMCOutliers()
Filter the mc tails in pt-hard distributions.
EMCalTriggerMode_t fEMCalTriggerMode
EMCal trigger selection mode.
virtual Bool_t FillHistograms()
Function filling histograms.
void SetRun(int runnumber)
Int_t GetNParticles(Int_t i=0) const
Get number of particles in container attached to this task with index i.
TClonesArray * fCaloClusters
!clusters
Bool_t fUseNewCentralityEstimation
Use new centrality estimation (for 2015 data)
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
Determines if a track is inside the EMCal acceptance.
TH1 * fHistTriggerClasses
!number of events in each trigger class
Bool_t fCountDownscaleCorrectedEvents
Count event number corrected for downscaling.
Double_t fMaxVz
max vertex for event selection
void GeneratePythiaInfoObject(AliMCEvent *mcEvent)
Copy some information about the Pythia event in a PythaInfo object.
AliEMCALGeometry * fGeom
!emcal geometry
The overlap between low and high threshold trigger is assigned to the lower threshold only...
kRecalculated gamma trigger patch; does not need to be above trigger threshold
TString fCaloTriggerPatchInfoName
trigger patch info array name
TString fCaloTriggersName
name of calo triggers collection
TH1 * fHistTriggerClassesCorr
!corrected number of events in each trigger class
Bool_t fIsHerwig
trigger, if it is a HERWIG production
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0)
Apply cut on azimuthal angle of the all tracks in the track container with index c...
AliParticleContainer * AddParticleContainer(const char *n)
Create new particle container and attach it to the task.
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
BeamType fForceBeamType
forced beam type
void SetUseScaling(Bool_t val)
Int_t fNcentBins
how many centrality bins
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
TriggerType fTriggerTypeSel
trigger type to select based on trigger patches
virtual Bool_t AcceptCluster(Int_t i, UInt_t &rejectionReason) const
virtual Bool_t FillGeneralHistograms()
Filling general histograms.
TString fTrigClass
trigger class name for event selection
Float_t fPtHardAndJetPtFactor
Factor between ptHard and jet pT to reject/accept event.
AliVCluster * GetAcceptCluster(Int_t i) const
TClonesArray * GetParticleArray(Int_t i=0) const
Get TClonesArray with particles.
BeamType GetBeamType() const
Get beam type.
Double_t fMinVz
min vertex for event selection
virtual AliVParticle * GetAcceptParticle(Int_t i=-1) const
BeamType fBeamType
!event beam type
Float_t fPtHardAndTrackPtFactor
Factor between ptHard and track pT to reject/accept event.
Double_t fCent
!event centrality
Double_t fMinEventPlane
minimum event plane value
TString fCaloCellsName
name of calo cell collection
Int_t fMCLabelShift
if MC label > fMCLabelShift, MC label -= fMCLabelShift
Int_t GetNClusters(Int_t i=0) const
Get number of clusters in the cluster container attached to this task with index i.
Int_t fNVertCont
!event vertex number of contributors
Bool_t fMCRejectFilter
enable the filtering of events by tail rejection
Bool_t fGetPtHardBinFromName
Obtain pt-hard bin from file path.
Double_t fZvertexDiff
upper limit for distance between primary and SPD vertex
virtual Bool_t AcceptParticle(const AliVParticle *vp, UInt_t &rejectionReason) const
AliEMCALTriggerPatchInfo * GetMainTriggerPatch(TriggerCategory triggersel=kTriggerLevel1Jet, Bool_t doSimpleOffline=kFALSE)
Get main trigger match.
EMCAL Level1 jet trigger, high threshold.
Int_t fSelectPtHardBin
select one pt hard bin for analysis
AliMCParticleContainer * AddMCParticleContainer(const char *n)
Create new container for MC particles and attach it to the task.
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)
Calculates the fraction of momentum z of part 1 w.r.t. part 2 in the direction of part 2...
virtual Bool_t RetrieveEventObjects()
Retrieve common objects from event.
Bool_t fRejectPileup
Reject pilup using function AliAnalysisUtils::IsPileUpEvent()
TProfile * fHistXsection
!x section from pyxsec.root
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
Loading PYTHIA information from external cross section file into the task.
void UserExec(Option_t *option)
Event loop, called for each event.
Int_t fMinMCLabel
minimum MC label value for the tracks/clusters being considered MC particles
void SetPartonFlag6(Int_t flag6)
AliVCaloCells * fCaloCells
!cells
TClonesArray * GetArrayFromEvent(const char *name, const char *clname=0)
Read a TClonesArray from event.
Enhanced TList-derived class that implements correct merging for pt_hard binned production.
Double_t fEventPlaneVsEmcal
select events which have a certain event plane wrt the emcal
virtual Bool_t IsEventSelected()
Performing event selection.
Float_t fPtHard
!event -hard
TH1 * fHistPtHard
! -hard distribution
std::vector< TString > GetTriggerClasses() const
void SetParticleEtaLimits(Double_t min, Double_t max)
AliEmcalList * fOutput
!output list
Handler for downscale factors for various triggers obtained from the OCDB.
Double_t fMaxBinPt
max pt in histograms
Int_t fPtHardBin
!event -hard bin
virtual void RunChanged(Int_t)
Process tasks relevant when a file with a different run number is processed.
TClonesArray * fTracks
!tracks
TH1 * fHistTrialsAfterSel
!total number of trials per pt hard bin after selection
AliGenHerwigEventHeader * fHerwigHeader
!event Herwig header
void LoadPythiaInfo(AliVEvent *event)
Load parton info.
Bool_t fIsEsd
!whether it's an ESD analysis
static AliAODInputHandler * AddAODHandler()
Add an AOD handler to the analysis manager.
Double_t fVertex[3]
!event vertex
AliTrackContainer * AddTrackContainer(const char *n)
Create new track container and attach it to the task.
Bool_t fCreateHisto
whether or not create histograms
Bool_t UserNotify()
Notifying the user that the input data file has changed and performing steps needed to be done...
Store some informaion about a Pythia eventThis class is used to store some information about a Pythia...
TFile * file
TList with histograms for a given trigger.
TH1 * fHistEventRejection
!book keep reasons for rejecting event
TClonesArray * fTriggerPatchInfo
!trigger patch info array
TClonesArray * GetClusterArray(Int_t i=0) const
Get TClonesArray with EMCAL clusters.
Bool_t FileChanged()
Steps to be executed when a few file is loaded into the input handler.
Double_t fEPV0A
!event plane V0A
virtual void ExecOnce()
Perform steps needed to initialize the analysis.
TString fCentEst
name of V0 centrality estimator
void SetArray(const AliVEvent *event)
TString fPythiaInfoName
name of pythia info object
Int_t GetRunNumber(TString)
Declaration of class AliEmcalPythiaInfo.
void SetClusPtCut(Double_t cut)
Int_t fRunNumber
!run number (triggering RunChanged()
EMCAL Level1 gamma trigger, high threshold.
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
Add object to event.
AliVCaloTrigger * fCaloTriggers
!calo triggers
void SetRejectionReasonLabels(TAxis *axis)
void UserCreateOutputObjects()
Main initialization function on the worker.
Bool_t fFileChanged
! Signal triggered when the file has changed
TH1 * fHistZVertex
!z vertex position
Int_t fMinNTrack
minimum nr of tracks in event with pT>fTrackPtCut
static Byte_t GetTrackType(const AliVTrack *t)
Get track type encoded from bits 20 and 21.
Bool_t fUseAliAnaUtils
used for LHC13* data: z-vtx, Ncontributors, z-vtx resolution cuts
void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0)
Apply cut on cluster time for clusters in container with index c.
ULong_t fTriggers
list of fired triggers
static AliESDInputHandler * AddESDHandler()
Add a ESD handler to the analysis manager.
Double_t fMaxEventPlane
maximum event plane value
void SetPythiaEventWeight(Float_t ptWeight)
Float_t fXsection
!x-section from pythia header
TH1 * fHistEventCount
!incoming and selected events
Double_t fMaxCent
max centrality for event selection
void SetClusTimeCut(Double_t min, Double_t max)
TriggerCategory
Online trigger categories.
void SetParticlePhiLimits(Double_t min, Double_t max)
AliVParticle * GetAcceptParticleFromArray(Int_t p, Int_t c=0) const
Get particle p if accepted from container with index c If particle not accepted return 0...
Container structure for EMCAL clusters.
TString fMinBiasRefTrigger
Name of the minmum bias reference trigger, used in the calculation of downscale-corrected event numbe...
Container for MC-true particles within the EMCAL framework.
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
AliVCluster * GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const
Get cluster cl if accepted from container c If particle not accepted return 0.
Int_t fNbins
no. of pt bins
Bool_t fTklVsClusSPDCut
Apply tracklet-vs-cluster SPD cut to reject background events in pp.
AliAnalysisTaskEmcal()
Default constructor.
TH2 * fHistPtHardCorr
!Correlation between -hard value and bin
TArrayI fPtHardBinning
-hard binning
TList * OpenFile(const char *fname)
virtual ~AliAnalysisTaskEmcal()
Destructor.
Level1 gamma trigger patch.
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal