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 |
pam-fi |
1.3 |
* Another functionality of this action is the correction of deflection for residual misalignment when |
31 |
|
|
* selecting data with a fixed MDR cut (which reduces the effective tracker geometry and thus brings up |
32 |
|
|
* some residual misalignment). |
33 |
pam-fi |
1.1 |
* For output file naming conventions, see #Finalize. |
34 |
|
|
* |
35 |
|
|
* CUT DEPENDENCIES: TrkPhSinCut for single physical track, TrkRigGeoCut for galactic event. |
36 |
|
|
* |
37 |
|
|
*/ |
38 |
pam-fi |
1.3 |
class RigFillAction: public Histo2DAction<Float_t> { |
39 |
pam-fi |
1.1 |
|
40 |
|
|
public: |
41 |
|
|
/*! @brief Constructor. |
42 |
|
|
* |
43 |
|
|
* outFileBase is the base name for output file: #Finalize will add ".txt" for the matrix histogram, |
44 |
|
|
* "-InfBins.txt" for the critical rigidity underflow and "-Spillover.txt" for the (spillover + rigidity overflow). |
45 |
|
|
* outFileBase has to contain the path (otherwise, files will be saved in the current directory). |
46 |
|
|
* The file containing the rigidity bins must be a text file. It must contain both the |
47 |
|
|
* lower and upper limits of the rigidity axis, so that if it contains N values it |
48 |
|
|
* defines a set of N-1 bins. |
49 |
|
|
* |
50 |
|
|
* @param actionName The action's name. |
51 |
|
|
* @param outFileBase The output file base name. If "" is given as name, no file will be produced. |
52 |
|
|
* @param rigBinsFile The file containing the rigidity bins |
53 |
|
|
* @param thresholdCoeff The threshold coefficient for critical rigidity. |
54 |
|
|
* @param chargeSign The sign of the rigidity of the particles that will fill the histograms. The |
55 |
|
|
* particles with opposite sign will be discarded (except,for spillover events, eventually). |
56 |
|
|
* See also aliases for positive and negative signs in CommonDefs.h. |
57 |
|
|
* @param spilloverFlag If true, spillover events (defined by spilloverLimit) will be not discarded and |
58 |
|
|
* added to the highest bin. |
59 |
|
|
* @param spilloverLimit The inferior limit of the spillover rigidities (absolute value). |
60 |
pam-fi |
1.3 |
* @param mdrMin The fixed MDR cut (in GV) applied to data before this action, and for which the measured rigidity |
61 |
|
|
* will be corrected. See the implementation of #OnGood for details about the correction calculation. |
62 |
|
|
* No correction will be applied if this parameter is set to 0. |
63 |
|
|
* |
64 |
pam-fi |
1.1 |
*/ |
65 |
|
|
RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff, |
66 |
pam-fi |
1.3 |
float chargeSign = POSITIVE, bool spilloverFlag = false, float spilloverLimit = 0, float mdrMin = 0.); |
67 |
pam-fi |
1.1 |
|
68 |
|
|
/*! @brief Constructor. |
69 |
|
|
* |
70 |
|
|
* outFileBase is the base name for output file: #Finalize will add .txt for ASCII output |
71 |
|
|
* and .root for ROOT output. "-report" will be also added for the report file (in which |
72 |
|
|
* the content of the zero bins will be saved). outFileBase has to contain the path (otherwise, |
73 |
|
|
* files will be saved in the current directory). |
74 |
|
|
* |
75 |
|
|
* @param actionName The action's name. |
76 |
|
|
* @param outFileBase The output file base name. If "" is given as name, no file will be produced. |
77 |
|
|
* @param bins A vector containing the bins limits. |
78 |
|
|
* @param thresholdCoeff The threshold coefficient for critical rigidity. |
79 |
|
|
* @param chargeSign The sign of the rigidity of the particles that will fill the histograms. The |
80 |
|
|
* particles with opposite sign will be discarded (except for spillover events, eventually). |
81 |
|
|
* @param spilloverFlag If true, spillover events (defined by spilloverLimit) will be not discarded and |
82 |
|
|
* added to the highest bin. |
83 |
|
|
* @param spilloverLimit The inferior limit of the spillover rigidities (absolute value). |
84 |
pam-fi |
1.3 |
* @param mdrMin The fixed MDR cut (in GV) applied to data before this action, and for which the measured rigidity |
85 |
|
|
* will be corrected. See the implementation of #OnGood for details about the correction calculation. |
86 |
|
|
* No correction will be applied if this parameter is set to 0. |
87 |
pam-fi |
1.1 |
*/ |
88 |
|
|
RigFillAction(const char *actionName, TString outFileBase, vector<float> &bins, float thresholdCoeff, |
89 |
pam-fi |
1.3 |
float chargeSign = POSITIVE, bool spilloverFlag = false, float spilloverLimit = 0, float mdrMin = 0.); |
90 |
pam-fi |
1.1 |
|
91 |
|
|
/*! @brief Destructor */ |
92 |
|
|
~RigFillAction() { |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
/*! @brief Fills histogram with the selected event. |
96 |
|
|
* |
97 |
|
|
* The current event will be added to the event rigidity bin corresponding to its event rigidity R and to the |
98 |
|
|
* threshold bin corresponding to the Stoermer cutoff rigidity (S) multiplied by the threshold coefficient. |
99 |
|
|
* |
100 |
|
|
* @param event The selected event. |
101 |
|
|
*/ |
102 |
|
|
void OnGood(PamLevel2 *event); |
103 |
|
|
|
104 |
|
|
/*! @brief Writes the output files. |
105 |
|
|
* |
106 |
|
|
* The output consists of: 1) a text file where the 2-dimensional histogram is saved. The first row of the |
107 |
|
|
* text file is the lowest rigidity bin, the second is the next bin and so on, so in the text output the positive |
108 |
|
|
* direction of the rigidity axis (Y axis) is downwards; 2) a text file with postfix "-InfBins.txt" where the |
109 |
|
|
* critical rigidity underflow array is saved (it will contain a number of entries equal to the number of bins); |
110 |
|
|
* 3) eventually, a text file with postfix "-Spillover.txt" where the (spillover + rigidity overflow) array is saved |
111 |
|
|
* (this array will contain one element more than the previous one, which is the (spillover + rigidity overflow) for the |
112 |
|
|
* critical rigidity underflow, and will be the first). |
113 |
|
|
*/ |
114 |
|
|
void Finalize(); |
115 |
|
|
|
116 |
|
|
private: |
117 |
|
|
|
118 |
|
|
float _thresholdCoeff; |
119 |
|
|
float _chargeSign; |
120 |
|
|
bool _spilloverFlag; |
121 |
|
|
float _spilloverLimit; |
122 |
pam-fi |
1.3 |
float _mdrMin; |
123 |
pam-fi |
1.1 |
}; |
124 |
|
|
#endif /* RIGFILLACTION_H_ */ |