add posibility to accept ESD events depending on time stamp
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2012 12:51:20 +0000 (12:51 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Dec 2012 12:51:20 +0000 (12:51 +0000)
PWG/CaloTrackCorrBase/AliCaloTrackReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackReader.h

index bda63ff..68aaa8c 100755 (executable)
@@ -94,7 +94,9 @@ fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),                 fCaloFilterPatch(k
 fEMCALClustersListName(""),  fZvtxCut(0.),                    
 fAcceptFastCluster(kFALSE),  fRemoveLEDEvents(kTRUE), 
 fDoEventSelection(kFALSE),   fDoV0ANDEventSelection(kFALSE),  fUseEventsWithPrimaryVertex(kFALSE),
-fTriggerAnalysis (0x0),
+fTriggerAnalysis (0x0),      fTimeStampEventSelect(0),
+fTimeStampEventFracMin(0),   fTimeStampEventFracMax(0),
+fTimeStampRunMin(0),         fTimeStampRunMax(0),
 fNPileUpClusters(-1),        fNNonPileUpClusters(-1),         fNPileUpClustersCut(3),
 fCentralityClass(""),        fCentralityOpt(0),
 fEventPlaneMethod(""),       fImportGeometryFromFile(kFALSE), fImportGeometryFilePath("")
@@ -688,6 +690,23 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry,
   //------------------------------------------------------
   //Event rejection depending on vertex, pileup, v0and
   //------------------------------------------------------
+  if(fDataType==kESD && fTimeStampEventSelect)
+  {
+    AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
+    Int_t timeStamp = esd->GetTimeStamp();
+    Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin);
+  
+    //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, //timeStampFrac);
+    
+    if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE;
+  
+    //printf("\t accept time stamp\n");
+  }
+
+  
+  //------------------------------------------------------
+  //Event rejection depending on vertex, pileup, v0and
+  //------------------------------------------------------
 
   if(fUseEventsWithPrimaryVertex)
   {
index 592b03a..0b44272 100755 (executable)
@@ -266,6 +266,25 @@ public:
   void             SwitchOffPrimaryVertexSelection()       { fUseEventsWithPrimaryVertex = kFALSE ; }
   Bool_t           IsPrimaryVertexSelectionDone()    const { return fUseEventsWithPrimaryVertex   ; } 
   
+  
+  //Time Stamp
+  
+  Int_t            GetRunTimeStampMin()              const { return fTimeStampRunMin         ; }
+  Int_t            GetRunTimeStampMax()              const { return fTimeStampRunMax         ; }
+  
+  void             SetRunTimeStamp(Int_t a, Int_t b)       { fTimeStampRunMin = a            ;
+                                                             fTimeStampRunMax = b            ; } // seconds
+  
+  Float_t          GetEventTimeStampFractionMin()    const { return fTimeStampEventFracMin   ; }
+  Float_t          GetEventTimeStampFractionMax()    const { return fTimeStampEventFracMax   ; }
+  
+  void             SetEventTimeStampFraction(Float_t a, Float_t b) { fTimeStampEventFracMin = a ;
+                                                                     fTimeStampEventFracMax = b ; }
+  
+  void             SwitchOnSelectEventTimeStamp()          { fTimeStampEventSelect = kTRUE   ; }
+  void             SwitchOffSelectEventTimeStamp()         { fTimeStampEventSelect = kFALSE  ; }
+  
+  
   Bool_t           IsPileUpFromSPD()               const ;
   Bool_t           IsPileUpFromEMCal()             const ;
   Bool_t           IsPileUpFromSPDAndEMCal()       const ;
@@ -559,11 +578,19 @@ public:
   Bool_t           fDoV0ANDEventSelection;       // Select events depending on V0, fDoEventSelection should be on
   Bool_t           fUseEventsWithPrimaryVertex ; // Select events with primary vertex
   AliTriggerAnalysis* fTriggerAnalysis;          // Access to trigger selection algorithm for V0AND calculation
+  
+  Bool_t           fTimeStampEventSelect;        // Select events within a fraction of data taking time
+  Float_t          fTimeStampEventFracMin;       // Minimum value of time stamp fraction event
+  Float_t          fTimeStampEventFracMax;       // Maximum value of time stamp fraction event
+  Int_t            fTimeStampRunMin;             // Minimum value of time stamp in run
+  Int_t            fTimeStampRunMax;             // Maximum value of time stamp in run
+  
   Double_t         fPileUpParamSPD[5];           // Parameters to pass to method IsPileupFromSPD: Int_t minContributors,
                                                  // Double_t minZdist, 
                                                  // Double_t nSigmaZdist, 
                                                  // Double_t nSigmaDiamXY, 
                                                  // Double_t nSigmaDiamZ)
+  
   // Pile-up in EMCal
   Int_t            fNPileUpClusters;             // Number of clusters with time avobe 20 ns
   Int_t            fNNonPileUpClusters;          // Number of clusters with time below 20 ns
@@ -586,7 +613,7 @@ public:
   AliCaloTrackReader(              const AliCaloTrackReader & r) ; // cpy ctor
   AliCaloTrackReader & operator = (const AliCaloTrackReader & r) ; // cpy assignment
   
-  ClassDef(AliCaloTrackReader,47)
+  ClassDef(AliCaloTrackReader,48)
   
 } ;