CMS 3D CMS Logo

Functions
compareHists.cc File Reference
#include <iostream>
#include <string>
#include <vector>
#include "TROOT.h"
#include "TFile.h"
#include "TKey.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TCanvas.h"
#include "TPostScript.h"
#include "TPaveText.h"
#include "TStyle.h"
#include "TText.h"

Go to the source code of this file.

Functions

std::vector< std::string > getAllKeys (const TDirectory *fDir, const std::string &fClassName)
 
std::vector< std::string > getAllObjects (const TDirectory *fDir, const std::string &fClassName)
 
TObject * getObject (TDirectory *fDir, const std::vector< std::string > &fObjectName)
 
int main (int argn, char *argv [])
 
double makeGifHists (TH1 *fHist, TH1 *fRefHist, TCanvas *fCanvas, const std::string &fPrefix="")
 

Function Documentation

◆ getAllKeys()

std::vector<std::string> getAllKeys ( const TDirectory *  fDir,
const std::string &  fClassName 
)

Definition at line 16 of file compareHists.cc.

References gather_cfg::cout, submitPVResolutionJobs::key, GetRecoTauVFromDQM_MC_cff::next, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by main().

16  {
17  std::cout << "getAllKeys-> " << fDir->GetName() << ", " << fClassName << std::endl;
18  // fDir->ls();
19  std::vector<std::string> result;
20  TIter next (fDir->GetListOfKeys ());
21  for (TKey* key = 0; (key = (TKey *) next());) {
22  std::cout << "key from list: " << key->GetName() << '/' << key->GetClassName () << std::endl;
23  if (fClassName == key->GetClassName ()) {
24  result.push_back (std::string (key->GetName ()));
25  }
26  }
27  return result;
28 }
key
prepare the HTCondor submission files and eventually submit them

◆ getAllObjects()

std::vector<std::string> getAllObjects ( const TDirectory *  fDir,
const std::string &  fClassName 
)

Definition at line 30 of file compareHists.cc.

References gather_cfg::cout, GetRecoTauVFromDQM_MC_cff::next, getGTfromDQMFile::obj, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
31  std::cout << "getAllObjects-> " << fDir->GetName() << ", " << fClassName << std::endl;
32  // fDir->ls();
33  std::vector<std::string> result;
34  TIter next (fDir->GetList ());
35  for (TObject* obj = 0; (obj = (TObject *) next());) {
36  std::cout << "name from list: " << obj->GetName() << '/' << obj->ClassName () << std::endl;
37  if (fClassName == obj->ClassName ()) {
38  result.push_back (std::string (obj->GetName ()));
39  }
40  }
41  return result;
42 }

◆ getObject()

TObject* getObject ( TDirectory *  fDir,
const std::vector< std::string > &  fObjectName 
)

Definition at line 44 of file compareHists.cc.

References DMR_cfg::cerr, DeadROC_duringRun::dir, mps_fire::i, and mps_fire::result.

Referenced by main().

44  {
45  TObject* result = 0; // nothing so far
46  TDirectory* dir = fDir;
47  for (unsigned i = 0; i < fObjectName.size (); ++i) {
48  dir->GetObject (fObjectName[i].c_str(), result);
49  if (result) {
50  if (i < fObjectName.size () - 1) {
51  dir = (TDirectory*) result;
52  result = 0;
53  }
54  }
55  else {
56  std::cerr << "getObject-> Can not find (sub)dir/object " << fObjectName[i] << " in directory " << dir->GetName () << std::endl;
57  return 0;
58  }
59  }
60  return result;
61 }

◆ main()

int main ( int  argn,
char *  argv[] 
)

===============================================================================================================================================================================================


variant2: for each run define phi-averaged A for normalization channel (Dref,16) and then, divide Rijk on it, i.e. get RRijk




















































































eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=29 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=28

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:





Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:


CALO JETS


PF JETS

Definition at line 104 of file compareHists.cc.

References GCPpyPlots::argv, svgfig::canvas(), DMR_cfg::cerr, gather_cfg::cout, L1TDiffHarvesting_cfi::dir1, L1TDiffHarvesting_cfi::dir2, getAllKeys(), getObject(), compareTotals::hist, makeListRunsInFiles::inputFile, InefficientDoubleROC::inputFileName, makeGifHists(), dataCertificationJetMET_cfi::refFileName, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

