/* * RigFillAction.h * * Created on: 14/lug/2009 * Author: Nicola Mori */ /*! @file RigFillAction.h The RigFillAction class declaration file */ #ifndef RIGFILLACTION_H_ #define RIGFILLACTION_H_ #include "../CollectionAction/CollectionAction.h" #include #include /*! @brief The rigidity vs threshold rigidity histogram filling. * * This class builds a 2D histogram binned in rigidity modulus * and threshold rigidity. Each 2D bin will contain the number of events whose * rigidity modulus and threshold rigidity (eg., Stoermer cutoff rigidity times a threshold coefficient) * lie in that bin. Note that the meaning of this threshold coefficient is the same as in * TrkRigGeoCut, so it must have the same value used for TrkRigGeoCut (consider * using TrkRigGeoCut::GetThresholdCoeff() to retrieve its value). * Events are discarded only if their rigidity modulus or cutoff rigidity lies * outside the histogram bounds. * * CUT DEPENDECIES: TrkPhSinCut for single physical track, TrkRigGeoCut for galactic event. * */ class RigFillAction: public CollectionAction { public: /*! @brief Constructor. * * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output * and .root for ROOT output. outFileBase has to contain the path (otherwise, files will be * saved in the current directory). * The file containing the rigidity bins must be a text file. It must contain both the * lower and upper limits of the rigidity axis, so that if it contains N values it * defines a set of N-1 bins. * * @param actionName The action's name. * @param outFileBase The output file base name. * @param rigBinsFile The file containing the rigidity bins. * @param thresholdCoeff The threshold coefficient for critical rigidity. */ RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff); /*! @brief Destructor */ ~RigFillAction() { } /*! @brief Fills histogram with the selected event. * * The current event will be added to the bin corresponding to its rigidity and critical rigidity multiplied * by the threshold coefficient, eg., to the bin (Rc*threshold, R). * * @param event The selected event. */ void OnGood(PamLevel2 *event); /*! @brief Writes the histogram to the output files (ASCII and ROOT). * * The output consists of a text file and of a ROOT file where the 2-dimensional histogram (TH2F) is * saved. The first row of the text file is the lowest rigidity bin, the second is the next bin and so on, so * in the text output the positive direction of the rigidity axis (Y axis) is downwards. */ void Finalize(); /*! @brief Returns the histogram. * * This method returns a SimpleMatrix. Its [i][j] element contain the number of analyzed events * whose rigidity modulus falls in the i-th rigidity bin and whose threshold rigidity multiplied by the * threshold falls in the j-th rigidity bin. * * @return The rigidity modulus - threshold rigidity 2D histogram. */ SimpleMatrix &GetHisto() { return _textHisto; } private: TString _outFileBase; vector _bins; TH2I _rootHisto; SimpleMatrix _textHisto; float _thresholdCoeff; }; #endif /* RIGFILLACTION_H_ */