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

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, createfilelist::int, create_public_lumi_plots::leg, and mps_splice::line.

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