104  {
105  int result = 0; // OK
106 
109  std::string globalTitle = argn > 2 ? argv[3] : "";
110  std::cout << "Processing file " << inputFileName << std::endl;
111  TFile* inputFile = TFile::Open (inputFileName.c_str());
112  TFile* refFile = TFile::Open (refFileName.c_str());
113  if (inputFile) {
114  std::cout << "ls for the file:" << std::endl;
115  inputFile->ls ();
116 
117  std::vector<std::string> dirName1 = getAllKeys (inputFile, "TDirectory");
118  for (unsigned idir = 0; idir < dirName1.size(); idir++) {
119  TDirectory* dir1 = 0;
120  inputFile->GetObject (dirName1[idir].c_str(), dir1);
121  if (dir1) {
122  std::vector<std::string> dirName2 = getAllKeys (dir1, "TDirectory");
123  for (unsigned idir2 = 0; idir2 < dirName1.size(); ++idir2) {
124  TDirectory* dir2 = 0;
125  dir1->GetObject (dirName2[idir2].c_str(), dir2);
126  if (dir2) {
127  std::vector<std::string> histKeys = getAllKeys (dir2, "TH1F");
128  // output
129  gStyle->SetOptStat (kFALSE);
130  TCanvas canvas ("Jets","Jets",800,600);
131  TPostScript ps ((dirName2[idir2]+std::string(".ps")).c_str(), -112);
132  ps.Range(29.7 , 21.0);
133  for (unsigned ihist = 0; ihist < histKeys.size (); ++ihist) {
134  TH1* hist = 0;
135  dir2->GetObject (histKeys[ihist].c_str(), hist);
136  if (hist) {
137  std::vector<std::string> histPathName;
138  histPathName.push_back (dirName1[idir]);
139  histPathName.push_back (dirName2[idir2]);
140  histPathName.push_back (histKeys[ihist]);
141  TH1* refhist = (TH1*) getObject (refFile, histPathName);
142  if (refhist) {
143  std::string title = globalTitle.empty () ? dirName2[idir2] : globalTitle;
144  double pv = makeGifHists (hist, refhist, &canvas, title);
145  std::cout << "pv for hist " << dirName1[idir] << '/' << dirName2[idir2] << '/' << histKeys[ihist] << " is " << pv << std::endl;
146  ps.NewPage();
147  }
148  }
149  else {
150  std::cerr << "Can not get histogram " << histKeys[ihist] << std::endl;
151  }
152  }
153  }
154  }
155  }
156  else {
157  std::cerr << "Can not find dir1: " << dirName1[idir] << std::endl;
158  }
159  }
160  }
161  else {
162  std::cerr << " Can not open input file " << inputFileName << std::endl;
163  result = 1;
164  }
165  return result;
166 }
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
Definition: compareHists.cc:44
std::vector< std::string > getAllKeys(const TDirectory *fDir, const std::string &fClassName)
Definition: compareHists.cc:16
double makeGifHists(TH1 *fHist, TH1 *fRefHist, TCanvas *fCanvas, const std::string &fPrefix="")
Definition: compareHists.cc:63
def canvas(sub, attr)
Definition: svgfig.py:482

◆ makeGifHists()

double makeGifHists ( TH1 *  fHist,
TH1 *  fRefHist,
TCanvas *  fCanvas,
const std::string &  fPrefix = "" 
)

Definition at line 63 of file compareHists.cc.

References visDQMUpload::buf, corrVsCorr::filename, Skims_PA_cff::name, MetAnalyzer::pv(), AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by main().

63  {
64  double pv = fHist->KolmogorovTest (fRefHist, "OU");
65  // set style
66  TPad pad ("pad", "pad", 0, 0, 1, 0.9, 0);
67  pad.SetLogy ();
68  pad.Draw();
69 
70  char buf [1024];
71  sprintf (buf, "%s: Kolmogorov Test PV = %5.3f", fPrefix.c_str(), pv);
72  TPaveText title (0.3,0.85,0.95, 0.99, buf);
73  title.SetFillColor(pv > 0.01 ? 3 : 2);
74  // TText* t1 = title.AddText (fPrefix.c_str());
75  sprintf (buf, "Kolmogorov Test PV = %6.4f", pv);
76  // TText* t2 = title.AddText (buf);
77  // t2->SetTextSize(0.3);
78  title.Draw();
79 
80  pad.cd();
81 
82  fHist->Sumw2 ();
83  fHist->Scale (fRefHist->GetSumOfWeights () / fHist->GetSumOfWeights ());
84 
85  fHist->SetMarkerStyle (21);
86  fHist->SetMarkerSize (0.7);
87  fRefHist->SetLineColor (2);
88  fRefHist->SetFillColor (42);
89  std::string name = fRefHist->GetTitle ();
90  int blank = name.rfind (' ');
91  if (blank >= 0) name.erase (0, blank+1);
92  fHist->SetXTitle (name.c_str());
93  fHist->SetTitle ("");
94 
95  fRefHist->Draw ();
96  fHist->Draw ("e1p,same");
97  std::string filename = name + ".gif";
98  fCanvas->Print (filename.c_str());
99  fCanvas->Update ();
100  return pv;
101 }
def pv(vc)
Definition: MetAnalyzer.py:7