22 |
class PamCut { |
class PamCut { |
23 |
public: |
public: |
24 |
|
|
25 |
/*! @brief Constructor. */ |
/*! @brief Constructor. |
26 |
|
* @param cutName The cut's name. |
27 |
|
*/ |
28 |
PamCut(const char *cutName) : |
PamCut(const char *cutName) : |
29 |
_cutName(cutName), _nEv(0), _nGood(0) { |
_cutName(cutName), _nEv(0), _nGood(0) { |
30 |
} |
} |
121 |
*/ |
*/ |
122 |
virtual void Setup(PamLevel2 *events); |
virtual void Setup(PamLevel2 *events); |
123 |
|
|
124 |
/*! @brief The post-analysis task definition. |
/*! @brief The post-analysis task definition. |
125 |
* |
* |
126 |
* This method is automatically called by Process() after the event selection has been |
* This method is automatically called by Process() after the event selection has been |
127 |
* performed; override this in derived classes to perform post-analysis tasks like writing |
* performed; override this in derived classes to perform post-analysis tasks like writing |
174 |
public: |
public: |
175 |
|
|
176 |
/*! @brief Constructor. |
/*! @brief Constructor. |
177 |
* |
* The collection can own the cuts, according to the value of the "owns" parameter. |
178 |
* @param cutName The cut's name. |
* If set to true, the collection will take in charge the duty of destroying cuts and |
179 |
|
* freeing their memory; users then should not set owns to true and explicitly call |
180 |
|
* delete for the cuts in the collection. If instead owns is set to false, no destruction |
181 |
|
* is performed by the collection; in this case, the user should issue the eventual |
182 |
|
* delete calls. |
183 |
|
* |
184 |
|
* @param collectionName The collection's name. |
185 |
|
* @param owns If true, the collection will own the cuts, ie., it will |
186 |
|
* destroy them in its destructor. |
187 |
*/ |
*/ |
188 |
PamCutCollection(const char *cutName) : |
PamCutCollection(const char *collectionName, bool owns = true) : |
189 |
PamCut(cutName) { |
PamCut(collectionName), _owns(owns) { |
190 |
} |
} |
191 |
|
|
192 |
/*! @brief Destructor. */ |
/*! @brief Destructor. */ |
193 |
~PamCutCollection() { |
~PamCutCollection(); |
|
} |
|
194 |
|
|
195 |
/*! @brief Adds a cut to the cut collection |
/*! @brief Adds a cut to the cut collection |
196 |
* This routine adds a cut to the collection. These are stored in a vector in the same order |
* This routine adds a cut to the collection. These are stored in a vector in the same order |
197 |
* they are inserted (the first cut would be element 0, the second cut element 1 and so on). |
* they are inserted (the first cut would be element 0, the second cut element 1 and so on). |
198 |
* All the references to a "cut number" or "cut index" will refer to this numbering scheme. |
* All the references to a "cut number" or "cut index" will refer to this numbering scheme. |
199 |
* |
* |
200 |
* @param cut The PamCut-derived object to add to the collection. |
* @param cut The pointer to a PamCut-derived object to add to the collection. |
201 |
*/ |
*/ |
202 |
void AddCut(PamCut &cut); |
void AddCut(PamCut *cut); |
203 |
|
|
204 |
/*! @brief The basic selection. |
/*! @brief The basic selection. |
205 |
* |
* |
206 |
* Like in the mother class, this method performs a basic check on the current event: it calls |
* Like in the mother class, this method performs a basic check on the current event: it calls |
207 |
* Check() for each cut previously added with AddCut(), exiting if one of them is not satisfied. |
* Check() for each cut previously added with AddCut(), exiting if one of them is not satisfied. |
208 |
* |
* |
209 |
|
* @param event The event to analyze. |
210 |
* @return the index of the failed cut (range: [0, \#cuts-1], see AddCut()); #CUTOK if the event |
* @return the index of the failed cut (range: [0, \#cuts-1], see AddCut()); #CUTOK if the event |
211 |
* satisfies all the cuts. |
* satisfies all the cuts. |
212 |
*/ |
*/ |
233 |
* */ |
* */ |
234 |
PamCut *GetCut(unsigned int iCut); |
PamCut *GetCut(unsigned int iCut); |
235 |
|
|
236 |
|
/*! @brief Searches for a cut by name. |
237 |
|
* |
238 |
|
* The return value of this method is a pointer to a PamCut object; hence, to use the specific method of |
239 |
|
* derived cuts it must be cast to the proper cut class. |
240 |
|
* |
241 |
|
* @param cutName The name of the cut to search for. |
242 |
|
* @return pointer to the iCut-th cut; NULL if the specified cut cannot be found or if no cuts are present. |
243 |
|
* */ |
244 |
|
PamCut *GetCut(const char *cutName); |
245 |
|
|
246 |
/*! @brief The number of cuts contained in the collection. |
/*! @brief The number of cuts contained in the collection. |
247 |
* |
* |
248 |
* @return The number of cuts |
* @return The number of cuts |
249 |
*/ |
*/ |
250 |
unsigned int GetSize(); |
unsigned int GetSize(); |
251 |
|
|
|
|
|
252 |
/*! @brief The pre-analysis task definition. |
/*! @brief The pre-analysis task definition. |
253 |
* |
* |
254 |
* This override of the Setup() method calls Setup() for the base class PamCut, and subsequently for each cut |
* This override of the Setup() method calls Setup() for the base class PamCut, and subsequently for each cut |
280 |
/*! @brief A vector containing pointers to PamCut objects */ |
/*! @brief A vector containing pointers to PamCut objects */ |
281 |
std::vector<PamCut*> _cuts; |
std::vector<PamCut*> _cuts; |
282 |
|
|
283 |
|
/*! @brief A flag signaling if the collection owns the cuts (ie., if the collection |
284 |
|
* will destroy the cuts. |
285 |
|
*/ |
286 |
|
bool _owns; |
287 |
}; |
}; |
288 |
|
|
289 |
#endif /* PAMCUTBASE_H_ */ |
#endif /* PAMCUTBASE_H_ */ |