CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Functions
makeModulePlots.cc File Reference
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include "TFile.h"
#include "TH1D.h"
#include "TCanvas.h"

Go to the source code of this file.

Macros

#define NOISEPREFIX   "Profile_NoiseFromCondDB__det__"
 
#define PEDESTALPREFIX   "Profile_PedestalFromCondDB__det__"
 

Functions

int main (int argc, char *argv[])
 
void printPlot (TH1D *hist, char *prefix, char *postfix)
 

Macro Definition Documentation

#define NOISEPREFIX   "Profile_NoiseFromCondDB__det__"

Definition at line 10 of file makeModulePlots.cc.

Referenced by main().

#define PEDESTALPREFIX   "Profile_PedestalFromCondDB__det__"

Definition at line 11 of file makeModulePlots.cc.

Referenced by main().

Function Documentation

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

Definition at line 15 of file makeModulePlots.cc.

References gather_cfg::cout, cond::rpcobgas::detid, estimatePileup::hist, NOISEPREFIX, PEDESTALPREFIX, prof2calltree::prefix, printPlot(), and reco_application_2006_simpleTBanalysis_cfg::rootfile.

15  {
16 
17  char* rootfilename;
18  char* modulelistname;
19  int pnbits;
20  char* prefix;
21  char* postfix;
22 
23  if(argc==6) {
24  rootfilename = argv[1];
25  modulelistname = argv[2];
26  pnbits = atoi(argv[3]);
27  prefix = argv[4];
28  postfix = argv[5];
29  }
30  else {
31  std::cout << "Wrong number of parameters " << argc << std::endl;
32  return 1;
33  }
34 
35  std::cout << "ready to go " << rootfilename << ' ' << modulelistname << std::endl;
36 
37  TFile* rootfile = new TFile(rootfilename,"READ");
38  if(!rootfile) {
39  std::cout << "Problems with input root file" << std::endl;
40  return 2;
41  }
42  int detid;
43  std::ifstream modulelist(modulelistname);
44 
45 
46 
47  while (modulelist >> detid) {
48  std::cout << " ready to go with detid " << detid << " " << pnbits << std::endl;
49  // bit 0: noise
50  if(pnbits & 1) {
51  std::stringstream histoname;
52  histoname << NOISEPREFIX << detid;
53  std::cout << " ready to go with histogram " << histoname.str() << std::endl;
54  TH1D* hist = (TH1D*)rootfile->FindObjectAny(histoname.str().c_str());
55  if(hist) {
56  std:: cout << histoname.str() << " found!" << std::endl;
57  printPlot(hist,prefix,postfix);
58  } else {
59  std:: cout << histoname.str() << " NOT found..." << std::endl;
60  }
61  }
62  // bit 1: pedestal
63  if(pnbits & 2) {
64  std::stringstream histoname;
65  histoname << PEDESTALPREFIX << detid;
66  std::cout << " ready to go with histogram " << histoname.str() << std::endl;
67  TH1D* hist = (TH1D*)rootfile->FindObjectAny(histoname.str().c_str());
68  if(hist) {
69  std:: cout << histoname.str() << " found!" << std::endl;
70  printPlot(hist,prefix,postfix);
71  } else {
72  std:: cout << histoname.str() << " NOT found..." << std::endl;
73  }
74  }
75  }
76 
77  return 0;
78 
79 }
void printPlot(TH1D *hist, char *prefix, char *postfix)
#define PEDESTALPREFIX
tuple argc
Definition: dir2webdir.py:38
#define NOISEPREFIX
tuple cout
Definition: gather_cfg.py:121
void printPlot ( TH1D *  hist,
char *  prefix,
char *  postfix 
)