1 |
/* |
2 |
* TrkChi2VsDeflHistoAction.h |
3 |
* |
4 |
* Created on: 14/ago/2009 |
5 |
* Author: Nicola Mori |
6 |
*/ |
7 |
|
8 |
/*! @file TrkChi2VsDeflHistoAction.h The TrkChi2VsDeflHistoAction class declaration file. */ |
9 |
|
10 |
#ifndef TRKCHI2VSDEFLHISTOACTION_H_ |
11 |
#define TRKCHI2VSDEFLHISTOACTION_H_ |
12 |
|
13 |
#include "../CollectionAction/CollectionAction.h" |
14 |
#include <TH2F.h> |
15 |
|
16 |
/*! @brief An action that fills a Trk Chi2 Vs Deflection histogram (for global Chi2, Chi2 X and Chi2 Y). */ |
17 |
class TrkChi2VsDeflHistoAction: public CollectionAction { |
18 |
public: |
19 |
|
20 |
/*! @brief Constructor. |
21 |
* |
22 |
* @param actionName The action's name. |
23 |
* @param outFileName The output file name. |
24 |
* @param mode The mode of ROOT file creation (see documentation of TFile constructor |
25 |
* in ROOT's reference guide). |
26 |
* @param logChi2 If true, log10(chi2) is used for the Y axis (linear scale). Notice that minChi2 and maxChi2 |
27 |
* must still be specified using chi2 values and NOT log10(chi2) values. |
28 |
* @param minDefl The lower limit for deflection axis (in GV^-1). |
29 |
* @param maxDefl The upper limit for deflection axis (in GV^-1). |
30 |
* @param nBinsDefl The number of deflection bins. |
31 |
* @param minChi2 The lower limit for chi2 axis. |
32 |
* @param maxChi2 The upper limit for chi2 axis. |
33 |
* @param nBinsChi2 The number of chi2 bins. |
34 |
|
35 |
*/ |
36 |
TrkChi2VsDeflHistoAction(const char *actionName, TString outFileName, TString mode = "UPDATE", bool logChi2 = false, |
37 |
float minDefl = 0.001, float maxDefl = 3.5, unsigned int nBinsDefl = 1000, float minChi2 = 0.01, float maxChi2 = |
38 |
1e7, unsigned int nBinsChi2 = 1000); |
39 |
|
40 |
/*! @brief Destructor. */ |
41 |
~TrkChi2VsDeflHistoAction() { |
42 |
|
43 |
if (!_histoX) { |
44 |
delete _histoX; |
45 |
_histoX = NULL; |
46 |
} |
47 |
|
48 |
if (!_histoY) { |
49 |
delete _histoY; |
50 |
_histoY = NULL; |
51 |
} |
52 |
} |
53 |
|
54 |
/*! @brief Fills histogram with the selected event. |
55 |
* |
56 |
* @param event The selected event. |
57 |
*/ |
58 |
void OnGood(PamLevel2 *event); |
59 |
|
60 |
/*! @brief Writes the histogram to the output ROOT file.*/ |
61 |
void Finalize(); |
62 |
|
63 |
/*! @brief Returns the histogram. |
64 |
* |
65 |
* @return A pointer to the TH2F chi2 vs deflection histogram. |
66 |
*/ |
67 |
TH2F *GetHisto() { |
68 |
return &_histo; |
69 |
} |
70 |
|
71 |
private: |
72 |
|
73 |
TString _outFileName; |
74 |
TH2F _histo; |
75 |
TH2F *_histoX, *_histoY; |
76 |
TString _mode; |
77 |
bool _logChi2; |
78 |
|
79 |
streambuf *_cout_sbuf; |
80 |
ofstream _fout; |
81 |
}; |
82 |
|
83 |
#endif /* TRKCHI2VSDEFLHISTOACTION_H_ */ |