CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
SiStripQualityHistoryPlots.h File Reference

Go to the source code of this file.

Functions

TH1D * AverageRunBadChannels (TFile &ff, const char *module, const char *histo, const bool excludeLastBins=false)
 
TCanvas * StripCompletePlot (TFile &ff, const char *module, const bool excludeLastBins=false)
 

Function Documentation

◆ AverageRunBadChannels()

TH1D* AverageRunBadChannels ( TFile &  ff,
const char *  module,
const char *  histo,
const bool  excludeLastBins = false 
)

Definition at line 17 of file SiStripQualityHistoryPlots.cc.

References gather_cfg::cout, alignCSCRings::ff, CommonAnalyzer::getObject(), CommonAnalyzer::getRunList(), timingPdfMaker::histo, mps_fire::i, callgraph::module, writedatasetfile::runs, CommonAnalyzer::setPath(), and jetUpdater_cfi::sort.

Referenced by StripCompletePlot().

17  {
18  CommonAnalyzer camult(&ff, "", module);
19 
20  TH1D* badchannels = new TH1D("badchannels", "Average Number of Bad Channels vs run", 10, 0., 10.);
21  badchannels->SetCanExtend(TH1::kXaxis);
22 
23  std::vector<unsigned int> runs = camult.getRunList();
24  std::sort(runs.begin(), runs.end());
25 
26  {
27  for (unsigned int i = 0; i < runs.size(); ++i) {
28  char runlabel[100];
29  sprintf(runlabel, "%d", runs[i]);
30  char runpath[100];
31  sprintf(runpath, "run_%d", runs[i]);
32  camult.setPath(runpath);
33 
34  TProfile* multvstime = nullptr;
35  if (multvstime == nullptr)
36  multvstime = (TProfile*)camult.getObject(histo);
37  if (multvstime) {
38  // compute mean exlucing the last filled bins
39 
40  if (excludeLastBins) {
41  int lastbin = multvstime->GetNbinsX() + 1;
42  int firstbin = 1;
43  for (int ibin = multvstime->GetNbinsX() + 1; ibin > 0; --ibin) {
44  if (multvstime->GetBinEntries(ibin) != 0) {
45  lastbin = ibin;
46  break;
47  }
48  }
49 
50  std::cout << "Restricted range: " << firstbin << " " << lastbin << std::endl;
51  multvstime->GetXaxis()->SetRangeUser(multvstime->GetBinLowEdge(firstbin),
52  multvstime->GetBinLowEdge(lastbin - 2));
53  }
54  // fill the summary
55  badchannels->Fill(runlabel, multvstime->GetMean(2));
56  }
57  }
58  }
59  return badchannels;
60 }

◆ StripCompletePlot()

TCanvas* StripCompletePlot ( TFile &  ff,
const char *  module,
const bool  excludeLastBins = false 
)

Definition at line 62 of file SiStripQualityHistoryPlots.cc.

References AverageRunBadChannels(), alignCSCRings::ff, and callgraph::module.

62  {
63  TCanvas* cc = new TCanvas();
64 
65  TH1D* cabling = AverageRunBadChannels(ff, module, "badmodrun_Cabling", excludeLastBins);
66  TH1D* runinfo = AverageRunBadChannels(ff, module, "badmodrun_RunInfo", excludeLastBins);
67  TH1D* badchannel = AverageRunBadChannels(ff, module, "badmodrun_BadChannel", excludeLastBins);
68  TH1D* dcs = AverageRunBadChannels(ff, module, "badmodrun_DCS", excludeLastBins);
69  TH1D* badfiber = AverageRunBadChannels(ff, module, "badmodrun_BadFiber", excludeLastBins);
70 
71  cabling->SetLineColor(kRed);
72  runinfo->SetLineColor(kMagenta);
73  badchannel->SetLineColor(kCyan);
74  dcs->SetLineColor(kGreen);
75  badfiber->SetLineColor(kBlue);
76 
77  badfiber->Draw();
78  dcs->Draw("same");
79  badchannel->Draw("same");
80  runinfo->Draw("same");
81  cabling->Draw("same");
82 
83  return cc;
84 }
TH1D * AverageRunBadChannels(TFile &ff, const char *module, const char *histo, const bool excludeLastBins)