/[PAMELA software]/PamCut/CollectionActions/RigFillAction/RigFillAction.h
ViewVC logotype

Annotation of /PamCut/CollectionActions/RigFillAction/RigFillAction.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Wed Aug 26 16:34:15 2009 UTC (15 years, 3 months ago) by pam-fi
Branch: MAIN
Changes since 1.2: +18 -15 lines
File MIME type: text/plain
*** empty log message ***

1 pam-fi 1.1 /*
2     * RigFillAction.h
3     *
4     * Created on: 14/lug/2009
5     * Author: Nicola Mori
6     */
7    
8     /*! @file RigFillAction.h The RigFillAction class declaration file */
9    
10     #ifndef RIGFILLACTION_H_
11     #define RIGFILLACTION_H_
12    
13     #include "../CollectionAction/CollectionAction.h"
14     #include <TH2I.h>
15     #include <stdint.h>
16    
17     /*! @brief The rigidity vs threshold rigidity histogram filling.
18     *
19 pam-fi 1.3 * This class builds a 2D histogram binned in event rigidity modulus
20 pam-fi 1.1 * and threshold rigidity. Each 2D bin will contain the number of events whose
21 pam-fi 1.3 * 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
22 pam-fi 1.1 * TrkRigGeoCut, so it must have the same value used for TrkRigGeoCut (consider
23     * using TrkRigGeoCut::GetThresholdCoeff() to retrieve its value).
24 pam-fi 1.3 * Events whose threshold rigidity is below the lower limit of the bins are recorded in a vector of
25     * event rigidities with threshold rigidity in the "inferior threshold bin", which ranges from zero to the the lowest threshold rigidity of the "normal" bins.
26     * Events are discarded only if their rigidity modulus or threshold rigidity lies
27     * outside the histogram boundaries.
28 pam-fi 1.1 *
29     * CUT DEPENDECIES: TrkPhSinCut for single physical track, TrkRigGeoCut for galactic event.
30     *
31     */
32     class RigFillAction: public CollectionAction {
33    
34     public:
35     /*! @brief Constructor.
36     *
37     * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output
38 pam-fi 1.2 * and .root for ROOT output. "-report" will be also added for the report file (in which
39     * the content of the zero bins will be saved). outFileBase has to contain the path (otherwise,
40     * files will be saved in the current directory).
41 pam-fi 1.1 * The file containing the rigidity bins must be a text file. It must contain both the
42     * lower and upper limits of the rigidity axis, so that if it contains N values it
43     * defines a set of N-1 bins.
44     *
45     * @param actionName The action's name.
46 pam-fi 1.2 * @param outFileBase The output file base name. If "" is given as name,
47     * no file output will be performed.
48     * @param rigBinsFile The file containing the rigidity bins
49 pam-fi 1.1 * @param thresholdCoeff The threshold coefficient for critical rigidity.
50     */
51     RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff);
52    
53 pam-fi 1.2 /*! @brief Constructor.
54     *
55     * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output
56     * and .root for ROOT output. "-report" will be also added for the report file (in which
57     * the content of the zero bins will be saved). outFileBase has to contain the path (otherwise,
58     * files will be saved in the current directory).
59     *
60     * @param actionName The action's name.
61     * @param outFileBase The output file base name. If "" is given as name,
62     * no file output will be performed.
63     * @param bins A vector containing the bins limits.
64     * @param thresholdCoeff The threshold coefficient for critical rigidity.
65     */
66     RigFillAction(const char *actionName, TString outFileBase, vector<float> &bins, float thresholdCoeff);
67    
68 pam-fi 1.1 /*! @brief Destructor */
69     ~RigFillAction() {
70     }
71    
72     /*! @brief Fills histogram with the selected event.
73     *
74 pam-fi 1.3 * 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.
75 pam-fi 1.1 *
76     * @param event The selected event.
77     */
78     void OnGood(PamLevel2 *event);
79    
80     /*! @brief Writes the histogram to the output files (ASCII and ROOT).
81     *
82     * The output consists of a text file and of a ROOT file where the 2-dimensional histogram (TH2F) is
83     * saved. The first row of the text file is the lowest rigidity bin, the second is the next bin and so on, so
84     * in the text output the positive direction of the rigidity axis (Y axis) is downwards.
85     */
86     void Finalize();
87    
88     /*! @brief Returns the histogram.
89     *
90 pam-fi 1.3 * This method returns a SimpleMatrix. Its [i][j] element contains the number of analyzed events
91     * whose event rigidity modulus falls in the i-th normal rigidity bin and whose threshold rigidity falls in the j-th normal bin.
92 pam-fi 1.1 *
93     * @return The rigidity modulus - threshold rigidity 2D histogram.
94     */
95 pam-fi 1.3 SimpleMatrix<UInt_t>& GetHistoThreshNormBins() {
96 pam-fi 1.1 return _textHisto;
97     }
98    
99 pam-fi 1.3 /*! @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 */
100     vector<UInt_t>& GetTotalHistoThreshNormBins() {
101     return _totalTextHisto;
102     }
103    
104     /*! @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 */
105     vector<UInt_t>& GetHistoThreshInfBin() {
106 pam-fi 1.2 return _zeroCutoffBins;
107     }
108    
109 pam-fi 1.1 private:
110    
111     TString _outFileBase;
112     vector<float> _bins;
113     TH2I _rootHisto;
114     SimpleMatrix<UInt_t> _textHisto;
115 pam-fi 1.2 vector<UInt_t> _zeroCutoffBins;
116 pam-fi 1.3 vector<UInt_t> _totalTextHisto;
117 pam-fi 1.1 float _thresholdCoeff;
118    
119 pam-fi 1.2 void _InitHistos(vector<float> &bins);
120    
121 pam-fi 1.1 };
122     #endif /* RIGFILLACTION_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23