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 chargeSign The sign of the rigidity of the particles that will fill the histograms. The |
52 |
* particles with opposite sign will be discarded (except,for spillover events, eventually). |
53 |
* See also aliases for positive and negative signs in CommonDefs.h. |
54 |
* @param spilloverFlag If true, spillover events (defined by spilloverLimit) will be not discarded and |
55 |
* added to the highest bin. |
56 |
* @param spilloverLimit The inferior limit of the spillover rigidities (absolute value). |
57 |
*/ |
58 |
RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff, |
59 |
float chargeSign = POSITIVE, bool spilloverFlag = false, float spilloverLimit = 0); |
60 |
|
61 |
/*! @brief Constructor. |
62 |
* |
63 |
* outFileBase is the base name for output file: #Finalize will add .txt for ASCII output |
64 |
* and .root for ROOT output. "-report" will be also added for the report file (in which |
65 |
* the content of the zero bins will be saved). outFileBase has to contain the path (otherwise, |
66 |
* files will be saved in the current directory). |
67 |
* |
68 |
* @param actionName The action's name. |
69 |
* @param outFileBase The output file base name. If "" is given as name, no file will be produced. |
70 |
* @param bins A vector containing the bins limits. |
71 |
* @param thresholdCoeff The threshold coefficient for critical rigidity. |
72 |
* @param chargeSign The sign of the rigidity of the particles that will fill the histograms. The |
73 |
* particles with opposite sign will be discarded (except for spillover events, eventually). |
74 |
* @param spilloverFlag If true, spillover events (defined by spilloverLimit) will be not discarded and |
75 |
* added to the highest bin. |
76 |
* @param spilloverLimit The inferior limit of the spillover rigidities (absolute value). |
77 |
*/ |
78 |
RigFillAction(const char *actionName, TString outFileBase, vector<float> &bins, float thresholdCoeff, |
79 |
float chargeSign = POSITIVE, bool spilloverFlag = false, float spilloverLimit = 0); |
80 |
|
81 |
/*! @brief Destructor */ |
82 |
~RigFillAction() { |
83 |
} |
84 |
|
85 |
/*! @brief Fills histogram with the selected event. |
86 |
* |
87 |
* The current event will be added to the event rigidity bin corresponding to its event rigidity R and to the |
88 |
* threshold bin corresponding to the Stoermer cutoff rigidity (S) multiplied by the threshold coefficient. |
89 |
* |
90 |
* @param event The selected event. |
91 |
*/ |
92 |
void OnGood(PamLevel2 *event); |
93 |
|
94 |
/*! @brief Writes the output files. |
95 |
* |
96 |
* The output consists of: 1) a text file where the 2-dimensional histogram is saved. The first row of the |
97 |
* text file is the lowest rigidity bin, the second is the next bin and so on, so in the text output the positive |
98 |
* direction of the rigidity axis (Y axis) is downwards; 2) a text file with postfix "-InfBins.txt" where the |
99 |
* critical rigidity underflow array is saved (it will contain a number of entries equal to the number of bins); |
100 |
* 3) eventually, a text file with postfix "-Spillover.txt" where the (spillover + rigidity overflow) array is saved |
101 |
* (this array will contain one element more than the previous one, which is the (spillover + rigidity overflow) for the |
102 |
* critical rigidity underflow, and will be the first). |
103 |
*/ |
104 |
void Finalize(); |
105 |
|
106 |
private: |
107 |
|
108 |
float _thresholdCoeff; |
109 |
float _chargeSign; |
110 |
bool _spilloverFlag; |
111 |
float _spilloverLimit; |
112 |
|
113 |
}; |
114 |
#endif /* RIGFILLACTION_H_ */ |