Base Particle Cuts moved to the separate file. Property eneum defined namespace of...
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Jul 2004 12:34:27 +0000 (12:34 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Jul 2004 12:34:27 +0000 (12:34 +0000)
ANALYSIS/AliAODParticleBaseCut.cxx [new file with mode: 0644]
ANALYSIS/AliAODParticleBaseCut.h [new file with mode: 0644]
ANALYSIS/AliAODParticleCut.cxx
ANALYSIS/AliAODParticleCut.h
ANALYSIS/libANALYSIS.pkg

diff --git a/ANALYSIS/AliAODParticleBaseCut.cxx b/ANALYSIS/AliAODParticleBaseCut.cxx
new file mode 100644 (file)
index 0000000..f1bfb7a
--- /dev/null
@@ -0,0 +1,171 @@
+#include "AliAODParticleBaseCut.h"
+
+
+
+#include <Riostream.h>
+
+ClassImp(AliAODParticleBaseCut)
+void AliAODParticleBaseCut::Print(void) const
+{
+  // prints the information anout the base cut to stdout
+  cout<<"fMin="<<fMin <<", fMax=" <<fMax<<"    ";
+  PrintProperty();
+}
+/******************************************************************/
+
+void AliAODParticleBaseCut::PrintProperty(void) const
+{
+ //prints the property name 
+ switch (fProperty)
+  {
+   case  kAODP: 
+     cout<<"kAODP"; break;
+   case  kAODPt: 
+     cout<<"kAODPt"; break;
+   case  kAODE: 
+     cout<<"kAODE"; break;
+   case  kAODRapidity: 
+     cout<<"kAODRapidity"; break;
+   case  kAODPseudoRapidity: 
+     cout<<"kAODPseudoRapidity"; break;
+   case  kAODPx: 
+     cout<<"kAODPx"; break;
+   case  kAODPy: 
+     cout<<"kAODPy"; break;
+   case  kAODPz: 
+     cout<<"kAODPz"; break;   
+   case  kAODPhi: 
+     cout<<"kAODPhi"; break;
+   case  kAODTheta: 
+     cout<<"kAODTheta"; break;
+   case  kAODVx: 
+     cout<<"kAODVx"; break;
+   case  kAODVy: 
+     cout<<"kAODVy"; break;
+   case  kAODVz: 
+     cout<<"kAODVz"; break;
+   case  kAODPid: 
+     cout<<"kAODPid"; break;
+   case  kAODNone: 
+     cout<<"kAODNone"; break;
+   default: 
+     cout<<"Property Not Found";
+  }
+ cout<<endl;
+}
+ClassImp( AliAODMomentumCut )
+
+ClassImp( AliAODPtCut )
+ClassImp( AliAODEnergyCut )
+ClassImp( AliAODRapidityCut )
+ClassImp( AliAODPseudoRapidityCut )
+ClassImp( AliAODPxCut )
+ClassImp( AliAODPyCut )
+ClassImp( AliAODPzCut )
+ClassImp( AliAODPhiCut )
+ClassImp( AliAODThetaCut )
+ClassImp( AliAODVxCut )
+ClassImp( AliAODVyCut )
+ClassImp( AliAODVzCut )
+
+ClassImp( AliAODPIDCut )
+
+void AliAODPIDCut::Print(void) const
+{
+  cout<<"PID "<<fPID<<" ";
+  AliAODParticleBaseCut::Print();
+}
+
+ClassImp( AliAODLogicalOperCut )
+
+AliAODLogicalOperCut::AliAODLogicalOperCut():
+ AliAODParticleBaseCut(-10e10,10e10,kAODNone),
+ fFirst(new AliAODDummyBaseCut),
+ fSecond(new AliAODDummyBaseCut)
+{
+ //ctor
+}
+/******************************************************************/
+
+AliAODLogicalOperCut::AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):
+ AliAODParticleBaseCut(-10e10,10e10,kAODNone),
+ fFirst((first)?(AliAODParticleBaseCut*)first->Clone():0x0),
+ fSecond((second)?(AliAODParticleBaseCut*)second->Clone():0x0)
+{
+  //ctor
+  if ( (fFirst && fSecond) == kFALSE) 
+   {
+     Fatal("AliAODLogicalOperCut","One of parameters is NULL!");
+   }
+}
+/******************************************************************/
+
+AliAODLogicalOperCut::~AliAODLogicalOperCut()
+{
+  //destructor
+  delete fFirst;
+  delete fSecond;
+}
+/******************************************************************/
+
+Bool_t AliAODLogicalOperCut::AliAODDummyBaseCut::Rejected(AliVAODParticle* /*part*/)  const
+{
+  //checks if particles passes properties defined by this cut
+  Warning("Pass","You are using dummy base cut! Probobly some logical cut is not set up properly");
+  return kFALSE;//accept
+}
+/******************************************************************/
+
+void AliAODLogicalOperCut::Streamer(TBuffer &b)
+{
+  // Stream all objects in the array to or from the I/O buffer.
+  UInt_t R__s, R__c;
+  if (b.IsReading()) 
+   {
+     delete fFirst;
+     delete fSecond;
+     fFirst  = 0x0;
+     fSecond = 0x0;
+
+     b.ReadVersion(&R__s, &R__c);
+     TObject::Streamer(b);
+     b >> fFirst;
+     b >> fSecond;
+     b.CheckByteCount(R__s, R__c,AliAODLogicalOperCut::IsA());
+   } 
+  else 
+   {
+     R__c = b.WriteVersion(AliAODLogicalOperCut::IsA(), kTRUE);
+     TObject::Streamer(b);
+     b << fFirst;
+     b << fSecond;
+     b.SetByteCount(R__c, kTRUE);
+  }
+}
+
+/******************************************************************/
+ClassImp(AliAODOrCut)
+
+Bool_t AliAODOrCut::Rejected(AliVAODParticle * p) const
+{
+  //returns true when rejected 
+  //AND operation is a little bit misleading but is correct
+  //User wants to build logical cuts with natural (positive) logic
+  //while AODAN use inernally reverse (returns true when rejected)
+  if (fFirst->Rejected(p) && fSecond->Rejected(p)) return kTRUE;//rejected (both rejected, returned kTRUE)
+  return kFALSE;//accepted, at least one accepted (returned kFALSE)
+}
+/******************************************************************/
+
+ClassImp(AliAODAndCut)
+
+Bool_t AliAODAndCut::Rejected(AliVAODParticle * p)  const
+{
+  //returns true when rejected 
+  //OR operation is a little bit misleading but is correct
+  //User wants to build logical cuts with natural (positive) logic
+  //while AODAN use inernally reverse (returns true when rejected)
+  if (fFirst->Rejected(p) || fSecond->Rejected(p)) return kTRUE;//rejected (any of two rejected(returned kTRUE) )
+  return kFALSE;//accepted (both accepted (returned kFALSE))
+}
+/******************************************************************/
diff --git a/ANALYSIS/AliAODParticleBaseCut.h b/ANALYSIS/AliAODParticleBaseCut.h
new file mode 100644 (file)
index 0000000..68ad072
--- /dev/null
@@ -0,0 +1,286 @@
+#ifndef ALIAODPARTICLEBASECUT_H
+#define ALIAODPARTICLEBASECUT_H
+
+#include <TObject.h>
+#include "AliVAODParticle.h"
+
+
+class AliAODParticleBaseCut: public TObject
+ {
+   //This class defines the range of some property - pure virtual
+   //Property is coded by AliAODCutTypes type
+   
+   public:
+
+     enum EAODCutProperty
+      {
+     //codes of particle properties
+       kAODP,  //Momentum
+       kAODPt, //Transverse momentum
+       kAODE,  //Energy
+       kAODRapidity, //
+       kAODPseudoRapidity,
+       kAODPx, //X coAnddinate of the momentum
+       kAODPy, //Y coAnddinate of the momentum
+       kAODPz, //Z coAnddinate of the momentum
+       kAODPhi,//angle
+       kAODTheta,//angle
+       kAODVx,  // vertex X coAnddinate
+       kAODVy,  // vertex Y coAnddinate
+       kAODVz,  // vertex Z coAnddinate
+       kAODPid, // vertex Z coAnddinate
+     //_____________________________
+       kAODNone
+      };
+
+     
+     AliAODParticleBaseCut(Double_t min = 0.0, Double_t max = 0.0,EAODCutProperty prop = kAODNone):
+                   fProperty(prop),fMin(min),fMax(max){}
+
+     virtual           ~AliAODParticleBaseCut(){}
+     
+     virtual Bool_t    Rejected(AliVAODParticle *p) const;
+     
+     void              SetRange(Double_t min, Double_t max){fMin = min; fMax = max;}
+
+     void              SetMinimum(Double_t min){fMin = min;}
+     void              SetMaximum(Double_t max){fMax = max;}
+     
+     Double_t          GetMinimum() const {return fMin;}
+     Double_t          GetMaximum() const {return fMax;}
+     
+     EAODCutProperty   GetProperty() const {return fProperty;}
+     virtual void Print(void) const;
+     
+   protected:
+     virtual Double_t  GetValue(AliVAODParticle *) const = 0;
+
+     EAODCutProperty fProperty; //property that this cut describes
+     Double_t fMin;//minimum value
+     Double_t fMax;//maximum value
+     
+   private:
+     void PrintProperty(void) const;
+     ClassDef(AliAODParticleBaseCut,1)
+   
+ };
+
+inline Bool_t
+AliAODParticleBaseCut::Rejected(AliVAODParticle *p) const
+{
+  //cjecks if particle property fits in range
+  if ( (GetValue(p) < fMin) || (GetValue(p) > fMax ) ) return kTRUE; //rejected
+  else return kFALSE; //accepted
+}
+/******************************************************************/
+/******************************************************************/
+/******************************************************************/
+
+class AliAODMomentumCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODMomentumCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODP){}
+    virtual ~AliAODMomentumCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->P();}
+    ClassDef(AliAODMomentumCut,1)
+ };
+
+class AliAODPtCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODPtCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPt){}
+    virtual ~AliAODPtCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Pt();}
+    ClassDef(AliAODPtCut,1)
+ };
+
+
+class AliAODEnergyCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODEnergyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODE){}
+    virtual ~AliAODEnergyCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const {return p->E();}
+    ClassDef(AliAODEnergyCut,1)
+ };
+
+class AliAODRapidityCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODRapidity){}
+    virtual ~AliAODRapidityCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Y();}
+    ClassDef(AliAODRapidityCut,1)
+ };
+
+class AliAODPseudoRapidityCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODPseudoRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPseudoRapidity){}
+    virtual ~AliAODPseudoRapidityCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Eta();}
+    ClassDef(AliAODPseudoRapidityCut,1)
+ };
+
+class AliAODPxCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODPxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPx){}
+    virtual ~AliAODPxCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Px();}
+    ClassDef(AliAODPxCut,1)
+ };
+
+class AliAODPyCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODPyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPy){}
+    virtual ~AliAODPyCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Py();}
+    ClassDef(AliAODPyCut,1)
+ };
+
+
+class AliAODPzCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODPzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPz){}
+    virtual ~AliAODPzCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Pz();}
+    ClassDef(AliAODPzCut,1)
+ };
+
+class AliAODPhiCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODPhiCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPhi){}
+    virtual ~AliAODPhiCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Phi();}
+    ClassDef(AliAODPhiCut,1)
+  
+ };
+
+class AliAODThetaCut: public AliAODParticleBaseCut
+ {
+  public: 
+    AliAODThetaCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODTheta){}
+    virtual ~AliAODThetaCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Theta();}
+    ClassDef(AliAODThetaCut,1)
+  
+ };
+
+class AliAODVxCut: public AliAODParticleBaseCut
+ {
+ //Cut of the X coAnddinate of the vertex position
+  public: 
+    AliAODVxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVx){}
+    virtual ~AliAODVxCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Vx();} //retruns value of the vertex
+    ClassDef(AliAODVxCut,1)
+  
+ };
+
+
+class AliAODVyCut: public AliAODParticleBaseCut
+ {
+ //Cut of the X coAnddinate of the vertex position
+  public: 
+    AliAODVyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVy){}
+    virtual ~AliAODVyCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Vy();} //retruns value of the vertex
+    ClassDef(AliAODVyCut,1)
+  
+ };
+
+class AliAODVzCut: public AliAODParticleBaseCut
+ {
+ //Cut of the X coAnddinate of the vertex position
+  public: 
+    AliAODVzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVz){}
+    virtual ~AliAODVzCut(){}
+  protected:
+    Double_t  GetValue(AliVAODParticle * p)const{return p->Vz();} //retruns value of the vertex
+    
+    ClassDef(AliAODVzCut,1)
+  
+ };
+
+class AliAODPIDCut:  public AliAODParticleBaseCut
+ {
+   public:
+     AliAODPIDCut():AliAODParticleBaseCut(0.0,0.0,kAODPid),fPID(0){}
+     AliAODPIDCut(Int_t pid, Double_t min = 0.0, Double_t max = 1.0):AliAODParticleBaseCut(min,max,kAODPid),fPID(pid){}
+     virtual ~AliAODPIDCut(){}
+     
+     void SetPID(Int_t pid){fPID = pid;}
+     void Print(void) const;
+   protected:
+     Double_t  GetValue(AliVAODParticle * p)const{return p->GetProbability(fPID);}
+     Int_t     fPID; //pid of particle that the pid is set 
+     ClassDef(AliAODPIDCut,1)
+ };
+//___________________________________________________
+/////////////////////////////////////////////////////
+//                                                 //
+// class AliAODLogicalOperCut                      //
+//                                                 //
+// This cut is base class fAnd class that perfAndms  //
+// logical operations on cuts                      //
+//                                                 //
+/////////////////////////////////////////////////////
+class AliAODLogicalOperCut:  public AliAODParticleBaseCut
+ {
+   public:
+     AliAODLogicalOperCut();
+     AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second);
+     virtual   ~AliAODLogicalOperCut();
+   protected:
+     Double_t  GetValue(AliVAODParticle * /*part*/) const {MayNotUse("GetValue");return 0.0;}
+     
+     AliAODParticleBaseCut* fFirst;   //second cut
+     AliAODParticleBaseCut* fSecond;  //first cut
+   private:  
+    class  AliAODDummyBaseCut: public AliAODParticleBaseCut 
+     {
+       Double_t  GetValue(AliVAODParticle * /*part*/) const {return 0.0;}
+       Bool_t    Rejected(AliVAODParticle* /*part*/) const;
+     };
+     
+    ClassDef(AliAODLogicalOperCut,1)
+ };
+
+class AliAODOrCut: public AliAODLogicalOperCut
+{
+   public:
+     AliAODOrCut(){}
+     AliAODOrCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
+     virtual   ~AliAODOrCut(){}
+     Bool_t    Rejected(AliVAODParticle *p) const;
+     ClassDef(AliAODOrCut,1)
+};
+
+class AliAODAndCut: public AliAODLogicalOperCut
+{
+   public:
+     AliAODAndCut(){}
+     AliAODAndCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
+     virtual   ~AliAODAndCut(){}
+     Bool_t    Rejected(AliVAODParticle *p) const;
+     ClassDef(AliAODAndCut,1)
+};
+
+#endif
index bf5c977..27d38e3 100644 (file)
@@ -4,20 +4,31 @@
 //                                                                        //
 // class AliAODParticleCut                                                //
 //                                                                        //
