34 #include <TLorentzVector.h> 36 #include "AliAnalysisManager.h" 38 #include "AliAODInputHandler.h" 42 #include "AliInputEventHandler.h" 46 #include "AliVCluster.h" 47 #include "AliVEvent.h" 48 #include "AliVTrack.h" 59 fNameTrackContainer(
""),
60 fNameClusterContainer(
""),
61 fTriggerSelectionString(
"")
85 auto contname =
dynamic_cast<TObjString *
>(
c);
86 if(!contname)
continue;
87 fHistos->
CreateTH2(Form(
"hPtChargedConstituents%s", contname->String().Data()),
"Charged jet constituents; p_{t, jet} (GeV/c); p_{t,ch}", 200, 0., 200., 200., 0., 200.);
88 fHistos->
CreateTH2(Form(
"hPtNeutralConstituents%s", contname->String().Data()),
"Neutral jet constituents; p_{t, jet} (GeV/c); p_{t,ne}", 200, 0., 200., 200., 0., 200.);
89 fHistos->
CreateTH2(Form(
"hENeutralConstituents%s", contname->String().Data()),
"Neutral jet constituents; p_{t, jet} (GeV/c); E_{ne}", 200, 0., 200., 200., 0., 200.);
90 fHistos->
CreateTH2(Form(
"hENeutralConstituentsNoSub%s", contname->String().Data()),
"Neutral jet constituent without hadronic correction; p_{t, jet} (GeV/c); E_{ne}", 200, 0., 200., 200., 0., 200.);
91 fHistos->
CreateTH2(Form(
"hZChargedConstituents%s", contname->String().Data()),
"Charged jet constituents; p_{t, jet} (GeV/c); z", 200, 0., 200., 100., 0., 1.);
92 fHistos->
CreateTH2(Form(
"hZNeutralConstituents%s", contname->String().Data()),
"Neutral jet constituent without hadronic correction; p_{t, jet} (GeV/c); z", 200, 0., 200., 100., 0., 1.);
102 if(!(tracks && clusters)){
103 AliErrorStream() <<
"Either track or cluster container missing, aborting ..." << std::endl;
107 AliDebugStream(1) <<
"Trigger selection string: " <<
fTriggerSelectionString <<
", fired trigger classes: " << fInputEvent->GetFiredTriggerClasses() << std::endl;
110 if(!(fInputHandler->IsEventSelected() & AliVEvent::kINT7))
return false;
114 if(!(fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE))
return false;
115 if(!fInputEvent->GetFiredTriggerClasses().Contains(triggerclass))
return false;
118 AliDebugStream(1) <<
"Event is selected" << std::endl;
121 auto contname =
dynamic_cast<TObjString *
>(jc);
123 AliErrorStream() <<
"Non-string object in the list of jet container names" << std::endl;
128 AliErrorStream() <<
"Jet container with name " << contname->String() <<
" not found in the list of jet containers" << std::endl;
132 for(
auto jet : jetcont->accepted()){
133 AliDebugStream(3) <<
"Next accepted jet, found " << jet->GetNumberOfTracks() <<
" tracks and " << jet->GetNumberOfClusters() <<
" clusters." << std::endl;
134 for(decltype(jet->GetNumberOfTracks()) itrk = 0; itrk < jet->GetNumberOfTracks(); itrk++){
135 const auto trk = jet->TrackAt(itrk, tracks->GetArray());
137 fHistos->
FillTH2(Form(
"hPtChargedConstituents%s", contname->String().Data()), std::abs(jet->Pt()), std::abs(trk->Pt()));
138 fHistos->
FillTH2(Form(
"hZChargedConstituents%s", contname->String().Data()), std::abs(jet->Pt()), jet->GetZ(trk));
140 for(decltype(jet->GetNumberOfClusters()) icl = 0; icl < jet->GetNumberOfClusters(); icl++){
141 const auto clust = jet->ClusterAt(icl, clusters->GetArray());
143 TLorentzVector ptvec;
144 clust->GetMomentum(ptvec, this->
fVertex, AliVCluster::kHadCorr);
145 fHistos->
FillTH2(Form(
"hPtNeutralConstituents%s", contname->String().Data()), std::abs(jet->Pt()), std::abs(ptvec.Pt()));
146 fHistos->
FillTH2(Form(
"hENeutralConstituents%s", contname->String().Data()), std::abs(jet->Pt()), std::abs(clust->GetHadCorrEnergy()));
147 fHistos->
FillTH2(Form(
"hENeutralConstituentsNoSub%s", contname->String().Data()), std::abs(jet->Pt()), std::abs(clust->GetNonLinCorrEnergy()));
148 fHistos->
FillTH2(Form(
"hZNeutralConstituents%s", contname->String().Data()), std::abs(jet->Pt()), jet->GetZ(ptvec.Px(), ptvec.Py(), ptvec.Pz()));
160 std::cerr <<
"[AliAnalysisTaskJetConstituentQA::AddTaskEmcalJetConstituentQA(EE)] No analysis manager provided ..." << std::endl;
164 std::stringstream taskname;
165 taskname <<
"constituentQA_" << trigger;
167 task->SetTriggerSelection(trigger);
170 auto inputhandler = mgr->GetInputEventHandler();
172 if(inputhandler->IsA() == AliAODInputHandler::Class()) isAOD =
true;
174 auto tracksname = AnalysisHelpers::TrackContainerNameFactory(isAOD);
175 auto tracks = task->AddTrackContainer(tracksname);
176 task->SetNameTrackContainer(tracksname);
177 tracks->SetMinPt(0.15);
179 auto clustername = AnalysisHelpers::ClusterContainerNameFactory(isAOD);
180 auto clusters = task->AddClusterContainer(clustername);
181 task->SetNameClusterContainer(clustername);
182 clusters->SetDefaultClusterEnergy(AliVCluster::kHadCorr);
183 clusters->SetClusHadCorrEnergyCut(0.3);
186 std::array<double, 2> jetradii = {{0.2, 0.4}};
187 for(
auto r : jetradii) {
188 std::stringstream contname;
189 contname <<
"fulljets_R" << std::setw(2) << std::setfill(
'0') << int(r*10.);
191 jcont->SetName(contname.str().data());
192 task->AddNameJetContainer(contname.str().data());
193 jcont->SetMinPt(20.);
196 std::stringstream contname, outfilename;
197 contname <<
"JetConstituentQA_" << trigger;
198 outfilename << mgr->GetCommonFileName() <<
":JetConstituentQA_" << trigger;
199 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
200 mgr->ConnectOutput(task, 1, mgr->CreateContainer(contname.str().data(), AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfilename.str().data()));
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
virtual bool Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
AliJetContainer * GetJetContainer(Int_t i=0) const
TObjArray fNamesJetContainers
Names of the connected jet container.
static AliAnalysisTaskEmcalJetConstituentQA * AddTaskEmcalJetConstituentQA(const char *trigger)
TString fTriggerSelectionString
Trigger selection string.
void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup=kTRUE)
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
THistManager * fHistos
Histogram manager.
TString fNameClusterContainer
Name of the cluster container.
virtual void UserCreateOutputObjects()
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
THashList * GetListOfHistograms() const
Get the list of histograms.
Collection of helper functions used to configure the analysis.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
virtual ~AliAnalysisTaskEmcalJetConstituentQA()
AliEmcalList * fOutput
!output list
TString fNameTrackContainer
Name of the track container.
Double_t fVertex[3]
!event vertex
AliTrackContainer * GetTrackContainer(Int_t i=0) const
Base task in the EMCAL jet framework.
Container class for histograms.
void UserCreateOutputObjects()
Main initialization function on the worker.
AliAnalysisTaskEmcalJetConstituentQA()