| 1 | /* | 
| 2 | * CaloChi2HistoAction.h | 
| 3 | * | 
| 4 | *  Created on: 04/ago/2009 | 
| 5 | *      Author: Nicola Mori | 
| 6 | */ | 
| 7 |  | 
| 8 | /*! @file CaloChi2HistoAction.h The CaloChi2HistoAction class declaration file. */ | 
| 9 |  | 
| 10 | #ifndef NO_CALOAXIS | 
| 11 |  | 
| 12 | #ifndef CALOCHI2HISTOACTION_H_ | 
| 13 | #define CALOCHI2HISTOACTION_H_ | 
| 14 |  | 
| 15 | #include "../CollectionAction/CollectionAction.h" | 
| 16 | #include <CaloAxis.h> | 
| 17 | #include <TH1F.h> | 
| 18 | #include <TH2F.h> | 
| 19 |  | 
| 20 | /*! @brief An action that fills a CALO Chi2 histogram. The value of Chi2 is obtained from CaloAxis objects. */ | 
| 21 | class CaloChi2HistoAction: public CollectionAction { | 
| 22 | public: | 
| 23 |  | 
| 24 | /*! @brief Constructor. | 
| 25 | * | 
| 26 | * Note that this action does NOT perform the fit of the CALO track, so the fitting procedure must be already done by the | 
| 27 | * CaloAxis objects pointed by xAxis and yAxis. | 
| 28 | * | 
| 29 | * @param actionName The action's name. | 
| 30 | * @param outFileName The output file name. | 
| 31 | * @param xAxis The X axis CaloAxis object. | 
| 32 | * @param yAxis The Y axis CaloAxis object. | 
| 33 | * @param min The lower limit of the histogram's X axis. | 
| 34 | * @param max The upper limit of the histogram's X axis. | 
| 35 | * @param nBins The number of bins. | 
| 36 | * @param logBinning If true, logarithmically-spaced bins will be used. | 
| 37 | * @param mode The mode of ROOT file creation (see documentation of TFile constructor | 
| 38 | *             in ROOT's reference guide). | 
| 39 | */ | 
| 40 | CaloChi2HistoAction(const char *actionName, TString outFileName, CaloAxis *xAxis, CaloAxis *yAxis, float min = 0., | 
| 41 | float max = 1., unsigned int nBins = 100, bool logBinning = false, TString mode = "UPDATE"); | 
| 42 |  | 
| 43 | /*! @brief Destructor. */ | 
| 44 | ~CaloChi2HistoAction() { | 
| 45 | } | 
| 46 |  | 
| 47 | /*! @brief Fills histogram with the selected event. | 
| 48 | * | 
| 49 | * @param event The selected event. | 
| 50 | */ | 
| 51 | void OnGood(PamLevel2 *event); | 
| 52 |  | 
| 53 | /*! @brief Writes the histogram to the output ROOT file.*/ | 
| 54 | void Finalize(); | 
| 55 |  | 
| 56 | private: | 
| 57 |  | 
| 58 | TString _outFileName; | 
| 59 | CaloAxis *_xAxis, *_yAxis; | 
| 60 | TString _mode; | 
| 61 | TH1F _xHisto, _yHisto; | 
| 62 | TH2F _xyHisto; | 
| 63 | }; | 
| 64 | #endif /* CALOCHI2HISTOACTION_H_ */ | 
| 65 | #endif /* NO_CALOAXIS */ |