-// Classes for single particle cuts                                       //
-// User should use only AliAODParticleCut, eventually                     //
-// EmptyCut which passes all particles                                    //
+// Classes for single particle cuts.                                      //
+// User should use mainly AliAODParticleCut interface methods,            //
+// eventually EmptyCut which passes all particles.                        //
+//                                                                        //
 // There is all interface for setting cuts on all particle properties     //
-// The main method is Pass - which returns                                //
+// The main method is Rejected - which returns                            //
 //         True to reject particle                                        //
 //         False in case it meets all the criteria of the given cut       //
 //                                                                        //
-// User should create (and also destroy) cuts himself                     // 
-// and then pass them to the Analysis And Function by a proper method     //
+// This class has the list of base particle  cuts that perform check on   //
+// single property. Particle  is rejected if any of cuts rejects it.      //
+// There are implemented logical base cuts that perform logical           //
+// operations on results of two other base cuts. Using them user can      //
+// create a tree structure of a base cuts that performs sophisticated     //
+// cut.                                                                   //
+//                                                                        //
+// User can also implement a base cut that performs complicated           //
+// calculations, if it is only more convenient and/or efficint.           //
 //                                                                        //
+// User should delete created cuts  himself                               //
+// because when setting a cut, other objects (functions,analyses,         //
+// readers, other cuts) make their own copy of a cut.                     //
 //                                                                        //
