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 |
|
|
* @param outOptions The file containing the rigidity bins |
39 |
|
|
*/ |
40 |
|
|
FluxHistoAction(const char *actionName, TString outFileBase, TString rigBinsFile); |
41 |
|
|
|
42 |
|
|
/*! @brief Destructor */ |
43 |
|
|
~FluxHistoAction() { |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
/*! @brief Fills histogram with the selected event. |
47 |
|
|
* |
48 |
|
|
* @param event The selected event. |
49 |
|
|
*/ |
50 |
|
|
void OnGood(PamLevel2 *event); |
51 |
|
|
|
52 |
|
|
/*! @brief Writes the histogram to the output files (ASCII and ROOT). |
53 |
|
|
* |
54 |
|
|
* The output consists of a text file and of a ROOT file where the 1-dimensional rigidity |
55 |
|
|
* histogram (TH1F) is saved. The format of the text output is: (lower bin limit) (upper bin limit) (\# of events). |
56 |
|
|
*/ |
57 |
|
|
void Finalize(); |
58 |
|
|
|
59 |
|
|
private: |
60 |
|
|
|
61 |
|
|
TString _outFileBase; |
62 |
|
|
vector<float> _bins; |
63 |
|
|
TH1I _rootHisto; |
64 |
|
|
vector<uint64_t> _textHisto; |
65 |
|
|
|
66 |
|
|
#ifdef DEBUGPAMCUT |
67 |
|
|
int _outUp, _outDown; |
68 |
|
|
#endif |
69 |
|
|
|
70 |
|
|
}; |
71 |
|
|
|
72 |
|
|
#endif /* FLUXHISTOACTION_H_ */ |