Event Cut developed; Spacial event move implemented; and few others
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2004 13:03:57 +0000 (13:03 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2004 13:03:57 +0000 (13:03 +0000)
ANALYSIS/ANALYSISLinkDef.h
ANALYSIS/AliAOD.cxx
ANALYSIS/AliAOD.h
ANALYSIS/AliAnalysis.h
ANALYSIS/AliBaseEventCut.cxx
ANALYSIS/AliBaseEventCut.h
ANALYSIS/AliEventCut.cxx
ANALYSIS/AliEventCut.h
ANALYSIS/AliReaderESD.cxx
ANALYSIS/AliReaderKineTree.cxx
ANALYSIS/libANALYSIS.pkg

index d4222b7a5c780927edf4ee7b47ac3654a7a5fb15..1cf46dfe21e61898947cd4c98abef43516ad509e 100644 (file)
 #pragma link C++ class AliFlowAnalysis+;
 
 #pragma link C++ class AliEventCut+;
 #pragma link C++ class AliFlowAnalysis+;
 
 #pragma link C++ class AliEventCut+;
+#pragma link C++ class AliEmptyEventCut+;
+#pragma link C++ class AliBaseEventCut+;
+
+#pragma link C++ class AliPrimVertexXCut+;
+#pragma link C++ class AliPrimVertexYCut+;
+#pragma link C++ class AliPrimVertexZCut+;
+#pragma link C++ class AliNChargedCut+;
 
 #pragma link C++ class AliAODParticleCut-;
 #pragma link C++ class AliAODEmptyParticleCut-;
 
 #pragma link C++ class AliAODParticleCut-;
 #pragma link C++ class AliAODEmptyParticleCut-;
index 18f92254e3315171061677a15dd76d45598d4bd4..25eb40bb3e5bed7cadc0fa038ba0e38584432f64 100644 (file)
 
 #include <TParticle.h>
 #include "AliAOD.h"
 
 #include <TParticle.h>
 #include "AliAOD.h"
-
 #include "AliAODParticle.h"
 #include "AliAODParticle.h"
+#include "AliTrackPoints.h"
 
 ClassImp(AliAOD)
 
 
 ClassImp(AliAOD)
 
+AliAOD::AliAOD():
+ fParticles(10),
+ fIsRandomized(kFALSE),
+ fPrimaryVertexX(0.0),
+ fPrimaryVertexY(0.0),
+ fPrimaryVertexZ(0.0)
+{
+ //ctor
+ SetOwner(kTRUE);
+}
+
 /**************************************************************************/
 
 void  AliAOD::AddParticle(TParticle* part, Int_t idx)
 /**************************************************************************/
 
 void  AliAOD::AddParticle(TParticle* part, Int_t idx)
@@ -74,3 +85,60 @@ void  AliAOD::Reset()
     }
 //   fRandomized = kFALSE;
 }
     }
 //   fRandomized = kFALSE;
 }
