CMS 3D CMS Logo

Functions
moduleOccupancyTrend.cc File Reference
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <TROOT.h>
#include <TStyle.h>
#include "TFile.h"
#include "THStack.h"
#include "TH1D.h"
#include "TDirectoryFile.h"
#include "TCanvas.h"
#include "TLine.h"
#include "TLegend.h"
#include "TRint.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ main()

int main ( int  argc,
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:

Definition at line 17 of file moduleOccupancyTrend.cc.

References cmsBatch::argv, alignmentValidation::c1, gather_cfg::cout, MillePedeFileConverter_cfg::e, harvestHGCalValidationPlots::filelist, corrVsCorr::filename, groupFilesInBlocks::fin, timingPdfMaker::histo, dqmdumpme::k, MainPageGenerator::l, mps_splice::line, SiStripPI::max, SiStripPI::min, DeadROCCounter_Phase1::outname, DeadROC_duringRun::runNum, AlCaHLTBitMon_QueryRunRegistry::string, and compareTotals::ttitle.

17  {
18 
19  gROOT->SetStyle("Plain");
20 
21  char* filelist;
22  char* modulelist;
23 
24  filelist= argv[1];
25  modulelist= argv[2];
26 
27  int stripmin = 999;
28  int stripmax = 999;
29 
30  if (argv[3] && argv[4]){
31  stripmin=atoi(argv[3]);
32  stripmax=atoi(argv[4]);
33  }
34 
35  std::string detid;
36  std::string hn;
37 
38  TLegend leg(0.1,0.7,0.2,0.9);
39  leg.SetFillStyle(0);
40 
41  std::ifstream inmodules(modulelist);
42 
43  while(true){
44 
45  inmodules >> detid;
46  if (!inmodules.good()) break;
47 
48  hn="ClusterDigiPosition__det__" + detid;//std::to_string(detid);
49 
50  TCanvas c1("c1","c1",1600,900);
51 
52  c1.SetBatch(kTRUE);
53  c1.SetLogy(1);
54  c1.SetGridy(1);
55 
56  //cout << detid << endl;
57  std::ifstream fileToCountLines(filelist);
58  std::size_t lines_count =0;
60 
61  while (std::getline(fileToCountLines , line))
62  ++lines_count;
63 
64  const float dim=lines_count;
65 
66  std::ifstream filesin(filelist);
67 
69  int k=0;
70 
71  TH1D* trend=new TH1D("trend","trend",int(dim),0.5,dim+0.5);
72  trend->SetMarkerSize(3);
73  trend->SetMarkerStyle(8);
74  trend->SetMarkerColor(4);
75 
76  std::string ttitle=hn+"_trend";
77  trend->SetTitle(ttitle.c_str());
78 
79  double max=-1;
80  double min=1000000;
81 
82  leg.Clear();
83  TFile* fin;
84 
85  THStack *hs = new THStack("hs","");
86 
87 
88  while(true){
89 
90  filesin >> filename;
91  if (!filesin.good()) break;
92 
93  std::string runNum= filename.substr(filename.find("run_")+4, 6);
94  //std::cout << runNum << std::endl;
95 
96  fin=TFile::Open(filename.c_str());
97 
98  if (!fin) {std::cout << "Cannot open file " << filename.c_str() << std::endl;
99  return 0;
100  }
101 
102  TH1D* Events=(TH1D*)fin->Get("TotEvents");
103 
104  double EvtNum=Events->GetBinContent(1);
105 
106  TH1D* histo=(TH1D*) fin->Get(hn.c_str());
107 
108  if (!histo) {std::cout << "Cannot open histo " << hn.c_str() << std::endl;
109  return 0;
110  }
111 
112  histo->SetDirectory(nullptr);
113  histo->SetStats(kFALSE);
114 
115  if (hn.find("Summary")==std::string::npos) histo->Scale(1/EvtNum);
116 
117  double numberPerEvent;
118  if (stripmin==999 && stripmax==999) numberPerEvent=histo->Integral();
119  else numberPerEvent=histo->Integral(stripmin,stripmax);
120 
121 
122  if (max<=histo->GetBinContent(histo->GetMaximumBin())) max=histo->GetBinContent(histo->GetMaximumBin());
123  if (min>histo->GetBinContent(histo->GetMinimumBin())) min=histo->GetBinContent(histo->GetMinimumBin());
124 
125  histo->SetLineColor(k+1);
126  histo->SetMarkerStyle(9);
127  histo->SetMarkerColor(k+1);
128 
129  trend->SetBinContent(k+1,numberPerEvent);
130  trend->GetXaxis()->SetBinLabel(k+1,runNum.c_str());
131 
132  leg.AddEntry(histo, runNum.c_str(), "L");
133  hs->Add(histo);
134  k++;
135 
136  fin->Close();
137  }
138 
139  if (min==0) min=1.e-6;
140 
141  max=max*10;// in a way one can read the legend
142 
143  hs->SetMaximum(max);
144  hs->SetMinimum(min);
145  hs->SetTitle(hn.c_str());
146 
147  hs->Draw("nostack");
148 
149  TLine l;
150 
151  l.SetLineColor(4);
152  l.SetLineStyle(2);
153  l.SetLineWidth(3);
154 
155  l.DrawLine(128,min,128,max);
156  l.DrawLine(256,min,256,max);
157  l.DrawLine(384,min,384,max);
158  l.DrawLine(384,min,384,max);
159  l.DrawLine(512,min,512,max);
160  l.DrawLine(640,min,640,max);
161 
162  leg.Draw();
163  std::string outname= hn+"_Super.png";
164  c1.SaveAs(outname.c_str());
165 
166  c1.SetGridx(1);
167 
168  double mintrend=0;
169  if (trend->GetMinimum()==0) mintrend=1.e-4;
170  else mintrend=trend->GetMinimum();
171 
172  trend->SetStats(kFALSE);
173 
174  trend->GetYaxis()->SetRangeUser(mintrend*0.5,trend->GetMaximum()*2);
175  trend->Draw("P");
176  outname=hn+"_Trend.png";
177  c1.SaveAs(outname.c_str());
178  c1.Clear();
179 
180  delete trend;
181 
182  }
183  return 0;
184 }