]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/EMCAL/AliEmcalParticle.h
AliAnalysisMuMu classes update
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalParticle.h
1 #ifndef ALIEMCALPARTICLE_H
2 #define ALIEMCALPARTICLE_H
3
4 // $Id$
5
6 #include <TLorentzVector.h>
7 #include <TMath.h>
8 #include <TObjArray.h>
9 #include "AliVCluster.h"
10 #include "AliVParticle.h"
11 #include "AliVTrack.h"
12
13 class AliEmcalParticle: public AliVParticle {
14  public:
15   AliEmcalParticle();
16   AliEmcalParticle(TObject *particle, Int_t id = -1, Double_t vx=0, Double_t vy=0, Double_t vz=0);
17   AliEmcalParticle(const AliEmcalParticle &p); 
18   AliEmcalParticle &operator=(const AliEmcalParticle &p);
19   virtual ~AliEmcalParticle();
20
21   // AliVParticle interface
22   Double_t          Px()        const { return fPt*TMath::Cos(fPhi);  }
23   Double_t          Py()        const { return fPt*TMath::Sin(fPhi);  };
24   Double_t          Pz()        const { return fPt*TMath::SinH(fEta); }
25   Double_t          Pt()        const { return fPt ; }
26   Double_t          P()         const { return TMath::Sqrt(Px()*Px()+Py()*Py()+Pz()*Pz()); }
27   Bool_t            PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return 1; }
28   Double_t          Xv()        const { return 0; }
29   Double_t          Yv()        const { return 0; }
30   Double_t          Zv()        const { return 0; }
31   Bool_t            XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return 1; }
32   Double_t          OneOverPt() const { return 1./fPt; }
33   Double_t          Phi()       const { return fPhi; }
34   Double_t          Theta()     const { return 0.; }
35   Double_t          E()         const { if (fTrack) return fTrack->E(); return fCluster->E(); }
36   Double_t          M()         const { if (fTrack) return fTrack->M(); return 0; }
37   Double_t          Eta()       const { return fEta; }
38   Double_t          Y()         const { if (fTrack) return fTrack->Y(); return fEta; }
39   Short_t           Charge()    const { if (fTrack) return fTrack->Charge(); else return 0; }
40   Int_t             GetLabel()  const { if (fTrack) return fTrack->GetLabel(); return fCluster->GetLabel(); }
41   Int_t             PdgCode()   const { return 0; }
42   const Double_t   *PID()       const { return 0; }
43
44   void              AddMatchedObj(Int_t id, Double_t d);
45   AliVCluster      *GetCluster()           const { return fCluster                                                  ; }
46   Int_t             GetMatchedObjId(UShort_t i = 0)         const { return fNMatched > i ? fMatchedIds[i]  : -1     ; }
47   Double_t          GetMatchedObjDistance(UShort_t i = 0)   const { return fNMatched > i ? fMatchedDist[i] : -1     ; }
48   UShort_t          GetNumberOfMatchedObj()                 const { return fNMatched                                ; }
49   AliVCluster      *GetMatchedCluster(UShort_t i = 0)       const { if (fTrack && fMatchedPtr && (fNMatched > i)) 
50                                                                       return static_cast<AliVCluster*>(fMatchedPtr->At(fMatchedIds[i]));
51                                                                     return 0                                        ; } 
52   AliVTrack        *GetMatchedTrack(UShort_t i = 0)         const { if (fCluster && fMatchedPtr && (fNMatched > i)) 
53                                                                       return static_cast<AliVTrack*>(fMatchedPtr->At(fMatchedIds[i]));
54                                                                     return 0                                        ; } 
55   AliVTrack        *GetTrack()             const { return fTrack                                                    ; }
56   Double_t          GetTrackPhiOnEMCal()   const { if (fTrack) return fTrack->GetTrackPhiOnEMCal(); else return -999; }
57   Double_t          GetTrackEtaOnEMCal()   const { if (fTrack) return fTrack->GetTrackEtaOnEMCal(); else return -999; }
58   Double_t          GetTrackPtOnEMCal()    const { if (fTrack) return fTrack->GetTrackPtOnEMCal();  else return -999; }
59   Int_t             IdInCollection()       const { return fId                                                       ; }
60   Bool_t            IsCluster()            const { return (Bool_t) fCluster != 0                                    ; }
61   Bool_t            IsEMCAL()              const { if (fCluster) return fCluster->IsEMCAL(); 
62                                                    if (fTrack)   return fTrack->IsEMCAL(); 
63                                                    return kFALSE; }
64   Bool_t            IsTrack()              const { return (Bool_t) fTrack   != 0                                    ; }
65   Bool_t            IsMC(Int_t minLabel=0) const { if (fTrack) return (TMath::Abs(fTrack->GetLabel()) > minLabel); 
66                                                    return (fCluster->GetLabel() > minLabel); }
67   void              ResetMatchedObjects();
68   void              SetIdInCollection(Int_t id)          { fId = id                                                                      ; }
69   void              SetMatchedObj(Int_t id, Double_t d)  { ResetMatchedObjects(); fMatchedIds[0] = id; fMatchedDist[0] = d; fNMatched = 1; }
70   void              SetMatchedPtr(TObjArray *arr)        { fMatchedPtr = arr; }
71
72  protected:
73   TLorentzVector   &GetLorentzVector(const Double_t *vertex = 0)  const;
74
75   static const UShort_t fSizeMatched = 99;        //!size of matched clusters array
76
77   AliVTrack        *fTrack;                       //!track
78   AliVCluster      *fCluster;                     //!cluster
79   UShort_t          fMatchedIds[fSizeMatched];    //!ids of matched tracks/clusters, ordered from the closest to the farthest
80   Double_t          fMatchedDist[fSizeMatched];   //!distances of matched tracks/clusters
81   UShort_t          fNMatched;                    //!number of matched objects 
82   Int_t             fId;                          //!id in original collection
83   Double_t          fPhi;                         //!phi
84   Double_t          fEta;                         //!eta
85   Double_t          fPt;                          //!pt
86   TObjArray        *fMatchedPtr;                  //!pointer to array of matched tracks/clusters
87
88   ClassDef(AliEmcalParticle, 2) // Emcal particle class
89 };
90 #endif