1 |
/* |
2 |
* EvRateS11VsBabsHistoAction.cpp |
3 |
* |
4 |
* Created on: 10-jun-2009 |
5 |
* Author: Nicola Mori |
6 |
*/ |
7 |
|
8 |
/*! @file EvRateS11VsBabsHistoAction.cpp The EvRateS11VsBabsHistoAction class implementation file. */ |
9 |
|
10 |
#include "EvRateS11VsBabsHistoAction.h" |
11 |
|
12 |
EvRateS11VsBabsHistoAction::EvRateS11VsBabsHistoAction(const char *actionName, TString outFileName, TString mode) : |
13 |
CollectionAction(actionName), _outFileName(outFileName), _histo(), _mode(mode) { |
14 |
|
15 |
_histo.SetName(GetName()); |
16 |
_histo.SetTitle("Event rate on S11 Vs. Geomagnetic field"); |
17 |
_histo.GetXaxis()->SetTitle("Magnetic field (gauss)"); |
18 |
_histo.GetYaxis()->SetTitle("Event rate on S11 (Hz)"); |
19 |
_histo.SetBins(100, 0., 1., 100, 0., 4000.); |
20 |
} |
21 |
|
22 |
void EvRateS11VsBabsHistoAction::OnGood(PamLevel2 *event) { |
23 |
|
24 |
int totRate = 0; |
25 |
for (int i = 0; i < 16; i++) |
26 |
totRate += event->GetTrigLevel2()->pmtcount1[i]; |
27 |
_histo.Fill(event->GetOrbitalInfo()->Babs, (float) totRate / 16.); |
28 |
|
29 |
} |
30 |
|
31 |
void EvRateS11VsBabsHistoAction::Finalize() { |
32 |
|
33 |
TFile outFile(_outFileName, _mode); |
34 |
outFile.cd(); |
35 |
_histo.Write(); |
36 |
outFile.Close(); |
37 |
} |