Pair cuts and all functonality connected with them moved to AliAnalysis
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2004 13:05:06 +0000 (13:05 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jul 2004 13:05:06 +0000 (13:05 +0000)
HBTAN/AliHBTAnalysis.cxx
HBTAN/AliHBTAnalysis.h

index a4e5723..f4ea1ab 100644 (file)
@@ -58,14 +58,17 @@ AliHBTAnalysis::AliHBTAnalysis():
   fTrackMonitorFunctions ( new AliHBTMonOneParticleFctn* [fgkFctnArraySize]),    
   fParticleAndTrackMonitorFunctions ( new AliHBTMonTwoParticleFctn* [fgkFctnArraySize]),    
   fBkgEventCut(0x0),
+  fPartBuffer(0x0),
+  fTrackBuffer(0x0),
   fBufferSize(2),
   fDisplayMixingInfo(fgkDefaultMixingInfo),
   fIsOwner(kFALSE),
-  fPartBuffer(0x0),
-  fTrackBuffer(0x0),
   fProcessOption(kSimulatedAndReconstructed),
   fNoCorrfctns(kFALSE),
-  fOutputFileName(0x0)
+  fOutputFileName(0x0),
+  fVertexX(0.0),
+  fVertexY(0.0),
+  fVertexZ(0.0)
  {
    //default constructor
    
@@ -89,14 +92,17 @@ AliHBTAnalysis::AliHBTAnalysis(const AliHBTAnalysis& in):
   fTrackMonitorFunctions(0x0),
   fParticleAndTrackMonitorFunctions(0x0),
   fBkgEventCut(0x0),
+  fPartBuffer(0x0),
+  fTrackBuffer(0x0),
   fBufferSize(fgkDefaultBufferSize),
   fDisplayMixingInfo(fgkDefaultMixingInfo),
   fIsOwner(kFALSE),
-  fPartBuffer(0x0),
-  fTrackBuffer(0x0),
   fProcessOption(kSimulatedAndReconstructed),
   fNoCorrfctns(kFALSE),
-  fOutputFileName(0x0)
+  fOutputFileName(0x0),
+  fVertexX(0.0),
+  fVertexY(0.0),
+  fVertexZ(0.0)
  {
 //copy constructor
    Fatal("AliHBTAnalysis(const AliHBTAnalysis&)","Sensless");
@@ -146,7 +152,26 @@ Int_t AliHBTAnalysis::ProcessEvent(AliAOD* aodrec, AliAOD* aodsim)
    }
   if ( Pass(aodrec,aodsim) ) return 0;
   
-  return  (this->*fProcEvent)(aodrec,aodsim);
+  //Move event to the apparent vertex -> must be after the event cut
+  //It is important for any cut that use any spacial coordiantes, 
+  //f.g. anti-merging cut in order to preserve the same bahavior of variables (f.g. distance between tracks)
+  Double_t dvx = 0, dvy = 0, dvz = 0;
+  if (aodrec)
+   {
+     Double_t pvx,pvy,pvz;
+     aodrec->GetPrimaryVertex(pvx,pvy,pvz);
+     
+     dvx = fVertexX - pvx;
+     dvy = fVertexY - pvy;
+     dvz = fVertexZ - pvz;
+     aodrec->Move(dvx,dvy,dvz);
+   }  
+  
+  Int_t result = (this->*fProcEvent)(aodrec,aodsim);
+
+  if (aodrec) aodrec->Move(-dvx,-dvy,-dvz);//move event back to the same spacial coordinates
+  
+  return  result;
 }
 /*************************************************************************************/ 
 
@@ -161,6 +186,7 @@ Int_t AliHBTAnalysis::Finish()
 void AliHBTAnalysis::DeleteFunctions()
 {
  //Deletes all functions added to analysis
  UInt_t ii;
  for(ii = 0;ii<fNParticleFunctions;ii++)
   { 
@@ -1696,6 +1722,19 @@ Bool_t AliHBTAnalysis::IsNonIdentAnalysis()
 }
 /*************************************************************************************/ 
 
+void AliHBTAnalysis::SetApparentVertex(Double_t x, Double_t y, Double_t z)
+{ 
+  //Sets apparent vertex
+  // All events have to be moved to the same vertex position in order to
+  // to be able to comare any space positions (f.g. anti-merging)
+  // This method defines this position
+  
+  fVertexX = x;
+  fVertexY = y;
+  fVertexZ = z;
+}
+/*************************************************************************************/ 
+
 void AliHBTAnalysis::PressAnyKey()
 { 
  //small utility function that helps to make comfortable macros
index be6d36f..a2fa38e 100644 (file)
@@ -48,74 +48,76 @@ class AliHBTAnalysis: public AliAnalysis
      virtual ~AliHBTAnalysis();
 
      Int_t  Init();
-     Int_t ProcessEvent(AliAOD* aodrec, AliAOD* aodsim = 0x0);
-     Int_t Finish();
+     Int_t  ProcessEvent(AliAOD* aodrec, AliAOD* aodsim = 0x0);
+     Int_t  Finish();
      
-     enum EProcessOption{kReconstructed,kSimulated,kSimulatedAndReconstructed};
-     void  SetProcessOption(EProcessOption option){fProcessOption = option;}//Init must be called to make effect
+     enum   EProcessOption{kReconstructed,kSimulated,kSimulatedAndReconstructed};
+     void   SetProcessOption(EProcessOption option){fProcessOption = option;}//Init must be called to make effect
      
-     virtual void Process(Option_t* option = "TracksAndParticles");//Stand alone HBT analysis 
+     void   Process(Option_t* option = "TracksAndParticles");//Stand alone HBT analysis 
      
-     void SetGlobalPairCut(AliAODPairCut* cut);
+     void   SetGlobalPairCut(AliAODPairCut* cut);
      
-     void AddTrackFunction(AliHBTOnePairFctn* f);
-     void AddParticleFunction(AliHBTOnePairFctn* f);
-     void AddParticleAndTrackFunction(AliHBTTwoPairFctn* f);
+     void   AddTrackFunction(AliHBTOnePairFctn* f);
+     void   AddParticleFunction(AliHBTOnePairFctn* f);
+     void   AddParticleAndTrackFunction(AliHBTTwoPairFctn* f);
      
-     void AddParticleMonitorFunction(AliHBTMonOneParticleFctn* f);    //z.ch.
-     void AddTrackMonitorFunction(AliHBTMonOneParticleFctn* f);    //z.ch.
-     void AddParticleAndTrackMonitorFunction(AliHBTMonTwoParticleFctn* f);//z.ch.
+     void   AddParticleMonitorFunction(AliHBTMonOneParticleFctn* f);    //z.ch.
+     void   AddTrackMonitorFunction(AliHBTMonOneParticleFctn* f);    //z.ch.
+     void   AddParticleAndTrackMonitorFunction(AliHBTMonTwoParticleFctn* f);//z.ch.
 
-     void AddResolutionFunction(AliHBTTwoPairFctn* f){AddParticleAndTrackFunction(f);}
+     void   AddResolutionFunction(AliHBTTwoPairFctn* f){AddParticleAndTrackFunction(f);}
      
-     void SetReader(AliReader* r){fReader = r;}
+     void   SetReader(AliReader* r){fReader = r;}
      
-     void WriteFunctions();
-     void SetOutputFileName(const char* fname);
+     void   WriteFunctions();
+     void   SetOutputFileName(const char* fname);
           
-     void SetBufferSize(Int_t buffsize){fBufferSize=buffsize;}
-     void SetOwner(Bool_t owner=kTRUE){fIsOwner=owner;}
+     void   SetBufferSize(Int_t buffsize){fBufferSize=buffsize;}
+     void   SetOwner(Bool_t owner=kTRUE){fIsOwner=owner;}
      Bool_t IsOwner() const {return fIsOwner;}
      Bool_t IsNonIdentAnalysis();
      void   ResetFunctions();
      void   SetDisplayInfo(Int_t howoften){fDisplayMixingInfo = howoften;}//defines every each line info about mixing is displayed
      
-     static void PressAnyKey();//small utility function that helps to make comfortable macros
-   protected:
+     void   SetApparentVertex(Double_t x, Double_t y, Double_t z);//Sets apparent vertex
      
-     Bool_t RunCoherencyCheck();
+     static void PressAnyKey();//small utility function that helps to make comfortable macros
      
-     void FilterOut(AliAOD* outpart1, AliAOD* outpart2, AliAOD* inpart,
-                    AliAOD* outtrack1, AliAOD* outtrack2, AliAOD* intrack)const;
-     void FilterOut(AliAOD* out1, AliAOD* out2, AliAOD* in)const;
-     void DeleteFunctions();
+   protected:
      
-
      /**********************************************/
      /*      E V E N T     P R O C E S S I N G     */
      /**********************************************/
      // NEW AOD schema
      Int_t (AliHBTAnalysis::*fProcEvent)(AliAOD* aodrec, AliAOD* aodsim);//Pointer to the processing method
 
-     virtual Int_t ProcessSim(AliAOD* /*aodrec*/, AliAOD* aodsim);
-     virtual Int_t ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/);
-     virtual Int_t ProcessRecAndSim(AliAOD* aodrec, AliAOD* aodsim);
+     Int_t ProcessSim(AliAOD* /*aodrec*/, AliAOD* aodsim);
+     Int_t ProcessRec(AliAOD* aodrec, AliAOD* /*aodsim*/);
+     Int_t ProcessRecAndSim(AliAOD* aodrec, AliAOD* aodsim);
      
-     virtual Int_t ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim);
-     virtual Int_t ProcessSimNonId(AliAOD* /*aodrec*/, AliAOD* aodsim);
-     virtual Int_t ProcessRecNonId(AliAOD* aodrec, AliAOD* /*aodsim*/);
+     Int_t ProcessRecAndSimNonId(AliAOD* aodrec, AliAOD* aodsim);
+     Int_t ProcessSimNonId(AliAOD* /*aodrec*/, AliAOD* aodsim);
+     Int_t ProcessRecNonId(AliAOD* aodrec, AliAOD* /*aodsim*/);
      
 
      // OLD legacy schema
 
-     virtual void ProcessTracks();
-     virtual void ProcessParticles();
-     virtual void ProcessTracksAndParticles();
+     void   ProcessTracks();
+     void   ProcessParticles();
+     void   ProcessTracksAndParticles();
      
-     virtual void ProcessTracksAndParticlesNonIdentAnal();
-     virtual void ProcessParticlesNonIdentAnal();
-     virtual void ProcessTracksNonIdentAnal();
+     void   ProcessTracksAndParticlesNonIdentAnal();
+     void   ProcessParticlesNonIdentAnal();
+     void   ProcessTracksNonIdentAnal();
 
+     Bool_t RunCoherencyCheck();
+     
+     void   FilterOut(AliAOD* outpart1, AliAOD* outpart2, AliAOD* inpart,
+                      AliAOD* outtrack1, AliAOD* outtrack2, AliAOD* intrack)const;
+     void   FilterOut(AliAOD* out1, AliAOD* out2, AliAOD* in)const;
+     void   DeleteFunctions();
+     
 
      AliReader* fReader;//! Pointer to reader
      
@@ -136,26 +138,28 @@ class AliHBTAnalysis: public AliAnalysis
      AliHBTMonOneParticleFctn**  fTrackMonitorFunctions; //! which are used for single particle analysis,
      AliHBTMonTwoParticleFctn**  fParticleAndTrackMonitorFunctions;  //! cut monitoring, etc.
 
+     AliEventCut*     fBkgEventCut;// We can narrow class of events used in 
+
+     AliEventBuffer*  fPartBuffer;//Sim Particles event buffer
+     AliEventBuffer*  fTrackBuffer;//Rec Tracks event buffer
 
      /**********************************************/
-     /* Control parameters  */
+     /* Control parameters                         */
      /**********************************************/
-
-     AliEventCut*     fBkgEventCut;// We can narrow class of events used in 
       
-     Int_t  fBufferSize; //defines the size of buffer for mixed events; -1==MIX All
-     Int_t  fDisplayMixingInfo;//!defines every which particle mixing info is displayed
-     Bool_t fIsOwner;//!defines of all functions are supposed to be deleted while by the way of analysis defaulr false
-    
-     AliEventBuffer* fPartBuffer;//Sim Particles event buffer
-     AliEventBuffer* fTrackBuffer;//Rec Tracks event buffer
+     Int_t            fBufferSize; //defines the size of buffer for mixed events; -1==MIX All
+     Int_t            fDisplayMixingInfo;//!defines every which particle mixing info is displayed
+     Bool_t           fIsOwner;//!defines of all functions are supposed to be deleted while by the way of analysis defaulr false
+     
+     EProcessOption   fProcessOption;//Option that says waht analysis to do (Rec, Sim or SimAndRec)
+     Bool_t           fNoCorrfctns;//Internal flag indicating that no cfs are set by the user (only monitor ones)
+     TString*         fOutputFileName;//Fiele name where to dump results, if not specified reults are written to gDirectory
      
-     EProcessOption  fProcessOption;//Option that says waht analysis to do (Rec, Sim or SimAndRec)
-     Bool_t          fNoCorrfctns;//Internal flag indicating that no cfs are set by the user (only monitor ones)
-     TString*        fOutputFileName;//Fiele name where to dump results, if not specified reults are written to gDirectory
+     Double_t         fVertexX;//X position of apparent vertex
+     Double_t         fVertexY;//Y position of apparent vertex
+     Double_t         fVertexZ;//Z position of apparent vertex
      
    private:
-   
 
      static const UInt_t fgkFctnArraySize;//!
      static const UInt_t fgkDefaultMixingInfo;//!
@@ -163,6 +167,4 @@ class AliHBTAnalysis: public AliAnalysis
 
      ClassDef(AliHBTAnalysis,0)
  };
 #endif