1 |
/* |
2 |
* RigFillCut.h |
3 |
* |
4 |
* Created on: 27-mar-2009 |
5 |
* Author: Nicola Mori, S. Ricciarini |
6 |
* Last update: 30-apr-2009 |
7 |
*/ |
8 |
|
9 |
/*! @file RigFillCut.h The RigFillCut class definition file */ |
10 |
|
11 |
#ifndef RIGFILLCUT_H_ |
12 |
#define RIGFILLCUT_H_ |
13 |
|
14 |
#include "../../PamCutBase/PamCutBase.h" |
15 |
|
16 |
/*! @enum RIGFILL_return Return codes for RigFillCut discarded events */ |
17 |
enum RIGFILL_return { |
18 |
RIGOUT, ///< Event is discarded because its rigidity is outside the rigidity binning limits. |
19 |
THRESHRIGOUT ///< Event is discarded because its threshold rigidity is outside the threshold rigidity binning limits. |
20 |
}; |
21 |
|
22 |
/*! @brief The rigidity vs threshold rigidity histogram filling. |
23 |
* |
24 |
* This class checks the events and builds a 2D histogram binned in rigidity modulus |
25 |
* and threshold rigidity. Each 2D bin will contain the number of events whose |
26 |
* rigidity modulus and threshold rigidity (eg., Stoermer cutoff rigidity times a threshold coefficient) |
27 |
* lie in that bin. Note that the meaning of this threshold coefficient is the same as in |
28 |
* TrkRigGeoCut, so it must have the same value used for TrkRigGeoCut (consider |
29 |
* using TrkRigGeoCut::GetThresholdCoeff() to retrieve its value). |
30 |
* Events are discarded only if their rigidity modulus or cutoff rigidity lies |
31 |
* outside the histogram bounds. |
32 |
* |
33 |
* CUT DEPENDECIES: TrkPhSinCut for single physical track, TrkRigGeoCut for galactic event. |
34 |
* |
35 |
*/ |
36 |
|
37 |
class RigFillCut: public PamCut { |
38 |
|
39 |
public: |
40 |
/*! @brief Constructor. |
41 |
* |
42 |
* The binning vectors must contain both the upper and lower limits, and |
43 |
* the elements must be ordered (ie., lowest value in the first element and so on) |
44 |
* and positive, so that charge sign will be irrelevant. |
45 |
* |
46 |
* @param cutName The cut's name. |
47 |
* @param binning A vector containing the histogram binning in rigidity modulus (X axis) and cutoff rigidity (Y axis). |
48 |
* @param thresholdCoeff The threshold rigidity coefficient for the event selection. |
49 |
* |
50 |
*/ |
51 |
RigFillCut(const char *cutName, std::vector<float> binning, float thresholdCoeff) : |
52 |
PamCut(cutName), _binning(binning), _histogram(binning.size() - 1, binning.size() - 1, 0), |
53 |
_thresholdCoeff(thresholdCoeff) { |
54 |
} |
55 |
|
56 |
/*! @brief Constructor. |
57 |
* |
58 |
* This constructor reads the binning from a text file. The bin limits should be arranged in rows. |
59 |
* |
60 |
* @param cutName The cut's name. |
61 |
* @param rigBinListFileName A text file containing the histogram binning. |
62 |
* Note that it must contain both the upper and lower limits, and |
63 |
* that the elements must be ordered (ie., lowest rigidity value in the first |
64 |
* element and so on). |
65 |
* @param thresholdCoeff The threshold rigidity coefficient for the event selection. |
66 |
* |
67 |
*/ |
68 |
RigFillCut(const char *cutName, const char* rigBinListFileName, float thresholdCoeff); |
69 |
|
70 |
/*! @brief Destructor. */ |
71 |
~RigFillCut() { |
72 |
} |
73 |
|
74 |
/*! @brief The rigidity and cutoff rigidity check. |
75 |
* |
76 |
* The event is discarded if its rigidity modulus or threshold rigidity are outside the limits of the |
77 |
* binnings. Please note that only absolute rigidity is considered. |
78 |
* |
79 |
* @param event The event to analyze. |
80 |
* @return #CUTOK if both rigidity modulus and threshold rigidity is contained in the histogram limits. |
81 |
* @return 0 otherwise. |
82 |
*/ |
83 |
int Check(PamLevel2 *event); |
84 |
|
85 |
/*! @brief The histogram filling. |
86 |
* |
87 |
* The method fills the histogram with the currently selected event. |
88 |
* |
89 |
* @param event The currently selected event. |
90 |
*/ |
91 |
void OnGood(PamLevel2 *event); |
92 |
|
93 |
/*! @brief Returns the histogram. |
94 |
* |
95 |
* This method returns a SimpleMatrix. Its [i][j] element contain the number of analyzed events |
96 |
* whose rigidity modulus falls in the i-th rigidity bin and whose threshold rigidity falls in the j-th rigidity bin. |
97 |
* |
98 |
* @return The rigidity modulus - threshold rigidity 2D histogram |
99 |
*/ |
100 |
SimpleMatrix<UInt_t> &GetHisto() { |
101 |
return _histogram; |
102 |
} |
103 |
|
104 |
private: |
105 |
|
106 |
std::vector<float> _binning; |
107 |
SimpleMatrix<UInt_t> _histogram; |
108 |
float _thresholdCoeff; |
109 |
}; |
110 |
#endif /* RIGFILLCUT_H_ */ |