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

Contents of /PamCut/CollectionActions/RigFillAction/RigFillAction.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Thu Mar 11 19:11:02 2010 UTC (14 years, 9 months ago) by pam-fi
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +0 -0 lines
File MIME type: text/plain
Error occurred while calculating annotation data.
FILE REMOVED
Replaced by a Histo2D-inherited version.

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

  ViewVC Help
Powered by ViewVC 1.1.23