]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/AliEmcalJet.h
From Salvatore
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliEmcalJet.h
CommitLineData
914d486c 1#ifndef AliEmcalJet_H
2#define AliEmcalJet_H
7df864a3 3
688670de 4// $Id$
5
f8087a81 6#include <TArrayS.h>
7efbea04 7#include <TLorentzVector.h>
8#include <TMath.h>
a55e4f1d 9#include <TClonesArray.h>
10
f8087a81 11#include "AliVParticle.h"
a55e4f1d 12#include "AliVCluster.h"
85d48773 13#include "AliVEvent.h"
7efbea04 14
914d486c 15class AliEmcalJet : public AliVParticle
7efbea04 16{
7df864a3 17 public:
96919f91 18 AliEmcalJet();
914d486c 19 AliEmcalJet(Double_t px, Double_t py, Double_t pz);
101cefde 20 AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m);
914d486c 21 AliEmcalJet(const AliEmcalJet &jet);
22 AliEmcalJet& operator=(const AliEmcalJet &jet);
7efbea04 23
a55e4f1d 24 Double_t Px() const { return fPt*TMath::Cos(fPhi); }
da1bd0e7 25 Double_t Py() const { return fPt*TMath::Sin(fPhi); }
a55e4f1d 26 Double_t Pz() const { return fPt*TMath::SinH(fEta); }
27 Double_t Pt() const { return fPt; }
28 Double_t P() const { return fPt*TMath::CosH(fEta); }
29 Bool_t PxPyPz(Double_t p[3]) const { p[0]=Px();p[1]=Py();p[2]=Pz(); return 1; }
30 Double_t Xv() const { return 0.; }
31 Double_t Yv() const { return 0.; }
32 Double_t Zv() const { return 0.; }
33 Bool_t XvYvZv(Double_t x[3]) const { x[0]=0;x[1]=0;x[2]=0; return 1; }
34 Double_t OneOverPt() const { return 1./fPt; }
35 Double_t Phi() const { return fPhi; }
36 Double_t Theta() const { return 2*TMath::ATan(TMath::Exp(-fEta)); }
37 Double_t E() const { Double_t p=P(); return TMath::Sqrt(M()*M()+p*p); }
38 Double_t M() const { return 0.13957; }
39 Double_t Eta() const { return fEta; }
40 Double_t Y() const { return 0.5*TMath::Log((E()+Pz())/(E()-Pz())); }
41 Short_t Charge() const { return 0; }
42 Int_t GetLabel() const { return -1; }
43 Int_t PdgCode() const { return 0; }
44 const Double_t *PID() const { return 0; }
45 void GetMom(TLorentzVector &vec) const;
46 void Print(Option_t* option = "") const;
688670de 47
a55e4f1d 48 Double_t Area() const { return fArea; }
db8a0184 49 Double_t AreaPt() const { return fArea; }
50 Double_t AreaEta() const { return fAreaEta; }
51 Double_t AreaPhi() const { return fAreaPhi; }
101cefde 52 Double_t AreaEmc() const { return fAreaEmc; }
53 Bool_t AxisInEmcal() const { return fAxisInEmcal; }
db8a0184 54 Int_t Compare(const TObject* obj) const;
a55e4f1d 55 Short_t ClusterAt(Int_t idx) const { return fClusterIDs.At(idx); }
8895e61b 56 AliVCluster *ClusterAt(Int_t idx, TClonesArray *ca) const { if (!ca) return 0; return dynamic_cast<AliVCluster*>(ca->At(ClusterAt(idx))); }
f660c2d6 57 AliVCluster *GetLeadingCluster(TClonesArray *clusters) const;
db8a0184 58 UShort_t GetNumberOfClusters() const { return fClusterIDs.GetSize(); }
96919f91 59 UShort_t GetNumberOfTracks() const { return fTrackIDs.GetSize(); }
624bef5b 60 UShort_t GetNumberOfConstituents() const { return GetNumberOfClusters()+GetNumberOfTracks(); }
101cefde 61 Double_t FracEmcalArea() const { return fAreaEmc/fArea; }
101cefde 62 Bool_t IsInsideEmcal() const { return (fAreaEmc/fArea>0.999); }
63 Bool_t IsInEmcal() const { return (fAreaEmc>0); }
db8a0184 64 Bool_t IsMC() const { return (Bool_t)(MCPt() > 0); }
65 Bool_t IsSortable() const { return kTRUE; }
96919f91 66 Double_t MaxNeutralPt() const { return fMaxNPt; }
67 Double_t MaxChargedPt() const { return fMaxCPt; }
a55e4f1d 68 Double_t NEF() const { return fNEF; }
96919f91 69 UShort_t Nn() const { return fNn; }
70 UShort_t Nch() const { return fNch; }
a55e4f1d 71 UShort_t N() const { return Nch()+Nn(); }
8895e61b 72 Int_t NEmc() const { return fNEmc; }
96919f91 73 Double_t MCPt() const { return fMCPt; }
96919f91 74 Double_t MaxClusterPt() const { return MaxNeutralPt(); }
75 Double_t MaxTrackPt() const { return MaxChargedPt(); }
e44e8726 76 Double_t MaxPartPt() const { return fMaxCPt < fMaxNPt ? fMaxNPt : fMaxCPt; }
8895e61b 77 Double_t PtEmc() const { return fPtEmc; }
78 Double_t PtSub() const { return fPtSub; }
79 Double_t PtSub(Double_t rho) const { return fPt - fArea*rho; }
db8a0184 80 Double_t PtSubVect(Double_t rho) const;
db8a0184 81 Short_t TrackAt(Int_t idx) const { return fTrackIDs.At(idx); }
82 AliVParticle *TrackAt(Int_t idx, TClonesArray *ta) const { if (!ta) return 0; return dynamic_cast<AliVParticle*>(ta->At(TrackAt(idx))); }
f660c2d6 83 AliVParticle *GetLeadingTrack(TClonesArray *tracks) const;
35789a2d 84
a55e4f1d 85 void AddClusterAt(Int_t clus, Int_t idx){ fClusterIDs.AddAt(clus, idx); }
86 void AddTrackAt(Int_t track, Int_t idx) { fTrackIDs.AddAt(track, idx); }
038f0049 87 void Clear(Option_t */*option*/="") { fClusterIDs.Set(0); fTrackIDs.Set(0); fClosestJets[0] = 0; fClosestJets[1] = 0;
88 fClosestJetsDist[0] = 0; fClosestJetsDist[1] = 0; fMatched = 0; fPtSub = 0; }
101cefde 89 void SetArea(Double_t a) { fArea = a; }
db8a0184 90 void SetAreaEta(Double_t a) { fAreaEta = a; }
91 void SetAreaPhi(Double_t a) { fAreaPhi = a; }
101cefde 92 void SetAreaEmc(Double_t a) { fAreaEmc = a; }
93 void SetAxisInEmcal(Bool_t b) { fAxisInEmcal = b; }
96919f91 94 void SetMaxNeutralPt(Double32_t t) { fMaxNPt = t; }
95 void SetMaxChargedPt(Double32_t t) { fMaxCPt = t; }
101cefde 96 void SetNEF(Double_t nef) { fNEF = nef; }
a55e4f1d 97 void SetNumberOfClusters(Int_t n) { fClusterIDs.Set(n); }
98 void SetNumberOfTracks(Int_t n) { fTrackIDs.Set(n); }
96919f91 99 void SetNumberOfCharged(Int_t n) { fNch = n; }
100 void SetNumberOfNeutrals(Int_t n) { fNn = n; }
101 void SetMCPt(Double_t p) { fMCPt = p; }
a55e4f1d 102 void SortConstituents();
cfc2ac24 103 void SetNEmc(Int_t n) { fNEmc = n; }
104 void SetPtEmc(Double_t pt) { fPtEmc = pt; }
105 void SetPtSub(Double_t ps) { fPtSub = ps; }
85d48773 106 void SetPtSubVect(Double_t ps) { fPtVectSub = ps; }
107
108 // Trigger
109 Bool_t IsTriggerJet(UInt_t trigger=AliVEvent::kEMCEJE) const { return (Bool_t)((fTriggers & trigger) != 0); }
110 void SetTrigger(UInt_t trigger) { fTriggers = trigger; }
111 void AddTrigger(UInt_t trigger) { fTriggers |= trigger; }
cfc2ac24 112
113 // Matching
2103dc6a 114 void SetClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[0] = j; fClosestJetsDist[0] = d ; }
cfc2ac24 115 void SetSecondClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[1] = j; fClosestJetsDist[1] = d ; }
116 void SetMatchedToClosest(UShort_t m) { fMatched = 0; fMatchingType = m ; }
117 void SetMatchedToSecondClosest(UShort_t m) { fMatched = 1; fMatchingType = m ; }
2103dc6a 118 void ResetMatching();
cfc2ac24 119 AliEmcalJet* ClosestJet() const { return fClosestJets[0] ; }
120 Double_t ClosestJetDistance() const { return fClosestJetsDist[0] ; }
121 AliEmcalJet* SecondClosestJet() const { return fClosestJets[1] ; }
122 Double_t SecondClosestJetDistance() const { return fClosestJetsDist[1] ; }
123 AliEmcalJet* MatchedJet() const { return fMatched < 2 ? fClosestJets[fMatched] : 0; }
124 UShort_t GetMatchingType() const { return fMatchingType ; }
629e03fc 125
7df864a3 126 protected:
43a9dcd0 127 Double32_t fPt; //[0,0,12] pt
128 Double32_t fEta; //[-1,1,12] eta
129 Double32_t fPhi; //[0,6.3,12] phi
130 Double32_t fM; //[0,0,8] mass
131 Double32_t fNEF; //[0,1,8] neutral energy fraction
132 Double32_t fArea; //[0,0,12] area
db8a0184 133 Double32_t fAreaEta; //[0,0,12] area eta
134 Double32_t fAreaPhi; //[0,0,12] area phi
43a9dcd0 135 Double32_t fAreaEmc; //[0,0,12] area on EMCAL surface (determined from ghosts)
136 Bool_t fAxisInEmcal; // =true if jet axis inside EMCAL acceptance
137 Double32_t fMaxCPt; //[0,0,12] pt of maximum charged constituent
138 Double32_t fMaxNPt; //[0,0,12] pt of maximum neutral constituent
139 Double32_t fMCPt; // pt from MC particles contributing to the jet
140 Int_t fNn; // number of neutral constituents
141 Int_t fNch; // number of charged constituents
8895e61b 142 Double32_t fPtEmc; //[0,0,12] pt in EMCAL acceptance
143 Int_t fNEmc; // number of constituents in EMCAL acceptance
43a9dcd0 144 TArrayS fClusterIDs; // array of cluster constituents
145 TArrayS fTrackIDs; // array of track constituents
146 AliEmcalJet *fClosestJets[2]; //! if this is MC it contains the two closest detector level jets in order of distance and viceversa
147 Double32_t fClosestJetsDist[2]; //! distance to closest jets (see above)
148 UShort_t fMatched; //! 0,1 if it is matched with one of the closest jets; 2 if it is not matched
cfc2ac24 149 UShort_t fMatchingType; //! matching type
8895e61b 150 Double_t fPtSub; //! background subtracted pt (not stored set from outside)
db8a0184 151 Double_t fPtVectSub; //! background vector subtracted pt (not stored set from outside)
85d48773 152 UInt_t fTriggers; //! triggers that the jet might have fired (AliVEvent::EOfflineTriggerTypes)
7df864a3 153
624bef5b 154 ClassDef(AliEmcalJet,9) // Emcal jet class in cylindrical coordinates
7df864a3 155};
f472e642 156#endif