/[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.2 - (show annotations) (download)
Wed Aug 5 17:05:01 2009 UTC (16 years, 4 months ago) by pam-fi
Branch: MAIN
Changes since 1.1: +32 -5 lines
File MIME type: text/plain
Constructor added;  now save on file is optional.

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 rigidity modulus
20 * and threshold rigidity. Each 2D bin will contain the number of events whose
21 * rigidity modulus and threshold rigidity (eg., Stoermer cutoff rigidity times a threshold coefficient)
22 * lie in that bin. Note that the meaning of this threshold coefficient is the same as in
23 * TrkRigGeoCut, so it must have the same value used for TrkRigGeoCut (consider
24 * using TrkRigGeoCut::GetThresholdCoeff() to retrieve its value).
25 * Events whose critical rigidity is below the lower limit of the axis are recorded in a vector of
26 * "zero bins", which range from zero to the the lowest critical rigidity.
27 * Events are discarded only if their rigidity modulus or cutoff rigidity lies
28 * outside the histogram bounds.
29 *
30 * CUT DEPENDECIES: TrkPhSinCut for single physical track, TrkRigGeoCut for galactic event.
31 *
32 */
33 class RigFillAction: public CollectionAction {
34
35 public:
36 /*! @brief Constructor.
37 *
38 * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output
39 * and .root for ROOT output. "-report" will be also added for the report file (in which
40 * the content of the zero bins will be saved). outFileBase has to contain the path (otherwise,
41 * files will be saved in the current directory).
42 * The file containing the rigidity bins must be a text file. It must contain both the
43 * lower and upper limits of the rigidity axis, so that if it contains N values it
44 * defines a set of N-1 bins.
45 *
46 * @param actionName The action's name.
47 * @param outFileBase The output file base name. If "" is given as name,
48 * no file output will be performed.
49 * @param rigBinsFile The file containing the rigidity bins
50 * @param thresholdCoeff The threshold coefficient for critical rigidity.
51 */
52 RigFillAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff);
53
54 /*! @brief Constructor.
55 *
56 * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output
57 * and .root for ROOT output. "-report" will be also added for the report file (in which
58 * the content of the zero bins will be saved). outFileBase has to contain the path (otherwise,
59 * files will be saved in the current directory).
60 *
61 * @param actionName The action's name.
62 * @param outFileBase The output file base name. If "" is given as name,
63 * no file output will be performed.
64 * @param bins A vector containing the bins limits.
65 * @param thresholdCoeff The threshold coefficient for critical rigidity.
66 */
67 RigFillAction(const char *actionName, TString outFileBase, vector<float> &bins, float thresholdCoeff);
68
69 /*! @brief Destructor */
70 ~RigFillAction() {
71 }
72
73 /*! @brief Fills histogram with the selected event.
74 *
75 * The current event will be added to the bin corresponding to its rigidity and critical rigidity multiplied
76 * by the threshold coefficient, eg., to the bin (Rc*threshold, R).
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 contain the number of analyzed events
93 * whose rigidity modulus falls in the i-th rigidity bin and whose threshold rigidity multiplied by the
94 * threshold falls in the j-th rigidity bin.
95 *
96 * @return The rigidity modulus - threshold rigidity 2D histogram.
97 */
98 SimpleMatrix<UInt_t>& GetHisto() {
99 return _textHisto;
100 }
101
102 /*! @brief Returns the vector of cutoff rigidity zero bins */
103 vector<UInt_t>& GetCutoffZeroBins() {
104 return _zeroCutoffBins;
105 }
106
107 private:
108
109 TString _outFileBase;
110 vector<float> _bins;
111 TH2I _rootHisto;
112 SimpleMatrix<UInt_t> _textHisto;
113 vector<UInt_t> _zeroCutoffBins;
114 float _thresholdCoeff;
115
116 void _InitHistos(vector<float> &bins);
117
118 };
119 #endif /* RIGFILLACTION_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23