AliPhysics  master (3d17d9d)
AliAnalysisTaskEmcalOutliersGen.cxx
Go to the documentation of this file.
1 #include <sstream>
3 #include "AliAnalysisManager.h"
4 #include "AliEmcalJet.h"
5 #include "AliJetContainer.h"
6 #include "AliMCEvent.h"
7 #include "AliParticleContainer.h"
8 #include "AliVParticle.h"
9 
11 
12 using namespace PWGJE::EMCALJetTasks;
13 
16  fHistJetPt(nullptr)
17 {
18 
19 }
20 
21 AliAnalysisTaskEmcalOutliersGen::AliAnalysisTaskEmcalOutliersGen(const char *name):
22  AliAnalysisTaskEmcalJet(name, kTRUE),
23  fHistJetPt(nullptr)
24 {
27  SetIsPythia(true);
28 }
29 
32 
33  fHistJetPt = new TH1F("fHistJetPt", "Jet pt", 1000, 0., 1000.);
34  fOutput->Add(fHistJetPt);
35 
36  PostData(1, fOutput);
37 }
38 
40  auto particles = GetParticleContainer("mcparticlesSelected");
41  //auto particles = GetParticleContainer("mcparticles");
42  auto jets = GetJetContainer("partjets");
43 
44  double partptmin[21] = {0., 20., 25., 30., 40., 50., 70., 80., 100., 120., 140., 180., 200., 250., 270., 300., 350., 380., 420., 450., 600.};
45  //std::cout << "Using pt-hard cut " << partptmin[fPtHardBin] << " for pt-hard bin " << fPtHardBin << std::endl;
46 
47  for(auto j : jets->accepted()){
48  fHistJetPt->Fill(j->Pt());
49  if(j->Pt() > partptmin[fPtHardBin]) {
50  std::cout << "Outlier jet found, pt > " << j->Pt() << " GeV/c, NEF = " << j->NEF() << ", "
51  << j->GetNumberOfTracks() << " / " << j->GetNumberOfClusters() << " constituents" << std::endl;
52  for(int i = 0; i < j->GetNumberOfTracks(); i++){
53  auto part = j->TrackAt(i, particles->GetArray());
54  auto z = j->GetZ(part->Px(), part->Py(), part->Pz());
55  auto mother = part->GetMother() > -1 ? MCEvent()->GetTrack(part->GetMother()) : nullptr;
56  std::cout << "Particle " << i << ": pt " << part->Pt() << " GeV/c, z " << z << ", pdg " << part->PdgCode();
57  if(mother) {
58  std::cout << ", mother pdg " << mother->PdgCode() << ", mother pt " << mother->Pt();
59  auto grandmother = mother->GetMother() > -1 ? MCEvent()->GetTrack(mother->GetMother()) : nullptr;
60  if(grandmother) {
61  std::cout << ", grandmother pdg " << grandmother->PdgCode() << ", grandmother pt " << grandmother->Pt();
62 
63  } else {
64  std::cout << ", no grand mother";
65  }
66 
67  } else {
68  std::cout << ", no mother";
69  }
70  std::cout << std::endl;
71  }
72  }
73  }
74 
75  return true;
76 }
77 
79  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
80  if(!mgr){
81  ::Error("EmcalTriggerJets::AliAnalysisTaskEmcalJetEnergyScale::AddTaskJetEnergyScale", "No analysis manager available");
82  return nullptr;
83  }
84 
85  auto task = new AliAnalysisTaskEmcalOutliersGen(name);
86  mgr->AddTask(task);
87 
88  auto partcont = task->AddMCParticleContainer("mcparticlesSelected");
89  //auto partcont = task->AddMCParticleContainer("mcparticles");
90  partcont->SetMinPt(0.);
92  AliJetContainer::kTPCfid, partcont, nullptr);
93  contjet->SetName("partjets");
94  contjet->SetMaxTrackPt(1000.);
95 
96  std::stringstream outnamebuilder;
97  outnamebuilder << mgr->GetCommonFileName() << ":Outliers";
98 
99  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
100  mgr->ConnectOutput(task, 1, mgr->CreateContainer("OutlierHists", TList::Class(), AliAnalysisManager::kOutputContainer, outnamebuilder.str().data()));
101 
102  return task;
103 }
AliJetContainer * GetJetContainer(Int_t i=0) const
void SetGetPtHardBinFromPath(Bool_t docheck)
Switch on/off getting bin from the file path.
void SetIsPythia(Bool_t i)
Define production as pythia pt-hard production.
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
TPC fiducial acceptance (each eta 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.
AliEmcalList * fOutput
!output list
Int_t fPtHardBin
!event -hard bin
void SetMakeGeneralHistograms(Bool_t g)
Enable general histograms.
Base task in the EMCAL jet framework.
static AliAnalysisTaskEmcalOutliersGen * AddTaskEmcalOutliersGen(const char *name)
void UserCreateOutputObjects()
Main initialization function on the worker.