Skip to content

Commit 7e3d954

Browse files
committed
New root macros added
1 parent 019649b commit 7e3d954

9 files changed

+1108
-0
lines changed

DPGAnalysis/SiStripTools/bin/ClusMultPlots.cc

+441
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef DPGAnalysis_SiStripTools_ClusMultPlots_h
2+
#define DPGAnalysis_SiStripTools_ClusMultPlots_h
3+
4+
class TH1D;
5+
class TFile;
6+
7+
void ClusMultPlots(const char* fullname, const char* pxmod, const char* strpmod, const char* corrmod,
8+
const char* pxlabel, const char* strplabel, const char* corrlabel, const char* postfix, const char* shortname, const char* outtrunk);
9+
void ClusMultInvestPlots(const char* fullname, const char* mod, const char* label, const char* postfix, const char* subdet, const char* shortname, const char* outtrunk);
10+
void ClusMultCorrPlots(const char* fullname, const char* mod, const char* label, const char* postfix, const char* shortname, const char* outtrunk);
11+
void ClusMultVtxCorrPlots(const char* fullname, const char* mod, const char* label, const char* postfix, const char* subdet, const char* shortname, const char* outtrunk);
12+
void ClusMultLumiCorrPlots(const char* fullname, const char* mod, const char* label,const char* postfix, const char* subdet, const char* shortname, const char* outtrunk);
13+
14+
#endif // DPGAnalysis_SiStripTools_ClusMultPlots_h
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
#include "OccupancyPlotMacros.h"
22
#include "MultiplicityPlotMacros.h"
3+
#include "StatisticsPlots.h"
4+
#include "ClusMultPlots.h"
5+
#include "SOF_profiles.h"
6+
#include "SiStripQualityHistoryPlots.h"
37
#ifdef __CINT__
48
#pragma link off all functions;
59
#pragma link C++ function PlotOccupancyMap;
610
#pragma link C++ function AverageRunMultiplicity;
711
#pragma link C++ function PlotPixelMultVtxPos;
12+
#pragma link C++ function DeadTimeAPVCycle;
13+
#pragma link C++ function CombinedHisto;
14+
#pragma link C++ function TimeRatio;
15+
#pragma link C++ function SummaryHisto;
16+
#pragma link C++ function SummaryHistoRatio;
17+
#pragma link C++ function Combined2DHisto;
18+
#pragma link C++ function StatisticsPlots;
19+
#pragma link C++ function ClusMultPlots;
20+
#pragma link C++ function ClusMultInvestPlots;
21+
#pragma link C++ function ClusMultCorrPlots;
22+
#pragma link C++ function ClusMultVtxCorrPlots;
23+
#pragma link C++ function ClusMultLumiCorrPlots;
24+
#pragma link C++ function printSOF;
25+
#pragma link C++ function AverageRunBadChannels;
26+
#pragma link C++ function StripCompletePlot;
827
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef DPGAnalysis_SiStripTools_SOF_profiles_h
2+
#define DPGAnalysis_SiStripTools_SOF_profiles_h
3+
4+
class TCanvas;
5+
class TFile;
6+
7+
TCanvas* printSOF(TFile* file, const int run, const int firstLS,const int zoom);
8+
9+
#endif // DPGAnalysis_SiStripTools_SOF_profiles_h
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#include "SiStripQualityHistoryPlots.h"
2+
#include <iostream>
3+
#include <algorithm>
4+
#include <vector>
5+
#include <string>
6+
#include <map>
7+
#include "TPad.h"
8+
#include "TFile.h"
9+
#include "TH2F.h"
10+
#include "TH1F.h"
11+
#include "TProfile.h"
12+
#include "TGraph.h"
13+
#include "DPGAnalysis/SiStripTools/interface/CommonAnalyzer.h"
14+
#include "TCanvas.h"
15+
#include "TStyle.h"
16+
17+
18+
TH1D* AverageRunBadChannels(TFile& ff, const char* module, const char* histo, const bool excludeLastBins) {
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->SetBit(TH1::kCanRebin);
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=0;
39+
if(multvstime==0) 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+
}
67+
68+
TCanvas* StripCompletePlot(TFile& ff, const char* module, const bool excludeLastBins) {
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef DPGAnalysis_SiStripTools_SiStripQualityHistoryPlots_h
2+
#define DPGAnalysis_SiStripTools_SiStripQualityHistoryPlots_h
3+
4+
class TH1D;
5+
class TCanvas;
6+
class TFile;
7+
8+
TH1D* AverageRunBadChannels(TFile& ff, const char* module, const char* histo, const bool excludeLastBins=false);
9+
TCanvas* StripCompletePlot(TFile& ff, const char* module, const bool excludeLastBins=false);
10+
11+
#endif // DPGAnalysis_SiStripTools_SiStripQualityHistoryPlots_h

0 commit comments

Comments
 (0)