+/**************************************************************************/
+
+void AliAOD::GetPrimaryVertex(Double_t&x, Double_t&y, Double_t&z)
+{
+//returns positions of the primary vertex
+  x = fPrimaryVertexX;
+  y = fPrimaryVertexY;
+  z = fPrimaryVertexZ;
+}
+/**************************************************************************/
+
+void AliAOD::SetPrimaryVertex(Double_t x, Double_t y, Double_t z)
+{
+//Sets positions of the primary vertex 
+  fPrimaryVertexX = x;
+  fPrimaryVertexY = y;
+  fPrimaryVertexZ = z;
+}
+/**************************************************************************/
+
+Int_t AliAOD::GetNumberOfCharged(Double_t etamin, Double_t etamax) const
+{
+  //reurns number of charged particles within given pseudorapidity range
+  Int_t n;
+  Int_t npart = fParticles.GetEntries();
+  for (Int_t i = 0; i < npart; i++)
+   {
+     AliVAODParticle* p = (AliVAODParticle*)fParticles.At(i);
+     Double_t eta = p->Eta();
+     if ( (eta < etamin) || (eta > etamax) ) continue;
+     if (p->Charge() != 0.0) n++;
+   }
+  return 0;  
+}
+/**************************************************************************/
+
+void AliAOD::Move(Double_t x, Double_t y, Double_t z)
+{
+ //moves all spacial coordinates about this vector
+ // vertex
+ // track points
+ // and whatever will be added to AOD and AOD particles that is a space coordinate
+
+  fPrimaryVertexX += x;
+  fPrimaryVertexY += y;
+  fPrimaryVertexZ += z;
+
+  Int_t npart = fParticles.GetEntries();
+  for (Int_t i = 0; i < npart; i++)
+   {
+     AliVAODParticle* p = (AliVAODParticle*)fParticles.At(i);
+     AliTrackPoints* tp  = p->GetTPCTrackPoints();
+     if (tp) tp->Move(x,y,z);
+     tp  = p->GetITSTrackPoints();
+     if (tp) tp->Move(x,y,z);
+   }
+}
index c64e4cd37b86b8d4046708fba8c4317faf1fd5ea..daaf06f48f307dee536ef66298a4cbc3944ecbfa 100644 (file)
@@ -19,13 +19,13 @@ class TParticle;
 
 class AliAOD: public TObject {
 public:
 
 class AliAOD: public TObject {
 public:
-  AliAOD(){SetOwner(kTRUE);}
+  AliAOD();
   virtual ~AliAOD() { Reset(); }
 
   virtual void             SetOwner(Bool_t owner){fParticles.SetOwner(owner);}
   virtual TObjArray*       GetParticles() {return &fParticles;};
   virtual Int_t            GetNumberOfParticles() const  {return fParticles.GetEntriesFast();}
   virtual ~AliAOD() { Reset(); }
 
   virtual void             SetOwner(Bool_t owner){fParticles.SetOwner(owner);}
   virtual TObjArray*       GetParticles() {return &fParticles;};
   virtual Int_t            GetNumberOfParticles() const  {return fParticles.GetEntriesFast();}
-  virtual AliVAODParticle*  GetParticle(Int_t index) const {return (AliVAODParticle*) fParticles[index];}
+  virtual AliVAODParticle* GetParticle(Int_t index) const {return (AliVAODParticle*) fParticles[index];}
   virtual void             AddParticle(AliVAODParticle* particle)  {fParticles.Add(particle);};
   virtual void             AddParticle(TParticle* part, Int_t idx); //adds particle to the event
   virtual void             AddParticle(Int_t pdg, Int_t idx, Double_t px, Double_t py, Double_t pz, Double_t etot,
   virtual void             AddParticle(AliVAODParticle* particle)  {fParticles.Add(particle);};
   virtual void             AddParticle(TParticle* part, Int_t idx); //adds particle to the event
   virtual void             AddParticle(Int_t pdg, Int_t idx, Double_t px, Double_t py, Double_t pz, Double_t etot,
@@ -35,9 +35,20 @@ public:
   void                     SwapParticles(Int_t i, Int_t j);//swaps particles positions; used by AliReader::Blend
   Bool_t                   IsRandomized() const {return fIsRandomized;}
   void                     SetRandomized(Bool_t flag = kTRUE){fIsRandomized = flag;}
   void                     SwapParticles(Int_t i, Int_t j);//swaps particles positions; used by AliReader::Blend
   Bool_t                   IsRandomized() const {return fIsRandomized;}
   void                     SetRandomized(Bool_t flag = kTRUE){fIsRandomized = flag;}
+  
+  void                     GetPrimaryVertex(Double_t&x, Double_t&y, Double_t&z);
+  void                     SetPrimaryVertex(Double_t x, Double_t y, Double_t z);
+  
+  Int_t                    GetNumberOfCharged(Double_t etamin = -10.0, Double_t etamax = -10.0) const;
+  void                     Move(Double_t x, Double_t y, Double_t z);//moves all spacial coordinates about this vector
 private:
   TObjArray                fParticles;   // array of AOD particles, AliAOD is owner of particles
   Bool_t                   fIsRandomized;//flag indicating if positions of particles were randomized - used by HBTAN
 private:
   TObjArray                fParticles;   // array of AOD particles, AliAOD is owner of particles
   Bool_t                   fIsRandomized;//flag indicating if positions of particles were randomized - used by HBTAN
+  Double_t                 fPrimaryVertexX;//X position of the primary vertex
+  Double_t                 fPrimaryVertexY;//Y position of the primary vertex
+  Double_t                 fPrimaryVertexZ;//Z position of the primary vertex
+  
+  
   ClassDef(AliAOD,1)  // base class for AOD containers
 };
 
   ClassDef(AliAOD,1)  // base class for AOD containers
 };
 
index fc9ae7033a1662cca3449dc007ed76a569cd3299..7afebb50b2845dd61f9dfba44fdb285208e4a582 100644 (file)
@@ -84,7 +84,8 @@ inline Bool_t AliAnalysis::PassPartAndTrack1(AliVAODParticle* part,AliVAODPartic
   AliAODParticleCut* pc = fPairCut->GetFirstPartCut();
   return (pc->Pass(part))?kTRUE:pc->Pass(track);
 }
   AliAODParticleCut* pc = fPairCut->GetFirstPartCut();
   return (pc->Pass(part))?kTRUE:pc->Pass(track);
 }
-/*************************************************************************************/ 
+/*************************************************************************************/
+
 inline Bool_t AliAnalysis::PassPartAndTrack2(AliVAODParticle* part,AliVAODParticle* track) const
 {
 //Checks second particle from both, particle and track pairs
 inline Bool_t AliAnalysis::PassPartAndTrack2(AliVAODParticle* part,AliVAODParticle* track) const
 {
 //Checks second particle from both, particle and track pairs
index 8e744ebb81969e10f2848a5574bd274548522355..e013b43750edf8f33fb24640abc15a1800b5bd86 100644 (file)
@@ -9,21 +9,80 @@
 //
 ///////////////////////////////////////////////////////////
 
 //
 ///////////////////////////////////////////////////////////
 
-#include <AliESDtrack.h>
-#include <AliESD.h>
+#include <AliAOD.h>
 ClassImp(AliBaseEventCut)
 
 AliBaseEventCut::AliBaseEventCut():
  fMin(0.0),
 ClassImp(AliBaseEventCut)
 
 AliBaseEventCut::AliBaseEventCut():
  fMin(0.0),
- fMax(0.0),
+ fMax(0.0)
 {
 {
-  
+//ctor  
 }
 /**********************************************************/
 
 }
 /**********************************************************/
 
-Bool_t AliBaseEventCut::Pass(AliESD* esd) const
+AliBaseEventCut::AliBaseEventCut(Double_t min, Double_t max):
+ fMin(min),
+ fMax(max)
 {
 {
-  if ( (GetValue() < fMin) || (GetValue() > fMax) ) return kTRUE;
+ //ctor
+}
+/**********************************************************/
+
+Bool_t AliBaseEventCut::Pass(AliAOD* aod) const
+{
+  if ( (GetValue(aod) < fMin) || (GetValue(aod) > fMax) ) return kTRUE;
   return kFALSE;
   return kFALSE;
+}
+/**********************************************************/
+/**********************************************************/
+/**********************************************************/
+ClassImp(AliPrimVertexXCut)
+
+Double_t AliPrimVertexXCut::GetValue(AliAOD* aod) const
 {
 {
+ //returns x coordinate of the primary vertex
+  Double_t x = 0, y = 0, z = 0;
+  if (aod) aod->GetPrimaryVertex(x,y,z);
+  return x;
+}
+/**********************************************************/
+/**********************************************************/
 /**********************************************************/
 /**********************************************************/
+ClassImp(AliPrimVertexYCut)
+
+Double_t AliPrimVertexYCut::GetValue(AliAOD* aod) const
+{
+ //returns x coordinate of the primary vertex
+  Double_t x = 0, y = 0, z = 0;
+  if (aod) aod->GetPrimaryVertex(x,y,z);
+  return y;
+}
+/**********************************************************/
+/**********************************************************/
+/**********************************************************/
+ClassImp(AliPrimVertexZCut)
+
+Double_t AliPrimVertexZCut::GetValue(AliAOD* aod) const
+{
+ //returns x coordinate of the primary vertex
+  Double_t x = 0, y = 0, z = 0;
+  if (aod) aod->GetPrimaryVertex(x,y,z);
+  return z;
+}
+
+/**********************************************************/
+/**********************************************************/
+/**********************************************************/
+
+ClassImp(AliNChargedCut)
+
+Double_t AliNChargedCut::GetValue(AliAOD* aod) const
+{
+  //returns number of charged particles
+  if (aod) 
+   {
+     return aod->GetNumberOfCharged(fEtaMin,fEtaMax);
+   }  
+  Error("GetValue","Pointer to AOD is NULL");
+  return 0.0;
+}
index d9923a3f1a4df58fb215c4da38fe3ee4a82a643a..42010074ba443419dada141651cecafff727b329 100644 (file)
 
 class AliAOD;
 
 
 class AliAOD;
 
+enum AliEventCutProperty
+ {
+   kPrimVertexXCut,
+   kPrimVertexYCut,
+   kPrimVertexZCut,
+   kNChargedCut
+ };
+
 class AliBaseEventCut: public TObject
 {
   public: 
     AliBaseEventCut();
 class AliBaseEventCut: public TObject
 {
   public: 
     AliBaseEventCut();
+    AliBaseEventCut(Double_t min,Double_t max);
     virtual ~AliBaseEventCut(){}
     
     virtual Bool_t Pass(AliAOD* aod) const;//returns kTRUE if rejected
     virtual ~AliBaseEventCut(){}
     
     virtual Bool_t Pass(AliAOD* aod) const;//returns kTRUE if rejected
@@ -31,4 +40,68 @@ class AliBaseEventCut: public TObject
     ClassDef(AliBaseEventCut,1)
 };
 
     ClassDef(AliBaseEventCut,1)
 };
 
+/************************************************************/
+
+class AliPrimVertexXCut: public AliBaseEventCut
+{
+ public: 
+   AliPrimVertexXCut(){}
+   AliPrimVertexXCut(Double_t min,Double_t max):AliBaseEventCut(min,max){}
+   virtual ~AliPrimVertexXCut(){}
+ protected:
+   Double_t GetValue(AliAOD* aod) const;
+   
+ private:
+   ClassDef(AliPrimVertexXCut,1)
+};
+/************************************************************/
+
+class AliPrimVertexYCut: public AliBaseEventCut
+{
+ public: 
+   AliPrimVertexYCut(){}
+   AliPrimVertexYCut(Double_t min,Double_t max):AliBaseEventCut(min,max){}
+   virtual ~AliPrimVertexYCut(){}
+   
+ protected:
+   Double_t GetValue(AliAOD* aod) const;
+   
+ private:
+   ClassDef(AliPrimVertexYCut,1)
+};
+/************************************************************/
+
+class AliPrimVertexZCut: public AliBaseEventCut
+{
+ public: 
+   AliPrimVertexZCut(){}
+   AliPrimVertexZCut(Double_t min,Double_t max):AliBaseEventCut(min,max){}
+   virtual ~AliPrimVertexZCut(){}
+ protected:
+   Double_t GetValue(AliAOD* aod) const;
+   
+ private:
+   ClassDef(AliPrimVertexZCut,1)
+};
+
+
+/************************************************************/
+
+class AliNChargedCut: public AliBaseEventCut
+{
+ public: 
+   AliNChargedCut(){}
+   AliNChargedCut(Double_t min, Double_t max, Double_t etamin = -10.0, Double_t etamax = 10.0):
+       AliBaseEventCut(min,max),fEtaMin(etamin),fEtaMax(etamax){}
+   virtual ~AliNChargedCut(){}
+ protected:
+   Double_t GetValue(AliAOD* aod) const;
+   Double_t fEtaMin;//Defines max of eta range where mult is caclulated
+   Double_t fEtaMax;//Defines min of eta range where mult is caclulated
+   
+ private:
+   ClassDef(AliNChargedCut,1)
+};
+
+
 #endif
 #endif
index 32e943f421a85d2b16a30b0ec6a5e7d4a8a03e40..dac68cf342f87208fa4684825146d29652207906 100644 (file)
 
 #include "AliBaseEventCut.h"
 
 
 #include "AliBaseEventCut.h"
 
+ClassImp(AliEventCut)
+
+
 AliEventCut::AliEventCut():
 AliEventCut::AliEventCut():
- fBaseCuts(0x0)
+ fBaseCuts(10)
 {
 //costructor
 
 }
 /*********************************************************/
 {
 //costructor
 
 }
 /*********************************************************/
+AliEventCut::AliEventCut(const AliEventCut& in):
+ TObject(in),
+ fBaseCuts(in.fBaseCuts)
+{
+  //cpy ctor
+  fBaseCuts.SetOwner(kTRUE);
+}
+/*********************************************************/
 
 AliEventCut::~AliEventCut()
 {
 //costructor
 
 AliEventCut::~AliEventCut()
 {
 //costructor
- delete fBaseCuts;
 }
 
 /*********************************************************/
 }
 
 /*********************************************************/
@@ -39,7 +49,7 @@ Bool_t AliEventCut::Pass(AliAOD* aod) const
      return kFALSE;
    }
    
      return kFALSE;
    }
    
-  TIter iter(fBaseCuts);
+  TIter iter(&fBaseCuts);
   AliBaseEventCut* becut;
   while (( becut = (AliBaseEventCut*)iter() ))
    {
   AliBaseEventCut* becut;
   while (( becut = (AliBaseEventCut*)iter() ))
    {
@@ -47,3 +57,9 @@ Bool_t AliEventCut::Pass(AliAOD* aod) const
    }
   return kFALSE;
 }
    }
   return kFALSE;
 }
+
+/*********************************************************/
+/*********************************************************/
+/*********************************************************/
+
+ClassImp(AliEmptyEventCut)
index 21e822b633717c0aec710e1007cec9b0d0bc734c..7cb041d6382f75d90022a2160be69823afaf25c3 100644 (file)
@@ -3,30 +3,48 @@
 //________________________________
 ///////////////////////////////////////////////////////////
 //
 //________________________________
 ///////////////////////////////////////////////////////////
 //
-// class AliRunAnalysis
-//
-//
+// class AliEventCut
 //
 //
+// Event cut. It has list of base event cuts. 
+// Each of base event cut checks only one property.
+// Logical base cuts also exists that point to other base cuts.
+// Using them one can build complicated cut with binary tree structure
 //
 ///////////////////////////////////////////////////////////
 
 //
 ///////////////////////////////////////////////////////////
 
-#include "TObject.h"
+#include <TObject.h>
+#include <TObjArray.h>
+#include "AliBaseEventCut.h"
 
 class AliAOD;
 
 class AliAOD;
-class TObjArray;
 
 class AliEventCut: public TObject
 {
   public: 
     AliEventCut();
 
 class AliEventCut: public TObject
 {
   public: 
     AliEventCut();
+    AliEventCut(const AliEventCut& in);
     virtual ~AliEventCut();
     
     virtual Bool_t Pass(AliAOD* aod) const;//returns kTRUE if rejected
     virtual ~AliEventCut();
     
     virtual Bool_t Pass(AliAOD* aod) const;//returns kTRUE if rejected
+    void AddBasePartCut(AliBaseEventCut* ebcut){fBaseCuts.Add(ebcut);}
     
   protected:
     
   protected:
-    TObjArray* fBaseCuts;
+    TObjArray fBaseCuts;
   private:
     ClassDef(AliEventCut,1)
 };
 
   private:
     ClassDef(AliEventCut,1)
 };
 
+class AliEmptyEventCut: public TObject
+{
+  public: 
+    AliEmptyEventCut(){}
+    virtual ~AliEmptyEventCut(){}
+    
+    Bool_t Pass(AliAOD* aod) const {return kFALSE;}//always accept
+    
+  protected:
+  private:
+    ClassDef(AliEmptyEventCut,1)
+};
+
 #endif
 #endif
index 076cf0ac6e3c0ce178c177c2bf090cfb2d7848d8..d214be421b2c9cc6038c0a34d2507df9f7e457c1 100644 (file)
@@ -423,14 +423,14 @@ Int_t AliReaderESD::ReadESD(AliESD* esd)
       if (fNTrackPoints > 0) 
        {
          tpts = new AliTrackPoints(fNTrackPoints,esdtrack,mf,fdR);
       if (fNTrackPoints > 0) 
        {
          tpts = new AliTrackPoints(fNTrackPoints,esdtrack,mf,fdR);
-         tpts->Move(-vertexpos[0],-vertexpos[1],-vertexpos[2]);
+//         tpts->Move(-vertexpos[0],-vertexpos[1],-vertexpos[2]);
        }
 
       AliTrackPoints* itstpts = 0x0;
       if (fITSTrackPoints) 
        {
          itstpts = new AliTrackPoints(AliTrackPoints::kITS,esdtrack);
        }
 
       AliTrackPoints* itstpts = 0x0;
       if (fITSTrackPoints) 
        {
          itstpts = new AliTrackPoints(AliTrackPoints::kITS,esdtrack);
-         itstpts->Move(-vertexpos[0],-vertexpos[1],-vertexpos[2]);
+//         itstpts->Move(-vertexpos[0],-vertexpos[1],-vertexpos[2]);
        }
 
       AliClusterMap* cmap = 0x0; 
        }
 
       AliClusterMap* cmap = 0x0; 
@@ -562,6 +562,15 @@ Int_t AliReaderESD::ReadESD(AliESD* esd)
          fEventRec->GetNumberOfParticles(), fEventSim->GetNumberOfParticles(),
          fNEventsRead,fCurrentEvent,fCurrentDir);
   fTrackCounter->Fill(fEventRec->GetNumberOfParticles());
          fEventRec->GetNumberOfParticles(), fEventSim->GetNumberOfParticles(),
          fNEventsRead,fCurrentEvent,fCurrentDir);
   fTrackCounter->Fill(fEventRec->GetNumberOfParticles());
