test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SOF_profiles.cc
Go to the documentation of this file.
1 #include "SOF_profiles.h"
2 #include "TCanvas.h"
3 #include "TFile.h"
4 #include "TProfile.h"
5 #include "TH1F.h"
6 #include "TDirectory.h"
7 #include "TLine.h"
8 #include "TGaxis.h"
9 #include "TLegend.h"
10 #include <iostream>
11 
12 TCanvas* printSOF(TFile* file, const int run, const int firstLS,const int zoom) {
13 
14  TCanvas* canout = 0;
15 
16  char rname[400];
17  sprintf(rname,"run_%d",run);
18 
19  if(file==0) return canout;
20 
21  TProfile* badmod = 0;
22  TH1F* evtanydcs = 0;
23  TH1F* evtdcson = 0;
24  TH1F* evtnostrip = 0;
25 
26  char dname[400];
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 }
TCanvas * printSOF(TFile *file, const int run, const int firstLS, const int zoom)
Definition: SOF_profiles.cc:12
tuple cout
Definition: gather_cfg.py:145