| 1 |
/* |
| 2 |
* TrkRigHistoAction.cpp |
| 3 |
* |
| 4 |
* Created on: 2009-06-05 |
| 5 |
* Author: S. Ricciarini |
| 6 |
*/ |
| 7 |
|
| 8 |
/*! @file TrkRigHistoAction.cpp The TrkRigHistoAction class implementation file. */ |
| 9 |
|
| 10 |
#include "TrkRigHistoAction.h" |
| 11 |
|
| 12 |
TrkRigHistoAction::TrkRigHistoAction(const char *actionName, std::vector<float> binning) : |
| 13 |
CollectionAction(actionName), _binning(binning), _histogram(binning.size() - 1, 0) { |
| 14 |
} |
| 15 |
|
| 16 |
void TrkRigHistoAction::OnGood(PamLevel2 *event){ |
| 17 |
|
| 18 |
float rig = 1./event->GetTrack(0)->GetTrkTrack()->GetDeflection(); // rigidity with sign |
| 19 |
|
| 20 |
// Bin identification: rigidity value must be less than (<) bin maximum |
| 21 |
|
| 22 |
if (rig < _binning[0] || rig >= _binning[_binning.size() - 1]) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
int i = 1; |
| 27 |
while (rig >= _binning[i]) { |
| 28 |
i++; |
| 29 |
} |
| 30 |
i--; |
| 31 |
|
| 32 |
_histogram[i]++; |
| 33 |
|
| 34 |
} |