ATLAS Offline Software
TRootCompare.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGVALTOOLS_TROOTCOMPARE_H
6 #define TRIGVALTOOLS_TROOTCOMPARE_H
7 
15 #include "TFileLooper.h"
16 #include "TFile.h"
17 #include "TCanvas.h"
18 #include "TKey.h"
19 
28 class TRootCompare : public TFileLooper {
29  public:
30  enum ALG {BIN, CHI2, AXIS};
31 
32  public:
33  TRootCompare();
34  virtual ~TRootCompare();
35 
36  virtual void processKey(TDirectory& dir, TKey& key);
37  virtual void beginJob();
38  virtual void endJob();
39 
40  Bool_t setReferenceFile(const char* filename, const char* baseDir = 0);
41  Bool_t setOutputFile(const char* filename);
42  Bool_t setPsFile(const char* filename);
45  }
46  void drawNormalized(Bool_t norm = kTRUE) { m_drawNormalized = norm; }
47  void drawDiff(Bool_t diff = kTRUE) { m_drawDiff = diff; }
48  void sortLabels(Bool_t sort = kTRUE) { m_sortLabels = sort; }
49 
50  Int_t matchingHist() const { return m_histMatch; }
51  Int_t totalHist() const { return m_histTotal; }
52  Int_t missingHist() const { return m_histMissing; }
53 
54  private:
55  Bool_t compareHist(const TH1& h, const TH1& href);
56  void sortAndDeflate(TH1& h);
57  void createDirectory(TFile* f, const char* dirpath);
58  void printCanvas(const char* filename);
59 
60  private:
61  TFile* m_refFile;
62  TFile* m_outFile;
63  TString m_refRootDir;
64  TString m_psFile;
65  TCanvas* m_can;
66 
68  Double_t m_threshold;
69  Int_t m_histMatch;
70  Int_t m_histTotal;
73  Bool_t m_drawDiff;
74  Bool_t m_sortLabels;
75 
76  std::vector<std::string> m_noMatch;
77 
78 };
79 
80 #endif
TRootCompare::drawDiff
void drawDiff(Bool_t diff=kTRUE)
Definition: TRootCompare.h:47
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
SGout2dot.alg
alg
Definition: SGout2dot.py:243
TRootCompare::m_alg
ALG m_alg
Definition: TRootCompare.h:67
TRootCompare::TRootCompare
TRootCompare()
Definition: TRootCompare.cxx:35
TRootCompare::setReferenceFile
Bool_t setReferenceFile(const char *filename, const char *baseDir=0)
Definition: TRootCompare.cxx:322
TRootCompare::drawNormalized
void drawNormalized(Bool_t norm=kTRUE)
Definition: TRootCompare.h:46
TRootCompare::totalHist
Int_t totalHist() const
Definition: TRootCompare.h:51
TRootCompare::m_sortLabels
Bool_t m_sortLabels
Definition: TRootCompare.h:74
TRootCompare::printCanvas
void printCanvas(const char *filename)
Definition: TRootCompare.cxx:370
TRootCompare::matchingHist
Int_t matchingHist() const
Definition: TRootCompare.h:50
TRootCompare::setAlg
void setAlg(TRootCompare::ALG alg, Double_t threshold)
Definition: TRootCompare.h:43
TRootCompare::m_drawDiff
Bool_t m_drawDiff
Definition: TRootCompare.h:73
TRootCompare::CHI2
@ CHI2
Definition: TRootCompare.h:30
TRootCompare
Class to compare the histograms in two root files.
Definition: TRootCompare.h:28
TFileLooper.h
TFileLooper class.
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
TRootCompare::endJob
virtual void endJob()
Definition: TRootCompare.cxx:71
TRootCompare::setPsFile
Bool_t setPsFile(const char *filename)
Definition: TRootCompare.cxx:360
TRootCompare::processKey
virtual void processKey(TDirectory &dir, TKey &key)
Method called for every key.
Definition: TRootCompare.cxx:116
TRootCompare::m_histTotal
Int_t m_histTotal
Definition: TRootCompare.h:70
TRootCompare::setOutputFile
Bool_t setOutputFile(const char *filename)
Definition: TRootCompare.cxx:343
TRootCompare::missingHist
Int_t missingHist() const
Definition: TRootCompare.h:52
TRootCompare::m_psFile
TString m_psFile
Definition: TRootCompare.h:64
TRootCompare::m_histMissing
Int_t m_histMissing
Definition: TRootCompare.h:71
TRootCompare::sortAndDeflate
void sortAndDeflate(TH1 &h)
Definition: TRootCompare.cxx:458
TRootCompare::m_histMatch
Int_t m_histMatch
Definition: TRootCompare.h:69
TRootCompare::ALG
ALG
Definition: TRootCompare.h:30
beamspotman.dir
string dir
Definition: beamspotman.py:623
TRootCompare::createDirectory
void createDirectory(TFile *f, const char *dirpath)
Definition: TRootCompare.cxx:471
TRootCompare::m_outFile
TFile * m_outFile
Definition: TRootCompare.h:62
TRootCompare::m_can
TCanvas * m_can
Definition: TRootCompare.h:65
threshold
Definition: chainparser.cxx:74
TRootCompare::m_noMatch
std::vector< std::string > m_noMatch
Definition: TRootCompare.h:76
TRootCompare::sortLabels
void sortLabels(Bool_t sort=kTRUE)
Definition: TRootCompare.h:48
TFileLooper
Base class to loop over all the keys in a ROOT file.
Definition: TFileLooper.h:35
TRootCompare::m_refFile
TFile * m_refFile
Definition: TRootCompare.h:61
TRootCompare::compareHist
Bool_t compareHist(const TH1 &h, const TH1 &href)
Definition: TRootCompare.cxx:382
h
TRootCompare::beginJob
virtual void beginJob()
Definition: TRootCompare.cxx:56
TH1
Definition: rootspy.cxx:268
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
TRootCompare::BIN
@ BIN
Definition: TRootCompare.h:30
TRootCompare::AXIS
@ AXIS
Definition: TRootCompare.h:30
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
TRootCompare::m_refRootDir
TString m_refRootDir
Definition: TRootCompare.h:63
TRootCompare::m_threshold
Double_t m_threshold
Definition: TRootCompare.h:68
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TRootCompare::~TRootCompare
virtual ~TRootCompare()
Definition: TRootCompare.cxx:51
TRootCompare::m_drawNormalized
Bool_t m_drawNormalized
Definition: TRootCompare.h:72