CMS 3D CMS Logo

Functions
SiStripQualityHistoryPlots.cc File Reference
#include "SiStripQualityHistoryPlots.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include "TPad.h"
#include "TFile.h"
#include "TH2F.h"
#include "TH1F.h"
#include "TProfile.h"
#include "TGraph.h"
#include "DPGAnalysis/SiStripTools/interface/CommonAnalyzer.h"
#include "TCanvas.h"
#include "TStyle.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ AverageRunBadChannels()

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

Definition at line 17 of file SiStripQualityHistoryPlots.cc.

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 }

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

Referenced by StripCompletePlot().

◆ StripCompletePlot()

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

Definition at line 62 of file SiStripQualityHistoryPlots.cc.

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 }

References AverageRunBadChannels(), and alignCSCRings::ff.

mps_fire.i
i
Definition: mps_fire.py:428
gather_cfg.cout
cout
Definition: gather_cfg.py:144
writedatasetfile.runs
runs
Definition: writedatasetfile.py:27
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
CommonAnalyzer
Definition: CommonAnalyzer.h:12
alignCSCRings.ff
ff
Definition: alignCSCRings.py:148
cc
AverageRunBadChannels
TH1D * AverageRunBadChannels(TFile &ff, const char *module, const char *histo, const bool excludeLastBins)
Definition: SiStripQualityHistoryPlots.cc:17