CMS 3D CMS Logo

Functions
SOF_profiles.cc File Reference
#include "SOF_profiles.h"
#include "TCanvas.h"
#include "TFile.h"
#include "TProfile.h"
#include "TH1F.h"
#include "TDirectory.h"
#include "TLine.h"
#include "TGaxis.h"
#include "TLegend.h"
#include <iostream>

Go to the source code of this file.

Functions

TCanvas * printSOF (TFile *file, const int run, const int firstLS, const int zoom)
 

Function Documentation

◆ printSOF()

TCanvas* printSOF ( TFile *  file,
const int  run,
const int  firstLS,
const int  zoom 
)

Definition at line 12 of file SOF_profiles.cc.

References gather_cfg::cout, RefreshWebPage::dname, geometryDiff::file, createfilelist::int, mps_splice::line, rname, and writedatasetfile::run.

12  {
13  TCanvas* canout = nullptr;
14 
15  char rname[400];
16  sprintf(rname, "run_%d", run);
17 
18  if (file == nullptr)
19  return canout;
20 
21  TProfile* badmod = nullptr;
22  TH1F* evtanydcs = nullptr;
23  TH1F* evtdcson = nullptr;
24  TH1F* evtnostrip = nullptr;
25 
26  char dname[422];
27 
28  sprintf(dname, "ssqhistory/%s", rname);
29  if (file->cd(dname)) {
30  badmod = (TProfile*)gDirectory->Get("badmodrun_HVDCS");
31  }
32 
33  sprintf(dname, "eventtimedistranydcs/%s", rname);
34  if (file->cd(dname)) {
35  evtanydcs = (TH1F*)gDirectory->Get("orbit");
36  }
37 
38  sprintf(dname, "eventtimedistribution/%s", rname);
39  if (file->cd(dname)) {
40  evtdcson = (TH1F*)gDirectory->Get("orbit");
41  }
42 
43  sprintf(dname, "eventtimedistrnostrip/%s", rname);
44  if (file->cd(dname)) {
45  evtnostrip = (TH1F*)gDirectory->Get("orbit");
46  }
47 
48  if (badmod && evtanydcs && evtdcson && evtnostrip) {
49  badmod->SetStats(kFALSE);
50  badmod->SetLineColor(kGreen);
51  badmod->SetMarkerColor(kGreen);
52  evtanydcs->SetStats(kFALSE);
53  evtanydcs->SetLineColor(kBlue);
54  evtdcson->SetStats(kFALSE);
55  evtdcson->SetLineColor(kRed);
56  evtnostrip->SetStats(kFALSE);
57  evtnostrip->SetLineColor(kRed);
58  evtnostrip->SetFillColor(kRed);
59  evtnostrip->SetFillStyle(1000);
60 
61  canout = new TCanvas;
62 
63  badmod->Draw();
64  badmod->GetYaxis()->SetRangeUser(1, 100000);
65  badmod->GetYaxis()->SetTitle("");
66  badmod->SetTitle(rname);
67  badmod->GetXaxis()->SetRangeUser((firstLS - zoom) * 262144, (firstLS + zoom) * 262144);
68  evtanydcs->Draw("same");
69  evtdcson->Draw("same");
70  evtnostrip->Rebin(int(badmod->GetBinWidth(1) / evtnostrip->GetBinWidth(1)));
71  std::cout << "rebin " << int(badmod->GetBinWidth(1) / evtnostrip->GetBinWidth(1)) << std::endl;
72  evtnostrip->Draw("same");
73 
74  TGaxis* lsaxis = new TGaxis((firstLS - zoom) * 262144,
75  100000,
76  (firstLS + zoom) * 262144,
77  100000,
78  firstLS - zoom + 1,
79  firstLS + zoom + 1,
80  2 * zoom,
81  "-SM");
82  // TGaxis* lsaxis = new TGaxis(badmod->GetXaxis()->GetXmin(),100000,
83  // badmod->GetXaxis()->GetXmax(),100000,
84  // badmod->GetXaxis()->GetXmin()/262144+1,badmod->GetXaxis()->GetXmax()/262144+1,50,"-SM");
85  lsaxis->Draw();
86 
87  TLine* line = new TLine((firstLS - 1) * 262144, 1, (firstLS - 1) * 262144, 100000);
88  line->SetLineWidth(2);
89  line->SetLineStyle(2);
90  line->Draw();
91 
92  TLegend* leg = new TLegend(.5, .65, .9, .85, "");
93  leg->AddEntry(badmod, "Modules with HV off", "l");
94  leg->AddEntry(evtanydcs, "Events with any DCS bit", "l");
95  leg->AddEntry(evtdcson, "Events with DCS bit ON", "l");
96  leg->AddEntry(evtnostrip, "DCS bit ON No strip clus (masked FED)", "f");
97  leg->AddEntry(line, "first good LS (DCSonly JSON)", "l");
98 
99  leg->SetFillStyle(0);
100  leg->Draw();
101 
102  canout->SetLogy(1);
103  }
104 
105  return canout;
106 }
const G4String rname[NREG]