33 #include "AliAnalysisManager.h"
34 #include "AliAODTrack.h"
37 #include "AliInputEventHandler.h"
40 #include "AliPIDResponse.h"
43 #include "AliVCluster.h"
44 #include "AliVEvent.h"
45 #include "AliVTrack.h"
54 namespace EmcalTriggerJets {
56 AliAnalysisTaskEmcalTriggerJetsIDcorr::AliAnalysisTaskEmcalTriggerJetsIDcorr():
81 const std::array<TString, 3> kEmcalTriggers = {
"INT7",
"EJ1",
"EJ2"};
82 const int kNJetPtBins = 9;
83 const int kNJetRadiusBins = 7;
85 TLinearBinning jetptbinning(9, 20, 200), pbinning(300, 0., 30.), massbinning(600., 0., 6.), radiusBinning(10, 0., 1.);
86 const TBinning *binningPID[4] = {&jetptbinning, &pbinning, &radiusBinning, &massbinning};
87 const std::array<TString, 2> kSpecies = {
"Proton",
"Deuteron"};
89 fHistos->
CreateTH1(
"hTPCdEdxErrors",
"Error counter for TPC dE/dx", AliPID::kSPECIESC, -0.5, AliPID::kSPECIESC - 0.5);
90 for(
auto t : kEmcalTriggers){
91 fHistos->
CreateTH1(
"hEventCount" + t,
"Number of events for trigger " + t, 1, 0.5, 1.5);
92 fHistos->
CreateTH1(
"hPtRawAllJet" + t,
" Raw jet pt spectrum for trigger " + t, 1000, 0., 1000.);
93 fHistos->
CreateTH1(
"hPtRawSelJet" + t,
" Raw jet pt spectrum for trigger " + t, 1000, 0., 1000.);
94 fHistos->
CreateTH1(
"hNJetsAll" + t,
"All reconstructed jets for trigger " + t, 101, -0.5, 100.5);
95 fHistos->
CreateTH1(
"hNJetsSelected" + t,
"Selected reconstructed jets for trigger " + t, 101, -0.5, 101.5);
96 for(
auto s: kSpecies){
97 fHistos->
CreateTH1(
"hNCandidatesPerEvent" + s + t,
"Number of " + s +
" candidates per events ", 101, -0.5, 100.5);
98 fHistos->
CreateTHnSparse(
"hPIDAssociateFullJet" + s + t, TString::Format(
"PID (TOF masss) for particles associated to full jets for R=0.4f in EMCAL for %s candidates for trigger %s", s.Data(), t.Data()), 4, binningPID);
110 AliErrorStream() <<
"PID Response not available - PID plots will not be filled" << std::endl;
116 std::vector<TString> triggers, kEmcalTriggers = {
"EJ1",
"EJ2"};
117 if(fInputHandler->IsEventSelected() & AliVEvent::kINT7) triggers.push_back(
"INT7");
118 if(fInputHandler->IsEventSelected() & AliVEvent::kEMCEJE){
119 TString fired = fInputEvent->GetFiredTriggerClasses();
120 for(
auto e : kEmcalTriggers){
121 if(fired.Contains(e))
122 triggers.push_back(e);
125 if(!triggers.size())
return false;
127 for(
const auto &t : triggers)
fHistos->
FillTH1(
"hEventCount" + t, 1);
130 std::vector<AliVTrack *> protonCandidates , deuteronCandidates;
141 for(
const auto &t : triggers){
142 fHistos->
FillTH1(
"hNCandidatesPerEventProton" + t, protonCandidates.size());
143 fHistos->
FillTH1(
"hNCandidatesPerEventDeuteron" + t, deuteronCandidates.size());
146 int njetsAll(0), njetsSel(0);
149 for(
const auto &t : triggers)
fHistos->
FillTH1(
"hPtRawAllJet" + t, j->Pt());
153 for(
const auto &t : triggers)
fHistos->
FillTH1(
"hPtRawSelJet" + t, j->Pt());
154 TVector3 jetmomentum(j->Px(), j->Py(), j->Pz());
157 for(
auto c : protonsCorrelated) {
158 Double_t point[4] = {TMath::Abs(j->Pt()),
c.fPt,
c.fDR,
c.fMass*
c.fMass};
164 for(
auto c : deuteronsCorrelated) {
165 Double_t point[4] = {TMath::Abs(j->Pt()),
c.fPt,
c.fDR,
c.fMass*
c.fMass};
169 for(
const auto &t : triggers){
178 std::vector<CorrParticleInfo> correlatedParticles;
179 for(
auto c : candidates) {
180 TVector3 particleMom(
c->Px(),
c->Py(),
c->Pz());
181 double dR = particleMom.DeltaR(jet);
182 if(dR > 1.)
continue;
189 correlatedParticles.push_back({
c->Pt(), dR, mTOF});
191 return correlatedParticles;
195 if(!((track->GetStatus() & AliVTrack::kTOFout) && (track->GetStatus() & AliVTrack::kTIME)))
throw TOFMassException();
196 Double_t trtime = (track->GetTOFsignal() -
fPIDResponse->GetTOFResponse().GetTimeZero()) * 1e-12;
197 Double_t v = track->GetIntegratedLength()/(100. * trtime);
198 Double_t beta = v / TMath::C(), gamma = 1 / TMath::Sqrt(1-beta*beta);
199 return track->P() / (beta*gamma);
203 std::vector<AliVTrack *> result;
204 for(
int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); itrk++){
205 AliVTrack *trk =
static_cast<AliVTrack *
>(fInputEvent->GetTrack(itrk));
207 if(trk->IsA() == AliAODTrack::Class()){
208 AliAODTrack *aodtrk =
static_cast<AliAODTrack *
>(trk);
209 if(!(aodtrk->IsHybridGlobalConstrainedGlobal() || aodtrk->IsHybridTPCConstrainedGlobal()))
continue;
210 if(aodtrk->GetTPCsignalN() < 30)
continue;
211 if(aodtrk->GetTPCSharedMapPtr()->CountBits(0) > 70)
continue;
213 if(nSigmaTPC <= -999.)
continue;
214 if(TMath::Abs(nSigmaTPC) > 3)
continue;
215 result.push_back(trk);
229 clustercont->SetMinE(0.3);
231 trackcont->SetMinPt(0.15);
246 trackcont, clustercont
248 cont->SetName(
"FullJetsR04EMCAL");
254 TString outfilename = mgr->GetCommonFileName();
255 outfilename +=
":EmcalTriggerJetsIDcorr";
256 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
257 mgr->ConnectOutput(task, 1, mgr->CreateContainer(
"HistsEmcalTriggerJetsIDcorr", TList::Class(), AliAnalysisManager::kOutputContainer, outfilename));
AliJetContainer * fJetCont
! Jet container
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.
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.
std::vector< AliVTrack * > GetTPCPIDCandidates(AliPID::EParticleType type) const
virtual void UserExecOnce()
Task initializations handled in user tasks.
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
Interface for binnings used by the histogram handler.
double GetTOFMass(const AliVTrack *const track) const
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="")
static AliAnalysisTaskEmcalTriggerJetsIDcorr * AddTaskEmcalTriggerJetsIDcorr(const char *name)
AliPIDResponse * fPIDResponse
! PID Response handler
void SetJetPtCut(Float_t cut)
THashList * GetListOfHistograms() const
Get the list of histograms.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
THistManager * fHistos
! Histogram handler
ClassImp(AliAnalysisTaskDeltaPt) AliAnalysisTaskDeltaPt
AliEmcalList * fOutput
!output list
AliPID::EParticleType GetParticleType() const
AliAnalysisTaskEmcalTriggerJetsIDcorr()
std::vector< CorrParticleInfo > CorrelateCandidatesToJet(const TVector3 &jet, std::vector< AliVTrack * > candidates) const
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.
void UserCreateOutputObjects()
Main initialization function on the worker.
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.
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 ~AliAnalysisTaskEmcalTriggerJetsIDcorr()
void SetJetPtCutMax(Float_t cut)
const AliJetIterableContainer all() const