28 #include "AliAnalysisManager.h"
29 #include "AliAODMCParticle.h"
30 #include "AliAODTrack.h"
31 #include "AliESDtrackCuts.h"
32 #include "AliESDtrack.h"
34 #include "AliMCEvent.h"
35 #include "AliMCParticle.h"
36 #include "AliTrackReference.h"
37 #include "AliVEvent.h"
38 #include "AliVParticle.h"
39 #include "AliVTrack.h"
41 #include <fastjet/PseudoJet.hh>
42 #include <fastjet/JetDefinition.hh>
43 #include <fastjet/ClusterSequence.hh>
57 namespace HighPtTracks {
62 AliHighPtReconstructionEfficiency::AliHighPtReconstructionEfficiency() :
68 fMaxEtaParticles(0.8),
69 fMinPtParticles(0.15),
76 memset(
fTrackCuts, 0,
sizeof(AliESDtrackCuts *) * 2);
86 AliAnalysisTaskSE(name),
91 fMaxEtaParticles(0.8),
92 fMinPtParticles(0.15),
99 DefineOutput(1, TNtuple::Class());
100 memset(
fTrackCuts, 0,
sizeof(AliESDtrackCuts *) * 2);
107 for(
int icut = 0; icut < 2; icut++)
119 fJetTree =
new TTree(
"JetEvent",
"A tree with jet information");
132 TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
134 AliError(Form(
"%s - UserNotify: No current tree!",GetName()));
138 TFile *curfile = tree->GetCurrentFile();
140 AliError(Form(
"%s - UserNotify: No current file!",GetName()));
166 AliVParticle *part(NULL);
167 TIter partIter(&listforjets);
168 std::vector<fastjet::PseudoJet> inputjets;
169 while((part = dynamic_cast<AliVParticle *>(partIter()))){
170 fastjet::PseudoJet inputpart(part->Px(), part->Py(), part->Pz(), part->E());
171 inputpart.set_user_index(part->GetLabel());
172 inputjets.push_back(inputpart);
174 fastjet::ClusterSequence jetfinder(inputjets, fastjet::JetDefinition(fastjet::antikt_algorithm, 0.4));
175 std::vector<fastjet::PseudoJet> recjets = fastjet::sorted_by_pt(jetfinder.inclusive_jets());
180 std::vector<AliReconstructedParticlePair> selectedParticles =
SelectParticles();
183 std::stringstream debugmessage;
185 AliDebug(1, debugmessage.str().c_str());
187 int nparticlesGen = 0, nparticlesRec = 0;
188 for(std::vector<AliReconstructedParticlePair>::iterator pairiter = selectedParticles.begin(); pairiter != selectedParticles.end(); ++pairiter){
189 if(pairiter->GetMCTrueParticle()) nparticlesGen++;
190 if(pairiter->GetRecTracks().GetNumberOfParticles()) nparticlesRec++;
192 AliDebug(1, Form(
"Among %d selected particles we find %d reconstructed particles.", nparticlesGen, nparticlesRec));
196 for(std::vector<fastjet::PseudoJet>::iterator jetiter = recjets.begin(); jetiter != recjets.end(); ++jetiter){
197 if(TMath::Abs(jetiter->eta()) >
fMaxEtaJets)
continue;
198 recjet =
new AliReducedJetInfo(jetiter->px(), jetiter->py(), jetiter->pz(), jetiter->E());
220 const AliESDtrack *inputtrack =
dynamic_cast<const AliESDtrack *
>(track);
222 return fTrackCuts[cuttype]->AcceptTrack(inputtrack);
225 AliESDtrack copytrack(track);
226 return fTrackCuts[cuttype]->AcceptTrack(©track);
240 if(!track->Charge())
return false;
252 AliVParticle *part = 0;
254 for(
int ipart = 0; ipart < fMCEvent->GetNumberOfTracks(); ipart++){
255 part = fMCEvent->GetTrack(ipart);
274 AliVParticle *part(NULL);
276 std::vector<AliReconstructedParticlePair> result;
277 for(
int ipart = 0; ipart <fMCEvent->GetNumberOfTracks(); ipart++){
278 part = fMCEvent->GetTrack(ipart);
282 if(tmptracks) tracks = *tmptracks;
284 std::stringstream debugmessage;
285 debugmessage <<
"Accepted particle with label " << ipart;
287 debugmessage <<
" - found reconstructed track";
289 debugmessage <<
" - did not find reconstructed track";
290 AliDebug(1, debugmessage.str().c_str());
296 result.push_back(foundpair);
309 return recjet.delta_R(fastjet::PseudoJet(inputtrack->Px(), inputtrack->Py(), inputtrack->Pz(), inputtrack->E()));
322 const std::vector<AliReconstructedParticlePair>& particles)
const
325 recjet->
GetPxPyPxE(pvec[0], pvec[1], pvec[2], pvec[3]);
326 fastjet::PseudoJet frecjet(pvec[0], pvec[1], pvec[2], pvec[3]);
327 AliVParticle *mcpart(NULL);
328 const AliVTrack *rectrack(NULL);
329 for(std::vector<AliReconstructedParticlePair>::const_iterator partiter = particles.begin(); partiter != particles.end(); ++partiter){
330 mcpart = partiter->GetMCTrueParticle();
332 double dr =
GetDR(frecjet, mcpart);
359 for(
int ipart = 0; ipart < fInputEvent->GetNumberOfTracks(); ipart++){
360 AliVTrack *mytrack =
dynamic_cast<AliVTrack *
>(fInputEvent->GetTrack(ipart));
363 if(!((mytrack->GetStatus() & AliVTrack::kITSrefit) && (mytrack->GetStatus() & AliVTrack::kTPCrefit)))
continue;
391 const AliAODMCParticle *aodpart =
dynamic_cast<const AliAODMCParticle *
>(part);
392 if(aodpart)
return aodpart->IsPhysicalPrimary();
393 else if (dynamic_cast<const AliMCParticle *>(part))
return fMCEvent->IsPhysicalPrimary(part->GetLabel());
405 std::vector<fastjet::PseudoJet> constituents = inputjet.constituents();
406 for(std::vector<fastjet::PseudoJet>::const_iterator citer = constituents.begin(); citer != constituents.end(); ++citer){
407 AliVParticle *mcpart = fMCEvent->GetTrack(citer->user_index());
425 TString
file(currFile);
429 if (file.Contains(
".zip#")) {
430 Ssiz_t pos1 = file.Index(
"root_archive",12,0,TString::kExact);
431 Ssiz_t pos = file.Index(
"#",1,pos1,TString::kExact);
432 Ssiz_t pos2 = file.Index(
".root",5,TString::kExact);
433 file.Replace(pos+1,pos2-pos1,
"");
436 file.ReplaceAll(gSystem->BaseName(file.Data()),
"");
440 TString strPthard(file);
442 strPthard.Remove(strPthard.Last(
'/'));
443 strPthard.Remove(strPthard.Last(
'/'));
444 if (strPthard.Contains(
"AOD")) strPthard.Remove(strPthard.Last(
'/'));
445 strPthard.Remove(0,strPthard.Last(
'/')+1);
446 if (strPthard.IsDec())
447 pthard = strPthard.Atoi();
450 TFile *fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec.root"));
454 fxsec = TFile::Open(Form(
"%s%s",file.Data(),
"pyxsec_hists.root"));
460 TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
465 TList *
list =
dynamic_cast<TList*
>(key->ReadObj());
470 fXsec = ((TProfile*)list->FindObject(
"h1Xsec"))->GetBinContent(1);
471 fTrials = ((TH1F*)list->FindObject(
"h1Trials"))->GetBinContent(1);
475 TTree *xtree = (TTree*)fxsec->Get(
"Xsection");
481 Double_t xsection = 0;
482 xtree->SetBranchAddress(
"xsection",&xsection);
483 xtree->SetBranchAddress(
"ntrials",&ntrials);
499 unsigned short nref = 0;
500 if(trk->IsA() == AliMCParticle::Class()){
501 AliMCParticle *part =
dynamic_cast<AliMCParticle *
>(trk);
502 AliTrackReference *tref(NULL);
503 for(
int iref = 0; iref < part->GetNumberOfTrackReferences(); ++iref){
504 tref = part->GetTrackReference(iref);
505 if(tref->DetectorId() == AliTrackReference::kTPC) nref++;
Definition of class AliReducedJetEvent, an event structure containing reduced jet information...
Minimal stucture for jet constituents associated to a jet by the jet clustering algorithm.
virtual void UserCreateOutputObjects()
void CreateRectrackLookup()
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
double fMaxEtaParticles
cut for particles
double fNtrials
Number of trials from PYTHIA.
double fMaxDR
maximum distance of a particle to the main jet axis
void SetNumberOfTPCtrackReferences(unsigned short nref)
AliESDtrackCuts * fTrackCuts[2]
Definintion of class AliReducedJetParticle, a structure for a reduced information set of particles as...
void AddParticle(AliVTrack *track)
virtual bool UserNotify()
AliParticleList * GetParticles(int label) const
void ConvertConstituents(AliReducedJetInfo *const recjet, const fastjet::PseudoJet &inputjet)
bool IsSelected(const AliVTrack *const track, CutType_t type) const
void SetSurvivedTrackCuts(ETrackCutsType_t cuts)
void AddMatchedTrack(AliReducedMatchedTrack *trk)
Event structure containing reduced jet information.
Container of reconstructed particles.
bool PythiaInfoFromFile(const char *currFile, double &fXsec, double &fTrials, int &pthard) const
void AddParticleInCone(AliReducedJetParticle *part)
double fMinPtParticles
minimium cut for particles
Analysis task producing filtered trees with reconstructed jets at generator level.
int fPtHardBin
-hard bin of the event
virtual ~AliHighPtReconstructionEfficiency()
void AddConstituent(AliReducedJetConstituent *con)
bool IsTrueSelected(const AliVParticle *const track) const
unsigned short GetNumberOfTPCTrackReferences(AliVParticle *const trk) const
AliReducedJetEvent * fJetEvent
Output jet event.
void ProcessJet(AliReducedJetInfo *const jet, const std::vector< AliReconstructedParticlePair > &particles) const
void SetMCTrueParticle(AliVParticle *const part)
CutType_t
Declaration of cut types.
Reduced information about a reconstructed jet.
double fCrossSection
Cross section from PYTHIA.
Pair of a Monte-Carlo true particle and the associated reconstructed information. ...
AliHighPtReconstructionEfficiency()
void SetNumberOfClustersTPC(unsigned char ncls)
AliParticleMap * fParticleMap
Map of reconstructed particles associate to a Monte-Carlo label.
void GetPxPyPxE(double &px, double &py, double &pz, double &e)
double GetDR(const fastjet::PseudoJet &recjet, const AliVParticle *const inputtrack) const
double fMaxEtaJets
cut for jets
Reduced information set of particles associated with a jet.
void SetDistanceToMainJetAxis(double dr)
int GetNumberOfParticles() const
const AliParticleList * FindReconstructedParticleFast(int label) const
Find reconstructed particles for a given label.
Definition of class AliReducedTrack, a structure with reduced track information at reconstruction lev...
TTree * fJetTree
Output tree.
void SetGoodTrackLabel(bool goodtrack)
Definition of class AliReducedJetConstituent, a minimal stucture for jet constituents associated to a...
virtual void UserExec(Option_t *)
void AddReconstructedJet(AliReducedJetInfo *jet)
Class with reduced track information at reconstruction level.
bool IsPhysicalPrimary(const AliVParticle *const part) const
Checks if the particle is a physical primary particle.
void SelectParticlesForJetfinding(TList &particles) const
void SetRecParticles(const AliParticleList &tracks)
AliVTrack * GetParticle(int itrack) const
std::vector< AliReconstructedParticlePair > SelectParticles() const
int GetNumberOfParticles() const
Definition of class AliReducedJetInfo, a structure for reduced information about a reconstructed jet...
bool fTaskDebugMode
Switch for debug mode.
Definition of the analysis task producing filtered trees with reconstructed jets at generator level...
Map of reconstructed particles which share the same Monte-Carlo label.