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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Thu Mar 11 19:11:27 2010 UTC (14 years, 9 months ago) by pam-fi
Branch: MAIN
File MIME type: text/plain
Added to repository. Replacing old version.

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 "../Histo2DAction/Histo2DAction.h"
14     //#include <stdint.h>
15    
16     /*! @brief The rigidity vs threshold rigidity histogram filling.
17     *
18     * This class builds a 2D histogram binned in event rigidity modulus (Y axis)
19     * and threshold rigidity (X axis). Each 2D bin will contain the number of events whose
20     * event rigidity modulus and threshold rigidity (eg., Stoermer cutoff rigidity times a
21     * threshold coefficient) lie in that bin. Note that the meaning of this threshold coefficient
22     * is the same as in TrkRigGeoCut, so it must have the same value used for TrkRigGeoCut
23     * (consider using TrkRigGeoCut::GetThresholdCoeff() to retrieve its value).
24     * Events whose threshold rigidity is below the lower limit of the bins are recorded in a vector
25     * of event rigidities with threshold rigidity in the "inferior threshold bin", which ranges
26     * from zero to the the lowest threshold rigidity of the "normal" bins.
27     * It is also possible to recover spillover events. These are defined as events with opposite sign
28     * and absolute rigidity greater than a certain value (specified as a constructors' parameter).
29     * They will be added to the rigidity overflow bins (YOverflow).
30     * For output file naming conventions, see #Finalize.
31     *
32     * CUT DEPENDENCIES: TrkPhSinCut for single physical track, TrkRigGeoCut for galactic event.
33     *
34     */
35     class RigFillAction: public Histo2DAction<Int_t> {
36    
37     public:
38     /*! @brief Constructor.
39     *
40     * outFileBase is the base name for output file: #Finalize will add ".txt" for the matrix histogram,
41     * "-InfBins.txt" for the critical rigidity underflow and "-Spillover.txt" for the (spillover + rigidity overflow).
42     * outFileBase has to contain the path (otherwise, files will be saved in the current directory).
43     * The file containing the rigidity bins must be a text file. It must contain both the
44     * lower and upper limits of the rigidity axis, so that if it contains N values it
45     * defines a set of N-1 bins.
46     *
47     * @param actionName The action's name.
48     * @param outFileBase The output file base name. If "" is given as name, no file will be produced.
49     * @param rigBinsFile The file containing the rigidity bins
50     * @param thresholdCoeff The threshold coefficient for critical rigidity.
51     * @param thresholdCoeff The threshold coefficient for critical rigidity.
52     * @param chargeSign The sign of the rigidity of the particles that will fill the histograms. The
53     * particles with opposite sign will be discarded (except,for spillover events, eventually).
54     * See also aliases for positive and negative signs in CommonDefs.h.
55     * @param spilloverFlag If true, spillover events (defined by spilloverLimit) will be not discarded and
56     * added to the highest bin.
57     * @param spilloverLimit The inferior limit of the spillover rigidities (absolute value).
58     */
59     RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff,
60     float chargeSign = POSITIVE, bool spilloverFlag = false, float spilloverLimit = 0);
61    
62     /*! @brief Constructor.
63     *
64     * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output
65     * and .root for ROOT output. "-report" will be also added for the report file (in which
66     * the content of the zero bins will be saved). outFileBase has to contain the path (otherwise,
67     * files will be saved in the current directory).
68     *
69     * @param actionName The action's name.
70     * @param outFileBase The output file base name. If "" is given as name, no file will be produced.
71     * @param bins A vector containing the bins limits.
72     * @param thresholdCoeff The threshold coefficient for critical rigidity.
73     * @param chargeSign The sign of the rigidity of the particles that will fill the histograms. The
74     * particles with opposite sign will be discarded (except for spillover events, eventually).
75     * @param spilloverFlag If true, spillover events (defined by spilloverLimit) will be not discarded and
76     * added to the highest bin.
77     * @param spilloverLimit The inferior limit of the spillover rigidities (absolute value).
78     */
79     RigFillAction(const char *actionName, TString outFileBase, vector<float> &bins, float thresholdCoeff,
80     float chargeSign = POSITIVE, bool spilloverFlag = false, float spilloverLimit = 0);
81    
82     /*! @brief Destructor */
83     ~RigFillAction() {
84     }
85    
86     /*! @brief Fills histogram with the selected event.
87     *
88     * The current event will be added to the event rigidity bin corresponding to its event rigidity R and to the
89     * threshold bin corresponding to the Stoermer cutoff rigidity (S) multiplied by the threshold coefficient.
90     *
91     * @param event The selected event.
92     */
93     void OnGood(PamLevel2 *event);
94    
95     /*! @brief Writes the output files.
96     *
97     * The output consists of: 1) a text file where the 2-dimensional histogram is saved. The first row of the
98     * text file is the lowest rigidity bin, the second is the next bin and so on, so in the text output the positive
99     * direction of the rigidity axis (Y axis) is downwards; 2) a text file with postfix "-InfBins.txt" where the
100     * critical rigidity underflow array is saved (it will contain a number of entries equal to the number of bins);
101     * 3) eventually, a text file with postfix "-Spillover.txt" where the (spillover + rigidity overflow) array is saved
102     * (this array will contain one element more than the previous one, which is the (spillover + rigidity overflow) for the
103     * critical rigidity underflow, and will be the first).
104     */
105     void Finalize();
106    
107     private:
108    
109     float _thresholdCoeff;
110     float _chargeSign;
111     bool _spilloverFlag;
112     float _spilloverLimit;
113    
114     };
115     #endif /* RIGFILLACTION_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23