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