]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALJetTasks/AliEmcalJet.h
changes submitted by user saiola
[u/mrichter/AliRoot.git] / PWGGA / 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::Cos(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          AreaEmc()                    const { return fAreaEmc;                  }
49   Bool_t            AxisInEmcal()                const { return fAxisInEmcal;              }
50   UShort_t          GetNumberOfClusters()        const { return fClusterIDs.GetSize();     }
51   Short_t           ClusterAt(Int_t idx)         const { return fClusterIDs.At(idx);       }
52   AliVCluster      *ClusterAt(Int_t idx, TClonesArray *clusarray)  const { if (!clusarray) return 0; return dynamic_cast<AliVCluster*>(clusarray->At(ClusterAt(idx))); }
53   UShort_t          GetNumberOfTracks()          const { return fTrackIDs.GetSize();       }
54   Short_t           TrackAt(Int_t idx)           const { return fTrackIDs.At(idx);         }
55   AliVParticle     *TrackAt(Int_t idx, TClonesArray *trackarray)   const { if (!trackarray) return 0; return dynamic_cast<AliVParticle*>(trackarray->At(TrackAt(idx))); } 
56   Double_t          FracEmcalArea()              const { return fAreaEmc/fArea;            }
57   Bool_t            IsInsideEmcal()              const { return (fAreaEmc/fArea>0.999);    }
58   Bool_t            IsInEmcal()                  const { return (fAreaEmc>0);              }
59   Double_t          MaxNeutralPt()               const { return fMaxNPt;                   }
60   Double_t          MaxChargedPt()               const { return fMaxCPt;                   }
61   Double_t          NEF()                        const { return fNEF;                      }
62   UShort_t          Nn()                         const { return fNn;                       }
63   UShort_t          Nch()                        const { return fNch;                      }
64   UShort_t          N()                          const { return Nch()+Nn();                }
65   Double_t          MCPt()                       const { return fMCPt;                     }
66   Bool_t            IsMC()                       const { return (Bool_t)(MCPt() > 0);      }
67   AliEmcalJet*      ClosestJet()                 const { return fClosestJets[0];           }
68   Double_t          ClosestJetDistance()         const { return fClosestJetsDist[0];       }
69   AliEmcalJet*      SecondClosestJet()           const { return fClosestJets[1];           }
70   Double_t          SecondClosestJetDistance()   const { return fClosestJetsDist[1];       }
71   AliEmcalJet*      MatchedJet()                 const { return fMatched < 2 ? fClosestJets[fMatched] : 0; }
72   Double_t          MaxClusterPt()               const { return MaxNeutralPt();            }
73   Double_t          MaxTrackPt()                 const { return MaxChargedPt();            }
74   Double_t          MaxPartPt()                  const { return fMaxCPt < fMaxNPt ? fMaxNPt : fMaxCPt;     }
75
76   void              AddClusterAt(Int_t clus, Int_t idx){ fClusterIDs.AddAt(clus, idx);     }
77   void              AddTrackAt(Int_t track, Int_t idx) { fTrackIDs.AddAt(track, idx);      }
78   void              Clear(Option_t */*option*/="")     { fClusterIDs.Set(0); 
79                                                          fTrackIDs.Set(0);                 }
80   void              SetArea(Double_t a)                { fArea    = a;                     }
81   void              SetAreaEmc(Double_t a)             { fAreaEmc = a;                     }
82   void              SetAxisInEmcal(Bool_t b)           { fAxisInEmcal = b;                 }
83   void              SetMaxNeutralPt(Double32_t t)      { fMaxNPt  = t;                     }
84   void              SetMaxChargedPt(Double32_t t)      { fMaxCPt  = t;                     }
85   void              SetNEF(Double_t nef)               { fNEF     = nef;                   }
86   void              SetNumberOfClusters(Int_t n)       { fClusterIDs.Set(n);               }
87   void              SetNumberOfTracks(Int_t n)         { fTrackIDs.Set(n);                 }
88   void              SetNumberOfCharged(Int_t n)        { fNch = n;                         }
89   void              SetNumberOfNeutrals(Int_t n)       { fNn = n;                          }
90   void              SetMCPt(Double_t p)                { fMCPt = p;                        }
91   void              SortConstituents();
92   void              SetClosestJet(AliEmcalJet *j, Double_t d)       { fClosestJets[0] = j; fClosestJetsDist[0] = d; }
93   void              SetSecondClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[1] = j; fClosestJetsDist[1] = d; }
94   void              SetMatchedToClosest()                           { fMatched = 0;        }
95   void              SetMatchedToSecondClosest()                     { fMatched = 1;        }
96
97  protected:
98   Double32_t        fPt;                  //[0,0,12]   pt 
99   Double32_t        fEta;                 //[-1,1,12]  eta
100   Double32_t        fPhi;                 //[0,6.3,12] phi
101   Double32_t        fM;                   //[0,0,8]    mass
102   Double32_t        fNEF;                 //[0,1,8]    neutral energy fraction
103   Double32_t        fArea;                //[0,0,12]   area
104   Double32_t        fAreaEmc;             //[0,0,12]   area on EMCAL surface (determined from ghosts)
105   Bool_t            fAxisInEmcal;         //           =true if jet axis inside EMCAL acceptance
106   Double32_t        fMaxCPt;              //[0,0,12]   pt of maximum charged constituent
107   Double32_t        fMaxNPt;              //[0,0,12]   pt of maximum neutral constituent
108   Double32_t        fMCPt;                //           pt from MC particles contributing to the jet
109   Int_t             fNn;                  //           number of neutral constituents
110   Int_t             fNch;                 //           number of charged constituents
111   TArrayS           fClusterIDs;          //           array of cluster constituents  
112   TArrayS           fTrackIDs;            //           array of track constituents   
113   AliEmcalJet      *fClosestJets[2];      //!          if this is MC it contains the two closest detector level jets in order of distance and viceversa
114   Double32_t        fClosestJetsDist[2];  //!          distance to closest jets (see above)
115   UShort_t          fMatched;             //!          0,1 if it is matched with one of the closest jets; 2 if it is not matched
116
117   ClassDef(AliEmcalJet,6) // Emcal jet class in cylindrical coordinates
118 };
119 #endif