32 #include "AliAnalysisManager.h" 33 #include "AliAODTrack.h" 36 #include "AliInputEventHandler.h" 39 #include "AliPIDResponse.h" 42 #include "AliVCluster.h" 43 #include "AliVEvent.h" 44 #include "AliVTrack.h" 55 AliAnalysisTaskEmcalTriggerJets::AliAnalysisTaskEmcalTriggerJets():
78 const std::array<TString, 5> kEmcalTriggers = {
"INT7",
"EJ1",
"EJ2",
"DJ1",
"DJ2"};
79 const int kNJetPtBins = 9;
80 const int kNJetRadiusBins = 7;
82 TLinearBinning jetptbinning(9, 20, 200), pbinning(300, 0., 30.), dEdxbinning(600, 0., 600.), massbinning(400., 0., 4.), eopbinning(150, 0., 1.5), radiusBinning(10, 0., 1.);
83 const TBinning *binningPID[5] {&jetptbinning, &pbinning, &dEdxbinning, &massbinning, &eopbinning},
84 *binningAssociate[6] = {&jetptbinning, &pbinning, &radiusBinning, &dEdxbinning, &massbinning, &eopbinning};
85 const std::array<int, 2> kJetRadii = {2, 4};
86 const std::array<TString, 3> kJetTypes = {
"Charged",
"Full",
"Neutral"};
87 const std::array<TString, 2> kDetectors = {
"EMCAL",
"DCAL"};
88 const std::array<TString, 2> kConstituentType = {
"Charged",
"Neutral"};
90 for(
auto t : kEmcalTriggers){
91 fHistos->
CreateTH1(
"hEventCount" + t,
"Event counter for trigger " + t, 1., 0.5, 1.5);
92 for(
auto det: kDetectors){
93 for(
auto jt : kJetTypes) {
94 for(
auto radius : kJetRadii){
96 "Raw pt spectrum for " + jt +
" jets with R=" + Form(
"%.1f",
double(radius)/10.) +
" in " + det +
" for trigger " + t,
100 fHistos->
CreateTH2(
"hNefFullJetR" + TString::Format(
"%02d", radius) + det + t,
101 "Neutral energy fraction vs. jet pt for R=" + TString::Format(
"%.1f",
double(radius)/10.) +
" full jets in " + det +
" for trigger " + t,
102 200, 0., 200., 100, 0., 1.);
104 for(
auto constituent : kConstituentType){
105 fHistos->
CreateTH2(
"hLeading" + constituent +
"PtFullJetR" + TString::Format(
"%02d", radius) + det + t,
106 "p{t_const} vs. p_{t, jet} for leading " + constituent +
" constituents in full jets with R=" + TString::Format(
"%.1f",
double(radius)/10.) +
" in " + det +
"for trigger " + t,
107 200, 0., 200., 200, 0., 200.);
108 fHistos->
CreateTH2(
"hLeading" + constituent +
"ZFullJetR" + TString::Format(
"%02d", radius) + det + t,
109 "z vs. p_{t, jet} for leading " + constituent +
" constituents in full jets with R=" + TString::Format(
"%.1f",
double(radius)/10.) +
" in " + det +
" for trigger " + t,
110 200, 0., 200., 100, 0., 1.);
111 fHistos->
CreateTH2(
"hLeading" + constituent +
"PtrelFullJetR" + TString::Format(
"%02d", radius) + det + t,
112 "p_{t,rel} vs. p_{t, jet} for leading " + constituent +
" constituents in full jets with R=" + TString::Format(
"%.1f",
double(radius)/10.) +
" in " + det +
" for trigger " + t,
113 200., 0., 200., 100, 0., 1.);
115 fHistos->
CreateTHnSparse(
"hPIDConstituentFullJet" + TString::Format(
"R%02d", radius) + det + t, TString::Format(
"PID for full jet constituents for R=%0.2f in %s for trigger %s",
double(radius)/10., det.Data(), t.Data()), 5, binningPID);
116 fHistos->
CreateTHnSparse(
"hPIDLeadingFullJet" + TString::Format(
"R%02d", radius) + det + t, TString::Format(
"PID for full jet leading constituents for R=%0.2f in %s for trigger %s",
double(radius)/10., det.Data(), t.Data()), 5, binningPID);
131 AliErrorStream() <<
"PID Response not available - PID plots will not be filled" << std::endl;
136 std::vector<TString> triggers, kEmcalTriggers = {
"EJ1",
"EJ2",
"DJ1",
"DJ2"};
137 if(fInputHandler->IsEventSelected() & AliVEvent::kINT7) triggers.push_back(
"INT7");
138 if(fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE){
139 TString fired = fInputEvent->GetFiredTriggerClasses();
140 for(
auto e : kEmcalTriggers){
141 if(fired.Contains(e)) triggers.push_back(e);
144 if(!triggers.size())
return false;
147 std::vector<TString> jettypes = {
"Full",
"Charged",
"Neutral"}, detectors = {
"EMCAL",
"DCAL"}, radii = {
"R02",
"R04"};
148 for(
auto jt : jettypes) {
149 for(
auto det : detectors){
150 for(
auto r : radii) {
151 double radius = double(
TString(r).ReplaceAll(
"R0",
"").Atoi())/10.;
152 TString namejcont = jt +
"Jets" + r + det,
153 rawhistnamebase =
"hPtRaw" + jt +
"Jet" + r + det,
154 tagForLeading =
"FullJet" + r + det;
156 if(!c) AliErrorStream() <<
"Not found jet container " << namejcont << std::endl;
157 bool doPID =
fPIDResponse && (jt ==
"Full") && (r ==
"R04");
159 TLorentzVector jetvec(j->Px(), j->Py(), j->Pt(), j->E());
161 AliVCluster *leadingClust = (jt ==
"Full") ? j->GetLeadingCluster(this->GetClusterContainer(
"caloClusters")->GetArray()) :
nullptr;
162 AliVTrack *leadingTrack = (jt ==
"Full") ? static_cast<AliVTrack *>(j->GetLeadingTrack(this->GetTrackContainer(
"tracks")->GetArray())) :
nullptr;
163 TLorentzVector clustervec;
166 leadingClust->GetMomentum(clustervec,
fVertex);
169 trackvec.SetXYZ(leadingTrack->Px(), leadingTrack->Py(), leadingTrack->Pz());
171 double absJetPt = TMath::Abs(j->Pt());
172 for(
auto t : triggers) {
175 AliDebugStream(1) <<
"Filling full jet leading histograms, constituents c[" << j->GetNumberOfTracks() <<
"], n[" << j->GetNumberOfClusters() <<
"]" << std::endl;
177 fHistos->
FillTH2(
"hNefFullJet" + r + det + t, absJetPt, j->NEF());
180 fHistos->
FillTH2(
"hLeadingNeutralPt" + tagForLeading + t, absJetPt, TMath::Abs(clustervec.Pt()));
181 fHistos->
FillTH2(
"hLeadingNeutralZ" + tagForLeading + t, absJetPt, j->GetZ(clustervec.Px(), clustervec.Py(), clustervec.Pz()));
182 fHistos->
FillTH2(
"hLeadingNeutralPtrel" + tagForLeading + t, absJetPt, clustervec.Pt(jetvec.Vect()));
184 AliDebugStream(2) <<
"No leading cluster found" << std::endl;
187 fHistos->
FillTH2(
"hLeadingChargedPt" + tagForLeading + t, absJetPt, TMath::Abs(leadingTrack->Pt()));
188 fHistos->
FillTH2(
"hLeadingChargedZ" + tagForLeading + t, absJetPt, j->GetZ(leadingTrack));
189 fHistos->
FillTH2(
"hLeadingChargedPtrel" + tagForLeading + t, absJetPt, trackvec.Pt(jetvec.Vect()));
190 AliDebugStream(2) <<
"Filling full jet leading PID histograms" << std::endl;
193 AliDebugStream(2) <<
"No leading track found" << std::endl;
195 AliDebugStream(1) <<
"Filling full jet leading constituent histograms done" << std::endl;
206 if(TMath::Abs(jet->
Pt()) < 20 || TMath::Abs(jet->
Pt()) > 200)
return;
207 TString histname = TString::Format(
"hPIDConstituentFullJetR%02d%s%s",
int(radius * 10), detector, trigger);
211 AliVTrack *constituent =
static_cast<AliVTrack *
>(jet->
TrackAt(icharged, tc->GetArray()));
213 if(constituent->GetTPCsignalN() < 30)
continue;
214 if(constituent->GetTPCSharedMapPtr()->CountBits(0) > 70)
continue;
215 if(!((constituent->GetStatus() & AliVTrack::kTOFout) && (constituent->GetStatus() & AliVTrack::kTIME)))
continue;
216 Double_t trtime = (constituent->GetTOFsignal() -
fPIDResponse->GetTOFResponse().GetTimeZero()) * 1e-12;
217 Double_t v = constituent->GetIntegratedLength()/(100. * trtime);
218 Double_t beta = v / TMath::C(), gamma = 1 / TMath::Sqrt(1-beta*beta), mtof = constituent->P() / (beta*gamma);
220 if(constituent->GetEMCALcluster() >= 0) {
221 AliVCluster *matched =
static_cast<AliVCluster *
>((*
GetClusterContainer(
"caloClusters"))[constituent->GetEMCALcluster()]);
222 if(matched) eop = TMath::Abs(matched->GetNonLinCorrEnergy()/constituent->P());
224 Double_t datapoint[5] = {TMath::Abs(jet->
Pt()), TMath::Abs(constituent->P()), constituent->GetTPCsignal(), mtof, eop};
230 if(ptjet < 20 || ptjet > 200)
return;
232 TString histname = TString::Format(
"hPIDLeadingFullJetR%02d%s%s",
int(radius*10.), detector, trigger);
233 if(leading->GetTPCsignalN() < 30)
return;
234 if(!((leading->GetStatus() & AliVTrack::kTOFout) && (leading->GetStatus() & AliVTrack::kTIME)))
return;
235 if(leading->GetTPCSharedMapPtr()->CountBits(0) > 70)
return;
236 Double_t trtime = (leading->GetTOFsignal() -
fPIDResponse->GetTOFResponse().GetTimeZero()) * 1e-12;
237 Double_t v = leading->GetIntegratedLength()/(100. * trtime);
238 Double_t beta = v / TMath::C(), gamma = 1 / TMath::Sqrt(1-beta*beta), mtof = leading->P() / (beta*gamma);
240 if(leading->GetEMCALcluster() >= 0){
241 AliVCluster *matched =
static_cast<AliVCluster *
>((*
GetClusterContainer(
"caloClusters"))[leading->GetEMCALcluster()]);
242 if(matched) eop = TMath::Abs(matched->GetNonLinCorrEnergy()/leading->P());
244 Double_t datapoint[5] = {ptjet, TMath::Abs(leading->P()), leading->GetTPCsignal(), mtof, eop};
256 clustercont->SetMinE(0.3);
258 trackcont->SetMinPt(0.15);
272 trackcont, clustercont
274 cont->SetName(
"FullJetsR02EMCAL");
283 trackcont, clustercont
285 cont->SetName(
"FullJetsR04EMCAL");
294 trackcont, clustercont
296 cont->SetName(
"FullJetsR02DCAL");
305 trackcont, clustercont
307 cont->SetName(
"FullJetsR04DCAL");
319 cont->SetName(
"ChargedJetsR02EMCAL");
330 cont->SetName(
"ChargedJetsR04EMCAL");
341 cont->SetName(
"ChargedJetsR02DCAL");
352 cont->SetName(
"ChargedJetsR04DCAL");
364 cont->SetName(
"NeutralJetsR02EMCAL");
375 cont->SetName(
"NeutralJetsR04EMCAL");
386 cont->SetName(
"NeutralJetsR02DCAL");
397 cont->SetName(
"NeutralJetsR04DCAL");
400 TString outfilename = mgr->GetCommonFileName();
401 outfilename +=
":EmcalTriggerJets";
402 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
403 mgr->ConnectOutput(task, 1, mgr->CreateContainer(
"HistsEmcalTriggerJets", TList::Class(), AliAnalysisManager::kOutputContainer, outfilename));
Class creating a linear binning, used in the histogram manager.
AliJetContainer * GetJetContainer(Int_t i=0) const
Container with name, TClonesArray and cuts for particles.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
Interface for binnings used by the histogram handler.
AliClusterContainer * AddClusterContainer(const char *n)
Create new cluster container and attach it to the task.
Int_t TrackAt(Int_t idx) const
UShort_t GetNumberOfTracks() const
virtual ~AliAnalysisTaskEmcalTriggerJets()
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
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.
void FillJetPIDPlots(const AliEmcalJet *jet, double radius, const char *trigger, const char *detector)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
AliAnalysisTaskEmcalTriggerJets()
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
virtual void UserExecOnce()
Task initializations handled in user tasks.
AliEmcalList * fOutput
!output list
virtual void UserCreateOutputObjects()
Double_t fVertex[3]
!event vertex
AliTrackContainer * AddTrackContainer(const char *n)
Create new track container and attach it to the task.
AliTrackContainer * GetTrackContainer(Int_t i=0) const
Base task in the EMCAL jet framework.
AliPIDResponse * fPIDResponse
! PID Response handler
THistManager * fHistos
! Histogram handler
Represent a jet reconstructed using the EMCal jet framework.
Container class for histograms.
void UserCreateOutputObjects()
Main initialization function on the worker.
DCal fiducial acceptance (each eta, phi edge narrowed by jet R)
const AliJetIterableContainer accepted() const
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.
void FillJetPIDPlotsLeading(const AliVTrack *leading, double ptjet, double radius, const char *trigger, const char *detector)
Container structure for EMCAL clusters.
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Container for jet within the EMCAL jet framework.
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.
static AliAnalysisTaskEmcalTriggerJets * AddTaskEmcalTriggerJets(const char *name)