/* * FluxHistoAction.h * * Created on: 20-mag-2009 * Author: Nicola Mori */ /*! @file FluxHistoAction.h The FluxHistoAction class declaration file */ #ifndef FLUXHISTOACTION_H_ #define FLUXHISTOACTION_H_ #include "../CollectionAction/CollectionAction.h" #include #include /*! @brief An action that fills a flux histogram. * * This action reads a rigidity binning from a file and fills a flux histogram (text and ROOT format). * Currently, it fills an event-count histogram: in future implementations, it could also * read live time, efficiency and geometrical factor from external files and fill a * true flux histogram. */ class FluxHistoAction: 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 outOptions The file containing the rigidity bins */ FluxHistoAction(const char *actionName, TString outFileBase, TString rigBinsFile); /*! @brief Destructor */ ~FluxHistoAction() { } /*! @brief Fills histogram with the selected event. * * @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 1-dimensional rigidity * histogram (TH1F) is saved. The format of the text output is: (lower bin limit) (upper bin limit) (\# of events). */ void Finalize(); private: TString _outFileBase; vector _bins; TH1I _rootHisto; vector _textHisto; #ifdef DEBUGPAMCUT int _outUp, _outDown; #endif }; #endif /* FLUXHISTOACTION_H_ */