1 |
/* |
2 |
* CaloChi2HistoAction.cpp |
3 |
* |
4 |
* Created on: 04/ago/2009 |
5 |
* Author: Nicola Mori |
6 |
*/ |
7 |
|
8 |
/*! @file CaloChi2HistoAction.cpp The CaloChi2HistoAction class implementation file. */ |
9 |
|
10 |
#include "CaloChi2HistoAction.h" |
11 |
|
12 |
CaloChi2HistoAction::CaloChi2HistoAction(const char *actionName, TString outFileName, CaloAxis *xAxis, CaloAxis *yAxis, |
13 |
float min, float max, unsigned int nBins, TString mode) : |
14 |
CollectionAction(actionName), _outFileName(outFileName), _xAxis(xAxis), _yAxis(yAxis), _mode(mode), _xHisto(), |
15 |
_yHisto(), _xyHisto() { |
16 |
|
17 |
_xHisto.SetName(TString(GetName()) + TString("_x")); |
18 |
_xHisto.SetTitle("CALO Chi2 (X view)"); |
19 |
_xHisto.SetBins(nBins, min, max); |
20 |
_xHisto.GetXaxis()->SetTitle("Chi2 (X)"); |
21 |
_xHisto.GetYaxis()->SetTitle("Events"); |
22 |
|
23 |
|
24 |
_yHisto.SetName(TString(GetName()) + TString("_y")); |
25 |
_yHisto.SetBins(nBins, min, max); |
26 |
_yHisto.SetTitle("CALO Chi2 (Y view)"); |
27 |
_xHisto.GetXaxis()->SetTitle("Chi2 (Y)"); |
28 |
_xHisto.GetYaxis()->SetTitle("Events"); |
29 |
|
30 |
_xyHisto.SetName(TString(GetName()) + TString("_xy")); |
31 |
_xyHisto.SetBins(nBins, min, max, nBins, min, max); |
32 |
_xyHisto.SetTitle("CALO Chi2"); |
33 |
_xyHisto.GetXaxis()->SetTitle("Chi2 (X)"); |
34 |
_xyHisto.GetYaxis()->SetTitle("Chi2 (Y)"); |
35 |
|
36 |
|
37 |
} |
38 |
|
39 |
void CaloChi2HistoAction::OnGood(PamLevel2 *event) { |
40 |
|
41 |
_xHisto.Fill(_xAxis->GetChi2()); |
42 |
_yHisto.Fill(_yAxis->GetChi2()); |
43 |
_xyHisto.Fill(_xAxis->GetChi2(), _yAxis->GetChi2()); |
44 |
|
45 |
} |
46 |
|
47 |
void CaloChi2HistoAction::Finalize() { |
48 |
|
49 |
TFile outFile(_outFileName, _mode); |
50 |
outFile.cd(); |
51 |
_xHisto.Write(); |
52 |
_yHisto.Write(); |
53 |
_xyHisto.Write(); |
54 |
outFile.Close(); |
55 |
} |
56 |
|