34 #include "AliAODInputHandler.h" 35 #include "AliAnalysisManager.h" 40 #include "AliVEventHandler.h" 51 fTriggerSelectionString(),
52 fNameTriggerDecisionContainer("EmcalTriggerDecision")
54 DefineOutput(1, TList::Class());
57 AliAnalysisTaskEmcalJetEnergyScale::~AliAnalysisTaskEmcalJetEnergyScale() {
64 TLinearBinning jetPtBinning(20, 0., 200.), nefbinning(100, 0., 1.), ptdiffbinning(200, -1., 1.);
66 const TBinning *diffbinning[3] = {&jetPtBinning, &nefbinning, &ptdiffbinning},
67 *corrbinning[3] = {&jetPtBinning, &jetPtBinning, &nefbinning};
79 if(!(fInputHandler->IsEventSelected() & AliVEvent::kINT7))
return false;
82 AliDebugStream(1) <<
"Found trigger decision object: " << (mctrigger ?
"yes" :
"no") << std::endl;
84 AliErrorStream() <<
"Trigger decision container with name " <<
fNameTriggerDecisionContainer <<
" not found in event - not possible to select EMCAL triggers" << std::endl;
93 if(!detjets || !partjets) {
94 AliErrorStream() <<
"At least one jet container missing, exiting ..." << std::endl;
98 for(
auto detjet : detjets->accepted()){
99 auto partjet = detjet->ClosestJet();
100 if(!partjet)
continue;
101 double pointCorr[3] = {partjet->Pt(), detjet->Pt(), detjet->NEF()},
102 pointDiff[3] = {partjet->Pt(), (detjet->Pt()-partjet->Pt())/partjet->Pt(), detjet->NEF()};
110 const std::array<TString, 8> kEMCALTriggers = {
111 "EJ1",
"EJ2",
"DJ1",
"DJ2",
"EG1",
"EG2",
"DG1",
"DG2" 113 bool isEMCAL =
false;
114 for(
auto emcaltrg : kEMCALTriggers) {
115 if(triggerstring.Contains(emcaltrg)) {
126 ::Error(
"EmcalTriggerJets::AliAnalysisTaskEmcalJetEnergyScale::AddTaskJetEnergyScale",
"No analysis manager available");
130 auto inputhandler = mgr->GetInputEventHandler();
131 auto isAOD = inputhandler->IsA() == AliAODInputHandler::Class();
133 std::string jettypename;
135 bool addClusterContainer(
false), addTrackContainer(
false);
138 jettypename =
"FullJet";
140 addClusterContainer = addTrackContainer =
true;
143 jettypename =
"ChargedJet";
145 addTrackContainer =
true;
148 jettypename =
"NeutralJet";
150 addClusterContainer =
true;
154 std::stringstream taskname, tag;
155 tag << jettypename <<
"_R" << std::setw(2) << std::setfill(
'0') << int(jetradius * 10.) <<
"_" << trigger;
156 taskname <<
"EnergyScaleTask_" << tag.str();
158 mgr->AddTask(energyscaletask);
161 partcont->SetMinPt(0.);
164 if(addClusterContainer) {
168 if(addTrackContainer) {
173 acceptance, partcont,
nullptr,
"Jet");
174 contpartjet->SetName(
"particleLevelJets");
178 acceptance, tracks, clusters,
"Jet");
179 contdetjet->SetName(
"detectorLevelJets");
182 std::stringstream outnamebuilder, listnamebuilder;
183 listnamebuilder <<
"EnergyScaleHists_" << tag.str();
184 outnamebuilder << mgr->GetCommonFileName() <<
":EnergyScaleResults_" << tag.str();
186 mgr->ConnectInput(energyscaletask, 0, mgr->GetCommonInputContainer());
187 mgr->ConnectOutput(energyscaletask, 1, mgr->CreateContainer(listnamebuilder.str().data(), TList::Class(), AliAnalysisManager::kOutputContainer, outnamebuilder.str().data()));
188 return energyscaletask;
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Class creating a linear binning, used in the histogram manager.
AliJetContainer * GetJetContainer(Int_t i=0) const
TString fTriggerSelectionString
Trigger selection string.
bool IsSelectEmcalTriggers(const TString &triggerstring) const
Container with name, TClonesArray and cuts for particles.
static AliAnalysisTaskEmcalJetEnergyScale * AddTaskJetEnergyScale(AliJetContainer::EJetType_t jetType, Double_t radius, const char *trigger)
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
void SetNamePartJetContainer(const char *name)
TString fNameDetectorJets
Name of the data jet container.
Interface for binnings used by the histogram handler.
TString fNameTriggerDecisionContainer
Global trigger decision container.
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
virtual void UserCreateOutputObjects()
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
JetAcceptanceType
Bit definition for jet geometry acceptance. Defined here for backwards compatibility. This will be removed. Please use AliEmcalJet::JetAcceptanceType in your code.
THashList * GetListOfHistograms() const
Get the list of histograms.
TString fNameParticleJets
Name of the MC jet container.
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.
void SetNameDetJetContainer(const char *name)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliMCParticleContainer * AddMCParticleContainer(const char *n)
Create new container for MC particles and attach it to the task.
TPC fiducial acceptance (each eta edge narrowed by jet R)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
Container for trigger decision object.
AliAnalysisTaskEmcalJetEnergyScale()
AliEmcalList * fOutput
!output list
AliTrackContainer * AddTrackContainer(const char *n)
Create new track container and attach it to the task.
Base task in the EMCAL jet framework.
Container class for histograms.
THistManager * fHistos
! Histogram collection
void UserCreateOutputObjects()
Main initialization function on the worker.
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
Container structure for EMCAL clusters.
static TString TrackContainerNameFactory(Bool_t isAOD)
Get name of the default track container.
static TString ClusterContainerNameFactory(Bool_t isAOD)
Get name of the default cluster container.