| 1 |
pam-fi |
1.1 |
/* |
| 2 |
|
|
* EffCollection.h |
| 3 |
|
|
* |
| 4 |
|
|
* Created on: 10/ago/2009 |
| 5 |
|
|
* Author: Nicola Mori |
| 6 |
|
|
*/ |
| 7 |
|
|
|
| 8 |
|
|
/*! @file EffCollection.h The EffCollection class definition file. */ |
| 9 |
|
|
|
| 10 |
|
|
#ifndef EFFCOLLECTION_H_ |
| 11 |
|
|
#define EFFCOLLECTION_H_ |
| 12 |
|
|
|
| 13 |
|
|
#include "../VerboseCollection/VerboseCollection.h" |
| 14 |
|
|
|
| 15 |
|
|
/*! @brief A verbose collection which computes the efficiency of a set of cuts. |
| 16 |
|
|
* |
| 17 |
|
|
* This class subdivides the cuts it contains into two classes: selection and detector |
| 18 |
|
|
* cuts; detector cuts are evaluated after selection cuts. The collection will compute the |
| 19 |
|
|
* efficiency of the whole detector cuts set evaluated using an efficiency sample selected |
| 20 |
|
|
* by the selection cuts. Actions will be divided in selection and detector actions as well: |
| 21 |
|
|
* adding a selection action, it will be placed after all the selection cuts inserted since |
| 22 |
|
|
* the action insertion, and before all detector cuts. Detector actions are placed after all |
| 23 |
|
|
* the cuts. |
| 24 |
|
|
* This class implements specific methods to add selection and detector cuts; cuts added |
| 25 |
|
|
* with the standard #AddCut method will be treated as detector cuts. The same for actions. |
| 26 |
|
|
* |
| 27 |
|
|
*/ |
| 28 |
|
|
class EffCollection: public VerboseCollection { |
| 29 |
|
|
|
| 30 |
|
|
public: |
| 31 |
|
|
|
| 32 |
|
|
/*! @brief Constructor. |
| 33 |
|
|
* |
| 34 |
|
|
* @param collectionName The collection's name. |
| 35 |
|
|
* @param rigBinsFile The file with the rigidity bins. |
| 36 |
|
|
* @param outFileBase The output file base name. If != "", 3 text files will be produced: |
| 37 |
|
|
* - outFileBase + "-sel.txt": events surviving the selection cuts for each bin; |
| 38 |
|
|
* - outFileBase + "-det.txt": events surviving the detector cuts for each bin; |
| 39 |
|
|
* - outFileBase + "-eff.txt": efficiency for each bin (will be 0 if no event survives selection cuts). |
| 40 |
|
|
* @param absRig If true, the absolute rigidity of the selected events will be considered. |
| 41 |
|
|
* |
| 42 |
|
|
*/ |
| 43 |
|
|
EffCollection(const char *collectionName, TString rigBinsFile, TString &outFileBase = "", bool absRig = false); |
| 44 |
|
|
|
| 45 |
|
|
/*! @brief Destructor. */ |
| 46 |
|
|
~EffCollection() { |
| 47 |
|
|
|
| 48 |
|
|
} |
| 49 |
|
|
|
| 50 |
|
|
/*! @brief Adds a detector cut to the collection. |
| 51 |
|
|
* |
| 52 |
|
|
* For EffCollection, cuts added wit #AddCut will be treated as detector cuts. |
| 53 |
|
|
* |
| 54 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
| 55 |
|
|
*/ |
| 56 |
|
|
void AddCut(PamCut &cut) { |
| 57 |
|
|
AddDetectorCut(cut); |
| 58 |
|
|
} |
| 59 |
|
|
|
| 60 |
|
|
/*! @brief Adds a detector cut to the collection. |
| 61 |
|
|
* |
| 62 |
|
|
* Adds a detector cut. Calling #AddCut will add a detector cut as well, and not a |
| 63 |
|
|
* selection cut. |
| 64 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
| 65 |
|
|
*/ |
| 66 |
|
|
void AddDetectorCut(PamCut &cut); |
| 67 |
|
|
|
| 68 |
|
|
/*! @brief Adds a selection cut to the collection. |
| 69 |
|
|
* |
| 70 |
|
|
* Adds a selection cut. Notice that calling #AddCut will add a detector cut , and not a |
| 71 |
|
|
* selection cut. |
| 72 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
| 73 |
|
|
*/ |
| 74 |
|
|
void AddSelectionCut(PamCut &cut); |
| 75 |
|
|
|
| 76 |
|
|
/*! @brief Adds an action to the detector cuts queue. |
| 77 |
|
|
* |
| 78 |
|
|
* For EffCollection, actions added wit #AddAction will be inserted in the detector cuts queue. |
| 79 |
|
|
* |
| 80 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
| 81 |
|
|
*/ |
| 82 |
|
|
void AddAction(CollectionAction &action) { |
| 83 |
|
|
AddDetectorAction(action); |
| 84 |
|
|
} |
| 85 |
|
|
|
| 86 |
|
|
/*! @brief Adds an action to the detector cuts queue. |
| 87 |
|
|
* |
| 88 |
|
|
* Adds a detector action, ie., an action placed in the detector cuts queue. Calling #AddAction will |
| 89 |
|
|
* add a detector action as well, and not a selection action. |
| 90 |
|
|
* |
| 91 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
| 92 |
|
|
*/ |
| 93 |
|
|
void AddDetectorAction(CollectionAction &action); |
| 94 |
|
|
|
| 95 |
|
|
/*! @brief Adds an action to the selection cuts queue. |
| 96 |
|
|
* |
| 97 |
|
|
* Adds a selection action, ie., an action placed in the selection cuts queue. Notice that calling |
| 98 |
|
|
* #AddAction will add a detector action, and not a selection action. |
| 99 |
|
|
* |
| 100 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
| 101 |
|
|
*/ |
| 102 |
|
|
void AddSelectionAction(CollectionAction &action); |
| 103 |
|
|
|
| 104 |
|
|
/*! @brief Applies the selection and detector cuts to the current event. |
| 105 |
|
|
* |
| 106 |
|
|
* @param event The event to analyze. |
| 107 |
|
|
* @return CUTOK if the event survives all the selection and detector cuts. |
| 108 |
|
|
*/ |
| 109 |
|
|
int ApplyCut(PamLevel2 *event); |
| 110 |
|
|
|
| 111 |
|
|
/*TODO: redefine GetCut and the other methods to comply with the new selection/detector cuts structure. */ |
| 112 |
|
|
|
| 113 |
|
|
/*! @brief The post analysis task. |
| 114 |
|
|
* |
| 115 |
|
|
*/ |
| 116 |
|
|
void Finalize(); |
| 117 |
|
|
|
| 118 |
|
|
private: |
| 119 |
|
|
|
| 120 |
|
|
SmartCollection _selCollection; |
| 121 |
|
|
SmartCollection _detCollection; |
| 122 |
|
|
TString _outFileBase; |
| 123 |
|
|
bool _absRig; |
| 124 |
|
|
vector<float> _bins; |
| 125 |
|
|
vector<unsigned int> _sel; |
| 126 |
|
|
vector<unsigned int> _det; |
| 127 |
|
|
|
| 128 |
|
|
unsigned int _outUp, _outDown; |
| 129 |
|
|
}; |
| 130 |
|
|
|
| 131 |
|
|
#endif /* EFFCOLLECTION_H_ */ |