1 |
/* |
2 |
* EvRateCorrHistoAction.cpp |
3 |
* |
4 |
* Created on: 15-giu-2009 |
5 |
* Author: mori |
6 |
*/ |
7 |
|
8 |
/*! @file EvRateCorrHistoAction.cpp The EvRateCorrHistoAction class implementation file. */ |
9 |
|
10 |
#include "EvRateCorrHistoAction.h" |
11 |
|
12 |
EvRateCorrHistoAction::EvRateCorrHistoAction(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. Event rate on S12"); |
17 |
_histo.GetXaxis()->SetTitle("Event rate on S12 (Hz)"); |
18 |
_histo.GetYaxis()->SetTitle("Event rate on S11 (Hz)"); |
19 |
_histo.SetBins(100, 0., 4000., 100, 0., 4000.); |
20 |
} |
21 |
|
22 |
void EvRateCorrHistoAction::OnGood(PamLevel2 *event) { |
23 |
|
24 |
int totRateS11 = 0; |
25 |
for (int i = 0; i < 16; i++) |
26 |
totRateS11 += event->GetTrigLevel2()->pmtcount1[i]; |
27 |
int totRateS12 = 0; |
28 |
for (int i = 16; i < 24; i++) // First 8 PMTs of S12 |
29 |
totRateS12 += event->GetTrigLevel2()->pmtcount1[i]; |
30 |
for (int i = 0; i < 4; i++) // Last 4 PMTs of S12 |
31 |
totRateS12 += event->GetTrigLevel2()->pmtcount2[i]; |
32 |
_histo.Fill((float) totRateS12 / 12., (float) totRateS11 / 16.); |
33 |
} |
34 |
|
35 |
void EvRateCorrHistoAction::Finalize() { |
36 |
|
37 |
TFile outFile(_outFileName, _mode); |
38 |
outFile.cd(); |
39 |
_histo.Write(); |
40 |
outFile.Close(); |
41 |
} |