15 #include <THashList.h>
20 #include "AliAnalysisDataContainer.h"
21 #include "AliAnalysisManager.h"
22 #include "AliAODInputHandler.h"
23 #include "AliAODTrack.h"
26 #include "AliEMCALGeometry.h"
27 #include "AliESDtrackCuts.h"
30 #include "AliVCluster.h"
31 #include "AliVEvent.h"
32 #include "AliVEventHandler.h"
33 #include "AliVTrack.h"
41 namespace EMCalTriggerPtAnalysis {
43 AliAnalysisTaskEmcalClusterMatched::AliAnalysisTaskEmcalClusterMatched():
46 fTrackSelectionTPConly(
nullptr),
47 fTimeCut(-50e6, 50e6),
56 fTrackSelectionTPConly(
nullptr),
57 fTimeCut(-50e6, 50e6),
69 Bool_t isAOD = fInputHandler->IsA() == AliAODInputHandler::Class();
76 TLinearBinning smbinning(20, -0.5, 19.5), timebinning(1000, -0.5e-6, 0.5e-6);
81 fHistos->
CreateTH1(
"hEventCount" + t,
"Event count for trigger " + t, 1, 0.5, 1.5, optionstring);
82 fHistos->
CreateTH1(
"hVertexZ" + t,
"Position of the z-vertex for trigger" + t, 500, -50., 50., optionstring);
83 fHistos->
CreateTH2(
"hClusterEnergyTime" + t,
"Cluster energy vs time for trigger " + t, enbinning, timebinning, optionstring);
84 fHistos->
CreateTH2(
"hClusterEnergyAllSM" + t,
"Cluster energy vs supermodule for all clusters for trigger " + t, smbinning, enbinning, optionstring);
85 fHistos->
CreateTH2(
"hClusterEnergyMatchGlobalSM" + t,
"Cluster energy vs supermodule for matched clusters (gl) for trigger " + t, smbinning, enbinning, optionstring);
86 fHistos->
CreateTH2(
"hClusterEnergyTimeMatchGlobal" + t,
"Cluster energy vs time for matched clusters (gl) for trigger" + t, enbinning, timebinning, optionstring);
87 fHistos->
CreateTH2(
"hClusterEnergyMatchTPConlySM" + t,
"Cluster energy vs supermodule for matched clusters (tpc) for trigger " + t, smbinning, enbinning, optionstring);
88 fHistos->
CreateTH2(
"hClusterEnergyTimeMatchTPConly" + t,
"Cluster energy vs time for matched clusters (tpc) for trigger" + t, enbinning, timebinning, optionstring);
89 fHistos->
CreateTH2(
"hClusterEnergyMatchTPCexclSM" + t,
"Cluster energy vs supermodule for matched clusters (tpc excl) for trigger " + t, smbinning, enbinning, optionstring);
90 fHistos->
CreateTH2(
"hClusterEnergyTimeMatchTPCexcl" + t,
"Cluster energy vs time for matched clusters (tpc excl) for trigger " + t, enbinning, timebinning, optionstring);
91 fHistos->
CreateTH2(
"hClusterEnergyUnmatchSM" + t,
"Cluster energy vs supermodule for unmatched clusters for trigger " + t, smbinning, enbinning, optionstring);
92 fHistos->
CreateTH2(
"hClusterEnergyTimeUnmatch" + t,
"Cluster energy vs time for unmatched clusters for trigger " + t, enbinning, timebinning, optionstring);
106 if(!clust->IsEMCAL())
continue;
107 if(clust->GetIsExotic())
continue;
110 double energy = clust->GetNonLinCorrEnergy();
111 TLorentzVector clustervec;
112 clust->GetMomentum(clustervec,
fVertex);
114 fGeom->SuperModuleNumberFromEtaPhi(clustervec.Eta(), clustervec.Phi(), supermoduleID);
117 fHistos->
FillTH2(
"hClusterEnergyAllSM" + t, supermoduleID, energy, weight);
118 fHistos->
FillTH2(
"hClusterEnergyTime" + t, energy, clust->GetTOF(), weight);
124 int nglobal(0), ntpc(0);
125 if(clust->GetNTracksMatched()){
126 AliDebugStream(1) <<
"Cluster matched to " << clust->GetNTracksMatched() <<
" Tracks" << std::endl;
128 for(
int itrk = 0; itrk < clust->GetNTracksMatched(); itrk++){
129 AliVTrack *matched =
static_cast<AliVTrack *
>(clust->GetTrackMatched(itrk));
131 AliDebugStream(2) <<
"Track is null" << std::endl;
139 for(
const auto &t : fSelectedTriggers){
142 fHistos->
FillTH2(
"hClusterEnergyMatchGlobalSM" + t, supermoduleID, energy, weight);
143 fHistos->
FillTH2(
"hClusterEnergyTimeMatchGlobal" + t, energy, clust->GetTOF(), weight);
146 fHistos->
FillTH2(
"hClusterEnergyMatchTPConlySM" + t, supermoduleID, energy, weight);
147 fHistos->
FillTH2(
"hClusterEnergyTimeMatchTPConly" + t, energy, clust->GetTOF(), weight);
149 if(ntpc && !nglobal){
150 fHistos->
FillTH2(
"hClusterEnergyMatchTPCexclSM" + t, supermoduleID, energy, weight);
151 fHistos->
FillTH2(
"hClusterEnergyTimeMatchTPCexcl" + t, energy, clust->GetTOF(), weight);
156 for(
const auto &t : fSelectedTriggers){
158 fHistos->
FillTH2(
"hClusterEnergyUnmatchSM" + t, supermoduleID, energy, weight);
159 fHistos->
FillTH2(
"hClusterEnergyTimeUnmatch" + t, energy, clust->GetTOF(), weight);
177 globalESD->
AddTrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(
true, 1));
181 tpcOnlyESD->
AddTrackCuts(AliESDtrackCuts::GetStandardTPCOnlyTrackCuts());
190 mgr->AddTask(clustertask);
192 TString outputfile = mgr->GetCommonFileName();
193 outputfile += (
":MatchedClusterResults" + suffixstring);
194 mgr->ConnectInput(clustertask, 0, mgr->GetCommonInputContainer());
195 mgr->ConnectOutput(clustertask, 1, mgr->CreateContainer(
"MatchedClusterResultHistos" + suffixstring, AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outputfile));
std::vector< TString > fSelectedTriggers
! Triggers selected for given event
std::vector< TString > GetSupportedTriggers()
AliCutValueRange< double > fTimeCut
Cut on cluster time.
Class creating a linear binning, used in the histogram manager.
THistManager * fHistos
Task Histogram container.
static AliAnalysisTaskEmcalClusterMatched * AddTaskEmcalClusterMatched(const char *suffix)
Double_t GetTriggerWeight(const TString &triggerclass) const
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
virtual void UserFillHistosAfterEventSelection()
void AddFilterBit(UInt_t filterbits)
void AddStep(Double_t max, Double_t binwidth)
void InitializeTrackSelections(bool isAOD)
AliClusterContainer * AddClusterContainer(const char *n)
virtual void CreateUserObjects()
virtual ~AliAnalysisTaskEmcalClusterMatched()
Base class for analyses using EMCAL triggers.
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
TString fNameClusterContainer
Name of the cluster container in the event.
AliEMCALGeometry * fGeom
!emcal geometry
AliEmcalTrackSelection * fTrackSelectionGlobal
Global track cuts (strong condition)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Helper class creating user defined custom binning.
Binning for cluster energy.
void AddTrackCuts(AliVCuts *cuts)
Implement virtual track selection for AOD analysis.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Simple task checking energy spectra of clusters matched to tracks.
AliEmcalTrackSelection * fTrackSelectionTPConly
TPC-only track cuts (weak condition)
virtual void CreateUserHistos()
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fVertex[3]
!event vertex
AliAnalysisTaskEmcalClusterMatched()
Bool_t fEnableSumw2
Enable Sumw2.
Implementation of virtual track selection for ESDs.
virtual bool IsTrackAccepted(AliVTrack *const trk)=0
bool IsInRange(t value) const
void SetMinimum(Double_t min)