Few basic event cuts developed, coding conventions corrected
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2004 16:31:52 +0000 (16:31 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2004 16:31:52 +0000 (16:31 +0000)
ANALYSIS/AliAODPairCut.cxx
ANALYSIS/AliAODPairCut.h
ANALYSIS/AliAODParticleCut.cxx
ANALYSIS/AliAODParticleCut.h
ANALYSIS/AliEventBaseCut.cxx
ANALYSIS/AliEventBaseCut.h
ANALYSIS/AliEventCut.cxx
ANALYSIS/AliEventCut.h

index 44b63629ef31f930c38a1439733561f859792c31..4bc41ba5f6041d690f59703fdb8c9945f5bf3ffa 100644 (file)
@@ -286,7 +286,7 @@ void AliAODPairCut::SetClusterOverlapRange(Double_t min,Double_t max)
 }
 /**********************************************************/
 
-AliAODPairBaseCut* AliAODPairCut::FindCut(AliAODPairCutProperty property)
+AliAODPairBaseCut* AliAODPairCut::FindCut(EAODPairCutProperty property)
 {
   // Find the cut corresponding to "property"
   for (Int_t i = 0;i<fNCuts;i++)
index 0a83057840bfef379c00b903c08af1ef4e79b19b..059758835cc33179b5abc580f2b41b78cbd10fc6 100644 (file)
@@ -14,7 +14,7 @@
 class AliAODParticleCut;
 class AliAODPairBaseCut;
 
-enum AliAODPairCutProperty
+enum EAODPairCutProperty
 {
   kHbtPairCutPropQInv, //Q invariant
   kHbtPairCutPropKt,
@@ -76,7 +76,7 @@ class AliAODPairCut: public TNamed
   Int_t fNCuts;//Number of cuts in fCuts array
   
   
-  AliAODPairBaseCut* FindCut(AliAODPairCutProperty cut);
+  AliAODPairBaseCut* FindCut(EAODPairCutProperty cut);
  private:
   static const Int_t fgkMaxCuts; // Max number of cuts
   ClassDef(AliAODPairCut,2)
@@ -113,7 +113,7 @@ class AliAODPairBaseCut: public TObject
    
  public:
      
-  AliAODPairBaseCut(Double_t min = 0.0, Double_t max = 0.0, AliAODPairCutProperty prop= kHbtPairCutPropNone):
+  AliAODPairBaseCut(Double_t min = 0.0, Double_t max = 0.0, EAODPairCutProperty prop= kHbtPairCutPropNone):
     fMin(min),fMax(max),fProperty(prop){}
   
   virtual   ~AliAODPairBaseCut(){}
@@ -128,7 +128,7 @@ class AliAODPairBaseCut: public TObject
   Double_t  GetMinimum() const {return fMin;}
   Double_t  GetMaximum() const {return fMax;}
   
-  AliAODPairCutProperty GetProperty() const {return fProperty;}
+  EAODPairCutProperty GetProperty() const {return fProperty;}
   
  protected:
   virtual Double_t  GetValue(AliAODPair* pair) const = 0;
@@ -136,7 +136,7 @@ class AliAODPairBaseCut: public TObject
   Double_t fMin; // Lower boundary of the range
   Double_t fMax; // Upper boundary of the range
   
-  AliAODPairCutProperty fProperty; // The property itself
+  EAODPairCutProperty fProperty; // The property itself
   
   ClassDef(AliAODPairBaseCut,1)
  
index 24c3fa14ddb2e2e28fa6a56ce7b90b56ac670c38..4537c689dcc17f024edd88b08df5a992d8322691 100644 (file)
@@ -120,7 +120,7 @@ void AliAODParticleCut::AddBasePartCut(AliAODParticleBaseCut* basecut)
 }
 
 /******************************************************************/
-AliAODParticleBaseCut* AliAODParticleCut::FindCut(AliAODCutProperty property)
+AliAODParticleBaseCut* AliAODParticleCut::FindCut(EAODCutProperty property)
 {
  //returns pointer to the cut checking the given property
  for (Int_t i = 0;i<fNCuts;i++)
index 615293bdd351c96ee2bf6c6be7633051135f7c71..d28a59319cb41606234779f4e37e68ff559c6a43 100644 (file)
@@ -36,7 +36,7 @@ class AliAODParticleBaseCut;
 /******************************************************************/
 /******************************************************************/
 
-enum AliAODCutProperty
+enum EAODCutProperty
  {
 //codes particle property
   kAODP,  //Momentum
@@ -96,7 +96,7 @@ class AliAODParticleCut: public TObject
     void Print(void) const;
   protected:
      
-    AliAODParticleBaseCut* FindCut(AliAODCutProperty property);
+    AliAODParticleBaseCut* FindCut(EAODCutProperty property);
 
     AliAODParticleBaseCut ** fCuts;//! Array with cuts
     Int_t fNCuts; //number of base cuts stored in fCuts
@@ -138,7 +138,7 @@ class AliAODParticleBaseCut: public TObject
    
    public:
      
-     AliAODParticleBaseCut(Double_t min = 0.0, Double_t max = 0.0,AliAODCutProperty prop = kAODNone):
+     AliAODParticleBaseCut(Double_t min = 0.0, Double_t max = 0.0,EAODCutProperty prop = kAODNone):
                    fProperty(prop),fMin(min),fMax(max){}
 
      virtual           ~AliAODParticleBaseCut(){}
@@ -153,13 +153,13 @@ class AliAODParticleBaseCut: public TObject
      Double_t          GetMinimum() const {return fMin;}
      Double_t          GetMaximum() const {return fMax;}
      
-     AliAODCutProperty GetProperty() const {return fProperty;}
+     EAODCutProperty GetProperty() const {return fProperty;}
      virtual void Print(void) const;
      
    protected:
      virtual Double_t  GetValue(AliVAODParticle *) const = 0;
 
-     AliAODCutProperty fProperty; //property that this cut describes
+     EAODCutProperty fProperty; //property that this cut describes
      Double_t fMin;//minimum value
      Double_t fMax;//maximum value
      
index 07d0caa4a7d74e485f1dda3e754c03aeffdba69d..d209305bc05dd370f347f8bee5e699411ad183a4 100644 (file)
@@ -14,15 +14,17 @@ ClassImp(AliEventBaseCut)
 
 AliEventBaseCut::AliEventBaseCut():
  fMin(0.0),
- fMax(0.0)
+ fMax(0.0),
+ fProperty(kNone)
 {
 //ctor  
 }
 /**********************************************************/
 
-AliEventBaseCut::AliEventBaseCut(Double_t min, Double_t max):
+AliEventBaseCut::AliEventBaseCut(Double_t min, Double_t max, EEventCutProperty prop):
  fMin(min),
- fMax(max)
+ fMax(max),
+ fProperty(prop)
 {
  //ctor
 }
index df1f9b7c53ce3f7b2feaf302283c582cb86b9cd4..c50d19fbd1961aa4f01651ec8e5b4bff1ff30954 100644 (file)
 
 class AliAOD;
 
-enum AliEventCutProperty
+enum EEventCutProperty
  {
    kPrimVertexXCut,
    kPrimVertexYCut,
    kPrimVertexZCut,
-   kNChargedCut
+   kNChargedCut,
+   kNone
  };
 
 class AliEventBaseCut: public TObject
 {
   public: 
     AliEventBaseCut();
-    AliEventBaseCut(Double_t min,Double_t max);
+    AliEventBaseCut(Double_t min,Double_t max, EEventCutProperty prop = kNone);
     virtual ~AliEventBaseCut(){}
-    
     virtual Bool_t Pass(AliAOD* aod) const;//returns kTRUE if rejected
+    virtual void   SetRange(Double_t min, Double_t max){fMin = min; fMax = max;}
+
+    virtual EEventCutProperty GetProperty()const{return fProperty;}
+
   protected:
     virtual Double_t GetValue(AliAOD* aod) const = 0;
     
     Double_t fMin;//Minimum value
     Double_t fMax;//Maximum value
+    EEventCutProperty fProperty;//Defines the type of the cut - used by the setters cut
+    
   private:
     ClassDef(AliEventBaseCut,1)
 };
@@ -45,8 +51,8 @@ class AliEventBaseCut: public TObject
 class AliPrimVertexXCut: public AliEventBaseCut
 {
  public: 
-   AliPrimVertexXCut(){}
-   AliPrimVertexXCut(Double_t min,Double_t max):AliEventBaseCut(min,max){}
+   AliPrimVertexXCut():AliEventBaseCut(0,0,kPrimVertexXCut){}
+   AliPrimVertexXCut(Double_t min,Double_t max):AliEventBaseCut(min,max,kPrimVertexXCut){}
    virtual ~AliPrimVertexXCut(){}
  protected:
    Double_t GetValue(AliAOD* aod) const;
@@ -59,8 +65,8 @@ class AliPrimVertexXCut: public AliEventBaseCut
 class AliPrimVertexYCut: public AliEventBaseCut
 {
  public: 
-   AliPrimVertexYCut(){}
-   AliPrimVertexYCut(Double_t min,Double_t max):AliEventBaseCut(min,max){}
+   AliPrimVertexYCut():AliEventBaseCut(0,0,kPrimVertexYCut){}
+   AliPrimVertexYCut(Double_t min,Double_t max):AliEventBaseCut(min,max,kPrimVertexYCut){}
    virtual ~AliPrimVertexYCut(){}
    
  protected:
@@ -74,8 +80,8 @@ class AliPrimVertexYCut: public AliEventBaseCut
 class AliPrimVertexZCut: public AliEventBaseCut
 {
  public: 
-   AliPrimVertexZCut(){}
-   AliPrimVertexZCut(Double_t min,Double_t max):AliEventBaseCut(min,max){}
+   AliPrimVertexZCut():AliEventBaseCut(0,0,kPrimVertexZCut){}
+   AliPrimVertexZCut(Double_t min,Double_t max):AliEventBaseCut(min,max,kPrimVertexZCut){}
    virtual ~AliPrimVertexZCut(){}
  protected:
    Double_t GetValue(AliAOD* aod) const;
@@ -90,10 +96,12 @@ class AliPrimVertexZCut: public AliEventBaseCut
 class AliNChargedCut: public AliEventBaseCut
 {
  public: 
-   AliNChargedCut(){}
+   AliNChargedCut():AliEventBaseCut(0,0,kNChargedCut){}
    AliNChargedCut(Double_t min, Double_t max, Double_t etamin = -10.0, Double_t etamax = 10.0):
-       AliEventBaseCut(min,max),fEtaMin(etamin),fEtaMax(etamax){}
+       AliEventBaseCut(min,max,kNChargedCut),fEtaMin(etamin),fEtaMax(etamax){}
    virtual ~AliNChargedCut(){}
+   
+   void     SetEtaRange(Double_t min,Double_t max){fEtaMin = min;fEtaMax = max;}
  protected:
    Double_t GetValue(AliAOD* aod) const;
    Double_t fEtaMin;//Defines max of eta range where mult is caclulated
index ec20b6adc10d7274d3a74771406c65b97d0a66b5..9124460c5a245db4fd129a7b23dac8e025496bcb 100644 (file)
@@ -57,6 +57,56 @@ Bool_t AliEventCut::Pass(AliAOD* aod) const
    }
   return kFALSE;
 }
+/*********************************************************/
+void AliEventCut::AddBasePartCut(AliEventBaseCut* ebcut)
+{
+//Adds a base cut
+ if (ebcut == 0x0)
+  {
+    Error("AddBasePartCut","Pointer to base cut is NULL");
+    return;
+  }
+ if (ebcut->GetProperty() != kNone)
+  {
+    if (FindCut(ebcut->GetProperty()))
+     {
+       Warning("AddBasePartCut","Cut with this property is already in the list of base cuts");
+     }
+  }  
+  
+ fBaseCuts.Add(ebcut->Clone());
+}
+/*********************************************************/
+
+AliEventBaseCut* AliEventCut::FindCut(EEventCutProperty prop)
+{
+//Finds and returns pointer to the cut with given property
+ Int_t n = fBaseCuts.GetEntries();
+ for (Int_t i = 0; i<n; i++)
+  {
+    AliEventBaseCut* bcut = (AliEventBaseCut*)fBaseCuts.At(i);
+    if (bcut->GetProperty() == prop)
+       return bcut; //we found the cut we were searching for
+  }
+
+ return 0x0; //we did not found this cut
+
+}
+/*********************************************************/
+
+void AliEventCut::SetNChargedRange(Int_t min,Int_t max,Double_t etamin,Double_t etamax)
+{
+ //Sets renge of number of charged particles
+  AliNChargedCut* cut = dynamic_cast<AliNChargedCut*>(FindCut(kNChargedCut));
+  if(cut) 
+   { 
+     cut->SetRange(min,max);
+     cut->SetEtaRange(etamin,etamax);
+   }  
+  else fBaseCuts.Add(new AliNChargedCut(min,max,etamin,etamax));
+}
 
 /*********************************************************/
 /*********************************************************/
index b14131499f47b59576370d58a74f07720d5905f5..58518bb8681b6802d66ff589cd5a07612abd3ad2 100644 (file)
@@ -17,6 +17,7 @@
 #include "AliEventBaseCut.h"
 
 class AliAOD;
+enum EEventCutProperty;
 
 class AliEventCut: public TObject
 {
@@ -26,9 +27,13 @@ class AliEventCut: public TObject
     virtual ~AliEventCut();
     
     virtual Bool_t Pass(AliAOD* aod) const;//returns kTRUE if rejected
-    void AddBasePartCut(AliEventBaseCut* ebcut){fBaseCuts.Add(ebcut);}
+    void           AddBasePartCut(AliEventBaseCut* ebcut);
+
+    void           SetNChargedRange(Int_t min,Int_t max, Double_t etamin = -10.0,Double_t etamax = 10.0);
     
   protected:
+    AliEventBaseCut* FindCut(EEventCutProperty prop);
+    
     TObjArray fBaseCuts;
   private:
     ClassDef(AliEventCut,1)