--- PamCut/PamCutBase/PamCutBase.h 2009/05/29 10:10:28 1.2 +++ PamCut/PamCutBase/PamCutBase.h 2010/03/18 14:41:13 1.6 @@ -22,7 +22,9 @@ class PamCut { public: - /*! @brief Constructor. */ + /*! @brief Constructor. + * @param cutName The cut's name. + */ PamCut(const char *cutName) : _cutName(cutName), _nEv(0), _nGood(0) { } @@ -105,6 +107,17 @@ return _nGood; } + /*! @brief Returns the index of currently processed event. + * + * This method returns the index of the currently processed event inside a #Process() + * invocation. It has no meaning when read outside #Process(). + * + * @return The index of the currently processed event. + */ + ULong_t GetCurrentEvent(){ + return _currEv; + } + /*! @brief The pre-analysis task definition. * * This method is automatically called by Process() before the event selection; @@ -152,6 +165,7 @@ private: const char *_cutName; + ULong_t _currEv; protected: @@ -172,31 +186,39 @@ public: /*! @brief Constructor. + * The collection can own the cuts, according to the value of the "owns" parameter. + * If set to true, the collection will take in charge the duty of destroying cuts and + * freeing their memory; users then should not set owns to true and explicitly call + * delete for the cuts in the collection. If instead owns is set to false, no destruction + * is performed by the collection; in this case, the user should issue the eventual + * delete calls. * * @param collectionName The collection's name. + * @param owns If true, the collection will own the cuts, ie., it will + * destroy them in its destructor. */ - PamCutCollection(const char *collectionName) : - PamCut(collectionName) { + PamCutCollection(const char *collectionName, bool owns = true) : + PamCut(collectionName), _owns(owns) { } /*! @brief Destructor. */ - ~PamCutCollection() { - } + ~PamCutCollection(); /*! @brief Adds a cut to the cut collection * This routine adds a cut to the collection. These are stored in a vector in the same order * they are inserted (the first cut would be element 0, the second cut element 1 and so on). * All the references to a "cut number" or "cut index" will refer to this numbering scheme. * - * @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. */ - void AddCut(PamCut &cut); + void AddCut(PamCut *cut); /*! @brief The basic selection. * * Like in the mother class, this method performs a basic check on the current event: it calls * Check() for each cut previously added with AddCut(), exiting if one of them is not satisfied. * + * @param event The event to analyze. * @return the index of the failed cut (range: [0, \#cuts-1], see AddCut()); #CUTOK if the event * satisfies all the cuts. */ @@ -223,6 +245,16 @@ * */ PamCut *GetCut(unsigned int iCut); + /*! @brief Searches for a cut by name. + * + * The return value of this method is a pointer to a PamCut object; hence, to use the specific method of + * derived cuts it must be cast to the proper cut class. + * + * @param cutName The name of the cut to search for. + * @return pointer to the iCut-th cut; NULL if the specified cut cannot be found or if no cuts are present. + * */ + PamCut *GetCut(const char *cutName); + /*! @brief The number of cuts contained in the collection. * * @return The number of cuts @@ -260,6 +292,10 @@ /*! @brief A vector containing pointers to PamCut objects */ std::vector _cuts; + /*! @brief A flag signaling if the collection owns the cuts (ie., if the collection + * will destroy the cuts. + */ + bool _owns; }; #endif /* PAMCUTBASE_H_ */