]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
vector area and compare fct.
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Jun 2012 07:53:08 +0000 (07:53 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Jun 2012 07:53:08 +0000 (07:53 +0000)
PWGGA/EMCALJetTasks/AliEmcalJet.cxx
PWGGA/EMCALJetTasks/AliEmcalJet.h

index 6c61f9ec17b465c7fe845628099b62a424fde3cb..d03acebc2448d3f17df429d9dd6f4d2f0dd88f18 100644 (file)
@@ -17,6 +17,8 @@ AliEmcalJet::AliEmcalJet() :
   fM(0), 
   fNEF(0),
   fArea(0),       
+  fAreaEta(0),       
+  fAreaPhi(0),       
   fAreaEmc(-1), 
   fAxisInEmcal(0), 
   fMaxCPt(0), 
@@ -29,7 +31,8 @@ AliEmcalJet::AliEmcalJet() :
   fClusterIDs(),
   fTrackIDs(),
   fMatched(2),
-  fPtSub(0)
+  fPtSub(0),
+  fPtVectSub(0)
 {
   // Constructor.
 
@@ -48,6 +51,8 @@ AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) :
   fM(0), 
   fNEF(0), 
   fArea(0), 
+  fAreaEta(0),       
+  fAreaPhi(0),       
   fAreaEmc(-1), 
   fAxisInEmcal(0),
   fMaxCPt(0), 
@@ -60,7 +65,8 @@ AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) :
   fClusterIDs(), 
   fTrackIDs(),
   fMatched(2),
-  fPtSub(0)
+  fPtSub(0),
+  fPtVectSub(0)
 {    
   // Constructor.
 
@@ -85,6 +91,8 @@ AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
   fM(m), 
   fNEF(0), 
   fArea(0), 
+  fAreaEta(0),       
+  fAreaPhi(0),       
   fAreaEmc(-1), 
   fAxisInEmcal(0),
   fMaxCPt(0), 
@@ -97,7 +105,8 @@ AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) :
   fClusterIDs(), 
   fTrackIDs(),
   fMatched(2),
-  fPtSub(0)
+  fPtSub(0),
+  fPtVectSub(0)
 {
   // Constructor.
 
@@ -119,6 +128,8 @@ AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
   fM(jet.fM), 
   fNEF(jet.fNEF), 
   fArea(jet.fArea), 
+  fAreaEta(jet.fAreaEta),       
+  fAreaPhi(jet.fAreaPhi),       
   fAreaEmc(jet.fAreaEmc), 
   fAxisInEmcal(jet.fAxisInEmcal),
   fMaxCPt(jet.fMaxCPt), 
@@ -131,7 +142,8 @@ AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) :
   fClusterIDs(jet.fClusterIDs), 
   fTrackIDs(jet.fTrackIDs),
   fMatched(jet.fMatched),
-  fPtSub(jet.fPtSub)
+  fPtSub(jet.fPtSub),
+  fPtVectSub(jet.fPtVectSub)
 {
   // Copy constructor.
 
@@ -154,6 +166,8 @@ AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
     fM                  = jet.fM; 
     fNEF                = jet.fNEF;
     fArea               = jet.fArea; 
+    fAreaEta            = jet.fAreaEta; 
+    fAreaPhi            = jet.fAreaPhi; 
     fAreaEmc            = jet.fAreaEmc; 
     fAxisInEmcal        = jet.fAxisInEmcal; 
     fMaxCPt             = jet.fMaxCPt; 
@@ -171,11 +185,24 @@ AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet)
     fClosestJetsDist[1] = jet.fClosestJetsDist[1]; 
     fMatched            = jet.fMatched;
     fPtSub              = jet.fPtSub;
+    fPtVectSub              = jet.fPtVectSub;
   }
 
   return *this;
 }
 
+Int_t AliEmcalJet::Compare(const TObject* obj) const
+{
+  //Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj.
+
+  const AliEmcalJet *jet = static_cast<const AliEmcalJet *>(obj);
+  if (!obj)
+    return 0;
+  if (Pt()>jet->Pt())
+    return -1;
+  return 1;
+}
+
 //__________________________________________________________________________________________________
 void AliEmcalJet::GetMom(TLorentzVector &vec) const
 {
@@ -193,6 +220,17 @@ void AliEmcalJet::Print(Option_t* /*option*/) const
   printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f\n", fPt, fEta, fPhi, fArea, fNEF);
 }
 
