| 1 | 
pam-fi | 
1.1 | 
/* | 
| 2 | 
  | 
  | 
 * BinnedEffCollection.h | 
| 3 | 
  | 
  | 
 * | 
| 4 | 
  | 
  | 
 *  Created on: 12/lug/2011 | 
| 5 | 
  | 
  | 
 *      Author: Nicola Mori | 
| 6 | 
  | 
  | 
 */ | 
| 7 | 
  | 
  | 
 | 
| 8 | 
  | 
  | 
/*! @file BinnedEffCollection.h The BinnedEffCollection class definition file. */ | 
| 9 | 
  | 
  | 
 | 
| 10 | 
  | 
  | 
#ifndef BINNEDEFFCOLLECTION_H_ | 
| 11 | 
  | 
  | 
#define BINNEDEFFCOLLECTION_H_ | 
| 12 | 
  | 
  | 
 | 
| 13 | 
  | 
  | 
#include "../EffCollection/EffCollection.h" | 
| 14 | 
  | 
  | 
 | 
| 15 | 
  | 
  | 
/*! @brief A binned efficiency collection. | 
| 16 | 
  | 
  | 
 * | 
| 17 | 
  | 
  | 
 * This abstract class provides methods for computing a binned efficiency. The binning variable is | 
| 18 | 
  | 
  | 
 * not defined here but must be specified in children concrete classes by implementing the pure | 
| 19 | 
  | 
  | 
 * virtual method #GetBinValue. For example, to bin the efficiency using rigidity it is sufficient | 
| 20 | 
  | 
  | 
 * to implement #GetBinValue so that it returns the rigidity of current event. Likewise for beta or | 
| 21 | 
  | 
  | 
 * any other possible variable (calorimeter energy, rigidity from beta and so on). | 
| 22 | 
  | 
  | 
 * | 
| 23 | 
  | 
  | 
 * This class inherits from #EffCollection: it has selection and detector cuts and actions, and it | 
| 24 | 
  | 
  | 
 * computes and saves the integrated detector efficiency. Plus, it will compute and save the efficiency | 
| 25 | 
  | 
  | 
 * for each bin given to the constructor. The output consists of text files and a ROOT file | 
| 26 | 
  | 
  | 
 * with the efficiency graph. | 
| 27 | 
  | 
  | 
 */ | 
| 28 | 
  | 
  | 
class BinnedEffCollection: public EffCollection { | 
| 29 | 
  | 
  | 
 | 
| 30 | 
  | 
  | 
public: | 
| 31 | 
  | 
  | 
 | 
| 32 | 
  | 
  | 
  /*! @brief Constructor. | 
| 33 | 
  | 
  | 
   * | 
| 34 | 
  | 
  | 
   * @param collectionName The collection's name. The graph in the ROOT output will have the same name, so be | 
| 35 | 
  | 
  | 
   *                       careful to name the collection respecting the C++ rules for the names of the variables | 
| 36 | 
  | 
  | 
   *                       (eg. don't use - in the name) otherwise the graph will be unusable. | 
| 37 | 
  | 
  | 
   * @param outFileBase The output file base name. It will produce the same file as the parent class #EffCollection | 
| 38 | 
  | 
  | 
   *                    with the total efficiency, plus a similar file (named outFileBase + collection's name + "-rig.txt") | 
| 39 | 
  | 
  | 
   *                    with a row for each rigidity bin. At the beginning of each row there will be two additional columns | 
| 40 | 
  | 
  | 
   *                    with the edges of the bin. Additionally, a ROOT file (outFileBase + collection's name +"-rig.root") | 
| 41 | 
  | 
  | 
   *                    will be produced, containing the efficiency graph. | 
| 42 | 
  | 
  | 
   * @param binsFile The file with the bins. | 
| 43 | 
  | 
  | 
   * @param errMethod The method to use for error computation. Possible values are defined in #EffCollection_ErrMethod. | 
| 44 | 
  | 
  | 
   * @param owns If true, the collection will own the cuts and the actions, ie., it will | 
| 45 | 
  | 
  | 
   *             destroy them in its destructor. | 
| 46 | 
  | 
  | 
   */ | 
| 47 | 
  | 
  | 
  BinnedEffCollection(const char *collectionName, TString outFileBase = "", TString binsFile = "", int errMethod = | 
| 48 | 
  | 
  | 
      EFFERR_ROOT, bool owns = true); | 
| 49 | 
  | 
  | 
 | 
| 50 | 
  | 
  | 
  /*! @brief Destructor. */ | 
| 51 | 
  | 
  | 
  ~BinnedEffCollection() { | 
| 52 | 
  | 
  | 
 | 
| 53 | 
  | 
  | 
  } | 
| 54 | 
  | 
  | 
 | 
| 55 | 
  | 
  | 
  /*! @brief Applies the selection and detector cuts to the current event. | 
| 56 | 
  | 
  | 
   * | 
| 57 | 
  | 
  | 
   * @param event The event to analyze. | 
| 58 | 
  | 
  | 
   * @return CUTOK if the event survives all the selection and detector cuts. | 
| 59 | 
  | 
  | 
   */ | 
| 60 | 
  | 
  | 
  int ApplyCut(PamLevel2 *event); | 
| 61 | 
  | 
  | 
 | 
| 62 | 
  | 
  | 
  /*! @brief The post analysis task. | 
| 63 | 
  | 
  | 
   * | 
| 64 | 
  | 
  | 
   */ | 
| 65 | 
  | 
  | 
  void Finalize(); | 
| 66 | 
  | 
  | 
 | 
| 67 | 
  | 
  | 
  /*! @brief Returns the value of the binning parameter for current event. | 
| 68 | 
  | 
  | 
   * | 
| 69 | 
  | 
  | 
   * This method has to be implemented in children classes, and must return the value of the binning parameter (rigidity, beta, | 
| 70 | 
  | 
  | 
   * energy etc.) for current event. | 
| 71 | 
  | 
  | 
   * | 
| 72 | 
  | 
  | 
   * @param event The current event. | 
| 73 | 
  | 
  | 
   * @return The binning value. | 
| 74 | 
  | 
  | 
   */ | 
| 75 | 
  | 
  | 
  virtual float GetBinValue(PamLevel2 *event) = 0; | 
| 76 | 
  | 
  | 
 | 
| 77 | 
  | 
  | 
private: | 
| 78 | 
  | 
  | 
 | 
| 79 | 
  | 
  | 
  vector<float> _bins; | 
| 80 | 
  | 
  | 
  vector<unsigned int> _selVector; | 
| 81 | 
  | 
  | 
  vector<unsigned int> _detVector; | 
| 82 | 
  | 
  | 
 | 
| 83 | 
  | 
  | 
  unsigned int _outUp, _outDown; | 
| 84 | 
  | 
  | 
 | 
| 85 | 
  | 
  | 
}; | 
| 86 | 
  | 
  | 
 | 
| 87 | 
  | 
  | 
#endif /* BINNEDEFFCOLLECTION_H_ */ |