/[PAMELA software]/PamCut/PamCutBase/PamCutBase.h
ViewVC logotype

Diff of /PamCut/PamCutBase/PamCutBase.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pam-fi, Wed May 27 13:30:09 2009 UTC revision 1.6 by pam-fi, Thu Mar 18 14:41:13 2010 UTC
# Line 22  using namespace std; Line 22  using namespace std;
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    }    }
# Line 105  public: Line 107  public:
107      return _nGood;      return _nGood;
108    }    }
109    
110      /*! @brief Returns the index of currently processed event.
111        *
112        * This method returns the index of the currently processed event inside a #Process()
113        * invocation. It has no meaning when read outside #Process().
114        *
115        * @return The index of the currently processed event.
116        */
117      ULong_t GetCurrentEvent(){
118        return _currEv;
119      }
120    
121    /*! @brief The pre-analysis task definition.    /*! @brief The pre-analysis task definition.
122     *     *
123     * This method is automatically called by Process() before the event selection;     * This method is automatically called by Process() before the event selection;
# Line 119  public: Line 132  public:
132     */     */
133    virtual void Setup(PamLevel2 *events);    virtual void Setup(PamLevel2 *events);
134    
135   /*! @brief The post-analysis task definition.    /*! @brief The post-analysis task definition.
136     *     *
137     * 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
138     * 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
# Line 152  public: Line 165  public:
165  private:  private:
166    
167    const char *_cutName;    const char *_cutName;
168      ULong_t _currEv;
169    
170  protected:  protected:
171    
# Line 172  class PamCutCollection: public PamCut { Line 186  class PamCutCollection: public PamCut {
186  public:  public:
187    
188    /*! @brief Constructor.    /*! @brief Constructor.
189     *     * The collection can own the cuts, according to the value of the "owns" parameter.
190     * @param cutName The cut's name.     * If set to true, the collection will take in charge the duty of destroying cuts and
191       * freeing their memory; users then should not set owns to true and explicitly call
192       * delete for the cuts in the collection. If instead owns is set to false, no destruction
193       * is performed by the collection; in this case, the user should issue the eventual
194       * delete calls.
195       *
196       * @param collectionName The collection's name.
197       * @param owns If true, the collection will own the cuts, ie., it will
198       *             destroy them in its destructor.
199     */     */
200    PamCutCollection(const char *cutName) :    PamCutCollection(const char *collectionName, bool owns = true) :
201      PamCut(cutName) {      PamCut(collectionName), _owns(owns) {
202    }    }
203    
204    /*! @brief Destructor. */    /*! @brief Destructor. */
205    ~PamCutCollection() {    ~PamCutCollection();
   }  
206    
207    /*! @brief Adds a cut to the cut collection    /*! @brief Adds a cut to the cut collection
208     *  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
209     *  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).
210     *  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.
211     *     *
212     * @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.
213     */     */
214    void AddCut(PamCut &cut);    void AddCut(PamCut *cut);
215    
216    /*! @brief The basic selection.    /*! @brief The basic selection.
217     *     *
218     *  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
219     *  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.
220     *     *
221       *  @param event The event to analyze.
222     *  @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
223     *  satisfies all the cuts.     *  satisfies all the cuts.
224     */     */
# Line 223  public: Line 245  public:
245     * */     * */
246    PamCut *GetCut(unsigned int iCut);    PamCut *GetCut(unsigned int iCut);
247    
248      /*! @brief Searches for a cut by name.
249       *
250       *  The return value of this method is a pointer to a PamCut object; hence, to use the specific method of
251       *  derived cuts it must be cast to the proper cut class.
252       *
253       * @param cutName The name of the cut to search for.
254       *  @return pointer to the iCut-th cut; NULL if the specified cut cannot be found or if no cuts are present.
255       * */
256      PamCut *GetCut(const char *cutName);
257    
258    /*! @brief The number of cuts contained in the collection.    /*! @brief The number of cuts contained in the collection.
259     *     *
260     * @return The number of cuts     * @return The number of cuts
261     */     */
262    unsigned int GetSize();    unsigned int GetSize();
263    
   
264    /*! @brief The pre-analysis task definition.    /*! @brief The pre-analysis task definition.
265     *     *
266     * 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
# Line 261  protected: Line 292  protected:
292    /*! @brief A vector containing pointers to PamCut objects */    /*! @brief A vector containing pointers to PamCut objects */
293    std::vector<PamCut*> _cuts;    std::vector<PamCut*> _cuts;
294    
295      /*! @brief A flag signaling if the collection owns the cuts (ie., if the collection
296       *         will destroy the cuts.
297       */
298      bool _owns;
299  };  };
300    
301  #endif /* PAMCUTBASE_H_ */  #endif /* PAMCUTBASE_H_ */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23