+//__________________________________________________________________________________________________
+Double_t AliEmcalJet::PtSubVect(Double_t rho) const
+{
+  // Return vectorial subtracted transverse momentum.
+
+  Double_t dx = Px() - rho * fArea * TMath::Cos(fAreaPhi);
+  Double_t dy = Py() - rho * fArea * TMath::Sin(fAreaPhi);
+  //Double_t dz = Pz() - rho * fArea * TMath::SinH(fAreaEta);
+  return TMath::Sqrt(dx*dx+dy*dy);
+}
+
 //__________________________________________________________________________________________________
 void AliEmcalJet::SortConstituents()
 {
index 14b83c658aa3901c3c4209d9bd71830f161c87b9..3b28459e3d4a499159f41f264cc2e094507f741d 100644 (file)
@@ -45,17 +45,23 @@ class AliEmcalJet : public AliVParticle
   void              Print(Option_t* option = "") const;
 
   Double_t          Area()                       const { return fArea;                     }
+  Double_t          AreaPt()                     const { return fArea;                     }
+  Double_t          AreaEta()                    const { return fAreaEta;                  }
+  Double_t          AreaPhi()                    const { return fAreaPhi;                  }
   Double_t          AreaEmc()                    const { return fAreaEmc;                  }
   Bool_t            AxisInEmcal()                const { return fAxisInEmcal;              }
-  UShort_t          GetNumberOfClusters()        const { return fClusterIDs.GetSize();     }
+  Int_t             Compare(const TObject* obj)  const;
+  AliEmcalJet*      ClosestJet()                 const { return fClosestJets[0];           }
+  Double_t          ClosestJetDistance()         const { return fClosestJetsDist[0];       }
   Short_t           ClusterAt(Int_t idx)         const { return fClusterIDs.At(idx);       }
   AliVCluster      *ClusterAt(Int_t idx, TClonesArray *ca)  const { if (!ca) return 0; return dynamic_cast<AliVCluster*>(ca->At(ClusterAt(idx))); }
+  UShort_t          GetNumberOfClusters()        const { return fClusterIDs.GetSize();     }
   UShort_t          GetNumberOfTracks()          const { return fTrackIDs.GetSize();       }
-  Short_t           TrackAt(Int_t idx)           const { return fTrackIDs.At(idx);         }
-  AliVParticle     *TrackAt(Int_t idx, TClonesArray *ta)   const { if (!ta) return 0; return dynamic_cast<AliVParticle*>(ta->At(TrackAt(idx))); } 
   Double_t          FracEmcalArea()              const { return fAreaEmc/fArea;            }
   Bool_t            IsInsideEmcal()              const { return (fAreaEmc/fArea>0.999);    }
   Bool_t            IsInEmcal()                  const { return (fAreaEmc>0);              }
+  Bool_t            IsMC()                       const { return (Bool_t)(MCPt() > 0);      }
+  Bool_t            IsSortable()                 const { return kTRUE;                     }
   Double_t          MaxNeutralPt()               const { return fMaxNPt;                   }
   Double_t          MaxChargedPt()               const { return fMaxCPt;                   }
   Double_t          NEF()                        const { return fNEF;                      }
@@ -64,11 +70,6 @@ class AliEmcalJet : public AliVParticle
   UShort_t          N()                          const { return Nch()+Nn();                }
   Int_t             NEmc()                       const { return fNEmc;                     }
   Double_t          MCPt()                       const { return fMCPt;                     }
-  Bool_t            IsMC()                       const { return (Bool_t)(MCPt() > 0);      }
-  AliEmcalJet*      ClosestJet()                 const { return fClosestJets[0];           }
-  Double_t          ClosestJetDistance()         const { return fClosestJetsDist[0];       }
-  AliEmcalJet*      SecondClosestJet()           const { return fClosestJets[1];           }
-  Double_t          SecondClosestJetDistance()   const { return fClosestJetsDist[1];       }
   AliEmcalJet*      MatchedJet()                 const { return fMatched < 2 ? fClosestJets[fMatched] : 0; }
   Double_t          MaxClusterPt()               const { return MaxNeutralPt();            }
   Double_t          MaxTrackPt()                 const { return MaxChargedPt();            }
@@ -76,12 +77,19 @@ class AliEmcalJet : public AliVParticle
   Double_t          PtEmc()                      const { return fPtEmc;                    }
   Double_t          PtSub()                      const { return fPtSub;                    }
   Double_t          PtSub(Double_t rho)          const { return fPt - fArea*rho;           }
+  Double_t          PtSubVect(Double_t rho)      const;
+  AliEmcalJet*      SecondClosestJet()           const { return fClosestJets[1];           }
+  Double_t          SecondClosestJetDistance()   const { return fClosestJetsDist[1];       }
+  Short_t           TrackAt(Int_t idx)           const { return fTrackIDs.At(idx);         }
+  AliVParticle     *TrackAt(Int_t idx, TClonesArray *ta)   const { if (!ta) return 0; return dynamic_cast<AliVParticle*>(ta->At(TrackAt(idx))); } 
 
   void              AddClusterAt(Int_t clus, Int_t idx){ fClusterIDs.AddAt(clus, idx);     }
   void              AddTrackAt(Int_t track, Int_t idx) { fTrackIDs.AddAt(track, idx);      }
   void              Clear(Option_t */*option*/="")     { fClusterIDs.Set(0); fTrackIDs.Set(0); fClosestJets[0] = 0; fClosestJets[1] = 0; 
                                                          fClosestJetsDist[0] = 0; fClosestJetsDist[1] = 0; fMatched = 0; fPtSub = 0; }
   void              SetArea(Double_t a)                { fArea    = a;                     }
+  void              SetAreaEta(Double_t a)             { fAreaEta = a;                     }
+  void              SetAreaPhi(Double_t a)             { fAreaPhi = a;                     }
   void              SetAreaEmc(Double_t a)             { fAreaEmc = a;                     }
   void              SetAxisInEmcal(Bool_t b)           { fAxisInEmcal = b;                 }
   void              SetMaxNeutralPt(Double32_t t)      { fMaxNPt  = t;                     }
@@ -95,11 +103,12 @@ class AliEmcalJet : public AliVParticle
   void              SortConstituents();
   void              SetClosestJet(AliEmcalJet *j, Double_t d)       { fClosestJets[0] = j; fClosestJetsDist[0] = d; }
   void              SetSecondClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[1] = j; fClosestJetsDist[1] = d; }
