CMS 3D CMS Logo

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

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

Definition at line 18 of file SiStripQualityHistoryPlots.cc.

References gather_cfg::cout, CommonAnalyzer::getObject(), CommonAnalyzer::getRunList(), mps_fire::i, writedatasetfile::runs, CommonAnalyzer::setPath(), and jetUpdater_cfi::sort.

Referenced by StripCompletePlot().

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

Definition at line 68 of file SiStripQualityHistoryPlots.cc.

References AverageRunBadChannels().

68  {
69 
70  TCanvas* cc = new TCanvas();
71 
72  TH1D* cabling = AverageRunBadChannels(ff,module,"badmodrun_Cabling",excludeLastBins);
73  TH1D* runinfo = AverageRunBadChannels(ff,module,"badmodrun_RunInfo",excludeLastBins);
74  TH1D* badchannel = AverageRunBadChannels(ff,module,"badmodrun_BadChannel",excludeLastBins);
75  TH1D* dcs = AverageRunBadChannels(ff,module,"badmodrun_DCS",excludeLastBins);
76  TH1D* badfiber = AverageRunBadChannels(ff,module,"badmodrun_BadFiber",excludeLastBins);
77 
78  cabling->SetLineColor(kRed);
79  runinfo->SetLineColor(kMagenta);
80  badchannel->SetLineColor(kCyan);
81  dcs->SetLineColor(kGreen);
82  badfiber->SetLineColor(kBlue);
83 
84  badfiber->Draw();
85  dcs->Draw("same");
86  badchannel->Draw("same");
87  runinfo->Draw("same");
88  cabling->Draw("same");
89 
90  return cc;
91 }
TH1D * AverageRunBadChannels(TFile &ff, const char *module, const char *histo, const bool excludeLastBins)
Definition: vlib.h:208