/* * 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 event rigidity modulus * and threshold rigidity. Each 2D bin will contain the number of events whose * event 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 whose threshold rigidity is below the lower limit of the bins are recorded in a vector * of event rigidities with threshold rigidity in the "inferior threshold bin", which ranges * from zero to the the lowest threshold rigidity of the "normal" bins. * Events are discarded only if their rigidity modulus or threshold rigidity lies * outside the histogram boundaries. * * CUT DEPENDENCIES: 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. "-report" will be also added for the report file (in which * the content of the zero bins will be saved). 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. If "" is given as name, * no file output will be performed. * @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 Constructor. * * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output * and .root for ROOT output. "-report" will be also added for the report file (in which * the content of the zero bins will be saved). outFileBase has to contain the path (otherwise, * files will be saved in the current directory). * * @param actionName The action's name. * @param outFileBase The output file base name. If "" is given as name, * no file output will be performed. * @param bins A vector containing the bins limits. * @param thresholdCoeff The threshold coefficient for critical rigidity. */ RigFillAction(const char *actionName, TString outFileBase, vector &bins, float thresholdCoeff); /*! @brief Destructor */ ~RigFillAction() { } /*! @brief Fills histogram with the selected event. * * The current event will be added to the event rigidity bin corresponding to its event rigidity R and to the threshold bin corresponding to the Stoermer cutoff rigidity (S) multiplied by the threshold coefficient. * * @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 contains the number of analyzed events * whose event rigidity modulus falls in the i-th normal rigidity bin and whose threshold rigidity falls in the j-th normal bin. * * @return The rigidity modulus - threshold rigidity 2D histogram. */ SimpleMatrix& GetHistoThreshNormBins() { return _textHisto; } /*! @brief whose [i] element contains the number of analyzed events whose event rigidity modulus falls in the i-th normal rigidity bin, and whose threshold rigidity falls in any normal bin */ vector& GetTotalHistoThreshNormBins() { return _totalTextHisto; } /*! @brief Returns the vector whose [i] element contains the number of analyzed events whose event rigidity modulus falls in the i-th normal rigidity bin, and whose threshold rigidity falls in the inferior bin */ vector& GetHistoThreshInfBin() { return _zeroCutoffBins; } private: TString _outFileBase; vector _bins; TH2I _rootHisto; SimpleMatrix _textHisto; vector _zeroCutoffBins; vector _totalTextHisto; float _thresholdCoeff; void _InitHistos(vector &bins); }; #endif /* RIGFILLACTION_H_ */