ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/DTDPGAnalysis/src/DTDPGCreateAnalyzerSummary.cc
Revision: 1.12
Committed: Thu Jul 4 17:16:09 2013 UTC (11 years, 10 months ago) by marycruz
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +560 -97 lines
Log Message:
Update last version of PromptOffline

File Contents

# Content
1 /*
2 * See header file for a description of this class.
3 *
4 * $Date: 2011/07/13 08:46:59 $
5 * $Revision: 1.10 $
6 * \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/DTDPGCreateAnalyzerSummary.h>
15 #include "UserCode/DTDPGAnalysis/src/DTROUtility.h"
16
17 // Framework
18 #include <FWCore/Framework/interface/Event.h>
19 #include <FWCore/Framework/interface/EventSetup.h>
20
21 // Geometry
22 #include "Geometry/Records/interface/MuonGeometryRecord.h"
23 #include "Geometry/DTGeometry/interface/DTGeometry.h"
24 #include "Geometry/DTGeometry/interface/DTLayer.h"
25 #include "Geometry/DTGeometry/interface/DTTopology.h"
26
27 #include "FWCore/MessageLogger/interface/MessageLogger.h"
28
29 #include <iostream>
30 #include <string>
31 #include <sstream>
32 #include <iomanip>
33 #include <math.h>
34
35 #include "TH1F.h"
36 #include "TF1.h"
37 #include "TH2F.h"
38 #include "TCanvas.h"
39 #include "TPad.h"
40 #include "TGraph.h"
41 #include "TPostScript.h"
42 #include "TPaveLabel.h"
43 #include "TPaveText.h"
44 #include "TProfile.h"
45 #include "TStyle.h"
46 #include "TFolder.h"
47 #include "TColor.h"
48 #include "TPaletteAxis.h"
49 #include "boost/filesystem.hpp"
50
51 using namespace edm;
52 using namespace std;
53 using namespace boost::filesystem;
54
55 DTDPGCreateAnalyzerSummary::DTDPGCreateAnalyzerSummary(const edm::ParameterSet& ps) : myFile(0){
56
57 LogVerbatim("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Constructor";
58
59 myParameters = ps;
60 myRunNumber = ps.getUntrackedParameter<int>("runNumber",0);
61
62 }
63
64 DTDPGCreateAnalyzerSummary::~DTDPGCreateAnalyzerSummary(){
65
66 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Destructor ";
67
68 }
69
70
71 void DTDPGCreateAnalyzerSummary::beginJob(){
72
73 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: BeginJob";
74
75 }
76
77 void DTDPGCreateAnalyzerSummary::analyze(const edm::Event& e, const edm::EventSetup& context){
78 }
79
80
81 void DTDPGCreateAnalyzerSummary::endJob(){
82
83 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: endJob";
84
85 myFile = new TFile(myParameters.getUntrackedParameter<string>("rootFileName", "DTEfficiencyTest.root").c_str(), "READ");
86
87 char cMainFolder[30];sprintf(cMainFolder,"DQMData/Run %d", myRunNumber);
88 TFolder * mfolder=(TFolder*)myFile->Get(cMainFolder);
89 if(!mfolder) {
90 throw cms::Exception("DTDPGCreateAnalyzerSummaryError") << "[DTDPGCreateAnalyzerSummary]: Folder = " << cMainFolder << " does not exist!!! Check the run number" << endl;
91 }
92
93 myMainFolder.append(cMainFolder);
94 myMainFolder.append("/DT/Run summary/DTOfflineAnalyzer/");
95
96 string mainFold;
97 mainFold.append(cMainFolder);
98 mainFold.append("/DT/Run summary/");
99 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Creating summaries!";
100
101 DTROUtility roUtil(myFile,mainFold);
102 mySectors = roUtil.getSectorMap();
103
104 if (myParameters.getUntrackedParameter<bool>("SummaryHistos", false)) { createSummaryPlots(); }
105 if (myParameters.getUntrackedParameter<bool>("SummaryWheelHistos", false)) { createSummaryWheelPlots(); }
106 if (myParameters.getUntrackedParameter<bool>("SummaryAllHistos", false)) { createSummaryAllPlots(); }
107
108 if(myFile) {
109 myFile->Close();
110 delete myFile;
111 }
112
113 }
114
115 void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, int wh, int sec, string tag, TCanvas *canvas, bool isExtraFile) {
116
117 stringstream gifBase;
118 gifBase << "Run" << myRunNumber << "/Wheel" << showpos << wh << "/Sect" << noshowpos << setfill('0')<< setw(2) << sec;
119 if (isExtraFile) { gifBase << "/ExtraPlots"; }
120
121 try {
122 create_directories(gifBase.str());
123 } catch(const std::exception & ex) {
124 throw cms::Exception("DTDPGCreateAnalyzerSummaryError")<< "[DTDPGCreateAnalyzerSummary]: Excepiton " << ex.what() << " thrown creating " << gifBase.str() << " directory" << endl;
125 }
126
127 stringstream gifTag; gifTag << "_r" << myRunNumber << "_W" << wh <<"_S" << sec;
128 string gifFile = gifBase.str() + "/" + fileName + gifTag.str() + tag + ".gif";
129 canvas->Update();
130 canvas->Print(gifFile.c_str());
131
132 }
133
134 void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, int wh, string tag, TCanvas *canvas, bool isExtraFile) {
135
136 stringstream gifBase;
137 gifBase << "Run" << myRunNumber << "/Wheel" << showpos << wh << noshowpos;
138 if (isExtraFile) { gifBase << "/ExtraPlots"; }
139 try {
140 create_directories(gifBase.str());
141 } catch(const std::exception & ex) {
142 throw cms::Exception("DTDPGCreateAnalyzerSummaryError")<< "[DTDPGCreateAnalyzerSummary]: Excepiton " << ex.what() << " thrown creating " << gifBase.str() << " directory" << endl;
143 }
144
145 stringstream gifTag; gifTag << "_r" << myRunNumber << "_W" << wh;
146 string gifFile = gifBase.str() + "/" + fileName + gifTag.str() + tag + ".gif";
147 canvas->Update();
148 canvas->Print(gifFile.c_str());
149
150 }
151
152 void DTDPGCreateAnalyzerSummary::createGifFile(string fileName, string tag, TCanvas *canvas, bool isExtraFile) {
153
154 stringstream gifBase;
155 gifBase << "Run" << myRunNumber;
156 if (isExtraFile) { gifBase << "/ExtraPlots"; }
157 try {
158 create_directories(gifBase.str());
159 } catch(const std::exception & ex) {
160 throw cms::Exception("DTDPGCreateAnalyzerSummaryError")<< "[DTDPGCreateAnalyzerSummary]: Excepiton " << ex.what() << " thrown creating " << gifBase.str() << " directory" << endl;
161 }
162
163 stringstream runTag; runTag << "_r" << myRunNumber;
164
165 string gifFile = gifBase.str() + "/" + fileName + runTag.str() + tag + ".gif";
166 canvas->Update();
167 canvas->Print(gifFile.c_str());
168
169 }
170
171 void DTDPGCreateAnalyzerSummary::createSummaryPlots() {
172
173 string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
174
175 gStyle->SetTitleW(0.55);
176 gStyle->SetTitleH(0.13);
177 //gStyle->SetTitleX(0.01);
178 //gStyle->SetTitleY(0.99);
179 gStyle->SetTitleX(0.51);
180 gStyle->SetTitleY(1.00);
181
182 gStyle->SetOptStat(10);
183 //gStyle->SetStatY(0.97);
184 gStyle->SetStatY(0.89);
185 gStyle->SetStatX(0.98);
186 gStyle->SetStatW(0.35);
187 //gStyle->SetStatH(0.45);
188 gStyle->SetStatH(0.20);
189
190
191 // Get histos to be plotted
192 TH1F * first_to_paint;
193 //TH1F * first_to_paint_MB[4];
194 string SLname[3]={"Phi1","Theta","Phi2"};
195
196 //int nbin;
197 //float max, max1;
198
199 TH2F *DigiXYS[5][14];
200 TH1F *DigiXSecMBSlLayer[5][14][4][3][4];
201 TH1F *TBoxSecMBSlLayer[5][14][4][3][4];
202 TH1F *TBoxSegSecMBSlLayer[5][14][4][3][4];
203 //TH1F *OccupMB[5][4];
204 //TH1F *Correlated_trig_Bx[5][14][4][3]; // Not being used and in 62X gives erors for being set but not used
205 //TH1F *hTrg_effnum_SecMB[5][14][4]; // Not being used and in 62X gives erors for being set but not used
206 //TH1F *hTrg_effdenum_SecMB[5][14][4]; // Not being used and in 62X gives erors for being set but not used
207 //TH1F *hPhiHL_SecMB[5][14][4]; // Not being used and in 62X gives erors for being set but not used
208 //TH1F *TriggerMatrix[5][15]; // Not being used and in 62X gives erors for being set but not used
209 TH1F * TriggerInclusive[5];
210
211 std::map<int,std::vector<int> >::const_iterator whIt = mySectors.begin();
212 std::map<int,std::vector<int> >::const_iterator whEnd = mySectors.end();
213 for(;whIt!=whEnd;++whIt) {
214 int iw = (*whIt).first + 2;
215 std::vector<int>::const_iterator secIt = (*whIt).second.begin();
216 std::vector<int>::const_iterator secEnd = (*whIt).second.end();
217 for(;secIt!=secEnd;++secIt) {
218 int isec = (*secIt);
219
220 // Occupancies
221 stringstream histoNameOcc; histoNameOcc << "hDigiXY_" << Whname[iw] << "_S" << isec;
222 DigiXYS[iw][isec-1]=getHisto<TH2F>(histoNameOcc.str());
223 for(int ich=1;ich<5;++ich){
224 for(int isl=1;isl<4;++isl){
225 for(int il=1;il<5;++il){
226 // Create and fill individual layer occupancy plots from hDigiXY_S
227 stringstream histoNameOccup; histoNameOccup << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" <<il;
228 stringstream histoTitleOccup; histoTitleOccup << "Occupancy " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1] << "L" << il;
229 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(histoNameOccup.str().c_str(),histoTitleOccup.str().c_str(),100, 0.,100.);
230 // TBoxes
231 stringstream histoNameTBox; histoNameTBox << "htime_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" << il;
232 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]=getHisto<TH1F>(histoNameTBox.str());
233 stringstream histoNameTBoxSeg; histoNameTBoxSeg << "SegTimeBox_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" << il;
234 TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]=getHisto<TH1F>(histoNameTBoxSeg.str());
235 }
236 }
237 // Correlated Triggers
238 for(int iq=4;iq<7;iq++){
239 stringstream histoNameTrQual; histoNameTrQual << "hTrigBX_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_qual" << iq;
240 // Correlated_trig_Bx[iw][isec-1][ich-1][iq-4]=getHisto<TH1F>(histoNameTrQual.str()); // Not being used and in 62X gives erors for being set but not used
241 }
242 // Trig Eff
243 stringstream htag; htag << "_" << Whname[iw] << "_S" << isec << "_MB" << ich;
244 stringstream heffden; heffden << "hTrg_effdenum" << htag.str();
245 //hTrg_effdenum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffden.str()); // Not being used and in 62X gives erors for being set but not used
246 stringstream heffnum; heffnum << "hTrg_effnum" << htag.str();
247 // hTrg_effnum_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(heffnum.str()); // Not being used and in 62X gives erors for being set but not used
248 stringstream phihl; phihl << "hPhiHL" << htag.str();
249 //hPhiHL_SecMB[iw][isec-1][ich-1]=getHisto<TH1F>(phihl.str()); // Not being used and in 62X gives erors for being set but not used
250
251 }
252
253 int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
254
255 for(int ich=1;ich<5;ich++){
256 for(int isl=1;isl<4;isl++){
257 for(int il=1;il<5;il++){
258 int iby=(ich-1)*20+(isl-1)*4+il+1;
259 float totentr=0;
260 for(int ibx=1;ibx<nbx;ibx++){
261 float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
262 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
263 totentr+=yval;
264 }
265 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
266 }
267 }
268 }
269
270 // Trigger matrix
271 stringstream histoNameTrMatrix; histoNameTrMatrix << "TriggerMatrix" << Whname[iw] << "_S" << isec;
272 //TriggerMatrix[iw][isec-1]=getHisto<TH1F>(histoNameTrMatrix.str()); // Not being used and in 62X gives erors for being set but not used
273
274 }
275 // Trigger Inclusive
276 stringstream histoNameTrInclusive; histoNameTrInclusive << "TriggerInclusive" << Whname[iw];
277 TriggerInclusive[iw]=getHisto<TH1F>(histoNameTrInclusive.str());
278 for (int isec=1;isec<13;++isec) {
279 for (int ibin=1; ibin<5; ibin++) {
280 stringstream hlabel; hlabel << "S" << isec << "MB" << ibin;
281 TriggerInclusive[iw]->GetXaxis()->SetBinLabel((isec-1)*5+ibin,hlabel.str().c_str());
282 }
283 TriggerInclusive[iw]->GetXaxis()->SetBinLabel(isec*5," ");
284 }
285 }
286
287
288 gStyle->SetTitleW(0.55);
289 //gStyle->SetTitleH(0.13);
290 //gStyle->SetTitleX(0.01);
291 //gStyle->SetTitleY(0.99);
292 gStyle->SetTitleH(0.10);
293 gStyle->SetTitleX(0.51);
294 gStyle->SetTitleY(1.00);
295
296 whIt = mySectors.begin();
297 whEnd = mySectors.end();
298 for(;whIt!=whEnd;++whIt) {
299 int iw = (*whIt).first + 2;
300 std::vector<int>::const_iterator secIt = (*whIt).second.begin();
301 std::vector<int>::const_iterator secEnd = (*whIt).second.end();
302 for(;secIt!=secEnd;++secIt) {
303 int isec = (*secIt);
304
305 //===================================================================================
306 // DIGI's occupancies
307 //===================================================================================
308 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies per layer in 1 single page per Sector wh "
309 << (iw-2) << " sec " << isec << endl;
310
311 TCanvas *Digi = new TCanvas("Digi", "",201,81,999,699);
312 Digi->Divide(3,4) ;
313
314 for(int ich=1;ich<5;ich++){
315 for(int isl=1;isl<4;isl++){
316 bool dodraw=1;
317 if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
318 if(dodraw){
319 // look first for the maximum bin entries
320 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
321 float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
322 for(int il=2;il<5;il++){
323 float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
324 if(nbmax0>nbmax){
325 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
326 nbmax=nbmax0;
327 }
328 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
329 }
330 stringstream htitle; htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
331 first_to_paint->SetTitle(htitle.str().c_str());
332 int icpos=(ich-1)*3+isl;
333 Digi->cd(icpos) ;
334 Digi->cd(icpos)->SetLogy();
335 first_to_paint->GetYaxis()->SetLabelSize(0.07);
336 first_to_paint->GetXaxis()->SetLabelSize(0.07);
337 first_to_paint->Draw();
338 for(int il=1;il<5;il++){
339 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
340 }
341 }
342 }
343 }
344 createGifFile("Occupancies_LogScale",iw-2,isec,"",Digi);
345 delete Digi;
346
347 //===================================================================================
348 // DIGI's occupancies
349 // now print 1 page per SL
350 //===================================================================================
351 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing DIGI's occupancies per layer in 1 single page per SL wh "
352 << (iw-2) << " sec " << isec << endl;
353 int ichmin=1; if (isec==13|| isec==14)ichmin=4;
354 for(int ich=ichmin;ich<5;ich++){
355 for(int isl=1;isl<4;isl++){
356 bool dodraw=1;
357 if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
358 if(dodraw){
359 TCanvas *DigiSL = new TCanvas("DigiSL", "",201,81,999,699);
360 // look first for the maximum bin entries
361 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
362 float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
363 for(int il=2;il<5;il++){
364 float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
365 if(nbmax0>nbmax){
366 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
367 nbmax=nbmax0;
368 }
369 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
370 }
371 stringstream htitle; htitle << "Occupancy W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
372 first_to_paint->SetTitle(htitle.str().c_str());
373 first_to_paint->GetYaxis()->SetLabelSize(0.05);
374 first_to_paint->GetXaxis()->SetLabelSize(0.05);
375 first_to_paint->Draw();
376 for(int il=1;il<5;il++){
377 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
378 }
379
380 stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
381 createGifFile("Occupancies",(iw-2),isec,fileTag.str(),DigiSL);
382 delete DigiSL;
383 }
384
385 }//end Loop Superlayers
386 }//end Loop chambers
387
388 //====================================================================================
389 // Time boxes: all in 1 single page (Layer granularity)
390 //===================================================================================
391 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per Sector wh "
392 << (iw-2) << " sec " << isec << endl;
393 TCanvas *Tboxes = new TCanvas("Tboxes", "",201,81,999,699);
394 Tboxes->Divide(3,4) ;
395
396 for(int ich=1;ich<5;ich++){
397 for(int isl=1;isl<4;isl++){
398 bool dodraw=1;
399 if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
400 if(dodraw){
401 // look first for the maximum bin entries
402 first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
403 float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
404 for(int il=2;il<5;il++){
405 float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
406 if(nbmax0>nbmax){
407 first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
408 nbmax=nbmax0;
409 }
410 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
411 }
412 stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
413 first_to_paint->SetTitle(htitle.str().c_str());
414 int icpos=(ich-1)*3+isl;
415 Tboxes->cd(icpos) ;
416 first_to_paint->GetYaxis()->SetLabelSize(0.07);
417 first_to_paint->GetXaxis()->SetLabelSize(0.07);
418 first_to_paint->Draw();
419 for(int il=1;il<5;il++){
420 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
421 }
422 }
423 }
424 }
425
426 createGifFile("Tboxes",(iw-2),isec,"",Tboxes);
427 delete Tboxes;
428
429
430 //====================================================================================
431 // Time boxes - From Segment hits: all in 1 single page (Layer granularity)
432 //===================================================================================
433 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes (from Segments) per layer in 1 single page per Sector wh "
434 << (iw-2) << " sec " << isec << endl;
435 TCanvas *TboxesSeg = new TCanvas("TboxesSeg", "",201,81,999,699);
436 TboxesSeg->Divide(3,4) ;
437
438 for(int ich=1;ich<5;ich++){
439 for(int isl=1;isl<4;isl++){
440 bool dodraw=1;
441 if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
442 if(dodraw){
443 // look first for the maximum bin entries
444 first_to_paint=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
445 float nbmax=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
446 for(int il=2;il<5;il++){
447 float nbmax0=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
448 if(nbmax0>nbmax){
449 first_to_paint=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
450 nbmax=nbmax0;
451 }
452 TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
453 }
454 stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
455 first_to_paint->SetTitle(htitle.str().c_str());
456 int icpos=(ich-1)*3+isl;
457 TboxesSeg->cd(icpos) ;
458 first_to_paint->GetYaxis()->SetLabelSize(0.07);
459 first_to_paint->GetXaxis()->SetLabelSize(0.07);
460 first_to_paint->Draw();
461 for(int il=1;il<5;il++){
462 TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
463 }
464 }
465 }
466 }
467
468 createGifFile("TboxesSeg",(iw-2),isec,"",TboxesSeg);
469 delete TboxesSeg;
470
471 //===================================================================================
472 // Time boxes: 1 page per SL
473 //===================================================================================
474 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes per layer in 1 single page per SL wh "
475 << (iw-2) << " sec " << isec << endl;
476 ichmin=1; if (isec==13|| isec==14)ichmin=4;
477 for(int ich=ichmin;ich<5;ich++){
478 for(int isl=1;isl<4;isl++){
479
480 bool dodraw=1;
481 if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
482 if(dodraw){
483 TCanvas *TboxSL = new TCanvas("TboxSL", "",201,81,999,699);
484 // look first for the maximum bin entries
485 first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
486 float nbmax=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
487 for(int il=2;il<5;il++){
488 float nbmax0=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
489 if(nbmax0>nbmax){
490 first_to_paint=TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
491 nbmax=nbmax0;
492 }
493 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
494 }
495 stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
496 first_to_paint->SetTitle(htitle.str().c_str());
497 first_to_paint->GetYaxis()->SetLabelSize(0.04);
498 first_to_paint->GetXaxis()->SetLabelSize(0.04);
499 first_to_paint->Draw();
500 for(int il=1;il<5;il++){
501 TBoxSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
502 }
503
504 stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
505 createGifFile("Tboxes",(iw-2),isec,fileTag.str(),TboxSL);
506 delete TboxSL;
507
508 }
509 }//end loop SL
510 }//end loop chambers
511
512 //===================================================================================
513 // Time boxes - From Segment Hits: 1 page per SL
514 //===================================================================================
515 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Drawing Time boxes (from Segments) per layer in 1 single page per SL wh "
516 << (iw-2) << " sec " << isec << endl;
517 ichmin=1; if (isec==13|| isec==14)ichmin=4;
518 for(int ich=ichmin;ich<5;ich++){
519 for(int isl=1;isl<4;isl++){
520
521 bool dodraw=1;
522 if(ich==4 && isl==2)dodraw=0; // avoid ThetaMB4
523 if(dodraw){
524 TCanvas *TboxSegSL = new TCanvas("TboxSegSL", "",201,81,999,699);
525 // look first for the maximum bin entries
526 first_to_paint=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
527 float nbmax=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
528 for(int il=2;il<5;il++){
529 float nbmax0=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
530 if(nbmax0>nbmax){
531 first_to_paint=TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
532 nbmax=nbmax0;
533 }
534 TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
535 }
536 stringstream htitle; htitle << "TimeBox W" << (iw-2) << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
537 first_to_paint->SetTitle(htitle.str().c_str());
538 first_to_paint->GetYaxis()->SetLabelSize(0.04);
539 first_to_paint->GetXaxis()->SetLabelSize(0.04);
540 first_to_paint->Draw();
541 for(int il=1;il<5;il++){
542 TBoxSegSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
543 }
544
545 stringstream fileTag; fileTag << "_MB" << ich << "_SL" << SLname[isl-1];
546 createGifFile("TboxesSeg",(iw-2),isec,fileTag.str(),TboxSegSL);
547 delete TboxSegSL;
548 }
549 }//end loop SL
550 }//end loop chambers
551
552 }
553 }//end Loop on sectors/wheels
554
555 }
556
557 void DTDPGCreateAnalyzerSummary::createSummaryWheelPlots() {
558
559 string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
560 string SLname[3]={"Phi1","Theta","Phi2"};
561
562 TH1F *historun = getHisto<TH1F>("RunInfo_RunNumbers");
563 float TotEntries = 999999999.; // It was happen sometime that this histo was not created.
564 // to protect from this problem
565 if(historun != NULL) TotEntries = historun->GetEntries();
566 else {
567 for(int i=1;i<10;i++)cout << "WARNING!!!! histo RunInfo_RunNumbers was NOT FOUND " << endl;
568 }
569
570 //gStyle->SetTitleX(0.01);
571 //gStyle->SetTitleY(0.99);
572 gStyle->SetTitleX(0.51);
573 gStyle->SetTitleY(1.00);
574
575 gStyle->SetPalette(1); // set palette for 2D histos
576 gStyle->SetTitleW(0.97);
577 gStyle->SetTitleH(0.1);
578
579 gStyle->SetOptFit(1);
580 gStyle->SetOptStat(10);
581 //gStyle->SetStatY(0.95); //92
582 gStyle->SetStatY(0.89); //92
583 gStyle->SetStatX(0.98);
584 gStyle->SetStatW(0.35); //45
585 //gStyle->SetStatH(0.45); //85
586 gStyle->SetStatH(0.20); //85
587
588 gStyle->SetTitleBorderSize(2);
589
590 TH1F * first_to_paint;
591
592 TH1F *BXSummary[5][4];
593 for(int iw=0;iw<5;iw++){ // Loop in wheels
594 for(int ic=1;ic<5;ic++){
595 stringstream hname; hname << "BX_mean_MB" << ic << "_W" << (iw-2);
596 stringstream htitle; htitle << "BX MeanValue (HH,HL) MB" << ic << " W" << (iw-2);
597 BXSummary[iw][ic-1]= new TH1F(hname.str().c_str(),htitle.str().c_str(),12,1.,13.);
598 for(int is=1;is<13;is++){
599 stringstream xlab; xlab << "S" << is;
600 BXSummary[iw][ic-1]->GetXaxis()->SetBinLabel(is,xlab.str().c_str());
601 }
602 }
603 }
604
605
606
607 for(int iw=0;iw<5;iw++){ // Loop in wheels
608
609 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Processing Wheel " << iw-2 << endl;
610 // Digi scatter plots
611 TCanvas *DQM1 = new TCanvas("DQM1", "",201,81,999,699);
612 DQM1->Divide(2,3) ;
613 TCanvas *DQM1b = new TCanvas("DQM1b", "",201,81,999,699);
614 DQM1b->Divide(2,3) ;
615 TCanvas *DQM2 = new TCanvas("DQM2", "",201,81,999,699);
616 DQM2->Divide(2,3) ;
617 TCanvas *DQM2b = new TCanvas("DQM2b", "",201,81,999,699);
618 DQM2b->Divide(2,3) ;
619
620 TCanvas *ExtraS13S14 = new TCanvas("ExtraS13S14", "",201,81,1150,950);
621 ExtraS13S14->Divide(2,4);
622 int iExtraPad=1;
623
624 TH2F *hDigiXYList[14];
625
626 for(int isec=1;isec<15;isec++){
627 stringstream histoname; histoname << "hDigiXY_" << Whname[iw] << "_S" << isec;
628 for(int iih=1;iih<25;++iih)
629 hDigiXYList[isec-1]= getHisto<TH2F>(histoname.str());
630 }
631
632 float Max=3000;
633 float Max0[12];
634 //float MaxMean=0;
635 float MaxMean0=0;
636 float MaxRMS0=0;
637 //float MaxRMS=0;
638 int Ns=0;
639 for(int is=0;is<12; is++){
640 if(hDigiXYList[is] != NULL)
641 {
642 Max0[is]=0;
643 Max0[is]=hDigiXYList[is]->GetMaximum();
644 if(Max0[is]>Max)Max=Max0[is];
645 if(Max0[is]>0){ MaxMean0+=Max0[is]; MaxRMS0+=Max0[is]*Max0[is];Ns++;}
646 }
647 }
648
649
650 for(int is=0;is<12; is++){
651 if(is<6){DQM1->cd(is+1); DQM1->cd(is+1)->SetLogz();}
652 else {DQM2->cd(is-5); DQM2->cd(is-5)->SetLogz();}
653 if(hDigiXYList[is] != NULL)
654 {
655 hDigiXYList[is]->SetStats(0);
656 hDigiXYList[is]->SetMaximum(Max);
657 hDigiXYList[is]->Draw("colz");
658 }
659 }
660
661 createGifFile("Digi",(iw-2),"_S1-S6",DQM1);
662 createGifFile("Digi",(iw-2),"_S7_S12",DQM2);
663
664 // MB4 S13 & S14
665 for(int is=13;is<15; is++){
666 ExtraS13S14->cd(iExtraPad);iExtraPad++;
667 if(hDigiXYList[is-1] != NULL)
668 {
669 hDigiXYList[is-1]->SetStats(0);
670 hDigiXYList[is-1]->SetMaximum(Max);
671 hDigiXYList[is-1]->Draw("colz");
672 }
673 }
674
675 if(Max>TotEntries){ // To cut noise cells and see better the
676 // occupancies on other cells
677 for(int is=0;is<12; is++){
678 if(is<6){DQM1b->cd(is+1); DQM1b->cd(is+1)->SetLogz();}
679 else {DQM2b->cd(is-5); DQM2b->cd(is-5)->SetLogz();}
680 if(hDigiXYList[is] != NULL)
681 {
682 hDigiXYList[is]->SetStats(0);
683 hDigiXYList[is]->SetMaximum(TotEntries);
684 hDigiXYList[is]->Draw("colz");
685 }
686 }
687
688 createGifFile("Digi",(iw-2),"_S1-S6_b",DQM1b);
689 createGifFile("Digi",(iw-2),"_S7-S12_b",DQM2b);
690 }
691
692 // Ocupancies per SL
693 // Get histos to be plotted
694 //int nbin;
695 //float max, max1;
696 //char sid1[50];
697
698 // Occupancies
699 TH2F *DigiXYS[5][14];
700 for(int isec=1;isec<15;isec++){
701 stringstream histoname; histoname << "hDigiXY_" << Whname[iw] << "_S" << isec;
702 DigiXYS[iw][isec-1]=getHisto<TH2F>(histoname.str());
703 }
704
705 // Crea and fill individual layer occupancy plots from hDigiXY_S
706 TH1F *DigiXSecMBSl[5][14][4][3];
707 TH1F *DigiXSecMBSlLayer[5][14][4][3][4];
708 for(int isec=1;isec<15;isec++){
709 for(int ich=1;ich<5;ich++){
710 for(int isl=1;isl<4;isl++){
711 stringstream hnamesl; hnamesl << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich <<" _SL" << isl;
712 stringstream htitlesl; htitlesl << "Occupancy " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1];
713 DigiXSecMBSl[iw][isec-1][ich-1][isl-1]= new TH1F(hnamesl.str().c_str(),htitlesl.str().c_str(),100, 0.,100.);
714 for(int il=1;il<5;il++){
715 stringstream hnamel; hnamel << hnamesl.str() << "_L" << il;
716 stringstream htitlel; htitlel << htitlesl.str()<< " L" << il;
717 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(hnamel.str().c_str(),htitlel.str().c_str(),100, 0.,100.);
718 }
719 }
720 }
721 }
722
723 for(int isec=1;isec<15;isec++){
724 if(DigiXYS[iw][isec-1] != NULL)
725 {
726 int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
727 //int nby= DigiXYS[iw][isec-1]->GetNbinsY() ;
728
729 for(int ich=1;ich<5;ich++){
730 for(int isl=1;isl<4;isl++){
731 // Fill layer histos
732 for(int il=1;il<5;il++){
733 int iby=(ich-1)*20+(isl-1)*4+il+1;
734 float totentr=0;
735 for(int ibx=1;ibx<nbx;ibx++){
736 float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
737 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
738 totentr+=yval;
739 }
740 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
741 }
742 // Fill SL histos adding individual layer contents
743 for(int ibx=1;ibx<nbx;ibx++){
744 float yval=0;
745 for(int il=1;il<5;il++)
746 yval+=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetBinContent(ibx);
747
748 DigiXSecMBSl[iw][isec-1][ich-1][isl-1]->SetBinContent(ibx,yval);
749 }
750 }
751 }
752 }
753 }// end loop sector
754
755 TCanvas *Digi1 = new TCanvas("Digi1", "",201,81,1150,950);
756 TCanvas *Digi2 = new TCanvas("Digi2", "",201,81,1150,950);
757 TCanvas *Digi3 = new TCanvas("Digi3", "",201,81,1150,950);
758 Digi1->Divide(4,12,0.00001,0.00001); Digi2->Divide(4,12,0.00001,0.00001); Digi3->Divide(4,12,0.00001,0.00001);
759 for(int isec=1;isec<13;isec++){ // Loop on sectors
760 gStyle->SetTitleW(0.25);
761 gStyle->SetTitleH(0.22);
762 //gStyle->SetTitleX(0.72);
763 //gStyle->SetTitleY(0.99);
764 gStyle->SetTitleX(0.79);
765 gStyle->SetTitleY(0.89);
766
767
768 for(int ich=1;ich<5;ich++){
769 for(int isl=1;isl<4;isl++){
770 if(!(ich==4 && isl==2)){ // avoid ThetaMB4
771 // look first for the maximum bin entries
772 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0];
773 float nbmax=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][0]->GetMaximum();
774 for(int il=1;il<5;il++){
775 float nbmax0=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetMaximum();
776 if(nbmax0>nbmax){
777 first_to_paint=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1];
778 nbmax=nbmax0;
779 }
780 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetLineColor(il);
781 }
782 stringstream htitle; htitle << "W" << (iw-2) << " S" << isec << " MB" << ich << " SL " << isl;
783 first_to_paint->SetTitle(htitle.str().c_str());
784 if(isec<5) {int icpos=(ich-1)*3*4+(isl-1)*4+isec; Digi1->cd(icpos) ; Digi1->cd(icpos)->SetBottomMargin(0.15) ; Digi1->cd(icpos)->SetLeftMargin(0.15) ; Digi1->cd(icpos)->SetLogy();}
785 if(isec>4 && isec<9) {int icpos=(ich-1)*3*4+(isl-1)*4+(isec-4); Digi2->cd(icpos) ; Digi2->cd(icpos)->SetBottomMargin(0.15) ; Digi2->cd(icpos)->SetLeftMargin(0.15) ; Digi2->cd(icpos)->SetLogy();}
786 if(isec>8 && isec<13){int icpos=(ich-1)*3*4+(isl-1)*4+(isec-8); Digi3->cd(icpos) ; Digi3->cd(icpos)->SetBottomMargin(0.15) ; Digi3->cd(icpos)->SetLeftMargin(0.15) ; Digi3->cd(icpos)->SetLogy();}
787 first_to_paint->GetYaxis()->SetLabelSize(0.14);
788 first_to_paint->GetXaxis()->SetLabelSize(0.14);
789 first_to_paint->SetStats(0);
790 first_to_paint->Draw();
791 for(int il=1;il<5;il++)
792 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->Draw("same");
793 }
794
795 if(ich==4 && isl !=2)
796 {
797 if(isec ==4 || isec ==10)
798 {
799 int isec_extra=13;
800 if (isec ==10)isec_extra=14;
801 ExtraS13S14->cd(iExtraPad); iExtraPad++;
802 DigiXSecMBSlLayer[iw][isec_extra-1][ich-1][isl-1][0]->Draw();
803 for(int il=2;il<5;il++)
804 {
805 DigiXSecMBSlLayer[iw][isec_extra-1][ich-1][isl-1][il-1]->SetLineColor(il);
806 DigiXSecMBSlLayer[iw][isec_extra-1][ich-1][isl-1][il-1]->Draw("same");
807 }
808 }
809 }
810
811 }// End Loop in SLs
812 }// End Loop in Chambers
813 }// End Loop on sectors
814 createGifFile("Occupancies_LogScale",(iw-2),"_S1-S4",Digi1);
815 createGifFile("Occupancies_LogScale",(iw-2),"_S5-S8",Digi2);
816 createGifFile("Occupancies_LogScale",(iw-2),"_S9-S12",Digi3);
817
818 //gStyle->SetTitleX(0.01);
819 //gStyle->SetTitleY(0.99);
820 gStyle->SetTitleX(0.51);
821 gStyle->SetTitleY(1.00);
822 gStyle->SetTitleW(0.97);
823 gStyle->SetTitleH(0.1);
824
825 gStyle->SetStatH(0.20);
826
827
828 // TimeBoxes
829
830 TCanvas *TB1 = new TCanvas("TB1", "",201,81,999,999);
831 TCanvas *TB2 = new TCanvas("TB2", "",201,81,999,999);
832 TB1->Divide(4,6,0.00001,0.00001) ;
833 TB2->Divide(4,6,0.00001,0.00001) ;
834 for (int ins=1; ins<13;ins++)
835 for(int ic=1;ic<5;ic++){
836 TH1F *hHisto[3];
837 int nbmax=0;
838 int nbmax0=0;
839
840
841 for(int isl=1;isl<4;isl++){
842 stringstream hname; hname << "htime_" << Whname[iw] << "_S" << ins << "_MB" << ic << "_SL" << isl;
843 hHisto[isl-1]=getHisto<TH1F>(hname.str());
844 if(hHisto[isl-1] !=NULL) hHisto[isl-1]->SetLineColor(isl);
845 }
846
847 first_to_paint = hHisto[0];
848 if(first_to_paint !=NULL)nbmax=hHisto[0]->GetMaximum();
849
850 for(int isl=2;isl<4;isl++){
851 if(hHisto[isl-1] !=NULL)
852 {
853 nbmax0=hHisto[isl-1]->GetMaximum();
854 if(nbmax0>nbmax){
855 nbmax=nbmax0;
856 first_to_paint=hHisto[isl-1];
857 }
858 }
859 }
860
861 if(ins<7)
862 {
863 int icpos=(ins-1)*4+ic;
864 TB1->cd(icpos);
865 TB1->cd(icpos)->SetLeftMargin(0.20);
866 }
867 else
868 {
869 int icpos=(ins-7)*4+ic;
870 TB2->cd(icpos);
871 TB2->cd(icpos)->SetLeftMargin(0.20);
872 }
873
874 if(first_to_paint != NULL)
875 {
876 first_to_paint->GetYaxis()->SetLabelSize(0.08);
877 first_to_paint->GetXaxis()->SetLabelSize(0.08);
878 first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
879 first_to_paint->GetXaxis()->SetTitle("ns");
880 first_to_paint->GetXaxis()->SetTitleSize(0.09);
881 first_to_paint->GetXaxis()->SetTitleOffset(0.5);
882 first_to_paint->GetXaxis()->SetNdivisions(308);
883 //char htit[240];
884 stringstream htitle; htitle << "TimeBox W" << iw-2 << " S" << ins << " MB"<< ic;
885 first_to_paint->SetTitle(htitle.str().c_str());
886 first_to_paint->Draw();
887 for(int isl=1;isl<4;isl++) hHisto[isl-1]->Draw("same");
888 }
889
890 if(ic==4)
891 {
892 if(ins==4 || ins==10)
893 {
894 int isec_extra=13;
895 if (ins ==10)isec_extra=14;
896 TH1F *hHisto_extra[3];
897 for(int isl=1;isl<4;isl++){
898 stringstream hname; hname << "htime_" << Whname[iw] << "_S" << isec_extra << "_MB" << ic << "_SL" << isl;
899 hHisto_extra[isl-1]=getHisto<TH1F>(hname.str());
900 if(hHisto_extra[isl-1] != NULL) hHisto_extra[isl-1]->SetLineColor(isl);
901 }
902 ExtraS13S14->cd(iExtraPad); iExtraPad++;
903 int nbmax=0;
904 first_to_paint=hHisto_extra[0];
905 if(first_to_paint !=NULL)nbmax=hHisto[0]->GetMaximum();
906 for(int isl=2;isl<4;isl++){
907 if(hHisto[isl-1] !=NULL)
908 {
909 int nbmax0=hHisto[isl-1]->GetMaximum();
910 if(nbmax0>nbmax)
911 { nbmax=nbmax0; first_to_paint=hHisto[isl-1];}
912 }
913 }
914
915 if(first_to_paint!=NULL)
916 {
917 stringstream nhtitle; nhtitle << "TimeBox W" << iw-2 << " S" << isec_extra << " MB"<< ic;
918 first_to_paint->SetTitle(nhtitle.str().c_str());
919 first_to_paint->Draw();
920 for(int isl=1;isl<4;isl++) hHisto_extra[isl-1]->Draw("same");
921 }
922 }
923 }
924
925 }// end loop on sectors & Chambers
926 createGifFile("TBox_S1_S6",(iw-2),"",TB1);
927 createGifFile("TBox_S7_S12",(iw-2),"",TB2);
928
929 createGifFile("MB4S13S14Plots",(iw-2),"",ExtraS13S14);
930
931
932 // TimeBoxes - Segment hits
933
934 TCanvas *TB1Seg = new TCanvas("TB1Seg", "",201,81,999,999);
935 TCanvas *TB2Seg = new TCanvas("TB2Seg", "",201,81,999,999);
936 TB1Seg->Divide(4,6,0.00001,0.00001) ;
937 TB2Seg->Divide(4,6,0.00001,0.00001) ;
938 for (int ins=1; ins<13;ins++)
939 for(int ic=1;ic<5;ic++){
940 TH1F *hHisto[3];
941 int nbmax=0;
942 int nbmax0=0;
943
944
945 for(int isl=1;isl<4;isl++){
946 stringstream hname; hname << "SegTimeBox_" << Whname[iw] << "_S" << ins << "_MB" << ic << "_SL" << isl;
947 hHisto[isl-1]=getHisto<TH1F>(hname.str());
948 if(hHisto[isl-1] !=NULL) hHisto[isl-1]->SetLineColor(isl);
949 }
950
951 first_to_paint = hHisto[0];
952 if(first_to_paint !=NULL)nbmax=hHisto[0]->GetMaximum();
953
954 for(int isl=2;isl<4;isl++){
955 if(hHisto[isl-1] !=NULL)
956 {
957 nbmax0=hHisto[isl-1]->GetMaximum();
958 if(nbmax0>nbmax){
959 nbmax=nbmax0;
960 first_to_paint=hHisto[isl-1];
961 }
962 }
963 }
964
965 if(ins<7)
966 {
967 int icpos=(ins-1)*4+ic;
968 TB1Seg->cd(icpos);
969 TB1Seg->cd(icpos)->SetLeftMargin(0.20);
970 }
971 else
972 {
973 int icpos=(ins-7)*4+ic;
974 TB2Seg->cd(icpos);
975 TB2Seg->cd(icpos)->SetLeftMargin(0.20);
976 }
977
978 if(first_to_paint != NULL)
979 {
980 first_to_paint->GetYaxis()->SetLabelSize(0.08);
981 first_to_paint->GetXaxis()->SetLabelSize(0.08);
982 first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
983 first_to_paint->GetXaxis()->SetTitle("ns");
984 first_to_paint->GetXaxis()->SetTitleSize(0.09);
985 first_to_paint->GetXaxis()->SetTitleOffset(0.5);
986 first_to_paint->GetXaxis()->SetNdivisions(308);
987 //char htit[240];
988 stringstream htitle; htitle << "TimeBox W" << iw-2 << " S" << ins << " MB"<< ic;
989 first_to_paint->SetTitle(htitle.str().c_str());
990 first_to_paint->Draw();
991 for(int isl=1;isl<4;isl++) hHisto[isl-1]->Draw("same");
992 }
993
994 }// end loop on sectors & Chambers
995 createGifFile("TBoxSeg_S1_S6",(iw-2),"",TB1Seg);
996 createGifFile("TBoxSeg_S7_S12",(iw-2),"",TB2Seg);
997
998 // Hit Residuals
999 DQM1->Clear();
1000 DQM1->Divide(6,2) ;
1001
1002 for(int ins=1;ins<13; ins++){
1003 TH1F *hHisto[4];
1004 DQM1->cd(ins);
1005 DQM1->cd(ins)->SetLeftMargin(0.20);
1006
1007 int nbmax=0;
1008 int nbmax0=0;
1009
1010 for(int ic=1;ic<5;ic++){
1011 stringstream hname; hname << "hResX_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1012 hHisto[ic-1]= getHisto<TH1F>(hname.str());
1013 hHisto[ic-1]->SetLineColor(ic);
1014 }
1015
1016 first_to_paint = hHisto[0];
1017 nbmax=hHisto[0]->GetMaximum();
1018
1019 for(int ic=2;ic<5;ic++){
1020 nbmax0=hHisto[ic-1]->GetMaximum();
1021 if(nbmax0>nbmax){
1022 nbmax=nbmax0;
1023 first_to_paint=hHisto[ic-1];
1024 }
1025 }
1026
1027 first_to_paint->GetYaxis()->SetLabelSize(0.08);
1028 first_to_paint->GetXaxis()->SetLabelSize(0.08);
1029 first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
1030 first_to_paint->GetXaxis()->SetTitle("cm");
1031 first_to_paint->GetXaxis()->SetTitleSize(0.09);
1032 first_to_paint->GetXaxis()->SetTitleOffset(0.5);
1033 first_to_paint->GetXaxis()->SetNdivisions(308);
1034 stringstream htitle; htitle << "Hit residuals W" << (iw-2) << " S" << ins;
1035 first_to_paint->SetTitle(htitle.str().c_str());
1036
1037 first_to_paint->Draw();
1038 for(int ic=1;ic<5;ic++)
1039 hHisto[ic-1]->Draw("same");
1040
1041 }// end loop on sectors
1042
1043 createGifFile("HitResiduals",(iw-2),"",DQM1);
1044
1045 // Angle Phi LOCAL
1046 DQM1->Clear();
1047 DQM1->Divide(6,2) ;
1048
1049 for (int ins=1; ins<13;ins++){
1050 TH1F *hPhi[4];
1051 DQM1->cd(ins);
1052 DQM1->cd(ins)->SetLeftMargin(0.20);
1053 int nbmax=0;
1054 int nbmax0=0;
1055
1056 for(int ic=1;ic<5;ic++){
1057 stringstream hname; hname << "hPhi_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1058 hPhi[ic-1]=getHisto<TH1F>(hname.str());
1059 hPhi[ic-1]->SetLineColor(ic);
1060 }
1061
1062 first_to_paint = hPhi[0];
1063 nbmax=hPhi[0]->GetMaximum();
1064
1065 for(int ic=2;ic<5;ic++){
1066 nbmax0=hPhi[ic-1]->GetMaximum();
1067 if(nbmax0>nbmax){
1068 nbmax=nbmax0;
1069 first_to_paint=hPhi[ic-1];
1070 }
1071 }
1072
1073 first_to_paint->GetYaxis()->SetLabelSize(0.08);
1074 first_to_paint->GetXaxis()->SetLabelSize(0.08);
1075 first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
1076 first_to_paint->GetXaxis()->SetTitle("deg");
1077 first_to_paint->GetXaxis()->SetTitleSize(0.09);
1078 first_to_paint->GetXaxis()->SetTitleOffset(0.5);
1079 first_to_paint->GetXaxis()->SetNdivisions(308);
1080 stringstream htitle; htitle << "Phi local W" << (iw-2) << " S" << ins;
1081 first_to_paint->SetTitle(htitle.str().c_str());
1082
1083 first_to_paint->Draw();
1084 for(int ic=1;ic<5;ic++) hPhi[ic-1]->Draw( "same");
1085
1086 }// end loop on sectors
1087
1088
1089 createGifFile("PhiLocal",(iw-2),"",DQM1);
1090
1091 // STA Digis
1092 DQM1->Clear();
1093
1094 stringstream hnameSTADigi; hnameSTADigi << "hHitsPosXYSA_" << Whname[iw];
1095
1096 // STA Plots created only on demand they could not exist
1097 TH1F *hXYHisto=force_getHisto<TH1F>(hnameSTADigi.str());;
1098 if(hXYHisto)
1099 {
1100 hXYHisto->SetStats(0);
1101 hXYHisto->Draw("colz");
1102
1103 createGifFile("STADigi",(iw-2),"",DQM1);
1104 }
1105 else
1106 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: STA histo "
1107 << hnameSTADigi.str() << " not present, skiping STADigi gif file" << endl;
1108
1109
1110 // STA Phi Hits
1111 TCanvas *DQM6 = new TCanvas("DQM6", "",301,81,999,699); // open a large canvas
1112 TH1F *hnHitDT= getHisto<TH1F>("hnHitDT");
1113 //int hh=0;
1114 if(hnHitDT != NULL)
1115 {
1116 Float_t Nevents = hnHitDT->GetEntries();
1117 edm::LogVerbatim ("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Total nr. of triggers:" << Nevents << endl;
1118
1119 TH1F *hPhiHisto[4];
1120 TH1F *heff[4];
1121
1122 bool doSTAPhiHits=false;
1123 //float ymax = 0.1;
1124 float ymax = 0.0;
1125 for(int ic=1;ic<5;ic++){
1126 stringstream hname1, hname2, htitle;
1127
1128 hname1 << "hPhiHit_" << Whname[iw] << "_MB" << ic;
1129 // STA Plots created only on demand they could not exist
1130 hPhiHisto[ic-1]=force_getHisto<TH1F>(hname1.str());
1131
1132 if(hPhiHisto[ic-1])
1133 {
1134 doSTAPhiHits=true;
1135 hname2 << "heff" << ic;
1136 heff[ic-1] =(TH1F*) hPhiHisto[ic-1]->Clone(hname2.str().c_str());
1137 heff[ic-1]->Add(heff[ic-1],heff[ic-1],0.5/Nevents,0.5/Nevents);
1138
1139 float nbmax=heff[ic-1]->GetMaximum();
1140 if(nbmax>ymax)ymax=nbmax;
1141 heff[ic-1]->SetStats(0);
1142 heff[ic-1]->SetLineColor(ic);
1143 htitle << "Phi of ass. hit, W" << (iw-2);
1144 heff[0]->SetTitle(htitle.str().c_str());
1145 }
1146
1147 }
1148 ymax=ymax*1.1;
1149 for(int ic=1;ic<5;ic++){
1150 if(hPhiHisto[ic-1])
1151 {
1152 heff[ic-1]->SetMaximum(ymax);
1153 if(ic==1)heff[ic-1]->Draw();
1154 else heff[ic-1]->Draw("same");
1155 }
1156 }
1157
1158 TLine *l[16];
1159 l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
1160 l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
1161 l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
1162 l[3] = new TLine( -75, 0, -75, ymax); l[3]->Draw();
1163 l[4] = new TLine( -45, 0, -45, ymax); l[4]->Draw();
1164 l[5] = new TLine( -15, 0, -15, ymax); l[5]->Draw();
1165 l[6] = new TLine( 15, 0, 15, ymax); l[6]->Draw();
1166 l[7] = new TLine( 45, 0, 45, ymax); l[7]->Draw();
1167 l[8] = new TLine( 75, 0, 75, ymax); l[8]->Draw();
1168 l[9] = new TLine( 105, 0, 105, ymax); l[9]->Draw();
1169 l[10] = new TLine( 135, 0, 135, ymax); l[10]->Draw();
1170 l[11] = new TLine( 165, 0, 165, ymax); l[11]->Draw();
1171
1172 l[12] = new TLine( -40, 0.8*ymax, -20, 0.8*ymax); //l->Draw();
1173 l[12]->SetLineColor(1);
1174 l[12]->Draw();
1175 TPaveLabel * box [4];
1176 box[0] = new TPaveLabel(-10,0.8*ymax,5,0.85*ymax,"MB1");
1177 box[0]->Draw();
1178
1179 l[13] = new TLine( -40, 0.7*ymax, -20, 0.7*ymax); //l->Draw();
1180 l[13]->SetLineColor(2);
1181 l[13]->Draw();
1182 box[1] = new TPaveLabel(-10,0.7*ymax,5,0.75*ymax,"MB2");
1183 box[1]->Draw();
1184
1185 l[14] = new TLine( -40, 0.6*ymax, -20, 0.6*ymax); //l->Draw();
1186 l[14]->SetLineColor(3);
1187 l[14]->Draw();
1188 box[2] = new TPaveLabel(-10,0.6*ymax,5,0.65*ymax,"MB3");
1189 box[2]->Draw();
1190
1191 l[15] = new TLine( -40, 0.5*ymax, -20, 0.5*ymax); //l->Draw();
1192 l[15]->SetLineColor(4);
1193 l[15]->Draw();
1194 box[3] = new TPaveLabel(-10,0.5*ymax,5,0.55*ymax,"MB4");
1195 box[3]->Draw();
1196
1197 if(doSTAPhiHits) createGifFile("STAPhiHits",(iw-2),"",DQM6);
1198
1199 for (int i=0;i<16;++i) delete l[i];
1200 for (int i=0;i<4;++i) delete box[i];
1201 }
1202
1203 // STA Hits
1204 DQM1->Clear();
1205 DQM1->Divide(6,2) ;
1206
1207 TH1F *hNassList[12];
1208
1209 for(int isec=1;isec<13;isec++){
1210 stringstream histoname; histoname << "hNhass_" << Whname[iw] << "_S" << isec;
1211 hNassList[isec-1]=force_getHisto<TH1F>(histoname.str());
1212 }
1213
1214
1215 bool doSTAHits=false;
1216 for(int is=0;is<12;is++){
1217 if(hNassList[is])
1218 {
1219 doSTAHits=true;
1220 hNassList[is]->GetYaxis()->SetLabelSize(0.08);
1221 hNassList[is]->GetXaxis()->SetNdivisions(308);
1222 hNassList[is]->GetXaxis()->SetLabelSize(0.08);
1223 hNassList[is]->GetXaxis()->SetLabelOffset(-0.025);
1224 hNassList[is]->GetXaxis()->SetTitle("# hits");
1225 hNassList[is]->GetXaxis()->SetTitleSize(0.01);
1226 hNassList[is]->GetXaxis()->SetTitleOffset(0.5);
1227
1228 DQM1->cd(is+1);
1229 DQM1->cd(is+1)->SetLeftMargin(0.20);
1230 hNassList[is]->SetStats(1);
1231 hNassList[is]->Draw();
1232 }
1233 }
1234
1235 if(doSTAHits) createGifFile("STAHits",(iw-2),"",DQM1);
1236
1237
1238 // Segment Hits
1239 DQM2->Clear();
1240 DQM2->Divide(6,2);
1241 gStyle->SetStatX(0.6);
1242 gStyle->SetStatY(0.88);
1243 gStyle->SetStatW(0.40);
1244 gStyle->SetStatH(0.20);
1245
1246
1247 TH1F *hNhits[12][4];
1248 for (int ins=1; ins<13;ins++){
1249 DQM2->cd(ins);
1250 DQM2->cd(ins)->SetLeftMargin(0.20);
1251 int nbmax=0;
1252 int nbmax0=0;
1253
1254 for(int ic=1;ic<5;ic++){
1255 stringstream hname; hname << "hNhits_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1256 hNhits[ins-1][ic-1]= getHisto<TH1F>(hname.str());
1257 hNhits[ins-1][ic-1]->SetLineColor(ic);
1258 }
1259
1260 first_to_paint= hNhits[ins-1][0];
1261 nbmax=hNhits[ins-1][0]->GetMaximum();
1262
1263 for(int ic=2;ic<5;ic++){
1264 nbmax0=hNhits[ins-1][ic-1]->GetMaximum();
1265 if(nbmax0>nbmax){
1266 nbmax=nbmax0;
1267 first_to_paint=hNhits[ins-1][ic-1];
1268 }
1269 }
1270
1271 first_to_paint->GetYaxis()->SetLabelSize(0.08);
1272 first_to_paint->GetXaxis()->SetLabelSize(0.08);
1273 first_to_paint->GetXaxis()->SetLabelOffset(-0.025);
1274 first_to_paint->GetXaxis()->SetTitle("#hits");
1275 first_to_paint->GetXaxis()->SetTitleSize(0.09);
1276 first_to_paint->GetXaxis()->SetTitleOffset(0.5);
1277 first_to_paint->GetXaxis()->SetNdivisions(308);
1278 stringstream htitle; htitle << "# hits in seg W" << (iw-2) << " S" << ins;
1279 first_to_paint->SetTitle(htitle.str().c_str());
1280
1281 first_to_paint->Draw();
1282 for(int ic=1;ic<5;ic++) hNhits[ins-1][ic-1]->Draw( "same");
1283
1284 }// end loop on sectors
1285
1286
1287 createGifFile("SegHits",(iw-2),"",DQM2);
1288
1289
1290
1291 gStyle->SetStatY(0.89);
1292 gStyle->SetStatX(0.98);
1293 gStyle->SetStatW(0.40);
1294 gStyle->SetStatH(0.20);
1295
1296
1297 // Segment Hits
1298 DQM1->Clear();
1299 DQM1->Divide(6,2);
1300 TH1F * hNsegsList[12];
1301 for(int is=0;is<12;is++){
1302 stringstream hname; hname << "hNsegs_" << Whname[iw] << "_S" <<is+1;
1303 hNsegsList[is]= getHisto<TH1F>(hname.str());
1304 hNsegsList[is]->GetXaxis()->SetTitle("# Segments");
1305 }
1306
1307 for(int is=0;is<12;is++){
1308 DQM1->cd(is+1);
1309 DQM1->cd(is+1)->SetLeftMargin(0.20);
1310 hNsegsList[is]->GetYaxis()->SetLabelSize(0.08);
1311 hNsegsList[is]->GetXaxis()->SetNdivisions(308);
1312 hNsegsList[is]->GetXaxis()->SetLabelSize(0.08);
1313 hNsegsList[is]->GetXaxis()->SetLabelOffset(-0.025);
1314 hNsegsList[is]->GetXaxis()->SetTitleSize(0.09);
1315 hNsegsList[is]->GetXaxis()->SetTitleOffset(0.5);
1316 hNsegsList[is]->SetStats(1);
1317 hNsegsList[is]->GetXaxis()->SetRangeUser(1.,10.);
1318 hNsegsList[is]->Draw();
1319 }
1320
1321 createGifFile("Segments",(iw-2),"",DQM1);
1322
1323 // TMAX
1324
1325
1326 gStyle->SetOptStat(10);
1327 //gStyle->SetStatY(0.95);
1328 gStyle->SetStatY(0.89);
1329 gStyle->SetStatX(0.98);
1330 gStyle->SetStatW(0.35);
1331 gStyle->SetStatH(0.45);
1332
1333 TCanvas *DQM11 = new TCanvas("DQM11", "1",101,81,999,699);
1334 TCanvas *DQM12 = new TCanvas("DQM12", "2",101,81,999,699);
1335 TCanvas *DQM13 = new TCanvas("DQM13", "3",101,81,999,699);
1336 TCanvas *DQM14 = new TCanvas("DQM14", "4",101,81,999,699);
1337 DQM11->Divide(4,3) ;
1338 DQM12->Divide(4,3) ;
1339 DQM13->Divide(4,3) ;
1340 DQM14->Divide(4,3) ;
1341
1342
1343 for (int ins=1; ins<13;ins++){
1344 TH1F *hHisto[2];
1345 for(int ic=1;ic<5;ic++){
1346
1347
1348 stringstream hname; hname << "htmax_" << Whname[iw] << "_S" << ins << "_MB" << ic;
1349 hHisto[0]= getHisto<TH1F>(hname.str()+"_SL1");
1350 hHisto[1]= getHisto<TH1F>(hname.str()+"_SL3");
1351
1352 if(ins<4){
1353 int ipos=(ins-1)*4+ic;
1354 DQM11->cd(ipos);
1355 }
1356 if(ins>3 && ins<7){
1357 int ipos=(ins-4)*4+ic;
1358 DQM12->cd(ipos);
1359 }
1360 if(ins>6 && ins<10){
1361 int ipos=(ins-7)*4+ic;
1362 DQM13->cd(ipos);
1363 }
1364 if(ins>9){
1365 int ipos=(ins-10)*4+ic;
1366 DQM14->cd(ipos);
1367 }
1368
1369 hHisto[0]->SetStats(1);
1370 gStyle->SetOptFit(1);
1371 hHisto[0]->Draw();
1372 if(hHisto[0]->GetEntries()>50) // Problems on version 31X when no entries or few entries
1373 try {
1374 hHisto[0]->Fit("gaus","Q");
1375 hHisto[0]->Draw("same");
1376 } catch(const cms::Exception&) {
1377 edm::LogError("DTDPGSummary") << "[DTDPGCreateAnalyzerSummary]: Error fitting " << hname.str() << "_SL1";
1378 }
1379 hHisto[1]->SetLineColor(2);
1380 hHisto[1]->Draw("same");
1381 }// end loop on chambers
1382 }// end loop on sectors
1383
1384 createGifFile("TMax",(iw-2),"S1-S3",DQM11,true);
1385 createGifFile("TMax",(iw-2),"S4-S6",DQM12,true);
1386 createGifFile("TMax",(iw-2),"S7-S9",DQM13,true);
1387 createGifFile("TMax",(iw-2),"S10-S12",DQM14,true);
1388
1389 gStyle->SetOptStat(10);
1390 //gStyle->SetStatY(0.95); //92
1391 gStyle->SetStatY(0.89); //92
1392 gStyle->SetStatX(0.98);
1393 gStyle->SetStatW(0.35); //45
1394 gStyle->SetStatH(0.45); //85
1395
1396 // Phi-Trig Efficiency
1397 TCanvas *Eff = new TCanvas("Eff", "",201,81,999,699);
1398 TH1F *hHisto[4];
1399 TH1F *hHistoTr[4];
1400 TH1F *heffx[4];
1401 for(int ic=1;ic<5;ic++)
1402 {
1403 stringstream hname1; hname1 << "hPhiGlob_" << Whname[iw] << "_MB" << ic;
1404 hHisto[ic-1]= getHisto<TH1F>(hname1.str());
1405
1406 stringstream hname2; hname2 << "heff" << ic <<"x";
1407 heffx[ic-1] =(TH1F*) hHisto[ic-1]->Clone(hname2.str().c_str());
1408 heffx[ic-1]->SetLineColor(ic);
1409
1410 stringstream hname3; hname3 << "hPhiTrigg_" << Whname[iw] << "_MB" << ic;
1411 hHistoTr[ic-1]= getHisto<TH1F>(hname3.str());
1412 heffx[ic-1]->Divide(hHistoTr[ic-1],hHisto[ic-1],1.0,1.0);
1413
1414 for (int i = 0; i <= heffx[ic-1]->GetNbinsX()+1; i++ ) {
1415 Float_t tot = hHisto[ic-1]->GetBinContent(i) ;
1416 Float_t tot_e = hHisto[ic-1]->GetBinError(i);
1417 Float_t eff = heffx[ic-1]->GetBinContent(i) ;
1418 Float_t Err = 0.;
1419 if (tot > 0) Err = tot_e / tot * sqrt( eff* (1-eff) );
1420 // if (eff == 1. || isnan(Err) || !isfinite(Err) ) Err=1.e-3;
1421 heffx[ic-1]->SetBinError(i, Err);
1422 }
1423 heffx[ic-1]->SetStats(0);
1424 heffx[ic-1]->SetMaximum(1);
1425 stringstream htitle; htitle << "Phi-Trigger Eff W" << iw-2;
1426 heffx[0]->SetTitle(htitle.str().c_str());
1427 heffx[0]->SetMaximum(1.02);
1428
1429 if(ic==1)heffx[ic-1]->Draw();
1430 else heffx[ic-1]->Draw("same");
1431 }
1432
1433 float ymax = 1.;
1434 TLine *l[16];
1435 l[0] = new TLine(-165, 0, -165, ymax); l[0]->Draw();
1436 l[1] = new TLine(-135, 0, -135, ymax); l[1]->Draw();
1437 l[2] = new TLine(-105, 0, -105, ymax); l[2]->Draw();
1438 l[3] = new TLine( -75, 0, -75, ymax); l[3]->Draw();
1439 l[4] = new TLine( -45, 0, -45, ymax); l[4]->Draw();
1440 l[5] = new TLine( -15, 0, -15, ymax); l[5]->Draw();
1441 l[6] = new TLine( 15, 0, 15, ymax); l[6]->Draw();
1442 l[7] = new TLine( 45, 0, 45, ymax); l[7]->Draw();
1443 l[8] = new TLine( 75, 0, 75, ymax); l[8]->Draw();
1444 l[9] = new TLine( 105, 0, 105, ymax); l[9]->Draw();
1445 l[10] = new TLine( 135, 0, 135, ymax); l[10]->Draw();
1446 l[11] = new TLine( 165, 0, 165, ymax); l[11]->Draw();
1447
1448 createGifFile("TrigEff",(iw-2),"",Eff,true);
1449
1450 // for (int i=0;i<12;++i) delete l[i];
1451
1452 delete TB1;
1453 delete TB2;
1454 delete TB1Seg;
1455 delete TB2Seg;
1456 delete DQM1;
1457 delete DQM2;
1458 delete DQM1b;
1459 delete DQM2b;
1460 delete Digi1;
1461 delete Digi2;
1462 delete Digi3;
1463 delete DQM6;
1464
1465 delete DQM11;
1466 delete DQM12;
1467 delete DQM13;
1468 delete DQM14;
1469
1470 delete Eff;
1471 delete ExtraS13S14;
1472
1473 }// END loop in wheels
1474
1475
1476 }
1477
1478
1479 void DTDPGCreateAnalyzerSummary::createSummaryAllPlots() {
1480 string Whname[5]={"Wm2","Wm1","W0","W1","W2"};
1481
1482 gStyle->SetTitleW(0.55);
1483 gStyle->SetTitleH(0.13);
1484 //gStyle->SetTitleX(0.01);
1485 //gStyle->SetTitleY(0.99);
1486 gStyle->SetTitleX(0.51);
1487 gStyle->SetTitleY(1.00);
1488
1489 gStyle->SetOptStat(10);
1490 //gStyle->SetStatY(0.97);
1491 gStyle->SetStatY(0.82);
1492 gStyle->SetStatX(0.98);
1493 gStyle->SetStatW(0.35);
1494 //gStyle->SetStatH(0.45);
1495 gStyle->SetStatH(0.20);
1496
1497 //Change standard palette colors
1498 const Int_t NRGBs = 5;
1499 //const Int_t NCont = 255;
1500 const Int_t NCont = 155;
1501
1502 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
1503 Double_t red[NRGBs] = { 0.99, 0.40, 0.00, 0.80, 0.95 };
1504 Double_t green[NRGBs] = { 0.99, 0.40, 0.40, 0.10, 0.00 };
1505 Double_t blue[NRGBs] = { 0.20, 0.00, 0.90, 0.10, 0.00 };
1506 // It needs to be initialize if not root gives a warning and cmssw an error and
1507 // the program stops
1508 TColor::InitializeColors();
1509 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
1510 //gStyle->SetNumberContours(NCont);
1511
1512 // Get histos to be plotted
1513 TH1F * first_to_paint;
1514 TH1F * first_to_paint_MB[4];
1515 string SLname[3]={"Phi1","Theta","Phi2"};
1516
1517 TH1F *DigiXSecMBSlLayer[5][14][4][3][4];
1518
1519 for(int iw=0;iw<5;++iw)
1520 for(int isec=1;isec<15;++isec)
1521 for(int ich=1;ich<5;++ich)
1522 for(int isl=1;isl<4;++isl)
1523 for(int il=1;il<5;++il){
1524 // Create individual layer occupancy plots from hDigiXY_S
1525 stringstream histoNameOccup; histoNameOccup << "Occup_" << Whname[iw] << "_S" << isec << "_MB" << ich << "_SL" << isl << "_L" <<il;
1526 stringstream histoTitleOccup; histoTitleOccup << "Occupancy " << Whname[iw] << " S" << isec << " MB" << ich << " SL" << SLname[isl-1] << "L" << il;
1527 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]= new TH1F(histoNameOccup.str().c_str(),histoTitleOccup.str().c_str(),100, 0.,100.);
1528 }
1529
1530 TH2F *DigiXYS[5][14];
1531 TH1F *OccupMB[5][4];
1532 TH1F *OccupWh[5];
1533
1534 std::map<int,std::vector<int> >::const_iterator whIt = mySectors.begin();
1535 std::map<int,std::vector<int> >::const_iterator whEnd = mySectors.end();
1536 for(;whIt!=whEnd;++whIt) {
1537 int iw = (*whIt).first + 2;
1538 std::vector<int>::const_iterator secIt = (*whIt).second.begin();
1539 std::vector<int>::const_iterator secEnd = (*whIt).second.end();
1540 for(;secIt!=secEnd;++secIt) {
1541 int isec = (*secIt);
1542
1543 // Occupancies
1544 stringstream histoNameOcc; histoNameOcc << "hDigiXY_" << Whname[iw] << "_S" << isec;
1545 DigiXYS[iw][isec-1]=getHisto<TH2F>(histoNameOcc.str());
1546 int nbx= DigiXYS[iw][isec-1]->GetNbinsX() ;
1547
1548 for(int ich=1;ich<5;ich++){
1549 for(int isl=1;isl<4;isl++){
1550 for(int il=1;il<5;il++){
1551 int iby=(ich-1)*20+(isl-1)*4+il+1;
1552 float totentr=0;
1553 for(int ibx=1;ibx<nbx;ibx++){
1554 float yval=DigiXYS[iw][isec-1]->GetBinContent(ibx,iby);
1555 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetBinContent(ibx,yval);
1556 totentr+=yval;
1557 }
1558 DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->SetEntries(totentr);
1559 }
1560 }
1561 }
1562 }// End loop Sectors
1563 }//End loop Wheels
1564
1565 for(int iw=0;iw<5;++iw)
1566 for(int ich=1;ich<5;++ich)
1567 {
1568 stringstream histoNameOccMB; histoNameOccMB << "Digi_" << Whname[iw] << "_MB" << ich;
1569 OccupMB[iw][ich-1]= new TH1F(histoNameOccMB.str().c_str(),histoNameOccMB.str().c_str(),14, 0.,14.);
1570 }
1571 whIt = mySectors.begin();
1572 whEnd = mySectors.end();
1573 for(;whIt!=whEnd;++whIt) {
1574 int iw = (*whIt).first + 2;
1575 for(int ich=1;ich<5;++ich){
1576 for(int isec=1;isec<13;isec++){
1577 float totentr=0;
1578 for(int isl=1;isl<4;isl++){
1579 for(int il=1;il<5;il++){
1580 totentr+=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetEntries();
1581 }
1582 }
1583 OccupMB[iw][ich-1]->Fill(isec,totentr);
1584 }
1585 }
1586 }
1587
1588
1589 /*
1590 for(int ic=0;ic<4;ic++)
1591 {
1592 first_to_paint_MB[ic]=OccupMB[0][ic];
1593 float nbmax=0;
1594 nbmax=OccupMB[0][ic]->GetMaximum();
1595 for(int iw=0;iw<5;iw++)
1596 {
1597 float nbmax0=0;
1598 nbmax0=OccupMB[iw][ic]->GetMaximum();
1599
1600 if(nbmax0>nbmax)
1601 {
1602 nbmax=nbmax0; first_to_paint_MB[ic]=OccupMB[iw][ic];
1603 }
1604 }
1605 }
1606
1607 */
1608
1609 float Ocmax[4]={0.,0.,0.,0};
1610 for(int ic=0;ic<4;ic++)
1611 {
1612 first_to_paint_MB[ic]=OccupMB[0][ic];
1613 float nbmin=9999999;
1614 //float nbmin00=OccupMB[0][ic]->GetMinimum();
1615 //if(nbmin00 > 0) nbmin=nbmin00;
1616 for(int iw=0;iw<5;iw++)
1617 {
1618 float nbmax0=0;
1619 //float nbmin0=99999999.; // Not being used and in 62X gives erors for being set but not used
1620 nbmax0=OccupMB[iw][ic]->GetMaximum();
1621 //nbmin0=OccupMB[iw][ic]->GetMinimum();
1622
1623 if(nbmax0>Ocmax[ic]) Ocmax[ic]=nbmax0;
1624 if(nbmax0>0 && nbmax0<nbmin)
1625 {
1626 nbmin=nbmax0; first_to_paint_MB[ic]=OccupMB[iw][ic];
1627 }
1628 //if(nbmin0>0 && nbmin0<nbmin)
1629 // {
1630 // nbmin=nbmin0; first_to_paint_MB[ic]=OccupMB[iw][ic];
1631 // }
1632 }
1633 }
1634
1635
1636 for(int ic=1;ic<5;ic++)
1637 {
1638 stringstream hname21; hname21 << "Total Occupancy MB" << ic ;
1639 first_to_paint_MB[ic-1]->SetTitle(hname21.str().c_str());
1640
1641 first_to_paint_MB[ic-1]->GetXaxis()->SetLabelSize(0.09);
1642 first_to_paint_MB[ic-1]->GetXaxis()->SetTitleSize(0.09);
1643 first_to_paint_MB[ic-1]->GetXaxis()->SetTitleOffset(0.5);
1644 first_to_paint_MB[ic-1]->GetXaxis()->SetTitle("Sector ");
1645 first_to_paint_MB[ic-1]->GetYaxis()->SetLabelSize(0.09);
1646 first_to_paint_MB[ic-1]->GetYaxis()->SetTitleSize(0.09);
1647 first_to_paint_MB[ic-1]->GetYaxis()->SetTitleOffset(0.5);
1648 first_to_paint_MB[ic-1]->GetYaxis()->SetTitle("Entries");
1649 first_to_paint_MB[ic-1]->SetStats(0);
1650 first_to_paint_MB[ic-1]->SetMaximum(Ocmax[ic-1]*1.25);
1651 // int nbb=first_to_paint_MB[ic-1]->GetNbinsX();
1652 // float ymin=9999999999999.;
1653 // for(int ib=1;ib<nbb;ib++)
1654 // {
1655 // float ymin0= first_to_paint_MB[ic-1]->GetBinContent(ib);
1656 // if(ymin0>0 && ymin0<ymin)ymin=ymin0;
1657 // }
1658 // first_to_paint_MB[ic-1]->SetMinimum(ymin*.20);
1659 }
1660
1661 gStyle->SetTitleW(0.25);
1662 gStyle->SetTitleH(0.22);
1663 //gStyle->SetTitleX(0.74);
1664 //gStyle->SetTitleY(0.99);
1665 gStyle->SetTitleX(0.90);
1666 gStyle->SetTitleY(1.01);
1667
1668
1669 TCanvas *OccupanALL = new TCanvas("OccupanALL", "",201,81,999,950);
1670 OccupanALL->Divide(1,4) ;
1671 for(int ic=1;ic<5;ic++)
1672 {
1673 OccupanALL->cd(ic)->SetLogy(1);
1674 OccupanALL->cd(ic)->SetFillColor(0);
1675 OccupanALL->cd(ic)->SetFrameFillColor(0);
1676 OccupanALL->cd(ic);
1677 first_to_paint_MB[ic-1]->Draw();
1678
1679 for(int iw=0;iw<5;iw++)
1680 {
1681 OccupMB[iw][ic-1]->SetLineColor(iw+1);
1682 if(iw==4)
1683 OccupMB[iw][ic-1]->SetLineColor(6);
1684 OccupanALL->cd(ic); OccupMB[iw][ic-1]->Draw("same");
1685 }
1686 }
1687 createGifFile("OccupancyAll","",OccupanALL,false);
1688
1689 delete OccupanALL;
1690
1691 // Occupancies/Sector
1692 for(int iw=0;iw<5;iw++){
1693 stringstream histoNameOccMB; histoNameOccMB << "Digi_" << Whname[iw];
1694 OccupWh[iw]= new TH1F(histoNameOccMB.str().c_str(),histoNameOccMB.str().c_str(),14, 0.,14.);
1695 for(int isec=1;isec<13;isec++){
1696 float totentr=0;
1697 for(int ich=1;ich<5;++ich){
1698 for(int isl=1;isl<4;isl++){
1699 for(int il=1;il<5;il++){
1700 if(DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1])
1701 totentr+=DigiXSecMBSlLayer[iw][isec-1][ich-1][isl-1][il-1]->GetEntries();
1702 }
1703 }
1704 OccupWh[iw]->Fill(isec,totentr);
1705 }
1706 }
1707 }
1708
1709 first_to_paint=OccupWh[0];
1710
1711 /*
1712 float nbmax=0;
1713 nbmax=OccupWh[0]->GetMaximum();
1714 for(int iw=1;iw<5;iw++)
1715 {
1716 float nbmax0=0;
1717 nbmax0=OccupWh[iw]->GetMaximum();
1718 if(nbmax0>nbmax)
1719 {
1720 nbmax=nbmax0; first_to_paint=OccupWh[iw];
1721 }
1722 }
1723 */
1724
1725 float OcmaxS=0;
1726 float nbminS=9999999;
1727 float nbminS00=OccupWh[0]->GetMinimum();
1728 if(nbminS00 > 0) nbminS=nbminS00;
1729 for(int iw=1;iw<5;iw++)
1730 {
1731 float nbmax0=0;
1732 float nbmin0=99999999.;
1733 nbmax0=OccupWh[iw]->GetMaximum();
1734
1735 if(nbmax0>OcmaxS) OcmaxS=nbmax0;
1736 if(nbmin0>0 && nbmin0<nbminS)
1737 {
1738 nbminS=nbmin0; first_to_paint_MB[iw]=OccupWh[iw];
1739 }
1740 }
1741
1742
1743
1744 stringstream hname21; hname21 << "Total Occupancy ";
1745 first_to_paint->SetTitle(hname21.str().c_str());
1746
1747 first_to_paint->GetXaxis()->SetLabelSize(0.04);
1748 first_to_paint->GetXaxis()->SetTitleSize(0.04);
1749 // first_to_paint->GetXaxis()->SetTitleOffset(0.5);
1750 first_to_paint->GetXaxis()->SetTitle("Sector ");
1751 first_to_paint->GetYaxis()->SetLabelSize(0.04);
1752 first_to_paint->GetYaxis()->SetTitleSize(0.04);
1753 // first_to_paint->GetYaxis()->SetTitleOffset(0.5);
1754 first_to_paint->GetYaxis()->SetTitle("Entries");
1755 first_to_paint->SetStats(0);
1756
1757
1758 gStyle->SetTitleX(0.31);
1759 gStyle->SetTitleY(1.01);
1760 gStyle->SetTitleW(0.87);
1761 gStyle->SetTitleH(0.12);
1762
1763
1764 TCanvas *OccupanSec = new TCanvas("OccupanSec", "",201,81,650,550);
1765 OccupanSec->SetLogy(1) ;
1766 first_to_paint->SetMaximum(OcmaxS*1.25);
1767 float yminS=9999999999999.;
1768 int nbbS=first_to_paint->GetNbinsX();
1769 for(int ib=1;ib<nbbS;ib++)
1770 {
1771 float ymin0= first_to_paint->GetBinContent(ib);
1772 if(ymin0>0 && ymin0<yminS)yminS=ymin0;
1773 }
1774 first_to_paint->SetMinimum(yminS*.20);
1775 first_to_paint->Draw();
1776 for(int iw=0;iw<5;iw++)
1777 {
1778 OccupWh[iw]->SetLineColor(iw+1);
1779 if(iw==4)OccupWh[iw]->SetLineColor(6);
1780 OccupWh[iw]->Draw("same");
1781 }
1782
1783 createGifFile("OccupancySec","",OccupanSec,false);
1784 delete OccupanSec;
1785
1786 gStyle->SetTitleW(0.55);
1787 gStyle->SetTitleH(0.13);
1788 //gStyle->SetTitleX(0.01);
1789 //gStyle->SetTitleY(0.99);
1790 gStyle->SetTitleX(0.31);
1791 gStyle->SetTitleY(1.03);
1792
1793 gStyle->SetOptStat(10);
1794 gStyle->SetStatX(0.98);
1795 //gStyle->SetStatY(0.97);
1796 gStyle->SetStatY(0.89);
1797 gStyle->SetStatW(0.35);
1798 //gStyle->SetStatH(0.38);
1799 gStyle->SetStatH(0.20);
1800
1801
1802 TH1F *TBoxSec[5][12];
1803 TH1F *TBoxMB[5][4];
1804 TH1F *TBoxMBTop[5][4];
1805 TH1F *TBoxMBBottom[5][4];
1806 TH1F *TBoxMBVertical[5][4];
1807
1808 TH1F *TBoxSegSec[5][12];
1809 TH1F *TBoxSegMB[5][4];
1810 TH1F *TBoxSegMBTop[5][4];
1811 TH1F *TBoxSegMBBottom[5][4];
1812 TH1F *TBoxSegMBVertical[5][4];
1813
1814
1815 for(int iw=0; iw<5; iw++)
1816 {
1817 for(int is=0;is<12; is++)
1818 {
1819 TBoxSec[iw][is]=NULL;
1820 TBoxSegSec[iw][is]=NULL;
1821 }
1822 for(int ic=0;ic<4; ic++)
1823 {
1824 TBoxMB[iw][ic]=NULL;
1825 TBoxMBTop[iw][ic]=NULL;
1826 TBoxMBBottom[iw][ic]=NULL;
1827 TBoxMBVertical[iw][ic]=NULL;
1828
1829 TBoxSegMB[iw][ic]=NULL;
1830 TBoxSegMBTop[iw][ic]=NULL;
1831 TBoxSegMBBottom[iw][ic]=NULL;
1832 TBoxSegMBVertical[iw][ic]=NULL;
1833 }
1834 }
1835
1836
1837 whIt = mySectors.begin();
1838 whEnd = mySectors.end();
1839 for(;whIt!=whEnd;++whIt) {
1840 int iw = (*whIt).first + 2;
1841
1842 std::vector<int>::const_iterator secIt = (*whIt).second.begin();
1843 std::vector<int>::const_iterator secEnd = (*whIt).second.end();
1844 for(;secIt!=secEnd;++secIt) {
1845 int isec = (*secIt);
1846 if(isec<13)
1847 for(int ic=1;ic<5;ic++){
1848 stringstream hname; hname << "htime_" << Whname[iw] << "_S" << isec << "_MB" << ic;
1849 TH1F * theHisto=getHisto<TH1F>(hname.str());
1850
1851 stringstream hnames; hnames << "SegTimeBox_" << Whname[iw] << "_S" << isec << "_MB" << ic;
1852 TH1F * theHistos=getHisto<TH1F>(hnames.str());
1853
1854 if(isec==1)
1855 {
1856 stringstream hname2; hname2 << "htime_" << Whname[iw] << "_MB" << ic ;
1857 TBoxMB[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1858 TBoxMB[iw][ic-1]->SetTitle(hname2.str().c_str());
1859
1860 stringstream hname3; hname3 << "htime_" << Whname[iw] << "_MB" << ic << "_Vertical" ;
1861 TBoxMBVertical[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1862 TBoxMBVertical[iw][ic-1]->SetTitle(hname3.str().c_str());
1863
1864 stringstream hname2s; hname2s << "SegTimeBox_" << Whname[iw] << "_MB" << ic ;
1865 TBoxSegMB[iw][ic-1]=(TH1F*)theHistos->Clone(hnames.str().c_str());
1866 TBoxSegMB[iw][ic-1]->SetTitle(hname2s.str().c_str());
1867
1868 stringstream hname3s; hname3s << "SegTimeBox_" << Whname[iw] << "_MB" << ic << "_Vertical" ;
1869 TBoxSegMBVertical[iw][ic-1]=(TH1F*)theHistos->Clone(hnames.str().c_str());
1870 TBoxSegMBVertical[iw][ic-1]->SetTitle(hname3s.str().c_str());
1871 }
1872 if(isec==2)
1873 {
1874 stringstream hname2; hname2 << "htime_" << Whname[iw] << "_MB" << ic << "_Top" ;
1875 TBoxMBTop[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1876 TBoxMBTop[iw][ic-1]->SetTitle(hname2.str().c_str());
1877
1878 stringstream hname2s; hname2s << "SegTimeBox_" << Whname[iw] << "_MB" << ic << "_Top" ;
1879 TBoxSegMBTop[iw][ic-1]=(TH1F*)theHistos->Clone(hnames.str().c_str());
1880 TBoxSegMBTop[iw][ic-1]->SetTitle(hname2s.str().c_str());
1881 }
1882 if(isec==8)
1883 {
1884 stringstream hname2; hname2 << "htime_" << Whname[iw] << "_MB" << ic << "_Bottom" ;
1885 TBoxMBBottom[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1886 TBoxMBBottom[iw][ic-1]->SetTitle(hname2.str().c_str());
1887
1888 stringstream hname2s; hname2s << "SegTimeBox_" << Whname[iw] << "_MB" << ic << "_Bottom" ;
1889 TBoxSegMBBottom[iw][ic-1]=(TH1F*)theHistos->Clone(hnames.str().c_str());
1890 TBoxSegMBBottom[iw][ic-1]->SetTitle(hname2s.str().c_str());
1891 }
1892
1893 if(isec>2)TBoxMB[iw][ic-1]->Add(theHisto); //
1894 if(isec>2 && isec<7)TBoxMBTop[iw][ic-1]->Add(theHisto);
1895 if(isec>8)TBoxMBBottom[iw][ic-1]->Add(theHisto);
1896 if(isec==7)TBoxMBVertical[iw][ic-1]->Add(theHisto); //
1897
1898 if(isec>2)TBoxSegMB[iw][ic-1]->Add(theHistos); //
1899 if(isec>2 && isec<7)TBoxSegMBTop[iw][ic-1]->Add(theHistos);
1900 if(isec>8)TBoxSegMBBottom[iw][ic-1]->Add(theHistos);
1901 if(isec==7)TBoxSegMBVertical[iw][ic-1]->Add(theHistos); //
1902
1903 if(ic==1)
1904 {
1905 stringstream hname2; hname2 << "timebox_" << Whname[iw] << "_S" << isec ;
1906 TBoxSec[iw][isec-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
1907 TBoxSec[iw][isec-1]->SetTitle(hname2.str().c_str());
1908
1909 stringstream hname2s; hname2s << "SegTimeBox_" << Whname[iw] << "_S" << isec ;
1910 TBoxSegSec[iw][isec-1]=(TH1F*)theHistos->Clone(hnames.str().c_str());
1911 TBoxSegSec[iw][isec-1]->SetTitle(hname2s.str().c_str());
1912
1913 }
1914 if(ic>1)TBoxSec[iw][isec-1]->Add(theHisto); //
1915 if(ic>1)TBoxSegSec[iw][isec-1]->Add(theHistos); //
1916
1917 }// end loop MB
1918 }// end loop Sector
1919 }// end loop Wheel
1920
1921 TH1F * first_to_paint_MB_typ[4][4];
1922 for(int ic=0;ic<4;ic++)
1923 {
1924 first_to_paint_MB_typ[ic][0]=TBoxMB[0][ic];
1925 first_to_paint_MB_typ[ic][1]=TBoxMBTop[0][ic];
1926 first_to_paint_MB_typ[ic][2]=TBoxMBBottom[0][ic];
1927 first_to_paint_MB_typ[ic][3]=TBoxMBVertical[0][ic];
1928 float nbmax[4]={0,0,0,0};
1929 if(TBoxMB[0][ic] != NULL) nbmax[0]=TBoxMB[0][ic]->GetMaximum();
1930 if(TBoxMBTop[0][ic] != NULL) nbmax[1]=TBoxMBTop[0][ic]->GetMaximum();
1931 if(TBoxMBBottom[0][ic] != NULL) nbmax[2]=TBoxMBBottom[0][ic]->GetMaximum();
1932 if(TBoxMBVertical[0][ic] != NULL) nbmax[3]=TBoxMBVertical[0][ic]->GetMaximum();
1933 for(int iw=1;iw<5;iw++)
1934 {
1935 float nbmax0[4]={0,0,0,0};
1936 if(TBoxMB[iw][ic] != NULL) nbmax0[0]=TBoxMB[iw][ic]->GetMaximum();
1937 if(TBoxMBTop[iw][ic] != NULL) nbmax0[1]=TBoxMBTop[iw][ic]->GetMaximum();
1938 if(TBoxMBBottom[iw][ic] != NULL) nbmax0[2]=TBoxMBBottom[iw][ic]->GetMaximum();
1939 if(TBoxMBVertical[iw][ic] != NULL)nbmax0[3]=TBoxMBVertical[iw][ic]->GetMaximum();
1940
1941 if(nbmax0[0]>nbmax[0])
1942 {
1943 nbmax[0]=nbmax0[0]; first_to_paint_MB_typ[ic][0]=TBoxMB[iw][ic];
1944 }
1945 if(nbmax0[1]>nbmax[1])
1946 {
1947 nbmax[1]=nbmax0[1]; first_to_paint_MB_typ[ic][1]=TBoxMBTop[iw][ic];
1948 }
1949 if(nbmax0[2]>nbmax[2])
1950 {
1951 nbmax[2]=nbmax0[2]; first_to_paint_MB_typ[ic][2]=TBoxMBBottom[iw][ic];
1952 }
1953 if(nbmax0[3]>nbmax[3])
1954 {
1955 nbmax[3]=nbmax0[3]; first_to_paint_MB_typ[ic][3]=TBoxMBVertical[iw][ic];
1956 }
1957
1958 }
1959 }
1960 for(int ic=1;ic<5;ic++)
1961 {
1962 stringstream hname21; hname21 << "htime_MB" << ic ;
1963 stringstream hname22; hname22 << "htime_MB" << ic << "_Top" ;
1964 stringstream hname23; hname23 << "htime_MB" << ic << "_Bottom" ;
1965 stringstream hname24; hname24 << "htime_MB" << ic << "_Vertical" ;
1966 if(first_to_paint_MB_typ[ic-1][0] != NULL) first_to_paint_MB_typ[ic-1][0]->SetTitle(hname21.str().c_str());
1967 if(first_to_paint_MB_typ[ic-1][1] != NULL) first_to_paint_MB_typ[ic-1][1]->SetTitle(hname22.str().c_str());
1968 if(first_to_paint_MB_typ[ic-1][2] != NULL) first_to_paint_MB_typ[ic-1][2]->SetTitle(hname23.str().c_str());
1969 if(first_to_paint_MB_typ[ic-1][3] != NULL) first_to_paint_MB_typ[ic-1][3]->SetTitle(hname24.str().c_str());
1970
1971 for(int ityp=0;ityp<4;ityp++)
1972 {
1973 if(first_to_paint_MB_typ[ic-1][ityp] != NULL)
1974 {
1975 first_to_paint_MB_typ[ic-1][ityp]->GetXaxis()->SetLabelSize(0.07);
1976 first_to_paint_MB_typ[ic-1][ityp]->GetYaxis()->SetLabelSize(0.05);
1977 first_to_paint_MB_typ[ic-1][ityp]->SetNdivisions(505);
1978 }
1979 }
1980 }
1981
1982
1983 TCanvas *TBoxAll = new TCanvas("TBoxAll", "",201,81,999,950);
1984 int TBoxAllCheck=0;
1985 TBoxAll->Divide(4,4) ;
1986 for(int ic=1;ic<5;ic++)
1987 {
1988 for(int it=0;it<4;it++)
1989 {
1990 TBoxAll->cd((ic-1)*4+it+1);
1991 if(first_to_paint_MB_typ[ic-1][it]!= NULL)
1992 {
1993 TBoxAllCheck++;
1994 first_to_paint_MB_typ[ic-1][it]->SetMinimum(0);
1995 first_to_paint_MB_typ[ic-1][it]->Draw();
1996 }
1997 }
1998
1999 for(int iw=0;iw<5;iw++)
2000 {
2001 if(TBoxMB[iw][ic-1]!=NULL) TBoxMB[iw][ic-1]->SetLineColor(iw+1);
2002 if(TBoxMBTop[iw][ic-1]!=NULL) TBoxMBTop[iw][ic-1]->SetLineColor(iw+1);
2003 if(TBoxMBBottom[iw][ic-1]!=NULL) TBoxMBBottom[iw][ic-1]->SetLineColor(iw+1);
2004 if(TBoxMBVertical[iw][ic-1]!=NULL) TBoxMBVertical[iw][ic-1]->SetLineColor(iw+1);
2005 if(iw==4)
2006 {
2007 if(TBoxMB[iw][ic-1]!=NULL) TBoxMB[iw][ic-1]->SetLineColor(6);
2008 if(TBoxMBTop[iw][ic-1]!=NULL) TBoxMBTop[iw][ic-1]->SetLineColor(6);
2009 if(TBoxMBBottom[iw][ic-1]!=NULL) TBoxMBBottom[iw][ic-1]->SetLineColor(6);
2010 if(TBoxMBVertical[iw][ic-1]!=NULL) TBoxMBVertical[iw][ic-1]->SetLineColor(6);
2011 }
2012 TBoxAll->cd((ic-1)*4+1); if(TBoxMB[iw][ic-1]!=NULL) TBoxMB[iw][ic-1]->Draw("same");
2013 TBoxAll->cd((ic-1)*4+2); if(TBoxMBTop[iw][ic-1]!=NULL) TBoxMBTop[iw][ic-1]->Draw("same");
2014 TBoxAll->cd((ic-1)*4+3); if(TBoxMBBottom[iw][ic-1]!=NULL) TBoxMBBottom[iw][ic-1]->Draw("same");
2015 TBoxAll->cd((ic-1)*4+4); if(TBoxMBVertical[iw][ic-1]!=NULL) TBoxMBVertical[iw][ic-1]->Draw("same");
2016 }
2017 }
2018
2019 if(TBoxAllCheck > 0)createGifFile("TimeBoxAll","",TBoxAll,false);
2020 delete TBoxAll;
2021
2022 gStyle->SetTitleW(0.55);
2023 gStyle->SetTitleH(0.13);
2024 //gStyle->SetTitleX(0.01);
2025 //gStyle->SetTitleY(0.99);
2026 gStyle->SetTitleX(0.31);
2027 gStyle->SetTitleY(1.03);
2028
2029
2030 TCanvas *TBoxWh[5];
2031 TBoxWh[0] = new TCanvas("TBoxWh-2", "",201,81,999,950);
2032 TBoxWh[1] = new TCanvas("TBoxWh-1", "",201,81,999,950);
2033 TBoxWh[2] = new TCanvas("TBoxWh0", "",201,81,999,950);
2034 TBoxWh[3] = new TCanvas("TBoxWh+1", "",201,81,999,950);
2035 TBoxWh[4] = new TCanvas("TBoxWh+2", "",201,81,999,950);
2036 int TBoxWhCheck[5]={0,0,0,0,0};
2037 for(int iw=0;iw<5;iw++)
2038 {
2039 TBoxWh[iw]->Divide(3,4) ;
2040 for(int isec=1;isec<13;isec++)
2041 {
2042 TBoxWh[iw]->cd(isec);
2043 TBoxWh[iw]->cd(isec)->SetFillColor(0);
2044 TBoxWh[iw]->cd(isec)->SetFrameFillColor(0);
2045 if(TBoxSec[iw][isec-1] != NULL)
2046 {
2047 TBoxWhCheck[iw]++;
2048 TBoxSec[iw][isec-1]->GetXaxis()->SetLabelSize(0.07);
2049 TBoxSec[iw][isec-1]->GetYaxis()->SetLabelSize(0.05);
2050 TBoxSec[iw][isec-1]->SetNdivisions(505);
2051 TBoxSec[iw][isec-1]->Draw(); //
2052 }
2053 }
2054 }
2055
2056 for(int iw=0;iw<5;iw++)
2057 {
2058 if(TBoxWhCheck[iw]>0)
2059 createGifFile("TimeBoxAll",(iw-2),"",TBoxWh[iw]);
2060 delete TBoxWh[iw];
2061 }
2062
2063 TH1F * first_to_paint_MB_typSeg[4][4];
2064 for(int i=0;i<4;i++)
2065 for(int j=0;j<4;j++)
2066 first_to_paint_MB_typSeg[i][j]=NULL;
2067
2068 for(int ic=0;ic<4;ic++)
2069 {
2070 if(TBoxSegMB[0][ic]!=NULL) first_to_paint_MB_typSeg[ic][0]=TBoxSegMB[0][ic];
2071 if(TBoxSegMBTop[0][ic]!=NULL) first_to_paint_MB_typSeg[ic][1]=TBoxSegMBTop[0][ic];
2072 if(TBoxSegMBBottom[0][ic]!=NULL) first_to_paint_MB_typSeg[ic][2]=TBoxSegMBBottom[0][ic];
2073 if(TBoxSegMBVertical[0][ic]!=NULL) first_to_paint_MB_typSeg[ic][3]=TBoxSegMBVertical[0][ic];
2074 float nbmax[4]={0,0,0,0};
2075 if(TBoxSegMB[0][ic]!=NULL) nbmax[0]=TBoxSegMB[0][ic]->GetMaximum();
2076 if(TBoxSegMBTop[0][ic]!=NULL) nbmax[1]=TBoxSegMBTop[0][ic]->GetMaximum();
2077 if(TBoxSegMBBottom[0][ic]!=NULL) nbmax[2]=TBoxSegMBBottom[0][ic]->GetMaximum();
2078 if(TBoxSegMBVertical[0][ic]!=NULL) nbmax[3]=TBoxSegMBVertical[0][ic]->GetMaximum();
2079 for(int iw=1;iw<5;iw++)
2080 {
2081 float nbmax0[4]={0,0,0,0};
2082 if(TBoxSegMB[0][ic]!=NULL) nbmax0[0]=TBoxSegMB[iw][ic]->GetMaximum();
2083 if(TBoxSegMBTop[0][ic]!=NULL) nbmax0[1]=TBoxSegMBTop[iw][ic]->GetMaximum();
2084 if(TBoxSegMBBottom[0][ic]!=NULL) nbmax0[2]=TBoxSegMBBottom[iw][ic]->GetMaximum();
2085 if(TBoxSegMBVertical[0][ic]!=NULL) nbmax0[3]=TBoxSegMBVertical[iw][ic]->GetMaximum();
2086
2087 if(nbmax0[0]>nbmax[0])
2088 {
2089 nbmax[0]=nbmax0[0]; first_to_paint_MB_typSeg[ic][0]=TBoxSegMB[iw][ic];
2090 }
2091 if(nbmax0[1]>nbmax[1])
2092 {
2093 nbmax[1]=nbmax0[1]; first_to_paint_MB_typSeg[ic][1]=TBoxSegMBTop[iw][ic];
2094 }
2095 if(nbmax0[2]>nbmax[2])
2096 {
2097 nbmax[2]=nbmax0[2]; first_to_paint_MB_typSeg[ic][2]=TBoxSegMBBottom[iw][ic];
2098 }
2099 if(nbmax0[3]>nbmax[3])
2100 {
2101 nbmax[3]=nbmax0[3]; first_to_paint_MB_typSeg[ic][3]=TBoxSegMBVertical[iw][ic];
2102 }
2103
2104 }
2105 }
2106 for(int ic=1;ic<5;ic++)
2107 {
2108 stringstream hname21; hname21 << "htime_MB" << ic ;
2109 stringstream hname22; hname22 << "htime_MB" << ic << "_Top" ;
2110 stringstream hname23; hname23 << "htime_MB" << ic << "_Bottom" ;
2111 stringstream hname24; hname24 << "htime_MB" << ic << "_Vertical" ;
2112 if(first_to_paint_MB_typSeg[ic-1][0] != NULL) first_to_paint_MB_typSeg[ic-1][0]->SetTitle(hname21.str().c_str());
2113 if(first_to_paint_MB_typSeg[ic-1][1] != NULL) first_to_paint_MB_typSeg[ic-1][1]->SetTitle(hname22.str().c_str());
2114 if(first_to_paint_MB_typSeg[ic-1][2] != NULL) first_to_paint_MB_typSeg[ic-1][2]->SetTitle(hname23.str().c_str());
2115 if(first_to_paint_MB_typSeg[ic-1][3] != NULL) first_to_paint_MB_typSeg[ic-1][3]->SetTitle(hname24.str().c_str());
2116
2117 for(int ityp=0;ityp<4;ityp++)
2118 {
2119 if(first_to_paint_MB_typSeg[ic-1][ityp]!= NULL)
2120 {
2121 first_to_paint_MB_typSeg[ic-1][ityp]->GetXaxis()->SetLabelSize(0.07);
2122 first_to_paint_MB_typSeg[ic-1][ityp]->GetYaxis()->SetLabelSize(0.05);
2123 first_to_paint_MB_typSeg[ic-1][ityp]->SetNdivisions(505);
2124 }
2125 }
2126 }
2127
2128
2129 TCanvas *TBoxAllSeg = new TCanvas("TBoxAllSeg", "",201,81,999,950);
2130 TBoxAllSeg->Divide(4,4) ;
2131 int TBoxAllSegCheck=0;
2132 for(int ic=1;ic<5;ic++)
2133 {
2134 for (int it=0;it<4;it++)
2135 {
2136 if(first_to_paint_MB_typSeg[ic-1][it] != NULL )
2137 {
2138 TBoxAllSegCheck++;
2139 first_to_paint_MB_typSeg[ic-1][it]->SetMinimum(0);
2140 TBoxAllSeg->cd((ic-1)*4+it+1);
2141 first_to_paint_MB_typSeg[ic-1][it]->Draw();
2142 }
2143 }
2144
2145 for(int iw=0;iw<5;iw++)
2146 {
2147 if(TBoxSegMB[iw][ic-1] != NULL) TBoxSegMB[iw][ic-1]->SetLineColor(iw+1);
2148 if(TBoxSegMBTop[iw][ic-1] != NULL) TBoxSegMBTop[iw][ic-1]->SetLineColor(iw+1);
2149 if(TBoxSegMBBottom[iw][ic-1] != NULL) TBoxSegMBBottom[iw][ic-1]->SetLineColor(iw+1);
2150 if(TBoxSegMBVertical[iw][ic-1] != NULL)TBoxSegMBVertical[iw][ic-1]->SetLineColor(iw+1);
2151 if(iw==4)
2152 {
2153 if(TBoxSegMB[iw][ic-1] != NULL) TBoxSegMB[iw][ic-1]->SetLineColor(6);
2154 if(TBoxSegMBTop[iw][ic-1] != NULL) TBoxSegMBTop[iw][ic-1]->SetLineColor(6);
2155 if(TBoxSegMBBottom[iw][ic-1] != NULL) TBoxSegMBBottom[iw][ic-1]->SetLineColor(6);
2156 if(TBoxSegMBVertical[iw][ic-1] != NULL)TBoxSegMBVertical[iw][ic-1]->SetLineColor(6);
2157 }
2158 TBoxAllSeg->cd((ic-1)*4+1); if(TBoxSegMB[iw][ic-1] != NULL) TBoxSegMB[iw][ic-1]->Draw("same");
2159 TBoxAllSeg->cd((ic-1)*4+2); if(TBoxSegMBTop[iw][ic-1] != NULL) TBoxSegMBTop[iw][ic-1]->Draw("same");
2160 TBoxAllSeg->cd((ic-1)*4+3); if(TBoxSegMBBottom[iw][ic-1] != NULL) TBoxSegMBBottom[iw][ic-1]->Draw("same");
2161 TBoxAllSeg->cd((ic-1)*4+4); if(TBoxSegMBVertical[iw][ic-1] != NULL) TBoxSegMBVertical[iw][ic-1]->Draw("same");
2162 }
2163 }
2164
2165 if(TBoxAllSegCheck>0)createGifFile("TimeBoxAllSeg","",TBoxAllSeg,false);
2166 delete TBoxAllSeg;
2167
2168 gStyle->SetTitleW(0.55);
2169 gStyle->SetTitleH(0.13);
2170 //gStyle->SetTitleX(0.01);
2171 //gStyle->SetTitleY(0.99);
2172 gStyle->SetTitleX(0.31);
2173 gStyle->SetTitleY(1.03);
2174
2175
2176 TCanvas *TBoxWhSeg[5];
2177 int TBoxWhSegCheck[5]={0,0,0,0,0};
2178 TBoxWhSeg[0] = new TCanvas("TBoxSegWh-2", "",201,81,999,950);
2179 TBoxWhSeg[1] = new TCanvas("TBoxSegWh-1", "",201,81,999,950);
2180 TBoxWhSeg[2] = new TCanvas("TBoxSegWh0", "",201,81,999,950);
2181 TBoxWhSeg[3] = new TCanvas("TBoxSegWh+1", "",201,81,999,950);
2182 TBoxWhSeg[4] = new TCanvas("TBoxSegWh+2", "",201,81,999,950);
2183 for(int iw=0;iw<5;iw++)
2184 {
2185 TBoxWhSeg[iw]->Divide(3,4) ;
2186 for(int isec=1;isec<13;isec++)
2187 {
2188 TBoxWhSeg[iw]->cd(isec);
2189 TBoxWhSeg[iw]->cd(isec)->SetFillColor(0);
2190 TBoxWhSeg[iw]->cd(isec)->SetFrameFillColor(0);
2191
2192 if(TBoxSegSec[iw][isec-1] != NULL)
2193 {
2194 TBoxWhSegCheck[iw]++;
2195 TBoxSegSec[iw][isec-1]->GetXaxis()->SetLabelSize(0.07);
2196 TBoxSegSec[iw][isec-1]->GetYaxis()->SetLabelSize(0.05);
2197 TBoxSegSec[iw][isec-1]->SetNdivisions(505);
2198 TBoxSegSec[iw][isec-1]->Draw(); //
2199 }
2200 }
2201 }
2202
2203 for(int iw=0;iw<5;iw++)
2204 {
2205 if(TBoxWhSegCheck[iw]>0)
2206 createGifFile("TimeBoxAllSeg",(iw-2),"",TBoxWhSeg[iw]);
2207 delete TBoxWhSeg[iw];
2208 }
2209
2210
2211
2212
2213
2214 gStyle->SetOptStat(10);
2215 gStyle->SetStatX(0.4);
2216 gStyle->SetStatY(0.88);
2217 gStyle->SetStatW(0.29);
2218 gStyle->SetStatH(0.38);
2219 gStyle->SetTitleY(1.03);
2220
2221
2222 TH1F *NHitsSec[5][12];
2223 TH1F *NHitsMB[5][4];
2224 TH1F *NHitsMBTop[5][4];
2225 TH1F *NHitsMBBottom[5][4];
2226 TH1F *NHitsMBVertical[5][4];
2227 for(int iw=0;iw<5;iw++)
2228 {
2229 for(int isec=0;isec<12;isec++)NHitsSec[iw][isec]=NULL;
2230 for(int ic=0;ic<5;ic++)
2231 {
2232 NHitsMB[iw][ic]=NULL;
2233 NHitsMBTop[iw][ic]=NULL;
2234 NHitsMBBottom[iw][ic]=NULL;
2235 NHitsMBVertical[iw][ic]=NULL;
2236 }
2237 }
2238
2239 whIt = mySectors.begin();
2240 whEnd = mySectors.end();
2241 for(;whIt!=whEnd;++whIt) {
2242 int iw = (*whIt).first + 2;
2243 std::vector<int>::const_iterator secIt = (*whIt).second.begin();
2244 std::vector<int>::const_iterator secEnd = (*whIt).second.end();
2245 for(;secIt!=secEnd;++secIt) {
2246 int isec = (*secIt);
2247 if(isec<13)
2248 for(int ic=1;ic<5;ic++){
2249 //for(int isl=1;isl<4;isl++){
2250 //stringstream hname; hname << "hNhits_" << Whname[iw] << "_S" << isec << "_MB" << ic << "_SL" << isl;
2251 {
2252 stringstream hname; hname << "hNhits_" << Whname[iw] << "_S" << isec << "_MB" << ic;
2253 TH1F * theHisto=getHisto<TH1F>(hname.str());
2254
2255 if(isec==1)
2256 {
2257 stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_MB" << ic ;
2258 NHitsMB[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
2259 NHitsMB[iw][ic-1]->SetTitle(hname2.str().c_str());
2260
2261 stringstream hname3; hname3 << "nHits_" << Whname[iw] << "_MB" << ic << "_Vertical";
2262 NHitsMBVertical[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
2263 NHitsMBVertical[iw][ic-1]->SetTitle(hname3.str().c_str());
2264 }
2265 if(isec==2)
2266 {
2267 stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_MB" << ic << "_Top" ;
2268 NHitsMBTop[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
2269 NHitsMBTop[iw][ic-1]->SetTitle(hname2.str().c_str());
2270 }
2271 if(isec==8)
2272 {
2273 stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_MB" << ic << "_Bottom" ;
2274 NHitsMBBottom[iw][ic-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
2275 NHitsMBBottom[iw][ic-1]->SetTitle(hname2.str().c_str());
2276 }
2277
2278
2279 if(isec>2)NHitsMB[iw][ic-1]->Add(theHisto); //
2280 if(isec>2 && isec<7)NHitsMBTop[iw][ic-1]->Add(theHisto);
2281 if(isec>8)NHitsMBBottom[iw][ic-1]->Add(theHisto);
2282 if(isec==7)NHitsMBVertical[iw][ic-1]->Add(theHisto);
2283
2284 if(ic==1)
2285 {
2286 stringstream hname2; hname2 << "nHits_" << Whname[iw] << "_S" << isec ;
2287 NHitsSec[iw][isec-1]=(TH1F*)theHisto->Clone(hname.str().c_str());
2288 NHitsSec[iw][isec-1]->SetTitle(hname2.str().c_str());
2289
2290 }
2291 if(ic>1 && ic<4)NHitsSec[iw][isec-1]->Add(theHisto); // To avoid mix with MB4
2292 // that has not Theta SLs
2293 }
2294 }
2295 }
2296 }
2297
2298 for(int ic=0;ic<4;ic++)
2299 {
2300 first_to_paint_MB_typ[ic][0]=NHitsMB[0][ic];
2301 first_to_paint_MB_typ[ic][1]=NHitsMBTop[0][ic];
2302 first_to_paint_MB_typ[ic][2]=NHitsMBBottom[0][ic];
2303 first_to_paint_MB_typ[ic][3]=NHitsMBVertical[0][ic];
2304 float nbmax[4]={0,0,0,0};
2305 if(NHitsMB[0][ic])nbmax[0]=NHitsMB[0][ic]->GetMaximum();
2306 if(NHitsMBTop[0][ic])nbmax[1]=NHitsMBTop[0][ic]->GetMaximum();
2307 if(NHitsMBBottom[0][ic])nbmax[2]=NHitsMBBottom[0][ic]->GetMaximum();
2308 if(NHitsMBVertical[0][ic])nbmax[3]=NHitsMBVertical[0][ic]->GetMaximum();
2309 for(int iw=1;iw<5;iw++)
2310 {
2311 float nbmax0[4]={0,0,0,0};
2312 if(NHitsMB[iw][ic] !=NULL)nbmax0[0]=NHitsMB[iw][ic]->GetMaximum();
2313 if(NHitsMBTop[iw][ic] !=NULL)nbmax0[1]=NHitsMBTop[iw][ic]->GetMaximum();
2314 if(NHitsMBBottom[iw][ic] !=NULL)nbmax0[2]=NHitsMBBottom[iw][ic]->GetMaximum();
2315 if(NHitsMBVertical[iw][ic] !=NULL)nbmax0[3]=NHitsMBVertical[iw][ic]->GetMaximum();
2316
2317 if(nbmax0[0]>nbmax[0])
2318 {
2319 nbmax[0]=nbmax0[0]; first_to_paint_MB_typ[ic][0]=NHitsMB[iw][ic];
2320 }
2321 if(nbmax0[1]>nbmax[1])
2322 {
2323 nbmax[1]=nbmax0[1]; first_to_paint_MB_typ[ic][1]=NHitsMBTop[iw][ic];
2324 }
2325 if(nbmax0[2]>nbmax[2])
2326 {
2327 nbmax[2]=nbmax0[2]; first_to_paint_MB_typ[ic][2]=NHitsMBBottom[iw][ic];
2328 }
2329 if(nbmax0[3]>nbmax[3])
2330 {
2331 nbmax[3]=nbmax0[3]; first_to_paint_MB_typ[ic][3]=NHitsMBVertical[iw][ic];
2332 }
2333 }
2334 }
2335
2336
2337 for(int ic=1;ic<5;ic++)
2338 {
2339 stringstream hname21; hname21 << "nHits_MB" << ic ;
2340 stringstream hname22; hname22 << "nHits_MB" << ic << "_Top" ;
2341 stringstream hname23; hname23 << "nHits_MB" << ic << "_Bottom" ;
2342 stringstream hname24; hname24 << "nHits_MB" << ic << "_Vertical" ;
2343 if(first_to_paint_MB_typ[ic-1][0] != NULL) first_to_paint_MB_typ[ic-1][0]->SetTitle(hname21.str().c_str());
2344 if(first_to_paint_MB_typ[ic-1][1] != NULL) first_to_paint_MB_typ[ic-1][1]->SetTitle(hname22.str().c_str());
2345 if(first_to_paint_MB_typ[ic-1][2] != NULL) first_to_paint_MB_typ[ic-1][2]->SetTitle(hname23.str().c_str());
2346 if(first_to_paint_MB_typ[ic-1][3] != NULL) first_to_paint_MB_typ[ic-1][3]->SetTitle(hname24.str().c_str());
2347
2348 for(int ityp=0;ityp<4;ityp++)
2349 {
2350 if(first_to_paint_MB_typ[ic-1][ityp] != NULL)
2351 {
2352 first_to_paint_MB_typ[ic-1][ityp]->GetXaxis()->SetLabelSize(0.07);
2353 first_to_paint_MB_typ[ic-1][ityp]->GetYaxis()->SetLabelSize(0.05);
2354 first_to_paint_MB_typ[ic-1][ityp]->SetNdivisions(505);
2355 }
2356 }
2357 }
2358
2359 TCanvas *NHitsAll = new TCanvas("NHitsAll", "",201,81,999,950);
2360 int NHitsAllCheck=0;
2361 NHitsAll->Divide(4,4) ;
2362 for(int ip=1;ip<17;ip++)
2363 {
2364 NHitsAll->cd(ip)->SetFillColor(0) ;
2365 NHitsAll->cd(ip)->SetFrameFillColor(0) ;
2366 }
2367 for(int ic=1;ic<5;ic++)
2368 {
2369 for(int it=0;it<4; it++)
2370 {
2371 NHitsAll->cd((ic-1)*4+it+1);
2372 if(first_to_paint_MB_typ[ic-1][it] != NULL)
2373 {
2374 NHitsAllCheck++;
2375 first_to_paint_MB_typ[ic-1][it]->Draw();
2376 }
2377 }
2378
2379 for(int iw=0;iw<5;iw++)
2380 {
2381 if(NHitsMB[iw][ic-1] != NULL)NHitsMB[iw][ic-1]->SetLineColor(iw+1);
2382 if(NHitsMBTop[iw][ic-1] != NULL)NHitsMBTop[iw][ic-1]->SetLineColor(iw+1);
2383 if(NHitsMBBottom[iw][ic-1] != NULL)NHitsMBBottom[iw][ic-1]->SetLineColor(iw+1);
2384 if(NHitsMBVertical[iw][ic-1]!= NULL)NHitsMBVertical[iw][ic-1]->SetLineColor(iw+1);
2385 if(iw==4)
2386 {
2387 if(NHitsMB[iw][ic-1] != NULL)NHitsMB[iw][ic-1]->SetLineColor(6);
2388 if(NHitsMBTop[iw][ic-1] != NULL)NHitsMBTop[iw][ic-1]->SetLineColor(6);
2389 if(NHitsMBBottom[iw][ic-1] != NULL)NHitsMBBottom[iw][ic-1]->SetLineColor(6);
2390 if(NHitsMBVertical[iw][ic-1]!= NULL)NHitsMBVertical[iw][ic-1]->SetLineColor(6);
2391 }
2392 NHitsAll->cd((ic-1)*4+1); if(NHitsMB[iw][ic-1] != NULL)NHitsMB[iw][ic-1]->Draw("same");
2393 NHitsAll->cd((ic-1)*4+2); if(NHitsMBTop[iw][ic-1] != NULL)NHitsMBTop[iw][ic-1]->Draw("same");
2394 NHitsAll->cd((ic-1)*4+3); if(NHitsMBBottom[iw][ic-1] != NULL)NHitsMBBottom[iw][ic-1]->Draw("same");
2395 NHitsAll->cd((ic-1)*4+4); if(NHitsMBVertical[iw][ic-1]!= NULL)NHitsMBVertical[iw][ic-1]->Draw("same");
2396 }
2397 }
2398
2399
2400 if(NHitsAllCheck>0)createGifFile("NHitsAll","",NHitsAll,false);
2401 delete NHitsAll;
2402
2403
2404 gStyle->SetTitleW(0.55);
2405 gStyle->SetTitleH(0.13);
2406 //gStyle->SetTitleX(0.01);
2407 //gStyle->SetTitleY(0.99);
2408 gStyle->SetTitleX(0.31);
2409 gStyle->SetTitleY(1.03);
2410
2411 TCanvas *NHitsWh[5];
2412 int NHitsWhCheck[5]={0,0,0,0,0};
2413 NHitsWh[0] = new TCanvas("NHitsWh-2", "",201,81,999,950);
2414 NHitsWh[1] = new TCanvas("NHitsWh-1", "",201,81,999,950);
2415 NHitsWh[2] = new TCanvas("NHitsWh0", "",201,81,999,950);
2416 NHitsWh[3] = new TCanvas("NHitsWh+1", "",201,81,999,950);
2417 NHitsWh[4] = new TCanvas("NHitsWh+2", "",201,81,999,950);
2418 for(int iw=0;iw<5;iw++)
2419 {
2420 NHitsWh[iw]->Divide(3,4) ;
2421 for(int isec=1;isec<13;isec++)
2422 {
2423 NHitsWh[iw]->cd(isec);
2424 NHitsWh[iw]->cd(isec)->SetFillColor(0);
2425 NHitsWh[iw]->cd(isec)->SetFrameFillColor(0);
2426 if(NHitsSec[iw][isec-1] != NULL)
2427 {
2428 NHitsWhCheck[iw]++;
2429 NHitsSec[iw][isec-1]->GetXaxis()->SetLabelSize(0.07);
2430 NHitsSec[iw][isec-1]->GetYaxis()->SetLabelSize(0.05);
2431 NHitsSec[iw][isec-1]->SetNdivisions(505);
2432 NHitsSec[iw][isec-1]->Draw(); //
2433 }
2434 }
2435 }
2436
2437 for(int iw=0;iw<5;iw++)
2438 {
2439 if(NHitsWhCheck[iw]>0)createGifFile("NHitsSec",(iw-2),"",NHitsWh[iw]);
2440 delete NHitsWh[iw];
2441 }
2442
2443
2444 gStyle->SetTitleW(0.55);
2445 //gStyle->SetTitleH(0.13);
2446 gStyle->SetTitleH(0.11);
2447 //gStyle->SetTitleX(0.01);
2448 //gStyle->SetTitleY(0.99);
2449 gStyle->SetTitleX(0.31);
2450 gStyle->SetTitleY(1.03);
2451
2452 TCanvas *NHitsWhAll;
2453 NHitsWhAll = new TCanvas("NHitsWhAll", "",201,81,999,950);
2454 NHitsWhAll->Divide(3,4) ;
2455 int NHitsWhAllCheck=0;
2456 for(int ins=1;ins<13;ins++)
2457 {
2458 first_to_paint=NHitsSec[0][ins-1];
2459 float nbmax1=0;
2460 if(NHitsSec[0][ins-1]!=NULL)NHitsSec[0][ins-1]->GetMaximum();
2461 for(int iw=1;iw<5;iw++)
2462 {
2463 float nbmax2=0;
2464 if(NHitsSec[iw][ins-1] != NULL)nbmax2=NHitsSec[iw][ins-1]->GetMaximum();
2465 if(nbmax2>nbmax1)
2466 {
2467 nbmax1=nbmax2; first_to_paint=NHitsSec[iw][ins-1];
2468 }
2469 }
2470
2471 NHitsWhAll->cd(ins) ;
2472 NHitsWhAll->cd(ins)->SetFillColor(0) ;
2473 NHitsWhAll->cd(ins)->SetFrameFillColor(0) ;
2474 stringstream hname; hname << "nHits_S" << ins ;
2475 if(first_to_paint != NULL)
2476 {
2477 NHitsWhAllCheck++;
2478 first_to_paint->SetTitle(hname.str().c_str());
2479 first_to_paint->Draw();
2480 for(int iw=0;iw<5;iw++)
2481 {
2482 if(NHitsSec[iw][ins-1] != NULL)
2483 {
2484 NHitsSec[iw][ins-1]->SetLineColor(iw+1);
2485 if(iw==4) NHitsSec[iw][ins-1]->SetLineColor(6);
2486 NHitsSec[iw][ins-1]->Draw("same");
2487 }
2488 }
2489 }
2490 }
2491
2492 if(NHitsWhAllCheck>0)createGifFile("NHitsSec","",NHitsWhAll,false);
2493
2494 delete NHitsWhAll;
2495
2496 gStyle->SetStatY(1.01);
2497 //gStyle->SetStatX(0.98);
2498 gStyle->SetStatX(1.01);
2499 //gStyle->SetStatW(0.40);
2500 gStyle->SetStatW(0.35);
2501 //gStyle->SetStatH(0.25);
2502 gStyle->SetStatH(0.10);
2503
2504
2505 stringstream hnameSTA1; hnameSTA1 << "hrIPSA" ;
2506 stringstream hnameSTA2; hnameSTA2 << "hzIPSA" ;
2507 stringstream hnameSTA3; hnameSTA3 << "hrVszIPSA" ;
2508
2509 TH1F * theHistoSTA1=NULL;
2510 TH1F * theHistoSTA2=NULL;
2511 TH2F * theHistoSTA3=NULL;
2512
2513 theHistoSTA1=getHisto<TH1F>(hnameSTA1.str());
2514 theHistoSTA2=getHisto<TH1F>(hnameSTA2.str());
2515 theHistoSTA3=getHisto<TH2F>(hnameSTA3.str());
2516
2517 TCanvas *STAatIP;
2518 STAatIP = new TCanvas("STAatIP", "",201,81,999,400);
2519 STAatIP->Divide(3,1) ;
2520 int CheckSTAatIP=0;
2521 for(int i=1;i<5;i++)
2522 { STAatIP->cd(i)->SetFillColor(0);STAatIP->cd(i)->SetFrameFillColor(0); }
2523 if(theHistoSTA1 != NULL){STAatIP->cd(1);theHistoSTA1->Draw(); CheckSTAatIP++; }
2524 else cout << " hrIPSA histo not found " << endl;
2525 if(theHistoSTA2 != NULL){STAatIP->cd(2);theHistoSTA2->Draw(); CheckSTAatIP++; }
2526 else cout << " hzIPSA histo not found " << endl;
2527 if(theHistoSTA3 != NULL){STAatIP->cd(3);theHistoSTA3->Draw("colz"); CheckSTAatIP++; }
2528 else cout << " hrvszIPSA histo not found " << endl;
2529
2530 if(CheckSTAatIP>0)
2531 createGifFile("STATrack_at_IP","",STAatIP,false);
2532 delete STAatIP;
2533
2534
2535 //gStyle->SetStatY(0.97);
2536 gStyle->SetStatY(0.89);
2537 gStyle->SetStatX(0.98);
2538 gStyle->SetStatW(0.25);
2539 gStyle->SetStatH(0.15);
2540
2541
2542 TH1F * segphi=getHisto<TH1F>("segphi");
2543 TH1F * segphivsz=getHisto<TH1F>("segphivsz");
2544
2545 TH1F * segphiMB[4];
2546 TH1F * segzMB[4];
2547 for(int ic=1;ic<5;ic++)
2548 {
2549 stringstream hname1; hname1 << "segphiMB" << ic ;
2550 stringstream hname2; hname2 << "segzMB" << ic ;
2551 segphiMB[ic-1]=getHisto<TH1F>(hname1.str());
2552 segzMB[ic-1]=getHisto<TH1F>(hname2.str());
2553 }
2554
2555 TCanvas *SegPhiZ;
2556 SegPhiZ = new TCanvas("SegPhiZ", "",201,81,999,850);
2557 SegPhiZ->Divide(2,2) ;
2558 for(int i=1;i<5;i++)
2559 { SegPhiZ->cd(i)->SetFillColor(0);SegPhiZ->cd(i)->SetFrameFillColor(0); }
2560
2561 SegPhiZ->cd(1);segphi->Draw();
2562 SegPhiZ->cd(2);segphivsz->Draw("colz");
2563 first_to_paint=segphiMB[0];
2564 int nbmaxPSeg=segphiMB[0]->GetMaximum();
2565 for(int i=1;i<4;i++)
2566 {
2567 int nbmax0=segphiMB[i]->GetMaximum();
2568 if(nbmax0>nbmaxPSeg){
2569 nbmaxPSeg=nbmax0;
2570 first_to_paint=segphiMB[i];
2571 }
2572 }
2573 first_to_paint->SetTitle("phi of segment position");
2574 first_to_paint->SetMinimum(0);
2575 SegPhiZ->cd(3);first_to_paint->Draw();
2576 for(int i=0;i<4;i++)
2577 {
2578 segphiMB[i]->SetLineColor(i+1);
2579 segphiMB[i]->Draw("same");
2580 }
2581 first_to_paint=segzMB[0];
2582 first_to_paint->SetMinimum(0);
2583 int nbmaxZSeg=segzMB[0]->GetMaximum();
2584 for(int i=1;i<3;i++) // Not consider the MB4, not Theta Segment
2585 {
2586 int nbmax0=segzMB[i]->GetMaximum();
2587 if(nbmax0>nbmaxZSeg){
2588 nbmaxZSeg=nbmax0;
2589 first_to_paint=segzMB[i];
2590 }
2591 }
2592 first_to_paint->SetTitle("z of segment position");
2593 SegPhiZ->cd(4);first_to_paint->Draw();
2594 for(int i=0;i<3;i++) // Not consider the MB4, not Theta Segment
2595 {
2596 segzMB[i]->SetLineColor(i+1);
2597 segzMB[i]->Draw("same");
2598 }
2599
2600
2601 createGifFile("SegmentPosition","",SegPhiZ,false);
2602 delete SegPhiZ;
2603
2604 TH1F * difPhi4_all=getHisto<TH1F>("DifPhi4_1");
2605 TH1F * difPhi4_top=getHisto<TH1F>("DifPhi4_1_top");
2606 TH1F * difPhi4_bot=getHisto<TH1F>("DifPhi4_1_bot");
2607
2608 TCanvas *DifPhi4;
2609 DifPhi4 = new TCanvas("DifPhi4", "",201,81,699,400);
2610 DifPhi4->Divide(2,1) ;
2611 for(int i=1;i<3;i++)
2612 { DifPhi4->cd(i)->SetFillColor(0);DifPhi4->cd(i)->SetFrameFillColor(0); }
2613 TPad *DifPhi4_2 = (TPad*) DifPhi4->GetListOfPrimitives()->FindObject("DifPhi4_2");
2614
2615 DifPhi4->cd(1);difPhi4_all->Draw();
2616 TPaveLabel * titleDifPhi41 = new TPaveLabel(0.05,0.92,0.7,0.99,"phi pos. in MB4-MB1","NDC");
2617 titleDifPhi41->Draw();
2618
2619 difPhi4_top->SetTitle("Top Sectors"); difPhi4_bot->SetTitle("Bottom Sectors");
2620 DifPhi4->cd(2)->SetFillColor(0);DifPhi4->cd(2)->SetFrameFillColor(0);
2621 DifPhi4->cd(2);
2622 gStyle->SetOptTitle(0);
2623 double nphi4top=difPhi4_top->GetMaximum();
2624 double nphi4bot=difPhi4_bot->GetMaximum();
2625 if(nphi4bot>nphi4top)
2626 { difPhi4_bot->Draw();difPhi4_top->Draw("same"); }
2627 else
2628 {difPhi4_top->Draw();difPhi4_bot->Draw("same"); }
2629
2630 DifPhi4_2->BuildLegend();
2631 titleDifPhi41->Draw();
2632
2633
2634 createGifFile("DifPhi14","",DifPhi4,false);
2635
2636 delete DifPhi4;
2637
2638 gStyle->SetOptTitle(1);
2639
2640
2641 TCanvas *hSeg;
2642 hSeg = new TCanvas("hSeg", "",201,81,999,850);
2643 hSeg->Divide(2,2);
2644 for(int i=1;i<4;i++)
2645 { hSeg->cd(i)->SetFillColor(0);hSeg->cd(i)->SetFrameFillColor(0); }
2646
2647 TH1F * hnSegDT=getHisto<TH1F>("hnSegDT");
2648 TH1F * hnHSegDT=getHisto<TH1F>("hnHSegDT");
2649 TH1F * hnSegMB1=getHisto<TH1F>("hnSegMB1");
2650 TH1F * hnHSegMB1=getHisto<TH1F>("hnHSegMB1");
2651
2652 hSeg->cd(1);hnSegDT->Draw();
2653 hSeg->cd(2);hnHSegDT->Draw();
2654 hSeg->cd(3);hnSegMB1->Draw();
2655 hSeg->cd(4);hnHSegMB1->Draw();
2656
2657 createGifFile("SegmentsAll","",hSeg,false);
2658 delete hSeg;
2659
2660 }
2661
2662