| 106 |
*/ |
*/ |
| 107 |
void SetYAxis(TString label, unsigned int nBins, float min, float max, bool logBinning = false); |
void SetYAxis(TString label, unsigned int nBins, float min, float max, bool logBinning = false); |
| 108 |
|
|
| 109 |
|
/*! @brief Sets the ROOT histogram's title. |
| 110 |
|
* |
| 111 |
|
* @param title The histogram title as it will appear on the histogram itself. |
| 112 |
|
*/ |
| 113 |
|
void SetTitle(TString &title) { |
| 114 |
|
_title = title; |
| 115 |
|
} |
| 116 |
/*! @brief Sets up the histogram |
/*! @brief Sets up the histogram |
| 117 |
* |
* |
| 118 |
* 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() and #SetYAxis(). |
| 119 |
* |
* |
| 120 |
* @param events Pointer to PamLevel2 events (unused). |
* @param events Pointer to PamLevel2 events (unused). |
| 121 |
*/ |
*/ |
|
|
|
|
/*! @brief Sets the ROOT histogram's title. */ |
|
|
void SetTitle(TString &title){ |
|
|
_title = title; |
|
|
} |
|
| 122 |
void Setup(PamLevel2 *events) { |
void Setup(PamLevel2 *events) { |
| 123 |
CollectionAction::Setup(events); |
CollectionAction::Setup(events); |
| 124 |
_InitHistos(); |
_InitHistos(); |
| 143 |
return _histo; |
return _histo; |
| 144 |
} |
} |
| 145 |
|
|
| 146 |
/*! Fills the ROOT and the vector histogram. */ |
/*! Fills the ROOT and the vector histogram. |
| 147 |
|
* |
| 148 |
|
* @param xValue The value of the X coordinate associated to the event. |
| 149 |
|
* @param yValue The value of the Y coordinate associated to the event. |
| 150 |
|
* @param weight The weight which will be applied to the event. |
| 151 |
|
*/ |
| 152 |
void Fill(double xValue, double yValue, double weight = 1.); |
void Fill(double xValue, double yValue, double weight = 1.); |
| 153 |
|
|
| 154 |
/*! @brief Gets the X overflow histogram. |
/*! @brief Gets the X overflow histogram. |
| 243 |
|
|
| 244 |
protected: |
protected: |
| 245 |
|
|
| 246 |
|
/*! @brief The vector containing the limits of the X bins(from lower to higher). */ |
| 247 |
std::vector<float> _xBins; |
std::vector<float> _xBins; |
| 248 |
|
/*! @brief The vector containing the limits of the Y bins(from lower to higher). */ |
| 249 |
std::vector<float> _yBins; |
std::vector<float> _yBins; |
| 250 |
|
/*! @brief A matrix containing the value of the histogram for each X-Y bin. */ |
| 251 |
SimpleMatrix<HistoType> _histo; |
SimpleMatrix<HistoType> _histo; |
| 252 |
|
/*! @brief The ROOT histogram. */ |
| 253 |
TH2 *_rootHisto; |
TH2 *_rootHisto; |
| 254 |
|
|
| 255 |
private: |
private: |
| 278 |
|
|
| 279 |
_CreateHisto(); |
_CreateHisto(); |
| 280 |
|
|
| 281 |
if (_xBins.size() < 2){ |
if (_xBins.size() < 2) { |
| 282 |
_xBins.resize(2); |
_xBins.resize(2); |
| 283 |
_xBins[0] = 0.; |
_xBins[0] = 0.; |
| 284 |
_xBins[1] = 1.; |
_xBins[1] = 1.; |
| 285 |
} |
} |
| 286 |
|
|
| 287 |
if (_yBins.size() < 2){ |
if (_yBins.size() < 2) { |
| 288 |
_yBins.resize(2); |
_yBins.resize(2); |
| 289 |
_yBins[0] = 0.; |
_yBins[0] = 0.; |
| 290 |
_yBins[1] = 1.; |
_yBins[1] = 1.; |
| 325 |
|
|
| 326 |
template<class HistoType> |
template<class HistoType> |
| 327 |
Histo2DAction<HistoType>::~Histo2DAction() { |
Histo2DAction<HistoType>::~Histo2DAction() { |
| 328 |
|
|
| 329 |
|
delete _rootHisto; |
| 330 |
|
_rootHisto = NULL; |
| 331 |
} |
} |
| 332 |
|
|
| 333 |
template<class HistoType> |
template<class HistoType> |
| 515 |
return; |
return; |
| 516 |
} |
} |
| 517 |
else { |
else { |
| 518 |
if (yBin == (int)_yBins.size()) { |
if (yBin == (int) _yBins.size()) { |
| 519 |
_xUnderYOverflow += (HistoType) weight; |
_xUnderYOverflow += (HistoType) weight; |
| 520 |
return; |
return; |
| 521 |
} |
} |
| 526 |
} |
} |
| 527 |
} |
} |
| 528 |
|
|
| 529 |
if (xBin == (int)_xBins.size()) { |
if (xBin == (int) _xBins.size()) { |
| 530 |
if (yBin == -1) { |
if (yBin == -1) { |
| 531 |
_xOverYUnderflow += (HistoType) weight; |
_xOverYUnderflow += (HistoType) weight; |
| 532 |
return; |
return; |
| 533 |
} |
} |
| 534 |
else { |
else { |
| 535 |
if (yBin ==(int) _yBins.size()) { |
if (yBin == (int) _yBins.size()) { |
| 536 |
_xOverYOverflow += (HistoType) weight; |
_xOverYOverflow += (HistoType) weight; |
| 537 |
return; |
return; |
| 538 |
} |
} |
| 548 |
return; |
return; |
| 549 |
} |
} |
| 550 |
|
|
| 551 |
if (yBin == (int)_yBins.size()) { |
if (yBin == (int) _yBins.size()) { |
| 552 |
_yOverflow[xBin] += (HistoType) weight; |
_yOverflow[xBin] += (HistoType) weight; |
| 553 |
return; |
return; |
| 554 |
} |
} |