| 85 |
|
|
| 86 |
/*! @brief Sets up the histogram |
/*! @brief Sets up the histogram |
| 87 |
* |
* |
| 88 |
* This routine effectively prepares the histogram, after the desired parameters has been set by #SetXAxis() and #SetYAxis(). |
* This routine effectively prepares the histogram, after the desired parameters has been set by #SetXAxis(). |
| 89 |
* |
* |
| 90 |
* @param events Pointer to PamLevel2 events (unused). |
* @param events Pointer to PamLevel2 events (unused). |
| 91 |
*/ |
*/ |
| 108 |
return _histo; |
return _histo; |
| 109 |
} |
} |
| 110 |
|
|
| 111 |
/*! Fills the ROOT and the vector histogram. */ |
/*! Fills the ROOT and the vector histogram. |
| 112 |
|
* |
| 113 |
|
* @param value The value of the X coordinate associated to the event. |
| 114 |
|
* @param weight The weight which will be applied to the event. |
| 115 |
|
*/ |
| 116 |
void Fill(double value, double weight = 1.); |
void Fill(double value, double weight = 1.); |
| 117 |
|
|
| 118 |
/*! @brief The number of events which fell below the lower histogram limit. */ |
/*! @brief The number of events which fell below the lower histogram limit. */ |
| 127 |
|
|
| 128 |
protected: |
protected: |
| 129 |
|
|
| 130 |
|
/*! @brief The vector containing the limits of the bins(from lower to higher). */ |
| 131 |
std::vector<float> _bins; |
std::vector<float> _bins; |
| 132 |
|
/*! @brief A vector containing the value of the histogram for each bin. */ |
| 133 |
vector<HistoType> _histo; |
vector<HistoType> _histo; |
| 134 |
|
/*! @brief The ROOT histogram. */ |
| 135 |
TH1 *_rootHisto; |
TH1 *_rootHisto; |
| 136 |
|
|
| 137 |
private: |
/*! @brief Base name of the output file. */ |
|
|
|
|
unsigned int _underflow, _overflow; |
|
|
|
|
| 138 |
TString _outFileBase; |
TString _outFileBase; |
| 139 |
|
/*! @brief Output file open mode (UPDATE or RECREATE, see documentation of TFile). */ |
| 140 |
TString _mode; |
TString _mode; |
| 141 |
TString _title, _xLabel; |
/*! @brief Title for the ROOT histogram. */ |
| 142 |
|
TString _title; |
| 143 |
|
/*! @brief Axis labels for the ROOT histogram. */ |
| 144 |
|
TString _xLabel; |
| 145 |
|
|
| 146 |
|
private: |
| 147 |
|
|
| 148 |
|
HistoType _underflow, _overflow; |
| 149 |
bool _outRoot; |
bool _outRoot; |
| 150 |
bool _outText; |
bool _outText; |
|
|
|
| 151 |
void _CreateHisto(); |
void _CreateHisto(); |
| 152 |
void _InitHistos(); |
void _InitHistos(); |
| 153 |
}; |
}; |
| 158 |
// No ROOT histogram for generic type; see template specializations in .cpp file. |
// No ROOT histogram for generic type; see template specializations in .cpp file. |
| 159 |
_rootHisto = NULL; |
_rootHisto = NULL; |
| 160 |
} |
} |
| 161 |
|
// Specializations for _CreateHistos(). See Histo1DAction.cpp |
| 162 |
|
template<> |
| 163 |
|
void Histo1DAction<Int_t>::_CreateHisto(); |
| 164 |
|
|
| 165 |
|
template<> |
| 166 |
|
void Histo1DAction<Float_t>::_CreateHisto(); |
| 167 |
|
|
| 168 |
|
template<> |
| 169 |
|
void Histo1DAction<Double_t>::_CreateHisto(); |
| 170 |
|
|
| 171 |
template<class HistoType> |
template<class HistoType> |
| 172 |
void Histo1DAction<HistoType>::_InitHistos() { |
void Histo1DAction<HistoType>::_InitHistos() { |
| 173 |
|
|
| 174 |
_CreateHisto(); |
_CreateHisto(); |
| 175 |
|
if (_bins.size() < 2) // SetXAxis not called by the main program, or wrongly filled (only 1 bin limit) |
| 176 |
|
SetXAxis("Default X", 10, 0., 1.); |
| 177 |
|
|
| 178 |
if (_rootHisto) { |
if (_rootHisto) { |
| 179 |
Double_t *auxArray = new Double_t[_bins.size()]; |
Double_t *auxArray = new Double_t[_bins.size()]; |
| 198 |
|
|
| 199 |
template<class HistoType> |
template<class HistoType> |
| 200 |
Histo1DAction<HistoType>::~Histo1DAction() { |
Histo1DAction<HistoType>::~Histo1DAction() { |
| 201 |
|
|
| 202 |
|
delete _rootHisto; |
| 203 |
|
_rootHisto = NULL; |
| 204 |
|
|
| 205 |
} |
} |
| 206 |
|
|
| 207 |
template<class HistoType> |
template<class HistoType> |
| 208 |
Histo1DAction<HistoType>::Histo1DAction(const char *actionName, TString title, TString outFileBase, TString mode, |
Histo1DAction<HistoType>::Histo1DAction(const char *actionName, TString title, TString outFileBase, TString mode, |
| 209 |
bool outRoot, bool outText) : |
bool outRoot, bool outText) : |
| 210 |
CollectionAction(actionName), _bins(0), _histo(0), _rootHisto(NULL), _outFileBase(outFileBase), _mode(mode), _title( |
CollectionAction(actionName), _bins(0), _histo(0), _rootHisto(NULL), _outFileBase(outFileBase), _mode(mode), _title( |
| 211 |
title), _xLabel(""), _outRoot(outRoot), _outText(outText) { |
title), _xLabel(""), _underflow(0), _overflow(0), _outRoot(outRoot), _outText(outText) { |
| 212 |
|
|
| 213 |
} |
} |
| 214 |
|
|