-  void              SetMatchedToClosest()                           { fMatched = 0;        }
-  void              SetMatchedToSecondClosest()                     { fMatched = 1;        }
-  void              SetNEmc(Int_t n)                                { fNEmc    = n;        }
-  void              SetPtEmc(Double_t pt)                           { fPtEmc   = pt;       }
-  void              SetPtSub(Double_t ps)                           { fPtSub   = ps;       } 
+  void              SetMatchedToClosest()                           { fMatched   = 0;      }
+  void              SetMatchedToSecondClosest()                     { fMatched   = 1;      }
+  void              SetNEmc(Int_t n)                                { fNEmc      = n;      }
+  void              SetPtEmc(Double_t pt)                           { fPtEmc     = pt;     }
+  void              SetPtSub(Double_t ps)                           { fPtSub     = ps;     } 
+  void              SetPtSubVect(Double_t ps)                       { fPtVectSub = ps;     } 
 
  protected:
   Double32_t        fPt;                  //[0,0,12]   pt 
@@ -108,6 +117,8 @@ class AliEmcalJet : public AliVParticle
   Double32_t        fM;                   //[0,0,8]    mass
   Double32_t        fNEF;                 //[0,1,8]    neutral energy fraction
   Double32_t        fArea;                //[0,0,12]   area
+  Double32_t        fAreaEta;             //[0,0,12]   area eta
+  Double32_t        fAreaPhi;             //[0,0,12]   area phi
   Double32_t        fAreaEmc;             //[0,0,12]   area on EMCAL surface (determined from ghosts)
   Bool_t            fAxisInEmcal;         //           =true if jet axis inside EMCAL acceptance
   Double32_t        fMaxCPt;              //[0,0,12]   pt of maximum charged constituent
@@ -123,7 +134,8 @@ class AliEmcalJet : public AliVParticle
   Double32_t        fClosestJetsDist[2];  //!          distance to closest jets (see above)
   UShort_t          fMatched;             //!          0,1 if it is matched with one of the closest jets; 2 if it is not matched
   Double_t          fPtSub;               //!          background subtracted pt (not stored set from outside) 
+  Double_t          fPtVectSub;           //!          background vector subtracted pt (not stored set from outside) 
 
-  ClassDef(AliEmcalJet,7) // Emcal jet class in cylindrical coordinates
+  ClassDef(AliEmcalJet,8) // Emcal jet class in cylindrical coordinates
 };
 #endif