/[PAMELA software]/PamCut/CollectionActions/CaloChi2HistoAction/CaloChi2HistoAction.cpp
ViewVC logotype

Diff of /PamCut/CollectionActions/CaloChi2HistoAction/CaloChi2HistoAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by pam-fi, Thu Oct 29 09:40:50 2009 UTC revision 1.5 by pam-fi, Tue Jul 12 15:52:49 2011 UTC
# Line 7  Line 7 
7    
8  /*! @file CaloChi2HistoAction.cpp The CaloChi2HistoAction class implementation file. */  /*! @file CaloChi2HistoAction.cpp The CaloChi2HistoAction class implementation file. */
9    
10    #ifndef NO_CALOAXIS
11    
12  #include "CaloChi2HistoAction.h"  #include "CaloChi2HistoAction.h"
13    
14  CaloChi2HistoAction::CaloChi2HistoAction(const char *actionName, TString outFileName, CaloAxis *xAxis, CaloAxis *yAxis,  CaloChi2HistoAction::CaloChi2HistoAction(const char *actionName, TString outFileName, CaloAxis *xAxis, CaloAxis *yAxis,
15      float min, float max, unsigned int nBins, TString mode) :      float min, float max, unsigned int nBins, bool logBinning, TString mode) :
16    CollectionAction(actionName), _outFileName(outFileName), _xAxis(xAxis), _yAxis(yAxis), _mode(mode), _xHisto(),      CollectionAction(actionName), _outFileName(outFileName), _xAxis(xAxis), _yAxis(yAxis), _mode(mode), _xHisto(), _yHisto(), _xyHisto() {
17        _yHisto(), _xyHisto() {  
18      Double_t *bins = new Double_t[nBins + 1];
19    
20      if (!logBinning || (logBinning && min <= 0.)) {
21    
22    #ifdef DEBUGPAMCUT
23        if (logbinning && rigMin <= 0.)
24        cout << "Warning: logarithmic binning was chosen for X axis but min <= 0. Using linear binning."
25    #endif
26    
27        float step = (max - min) / nBins;
28        for (unsigned int i = 0; i < nBins + 1; i++) {
29          bins[i] = min + i * step;
30        }
31    
32      }
33      else {
34    
35        double maxExp = log10(max / min);
36        for (unsigned int i = 0; i < nBins + 1; i++) {
37          bins[i] = min * pow(10., (double) i / ((double) nBins) * maxExp);
38        }
39    
40      }
41    
42    _xHisto.SetName(TString(GetName()) + TString("_x"));    _xHisto.SetName(TString(GetName()) + TString("_x"));
43    _xHisto.SetTitle("CALO Chi2 (X view)");    _xHisto.SetTitle("CALO Chi2 (X view)");
44    _xHisto.SetBins(nBins, min, max);    _xHisto.SetBins(nBins, bins);
45    _xHisto.GetXaxis()->SetTitle("Chi2 (X)");    _xHisto.GetXaxis()->SetTitle("Chi2 (X)");
46    _xHisto.GetYaxis()->SetTitle("Events");    _xHisto.GetYaxis()->SetTitle("Events");
47    
   
48    _yHisto.SetName(TString(GetName()) + TString("_y"));    _yHisto.SetName(TString(GetName()) + TString("_y"));
49    _yHisto.SetBins(nBins, min, max);    _yHisto.SetBins(nBins, bins);
50    _yHisto.SetTitle("CALO Chi2 (Y view)");    _yHisto.SetTitle("CALO Chi2 (Y view)");
51    _xHisto.GetXaxis()->SetTitle("Chi2 (Y)");    _xHisto.GetXaxis()->SetTitle("Chi2 (Y)");
52    _xHisto.GetYaxis()->SetTitle("Events");    _xHisto.GetYaxis()->SetTitle("Events");
53    
54    _xyHisto.SetName(TString(GetName()) + TString("_xy"));    _xyHisto.SetName(TString(GetName()) + TString("_xy"));
55    _xyHisto.SetBins(nBins, min, max, nBins, min, max);    _xyHisto.SetBins(nBins, bins, nBins, bins);
56    _xyHisto.SetTitle("CALO Chi2");    _xyHisto.SetTitle("CALO Chi2");
57    _xyHisto.GetXaxis()->SetTitle("Chi2 (X)");    _xyHisto.GetXaxis()->SetTitle("Chi2 (X)");
58    _xyHisto.GetYaxis()->SetTitle("Chi2 (Y)");    _xyHisto.GetYaxis()->SetTitle("Chi2 (Y)");
59    
   
60  }  }
61    
62  void CaloChi2HistoAction::OnGood(PamLevel2 *event) {  void CaloChi2HistoAction::OnGood(PamLevel2 *event) {
# Line 54  void CaloChi2HistoAction::Finalize() { Line 77  void CaloChi2HistoAction::Finalize() {
77    outFile.Close();    outFile.Close();
78  }  }
79    
80    #endif /* NO_CALOAXIS */

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23