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:

Sticking ADC counts in neughbouring TS for HB:

Sticking ADC counts in neughbouring TS for HE:

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 GCPpyPlots::argv, alignmentValidation::c1, gather_cfg::cout, ALCARECOPPSCalTrackBasedSel_cff::detid, MillePedeFileConverter_cfg::e, createIOVlist::filelist, corrVsCorr::filename, groupFilesInBlocks::fin, timingPdfMaker::histo, isotrackApplyRegressor::k, MainPageGenerator::l, mps_splice::line, WZElectronSkims53X_cff::max, SiStripPI::min, DeadROCCounter_Phase1::outname, DeadROC_duringRun::runNum, AlCaHLTBitMon_QueryRunRegistry::string, and compareTotals::ttitle.

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