have pt,eta,phi
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Jun 2012 18:14:41 +0000 (18:14 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 8 Jun 2012 18:14:41 +0000 (18:14 +0000)
PWGGA/EMCALTasks/AliEmcalParticle.cxx
PWGGA/EMCALTasks/AliEmcalParticle.h

index 0b68b3d..85948ca 100644 (file)
@@ -14,7 +14,10 @@ AliEmcalParticle::AliEmcalParticle() :
   fTrack(0), 
   fCluster(0),
   fNMatched(0),
-  fId(-1)
+  fId(-1),
+  fPhi(0),
+  fEta(0),
+  fPt(0)
 {
   // Default constructor.
 
@@ -22,23 +25,35 @@ AliEmcalParticle::AliEmcalParticle() :
 }
 
 //_________________________________________________________________________________________________
-AliEmcalParticle::AliEmcalParticle(TObject *particle, Int_t id) :
+AliEmcalParticle::AliEmcalParticle(TObject *particle, Int_t id, Double_t vx, Double_t vy, Double_t vz) :
   TObject(),
   fTrack(0), 
   fCluster(0),
   fNMatched(0),
-  fId(id)
+  fId(id),
+  fPhi(0),
+  fEta(0),
+  fPt(0)
 {
   // Constructor.
 
   if (!particle)
     AliWarning("Null pointer passed as particle.");
 
-
   fTrack = dynamic_cast<AliVTrack*>(particle);
-  if (!fTrack)
+  if (fTrack) {
+    fEta = fTrack->Eta();
+    fPhi = fTrack->Phi();
+    fPt = fTrack->Pt();
+  } else {
     fCluster = dynamic_cast<AliVCluster*>(particle);
-
+    Double_t vtx[3]; vtx[0]=vx;vtx[1]=vy;vtx[2]=vz;
+    TLorentzVector vect;
+    fCluster->GetMomentum(vect, vtx);
+    fEta = vect.Eta();
+    fPhi = vect.Phi();
+    fPt  = vect.Pt();
+  }
   if (!fTrack && !fCluster)
     AliWarning("Particle type not recognized (not AliVTrack nor AliVCluster).");
 
@@ -51,7 +66,10 @@ AliEmcalParticle::AliEmcalParticle(const AliEmcalParticle &p) :
   fTrack(p.fTrack),
   fCluster(p.fCluster), 
   fNMatched(p.fNMatched),
-  fId(p.fId)
+  fId(p.fId),
+  fPhi(p.fPhi),
+  fEta(p.fEta),
+  fPt(p.fPt)
 {
   // Copy constructor.
 
@@ -73,12 +91,15 @@ AliEmcalParticle &AliEmcalParticle::operator=(const AliEmcalParticle &p)
   // Assignment operator.
 
   if (this != &p) {
-    fTrack = p.fTrack;
-    fCluster = p.fCluster;
-    fNMatched    = p.fNMatched;
-    
+    fTrack    = p.fTrack;
+    fCluster  = p.fCluster;
+    fNMatched = p.fNMatched;
+    fId       = p.fId;
+    fPhi      = p.fPhi;
+    fEta      = p.fEta;
+    fPt       = p.fPt;
+
     ResetMatchedObjects();
-  
     memcpy(fMatchedIds, p.fMatchedIds, sizeof(UShort_t) * fSizeMatched);
     memcpy(fMatchedDist, p.fMatchedDist, sizeof(Double_t) * fSizeMatched);
   }
index 99fcc1a..654904c 100644 (file)
@@ -5,19 +5,21 @@
 
 #include <TLorentzVector.h>
 #include <TObject.h>
-
+#include "AliVCluster.h"
 #include "AliVTrack.h"
 
-class AliVCluster;
-
 class AliEmcalParticle: public TObject {
  public:
   AliEmcalParticle();
-  AliEmcalParticle(TObject *particle, Int_t id = -1);
+  AliEmcalParticle(TObject *particle, Int_t id = -1, Double_t vx=0, Double_t vy=0, Double_t vz=0);
   ~AliEmcalParticle();
   AliEmcalParticle(const AliEmcalParticle &p); 
   AliEmcalParticle &operator=(const AliEmcalParticle &p);
 
+  Double_t          Eta()                  const { return fEta; }
+  Double_t          Phi()                  const { return fPhi; }
+  Double_t          Pt()                   const { return fPt ; }
+  Double_t          M()                    const { return 0.13957                                                   ; }
   Short_t           Charge()               const { if (fTrack) return fTrack->Charge(); else return 0               ; }
   Double_t          GetTrackPhiOnEMCal()   const { if (fTrack) return fTrack->GetTrackPhiOnEMCal(); else return -999; }
   Double_t          GetTrackEtaOnEMCal()   const { if (fTrack) return fTrack->GetTrackEtaOnEMCal(); else return -999; }
@@ -29,29 +31,33 @@ class AliEmcalParticle: public TObject {
   Bool_t            IsCluster()            const { return (Bool_t) fCluster != 0                                    ; }
   Bool_t            IsTrack()              const { return (Bool_t) fTrack   != 0                                    ; }
   Int_t             IdInCollection()       const { return fId                                                       ; }
-  Double_t          M()                    const { return 0.13957                                                   ; }
+  Bool_t            IsMC()                 const { if (fTrack) return (fTrack->GetLabel() == 100); 
+                                                   return (fCluster->Chi2() == 100); }
 
   Int_t             GetMatchedObjId(UShort_t i = 0)         const { return fNMatched > i ? fMatchedIds[i]  : -1 ; }
   Double_t          GetMatchedObjDistance(UShort_t i = 0)   const { return fNMatched > i ? fMatchedDist[i] : -1 ; }
   UShort_t          GetNumberOfMatchedObj()                 const { return fNMatched                            ; }
 
-  TLorentzVector   &GetLorentzVector(const Double_t *vertex = 0)  const;
-
   void              AddMatchedObj(Int_t id, Double_t d);
   void              ResetMatchedObjects();
   void              SetIdInCollection(Int_t id)          { fId = id                                                                      ; }
   void              SetMatchedObj(Int_t id, Double_t d)  { ResetMatchedObjects(); fMatchedIds[0] = id; fMatchedDist[0] = d; fNMatched = 1; }
 
  protected:
-  static const UShort_t fSizeMatched = 10;        //!size of matched clusters array
+  TLorentzVector   &GetLorentzVector(const Double_t *vertex = 0)  const;
+
+  static const UShort_t fSizeMatched = 99;        //!size of matched clusters array
 
   AliVTrack        *fTrack;                       //!track
   AliVCluster      *fCluster;                     //!cluster
   UShort_t          fMatchedIds[fSizeMatched];    //!ids of matched clusters, ordered from the closest to the farthest
   Double_t          fMatchedDist[fSizeMatched];   //!distances of matched clusters
   UShort_t          fNMatched;                    //!number of matched objects 
-  Int_t             fId;                          //!id in collection
+  Int_t             fId;                          //!id in original collection
+  Double_t          fPhi;                         //!phi
+  Double_t          fEta;                         //!eta
+  Double_t          fPt;                          //!pt
 
-  ClassDef(AliEmcalParticle, 1) // Emcal particle class
+  ClassDef(AliEmcalParticle, 2) // Emcal particle class
 };
 #endif