1 |
pam-fi |
1.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 |
pam-fi |
1.4 |
#ifndef NO_CALOAXIS |
11 |
|
|
|
12 |
pam-fi |
1.1 |
#include "CaloChi2HistoAction.h" |
13 |
|
|
|
14 |
|
|
CaloChi2HistoAction::CaloChi2HistoAction(const char *actionName, TString outFileName, CaloAxis *xAxis, CaloAxis *yAxis, |
15 |
|
|
float min, float max, unsigned int nBins, TString mode) : |
16 |
|
|
CollectionAction(actionName), _outFileName(outFileName), _xAxis(xAxis), _yAxis(yAxis), _mode(mode), _xHisto(), |
17 |
|
|
_yHisto(), _xyHisto() { |
18 |
|
|
|
19 |
|
|
_xHisto.SetName(TString(GetName()) + TString("_x")); |
20 |
|
|
_xHisto.SetTitle("CALO Chi2 (X view)"); |
21 |
|
|
_xHisto.SetBins(nBins, min, max); |
22 |
|
|
_xHisto.GetXaxis()->SetTitle("Chi2 (X)"); |
23 |
|
|
_xHisto.GetYaxis()->SetTitle("Events"); |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
_yHisto.SetName(TString(GetName()) + TString("_y")); |
27 |
|
|
_yHisto.SetBins(nBins, min, max); |
28 |
|
|
_yHisto.SetTitle("CALO Chi2 (Y view)"); |
29 |
|
|
_xHisto.GetXaxis()->SetTitle("Chi2 (Y)"); |
30 |
|
|
_xHisto.GetYaxis()->SetTitle("Events"); |
31 |
|
|
|
32 |
|
|
_xyHisto.SetName(TString(GetName()) + TString("_xy")); |
33 |
|
|
_xyHisto.SetBins(nBins, min, max, nBins, min, max); |
34 |
|
|
_xyHisto.SetTitle("CALO Chi2"); |
35 |
|
|
_xyHisto.GetXaxis()->SetTitle("Chi2 (X)"); |
36 |
|
|
_xyHisto.GetYaxis()->SetTitle("Chi2 (Y)"); |
37 |
|
|
|
38 |
|
|
|
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
void CaloChi2HistoAction::OnGood(PamLevel2 *event) { |
42 |
|
|
|
43 |
|
|
_xHisto.Fill(_xAxis->GetChi2()); |
44 |
|
|
_yHisto.Fill(_yAxis->GetChi2()); |
45 |
|
|
_xyHisto.Fill(_xAxis->GetChi2(), _yAxis->GetChi2()); |
46 |
|
|
|
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
void CaloChi2HistoAction::Finalize() { |
50 |
|
|
|
51 |
|
|
TFile outFile(_outFileName, _mode); |
52 |
|
|
outFile.cd(); |
53 |
|
|
_xHisto.Write(); |
54 |
|
|
_yHisto.Write(); |
55 |
|
|
_xyHisto.Write(); |
56 |
|
|
outFile.Close(); |
57 |
|
|
} |
58 |
|
|
|
59 |
pam-fi |
1.4 |
#endif /* NO_CALOAXIS */ |