/[PAMELA software]/PamCut/CollectionActions/Histo1DActions/LiveTimeAction/LiveTimeAction.h
ViewVC logotype

Contents of /PamCut/CollectionActions/Histo1DActions/LiveTimeAction/LiveTimeAction.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Mar 11 19:11:28 2010 UTC (14 years, 9 months ago) by pam-fi
Branch: MAIN
CVS Tags: Root_V8, MergedToHEAD_1, nuclei_reproc, MergedFromV8_1, BeforeMergingFromV8_1, V9, HEAD
Branch point for: V8
File MIME type: text/plain
Added to repository. Replacing old version.

1 /*
2 * LiveTimeAction.h
3 *
4 * Created on: 13/lug/2009
5 * Author: Nicola Mori
6 */
7
8 /*! @file LiveTimeAction.h The LiveTimeAction class declaration file */
9
10 #ifndef LIVETIMEACTION_H_
11 #define LIVETIMEACTION_H_
12
13 #include "../Histo1DAction/Histo1DAction.h"
14
15 /*! @brief An action that fills a live time histogram.
16 *
17 * This action reads a rigidity binning from a file and fills a live time histogram (text and ROOT format).
18 * The live time corresponding to each event will contribute to the bin corresponding to the cutoff rigidity
19 * of the event, eg., the lowest bin whose lower limit is greater than the cutoff rigidity of the event times
20 * a coefficient (threshold coefficient, see constructor). If threshold*cutoff is lower than the
21 * lower limit of the rigidity axis, then the live time will be added to the "inferior bin", eg., a special bin
22 * ranging from 0 to the lower limit. This special bin will be saved in a separate file.
23 *
24 */
25 class LiveTimeAction: public Histo1DAction<Double_t> {
26
27 public:
28 /*! @brief Constructor.
29 *
30 * outFileBase is the base name for output file: #Finalize will add #GetName() + ".txt" for ASCII output
31 * and #GetName() + ".root" for ROOT output. #GetName + "-report.txt" will be also added for the report file (in which
32 * the content of the inferior bin will be saved). outFileBase has to contain the path (otherwise,
33 * files will be saved in the current directory).
34 * The file containing the rigidity bins must be a text file. It must contain both the
35 * lower and upper limits of the rigidity axis, so that if it contains N values it
36 * defines a set of N-1 bins.
37 *
38 * @param actionName The action's name.
39 * @param outFileBase The output file base name. If "" is given as name,
40 * no file output will be performed.
41 * @param rigBinsFile The file containing the rigidity bins.
42 * @param thresholdCoeff The threshold rigidity coefficient.
43 */
44 LiveTimeAction(const char *actionName, TString outFileBase, TString rigBinsFile, float thresholdCoeff);
45
46 /*! @brief Constructor.
47 *
48 * outFileBase is the base name for output file: #Finalize will add .txt for ASCII output
49 * and .root for ROOT output. "-report" will be also added for the report file (in which
50 * the content of the inferior bin will be saved). outFileBase has to contain the path (otherwise,
51 * files will be saved in the current directory).
52 *
53 * @param actionName The action's name.
54 * @param outFileBase The output file base name. If "" is given as name,
55 * no file output will be performed.
56 * @param bins A vector containing the bins limits.
57 * @param thresholdCoeff The threshold rigidity coefficient.
58 */
59 LiveTimeAction(const char *actionName, TString outFileBase, vector<float> &bins, float thresholdCoeff);
60
61 /*! @brief Destructor */
62 ~LiveTimeAction() {
63 }
64
65 /*! @brief Fills histogram with the selected event.
66 *
67 * @param event The selected event.
68 */
69 void OnGood(PamLevel2 *event);
70
71 /*! @brief Writes the histogram to the output files (ASCII and ROOT).
72 *
73 * The output consists of a text file and of a ROOT file where the 1-dimensional rigidity
74 * histogram (TH1F) is saved. Additionally, another text file will store the content of the "inferior bin"
75 * and the total live time for all the "normal" bins.
76 */
77 void Finalize();
78
79 /*! @brief Returns the total live time (s) spent at threshold rigidities within all "normal" bins (excluding the "inferior bin") */
80 double GetTotalLTHisto() {
81 return _totalNorm;
82 }
83
84 /*! @brief Returns the live time (s) spent at threshold rigidities within the "inferior bin". */
85 double GetLTInfBin() {
86 return GetUnderflow();
87 }
88
89 /*! @brief Returns the number of events at threshold rigidities within all "normal" bins (excluding the "inferior bin") */
90 UInt_t GetNGoodHisto() {
91 return _nGoodHisto;
92 }
93
94 /*! @brief Returns the number of events within the "inferior bin" */
95 UInt_t GetNGoodInfBin() {
96 return _nGoodInfBin;
97 }
98
99 private:
100
101
102 float _thresholdCoeff;
103
104 double _totalNorm;
105 UInt_t _nGoodHisto;
106 UInt_t _nGoodInfBin;
107
108
109 };
110
111 #endif /* LIVETIMEACTION_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23