AliPhysics  63e47e1 (63e47e1)
AliEmcalPicoTrackFromJetMaker.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Class to make PicoTracks from jet 4-vectors
4 //
5 // Author: M. Verweij
6 
7 #include <TClonesArray.h>
8 #include <TRandom3.h>
9 #include "AliAODEvent.h"
10 #include "AliAODTrack.h"
11 #include "AliAnalysisManager.h"
12 #include "AliESDtrack.h"
13 #include "AliESDtrackCuts.h"
14 #include "AliLog.h"
15 #include "AliPicoTrack.h"
16 #include "AliVTrack.h"
17 #include "AliEmcalJet.h"
19 
21 
22 //________________________________________________________________________
25  fTracksOutName("PicoTracksFromJets"),
26  fJetsInName("tracks"),
27  fJetsIn(0),
28  fTracksOut(0)
29 {
30  // Constructor.
31 }
32 
33 //________________________________________________________________________
35  AliAnalysisTaskSE(name),
36  fTracksOutName("PicoTracksFromJets"),
37  fJetsInName("tracks"),
38  fJetsIn(0),
39  fTracksOut(0)
40 {
41  // Constructor.
42 }
43 
44 //________________________________________________________________________
46 {
47  // Destructor.
48 }
49 
50 //________________________________________________________________________
52 {
53  // Create my user objects.
54 
55  fTracksOut = new TClonesArray("AliPicoTrack");
56  fTracksOut->SetName(fTracksOutName);
57 }
58 
59 //________________________________________________________________________
61 {
62  // Main loop, called for each event.
63 
64  AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager();
65  if (!am) {
66  AliError("Manager zero, returning");
67  return;
68  }
69 
70  // retrieve tracks from input.
71  if (!fJetsIn) {
72  fJetsIn = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fJetsInName));
73  if (!fJetsIn) {
74  AliError(Form("Could not retrieve jets %s!", fJetsInName.Data()));
75  return;
76  }
77  if (!fJetsIn->GetClass()->GetBaseClass("AliVParticle")) {
78  AliError(Form("%s: Collection %s does not contain AliVParticle objects!", GetName(), fJetsInName.Data()));
79  return;
80  }
81  }
82 
83  // add tracks to event if not yet there
84  fTracksOut->Delete();
85  if (!(InputEvent()->FindListObject(fTracksOutName))) {
86  InputEvent()->AddObject(fTracksOut);
87  }
88 
89  // loop over tracks
90  const Int_t Njets = fJetsIn->GetEntriesFast();
91  for (Int_t iJets = 0, nacc = 0; iJets < Njets; ++iJets) {
92 
93  AliEmcalJet *jet = static_cast<AliEmcalJet*>(fJetsIn->At(iJets));
94  if (!jet)
95  continue;
96 
97  Bool_t isEmc = kFALSE;
98  if (TMath::Abs(jet->Eta()) < 0.75 &&
99  jet->Phi() > 70 * TMath::DegToRad() &&jet->Phi() < 190 * TMath::DegToRad())
100  isEmc = kTRUE;
101 
102  AliPicoTrack *picotrack = new ((*fTracksOut)[nacc]) AliPicoTrack(jet->Pt(),
103  jet->Eta(),
104  jet->Phi(),
105  1,
106  1,
107  0,
108  jet->Eta(),
109  jet->Phi(),
110  jet->Pt(),
111  isEmc,
112  jet->M());
113  picotrack->SetTrackType(0);
114  ++nacc;
115  }
116 }
void SetTrackType(Byte_t type)
Definition: AliPicoTrack.h:44
Double_t Eta() const
Definition: AliEmcalJet.h:121
Double_t Phi() const
Definition: AliEmcalJet.h:117
TClonesArray * fTracksOut
jet array in
int Int_t
Definition: External.C:63
Double_t Pt() const
Definition: AliEmcalJet.h:109
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
Double_t M() const
Definition: AliEmcalJet.h:120