-// more info: http://alisoft.cern.ch/people/skowron/analyzer/index.html   //
-// responsible: Piotr Skowronski@cern.ch                                   //
+// more info: http://aliweb.cern.ch/people/skowron/analyzer/index.html    //
+// responsible: Piotr Skowronski@cern.ch                                  //
 //                                                                        //
 ////////////////////////////////////////////////////////////////////////////
 
@@ -120,7 +131,7 @@ void AliAODParticleCut::AddBasePartCut(AliAODParticleBaseCut* basecut)
 }
 
 /******************************************************************/
-AliAODParticleBaseCut* AliAODParticleCut::FindCut(EAODCutProperty property)
+AliAODParticleBaseCut* AliAODParticleCut::FindCut(AliAODParticleBaseCut::EAODCutProperty property)
 {
  //returns pointer to the cut checking the given property
  for (Int_t i = 0;i<fNCuts;i++)
@@ -137,7 +148,7 @@ AliAODParticleBaseCut* AliAODParticleCut::FindCut(EAODCutProperty property)
 void AliAODParticleCut::SetMomentumRange(Double_t min, Double_t max)
 {
   //Sets momentum range
-  AliAODMomentumCut* cut= (AliAODMomentumCut*)FindCut(kAODP);
+  AliAODMomentumCut* cut= (AliAODMomentumCut*)FindCut(AliAODParticleBaseCut::kAODP);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODMomentumCut(min,max);
 }
@@ -147,7 +158,7 @@ void AliAODParticleCut::SetMomentumRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetPtRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODPtCut* cut= (AliAODPtCut*)FindCut(kAODPt);
+  AliAODPtCut* cut= (AliAODPtCut*)FindCut(AliAODParticleBaseCut::kAODPt);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODPtCut(min,max);
 
@@ -157,7 +168,7 @@ void AliAODParticleCut::SetPtRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetEnergyRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODEnergyCut* cut= (AliAODEnergyCut*)FindCut(kAODE);
+  AliAODEnergyCut* cut= (AliAODEnergyCut*)FindCut(AliAODParticleBaseCut::kAODE);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODEnergyCut(min,max);
  
@@ -167,7 +178,7 @@ void AliAODParticleCut::SetEnergyRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetRapidityRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODRapidity);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODRapidity);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODRapidityCut(min,max);
 
@@ -177,7 +188,7 @@ void AliAODParticleCut::SetRapidityRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetPseudoRapidityRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODPseudoRapidity);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODPseudoRapidity);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODPseudoRapidityCut(min,max);
  
@@ -187,7 +198,7 @@ void AliAODParticleCut::SetPseudoRapidityRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetPxRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODPx);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODPx);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODPxCut(min,max);
 }
@@ -196,7 +207,7 @@ void AliAODParticleCut::SetPxRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetPyRange(Double_t min, Double_t max)
 {  
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODPy);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODPy);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODPyCut(min,max);
 }
@@ -205,7 +216,7 @@ void AliAODParticleCut::SetPyRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetPzRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODPz);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODPz);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODPzCut(min,max);
 }
@@ -214,7 +225,7 @@ void AliAODParticleCut::SetPzRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetPhiRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODPhi);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODPhi);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODPhiCut(min,max);
 }
@@ -223,7 +234,7 @@ void AliAODParticleCut::SetPhiRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetThetaRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODTheta);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODTheta);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODThetaCut(min,max);
 }
@@ -232,7 +243,7 @@ void AliAODParticleCut::SetThetaRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetVxRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODVx);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODVx);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODVxCut(min,max);
 }
@@ -241,7 +252,7 @@ void AliAODParticleCut::SetVxRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetVyRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODVy);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODVy);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODVyCut(min,max);
 }
@@ -250,7 +261,7 @@ void AliAODParticleCut::SetVyRange(Double_t min, Double_t max)
 void AliAODParticleCut::SetVzRange(Double_t min, Double_t max)
 {
   //name self descriptive
-  AliAODParticleBaseCut* cut = FindCut(kAODVz);
+  AliAODParticleBaseCut* cut = FindCut(AliAODParticleBaseCut::kAODVz);
   if(cut) cut->SetRange(min,max);
   else fCuts[fNCuts++] = new AliAODVzCut(min,max);
 }
@@ -305,8 +316,8 @@ void AliAODParticleCut::Print(void) const
 
 /******************************************************************/
 /******************************************************************/
-
 ClassImp(AliAODParticleEmptyCut)
+
 void AliAODParticleEmptyCut::Streamer(TBuffer &b)
  {
   //stramer
@@ -315,173 +326,3 @@ void AliAODParticleEmptyCut::Streamer(TBuffer &b)
 /******************************************************************/
 /******************************************************************/
 /******************************************************************/
-
-/******************************************************************/
-/******************************************************************/
-/******************************************************************/
-
-ClassImp(AliAODParticleBaseCut)
-void AliAODParticleBaseCut::Print(void) const
-{
-  // prints the information anout the base cut to stdout
-  cout<<"fMin="<<fMin <<", fMax=" <<fMax<<"    ";
-  PrintProperty();
-}
-/******************************************************************/
-
-void AliAODParticleBaseCut::PrintProperty(void) const
-{
- //prints the property name 
- switch (fProperty)
-  {
-   case  kAODP: 
-     cout<<"kAODP"; break;
-   case  kAODPt: 
-     cout<<"kAODPt"; break;
-   case  kAODE: 
-     cout<<"kAODE"; break;
-   case  kAODRapidity: 
-     cout<<"kAODRapidity"; break;
-   case  kAODPseudoRapidity: 
-     cout<<"kAODPseudoRapidity"; break;
-   case  kAODPx: 
-     cout<<"kAODPx"; break;
-   case  kAODPy: 
-     cout<<"kAODPy"; break;
-   case  kAODPz: 
-     cout<<"kAODPz"; break;   
-   case  kAODPhi: 
-     cout<<"kAODPhi"; break;
-   case  kAODTheta: 
-     cout<<"kAODTheta"; break;
-   case  kAODVx: 
-     cout<<"kAODVx"; break;
-   case  kAODVy: 
-     cout<<"kAODVy"; break;
-   case  kAODVz: 
-     cout<<"kAODVz"; break;
-   case  kAODPid: 
-     cout<<"kAODPid"; break;
-   case  kAODNone: 
-     cout<<"kAODNone"; break;
-   default: 
-     cout<<"Property Not Found";
-  }
- cout<<endl;
-}
-ClassImp( AliAODMomentumCut )
-
-ClassImp( AliAODPtCut )
-ClassImp( AliAODEnergyCut )
-ClassImp( AliAODRapidityCut )
-ClassImp( AliAODPseudoRapidityCut )
-ClassImp( AliAODPxCut )
-ClassImp( AliAODPyCut )
-ClassImp( AliAODPzCut )
-ClassImp( AliAODPhiCut )
-ClassImp( AliAODThetaCut )
-ClassImp( AliAODVxCut )
-ClassImp( AliAODVyCut )
-ClassImp( AliAODVzCut )
-
-ClassImp( AliAODPIDCut )
-
-void AliAODPIDCut::Print(void) const
-{
-  cout<<"PID "<<fPID<<" ";
-  AliAODParticleBaseCut::Print();
-}
-
-ClassImp( AliAODLogicalOperCut )
-
-AliAODLogicalOperCut::AliAODLogicalOperCut():
- AliAODParticleBaseCut(-10e10,10e10,kAODNone),
- fFirst(new AliAODDummyBaseCut),
- fSecond(new AliAODDummyBaseCut)
-{
- //ctor
-}
-/******************************************************************/
-
-AliAODLogicalOperCut::AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):
- AliAODParticleBaseCut(-10e10,10e10,kAODNone),
- fFirst((first)?(AliAODParticleBaseCut*)first->Clone():0x0),
- fSecond((second)?(AliAODParticleBaseCut*)second->Clone():0x0)
-{
-  //ctor
-  if ( (fFirst && fSecond) == kFALSE) 
-   {
-     Fatal("AliAODLogicalOperCut","One of parameters is NULL!");
-   }
-}
-/******************************************************************/
-
-AliAODLogicalOperCut::~AliAODLogicalOperCut()
-{
-  //destructor
-  delete fFirst;
-  delete fSecond;
-}
-/******************************************************************/
-
-Bool_t AliAODLogicalOperCut::AliAODDummyBaseCut::Rejected(AliVAODParticle* /*part*/)  const
-{
-  //checks if particles passes properties defined by this cut
-  Warning("Pass","You are using dummy base cut! Probobly some logical cut is not set up properly");
-  return kFALSE;//accept
-}
-/******************************************************************/
-
-void AliAODLogicalOperCut::Streamer(TBuffer &b)
-{
-  // Stream all objects in the array to or from the I/O buffer.
-  UInt_t R__s, R__c;
-  if (b.IsReading()) 
-   {
-     delete fFirst;
-     delete fSecond;
-     fFirst  = 0x0;
-     fSecond = 0x0;
-
-     b.ReadVersion(&R__s, &R__c);
-     TObject::Streamer(b);
-     b >> fFirst;
-     b >> fSecond;
-     b.CheckByteCount(R__s, R__c,AliAODLogicalOperCut::IsA());
-   } 
-  else 
-   {
-     R__c = b.WriteVersion(AliAODLogicalOperCut::IsA(), kTRUE);
-     TObject::Streamer(b);
-     b << fFirst;
-     b << fSecond;
-     b.SetByteCount(R__c, kTRUE);
-  }
-}
-
-/******************************************************************/
-ClassImp(AliAODOrCut)
-
-Bool_t AliAODOrCut::Rejected(AliVAODParticle * p) const
-{
-  //returns true when rejected 
-  //AND operation is a little bit misleading but is correct
-  //User wants to build logical cuts with natural (positive) logic
-  //while AODAN use inernally reverse (returns true when rejected)
-  if (fFirst->Rejected(p) && fSecond->Rejected(p)) return kTRUE;//rejected (both rejected, returned kTRUE)
-  return kFALSE;//accepted, at least one accepted (returned kFALSE)
-}
-/******************************************************************/
-
-ClassImp(AliAODAndCut)
-
-Bool_t AliAODAndCut::Rejected(AliVAODParticle * p)  const
-{
-  //returns true when rejected 
-  //OR operation is a little bit misleading but is correct
-  //User wants to build logical cuts with natural (positive) logic
-  //while AODAN use inernally reverse (returns true when rejected)
-  if (fFirst->Rejected(p) || fSecond->Rejected(p)) return kTRUE;//rejected (any of two rejected(returned kTRUE) )
-  return kFALSE;//accepted (both accepted (returned kFALSE))
-}
-/******************************************************************/
index c531bdb..2189c1e 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <TObject.h>
 #include "AliVAODParticle.h"
+#include "AliAODParticleBaseCut.h"
 
 
 class AliAODParticleEmptyCut;
@@ -36,27 +37,6 @@ class AliAODParticleBaseCut;
 /******************************************************************/
 /******************************************************************/
 
-enum EAODCutProperty
- {
-//codes particle property
-  kAODP,  //Momentum
-  kAODPt, //Transverse momentum
-  kAODE,  //Energy
-  kAODRapidity, //
-  kAODPseudoRapidity,
-  kAODPx, //X coAnddinate of the momentum
-  kAODPy, //Y coAnddinate of the momentum
-  kAODPz, //Z coAnddinate of the momentum
-  kAODPhi,//angle
-  kAODTheta,//angle
-  kAODVx,  // vertex X coAnddinate
-  kAODVy,  // vertex Y coAnddinate
-  kAODVz,  // vertex Z coAnddinate
-  kAODPid, // vertex Z coAnddinate
-//_____________________________
-  kAODNone
- };
-
 /******************************************************************/
 /******************************************************************/
 /******************************************************************/
@@ -65,6 +45,7 @@ class AliAODParticleCut: public TObject
 {
 //Class describing cut on particle
   public:
+
     AliAODParticleCut();
     AliAODParticleCut(const AliAODParticleCut& in);
     virtual ~AliAODParticleCut();
@@ -96,7 +77,7 @@ class AliAODParticleCut: public TObject
     void Print(void) const;
   protected:
      
-    AliAODParticleBaseCut* FindCut(EAODCutProperty property);
+    AliAODParticleBaseCut* FindCut(AliAODParticleBaseCut::EAODCutProperty property);
 
     AliAODParticleBaseCut ** fCuts;//! Array with cuts
     Int_t fNCuts; //number of base cuts stored in fCuts
@@ -131,260 +112,5 @@ class AliAODParticleEmptyCut:  public AliAODParticleCut
 /******************************************************************/
 /******************************************************************/
 
-class AliAODParticleBaseCut: public TObject
- {
-   //This class defines the range of some property - pure virtual
-   //Property is coded by AliAODCutTypes type
-   
-   public:
-     
-     AliAODParticleBaseCut(Double_t min = 0.0, Double_t max = 0.0,EAODCutProperty prop = kAODNone):
-                   fProperty(prop),fMin(min),fMax(max){}
-
-     virtual           ~AliAODParticleBaseCut(){}
-     
-     virtual Bool_t    Rejected(AliVAODParticle *p) const;
-     
-     void              SetRange(Double_t min, Double_t max){fMin = min; fMax = max;}
-
-     void              SetMinimum(Double_t min){fMin = min;}
-     void              SetMaximum(Double_t max){fMax = max;}
-     
-     Double_t          GetMinimum() const {return fMin;}
-     Double_t          GetMaximum() const {return fMax;}
-     
-     EAODCutProperty   GetProperty() const {return fProperty;}
-     virtual void Print(void) const;
-     
-   protected:
-     virtual Double_t  GetValue(AliVAODParticle *) const = 0;
-
-     EAODCutProperty fProperty; //property that this cut describes
-     Double_t fMin;//minimum value
-     Double_t fMax;//maximum value
-     
-   private:
-     void PrintProperty(void) const;
-     ClassDef(AliAODParticleBaseCut,1)
-   
- };
-
-inline Bool_t
-AliAODParticleBaseCut::Rejected(AliVAODParticle *p) const
-{
-  //cjecks if particle property fits in range
-  if ( (GetValue(p) < fMin) || (GetValue(p) > fMax ) ) return kTRUE; //rejected
-  else return kFALSE; //accepted
-}
-/******************************************************************/
-/******************************************************************/
-/******************************************************************/
-
-class AliAODMomentumCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODMomentumCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODP){}
-    virtual ~AliAODMomentumCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->P();}
-    ClassDef(AliAODMomentumCut,1)
- };
-
-class AliAODPtCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODPtCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPt){}
-    virtual ~AliAODPtCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Pt();}
-    ClassDef(AliAODPtCut,1)
- };
-
-
-class AliAODEnergyCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODEnergyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODE){}
-    virtual ~AliAODEnergyCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const {return p->E();}
-    ClassDef(AliAODEnergyCut,1)
- };
-
-class AliAODRapidityCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODRapidity){}
-    virtual ~AliAODRapidityCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Y();}
-    ClassDef(AliAODRapidityCut,1)
- };
-
-class AliAODPseudoRapidityCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODPseudoRapidityCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPseudoRapidity){}
-    virtual ~AliAODPseudoRapidityCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Eta();}
-    ClassDef(AliAODPseudoRapidityCut,1)
- };
-
-class AliAODPxCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODPxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPx){}
-    virtual ~AliAODPxCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Px();}
-    ClassDef(AliAODPxCut,1)
- };
-
-class AliAODPyCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODPyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPy){}
-    virtual ~AliAODPyCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Py();}
-    ClassDef(AliAODPyCut,1)
- };
-
-
-class AliAODPzCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODPzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPz){}
-    virtual ~AliAODPzCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Pz();}
-    ClassDef(AliAODPzCut,1)
- };
-
-class AliAODPhiCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODPhiCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODPhi){}
-    virtual ~AliAODPhiCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Phi();}
-    ClassDef(AliAODPhiCut,1)
-  
- };
-
-class AliAODThetaCut: public AliAODParticleBaseCut
- {
-  public: 
-    AliAODThetaCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODTheta){}
-    virtual ~AliAODThetaCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Theta();}
-    ClassDef(AliAODThetaCut,1)
-  
- };
-
-class AliAODVxCut: public AliAODParticleBaseCut
- {
- //Cut of the X coAnddinate of the vertex position
-  public: 
-    AliAODVxCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVx){}
-    virtual ~AliAODVxCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Vx();} //retruns value of the vertex
-    ClassDef(AliAODVxCut,1)
-  
- };
-
-
-class AliAODVyCut: public AliAODParticleBaseCut
- {
- //Cut of the X coAnddinate of the vertex position
-  public: 
-    AliAODVyCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVy){}
-    virtual ~AliAODVyCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Vy();} //retruns value of the vertex
-    ClassDef(AliAODVyCut,1)
-  
- };
-
-class AliAODVzCut: public AliAODParticleBaseCut
- {
- //Cut of the X coAnddinate of the vertex position
-  public: 
-    AliAODVzCut(Double_t min = 0.0, Double_t max = 0.0):AliAODParticleBaseCut(min,max,kAODVz){}
-    virtual ~AliAODVzCut(){}
-  protected:
-    Double_t  GetValue(AliVAODParticle * p)const{return p->Vz();} //retruns value of the vertex
-    
-    ClassDef(AliAODVzCut,1)
-  
- };
-
-class AliAODPIDCut:  public AliAODParticleBaseCut
- {
-   public:
-     AliAODPIDCut():AliAODParticleBaseCut(0.0,0.0,kAODPid),fPID(0){}
-     AliAODPIDCut(Int_t pid, Double_t min = 0.0, Double_t max = 1.0):AliAODParticleBaseCut(min,max,kAODPid),fPID(pid){}
-     virtual ~AliAODPIDCut(){}
-     
-     void SetPID(Int_t pid){fPID = pid;}
-     void Print(void) const;
-   protected:
-     Double_t  GetValue(AliVAODParticle * p)const{return p->GetProbability(fPID);}
-     Int_t     fPID; //pid of particle that the pid is set 
-     ClassDef(AliAODPIDCut,1)
- };
-//___________________________________________________
-/////////////////////////////////////////////////////
-//                                                 //
-// class AliAODLogicalOperCut                      //
-//                                                 //
-// This cut is base class fAnd class that perfAndms  //
-// logical operations on cuts                      //
-//                                                 //
-/////////////////////////////////////////////////////
-class AliAODLogicalOperCut:  public AliAODParticleBaseCut
- {
-   public:
-     AliAODLogicalOperCut();
-     AliAODLogicalOperCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second);
-     virtual   ~AliAODLogicalOperCut();
-   protected:
-     Double_t  GetValue(AliVAODParticle * /*part*/) const {MayNotUse("GetValue");return 0.0;}
-     
-     AliAODParticleBaseCut* fFirst;   //second cut
-     AliAODParticleBaseCut* fSecond;  //first cut
-   private:  
-    class  AliAODDummyBaseCut: public AliAODParticleBaseCut 
-     {
-       Double_t  GetValue(AliVAODParticle * /*part*/) const {return 0.0;}
-       Bool_t    Rejected(AliVAODParticle* /*part*/) const;
-     };
-     
-    ClassDef(AliAODLogicalOperCut,1)
- };
-
-class AliAODOrCut: public AliAODLogicalOperCut
-{
-   public:
-     AliAODOrCut(){}
-     AliAODOrCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
-     virtual   ~AliAODOrCut(){}
-     Bool_t    Rejected(AliVAODParticle *p) const;
-     ClassDef(AliAODOrCut,1)
-};
-
-class AliAODAndCut: public AliAODLogicalOperCut
-{
-   public:
-     AliAODAndCut(){}
-     AliAODAndCut(AliAODParticleBaseCut* first, AliAODParticleBaseCut* second):AliAODLogicalOperCut(first,second){}
-     virtual   ~AliAODAndCut(){}
-     Bool_t    Rejected(AliVAODParticle *p) const;
-     ClassDef(AliAODAndCut,1)
-};
 
 #endif
index 9f55a7a..4d7d509 100644 (file)
@@ -1,7 +1,8 @@
 SRCS= AliAOD.cxx AliEventBuffer.cxx \
       AliVAODParticle.cxx AliAODParticle.cxx \
       AliAODPair.cxx        AliAODPairCut.cxx \
-      AliAODParticleCut.cxx AliAODRun.cxx \
+      AliAODParticleCut.cxx AliAODParticleBaseCut.cxx \
+      AliAODRun.cxx \
       AliRunAnalysis.cxx AliAnalysis.cxx \
       AliEventCut.cxx AliEventBaseCut.cxx \
       AliReader.cxx AliReaderESD.cxx AliReaderKineTree.cxx\
@@ -15,7 +16,8 @@ DHDR:=ANALYSISLinkDef.h
 EXPORT:=AliAOD.h AliEventBuffer.h\
       AliVAODParticle.h     AliAODParticle.h  \
       AliAODPair.h          AliAODPairCut.h   \
-      AliAODParticleCut.h   AliAODRun.h       \
+      AliAODParticleCut.h   AliAODParticleBaseCut.h \
+      AliAODRun.h       \
       AliRunAnalysis.h      AliAnalysis.h     \
       AliEventCut.h         AliEventBaseCut.h \
       AliReader.h           AliReaderESD.h    \