00001 /* 00002 * PamCutBase.h 00003 * 00004 * Created on: 6-feb-2009 00005 * Author: Nicola Mori 00006 */ 00007 00010 #ifndef PAMCUTBASE_H_ 00011 #define PAMCUTBASE_H_ 00012 00013 #include <PamLevel2.h> 00014 #include "../CommonDefs.h" 00015 00016 using namespace std; 00017 00022 class PamCut { 00023 public: 00024 00026 PamCut(const char *cutName) : 00027 _cutName(cutName), _nEv(0), _nGood(0) { 00028 } 00029 00031 virtual ~PamCut() { 00032 } 00033 00044 virtual int Check(PamLevel2 *event) = 0; 00045 00055 virtual int ApplyCut(PamLevel2 *event); 00056 00067 virtual void Process(PamLevel2 *events, ULong_t firstEvent, ULong_t lastEvent); 00068 00076 virtual void OnGood(PamLevel2 *event) { 00077 } 00078 00087 virtual void OnBad(PamLevel2 *event, int selectionResult) { 00088 } 00089 00094 virtual UInt_t GetNEv() { 00095 return _nEv; 00096 } 00104 virtual UInt_t GetNGood() { 00105 return _nGood; 00106 } 00107 00120 virtual void Setup(PamLevel2 *events); 00121 00128 virtual void Finalize() { 00129 } 00130 00135 const char* GetName() const; 00136 00141 void SetName(const char *newName); 00142 00150 PamCut& operator=(const PamCut &rightValue); 00151 00152 private: 00153 00154 const char *_cutName; 00155 00156 protected: 00157 00158 UInt_t _nEv; 00159 UInt_t _nGood; 00160 }; 00161 00171 class PamCutCollection: public PamCut { 00172 public: 00173 00178 PamCutCollection(const char *collectionName) : 00179 PamCut(collectionName) { 00180 } 00181 00183 ~PamCutCollection() { 00184 } 00185 00193 void AddCut(PamCut &cut); 00194 00204 int Check(PamLevel2 *event); 00205 00215 int ApplyCut(PamLevel2 *event); 00216 00225 PamCut *GetCut(unsigned int iCut); 00226 00231 unsigned int GetSize(); 00232 00240 void Setup(PamLevel2 *events); 00241 00247 void Finalize(); 00248 00258 PamCutCollection& operator=(const PamCutCollection &rightValue); 00259 00260 protected: 00262 std::vector<PamCut*> _cuts; 00263 00264 }; 00265 00266 #endif /* PAMCUTBASE_H_ */