+  
+  /******************************************************/
+  /******     Setting glevet properties     *************/
+  /******************************************************/
+    
+  if (fEventRec->GetNumberOfParticles() > 0)
+   {
+     fEventRec->SetPrimaryVertex(vertexpos[0],vertexpos[1],vertexpos[2]);
+   }
   return 0;
 }
 
   return 0;
 }
 
index ad44bf8cd65bd8407b39b9a9394b7d0fedd4d1b9..c07e41dcf8f4e02419789994f346c4c818e98f64 100644 (file)
@@ -90,7 +90,10 @@ Int_t AliReaderKineTree::ReadNext()
  //Reads Kinematics Tree
   
  Info("Read","");
  //Reads Kinematics Tree
   
  Info("Read","");
- if (fEventSim == 0x0)  fEventSim = new AliAOD();
+ if (fEventSim == 0x0)  
+  {
+    fEventSim = new AliAOD();
+  } 
  fEventSim->Reset();
 
  do  //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./"
  fEventSim->Reset();
 
  do  //do{}while; is OK even if 0 dirs specified. In that case we try to read from "./"
index e13cad4e8e2a43029a2d7a45d81ba4365090bce7..ef0b2252b993ece75adc76242ae4201ac349e5d7 100644 (file)
@@ -2,7 +2,8 @@ SRCS= AliAOD.cxx AliEventBuffer.cxx \
       AliVAODParticle.cxx AliAODParticle.cxx \
       AliAODPair.cxx        AliAODPairCut.cxx \
       AliAODParticleCut.cxx AliAODRun.cxx \
       AliVAODParticle.cxx AliAODParticle.cxx \
       AliAODPair.cxx        AliAODPairCut.cxx \
       AliAODParticleCut.cxx AliAODRun.cxx \
-      AliRunAnalysis.cxx AliAnalysis.cxx AliEventCut.cxx \
+      AliRunAnalysis.cxx AliAnalysis.cxx \
+      AliEventCut.cxx AliBaseEventCut.cxx \
       AliReader.cxx AliReaderESD.cxx AliReaderKineTree.cxx\
       AliTrackPoints.cxx AliClusterMap.cxx \
       AliD0toKpi.cxx  AliD0toKpiAnalysis.cxx AliFlowAnalysis.cxx \
       AliReader.cxx AliReaderESD.cxx AliReaderKineTree.cxx\
       AliTrackPoints.cxx AliClusterMap.cxx \
       AliD0toKpi.cxx  AliD0toKpiAnalysis.cxx AliFlowAnalysis.cxx \