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"
70 fGeneralHistograms(kFALSE),
71 fLocalInitialized(kFALSE),
76 fCaloTriggerPatchInfoName(),
84 fUseAliAnaUtils(kFALSE),
85 fRejectPileup(kFALSE),
86 fTklVsClusSPDCut(kFALSE),
87 fOffTrigger(AliVEvent::kAny),
89 fMinBiasRefTrigger(
"CINT7-B-NOPF-ALLNOTRD"),
94 fMinPtTrackInEmcal(0),
95 fEventPlaneVsEmcal(-1),
102 fGetPtHardBinFromName(kTRUE),
103 fSelectPtHardBin(-999),
107 fNeedEmcalGeom(kTRUE),
108 fParticleCollArray(),
111 fEMCalTriggerMode(kOverlapWithLowThreshold),
112 fUseNewCentralityEstimation(kFALSE),
113 fGeneratePythiaInfoObject(kFALSE),
114 fUsePtHardBinScaling(kFALSE),
115 fUseXsecFromHeader(kFALSE),
116 fMCRejectFilter(kFALSE),
117 fCountDownscaleCorrectedEvents(kFALSE),
118 fPtHardAndJetPtFactor(0.),
119 fPtHardAndClusterPtFactor(0.),
120 fPtHardAndTrackPtFactor(0.),
142 fPtHardBinGlobal(-1),
143 fPtHardInitialized(false),
153 fHistXsectionAfterSel(
nullptr),
159 fHistPtHardCorrGlobal(
nullptr),
166 fHistTriggerClassesCorr(
nullptr)
183 fGeneralHistograms(kFALSE),
184 fLocalInitialized(kFALSE),
185 fFileChanged(kFALSE),
189 fCaloTriggerPatchInfoName(),
197 fUseAliAnaUtils(kFALSE),
198 fRejectPileup(kFALSE),
199 fTklVsClusSPDCut(kFALSE),
200 fOffTrigger(AliVEvent::kAny),
202 fMinBiasRefTrigger(
"CINT7-B-NOPF-ALLNOTRD"),
203 fTriggerTypeSel(kND),
207 fMinPtTrackInEmcal(0),
208 fEventPlaneVsEmcal(-1),
209 fMinEventPlane(-1e6),
215 fGetPtHardBinFromName(kTRUE),
216 fSelectPtHardBin(-999),
220 fNeedEmcalGeom(kTRUE),
221 fParticleCollArray(),
224 fEMCalTriggerMode(kOverlapWithLowThreshold),
225 fUseNewCentralityEstimation(kFALSE),
226 fGeneratePythiaInfoObject(kFALSE),
227 fUsePtHardBinScaling(kFALSE),
228 fUseXsecFromHeader(kFALSE),
229 fMCRejectFilter(kFALSE),
230 fCountDownscaleCorrectedEvents(kFALSE),
231 fPtHardAndJetPtFactor(0.),
232 fPtHardAndClusterPtFactor(0.),
233 fPtHardAndTrackPtFactor(0.),
255 fPtHardBinGlobal(-1),
256 fPtHardInitialized(false),
266 fHistXsectionAfterSel(
nullptr),
272 fHistPtHardCorrGlobal(
nullptr),
279 fHistTriggerClassesCorr(
nullptr)
291 DefineOutput(1, AliEmcalList::Class());
303 else AliError(Form(
"%s in SetClusPtCut(...): container %d not found",GetName(),c));
310 else AliError(Form(
"%s in SetClusTimeCut(...): container %d not found",GetName(),c));
317 else AliError(Form(
"%s in SetTrackPtCut(...): container %d not found",GetName(),c));
326 else AliError(Form(
"%s in SetTrackPtCut(...): container %d not found",GetName(),c));
333 else AliError(Form(
"%s in SetTrackPhiLimits(...): container %d not found",GetName(),c));
340 AliVEventHandler *evhand = mgr->GetInputEventHandler();
342 if (evhand->InheritsFrom(
"AliESDInputHandler")) {
350 AliError(
"Event handler not found!");
354 AliError(
"Analysis manager not found!");
388 fHistTrials->GetXaxis()->SetTitle(
"p_{T} hard bin");
393 fHistEvents->GetXaxis()->SetTitle(
"p_{T} hard bin");
403 Bool_t binningAvailable =
false;
405 AliInfoStream() <<
"Using custom pt-hard binning" << std::endl;
407 else AliErrorStream() <<
"Pt-hard binning (" <<
fPtHardBinning.GetSize() -1 <<
") does not match the amount of bins (" <<
fNPtHardBins <<
")" << std::endl;
411 AliInfoStream() <<
"11 pt-hard bins - fall back to default binning for bin labels" << std::endl;
412 const Int_t kDefaultPtHardBinning[12] = {0,5,11,21,36,57, 84,117,152,191,234,1000000};
415 binningAvailable =
true;
417 AliErrorStream() <<
"No default binning available for " <<
fNPtHardBins <<
" pt-hard bins - bin labels will not be set." << std::endl;
421 if(binningAvailable){
432 AliErrorStream() <<
"No suitable binning available - skipping bin labels" << std::endl;
437 fHistPtHard->GetXaxis()->SetTitle(
"p_{T,hard} (GeV/c)");
458 fHistZVertex =
new TH1F(
"fHistZVertex",
"Z vertex position", 60, -30, 30);
464 fHistCentrality =
new TH1F(
"fHistCentrality",
"Event centrality distribution", 200, 0, 100);
469 fHistEventPlane =
new TH1F(
"fHistEventPlane",
"Event plane", 120, -TMath::Pi(), TMath::Pi());
476 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
499 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
508 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
550 std::unique_ptr<TObjArray> triggerClasses(InputEvent()->GetFiredTriggerClasses().Tokenize(
" "));
551 TObjString* triggerClass(
nullptr);
552 for(
auto trg : *triggerClasses){
553 triggerClass =
static_cast<TObjString*
>(trg);
599 AliDebugStream(1) <<
"Fallback to cross section from pythia header required" << std::endl;
643 AliWarning(
"AliAnalysisTaskEmcal::AcceptCluster method is deprecated. Please use GetCusterContainer(c)->AcceptCluster(clus).");
645 if (!clus)
return kFALSE;
649 AliError(Form(
"%s:Container %d not found",GetName(),c));
652 UInt_t rejectionReason = 0;
658 AliWarning(
"AliAnalysisTaskEmcal::AcceptTrack method is deprecated. Please use GetParticleContainer(c)->AcceptParticle(clus).");
660 if (!track)
return kFALSE;
664 AliError(Form(
"%s:Container %d not found",GetName(),c));
668 UInt_t rejectionReason = 0;
680 std::unique_ptr<TObjArray> walk(file.Tokenize(
"/"));
682 TString &tok =
static_cast<TObjString *
>(t)->String();
683 if(tok.Contains(
".zip")){
685 Int_t pos = archivetype.Index(
".zip");
686 archivetype.Replace(pos, archivetype.Length() - pos,
"");
689 if(archivetype.Length()){
690 AliDebugStream(1) <<
"Auto-detected archive type " << archivetype << std::endl;
691 Ssiz_t pos1 = file.Index(archivetype,archivetype.Length(),0,TString::kExact);
692 Ssiz_t pos = file.Index(
"#",1,pos1,TString::kExact);
693 Ssiz_t pos2 = file.Index(
".root",5,TString::kExact);
694 file.Replace(pos+1,pos2-pos1,
"");
697 file.ReplaceAll(
gSystem->BaseName(file.Data()),
"");
699 AliDebugStream(1) <<
"File name: " << file << std::endl;
704 if(file.Contains(
"__alice")){
706 Int_t pos = tmp.Index(
"__alice");
707 tmp.Replace(0, pos,
"");
708 tmp.ReplaceAll(
"__",
"/");
711 std::unique_ptr<TObjArray> toks(tmp.Tokenize(
"/"));
712 TString tag =
"_" + archivetype;
714 TString &path =
static_cast<TObjString *
>(t)->String();
715 if(path.Contains(tag)){
716 Int_t posTag = path.Index(tag);
717 path.Replace(posTag, path.Length() - posTag,
"");
719 virtualFileName +=
"/" + path;
722 virtualFileName =
file;
725 AliDebugStream(1) <<
"Physical file name " << file <<
", virtual file name " << virtualFileName << std::endl;
728 TString strPthard(virtualFileName);
751 bool binfound =
false;
752 std::unique_ptr<TObjArray> tokens(strPthard.Tokenize(
"/"));
753 for(
auto t : *tokens) {
754 TString &tok =
static_cast<TObjString *
>(t)->String();
756 Int_t number = tok.Atoi();
757 if(number > 2000 && number < 3000){
760 }
else if(number == fInputHandler->GetEvent()->GetRunNumber()){
774 AliErrorStream() <<
"Could not extract file number from path " << strPthard << std::endl;
776 AliInfoStream() <<
"Auto-detecting pt-hard bin " << pthard << std::endl;
779 AliInfoStream() <<
"File: " << file << std::endl;
782 std::unique_ptr<TFile> fxsec(TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec.root")));
786 fxsec = std::unique_ptr<TFile>(TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec_hists.root")));
788 AliErrorStream() <<
"Failed reading cross section from file " << file << std::endl;
794 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
795 if (!key)
return kFALSE;
796 TList *list =
dynamic_cast<TList*
>(key->ReadObj());
797 if (!list)
return kFALSE;
798 TProfile *xSecHist =
static_cast<TProfile*
>(list->FindObject(
"h1Xsec"));
800 if(!xSecHist->GetEntries()) {
802 AliErrorStream() <<
"No cross section information available in file " << fxsec->GetName() <<
" - fall back to cross section in PYTHIA header" << std::endl;
806 fXsec = xSecHist->GetBinContent(1);
807 if(!fXsec) AliErrorStream() << GetName() <<
": Cross section 0 for file " << file << std::endl;
810 fTrials = ((TH1F*)list->FindObject(
"h1Trials"))->GetBinContent(1);
813 TTree *xtree = (
TTree*)fxsec->Get(
"Xsection");
814 if (!xtree)
return kFALSE;
817 xtree->SetBranchAddress(
"xsection",&xsection);
818 xtree->SetBranchAddress(
"ntrials",&ntrials);
837 AliInfoStream() <<
"FileChanged called for run " << InputEvent()->GetRunNumber() << std::endl;
839 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
841 AliErrorStream() << GetName() <<
" - FileChanged: No current tree!" << std::endl;
847 Int_t pthardbin = -1;
849 TFile *curfile = tree->GetCurrentFile();
851 AliErrorStream() << GetName() <<
" - FileChanged: No current file!" << std::endl;
856 if (chain) tree = chain->GetTree();
873 AliErrorStream() << GetName() <<
": Invalid global pt-hard bin " << pthardbin <<
" detected" << std::endl;
878 AliDebugStream(1) <<
"Using cross section from file pyxsec.root" << std::endl;
891 AliError(Form(
"%s: Could not retrieve parton infos! %s!", GetName(),
fPythiaInfoName.Data()));
900 AliError(Form(
"%s: Could not retrieve event! Returning!", GetName()));
907 fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->
GetRunNumber());
909 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()));
921 AliWarning(
"Could not set event plane limits because EMCal geometry was not loaded!");
934 AliError(Form(
"%s: Could not retrieve first track branch!", GetName()));
948 AliError(Form(
"%s: Could not retrieve first cluster branch!", GetName()));
956 AliError(Form(
"%s: Could not retrieve cells %s!", GetName(),
fCaloCellsName.Data()));
964 AliError(Form(
"%s: Could not retrieve calo triggers %s!", GetName(),
fCaloTriggersName.Data()));
988 const AliESDRun *run = esd->GetESDRun();
989 TString beamType = run->GetBeamType();
990 if (beamType ==
"p-p")
992 else if (beamType ==
"A-A")
994 else if (beamType ==
"p-A")
999 Int_t runNumber = InputEvent()->GetRunNumber();
1001 if ((runNumber >= 136833 && runNumber <= 139517) ||
1002 (runNumber >= 167693 && runNumber <= 170593) ||
1003 (runNumber >= 244824 && runNumber <= 246994)) {
1005 }
else if ((runNumber >= 188356 && runNumber <= 188366) ||
1006 (runNumber >= 195164 && runNumber <= 197388) ||
1007 (runNumber >= 265015 && runNumber <= 267166)) {
1029 AliEMCALTriggerPatchInfo *patch;
1030 for (
Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1032 if (patch->IsGammaHigh()) nG1++;
1033 if (patch->IsGammaLow()) nG2++;
1034 if (patch->IsJetHigh()) nJ1++;
1035 if (patch->IsJetLow()) nJ2++;
1036 if (patch->IsLevel0()) nL0++;
1039 AliDebug(2,
"Patch summary: ");
1040 AliDebug(2, Form(
"Number of patches: %d", nPatch));
1041 AliDebug(2, Form(
"Jet: low[%d], high[%d]" ,nJ2, nJ1));
1042 AliDebug(2, Form(
"Gamma: low[%d], high[%d]" ,nG2, nG1));
1045 if (nL0>0) SETBIT(triggers,
kL0);
1046 if (nG1>0) SETBIT(triggers,
kG1);
1047 if (nG2>0) SETBIT(triggers,
kG2);
1048 if (nJ1>0) SETBIT(triggers,
kJ1);
1049 if (nJ2>0) SETBIT(triggers,
kJ2);
1057 AliWarning(Form(
"%s: Requesting undefined trigger type!", GetName()));
1073 res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1077 res = ((AliVAODHeader*)aev->GetHeader())->GetOfflineTrigger();
1090 fired = eev->GetFiredTriggerClasses();
1094 fired = aev->GetFiredTriggerClasses();
1097 if (!fired.Contains(
"-B-")) {
1102 std::unique_ptr<TObjArray> arr(
fTrigClass.Tokenize(
"|"));
1108 for (
Int_t i=0;i<arr->GetEntriesFast();++i) {
1114 TString objStr = obj->GetName();
1116 (objStr.Contains(
"J1") || objStr.Contains(
"J2") || objStr.Contains(
"G1") || objStr.Contains(
"G2"))) {
1121 if(objStr.Contains(
"G")) {
1125 if(objStr.Contains(trigType2) && fired.Contains(trigType2.Data())) {
1129 else if(objStr.Contains(trigType1) && fired.Contains(trigType1.Data()) && !fired.Contains(trigType2.Data())) {
1137 if (fired.Contains(obj->GetName())) {
1157 if (fCent<fMinCent || fCent>
fMaxCent) {
1193 if (vz < fMinVz || vz >
fMaxVz) {
1200 Double_t dvertex = TMath::Abs(vz-vzSPD);
1210 Bool_t trackInEmcalOk = kFALSE;
1212 for (
Int_t i = 0; i < ntracks; i++) {
1217 Double_t phiMin =
fGeom->GetArm1PhiMin() * TMath::DegToRad();
1218 Double_t phiMax =
fGeom->GetArm1PhiMax() * TMath::DegToRad();
1219 Int_t runNumber = InputEvent()->GetRunNumber();
1220 if (runNumber>=177295 && runNumber<=197470) {
1222 phiMax = TMath::Pi();
1225 if (track->Eta() <
fGeom->GetArm1EtaMin() || track->Eta() >
fGeom->GetArm1EtaMax() || track->Phi() < phiMin || track->Phi() > phiMax)
1228 trackInEmcalOk = kTRUE;
1232 if (!trackInEmcalOk) {
1239 Int_t nTracksAcc = 0;
1241 for (
Int_t i = 0; i < ntracks; i++) {
1286 AliDebug(1,Form(
"Njets: %d, pT Hard %f",nTriggerJets,
fPtHard));
1289 for (
Int_t ijet = 0; ijet< nTriggerJets; ijet++) {
1292 jet.SetPxPyPzE(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
1294 AliDebug(1,Form(
"jet %d; pycell jet pT %f",ijet, jet.Pt()));
1298 AliInfo(Form(
"Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
fPtHard, jet.Pt(),
fPtHardAndJetPtFactor));
1308 if ((
Bool_t)mccluscont) {
1309 for (
auto cluster : mccluscont->all()) {
1310 Float_t ecluster = cluster->E();
1324 if ((
Bool_t)mcpartcont) {
1325 for (
auto mctrack : mcpartcont->
all()) {
1326 Float_t trackpt = mctrack->Pt();
1341 TClonesArray *arr = 0;
1343 if (!sname.IsNull()) {
1344 arr =
dynamic_cast<TClonesArray*
>(InputEvent()->FindListObject(sname));
1346 AliWarning(Form(
"%s: Could not retrieve array with name %s!", GetName(), name));
1356 TString objname(arr->GetClass()->GetName());
1357 TClass cls(objname);
1358 if (!cls.InheritsFrom(clname)) {
1359 AliWarning(Form(
"%s: Objects of type %s in %s are not inherited from %s!",
1360 GetName(), cls.GetName(), name, clname));
1382 const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
1388 const AliVVertex *vertSPD = InputEvent()->GetPrimaryVertexSPD();
1395 TObject * header = InputEvent()->GetHeader();
1398 if (header->InheritsFrom(
"AliNanoAODStorage")){
1399 AliNanoAODHeader *nanoHead = (AliNanoAODHeader*)header;
1402 AliMultSelection *MultSelection =
static_cast<AliMultSelection*
>(InputEvent()->FindListObject(
"MultSelection"));
1403 if (MultSelection) {
1404 fCent = MultSelection->GetMultiplicityPercentile(
fCentEst.Data());
1407 AliWarning(Form(
"%s: Could not retrieve centrality information! Assuming 99", GetName()));
1412 if (header->InheritsFrom(
"AliNanoAODStorage")){
1413 AliNanoAODHeader *nanoHead = (AliNanoAODHeader*)header;
1416 AliCentrality *aliCent = InputEvent()->GetCentrality();
1421 AliWarning(Form(
"%s: Could not retrieve centrality information! Assuming 99", GetName()));
1432 AliWarning(Form(
"%s: Negative centrality: %f. Assuming 99", GetName(),
fCent));
1441 else if (
fCent > 90) {
1446 AliWarning(Form(
"%s: Negative centrality: %f. Assuming 99", GetName(),
fCent));
1459 AliWarning(Form(
"%s: fCentBin too large: cent = %f fCentBin = %d. Assuming 99", GetName(),
fCent,
fCentBin));
1463 if (header->InheritsFrom(
"AliNanoAODStorage")){
1464 AliNanoAODHeader *nanoHead = (AliNanoAODHeader*)header;
1465 fEPV0=nanoHead->GetVar(nanoHead->GetVarIndex(
"cstEvPlaneV0"));
1466 fEPV0A=nanoHead->GetVar(nanoHead->GetVarIndex(
"cstEvPlaneV0A"));
1467 fEPV0C=nanoHead->GetVar(nanoHead->GetVarIndex(
"cstEvPlaneV0C"));
1469 AliEventplane *aliEP = InputEvent()->GetEventplane();
1471 fEPV0 = aliEP->GetEventplane(
"V0" ,InputEvent());
1472 fEPV0A = aliEP->GetEventplane(
"V0A",InputEvent());
1473 fEPV0C = aliEP->GetEventplane(
"V0C",InputEvent());
1475 AliWarning(Form(
"%s: Could not retrieve event plane information!", GetName()));
1486 fPythiaHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(MCEvent()->GenEventHeader());
1489 AliAODMCHeader* aodMCH =
dynamic_cast<AliAODMCHeader*
>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1492 for (
UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1493 fPythiaHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(aodMCH->GetCocktailHeader(i));
1518 AliErrorStream() << GetName() <<
": Mismatch in pt-hard bin determination. Local: " <<
fPtHardBin <<
", Global: " <<
fPtHardBinGlobal << std::endl;
1528 fHerwigHeader =
dynamic_cast<AliGenHerwigEventHeader*
>(MCEvent()->GenEventHeader());
1532 AliAODMCHeader* aodMCH =
dynamic_cast<AliAODMCHeader*
>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1535 for (
UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1536 fHerwigHeader =
dynamic_cast<AliGenHerwigEventHeader*
>(aodMCH->GetCocktailHeader(i));
1564 AliEmcalContainer* cont = 0;
1567 while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))){
1568 cont->NextEvent(InputEvent());
1572 while ((cont = static_cast<AliParticleContainer*>(nextClusColl()))){
1573 cont->NextEvent(InputEvent());
1581 if (
TString(n).IsNull())
return 0;
1592 if (
TString(n).IsNull())
return 0;
1603 if (
TString(n).IsNull())
return 0;
1614 if (
TString(n).IsNull())
return 0;
1653 AliError(Form(
"%s: Particle container %d not found",GetName(),i));
1656 TString contName = cont->GetArrayName();
1657 return cont->GetArray();
1664 AliError(Form(
"%s:Cluster container %d not found",GetName(),i));
1667 return cont->GetArray();
1675 AliError(Form(
"%s: Particle container %d not found",GetName(),c));
1687 AliError(Form(
"%s: Cluster container %d not found",GetName(),c));
1699 AliError(Form(
"%s: Particle container %d not found",GetName(),i));
1702 return cont->GetNEntries();
1709 AliError(Form(
"%s: Cluster container %d not found",GetName(),i));
1712 return cont->GetNEntries();
1719 AliError(Form(
"%s: fTriggerPatchInfo not available",GetName()));
1727 AliEMCALTriggerPatchInfo *patch(NULL), *selected(NULL);
1728 for (
Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1731 if (patch->IsMainTrigger()) {
1732 if(doSimpleOffline){
1733 if(patch->IsOfflineSimple()){
1737 if(patch->IsLevel0()) selected = patch;
1740 if(patch->IsJetHighSimple() || patch->IsJetLowSimple()){
1741 if(!selected) selected = patch;
1742 else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1746 if(patch->IsGammaHighSimple() || patch->IsGammaLowSimple()){
1747 if(!selected) selected = patch;
1748 else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1752 AliError(
"Untreated case: Main Patch is recalculated; should be in 'else' branch");
1758 if(patch->IsLevel0()) selected = patch;
1761 if(patch->IsJetHigh() || patch->IsJetLow()){
1762 if(!selected) selected = patch;
1763 else if (patch->GetADCAmp() > selected->GetADCAmp())
1768 if(patch->IsGammaHigh() || patch->IsGammaLow()){
1769 if(!selected) selected = patch;
1770 else if (patch->GetADCAmp() > selected->GetADCAmp())
1775 AliError(
"Untreated case: Main Patch is recalculated; should be in 'else' branch");
1781 if (doSimpleOffline && patch->IsOfflineSimple()) {
1782 if(!selected) selected = patch;
1783 else if (patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp())
1786 else if (!doSimpleOffline && !patch->IsOfflineSimple()) {
1787 if(!selected) selected = patch;
1788 else if (patch->GetADCAmp() > selected->GetADCAmp())
1798 if (!(InputEvent()->FindListObject(obj->GetName()))) {
1799 InputEvent()->AddObject(obj);
1803 AliFatal(Form(
"%s: Container with name %s already present. Aborting", GetName(), obj->GetName()));
1812 AliWarning(Form(
"%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
1819 if (part->Phi() > minPhi && part->Phi() < maxPhi) {
1829 axis->SetBinLabel(1,
"NullObject");
1830 axis->SetBinLabel(2,
"Pt");
1831 axis->SetBinLabel(3,
"Acceptance");
1832 axis->SetBinLabel(4,
"MCLabel");
1833 axis->SetBinLabel(5,
"BitMap");
1834 axis->SetBinLabel(6,
"HF cut");
1835 axis->SetBinLabel(7,
"Bit6");
1836 axis->SetBinLabel(8,
"NotHybridTrack");
1837 axis->SetBinLabel(9,
"MCFlag");
1838 axis->SetBinLabel(10,
"MCGenerator");
1839 axis->SetBinLabel(11,
"ChargeCut");
1840 axis->SetBinLabel(12,
"MinDistanceTPCSectorEdge");
1841 axis->SetBinLabel(13,
"Bit12");
1842 axis->SetBinLabel(14,
"IsEMCal");
1843 axis->SetBinLabel(15,
"Time");
1844 axis->SetBinLabel(16,
"Energy");
1845 axis->SetBinLabel(17,
"ExoticCut");
1846 axis->SetBinLabel(18,
"Bit17");
1847 axis->SetBinLabel(19,
"Area");
1848 axis->SetBinLabel(20,
"AreaEmc");
1849 axis->SetBinLabel(21,
"ZLeadingCh");
1850 axis->SetBinLabel(22,
"ZLeadingEmc");
1851 axis->SetBinLabel(23,
"NEF");
1852 axis->SetBinLabel(24,
"MinLeadPt");
1853 axis->SetBinLabel(25,
"MaxTrackPt");
1854 axis->SetBinLabel(26,
"MaxClusterPt");
1855 axis->SetBinLabel(27,
"Flavour");
1856 axis->SetBinLabel(28,
"TagStatus");
1857 axis->SetBinLabel(29,
"MinNConstituents");
1858 axis->SetBinLabel(30,
"Bit29");
1859 axis->SetBinLabel(31,
"Bit30");
1860 axis->SetBinLabel(32,
"Bit31");
1865 TVector3 vect1(part1->Px(), part1->Py(), part1->Pz());
1866 TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1867 Double_t z = (vect1 * vect2) / (vect2 * vect2);
1873 TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1874 Double_t z = (vect1 * vect2) / (vect2 * vect2);
1885 Double_t veta = t->GetTrackEtaOnEMCal();
1886 Double_t vphi = t->GetTrackPhiOnEMCal();
1889 v->GetPosition(pos);
1894 phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
1900 if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
1902 else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
1904 else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
1914 if (aodTrack->TestFilterBit(filterBit1)) {
1917 else if (aodTrack->TestFilterBit(filterBit2)) {
1918 if ((aodTrack->GetStatus()&AliVTrack::kITSrefit)!=0) {
1938 AliStack*
stack = mcEvent->Stack();
1940 const Int_t nprim = stack->GetNprimary();
1942 if (nprim < 8)
return;
1944 TParticle *part6 = stack->Particle(6);
1945 TParticle *part7 = stack->Particle(7);
1953 AliGenPythiaEventHeader *pythiaGenHeader =
dynamic_cast<AliGenPythiaEventHeader*
>(mcEvent->GenEventHeader());
1954 if(pythiaGenHeader){
1963 ::Error(
"AddAODHandler",
"No analysis manager to connect to.");
1967 AliAODInputHandler* aodHandler =
new AliAODInputHandler();
1969 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
1970 if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
1971 AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
1972 multiInputHandler->AddInputEventHandler(aodHandler);
1975 if (!inputHandler) {
1976 mgr->SetInputEventHandler(aodHandler);
1979 ::Error(
"AddAODHandler",
"inputHandler is NOT null. AOD handler was NOT added !!!");
1991 ::Error(
"AddESDHandler",
"No analysis manager to connect to.");
1995 AliESDInputHandler *esdHandler =
new AliESDInputHandler();
1997 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
1998 if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
1999 AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2000 multiInputHandler->AddInputEventHandler(esdHandler);
2003 if (!inputHandler) {
2004 mgr->SetInputEventHandler(esdHandler);
2007 ::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
static AliEmcalDownscaleFactorsOCDB * Instance()
Double_t fTrackPtCut
cut on track pt in event selection
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 SetRun(int runnumber)
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
Int_t fNPtHardBins
Number of -hard bins in the dataset.
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
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
TH1 * fHistEventsAfterSel
!total number of events per pt hard bin after selection
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
Double_t GetDownscaleFactorForTriggerClass(const TString &trigger) const
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.
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.
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
std::vector< TString > GetTriggerClasses() const
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 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.
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
void SetParticleEtaLimits(Double_t min, Double_t max)
AliEmcalList * fOutput
!output list
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.
Handler for downscale factors for various triggers obtained from the OCDB.
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 Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal