1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* FluxHistoAction.h |
3 |
|
|
* |
4 |
|
|
* Created on: 20-mag-2009 |
5 |
|
|
* Author: Nicola Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file FluxHistoAction.h The FluxHistoAction class declaration file */ |
9 |
|
|
|
10 |
|
|
#ifndef FLUXHISTOACTION_H_ |
11 |
|
|
#define FLUXHISTOACTION_H_ |
12 |
|
|
|
13 |
|
|
#include "../CollectionAction/CollectionAction.h" |
14 |
|
|
#include <TH1I.h> |
15 |
|
|
#include <stdint.h> |
16 |
|
|
|
17 |
|
|
/*! @brief An action that fills a flux histogram. |
18 |
|
|
* |
19 |
|
|
* This action reads a rigidity binning from a file and fills a flux histogram (text and ROOT format). |
20 |
|
|
* Currently, it fills an event-count histogram: in future implementations, it could also |
21 |
|
|
* read live time, efficiency and geometrical factor from external files and fill a |
22 |
|
|
* true flux histogram. |
23 |
|
|
*/ |
24 |
|
|
class FluxHistoAction: public CollectionAction { |
25 |
|
|
|
26 |
|
|
public: |
27 |
|
|
/*! @brief Constructor. |
28 |
|
|
* |
29 |
|
|
* outFileBase is the base name for output file: #Finalize will add .txt for ASCII output |
30 |
|
|
* and .root for ROOT output. outFileBase has to contain the path (otherwise, files will be |
31 |
|
|
* saved in the current directory). |
32 |
|
|
* The file containing the rigidity bins must be a text file. It must contain both the |
33 |
|
|
* lower and upper limits of the rigidity axis, so that if it contains N values it |
34 |
|
|
* defines a set of N-1 bins. |
35 |
|
|
* |
36 |
|
|
* @param actionName The action's name. |
37 |
|
|
* @param outFileBase The output file base name. |
38 |
pam-fi |
1.3 |
* @param rigBinsFile The file containing the rigidity bins. |
39 |
|
|
* @param mode The mode of ROOT file creation (see documentation of TFile constructor |
40 |
|
|
* in ROOT's reference guide). In current implementation the text file output |
41 |
|
|
* does not support append. |
42 |
pam-fi |
1.1 |
*/ |
43 |
pam-fi |
1.3 |
FluxHistoAction(const char *actionName, TString outFileBase, TString rigBinsFile, TString mode = "UPDATE"); |
44 |
pam-fi |
1.1 |
|
45 |
|
|
/*! @brief Destructor */ |
46 |
|
|
~FluxHistoAction() { |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
/*! @brief Fills histogram with the selected event. |
50 |
|
|
* |
51 |
|
|
* @param event The selected event. |
52 |
|
|
*/ |
53 |
|
|
void OnGood(PamLevel2 *event); |
54 |
|
|
|
55 |
|
|
/*! @brief Writes the histogram to the output files (ASCII and ROOT). |
56 |
|
|
* |
57 |
|
|
* The output consists of a text file and of a ROOT file where the 1-dimensional rigidity |
58 |
|
|
* histogram (TH1F) is saved. The format of the text output is: (lower bin limit) (upper bin limit) (\# of events). |
59 |
|
|
*/ |
60 |
|
|
void Finalize(); |
61 |
|
|
|
62 |
|
|
private: |
63 |
|
|
|
64 |
|
|
TString _outFileBase; |
65 |
|
|
vector<float> _bins; |
66 |
|
|
TH1I _rootHisto; |
67 |
|
|
vector<uint64_t> _textHisto; |
68 |
pam-fi |
1.3 |
TString _mode; |
69 |
pam-fi |
1.1 |
|
70 |
|
|
#ifdef DEBUGPAMCUT |
71 |
|
|
int _outUp, _outDown; |
72 |
|
|
#endif |
73 |
|
|
|
74 |
|
|
}; |
75 |
|
|
|
76 |
|
|
#endif /* FLUXHISTOACTION_H_ */ |