]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/RESONANCES/AliRsnValue.h
Missing macro commented out
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnValue.h
index 3a21acdcaae2dff5f8de49e6a500f75fa0a90db0..7d9bb353c3040aeff83b73cbcc4b6d870d06379c 100644 (file)
 //
 // Class AliRsnValue
 //
-// Definition of a single value which can be computed
-// from any of the defined input objects implemented
-// in the resonance package.
+// This class implements all the computations which could be useful
+// during the analysis, both for cuts and for output histograms.
+// 
+// It inherits from the AliRsnTarget base class since it can operate
+// on tracks, pairs and events, and the kind of expected object to
+// be processed depends on the kind of requested computation.
+//
+// Since this class is used to produce the outputs, it contains the
+// facilities to define a binning in an output histogram.
 //
 
 #ifndef ALIRSNVALUE_H
 #define ALIRSNVALUE_H
 
-#include "TNamed.h"
 #include "TArrayD.h"
+#include "AliRsnTarget.h"
 
-class AliRsnPairDef;
-class AliRsnMother;
-
-class AliRsnValue : public TNamed
+class AliRsnValue : public AliRsnTarget
 {
   public:
-
+  
+    // this enumeration lists all available computations
+    // any user feedback proposing new ones is welcome
     enum EValueType
     {
-      kTrack1P,
-      kTrack2P,
-      kTrack1Pt,
-      kTrack2Pt,
-      kTrack1Px,
-      kTrack1Py,
-      kTrack1Pz,
-      kTrack2Px,
-      kTrack2Py,
-      kTrack2Pz,
-      kPairInvMass,
-      kPairInvMassMC,
-      kPairInvMassRes,
-      kPairPt,
-      kPairEta,
-      kPairMt,
-      kPairY,
-      kPairCosThetaStar,
-      kPairCosThetaStar1,
-      kPairCosThetaStar2,
-      kPairCosThetaStarMC1,
-      kPairCosThetaStarMC2,
-      kAngleToLeading,
-      kLeadingPt,
-      kQInv,
-      kEventMult,
-      kValueTypes
+      kTrackP,             // single track total momentum
+      kTrackPt,            // single track transverse momentum
+      kTrackEta,           // single track pseudo-rapidity
+      kPairP1,             // total momentum of 1st daughter of a pair
+      kPairP2,             // total momentum of 2nd daughter of a pair
+      kPairP1t,            // total momentum of 1st daughter of a pair
+      kPairP2t,            // total momentum of 2nd daughter of a pair
+      kPairP1z,            // total momentum of 1st daughter of a pair
+      kPairP2z,            // total momentum of 2nd daughter of a pair
+      kPairInvMass,        // pair invariant mass (with reconstructed momenta)
+      kPairInvMassMC,      // pair invariant mass (with MC momenta)
+      kPairInvMassRes,     // pair invariant mass resolution
+      kPairPt,             // pair transverse momentum
+      kPairPz,             // pair longitudinal momentum
+      kPairEta,            // pair pseudo-rapidity
+      kPairMt,             // pair transverse mass (need a reference mass)
+      kPairY,              // pair rapidity (need a reference mass)
+      kPairPhi,            // pair azimuthal angle (with reconstructed momenta)
+      kPairPhiMC,          // pair azimuthal angle (with MC momenta)
+      kPairPtRatio,        // ratio |pt1 - pt2|/(pt1 + pt2) of daughter transverse momenta
+      kPairDipAngle,       // inverse cosine of the angle between daughter vector momenta
+      kPairCosThetaStar,   // polarization angle
+      kPairQInv,           // invariant relative momentum of the two daughters
+      kPairAngleToLeading, // angle between the pair momentum and that of the event leading particle
+      kEventLeadingPt,     // transverse momentum of the event leading particle
+      kEventMult,          // multiplicity computed as the number of tracks
+      kEventMultESDCuts,   // multiplicity computed as the number of track passing an ESD quality cut (need this cut defined)
+      kEventVz,            // Z position of event primary vertex
+      
+      kValueTypes          // last value is used to have a meaningless enum value for initializations
     };
 
     AliRsnValue();
-    AliRsnValue(const char *name, EValueType type, Int_t n = 0, Double_t min = 0.0, Double_t max = 0.0);
+    AliRsnValue(const char *name, EValueType type, Int_t nbins = 0, Double_t min = 0.0, Double_t max = 0.0);
     AliRsnValue(const char *name, EValueType type, Double_t min, Double_t max, Double_t step);
-    AliRsnValue(const char *name, EValueType type, Int_t n, Double_t *array);
-    AliRsnValue(const AliRsnValue& copy) : TNamed(copy),fValue(copy.fValue),fType(copy.fType),fArray(copy.fArray) {}
-    AliRsnValue& operator=(const AliRsnValue& copy) {SetName(copy.GetName());fType=copy.fType;fValue=copy.fValue;fArray=copy.fArray;return (*this);}
-    virtual ~AliRsnValue() { }
+    AliRsnValue(const char *name, EValueType type, Int_t nbins, Double_t *array);
+    AliRsnValue(const AliRsnValue& copy);
+    AliRsnValue& operator=(const AliRsnValue& copy);
+    virtual ~AliRsnValue() { /*does nothing, since pointers are not owned by this object*/ }
+    
+    TArrayD     GetArray() const               {return fBinArray;}
+    Double_t    GetComputedValue() const       {return fComputedValue;}
+    EValueType  GetValueType() const           {return fValueType;}
+    const char* GetValueTypeName() const;
+    TObject*    GetSupportObject()             {return fSupportObject;}
+    void        SetSupportObject(TObject *obj) {fSupportObject = obj;}
+    void        SetValueType(EValueType type)  {fValueType = type;}
+    void        AssignTarget();
     
-    TArrayD     GetArray() const {return fArray;}
-    Double_t    GetValue() const {return fValue;}
-    EValueType  GetValueType() {return fType;}
-
-    void        SetValueType(EValueType type) {fType = type;}
     void        SetBins(Int_t n, Double_t min, Double_t max);
-    void        SetBins(Double_t min, Double_t max, Double_t step);
     void        SetBins(Int_t n, Double_t *array);
-    void        Set(EValueType type, Int_t n = 0, Double_t min = 0.0, Double_t max = 0.0) {fType = type; SetBins(n, min, max);}
-    void        Set(EValueType type, Double_t min, Double_t max, Double_t step) {fType = type; SetBins(min, max, step);}
-    void        Set(EValueType type, Int_t n, Double_t *array) {fType = type; SetBins(n, array);}
+    void        SetBins(Double_t min, Double_t max, Double_t step);
+    
+    void        Set(EValueType type, Int_t n, Double_t min, Double_t max)       {fValueType = type; AssignTarget(); SetBins(n, min, max);}
+    void        Set(EValueType type, Int_t n, Double_t *array)                  {fValueType = type; AssignTarget(); SetBins(n, array);}
+    void        Set(EValueType type, Double_t min, Double_t max, Double_t step) {fValueType = type; AssignTarget(); SetBins(min, max, step);}
     
-    virtual Bool_t  Eval(AliRsnMother * const mother, AliRsnPairDef * const pairDef, AliRsnEvent * const event);
-    virtual Bool_t  Eval(AliRsnDaughter * const daughter, AliRsnEvent * const event);
+    
+    virtual Bool_t  Eval(TObject *object, Bool_t useMC = kFALSE);
     virtual void    Print(Option_t *option = "") const;
 
   protected:
   
-    Double_t   fValue;   // computed value
-  
-  private:
-
-    EValueType fType;    // value type
-    TArrayD    fArray;   // array of bins (when necessary)
+    Double_t        fComputedValue;  // computed value
+    EValueType      fValueType;      // value type
+    TArrayD         fBinArray;       // array of bins (when used for a histogram axis)
+    TObject        *fSupportObject;  // support object needed for computing some of the values
     
     // ROOT dictionary
-    ClassDef(AliRsnValue, 1)
+    ClassDef(AliRsnValue, 2)
 };
 
 #endif