| 1 |
pam-fi |
1.1 |
/* |
| 2 |
|
|
* TrkDedxVsRigHistoAction.cpp |
| 3 |
|
|
* |
| 4 |
|
|
* Created on: 9-giu-2009 |
| 5 |
|
|
* Author: Nicola Mori |
| 6 |
|
|
*/ |
| 7 |
|
|
|
| 8 |
|
|
/*! @file TrkDedxVsRigHistoAction.cpp The TrkDedxVsRigHistoAction class implementation file. */ |
| 9 |
|
|
|
| 10 |
|
|
#include "TrkDedxVsRigHistoAction.h" |
| 11 |
|
|
|
| 12 |
|
|
TrkDedxVsRigHistoAction::TrkDedxVsRigHistoAction(const char *actionName, TString outFileName, TString mode, |
| 13 |
|
|
float minDedx, float maxDedx, unsigned int nBinsDedx, float minR, float maxR, unsigned int nBinsR) : |
| 14 |
|
|
CollectionAction(actionName), _outFileName(outFileName), _histo(), _mode(mode) { |
| 15 |
|
|
|
| 16 |
|
|
_histo.SetName(GetName()); |
| 17 |
|
|
_histo.SetTitle("TRK dE/dx Vs Rigidity"); |
| 18 |
|
|
_histo.GetXaxis()->SetTitle("R (GV)"); |
| 19 |
|
|
_histo.GetYaxis()->SetTitle("dE/dx (MIP)"); |
| 20 |
|
|
|
| 21 |
|
|
_histo.SetBins(nBinsR, minR, maxR, nBinsDedx, minDedx, maxDedx); |
| 22 |
|
|
} |
| 23 |
|
|
|
| 24 |
|
|
void TrkDedxVsRigHistoAction::OnGood(PamLevel2 *event) { |
| 25 |
|
|
|
| 26 |
|
|
_histo.Fill(1/event->GetTrack(0)->GetTrkTrack()->GetDeflection(), event->GetTrack(0)->GetTrkTrack()->GetDEDX()); |
| 27 |
|
|
} |
| 28 |
|
|
|
| 29 |
|
|
void TrkDedxVsRigHistoAction::Finalize() { |
| 30 |
|
|
|
| 31 |
|
|
TFile outFile(_outFileName, _mode); |
| 32 |
|
|
outFile.cd(); |
| 33 |
|
|
_histo.Write(); |
| 34 |
|
|
outFile.Close(); |
| 35 |
|
|
} |