Event cut added
authorskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 3 Jul 2004 17:14:00 +0000 (17:14 +0000)
committerskowron <skowron@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 3 Jul 2004 17:14:00 +0000 (17:14 +0000)
ANALYSIS/AliAnalysis.cxx
ANALYSIS/AliAnalysis.h

index 1a2fd96f9e3ee687f6039f238098ef6cc87282f1..4171c912f9ecc2a946a59760e6987147cf9c6b2a 100644 (file)
@@ -13,6 +13,7 @@
 //
 ///////////////////////////////////////////////////////////
 
+#include "AliEventCut.h"
 
 ClassImp(AliAnalysis)
 
@@ -23,7 +24,10 @@ AliAnalysis::AliAnalysis()
 /*********************************************************/
 
 AliAnalysis::AliAnalysis(const char* name,const char* title):
- TTask(name,title)
+ TTask(name,title),
+ fEventCut(0x0),
+ fCutOnSim(kTRUE),
+ fCutOnRec(kTRUE)
 {
  //ctor
 }
@@ -32,6 +36,29 @@ AliAnalysis::AliAnalysis(const char* name,const char* title):
 AliAnalysis::~AliAnalysis()
 {
  //dtor
+ delete fEventCut;
 }
 /*********************************************************/
 
+void AliAnalysis::SetEventCut(AliEventCut* evcut)
+{
+//Sets event -  makes a private copy
+  delete fEventCut;
+  if (evcut) fEventCut = (AliEventCut*)evcut->Clone();
+  else fEventCut = 0x0;
+}
+/*********************************************************/
+
+Bool_t AliAnalysis::Pass(AliAOD* recevent, AliAOD* simevent)
+{
+  //checks the event cut
+  if (fEventCut == 0x0) return kFALSE;
+  
+  if (fCutOnRec)
+    if (fEventCut->Pass(recevent)) return kTRUE;
+    
+  if (fCutOnSim)
+    if (fEventCut->Pass(simevent)) return kTRUE;
+  
+  return kFALSE;
+}
index 4b1e572046ff7e4a7275f267af6b517dacf7a22c..dfe10d8fb5957b736bfff0f9efa98e43f7debdfa 100644 (file)
@@ -16,6 +16,7 @@
 
 class AliAOD;
 class AliStack;
+class AliEventCut;
  
 class AliAnalysis: public TTask
 {
@@ -27,8 +28,17 @@ class AliAnalysis: public TTask
     virtual Int_t Init() = 0;
     virtual Int_t ProcessEvent(AliAOD* aodrec, AliAOD* aodsim = 0x0) = 0;
     virtual Int_t Finish() = 0;
+
+    void          EventCutOnRec(Bool_t flag){fCutOnRec = flag;}
+    void          EventCutOnSim(Bool_t flag){fCutOnSim = flag;}
+    void          SetEventCut(AliEventCut* evcut);
     
   protected:
+    Bool_t        Pass(AliAOD* recevent, AliAOD* simevent);
+    AliEventCut*  fEventCut;//event cut
+
+    Bool_t        fCutOnSim;//flag indicating that event cut is performed on simulated particles 
+    Bool_t        fCutOnRec;//flag indicating that event cut is performed on reconstructed tracks
     
   private:
     ClassDef(AliAnalysis,1)