| 1 | /* | 
| 2 | * MaskedCollection.h | 
| 3 | * | 
| 4 | *  Created on: 19-apr-2011 | 
| 5 | *      Author: Nicola Mori | 
| 6 | */ | 
| 7 |  | 
| 8 | /*! @file MaskedCollection.h The MaskedCollection class definition file */ | 
| 9 |  | 
| 10 | #ifndef MASKEDCOLLECTION_H_ | 
| 11 | #define MASKEDCOLLECTION_H_ | 
| 12 |  | 
| 13 | #include "../../../PamCut/Collections/VerboseCollection/VerboseCollection.h" | 
| 14 |  | 
| 15 | /*! @brief A collection which can use inverse cuts. | 
| 16 | * | 
| 17 | * This collection allow to define a flag for each cut which inverts the result of the cut. | 
| 18 | * This can be useful to select events that does NOT fulfill some constraints. | 
| 19 | */ | 
| 20 | class MaskedCollection: public VerboseCollection { | 
| 21 |  | 
| 22 | public: | 
| 23 |  | 
| 24 | /*! @brief Constructor. | 
| 25 | * | 
| 26 | * @param collectionName The collection's name. | 
| 27 | * @param owns If true, the collection will own the cuts and the actions, ie., it will | 
| 28 | *             destroy them in its destructor. | 
| 29 | */ | 
| 30 | MaskedCollection(const char *collectionName, bool owns = true) : | 
| 31 | VerboseCollection(collectionName, owns), _mask(0) { | 
| 32 | } | 
| 33 |  | 
| 34 | /*! @brief Destructor. */ | 
| 35 | ~MaskedCollection() { | 
| 36 | } | 
| 37 |  | 
| 38 | /*! @brief Adds a cut. | 
| 39 | * | 
| 40 | * A cut added with this method will work as defined. | 
| 41 | * @param cut The pointer to a PamCut-derived object to add to the collection. | 
| 42 | */ | 
| 43 | void AddCut(PamCut *cut); | 
| 44 |  | 
| 45 | /*! @brief Adds an inverse cut. | 
| 46 | * | 
| 47 | * A cut added with this method will work in the inverse way: it will discard an event if | 
| 48 | * the event satisfy the cut's selection criteria. | 
| 49 | * @param cut The pointer to a PamCut-derived object to add to the collection. | 
| 50 | */ | 
| 51 | void AddInverseCut(PamCut *cut); | 
| 52 |  | 
| 53 | /*! @brief Applies the cuts to the event, taking into account the inversion mask. | 
| 54 | * | 
| 55 | * @param event The event to analyze. | 
| 56 | * @return CUTOK if the event satisfy each masked cut. | 
| 57 | */ | 
| 58 | int ApplyCut(PamLevel2 *event); | 
| 59 |  | 
| 60 | private: | 
| 61 | vector<bool> _mask; | 
| 62 |  | 
| 63 | }; | 
| 64 |  | 
| 65 | #endif /* MASKEDCOLLECTION_H_ */ |