1 |
battilan |
1.5 |
/*
|
2 |
battilan |
1.1 |
* See header file for a description of this class.
|
3 |
|
|
*
|
4 |
battilan |
1.5 |
* $Date: 2008/12/19 16:36:40 $
|
5 |
|
|
* $Revision: 1.4 $
|
6 |
battilan |
1.1 |
* \author G. Mila - INFN Torino
|
7 |
|
|
* revised U.G. 2007/07/24
|
8 |
|
|
* Modified M.C Fouz. 2008/04/22
|
9 |
|
|
* Updated for version 200
|
10 |
|
|
* include the run & sector number on gif files
|
11 |
|
|
*/
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
#include <UserCode/DTDPGAnalysis/src/DTDPGCreateSummary.h>
|
15 |
cerminar |
1.4 |
#include "UserCode/DTDPGAnalysis/src/DTROUtility.h"
|
16 |
battilan |
1.1 |
|
17 |
|
|
// Framework
|
18 |
|
|
#include <FWCore/Utilities/interface/Exception.h>
|
19 |
|
|
#include <FWCore/Framework/interface/Event.h>
|
20 |
|
|
#include <FWCore/Framework/interface/EventSetup.h>
|
21 |
|
|
|
22 |
|
|
// Geometry
|
23 |
|
|
#include "Geometry/Records/interface/MuonGeometryRecord.h"
|
24 |
|
|
#include "Geometry/DTGeometry/interface/DTGeometry.h"
|
25 |
|
|
#include "Geometry/DTGeometry/interface/DTLayer.h"
|
26 |
|
|
#include "Geometry/DTGeometry/interface/DTTopology.h"
|
27 |
|
|
|
28 |
|
|
#include "FWCore/MessageLogger/interface/MessageLogger.h"
|
29 |
|
|
|
30 |
|
|
#include <iostream>
|
31 |
|
|
#include <string>
|
32 |
|
|
#include <sstream>
|
33 |
|
|
#include <iomanip>
|
34 |
|
|
#include <math.h>
|
35 |
|
|
|
36 |
|
|
#include "TH1F.h"
|
37 |
|
|
#include "TF1.h"
|
38 |
|
|
#include "TH2F.h"
|
39 |
|
|
#include "TCanvas.h"
|
40 |
|
|
#include "TGraph.h"
|
41 |
|
|
#include "TFile.h"
|
42 |
|
|
#include "TPostScript.h"
|
43 |
|
|
#include "TProfile.h"
|
44 |
|
|
#include "TStyle.h"
|
45 |
|
|
#include "TFolder.h"
|
46 |
battilan |
1.5 |
#include "TText.h"
|
47 |
battilan |
1.1 |
#include "boost/filesystem.hpp"
|
48 |
|
|
|
49 |
|
|
using namespace edm;
|
50 |
|
|
using namespace std;
|
51 |
|
|
using namespace boost::filesystem;
|
52 |
|
|
|
53 |
|
|
DTDPGCreateSummary::DTDPGCreateSummary(const edm::ParameterSet& ps) : myFile(0){
|
54 |
|
|
|
55 |
|
|
LogVerbatim("DTDPGSummary") << "[DTDPGCreateSummary]: Constructor";
|
56 |
|
|
|
57 |
|
|
myParameters = ps;
|
58 |
|
|
myRunNumber = ps.getUntrackedParameter<int>("runNumber",0);
|
59 |
|
|
|
60 |
|
|
// TCanvas c1("c1","",600,780);
|
61 |
|
|
myCanvas = new TCanvas("c1", "",201,81,999,699);
|
62 |
battilan |
1.5 |
myCanvas->SetFillColor(0);
|
63 |
battilan |
1.1 |
|
64 |
|
|
gStyle->SetPalette(1);
|
65 |
battilan |
1.5 |
gStyle->SetStatColor(0);
|
66 |
battilan |
1.1 |
gStyle->SetStatX(0.99);
|
67 |
|
|
gStyle->SetStatW(0.29);
|
68 |
|
|
gStyle->SetStatY(0.98);
|
69 |
|
|
gStyle->SetStatH(0.30);
|
70 |
|
|
gStyle->SetTitleH(0.1);
|
71 |
|
|
gStyle->SetTitleW(0.97);
|
72 |
|
|
|
73 |
battilan |
1.5 |
|
74 |
|
|
gStyle->SetTitleFillColor(0);
|
75 |
battilan |
1.1 |
}
|
76 |
|
|
|
77 |
|
|
DTDPGCreateSummary::~DTDPGCreateSummary(){
|
78 |
|
|
|
79 |
|
|
edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateSummary]: Destructor ";
|
80 |
|
|
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
|
84 |
battilan |
1.5 |
void DTDPGCreateSummary::beginJob(){
|
85 |
battilan |
1.1 |
|
86 |
|
|
edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateSummary]: BeginJob";
|
87 |
battilan |
1.5 |
}
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
void DTDPGCreateSummary::beginRun(const edm::Run& run,const edm::EventSetup& context){
|
91 |
|
|
|
92 |
|
|
edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateSummary]: BeginRun";
|
93 |
battilan |
1.1 |
context.get<MuonGeometryRecord>().get(myMuonGeom);
|
94 |
|
|
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
void DTDPGCreateSummary::analyze(const edm::Event& e, const edm::EventSetup& context){
|
98 |
|
|
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
void DTDPGCreateSummary::endJob(){
|
103 |
|
|
|
104 |
|
|
edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateSummary]: endJob";
|
105 |
|
|
|
106 |
|
|
myFile = new TFile(myParameters.getUntrackedParameter<string>("rootFileName", "DTEfficiencyTest.root").c_str(), "READ");
|
107 |
|
|
|
108 |
|
|
char cMainFolder[30];sprintf(cMainFolder,"DQMData/Run %d", myRunNumber);
|
109 |
|
|
TFolder * mfolder=(TFolder*)myFile->Get(cMainFolder);
|
110 |
|
|
if(!mfolder) {
|
111 |
|
|
throw cms::Exception("DTDPGCreateSummaryError") << "[DTDPGCreateSummary]: Folder = " << cMainFolder << " does not exist!!! Check the run number" << endl;
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
myMainFolder.append(cMainFolder);
|
115 |
|
|
myMainFolder.append("/DT/Run summary/");
|
116 |
cerminar |
1.4 |
|
117 |
|
|
DTROUtility roUtil(myFile,myMainFolder);
|
118 |
|
|
map<int,std::vector<int> > mySectors = roUtil.getSectorMap();
|
119 |
|
|
|
120 |
battilan |
1.1 |
|
121 |
|
|
edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateSummary]: Creating summaries!";
|
122 |
battilan |
1.3 |
|
123 |
|
|
std::map<int,std::vector<int> >::const_iterator whIt = mySectors.begin();
|
124 |
|
|
std::map<int,std::vector<int> >::const_iterator whEnd = mySectors.end();
|
125 |
|
|
for(;whIt!=whEnd;++whIt) {
|
126 |
|
|
int wh = (*whIt).first;
|
127 |
|
|
std::vector<int>::const_iterator secIt = (*whIt).second.begin();
|
128 |
|
|
std::vector<int>::const_iterator secEnd = (*whIt).second.end();
|
129 |
|
|
for(;secIt!=secEnd;++secIt) {
|
130 |
|
|
int sec = (*secIt);
|
131 |
battilan |
1.1 |
if (myParameters.getUntrackedParameter<bool>("DataIntegrityHistos", false)) { createDataIntegrityPlots(wh,sec); }
|
132 |
|
|
if (myParameters.getUntrackedParameter<bool>("DigiHistos", false)) { createDigiPlots(wh,sec); }
|
133 |
|
|
if (myParameters.getUntrackedParameter<bool>("RecoHistos", false)) { createRecoPlots(wh,sec); }
|
134 |
|
|
if (myParameters.getUntrackedParameter<bool>("ResoHistos", false)) { createResoPlots(wh,sec); }
|
135 |
|
|
if (myParameters.getUntrackedParameter<bool>("EfficiencyHistos", false)) { createEfficiencyPlots(wh,sec); }
|
136 |
|
|
if (myParameters.getUntrackedParameter<bool>("TestPulsesHistos", false)) { createTestPulsePlots(wh,sec); }
|
137 |
|
|
if (myParameters.getUntrackedParameter<bool>("TriggerHistos", false) && sec<=12) { createTriggerPlots(wh,sec); }
|
138 |
|
|
}
|
139 |
|
|
}
|
140 |
|
|
|
141 |
battilan |
1.2 |
delete myCanvas;
|
142 |
|
|
|
143 |
|
|
if(myFile) {
|
144 |
|
|
myFile->Close();
|
145 |
|
|
delete myFile;
|
146 |
|
|
}
|
147 |
|
|
|
148 |
battilan |
1.1 |
}
|
149 |
|
|
|
150 |
|
|
void DTDPGCreateSummary::createGifFile(string fileName, int wh, int sec) {
|
151 |
|
|
|
152 |
|
|
stringstream gifBase, gifTag;
|
153 |
|
|
gifBase << "Run" << myRunNumber << "/Wheel" << showpos << wh << "/Sect" << noshowpos << setfill('0')<< setw(2) << sec;
|
154 |
|
|
try {
|
155 |
|
|
create_directories(gifBase.str());
|
156 |
|
|
} catch(const std::exception & ex) {
|
157 |
|
|
throw cms::Exception("DTDPGCreateSummaryError")<< "[DTDPGCreateSummary]: Excepiton " << ex.what() << " thrown creating " << gifBase.str() << " directory" << endl;
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
gifTag << "_r" << myRunNumber << "_W" << wh << "_S" << sec;
|
161 |
|
|
string gifFile = gifBase.str() + "/" + fileName + gifTag.str() + ".gif";
|
162 |
|
|
myCanvas->Update();
|
163 |
|
|
myCanvas->Print(gifFile.c_str());
|
164 |
|
|
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
void DTDPGCreateSummary::createDataIntegrityPlots(int wh, int sec) {
|
170 |
|
|
|
171 |
|
|
myCanvas->Clear();
|
172 |
|
|
myCanvas->Divide(2,2);
|
173 |
battilan |
1.5 |
stringstream dduID;
|
174 |
|
|
if(sec<7)dduID << wheelToDDU(wh);
|
175 |
|
|
else dduID << wheelToDDU(wh)+5;
|
176 |
battilan |
1.1 |
stringstream ROSID; ROSID << sec; // fix ROS id for ROS Error histogram U.G. 28/8/07
|
177 |
|
|
|
178 |
|
|
string histoName = myMainFolder + "00-DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_TTSValues";
|
179 |
|
|
TH1F *histoTSSVal = (TH1F*) myFile -> Get(histoName.c_str());
|
180 |
|
|
myCanvas->cd(1);
|
181 |
|
|
if(histoTSSVal) {
|
182 |
|
|
histoTSSVal->SetStats( 0 ); // no statistics
|
183 |
|
|
histoTSSVal->GetXaxis()->SetBinLabel(1,"disc.");
|
184 |
|
|
histoTSSVal->GetXaxis()->SetBinLabel(2,"overfl");
|
185 |
|
|
histoTSSVal->GetXaxis()->SetBinLabel(3,"out sync");
|
186 |
|
|
histoTSSVal->GetXaxis()->SetBinLabel(4,"busy");
|
187 |
|
|
histoTSSVal->GetXaxis()->SetBinLabel(5,"ready");
|
188 |
|
|
histoTSSVal->GetXaxis()->SetBinLabel(6,"error");
|
189 |
|
|
histoTSSVal->GetXaxis()->SetBinLabel(7,"disc.");
|
190 |
|
|
//histo1->Draw("colz"); // draw with colour palette
|
191 |
battilan |
1.5 |
histoTSSVal->GetYaxis()->SetLabelSize(0.04);
|
192 |
|
|
histoTSSVal->GetXaxis()->SetLabelSize(0.05);
|
193 |
battilan |
1.1 |
histoTSSVal->Draw();
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
histoName = myMainFolder + "00-DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSStatus";
|
197 |
|
|
TH1F *histoROSStatus = (TH1F*) myFile -> Get(histoName.c_str());
|
198 |
|
|
myCanvas->cd(2);
|
199 |
|
|
if(histoROSStatus) {
|
200 |
|
|
histoROSStatus->SetStats( 0 );
|
201 |
battilan |
1.5 |
|
202 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(1,"#splitline{ch.}{enable}");
|
203 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(2,"#splitline{time}{out}");
|
204 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(3,"#splitline{trailer}{lost}");
|
205 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(4,"#splitline{fiber}{lost}");
|
206 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(5,"#splitline{prop.}{err.}");
|
207 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(6,"#splitline{patt.}{err.}");
|
208 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(7,"#splitline{sign.}{lost}");
|
209 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(8,"#splitline{ROS }{err.}");
|
210 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(9,"#splitline{ROS }{in ev.}");
|
211 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(10,"#splitline{Miss }{ev.}");
|
212 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(11,"#splitline{Ev ID}{Miss}");
|
213 |
|
|
histoROSStatus->GetXaxis()->SetBinLabel(12,"#splitline{BX}{Miss}");
|
214 |
|
|
histoROSStatus->LabelsOption("h","X");
|
215 |
|
|
histoROSStatus->GetYaxis()->SetLabelSize(0.05);
|
216 |
|
|
histoROSStatus->GetXaxis()->SetLabelSize(0.06);
|
217 |
|
|
|
218 |
battilan |
1.1 |
histoROSStatus->Draw("colz");
|
219 |
|
|
}
|
220 |
|
|
|
221 |
|
|
histoName = myMainFolder + "00-DataIntegrity"+ "/FED" + dduID.str() + "_ROSSummary";
|
222 |
|
|
TH1F *histoROSSummary = (TH1F*) myFile -> Get(histoName.c_str());
|
223 |
|
|
myCanvas->cd(3);
|
224 |
|
|
if(histoROSSummary) {
|
225 |
|
|
histoROSSummary->SetStats( 0 );
|
226 |
battilan |
1.5 |
|
227 |
battilan |
1.1 |
histoROSSummary->GetXaxis()->SetBinLabel(1,"#splitline{Link}{TimeOut}");
|
228 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(2,"#splitline{Ev.Id.}{Mis.}");
|
229 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(3,"#splitline{FIFO}{#splitline{almost}{full}}");
|
230 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(4,"#splitline{FIFO}{full}");
|
231 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(5,"#splitline{Ceros}{Timeout}");
|
232 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(6,"#splitline{Max.}{wds}");
|
233 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(7,"#splitline{L1A}{FF}");
|
234 |
battilan |
1.5 |
histoROSSummary->GetXaxis()->SetBinLabel(8,"#splitline{TDC}{#splitline{parity}{err.}}");
|
235 |
|
|
|
236 |
battilan |
1.1 |
histoROSSummary->GetXaxis()->SetBinLabel(9,"#splitline{BX ID}{Mis.}");
|
237 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(10,"TXP");
|
238 |
battilan |
1.5 |
|
239 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(11,"#splitline{L1A}{#splitline{almost}{full}}");
|
240 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(12,"#splitline{Ch}{blocked}");
|
241 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(13,"#splitline{Ev.}{#splitline{Id.}{Mis.}}");
|
242 |
|
|
|
243 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(14,"#splitline{CEROS}{blocked}");
|
244 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(15,"#splitline{TDC}{Fatal}");
|
245 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(16,"#splitline{TDC}{#splitline{FIFO}{Ov.}}");
|
246 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(17,"#splitline{L1}{#splitline{Buffer}{Ov.}}");
|
247 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(18,"#splitline{L1A}{#splitline{FIFO}{Ov.}}");
|
248 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(19,"#splitline{TDC}{#splitline{hit}{err.}}");
|
249 |
|
|
histoROSSummary->GetXaxis()->SetBinLabel(20,"#splitline{TDC}{#splitline{hit}{rej.}}");
|
250 |
battilan |
1.1 |
histoROSSummary->LabelsOption("h","X");
|
251 |
battilan |
1.5 |
|
252 |
battilan |
1.1 |
histoROSSummary->Draw("colz");
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
histoName = myMainFolder + "00-DataIntegrity/FED" + dduID.str() + "/ROS" + ROSID.str() + "/FED" + dduID.str() + "_ROS" + ROSID.str() + "_ROSError";
|
256 |
|
|
TH1F *histoROSError = (TH1F*) myFile -> Get(histoName.c_str());
|
257 |
|
|
myCanvas->cd(4);
|
258 |
battilan |
1.5 |
myCanvas->cd(4)->SetBottomMargin(0.15);
|
259 |
battilan |
1.1 |
if(histoROSError) {
|
260 |
|
|
histoROSError->SetStats( 0 );
|
261 |
|
|
histoROSError->GetXaxis()->SetBinLabel(1,"#splitline{Link}{TimeOut}");
|
262 |
|
|
histoROSError->GetXaxis()->SetBinLabel(2,"#splitline{Ev.Id.}{Mis.}");
|
263 |
|
|
histoROSError->GetXaxis()->SetBinLabel(3,"#splitline{FIFO}{#splitline{almost}{full}}");
|
264 |
|
|
histoROSError->GetXaxis()->SetBinLabel(4,"#splitline{FIFO}{full}");
|
265 |
battilan |
1.5 |
histoROSError->GetXaxis()->SetBinLabel(5,"#splitline{CEROS}{timeout}");
|
266 |
battilan |
1.1 |
histoROSError->GetXaxis()->SetBinLabel(6,"#splitline{Max.}{wds}");
|
267 |
battilan |
1.5 |
histoROSError->GetXaxis()->SetBinLabel(7,"#splitline{TDC}{#splitline{parity}{err}}");
|
268 |
|
|
histoROSError->GetXaxis()->SetBinLabel(8,"#splitline{BX ID}{Mis.}");
|
269 |
|
|
histoROSError->GetXaxis()->SetBinLabel(9,"#splitline{Ch}{blocked}");
|
270 |
|
|
histoROSError->GetXaxis()->SetBinLabel(10,"#splitline{Ev ID}{Mis.}");
|
271 |
|
|
histoROSError->GetXaxis()->SetBinLabel(11,"#splitline{CEROS}{blocked}");
|
272 |
|
|
histoROSError->GetXaxis()->SetBinLabel(12,"#splitline{TDC}{Fatal}");
|
273 |
|
|
histoROSError->GetXaxis()->SetBinLabel(13,"#splitline{TDC}{#splitline{FIFO}{Ov.}}");
|
274 |
|
|
histoROSError->GetXaxis()->SetBinLabel(14,"#splitline{L1}{#splitline{Buffer}{Ov.}}");
|
275 |
|
|
histoROSError->GetXaxis()->SetBinLabel(15,"#splitline{TDCL1A}{#splitline{FIFO}{Ov.}}");
|
276 |
|
|
histoROSError->GetXaxis()->SetBinLabel(16,"#splitline{TDC}{#splitline{hit}{err.}}");
|
277 |
|
|
histoROSError->GetXaxis()->SetBinLabel(17,"#splitline{TDC}{#splitline{hit}{rej.}}");
|
278 |
battilan |
1.1 |
histoROSError->LabelsOption("h","X");
|
279 |
|
|
histoROSError->Draw("colz");
|
280 |
|
|
}
|
281 |
|
|
createGifFile("DataIntegrity",wh,sec);
|
282 |
|
|
|
283 |
|
|
// Event Length
|
284 |
battilan |
1.5 |
gStyle->SetStatW(0.29);
|
285 |
|
|
gStyle->SetOptTitle(0);
|
286 |
battilan |
1.1 |
if(sec !=14 && sec !=13){
|
287 |
|
|
myCanvas->Clear();
|
288 |
|
|
myCanvas->Divide(2,2);
|
289 |
|
|
|
290 |
|
|
histoName = myMainFolder + "00-DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_EventLenght";
|
291 |
|
|
TH1F *histoEL = (TH1F*) myFile -> Get(histoName.c_str());
|
292 |
|
|
if(histoEL) {
|
293 |
|
|
myCanvas->cd(1);
|
294 |
|
|
gStyle->SetOptStat(111111);
|
295 |
|
|
histoEL->Draw();
|
296 |
|
|
myCanvas->cd(2)->SetLogy(1);
|
297 |
|
|
histoEL->Draw();
|
298 |
|
|
}
|
299 |
|
|
|
300 |
|
|
histoName = myMainFolder + "00-DataIntegrity/FED" + dduID.str() + "/ROS" + ROSID.str() + "/FED" + dduID.str() + "_ROS" + ROSID.str() + "_ROSEventLenght";
|
301 |
|
|
TH1F *histoROSEL = (TH1F*) myFile -> Get(histoName.c_str());
|
302 |
|
|
if(histoROSEL) {
|
303 |
|
|
myCanvas->cd(3);
|
304 |
|
|
histoROSEL->Draw();
|
305 |
|
|
myCanvas->cd(4)->SetLogy(1);
|
306 |
|
|
histoROSEL->Draw();
|
307 |
|
|
}
|
308 |
|
|
|
309 |
|
|
createGifFile("EventLength",wh,sec);
|
310 |
|
|
|
311 |
|
|
}
|
312 |
|
|
|
313 |
|
|
}
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
void DTDPGCreateSummary::createDigiPlots(int wh, int sec) {
|
317 |
|
|
|
318 |
battilan |
1.5 |
|
319 |
|
|
gStyle->SetOptTitle();
|
320 |
battilan |
1.1 |
gStyle->SetOptStat();
|
321 |
|
|
myCanvas->Clear();
|
322 |
|
|
myCanvas->Divide(3,4);
|
323 |
|
|
stringstream wheel; wheel << wh;
|
324 |
|
|
stringstream sector; sector << sec;
|
325 |
|
|
string digiFolder = myMainFolder + "01-Digi/Wheel" + wheel.str();
|
326 |
|
|
|
327 |
|
|
// TimeBox Histos
|
328 |
|
|
vector<DTChamber*>::const_iterator chDigiIt = myMuonGeom->chambers().begin();
|
329 |
|
|
vector<DTChamber*>::const_iterator chDigiEnd = myMuonGeom->chambers().end();
|
330 |
|
|
|
331 |
|
|
for (; chDigiIt != chDigiEnd; ++chDigiIt) {
|
332 |
|
|
DTChamberId ch = (*chDigiIt)->id();
|
333 |
|
|
if (ch.sector() == sec && ch.wheel()==wh) {
|
334 |
|
|
stringstream station; station << ch.station();
|
335 |
|
|
|
336 |
|
|
vector<const DTSuperLayer*>::const_iterator slIt = (*chDigiIt)->superLayers().begin();
|
337 |
|
|
vector<const DTSuperLayer*>::const_iterator slEnd = (*chDigiIt)->superLayers().end();
|
338 |
|
|
|
339 |
|
|
for(; slIt != slEnd; ++slIt) {
|
340 |
|
|
DTSuperLayerId sl = (*slIt)->id();
|
341 |
|
|
vector<const DTLayer*>::const_iterator lIt = (*slIt)->layers().begin();
|
342 |
|
|
vector<const DTLayer*>::const_iterator lEnd = (*slIt)->layers().end();
|
343 |
|
|
stringstream superLayer; superLayer << sl.superlayer();
|
344 |
|
|
|
345 |
battilan |
1.5 |
string histoName = digiFolder + "/Sector" + sector.str() + "/Station" + station.str() +"/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str();
|
346 |
battilan |
1.1 |
TH1F *histoTimeBox = (TH1F*) myFile->Get(histoName.c_str());
|
347 |
battilan |
1.5 |
|
348 |
battilan |
1.1 |
if(histoTimeBox){
|
349 |
|
|
int pad = (ch.station() - 1)*3 + sl.superlayer();
|
350 |
|
|
myCanvas->cd(pad);
|
351 |
|
|
gStyle->SetStatW(0.19);
|
352 |
|
|
gStyle->SetOptStat(10);
|
353 |
|
|
histoTimeBox->GetXaxis()->SetLabelSize(0.08);
|
354 |
|
|
histoTimeBox->Draw();
|
355 |
|
|
}
|
356 |
|
|
}
|
357 |
|
|
}
|
358 |
|
|
}
|
359 |
|
|
|
360 |
|
|
createGifFile("Timeboxes_filtered",wh,sec);
|
361 |
|
|
|
362 |
|
|
// Occupancy in Time Histos
|
363 |
|
|
gStyle->SetOptStat();
|
364 |
|
|
gStyle->SetStatW(0.29);
|
365 |
|
|
myCanvas->Clear();
|
366 |
|
|
myCanvas->Divide(3,4);
|
367 |
battilan |
1.3 |
TH1F *layerOccupancy[3][4];
|
368 |
|
|
memset(layerOccupancy,0,12*sizeof(TH1F*));
|
369 |
battilan |
1.1 |
|
370 |
|
|
chDigiIt = myMuonGeom->chambers().begin();
|
371 |
|
|
chDigiEnd = myMuonGeom->chambers().end();
|
372 |
|
|
for (; chDigiIt != chDigiEnd; ++chDigiIt) {
|
373 |
|
|
DTChamberId ch = (*chDigiIt)->id();
|
374 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
375 |
|
|
stringstream station; station << ch.station();
|
376 |
|
|
bool found = false;
|
377 |
battilan |
1.5 |
|
378 |
|
|
string histoNameOccupancy = digiFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/OccupancyInTimeHits_perCh_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
|
379 |
battilan |
1.1 |
TH2F *histoOccupancy = (TH2F*) myFile -> Get(histoNameOccupancy.c_str());
|
380 |
|
|
if(histoOccupancy){
|
381 |
|
|
found = true;
|
382 |
|
|
|
383 |
|
|
vector<const DTSuperLayer*>::const_iterator slIt = (*chDigiIt)->superLayers().begin();
|
384 |
|
|
vector<const DTSuperLayer*>::const_iterator slEnd = (*chDigiIt)->superLayers().end();
|
385 |
|
|
|
386 |
|
|
for(; slIt != slEnd; ++slIt) {
|
387 |
|
|
DTSuperLayerId sl = (*slIt)->id();
|
388 |
|
|
vector<const DTLayer*>::const_iterator lIt = (*slIt)->layers().begin();
|
389 |
|
|
vector<const DTLayer*>::const_iterator lEnd = (*slIt)->layers().end();
|
390 |
|
|
stringstream superLayer; superLayer << sl.superlayer();
|
391 |
|
|
|
392 |
|
|
for(; lIt != lEnd; ++lIt) {
|
393 |
|
|
DTLayerId layerId = (*lIt)->id();
|
394 |
|
|
|
395 |
|
|
// Create the new 1D histos
|
396 |
|
|
stringstream layer; layer << layerId.layer();
|
397 |
|
|
string histoTitleLayer= "In time occupancy: Station " + station.str() + "/SL" + superLayer.str();
|
398 |
|
|
string histoNameLayer = "Occupancy_MB" + station.str() + "SL" + superLayer.str() + "L" + layer.str();
|
399 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]= new TH1F(histoNameLayer.c_str(),histoTitleLayer.c_str(),100, 0.,100.);
|
400 |
|
|
|
401 |
|
|
// Fill the 1D Histos
|
402 |
battilan |
1.5 |
int iby=(sl.superlayer()-1)*4+layerId.layer();
|
403 |
battilan |
1.1 |
int nbx= histoOccupancy->GetNbinsX() ;
|
404 |
|
|
float totentr=0;
|
405 |
|
|
for(int ibx=1;ibx<nbx;ibx++) {
|
406 |
|
|
float yval=histoOccupancy->GetBinContent(ibx,iby);
|
407 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->SetBinContent(ibx,yval);
|
408 |
|
|
totentr+=yval;
|
409 |
|
|
}
|
410 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->SetEntries(totentr);
|
411 |
|
|
|
412 |
|
|
//Draw the histos
|
413 |
|
|
int Nstation = ch.station();
|
414 |
|
|
if (Nstation > 10) Nstation = 4;
|
415 |
|
|
int pad = (Nstation-1)*3 + sl.superlayer() ;
|
416 |
|
|
myCanvas->cd(pad);
|
417 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->SetMinimum(0.);
|
418 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->SetStats(0);
|
419 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->GetXaxis()->SetLabelSize(0.08);
|
420 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->GetYaxis()->SetLabelSize(0.06);
|
421 |
|
|
layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->SetLineColor( layerId.layer() );
|
422 |
|
|
if( layerId.layer() == 1 ) layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->Draw();
|
423 |
|
|
else layerOccupancy[sl.superlayer()-1][layerId.layer()-1]->Draw("same");
|
424 |
|
|
}
|
425 |
|
|
}
|
426 |
|
|
}
|
427 |
|
|
}
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
createGifFile("Occupancies",wh,sec);
|
431 |
battilan |
1.3 |
|
432 |
|
|
for (int i=0;i<3;++i) {
|
433 |
|
|
for (int j=0;j<4;++j) {
|
434 |
|
|
if (layerOccupancy[i][j]) {
|
435 |
|
|
delete layerOccupancy[i][j];
|
436 |
|
|
}
|
437 |
|
|
}
|
438 |
|
|
}
|
439 |
battilan |
1.1 |
|
440 |
|
|
}
|
441 |
|
|
|
442 |
|
|
|
443 |
|
|
void DTDPGCreateSummary::createTriggerPlots(int wh, int sec) {
|
444 |
|
|
|
445 |
|
|
stringstream wheel; wheel << wh;
|
446 |
|
|
stringstream sector; sector << sec;
|
447 |
|
|
|
448 |
|
|
std::vector<std::string> trigHwSources;
|
449 |
|
|
trigHwSources.push_back("DCC");
|
450 |
|
|
trigHwSources.push_back("DDU");
|
451 |
|
|
|
452 |
|
|
vector<string>::const_iterator hwSrcIt = trigHwSources.begin();
|
453 |
|
|
vector<string>::const_iterator hwSrcEnd = trigHwSources.end();
|
454 |
|
|
|
455 |
|
|
for (; hwSrcIt != hwSrcEnd; ++hwSrcIt) {
|
456 |
|
|
// Trigger quality (Phi & Theta)
|
457 |
|
|
myCanvas->Clear();
|
458 |
|
|
myCanvas->Divide(2,4);
|
459 |
|
|
|
460 |
|
|
vector<DTChamber*>::const_iterator chTriggerIt = myMuonGeom->chambers().begin();
|
461 |
|
|
vector<DTChamber*>::const_iterator chTriggerEnd = myMuonGeom->chambers().end();
|
462 |
|
|
string triggerFolder;
|
463 |
|
|
if ((*hwSrcIt)=="DCC") {
|
464 |
battilan |
1.5 |
triggerFolder = myMainFolder + "03-LocalTrigger-DCC/Wheel" + wheel.str();
|
465 |
battilan |
1.1 |
}
|
466 |
|
|
else {
|
467 |
battilan |
1.5 |
triggerFolder = myMainFolder + "04-LocalTrigger-DDU/Wheel" + wheel.str();
|
468 |
battilan |
1.1 |
}
|
469 |
|
|
|
470 |
|
|
for (; chTriggerIt != chTriggerEnd; ++chTriggerIt) {
|
471 |
|
|
DTChamberId ch = (*chTriggerIt)->id();
|
472 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
473 |
|
|
stringstream station; station << ch.station();
|
474 |
|
|
string histoNameBXQual = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/" + (*hwSrcIt) + "_BXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
|
475 |
|
|
TH1F *histoBXQual = (TH1F*) myFile -> Get(histoNameBXQual.c_str());
|
476 |
|
|
if(histoBXQual){
|
477 |
|
|
myCanvas->cd( 2*ch.station() - 1 );
|
478 |
|
|
histoBXQual->GetXaxis()->SetTitle("Quality Flag, Phi trigger");
|
479 |
|
|
histoBXQual->GetYaxis()->SetTitle("BX id .");
|
480 |
|
|
histoBXQual->GetYaxis()->SetTitleSize(0.1);
|
481 |
|
|
histoBXQual->GetYaxis()->SetTitleOffset(0.4);
|
482 |
|
|
histoBXQual->GetYaxis()->SetRangeUser(-9.0,50.1);
|
483 |
|
|
histoBXQual->GetXaxis()->SetTitleSize(0.07);
|
484 |
|
|
histoBXQual->SetStats( 0 );
|
485 |
battilan |
1.5 |
histoBXQual->SetFillColor( 0 );
|
486 |
battilan |
1.1 |
histoBXQual->GetXaxis()->SetLabelSize(0.08);
|
487 |
|
|
histoBXQual->GetYaxis()->SetLabelSize(0.08);
|
488 |
|
|
histoBXQual->Draw("colz");
|
489 |
|
|
}
|
490 |
|
|
histoNameBXQual = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/" + (*hwSrcIt)+ "_ThetaBXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
|
491 |
|
|
TH1F *histoBXQualTh = (TH1F*) myFile -> Get(histoNameBXQual.c_str());
|
492 |
|
|
if(histoBXQualTh){
|
493 |
|
|
myCanvas->cd( 2*(ch.station()-1) + 2 );
|
494 |
|
|
histoBXQualTh->GetXaxis()->SetTitle("Quality Flag, Theta trigger");
|
495 |
|
|
histoBXQualTh->GetYaxis()->SetTitle("BX id .");
|
496 |
|
|
histoBXQualTh->GetYaxis()->SetTitleSize(0.1);
|
497 |
|
|
histoBXQualTh->GetYaxis()->SetTitleOffset(0.4);
|
498 |
|
|
histoBXQualTh->GetXaxis()->SetTitleSize(0.07);
|
499 |
|
|
histoBXQualTh->SetStats( 0 );
|
500 |
battilan |
1.5 |
histoBXQualTh->SetFillColor( 0 );
|
501 |
battilan |
1.1 |
histoBXQualTh->GetXaxis()->SetLabelSize(0.08);
|
502 |
|
|
histoBXQualTh->GetYaxis()->SetLabelSize(0.08);
|
503 |
|
|
histoBXQualTh->Draw("colz");
|
504 |
|
|
}
|
505 |
|
|
}
|
506 |
|
|
}
|
507 |
|
|
|
508 |
|
|
createGifFile("TriggQuality"+(*hwSrcIt),wh,sec);
|
509 |
|
|
|
510 |
|
|
|
511 |
battilan |
1.5 |
// Trig efficiency 2d plots
|
512 |
battilan |
1.1 |
myCanvas->Clear();
|
513 |
battilan |
1.5 |
myCanvas->Divide(3,4);
|
514 |
|
|
string histo2DTag[3] = {"TrigEffPosvsAnglePhi","TrigEffPosvsAngleHHHLPhi","TrackPosvsAngle"};
|
515 |
battilan |
1.1 |
|
516 |
|
|
chTriggerIt = myMuonGeom->chambers().begin();
|
517 |
|
|
chTriggerEnd = myMuonGeom->chambers().end();
|
518 |
|
|
for (; chTriggerIt != chTriggerEnd; ++chTriggerIt) {
|
519 |
|
|
DTChamberId ch = (*chTriggerIt)->id();
|
520 |
|
|
|
521 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
522 |
|
|
stringstream station; station << ch.station();
|
523 |
|
|
|
524 |
battilan |
1.5 |
for (int i=0;i<3;++i){
|
525 |
battilan |
1.1 |
string histoName2DEff = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/Segment/"+ (*hwSrcIt) + "_" + histo2DTag[i] + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
|
526 |
|
|
TH2F *histo2DEff = (TH2F*) myFile -> Get(histoName2DEff.c_str());
|
527 |
|
|
if(histo2DEff){
|
528 |
battilan |
1.5 |
myCanvas->cd((ch.station()*3)-2+i);
|
529 |
|
|
histo2DEff->SetFillColor( 0 );
|
530 |
|
|
//histo2DEff->SetStats( 0 );
|
531 |
|
|
bool printStats = i==2;
|
532 |
|
|
histo2DEff->SetStats( printStats );
|
533 |
battilan |
1.1 |
histo2DEff->GetXaxis()->SetTitle("angle [deg]");
|
534 |
|
|
histo2DEff->GetYaxis()->SetTitle("position [cm] .");
|
535 |
|
|
histo2DEff->GetYaxis()->SetTitleSize(0.08);
|
536 |
|
|
histo2DEff->GetYaxis()->SetTitleOffset(0.6);
|
537 |
|
|
histo2DEff->GetYaxis()->SetLabelSize(0.08);
|
538 |
|
|
histo2DEff->GetXaxis()->SetTitleSize(0.075);
|
539 |
|
|
histo2DEff->GetXaxis()->SetLabelSize(0.075);
|
540 |
|
|
histo2DEff->GetXaxis()->SetTitleOffset(0.75);
|
541 |
|
|
histo2DEff->SetMinimum(0.);
|
542 |
|
|
histo2DEff->SetMaximum(1.);
|
543 |
battilan |
1.5 |
//const char* option = i ? "box" : "colz";
|
544 |
|
|
const char* option = i==2 ? "box" : "colz";
|
545 |
battilan |
1.1 |
histo2DEff->Draw(option);
|
546 |
|
|
}
|
547 |
|
|
}
|
548 |
|
|
}
|
549 |
|
|
}
|
550 |
|
|
|
551 |
|
|
createGifFile("TriggEfficiencyPosvsAngle"+(*hwSrcIt),wh,sec);
|
552 |
|
|
}
|
553 |
|
|
|
554 |
|
|
// DCC Only Plots
|
555 |
battilan |
1.5 |
string triggerFolder = myMainFolder + "03-LocalTrigger-DCC/Wheel" + wheel.str();
|
556 |
battilan |
1.1 |
|
557 |
|
|
// Trigger LUTs
|
558 |
|
|
myCanvas->Clear();
|
559 |
battilan |
1.5 |
if (sec==4 || sec==10) {
|
560 |
|
|
myCanvas->Divide(2,5);
|
561 |
|
|
} else {
|
562 |
|
|
myCanvas->Divide(2,4);
|
563 |
|
|
}
|
564 |
battilan |
1.1 |
vector<DTChamber*>::const_iterator chTriggerIt = myMuonGeom->chambers().begin();
|
565 |
|
|
vector<DTChamber*>::const_iterator chTriggerEnd = myMuonGeom->chambers().end();
|
566 |
|
|
for (; chTriggerIt != chTriggerEnd; ++chTriggerIt) {
|
567 |
|
|
DTChamberId ch = (*chTriggerIt)->id();
|
568 |
battilan |
1.5 |
int scsec = ch.sector()>12 ? (ch.sector()==13 ? 4 : 10) : ch.sector();
|
569 |
|
|
if ( (scsec == sec && ch.wheel() == wh)) {
|
570 |
|
|
int istat = ch.sector()>12 ? 5 : ch.station();
|
571 |
battilan |
1.1 |
stringstream station; station << ch.station();
|
572 |
battilan |
1.5 |
stringstream chsector; chsector << ch.sector();
|
573 |
|
|
string histoNameLut = triggerFolder + "/Sector" + chsector.str() + "/Station" + station.str() + "/Segment/DCC_PhitkvsPhitrig_W" + wheel.str() + "_Sec" + chsector.str() + "_St" + station.str();
|
574 |
battilan |
1.1 |
TH2F *histoLut = (TH2F*) myFile -> Get(histoNameLut.c_str());
|
575 |
|
|
if(histoLut){
|
576 |
battilan |
1.5 |
myCanvas->cd( 2*istat - 1 );
|
577 |
|
|
histoLut->SetFillColor(0);
|
578 |
battilan |
1.1 |
histoLut->GetXaxis()->SetTitle("Trigger local position [cm]");
|
579 |
|
|
histoLut->GetYaxis()->SetTitle("Segment local position [cm]");
|
580 |
|
|
histoLut->SetStats( 0 );
|
581 |
|
|
histoLut->GetXaxis()->SetLabelSize(0.08);
|
582 |
|
|
histoLut->GetYaxis()->SetLabelSize(0.08);
|
583 |
|
|
histoLut->Draw("box");
|
584 |
|
|
}
|
585 |
|
|
|
586 |
battilan |
1.5 |
histoNameLut = triggerFolder + "/Sector" + chsector.str() + "/Station" + station.str() + "/Segment/DCC_PhibtkvsPhibtrig_W" + wheel.str() + "_Sec" + chsector.str() + "_St" + station.str();
|
587 |
battilan |
1.1 |
histoLut = (TH2F*) myFile -> Get(histoNameLut.c_str());
|
588 |
battilan |
1.5 |
if(histoLut && istat!=3){
|
589 |
|
|
myCanvas->cd( 2*istat );
|
590 |
|
|
histoLut->SetFillColor(0);
|
591 |
|
|
histoLut->GetXaxis()->SetTitle("Trigger local direction [deg]");
|
592 |
|
|
histoLut->GetYaxis()->SetTitle("Segment local direction [deg]");
|
593 |
battilan |
1.1 |
histoLut->SetStats( 0 );
|
594 |
|
|
histoLut->GetXaxis()->SetLabelSize(0.08);
|
595 |
|
|
histoLut->GetYaxis()->SetLabelSize(0.08);
|
596 |
|
|
histoLut->Draw("box");
|
597 |
|
|
}
|
598 |
|
|
}
|
599 |
|
|
}
|
600 |
|
|
|
601 |
|
|
createGifFile("TriggLUTsDCC",wh,sec);
|
602 |
|
|
|
603 |
battilan |
1.5 |
// Trigger LUTs Residuals
|
604 |
|
|
myCanvas->Clear();
|
605 |
|
|
if (sec==4 || sec==10) {
|
606 |
|
|
myCanvas->Divide(2,5);
|
607 |
|
|
} else {
|
608 |
|
|
myCanvas->Divide(2,4);
|
609 |
|
|
}
|
610 |
|
|
|
611 |
|
|
gStyle->SetOptFit(1);
|
612 |
|
|
|
613 |
|
|
chTriggerIt = myMuonGeom->chambers().begin();
|
614 |
|
|
gStyle->SetStatW(0.15);
|
615 |
|
|
chTriggerEnd = myMuonGeom->chambers().end();
|
616 |
|
|
for (; chTriggerIt != chTriggerEnd; ++chTriggerIt) {
|
617 |
|
|
DTChamberId ch = (*chTriggerIt)->id();
|
618 |
|
|
int scsec = ch.sector()>12 ? (ch.sector()==13 ? 4 : 10) : ch.sector();
|
619 |
|
|
if (scsec == sec && ch.wheel() == wh ) {
|
620 |
|
|
int istat = ch.sector()>12 ? 5 : ch.station();
|
621 |
|
|
stringstream station; station << ch.station();
|
622 |
|
|
stringstream chsector; chsector << ch.sector();
|
623 |
|
|
string histoNameLutRes = triggerFolder + "/Sector" + chsector.str() + "/Station" + station.str() + "/Segment/DCC_PhiResidual_W" + wheel.str() + "_Sec" + chsector.str() + "_St" + station.str();
|
624 |
|
|
TH1F *histoLutRes = (TH1F*) myFile -> Get(histoNameLutRes.c_str());
|
625 |
|
|
if(histoLutRes){
|
626 |
|
|
myCanvas->cd( 2*istat - 1 );
|
627 |
|
|
gStyle->SetOptStat(1111);
|
628 |
|
|
histoLutRes->SetFillColor(0);
|
629 |
|
|
histoLutRes->GetXaxis()->SetTitle("Trigger - Segment local position [cm]");
|
630 |
|
|
histoLutRes->GetXaxis()->SetLabelSize(0.08);
|
631 |
|
|
histoLutRes->GetYaxis()->SetLabelSize(0.08);
|
632 |
|
|
histoLutRes->Draw();
|
633 |
|
|
}
|
634 |
|
|
|
635 |
|
|
histoNameLutRes = triggerFolder + "/Sector" + chsector.str() + "/Station" + station.str() + "/Segment/DCC_PhibResidual_W" + wheel.str() + "_Sec" + chsector.str() + "_St" + station.str();
|
636 |
|
|
histoLutRes = (TH1F*) myFile->Get(histoNameLutRes.c_str());
|
637 |
|
|
if(histoLutRes && istat!=3){
|
638 |
|
|
myCanvas->cd( 2*istat );
|
639 |
|
|
histoLutRes->SetFillColor(0);
|
640 |
|
|
histoLutRes->GetXaxis()->SetTitle("Trigger - Segment local direction [deg]");
|
641 |
|
|
histoLutRes->GetXaxis()->SetLabelSize(0.08);
|
642 |
|
|
histoLutRes->GetYaxis()->SetLabelSize(0.08);
|
643 |
|
|
histoLutRes->Draw();
|
644 |
|
|
}
|
645 |
|
|
}
|
646 |
|
|
}
|
647 |
|
|
|
648 |
|
|
createGifFile("TriggLUTsResidualDCC",wh,sec);
|
649 |
|
|
gStyle->SetOptFit(0);
|
650 |
|
|
|
651 |
|
|
|
652 |
battilan |
1.1 |
// Quality vs Hits
|
653 |
|
|
myCanvas->Clear();
|
654 |
|
|
myCanvas->Divide(2,2);
|
655 |
|
|
|
656 |
|
|
chTriggerIt = myMuonGeom->chambers().begin();
|
657 |
|
|
chTriggerEnd = myMuonGeom->chambers().end();
|
658 |
|
|
for (; chTriggerIt != chTriggerEnd; ++chTriggerIt) {
|
659 |
|
|
DTChamberId ch = (*chTriggerIt)->id();
|
660 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
661 |
|
|
stringstream wheel; wheel << ch.wheel();
|
662 |
|
|
stringstream station; station << ch.station();
|
663 |
|
|
stringstream sector; sector << ch.sector();
|
664 |
|
|
|
665 |
|
|
string histoNameHits = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/Segment/DCC_HitstkvsQualtrig_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
|
666 |
|
|
TH2F *histoHits = (TH2F*) myFile -> Get(histoNameHits.c_str());
|
667 |
|
|
if(histoHits){
|
668 |
|
|
myCanvas->cd( ch.station() );
|
669 |
battilan |
1.5 |
histoHits->GetXaxis()->SetTitle("Phi trigger quality");
|
670 |
battilan |
1.1 |
histoHits->GetYaxis()->SetTitle("Hits associated to phi segment");
|
671 |
battilan |
1.5 |
histoHits->SetFillColor( 0 );
|
672 |
|
|
histoHits->SetStats(0);
|
673 |
battilan |
1.1 |
histoHits->Draw("box");
|
674 |
|
|
}
|
675 |
|
|
}
|
676 |
|
|
}
|
677 |
|
|
|
678 |
|
|
createGifFile("TriggQualvsHitsDCC",wh,sec);
|
679 |
|
|
|
680 |
|
|
}
|
681 |
|
|
|
682 |
|
|
|
683 |
|
|
void DTDPGCreateSummary::createRecoPlots(int wh, int sec) {
|
684 |
|
|
|
685 |
|
|
myCanvas->Clear();
|
686 |
battilan |
1.5 |
myCanvas->Divide(2,2);
|
687 |
battilan |
1.1 |
stringstream wheel; wheel << wh;
|
688 |
|
|
stringstream sector; sector << sec;
|
689 |
|
|
string recoFolder = myMainFolder + "02-Segments/Wheel" + wheel.str();
|
690 |
|
|
|
691 |
|
|
vector<DTChamber*>::const_iterator chRecoIt = myMuonGeom->chambers().begin();
|
692 |
|
|
vector<DTChamber*>::const_iterator chRecoEnd = myMuonGeom->chambers().end();
|
693 |
|
|
|
694 |
|
|
for (; chRecoIt != chRecoEnd; ++chRecoIt) {
|
695 |
|
|
DTChamberId ch = (*chRecoIt)->id();
|
696 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
697 |
|
|
stringstream station; station << ch.station();
|
698 |
|
|
string histoName4DSeg;
|
699 |
|
|
if(ch.station() < 4)
|
700 |
battilan |
1.5 |
histoName4DSeg = recoFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
|
701 |
battilan |
1.1 |
if(ch.station() == 4)
|
702 |
battilan |
1.5 |
histoName4DSeg = recoFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/h4DSegmXInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
|
703 |
battilan |
1.3 |
TProfile *histo4DSeg = (TProfile*) myFile -> Get(histoName4DSeg.c_str()); // CB fix here it is not a profile
|
704 |
battilan |
1.5 |
histoName4DSeg = recoFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/h4DSegmNHits_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
|
705 |
battilan |
1.1 |
TH1F *histo4DSegNHits = (TH1F*) myFile -> Get(histoName4DSeg.c_str());
|
706 |
|
|
if(histo4DSegNHits){
|
707 |
battilan |
1.5 |
int pad = ch.station();
|
708 |
battilan |
1.1 |
myCanvas->cd(pad);
|
709 |
|
|
histo4DSegNHits->GetXaxis()->SetLabelSize(0.08);
|
710 |
|
|
histo4DSegNHits->GetYaxis()->SetLabelSize(0.07);
|
711 |
|
|
histo4DSegNHits->Draw();
|
712 |
battilan |
1.5 |
|
713 |
|
|
TText L1;
|
714 |
|
|
L1.SetTextSize(0.1);
|
715 |
|
|
L1.SetTextColor(4);
|
716 |
|
|
char MBstation[10];
|
717 |
|
|
sprintf(MBstation,"MB%d", ch.station());
|
718 |
|
|
L1.DrawText(14.0,0.02,MBstation);
|
719 |
|
|
|
720 |
|
|
|
721 |
battilan |
1.1 |
}
|
722 |
|
|
}
|
723 |
|
|
}
|
724 |
|
|
|
725 |
|
|
createGifFile("RecoSegments",wh,sec);
|
726 |
|
|
|
727 |
|
|
}
|
728 |
|
|
|
729 |
|
|
|
730 |
|
|
|
731 |
|
|
|
732 |
|
|
void DTDPGCreateSummary::createResoPlots(int wh, int sec) {
|
733 |
|
|
|
734 |
|
|
myCanvas->Clear();
|
735 |
|
|
myCanvas->Divide(3,4);
|
736 |
|
|
stringstream wheel; wheel << wh;
|
737 |
|
|
stringstream sector; sector << sec;
|
738 |
|
|
string resoFolder = myMainFolder + "02-Segments/Wheel" + wheel.str();
|
739 |
|
|
vector<DTChamber*>::const_iterator chResoIt = myMuonGeom->chambers().begin();
|
740 |
|
|
vector<DTChamber*>::const_iterator chResoEnd = myMuonGeom->chambers().end();
|
741 |
|
|
|
742 |
|
|
for (; chResoIt != chResoEnd; ++chResoIt) {
|
743 |
|
|
DTChamberId ch = (*chResoIt)->id();
|
744 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
745 |
|
|
stringstream station; station << ch.station();
|
746 |
|
|
vector<const DTSuperLayer*>::const_iterator slIt = (*chResoIt)->superLayers().begin();
|
747 |
|
|
vector<const DTSuperLayer*>::const_iterator slEnd = (*chResoIt)->superLayers().end();
|
748 |
|
|
|
749 |
|
|
for(; slIt != slEnd; ++slIt) {
|
750 |
|
|
DTSuperLayerId sl = (*slIt)->id();
|
751 |
|
|
stringstream superLayer; superLayer << sl.superlayer();
|
752 |
|
|
|
753 |
battilan |
1.5 |
string histoNameResDist = resoFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str();
|
754 |
battilan |
1.1 |
TH1F *histoResDist = (TH1F*) myFile -> Get(histoNameResDist.c_str());
|
755 |
|
|
if(histoResDist){
|
756 |
|
|
int pad = (ch.station() - 1)*3 + sl.superlayer();
|
757 |
|
|
myCanvas->cd(pad);
|
758 |
|
|
histoResDist->GetXaxis()->SetTitle(" Hit residuals (cm) ");
|
759 |
|
|
// histo->FitPanel(1);
|
760 |
|
|
// histo->Fit("f1","R");
|
761 |
|
|
// g1 = new TF1("g1","gaus",-0.15,0.15);
|
762 |
|
|
// histo->Fit("gaus");
|
763 |
|
|
histoResDist->GetXaxis()->SetLabelSize(0.08);
|
764 |
|
|
histoResDist->GetYaxis()->SetLabelSize(0.07);
|
765 |
|
|
histoResDist->Draw();
|
766 |
|
|
}
|
767 |
|
|
}
|
768 |
|
|
}
|
769 |
|
|
}
|
770 |
|
|
|
771 |
|
|
createGifFile("HitResiduals",wh,sec);
|
772 |
|
|
|
773 |
|
|
}
|
774 |
|
|
|
775 |
|
|
|
776 |
|
|
void DTDPGCreateSummary::createEfficiencyPlots(int wh, int sec) {
|
777 |
|
|
|
778 |
|
|
stringstream wheel; wheel << wh;
|
779 |
|
|
stringstream sector; sector << sec;
|
780 |
|
|
|
781 |
battilan |
1.5 |
string efficiencyFolder = myMainFolder + "DTEfficiencyTask/Wheel" + wheel.str() ;
|
782 |
battilan |
1.1 |
vector<DTChamber*>::const_iterator chEffIt = myMuonGeom->chambers().begin();
|
783 |
|
|
vector<DTChamber*>::const_iterator chEffEnd = myMuonGeom->chambers().end();
|
784 |
|
|
|
785 |
|
|
for (; chEffIt != chEffEnd; ++chEffIt) {
|
786 |
|
|
myCanvas->Clear();
|
787 |
|
|
myCanvas->Divide(4,3);
|
788 |
|
|
DTChamberId ch = (*chEffIt)->id();
|
789 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
790 |
|
|
stringstream station; station << ch.station();
|
791 |
|
|
bool found = false;
|
792 |
|
|
|
793 |
|
|
vector<const DTSuperLayer*>::const_iterator slIt = (*chEffIt)->superLayers().begin();
|
794 |
|
|
vector<const DTSuperLayer*>::const_iterator slEnd = (*chEffIt)->superLayers().end();
|
795 |
|
|
|
796 |
|
|
for(; slIt != slEnd; ++slIt) {
|
797 |
|
|
DTSuperLayerId sl = (*slIt)->id();
|
798 |
|
|
if( !(ch.station() == 4 && sl.superlayer() ==2)) {
|
799 |
|
|
vector<const DTLayer*>::const_iterator lIt = (*slIt)->layers().begin();
|
800 |
|
|
vector<const DTLayer*>::const_iterator lEnd = (*slIt)->layers().end();
|
801 |
|
|
stringstream superLayer; superLayer << sl.superlayer();
|
802 |
|
|
for(; lIt != lEnd; ++lIt) {
|
803 |
|
|
DTLayerId layerId = (*lIt)->id();
|
804 |
|
|
stringstream layer; layer << layerId.layer();
|
805 |
|
|
|
806 |
battilan |
1.5 |
string histoName1 = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str()
|
807 |
|
|
+ "/SuperLayer" + superLayer.str() + "/hRecSegmOccupancy_W" + wheel.str() + "_St" + station.str()
|
808 |
|
|
+ "_Sec" + sector.str() + "_SL" + superLayer.str()+ "_L" + layer.str();
|
809 |
|
|
string histoName2 = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str()
|
810 |
|
|
+ "/SuperLayer" + superLayer.str() + "/hEffUnassOccupancy_W" + wheel.str() + "_St" + station.str()
|
811 |
|
|
+ "_Sec" + sector.str() + "_SL" + superLayer.str()+ "_L" + layer.str();
|
812 |
|
|
TH1F *histoAll = (TH1F*) myFile -> Get(histoName1.c_str());
|
813 |
|
|
TH1F *histoEff = NULL ;
|
814 |
|
|
if(myFile -> Get(histoName2.c_str()))
|
815 |
|
|
histoEff = (TH1F*) myFile -> Get(histoName2.c_str())->Clone("histoEff");
|
816 |
|
|
|
817 |
|
|
|
818 |
battilan |
1.1 |
if(histoEff){
|
819 |
|
|
found = true;
|
820 |
battilan |
1.5 |
|
821 |
|
|
int nb1=histoAll->GetNbinsX();
|
822 |
|
|
int nb2=histoEff->GetNbinsX();
|
823 |
|
|
if(nb1 != nb2){ throw cms::Exception("DTDPGCreateSummaryError") << "[DTDPGCreateSummary]: ERROR : mistmach on number of bins" << endl;}
|
824 |
|
|
for(int ibin=1;ibin<nb1;ibin++)
|
825 |
|
|
{
|
826 |
|
|
float xpos1=histoEff->GetBinContent(ibin);
|
827 |
|
|
float xpos2=histoAll->GetBinContent(ibin);
|
828 |
|
|
if(xpos2>0)histoEff->SetBinContent(ibin,xpos1/xpos2);
|
829 |
|
|
else histoEff->SetBinContent(ibin,0.);
|
830 |
|
|
}
|
831 |
|
|
|
832 |
battilan |
1.1 |
int pad = (sl.superlayer() - 1)*4 + layerId.layer();
|
833 |
|
|
myCanvas->cd(pad);
|
834 |
|
|
histoEff->SetMinimum(0.);
|
835 |
|
|
histoEff->SetMaximum(1.1);
|
836 |
|
|
histoEff->GetXaxis()->SetLabelSize(0.07);
|
837 |
|
|
histoEff->GetYaxis()->SetLabelSize(0.07);
|
838 |
|
|
histoEff->SetStats(0);
|
839 |
|
|
histoEff->Draw();
|
840 |
|
|
// Look for DeadCells > Eff<2% to avoid some noise entries
|
841 |
|
|
TH1F *histoDead=(TH1F*)histoEff->Clone();
|
842 |
|
|
|
843 |
|
|
string histoName = myMainFolder + "DTEfficiencyTask/Wheel" + wheel.str() + "/Station" + station.str()
|
844 |
|
|
+ "/Sector" + sector.str() + "/SuperLayer" + superLayer.str()
|
845 |
|
|
+ "/hRecSegmOccupancy_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L"
|
846 |
|
|
+ layer.str();
|
847 |
|
|
// To check that there are tracks passing for cells and avoid not existing cells
|
848 |
|
|
TH1F *histoCheck = (TH1F*) myFile -> Get(histoName.c_str());
|
849 |
|
|
int nb=histoEff->GetNbinsX();
|
850 |
|
|
for(int ib=1;ib<nb+1;ib++)
|
851 |
|
|
{
|
852 |
|
|
if(histoEff->GetBinContent(ib)<0.02 && histoCheck->GetBinContent(ib)>3)
|
853 |
|
|
histoDead->SetBinContent(ib,1.3);
|
854 |
|
|
else
|
855 |
|
|
histoDead->SetBinContent(ib,0.0);
|
856 |
|
|
|
857 |
|
|
}
|
858 |
|
|
histoDead->SetFillColor(5);
|
859 |
|
|
histoDead->Draw("histsame");
|
860 |
|
|
histoEff->Draw("same");
|
861 |
|
|
}
|
862 |
|
|
}
|
863 |
|
|
}
|
864 |
|
|
}
|
865 |
|
|
if(found){
|
866 |
|
|
stringstream name; name << "Cell_efficiency_MB" << ch.station();
|
867 |
|
|
createGifFile(name.str(),wh,sec);
|
868 |
|
|
}
|
869 |
|
|
}
|
870 |
|
|
}
|
871 |
|
|
|
872 |
|
|
// Segment reconstruction efficiency vs X
|
873 |
|
|
efficiencyFolder = myMainFolder + "01-DTChamberEfficiency/Wheel" + wheel.str();
|
874 |
|
|
myCanvas->Clear();
|
875 |
|
|
myCanvas->Divide(2,4);
|
876 |
|
|
|
877 |
|
|
chEffIt = myMuonGeom->chambers().begin();
|
878 |
|
|
chEffEnd = myMuonGeom->chambers().end();
|
879 |
|
|
for (; chEffIt != chEffEnd; ++chEffIt) {
|
880 |
|
|
DTChamberId ch = (*chEffIt)->id();
|
881 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
882 |
|
|
stringstream station; station << ch.station();
|
883 |
|
|
string histoName = efficiencyFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
|
884 |
|
|
TH1F *histoEffX = (TH1F*) myFile -> Get(histoName.c_str());
|
885 |
|
|
if(histoEffX){
|
886 |
|
|
myCanvas->cd( (ch.station()-1)*2 +1 );
|
887 |
|
|
string histoTitle= "Segment reco eff.vs X: Station " + station.str();
|
888 |
|
|
histoEffX->SetTitle(histoTitle.c_str());
|
889 |
|
|
histoEffX->GetXaxis()->SetTitle(" X position in chamber (cm) ");
|
890 |
|
|
histoEffX->GetXaxis()->SetLabelSize(0.08);
|
891 |
|
|
histoEffX->GetYaxis()->SetLabelSize(0.08);
|
892 |
|
|
histoEffX->Draw();
|
893 |
|
|
}
|
894 |
|
|
}
|
895 |
|
|
}
|
896 |
|
|
|
897 |
|
|
// Segment reco efficiency vs Y
|
898 |
|
|
chEffIt = myMuonGeom->chambers().begin();
|
899 |
|
|
chEffEnd = myMuonGeom->chambers().end();
|
900 |
|
|
for (; chEffIt != chEffEnd; ++chEffIt) {
|
901 |
|
|
DTChamberId ch = (*chEffIt)->id();
|
902 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
903 |
|
|
stringstream station; station << ch.station();
|
904 |
|
|
string histoNameEffY = efficiencyFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str();
|
905 |
|
|
TH1F *histoEffY = (TH1F*) myFile -> Get(histoNameEffY.c_str());
|
906 |
|
|
if(histoEffY){
|
907 |
|
|
myCanvas->cd( (ch.station()-1)*2 +2 );
|
908 |
|
|
string histoTitle= "Segment reco eff.vs Y: Station " + station.str();
|
909 |
|
|
histoEffY->SetTitle(histoTitle.c_str());
|
910 |
|
|
histoEffY->GetXaxis()->SetTitle(" Y position in chamber (cm) ");
|
911 |
|
|
gStyle->SetOptStat(10);
|
912 |
|
|
histoEffY->GetXaxis()->SetLabelSize(0.08);
|
913 |
|
|
histoEffY->GetYaxis()->SetLabelSize(0.08);
|
914 |
|
|
histoEffY->Draw();
|
915 |
|
|
}
|
916 |
|
|
}
|
917 |
|
|
}
|
918 |
|
|
|
919 |
|
|
createGifFile("SegmentEfficiency",wh,sec);
|
920 |
|
|
|
921 |
|
|
}
|
922 |
|
|
|
923 |
|
|
|
924 |
|
|
void DTDPGCreateSummary::createTestPulsePlots(int wh, int sec) {
|
925 |
|
|
|
926 |
|
|
gStyle->SetOptStat();
|
927 |
|
|
myCanvas->Clear();
|
928 |
|
|
myCanvas->Divide(4,3);
|
929 |
|
|
stringstream wheel; wheel << wh;
|
930 |
|
|
stringstream sector; sector << sec;
|
931 |
|
|
|
932 |
|
|
vector<DTChamber*>::const_iterator chTPIt = myMuonGeom->chambers().begin();
|
933 |
|
|
vector<DTChamber*>::const_iterator chTPEnd = myMuonGeom->chambers().end();
|
934 |
|
|
for (; chTPIt != chTPEnd; ++chTPIt) {
|
935 |
|
|
DTChamberId ch = (*chTPIt)->id();
|
936 |
|
|
if (ch.sector() == sec && ch.wheel() == wh ) {
|
937 |
|
|
stringstream station; station << ch.station();
|
938 |
|
|
bool found = false;
|
939 |
|
|
vector<const DTSuperLayer*>::const_iterator slIt = (*chTPIt)->superLayers().begin();
|
940 |
|
|
vector<const DTSuperLayer*>::const_iterator slEnd = (*chTPIt)->superLayers().end();
|
941 |
|
|
// Loop over the SLs
|
942 |
|
|
for(; slIt != slEnd; ++slIt) {
|
943 |
|
|
DTSuperLayerId sl = (*slIt)->id();
|
944 |
|
|
vector<const DTLayer*>::const_iterator lIt = (*slIt)->layers().begin();
|
945 |
|
|
vector<const DTLayer*>::const_iterator lEnd = (*slIt)->layers().end();
|
946 |
|
|
stringstream superLayer; superLayer << sl.superlayer();
|
947 |
|
|
// Loop over the Ls
|
948 |
|
|
for(; lIt != lEnd; ++lIt) {
|
949 |
|
|
DTLayerId layerId = (*lIt)->id();
|
950 |
|
|
stringstream layer; layer << layerId.layer();
|
951 |
|
|
string testPulsesFolder = myMainFolder + "DTTestPulsesTask/Wheel" + wheel.str();
|
952 |
|
|
string histoName = testPulsesFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/SuperLayer" + superLayer.str() + "/TPProfile/TestPulses2D_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str();
|
953 |
battilan |
1.3 |
TProfile *histoTP = (TProfile*) myFile->Get(histoName.c_str()); // CB fix here
|
954 |
battilan |
1.1 |
if(histoTP){
|
955 |
|
|
found = true;
|
956 |
|
|
int pad = (sl.superlayer() - 1)*4 + layerId.layer();
|
957 |
|
|
myCanvas->cd(pad);
|
958 |
|
|
histoTP->Draw();
|
959 |
|
|
}
|
960 |
|
|
}
|
961 |
|
|
}
|
962 |
|
|
if(found){
|
963 |
|
|
myCanvas->Update();
|
964 |
|
|
}
|
965 |
|
|
}
|
966 |
|
|
}
|
967 |
|
|
}
|
968 |
|
|
|