1 |
/******* \class DTOfflineAnalyzer ***********************************************
|
2 |
*
|
3 |
* Description:
|
4 |
*
|
5 |
* detailed description
|
6 |
*
|
7 |
* \author : Stefano Lacaprara - INFN LNL <stefano.lacaprara@pd.infn.it>
|
8 |
* $date : 20/11/2006 16:50:57 CET $
|
9 |
*
|
10 |
* Modification:
|
11 |
* Mary-Cruz Fouz
|
12 |
* February 2008.
|
13 |
* To include the plots used on Commissioning
|
14 |
* To extend programs for running ALL wheels
|
15 |
* March 2008: Histo Modifications To allow run over the root files
|
16 |
* And all DTRecSegment2DCollection plots out (not in RECO)
|
17 |
*
|
18 |
*******************************i*****************************************/
|
19 |
|
20 |
|
21 |
/* This Class Header */
|
22 |
#include "UserCode/DTDPGAnalysis/src/DTOfflineAnalyzer.h"
|
23 |
|
24 |
/* Collaborating Class Header */
|
25 |
#include "FWCore/Framework/interface/MakerMacros.h"
|
26 |
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
27 |
#include "FWCore/Framework/interface/Event.h"
|
28 |
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
29 |
#include "FWCore/Framework/interface/ESHandle.h"
|
30 |
#include "FWCore/Utilities/interface/Exception.h"
|
31 |
#include "DQMServices/Core/interface/DQMStore.h"
|
32 |
#include "DQMServices/Core/interface/MonitorElement.h"
|
33 |
#include "FWCore/ServiceRegistry/interface/Service.h"
|
34 |
|
35 |
using namespace edm;
|
36 |
|
37 |
#include "TFile.h"
|
38 |
#include "TH1F.h"
|
39 |
#include "TH2F.h"
|
40 |
|
41 |
#include "DataFormats/LTCDigi/interface/LTCDigi.h"
|
42 |
|
43 |
#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h"
|
44 |
#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h"
|
45 |
#include "Geometry/DTGeometry/interface/DTGeometry.h"
|
46 |
#include "Geometry/Records/interface/MuonGeometryRecord.h"
|
47 |
#include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
|
48 |
#include "DataFormats/DTRecHit/interface/DTRangeMapAccessor.h"
|
49 |
#include "UserCode/DTDPGAnalysis/src/DTMeanTimer.h"
|
50 |
#include "UserCode/DTDPGAnalysis/src/DTSegmentResidual.h"
|
51 |
|
52 |
|
53 |
#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
|
54 |
#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
|
55 |
#include "MagneticField/Engine/interface/MagneticField.h"
|
56 |
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
|
57 |
#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
|
58 |
#include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h"
|
59 |
|
60 |
// this is to handle extrapolations
|
61 |
#include "DataFormats/GeometrySurface/interface/Cylinder.h"
|
62 |
#include "TrackingTools/GeomPropagators/interface/Propagator.h"
|
63 |
#include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
|
64 |
|
65 |
|
66 |
// this is to retrieve digi's
|
67 |
#include "DataFormats/DTDigi/interface/DTDigiCollection.h"
|
68 |
#include "DataFormats/MuonDetId/interface/DTWireId.h"
|
69 |
|
70 |
#include "DataFormats/DTDigi/interface/DTLocalTriggerCollection.h"
|
71 |
#include "DataFormats/DTRecHit/interface/DTRecSegment2DCollection.h"
|
72 |
#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
|
73 |
|
74 |
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
|
75 |
#include "DataFormats/TrackReco/interface/Track.h"
|
76 |
|
77 |
/* C++ Headers */
|
78 |
#include <iostream>
|
79 |
#include <cmath>
|
80 |
using namespace std;
|
81 |
|
82 |
/* ====================================================================== */
|
83 |
|
84 |
/* Constructor */
|
85 |
DTOfflineAnalyzer::DTOfflineAnalyzer(const ParameterSet& pset) : _ev(0){
|
86 |
|
87 |
theSync =
|
88 |
DTTTrigSyncFactory::get()->create(pset.getUntrackedParameter<string>("tTrigMode"),
|
89 |
pset.getUntrackedParameter<ParameterSet>("tTrigModeConfig"));
|
90 |
// Get the debug parameter for verbose output
|
91 |
debug = pset.getUntrackedParameter<bool>("debug");
|
92 |
theRootFileName = pset.getUntrackedParameter<string>("rootFileName");
|
93 |
|
94 |
// the name of the digis collection
|
95 |
theDTLocalTriggerLabel = pset.getParameter<string>("DTLocalTriggerLabel");
|
96 |
|
97 |
// the name of the 1D rec hits collection
|
98 |
theRecHits1DLabel = pset.getParameter<string>("recHits1DLabel");
|
99 |
|
100 |
// the name of the 2D rec hits collection
|
101 |
theRecHits2DLabel = pset.getParameter<string>("recHits2DLabel");
|
102 |
|
103 |
// the name of the 4D rec hits collection
|
104 |
theRecHits4DLabel = pset.getParameter<string>("recHits4DLabel");
|
105 |
|
106 |
// the name of the 4D rec hits collection
|
107 |
theSTAMuonLabel = pset.getParameter<string>("SALabel");
|
108 |
|
109 |
// the name of the propagator
|
110 |
thePropagatorName = pset.getParameter<std::string>("PropagatorName");
|
111 |
thePropagator = 0;
|
112 |
|
113 |
// if MC
|
114 |
mc = pset.getParameter<bool>("isMC");
|
115 |
|
116 |
LCT_RPC = pset.getParameter<bool>("LCT_RPC");
|
117 |
LCT_DT = pset.getParameter<bool>("LCT_DT");
|
118 |
LCT_CSC = pset.getParameter<bool>("LCT_CSC");
|
119 |
|
120 |
|
121 |
doTrig = pset.getParameter<bool>("doTrig");
|
122 |
doHits = pset.getParameter<bool>("doHits");
|
123 |
doTBox = pset.getParameter<bool>("doTBox");
|
124 |
doSegs = pset.getParameter<bool>("doSegs");
|
125 |
doSA = pset.getParameter<bool>("doSA");
|
126 |
|
127 |
doWheel[0] = pset.getParameter<bool>("doWheelm2");
|
128 |
doWheel[1] = pset.getParameter<bool>("doWheelm1");
|
129 |
doWheel[2] = pset.getParameter<bool>("doWheel0");
|
130 |
doWheel[3] = pset.getParameter<bool>("doWheel1");
|
131 |
doWheel[4] = pset.getParameter<bool>("doWheel2");
|
132 |
|
133 |
doTBoxWheel[0] = pset.getParameter<bool>("doTBoxWhm2");
|
134 |
doTBoxWheel[1] = pset.getParameter<bool>("doTBoxWhm1");
|
135 |
doTBoxWheel[2] = pset.getParameter<bool>("doTBoxWh0");
|
136 |
doTBoxWheel[3] = pset.getParameter<bool>("doTBoxWh1");
|
137 |
doTBoxWheel[4] = pset.getParameter<bool>("doTBoxWh2");
|
138 |
|
139 |
|
140 |
doTBoxSector = pset.getParameter<int>("doTBoxSector");
|
141 |
doTBoxChamber= pset.getParameter<int>("doTBoxChamber");
|
142 |
doTBoxSuperLayer= pset.getParameter<int>("doTBoxSuperLayer");
|
143 |
doTBoxLayer= pset.getParameter<int>("doTBoxLayer");
|
144 |
|
145 |
|
146 |
|
147 |
for(int iw=0;iw<5;iw++)
|
148 |
if(doWheel[iw])
|
149 |
cout<< "Wheeel "<< iw-2 << " will be analyzed "<< endl;
|
150 |
|
151 |
|
152 |
// Create the root file
|
153 |
//theFile = new TFile(theRootFileName.c_str(), "RECREATE");
|
154 |
|
155 |
theDQMStore = edm::Service<DQMStore>().operator->();
|
156 |
|
157 |
init=false;
|
158 |
|
159 |
// ==================
|
160 |
// histogram booking
|
161 |
// ==================
|
162 |
char Whname[5][20]={"Wm2","Wm1","W0","W1","W2"};
|
163 |
|
164 |
|
165 |
// global histos...------------
|
166 |
// 1d recHits (in whole detector)
|
167 |
if(doHits) createTH1F("hnHitDT","Num 1d hits DT","", 200,0.,200.);
|
168 |
// 1d recHits Sector by Sector
|
169 |
if(doHits){
|
170 |
for(int iw=0;iw<5;iw++)
|
171 |
{
|
172 |
if(doWheel[iw]){
|
173 |
stringstream hname;
|
174 |
stringstream hTitle;
|
175 |
hname << "hnHitDT" << Whname[iw] ;
|
176 |
hTitle << "Num 1d hits DT " << Whname[iw] ;
|
177 |
createTH1F(hname.str(),hTitle.str(),"",200,0.,200.);
|
178 |
}
|
179 |
}
|
180 |
}
|
181 |
// segments (in whole detector)
|
182 |
if(doSegs) {
|
183 |
createTH1F("hnSegDT","Num of DT segs","", 50,0.,50.);
|
184 |
createTH1F("hnHSegDT","Num of high qual. DT segs","", 50,0.,50.);
|
185 |
histo("hnHSegDT")->SetLineColor(2);
|
186 |
|
187 |
createTH1F("hnSegMB1","Num of MB1 segs","", 50,0.,50.);
|
188 |
createTH1F("hnHSegMB1","Num of high qual. MB1 segs","", 50,0.,50.);
|
189 |
histo("hnHSegMB1")->SetLineColor(2);
|
190 |
|
191 |
createTH1F("segphi","phi of segment position","",72,-180.,180.);
|
192 |
createTH2F("segphivsz","phi vs z of segment position","",160,-800,800,180,-180.,180.);
|
193 |
|
194 |
for (int iMB=0; iMB<4; iMB++) {
|
195 |
stringstream histoobj1; stringstream histoname1;
|
196 |
histoobj1<<"segphiMB"<<iMB+1;
|
197 |
histoname1<<"phi of segment position in MB"<<iMB+1;
|
198 |
createTH1F(histoobj1.str(),histoname1.str(),"",72,-180.,180.);
|
199 |
histo(histoobj1.str())->GetXaxis()->SetTitle("deg.");
|
200 |
histo(histoobj1.str())->SetLineColor(iMB+1);
|
201 |
|
202 |
stringstream histoobj2; stringstream histoname2;
|
203 |
histoobj2<<"segzMB"<<iMB+1;
|
204 |
histoname2<<"z of segment position in MB"<<iMB+1;
|
205 |
createTH1F(histoobj2.str(),histoname2.str(),"",64,-800,800.);
|
206 |
histo(histoobj2.str())->GetXaxis()->SetTitle("cm");
|
207 |
histo(histoobj2.str())->SetLineColor(iMB+1);
|
208 |
}
|
209 |
|
210 |
createTH1F("DifPhi4_1_top","phi pos. in MB4 - MB1, top sects","",40,-40.,40.);
|
211 |
createTH1F("DifPhi4_1_bot","phi pos. in MB4 - MB1, bottom sects","",40,-40.,40.);
|
212 |
createTH1F("DifPhi4_1","phi pos. in MB4 - MB1","",40,-40.,40.);
|
213 |
histo("DifPhi4_1_top")->GetXaxis()->SetTitle("deg.");
|
214 |
histo("DifPhi4_1_bot")->GetXaxis()->SetTitle("deg.");
|
215 |
histo("DifPhi4_1")->GetXaxis()->SetTitle("deg.");
|
216 |
histo("DifPhi4_1_bot")->SetLineColor(2);
|
217 |
}
|
218 |
// segments Sector by Secto
|
219 |
if(doSegs){
|
220 |
for(int iw=0;iw<5;iw++)
|
221 |
{
|
222 |
if(doWheel[iw]){
|
223 |
stringstream hname;
|
224 |
stringstream hTitle;
|
225 |
hname << "hnSegDT" << Whname[iw] ;
|
226 |
hTitle << "Num seg DT " << Whname[iw] ;
|
227 |
createTH1F(hname.str(),hTitle.str(),"",50,0.,50.);
|
228 |
}
|
229 |
}
|
230 |
}
|
231 |
|
232 |
|
233 |
// Trigger:
|
234 |
if(doTrig)
|
235 |
{
|
236 |
createTH1F("TriggerQuality","Local Trigger quality","",8,-0.5,7.5);
|
237 |
createTH1F("TriggerQualityMB4","Local Trigger quality, MB4","",8,-0.5,7.5);
|
238 |
histo("TriggerQualityMB4")->SetLineColor(2);
|
239 |
|
240 |
for(int iw=0;iw<5;iw++)
|
241 |
{
|
242 |
if(doWheel[iw]){
|
243 |
stringstream hname;
|
244 |
stringstream hTitle;
|
245 |
hname << "TriggerInclusive" << Whname[iw] ;
|
246 |
hTitle << "Trigger Inclusive " << Whname[iw] ;
|
247 |
createTH1F (hname.str(),hTitle.str(),"",60,0.5,60.5);
|
248 |
|
249 |
stringstream hname2;
|
250 |
stringstream hTitle2;
|
251 |
hname2 << "SectorTriggerMatrix" << Whname[iw] ;
|
252 |
hTitle2 << "SectorTrigger Matrix " << Whname[iw] ;
|
253 |
for (int ise=0; ise<12; ise++) sects[iw][ise]=0;
|
254 |
createTH1F (hname2.str(),hTitle2.str(),"",21,-0.5,20.5);
|
255 |
}
|
256 |
}
|
257 |
}//end if doTrig
|
258 |
|
259 |
// plots per Sector/CHambers / SL ------------------
|
260 |
|
261 |
for ( int iw = 0; iw < 5; iw++) { //Wheel loop
|
262 |
if(doWheel[iw]){
|
263 |
for ( int sect = 1; sect < 15; sect++) { // Sector loop
|
264 |
|
265 |
// occupancy digi scatter plots
|
266 |
if(doHits){
|
267 |
stringstream hNameOcc;
|
268 |
stringstream hTitleOcc;
|
269 |
hNameOcc << "hDigiXY_" << Whname[iw] << "_S" << sect ;
|
270 |
hTitleOcc << "Digis in " << Whname[iw] << " Sect" << sect ;
|
271 |
createTH2F(hNameOcc.str(),hTitleOcc.str(),"",100, 0.,100.,80,0.,80.); // ** histos hDigiXY_S1, ecc... ********
|
272 |
}//end if doHits
|
273 |
|
274 |
// sectors trigger matrix
|
275 |
if(doTrig)
|
276 |
{
|
277 |
stringstream hTitleTrigMat;
|
278 |
stringstream hNameTrigMat;
|
279 |
hNameTrigMat << "TriggerMatrix" << Whname[iw] << "_S" << sect ;
|
280 |
hTitleTrigMat << "Trigger Matrix, " << Whname[iw] << " Sector " << sect ;
|
281 |
createTH1F (hNameTrigMat.str(),hTitleTrigMat.str(),"",20,-0.5,19.5);
|
282 |
|
283 |
}//end if doTrig
|
284 |
|
285 |
|
286 |
for ( int jst = 1; jst < 5; jst++ ) { // station loop
|
287 |
|
288 |
// trigger Histos: quality & bxID ----------------------
|
289 |
if(doTrig)
|
290 |
{
|
291 |
stringstream hNameTrigg;
|
292 |
stringstream hTitleTrigg;
|
293 |
hNameTrigg << "hTrigBits_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
294 |
hTitleTrigg << "Highest trigg qual," << Whname[iw] << "S" << sect << "/MB" << jst ;
|
295 |
createTH1F(hNameTrigg.str(),hTitleTrigg.str(),"",11,-1.,10.); // *** histos: hTrigBits_S1_MB1, ecc... **********
|
296 |
for ( int iqual = 1; iqual < 7; iqual++ ) {
|
297 |
stringstream hNameTriggBX;
|
298 |
stringstream hTitleTriggBX;
|
299 |
if (iqual == 1 || iqual > 3) { // book histos for qual=1 (== all uncorrelated trigger), 4=LL, 5=HL, 6=HH
|
300 |
hNameTriggBX << "hTrigBX_" << Whname[iw] << "_S" << sect << "_MB" << jst << "_qual" << iqual ;
|
301 |
hTitleTriggBX << "Highest qual BXid," << Whname[iw] << "S" << sect << "/MB" << jst << " qual=" << iqual;
|
302 |
createTH1F(hNameTriggBX.str(),hTitleTriggBX.str(),"",40,0.,40.); // *** histos: hTrigBX_S1_MB1_qual1, ecc... **********
|
303 |
}
|
304 |
} // next quality flag
|
305 |
}//end if doTrig
|
306 |
|
307 |
|
308 |
// Digi histos: ------------------------
|
309 |
// time boxes per chamber....
|
310 |
// float tmin = 3500., tmax = 4500.; // full YB0, local Runs 25946,25602,...
|
311 |
// float tmin = 2000., tmax = 3000.; // Sept Global Runs
|
312 |
float tmin = -200., tmax = 800.; // for tbox ttrigger-subtracted
|
313 |
if(doHits){
|
314 |
stringstream hNameDigi;
|
315 |
stringstream hTitleDigi;
|
316 |
hNameDigi << "htime_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
317 |
hTitleDigi << "Tbox " << Whname[iw] << " S" << sect << "/MB" << jst ;
|
318 |
createTH1F(hNameDigi.str(),hTitleDigi.str(),"",100,tmin, tmax); // *** histos: htime_S1_MB1, ecc... **********
|
319 |
}//end if doHits
|
320 |
for (int sl = 1; sl < 4; sl++ ) { // histograms per SL
|
321 |
// time boxes per SL....
|
322 |
if(doHits){
|
323 |
stringstream hNameDigiSL;
|
324 |
stringstream hTitleDigiSL;
|
325 |
hNameDigiSL << "htime_" << Whname[iw] << "_S" << sect << "_MB" << jst << "_SL" << sl ;
|
326 |
hTitleDigiSL << "TBox " << Whname[iw] << " S" << sect << " MB" << jst << " SL" << sl ;
|
327 |
createTH1F(hNameDigiSL.str(),hTitleDigiSL.str(),"",100,tmin, tmax); // *** histos: htime_S1_MB1_SL1, ecc... **********
|
328 |
for (int il = 1; il < 5; il++ ) { // histograms per Layer
|
329 |
stringstream hNameDigiL;
|
330 |
stringstream hTitleDigiL;
|
331 |
hNameDigiL << "htime_" << Whname[iw] << "_S" << sect << "_MB" << jst << "_SL" << sl << "_L" <<il;
|
332 |
hTitleDigiL << "TBox " << Whname[iw] << " S" << sect << " MB" << jst << " SL" << sl << " L" <<il;
|
333 |
createTH1F(hNameDigiL.str(),hTitleDigiL.str(),"",100,tmin, tmax); // *** histos: htime_S1_MB1_SL1, ecc... **********
|
334 |
if(doTBox && doTBoxWheel[iw]) //make single tbox histos cell by cell
|
335 |
if(doTBoxSector==0 || doTBoxSector== sect)
|
336 |
if(doTBoxChamber==0 || doTBoxChamber== jst)
|
337 |
if(doTBoxSuperLayer==0 || doTBoxSuperLayer==sl )
|
338 |
if(doTBoxLayer==0 || doTBoxLayer==il )
|
339 |
{
|
340 |
int icmax=100;
|
341 |
if(sl==2)icmax=57;
|
342 |
else if(jst==1)icmax=49;
|
343 |
else if(jst==2)icmax=60;
|
344 |
else if(jst==3)icmax=73;
|
345 |
for (int ic = 1; ic < icmax+1; ic++ ) { // histograms per Cell
|
346 |
stringstream hNameDigiC;
|
347 |
stringstream hTitleDigiC;
|
348 |
hNameDigiC << "htime_" << Whname[iw] << "_S" << sect << "_MB" << jst << "_SL" << sl << "_L" <<il <<"_C" << ic;
|
349 |
hTitleDigiC << "TBox " << Whname[iw] << " S" << sect << " MB" << jst << " SL" << sl << " L" <<il <<"_C" << ic;
|
350 |
createTH1F(hNameDigiC.str(),hTitleDigiC.str(),"",100,tmin, tmax); // *** histos: htime_S1_MB1_SL1_C1, ecc... **********
|
351 |
//cout << " Produccing TBox: " << hNameDigiC.str() << endl ;
|
352 |
}
|
353 |
}
|
354 |
}//end Layer
|
355 |
}//end if doHits
|
356 |
if(doSegs)
|
357 |
{
|
358 |
// tmax plots per SL...
|
359 |
float t1 = 300., t2 = 450. ;
|
360 |
stringstream hNameTmax;
|
361 |
stringstream hTitleTmax;
|
362 |
hNameTmax << "htmax_" << Whname[iw] << "_S" << sect << "_MB" << jst << "_SL" << sl ;
|
363 |
hTitleTmax << "Tmax " << Whname[iw] << " S" << sect << "/MB" << jst << "/SL" << sl ;
|
364 |
createTH1F(hNameTmax.str(),hTitleTmax.str(),"",100,t1, t2); // *** histos: htmaxYB0_S1_MB1_SL1, ecc... **********
|
365 |
}// end if doSegs
|
366 |
} // next SL
|
367 |
|
368 |
if(doSegs)
|
369 |
{
|
370 |
// hit residuals in segments -------------
|
371 |
float xmin = -0.25, xmax = 0.25 ; // cm
|
372 |
stringstream hNameRes;
|
373 |
stringstream hTitleRes;
|
374 |
hNameRes << "hResX_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
375 |
hTitleRes << "Hit residuals " << Whname[iw] << " S" << sect << "/MB" << jst ;
|
376 |
createTH1F(hNameRes.str(),hTitleRes.str(),"",100,xmin, xmax); // *** histos: hResX_S1_MB1, ecc... **********
|
377 |
|
378 |
// philocal of rec segments
|
379 |
float phimin = -50., phimax = 50.;
|
380 |
stringstream hNamePhi;
|
381 |
stringstream hTitlePhi;
|
382 |
hNamePhi << "hPhi_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
383 |
hTitlePhi << "Phi local " << Whname[iw] << " S" << sect << "/MB" << jst ;
|
384 |
createTH1F(hNamePhi.str(),hTitlePhi.str(),"",100,phimin, phimax); // *** histos: hPhi_S1_MB1, ecc... **********
|
385 |
|
386 |
// philocal of rec segments HH/HL
|
387 |
phimin = -90., phimax = 90.;
|
388 |
stringstream hNamePhiHL;
|
389 |
stringstream hTitlePhiHL;
|
390 |
hNamePhiHL << "hPhiHL_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
391 |
hTitlePhiHL << "Phi local " << Whname[iw] << " S" << sect << "/MB" << jst << "(>7 hits)";
|
392 |
createTH1F(hNamePhiHL.str(),hTitlePhiHL.str(),"",90,phimin, phimax); // *** histos: hPhiHL_S1_MB1, ecc... **********
|
393 |
// localposition of phi rec segments HH/HL
|
394 |
float xposmin = -150., xposmax = 150.;
|
395 |
stringstream hNamePosHL;
|
396 |
stringstream hTitlePosHL;
|
397 |
hNamePosHL << "hTrg_effdenum_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
398 |
hTitlePosHL << "Phi local Position " << Whname[iw] << " S" << sect << "/MB" << jst << "(>7 hits)";
|
399 |
createTH1F(hNamePosHL.str(),hTitlePosHL.str(),"",50,xposmin, xposmax); // *** histos: hTrg_effdenum_S1_MB1, ecc... **********
|
400 |
|
401 |
// localposition of HH/HL Triggers for phi rec segments HH/HL
|
402 |
stringstream hNamePosTrigHL;
|
403 |
stringstream hTitlePosTrigHL;
|
404 |
hNamePosTrigHL << "hTrg_effnum_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
405 |
hTitlePosTrigHL << "Phi local Position " << Whname[iw] << " S" << sect << "/MB" << jst << "(>7 hits & HH/HL trig)";
|
406 |
createTH1F(hNamePosTrigHL.str(),hTitlePosTrigHL.str(),"",50,xposmin, xposmax); // *** histos: hTrg_effnum_S1_MB1, ecc... **********
|
407 |
// hits in track segments
|
408 |
stringstream hNameHits;
|
409 |
stringstream hTitleHits;
|
410 |
hNameHits << "hNhits_" << Whname[iw] << "_S" << sect << "_MB" << jst ;
|
411 |
hTitleHits << "Nr.hits in segment, " << Whname[iw] << " S" << sect << "/MB" << jst ;
|
412 |
createTH1F(hNameHits.str(),hTitleHits.str(),"",15,0, 15); // *** histos: hNhits_S1_MB1, ecc... **********
|
413 |
}// end if doSegs
|
414 |
|
415 |
} // next station ===========================
|
416 |
|
417 |
if(doSegs)
|
418 |
{
|
419 |
// segments in Sector
|
420 |
stringstream hNameNsegm;
|
421 |
stringstream hTitleNsegm;
|
422 |
hNameNsegm << "hNsegs_" << Whname[iw] << "_S" << sect ;
|
423 |
hTitleNsegm << "Segments in " << Whname[iw] << " sect " << sect ;
|
424 |
createTH1F(hNameNsegm.str(),hTitleNsegm.str(),"",10, 0, 10); // *** histos: hNsegs_S1 ecc... **********
|
425 |
}// end if doSegs
|
426 |
|
427 |
// associated hits to global track per sector
|
428 |
if(doSA)
|
429 |
{
|
430 |
stringstream hNameNassH;
|
431 |
stringstream hTitleNassH;
|
432 |
hNameNassH<< "hNhass_" << Whname[iw] << "_S" << sect ;
|
433 |
hTitleNassH<< "Associated hits in " << Whname[iw] << " sect." << sect ;
|
434 |
createTH1F(hNameNassH.str(),hTitleNassH.str(),"",50, 0, 50); // *** histos: hNhass_S1 ecc... **********
|
435 |
}// end if doSegs
|
436 |
|
437 |
} // next sector ============================
|
438 |
}
|
439 |
} // next wheel ============================
|
440 |
|
441 |
|
442 |
|
443 |
if(doSA)
|
444 |
{
|
445 |
// STA Muon plots
|
446 |
createTH1F("hNSA","Num SA tracks in events","", 6, -0.5, 5.5);
|
447 |
createTH1F("hNhitsSA","Num hits in SA tracks","", 50, .5, 50.5);
|
448 |
createTH1F("hChi2SA","#chi^{2}/NDoF for SA tracks","", 100, 0, 100.);
|
449 |
createTH1F("hPIPSA","p for SA tracks @ IP","", 100, 0., 100);
|
450 |
createTH1F("hPtIPSA","pt for SA tracks @ IP","", 100, 0., 100);
|
451 |
createTH1F("hPhiIPSA","#phi for SA tracks @ IP","", 100, -3.14, 3.14);
|
452 |
createTH1F("hEtaIPSA","#eta for SA tracks @ IP","", 100, -2.5, 2.5);
|
453 |
createTH1F("hrIPSA"," r at IP","",100,0.,500.);
|
454 |
createTH1F("hzIPSA"," z at IP","",100,-750.,750.);
|
455 |
createTH2F("hrVszIPSA"," r vs z at IP","",100,-750.,750.,100,0.,500.);
|
456 |
|
457 |
createTH1F("hPInnerTSOSSA","p for SA tracks @ innermost TSOS","", 100, 0., 100);
|
458 |
createTH1F("hPtInnerTSOSSA","pt for SA tracks @ innermost TSOS","", 100, 0., 100);
|
459 |
createTH1F("hPhiInnerTSOSSA","#phi for SA tracks @ innermost TSOS","", 100, -3.14, 3.14);
|
460 |
createTH1F("hEtaInnerTSOSSA","#eta for SA tracks @ innermost TSOS","", 100, -2.5, 2.5);
|
461 |
createTH1F("hInnerRSA","Radius of innermost TSOS for SA tracks","", 100, 400, 1000.);
|
462 |
createTH1F("hOuterRSA","Radius of outermost TSOS for SA tracks","", 100, 400, 1000.);
|
463 |
createTH2F("hInnerOuterRSA","Radius of outermost TSOS vs innermost one for SA tracks","",
|
464 |
40, 400, 1000.,40, 400, 1000.);
|
465 |
|
466 |
|
467 |
createTH2F("hNSAVsNHits", "Nr.SA tracks vs Nr.1d Hits","", 100,-0.5,39.5, 5,-0.5, 4.5);
|
468 |
createTH2F("hNSAVsNSegs2D","Nr.SA tracks vs Nr.2d Segs","", 20,-0.5,19.5, 5,-0.5, 4.5);
|
469 |
createTH2F("hNSAVsNSegs4D","Nr.SA tracks vs Nr.4d Segs","", 10,-0.5,9.5, 5,-0.5, 4.5);
|
470 |
|
471 |
createTH2F("hNHitsSAVsNHits", "N Hits SA vs Nr. 1d Hits","", 40,-0.5,39.5,100,0,100);
|
472 |
createTH2F("hNHitsSAVsNSegs2D","N Hits SA vs Nr. 2d Segs","", 20,-0.5,19.5,100,0,100);
|
473 |
createTH2F("hNHitsSAVsNSegs4D","N Hits SA vs Nr. 4d Segs","", 10,-0.5,9.5, 100,0,100);
|
474 |
|
475 |
createTH2F("hHitsPosXYSA","Hits position (x,y) SA","",150,-750,750,150,-750,750);
|
476 |
createTH2F("hHitsPosXYSA_1","Hits position (x,y) SA","",150,0,750,150,0,750);
|
477 |
createTH2F("hHitsPosXYSA_2","Hits position (x,y) SA","",150,-750,0,150,0,750);
|
478 |
createTH2F("hHitsPosXYSA_3","Hits position (x,y) SA","",150,-750,0,150,-750,0);
|
479 |
createTH2F("hHitsPosXYSA_4","Hits position (x,y) SA","",150,0,750,150,-750,0);
|
480 |
createTH2F("hHitsPosXZSA","Hits position (x,z) SA","",100,-700,700,100,-800,800);
|
481 |
createTH2F("hHitsPosYZSA","Hits position (y,z) SA","",100,-700,700,100,-800,800);
|
482 |
for ( int iw = 0; iw < 5; iw++) { //Wheel loop
|
483 |
if(doWheel[iw]){
|
484 |
stringstream hTitlePhihit;
|
485 |
stringstream hNamePhihit;
|
486 |
hNamePhihit << "hHitsPosXYSA_" << Whname[iw] ;
|
487 |
hTitlePhihit << "Hits position (x,y) SA " << Whname[iw] ;
|
488 |
createTH2F(hNamePhihit.str(),hTitlePhihit.str(),"",150,-750,750,150,-750,750);
|
489 |
stringstream hNamePhihit2;
|
490 |
hNamePhihit2 << "hHitsPosXYSA_1_" << Whname[iw] ;
|
491 |
createTH2F(hNamePhihit2.str(),hTitlePhihit.str(),"",150,0,750,150,0,750);
|
492 |
stringstream hNamePhihit3;
|
493 |
hNamePhihit3 << "hHitsPosXYSA_2_" << Whname[iw] ;
|
494 |
createTH2F(hNamePhihit3.str(),hTitlePhihit.str(),"",150,-750,0,150,0,750);
|
495 |
stringstream hNamePhihit4;
|
496 |
hNamePhihit4 << "hHitsPosXYSA_3_" << Whname[iw] ;
|
497 |
createTH2F(hNamePhihit4.str(),hTitlePhihit.str(),"",150,-750,0,150,-750,0);
|
498 |
stringstream hNamePhihit5;
|
499 |
hNamePhihit5 << "hHitsPosXYSA_4_" << Whname[iw] ;
|
500 |
createTH2F(hNamePhihit5.str(),hTitlePhihit.str(),"",150,0,750,150,-750,0);
|
501 |
stringstream hNamePhihitXZ;
|
502 |
stringstream hTitlePhihitXZ;
|
503 |
hNamePhihitXZ << "hHitsPosXZSA_" << Whname[iw] ;
|
504 |
hTitlePhihitXZ << "Hits position (x,z) SA " << Whname[iw] ;
|
505 |
createTH2F(hNamePhihitXZ.str(),hTitlePhihitXZ.str(),"",100,-700,700,100,-800,800);
|
506 |
stringstream hNamePhihitYZ;
|
507 |
stringstream hTitlePhihitYZ;
|
508 |
hNamePhihitYZ << "hHitsPosYZSA_" << Whname[iw] ;
|
509 |
hTitlePhihitYZ << "Hits position (y,z) SA " << Whname[iw] ;
|
510 |
createTH2F(hNamePhihitYZ.str(),hTitlePhihitYZ.str(),"",100,-700,700,100,-800,800);
|
511 |
}
|
512 |
}
|
513 |
|
514 |
}//end if doSA
|
515 |
|
516 |
// Global Phi of associated rechits
|
517 |
for ( int iw = 0; iw < 5; iw++) { //Wheel loop
|
518 |
if(doWheel[iw]){
|
519 |
for ( int jst = 1; jst < 5; jst++ ) { // station loop
|
520 |
if(doSA)
|
521 |
{
|
522 |
stringstream hTitlePhihit;
|
523 |
stringstream hNamePhihit;
|
524 |
hNamePhihit << "hPhiHit_" << Whname[iw] << "_MB" << jst ;
|
525 |
hTitlePhihit << "Phi of ass.hit," << Whname[iw] << " MB" << jst ;
|
526 |
createTH1F(hNamePhihit.str(),hTitlePhihit.str(),"",180,-180., 180.); // *** histos: hPhiHit_MB1 ecc... **********
|
527 |
}//end if doSA
|
528 |
if(doSegs)
|
529 |
{
|
530 |
stringstream hNamePhiGlob;
|
531 |
stringstream hTitlePhiGlob;
|
532 |
hNamePhiGlob << "hPhiGlob_" << Whname[iw] << "_MB" << jst;
|
533 |
hTitlePhiGlob << "Phi-Trigger eff," << Whname[iw] << " MB" << jst;
|
534 |
createTH1F(hNamePhiGlob.str(),hTitlePhiGlob.str(),"",180,-180., 180.); // *** histos: hPhiGlob_MB1 ecc... **********
|
535 |
stringstream hNamePhiTrigg;
|
536 |
stringstream hTitlePhiTrigg;
|
537 |
hNamePhiTrigg << "hPhiTrigg_" << Whname[iw] << "_MB" << jst;
|
538 |
hTitlePhiTrigg << "Phi-Trigger eff," << Whname[iw] << " MB" << jst;
|
539 |
createTH1F(hNamePhiTrigg.str(),hTitlePhiTrigg.str(),"",180,-180., 180.); // *** histos: hPhiTrigg_MB1 ecc... **********
|
540 |
}//end if doSegs
|
541 |
} // nest station
|
542 |
}
|
543 |
}
|
544 |
|
545 |
if(doSegs)
|
546 |
{ // DigiTime of hits associated to segments
|
547 |
for ( int iw = 0; iw < 5; iw++) { //Wheel loop
|
548 |
if(doWheel[iw]){
|
549 |
for (int isc=1;isc<15;isc++){// Sector Loop
|
550 |
for ( int jst = 1; jst < 5; jst++ ) { // station loop
|
551 |
stringstream hNameSegTimeMB;
|
552 |
stringstream hTitleSegTimeMB;
|
553 |
hNameSegTimeMB << "SegTimeBox_" << Whname[iw] << "_S" << isc << "_MB" << jst;
|
554 |
hTitleSegTimeMB << "Time Hits (Segment) " << Whname[iw] << "_S" << isc << "_MB" << jst;
|
555 |
createTH1F(hNameSegTimeMB.str(),hTitleSegTimeMB.str(),"",100,-200., 800.); // *** histos:
|
556 |
for (int isl=1;isl<4;isl++){// SuperLayer Loop
|
557 |
stringstream hNameSegTimeSL;
|
558 |
stringstream hTitleSegTimeSL;
|
559 |
hNameSegTimeSL << "SegTimeBox_" << Whname[iw] << "_S" << isc << "_MB" << jst << "_SL"<< isl;
|
560 |
hTitleSegTimeSL << "Time Hits (Segment) " << Whname[iw] << "_S" << isc << "_MB" << jst << "_SL"<< isl;
|
561 |
createTH1F(hNameSegTimeSL.str(),hTitleSegTimeSL.str(),"",100,-200., 800.); // *** histos:
|
562 |
for (int il=1;il<5;il++){// Layer Loop
|
563 |
stringstream hNameSegTime;
|
564 |
stringstream hTitleSegTime;
|
565 |
hNameSegTime << "SegTimeBox_" << Whname[iw] << "_S" << isc << "_MB" << jst << "_SL"<< isl << "_L" << il;
|
566 |
hTitleSegTime << "Time Hits (Segment) " << Whname[iw] << "_S" << isc << "_MB" << jst << "_SL"<< isl << "_L" << il;
|
567 |
createTH1F(hNameSegTime.str(),hTitleSegTime.str(),"",100,-200., 800.); // *** histos:
|
568 |
}//Layer loop
|
569 |
}//Layer Superloop
|
570 |
} // Station loop
|
571 |
} // Sector loop
|
572 |
} // If doWheel
|
573 |
} // Wheel loop
|
574 |
|
575 |
}
|
576 |
|
577 |
|
578 |
|
579 |
// extrapolations to ECAL, HCAL
|
580 |
float zmin = -400., zmax = 400.;
|
581 |
if(doSA){
|
582 |
createTH2F("hphivszECAL","Extrap.position phi-vs-z to ECAL ","",100,zmin,zmax,90,-180,180);
|
583 |
createTH2F("hphivszHCAL","Extrap.position phi-vs-z to HCAL ","",100,zmin,zmax,90,-180,180);
|
584 |
}//end if doSA
|
585 |
|
586 |
|
587 |
} // end constructor =================================================================
|
588 |
|
589 |
/* Destructor */
|
590 |
DTOfflineAnalyzer::~DTOfflineAnalyzer() {
|
591 |
if(doTrig)LabelTriggerMatrix(); // Trigger Matrix Labels
|
592 |
theDQMStore->rmdir("DT/DTOfflineAnalyzer");
|
593 |
cout << " END Destructor " << endl;
|
594 |
} // end destructor ================================================================
|
595 |
|
596 |
// tools for trigger analysis.....==============================================
|
597 |
void DTOfflineAnalyzer::LabelTriggerMatrix() {
|
598 |
char Whname[5][20]={"Wm2","Wm1","W0","W1","W2"};
|
599 |
|
600 |
//Labels for SectorTriggerMatrix:
|
601 |
|
602 |
for(int iw=0;iw<5;iw++)
|
603 |
{
|
604 |
if(doWheel[iw])
|
605 |
{
|
606 |
char A[3]; char B[3]; char C[3]; char D[3];
|
607 |
sprintf (A,"%u",sects[iw][0]); sprintf (B,"%u",sects[iw][1]); sprintf (C,"%u",sects[iw][2]); sprintf (D,"%u",sects[iw][3]);
|
608 |
std::string lab1[] = {" "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "};
|
609 |
|
610 |
lab1[0]="no trig";
|
611 |
lab1[1]="other sects";
|
612 |
lab1[3]= lab1[3] + "Sect" + A;
|
613 |
if (sects[iw][1]) {
|
614 |
lab1[4]= lab1[4] + "Sect" + B;
|
615 |
lab1[8]=lab1[8] + A + " & " + B;
|
616 |
if (sects[iw][2]) {
|
617 |
lab1[5]=lab1[5] + "Sect" + C;
|
618 |
lab1[9]=lab1[9] + A + " & " + C;
|
619 |
lab1[11]=lab1[11] + B +" & " + C;
|
620 |
lab1[15]=lab1[15] + A + " & " + B +" & " + C;
|
621 |
if (sects[iw][3]) {
|
622 |
lab1[6]=lab1[6] + "Sect" + D;
|
623 |
lab1[10]=lab1[10] + A + " & " + D;
|
624 |
lab1[12]=lab1[12] + B + " & " + D;
|
625 |
lab1[13]=lab1[13] + C + " & " + D;
|
626 |
|
627 |
lab1[16]=lab1[16] + A + " & " + B + " & " + D;
|
628 |
lab1[17]=lab1[17] + A + " & " + C + " & " + D;
|
629 |
lab1[18]=lab1[18] + B + " & " + C + " & " + D;
|
630 |
|
631 |
lab1[20]=lab1[20] + A + " & " + B + " & " + C + " & " + D;
|
632 |
}
|
633 |
}
|
634 |
}
|
635 |
|
636 |
stringstream hname;
|
637 |
hname << "SectorTriggerMatrix" << Whname[iw] ;
|
638 |
// for (int ibin=1; ibin<21; ibin++) histo(hname.str())->GetXaxis()->SetBinLabel(ibin,lab1[ibin-1].c_str());
|
639 |
}
|
640 |
}
|
641 |
|
642 |
// Labels for TriggerMatrix:
|
643 |
|
644 |
//char * lab[]={"no trig"," ","MB1","MB2","MB3","MB4"," ","1 & 2","1 & 3","1 & 4","2 & 3","2 & 4",
|
645 |
// "3 & 4"," ","1 & 2 & 3","1 & 2 & 4","1 & 3 & 4","2 & 3 & 4"," ","1 & 2 & 3 & 4"};
|
646 |
//char lab[20][100]={"no trig"," ","MB1","MB2","MB3","MB4"," ","1 & 2","1 & 3","1 & 4","2 & 3","2 & 4",
|
647 |
// "3 & 4"," ","1 & 2 & 3","1 & 2 & 4","1 & 3 & 4","2 & 3 & 4"," ","1 & 2 & 3 & 4"};
|
648 |
for(int iw=0;iw<5;iw++){
|
649 |
if(doWheel[iw]){
|
650 |
for (int ise=1; ise<13; ise++) {
|
651 |
stringstream hName;
|
652 |
hName << "TriggerMatrix" << Whname[iw] << "_S" << ise ;
|
653 |
//for (int ibin=1; ibin<21; ibin++) histo(hName.str())->GetXaxis()->SetBinLabel(ibin,lab[ibin-1]);
|
654 |
}
|
655 |
}}
|
656 |
|
657 |
// Labels for TriggerInclusive:
|
658 |
char label[10];
|
659 |
for(int iw=0;iw<5;iw++){
|
660 |
if(doWheel[iw]){
|
661 |
for (int ise=1; ise<13; ise++) {
|
662 |
for (int ibin=1; ibin<5; ibin++) {
|
663 |
sprintf (label,"S%uMB%u",ise,ibin);
|
664 |
stringstream hname;
|
665 |
hname << "TriggerInclusive" << Whname[iw] ;
|
666 |
// histo(hname.str())->GetXaxis()->SetBinLabel((ise-1)*5+ibin,label);
|
667 |
}
|
668 |
stringstream hname2;
|
669 |
hname2 << "TriggerInclusive" << Whname[iw] ;
|
670 |
// histo(hname2.str())->GetXaxis()->SetBinLabel(ise*5," ");
|
671 |
}
|
672 |
}
|
673 |
}
|
674 |
|
675 |
}
|
676 |
|
677 |
// Operations : main module ======================================================================
|
678 |
void DTOfflineAnalyzer::analyze(const Event & event,
|
679 |
const EventSetup& eventSetup) {
|
680 |
// ===============================================================================================
|
681 |
|
682 |
theSync->setES(eventSetup);
|
683 |
|
684 |
int nprt = event.id().event() - 100*(event.id().event()/100);
|
685 |
if( nprt == 1000)
|
686 |
cout << "Run:Event analyzed " << event.id().run() << ":" << event.id().event() <<
|
687 |
" Num " << _ev++ << endl;
|
688 |
|
689 |
if (debug) cout << endl<<"--- [DTOfflineAnalyzer] Event analysed #Run: " <<
|
690 |
event.id().run() << " #Event: " << event.id().event() << " =====================================" << endl;
|
691 |
|
692 |
float nrun=event.id().run();
|
693 |
if(!init)
|
694 |
{
|
695 |
createTH1F("RunInfo_RunNumbers","RunInfo_RunNumbers","",23,nrun-11.5,nrun+11.5);
|
696 |
init=true;
|
697 |
}
|
698 |
histo("RunInfo_RunNumbers")->Fill(nrun);
|
699 |
|
700 |
// go on with the rest of analysis: DIGI/RecHits, Segments, STAmuons... ============
|
701 |
if (selectEvent()) {
|
702 |
if (doTrig) analyzeTrigger(event, eventSetup);
|
703 |
if (doHits) analyzeDTHits(event, eventSetup);
|
704 |
if (doSegs) analyzeDTSegments(event, eventSetup);
|
705 |
if (doSA) analyzeSATrack(event, eventSetup);
|
706 |
}
|
707 |
|
708 |
} // end main ===========================================================================================
|
709 |
|
710 |
bool DTOfflineAnalyzer::selectEvent() const {
|
711 |
bool trigger=true;
|
712 |
// if( qual[0] > 3 ) trigger = true ; // HH,HL,LL trigger in MB1
|
713 |
return trigger;
|
714 |
}
|
715 |
|
716 |
// ============================================================================================================
|
717 |
// Hits & RecHits analysis
|
718 |
void DTOfflineAnalyzer::analyzeDTHits(const Event & event,
|
719 |
const EventSetup& eventSetup){
|
720 |
// ============================================================================================================
|
721 |
|
722 |
char Whname[5][20]={"Wm2","Wm1","W0","W1","W2"};
|
723 |
|
724 |
// Get the DT Geometry
|
725 |
ESHandle<DTGeometry> dtGeom;
|
726 |
eventSetup.get<MuonGeometryRecord>().get(dtGeom);
|
727 |
|
728 |
|
729 |
// Get the digis from the event ======================
|
730 |
Handle<DTDigiCollection> digis;
|
731 |
// event.getByLabel(digiLabel, digis);
|
732 |
event.getByLabel(theDTLocalTriggerLabel, digis);
|
733 |
|
734 |
// Iterate through all digi collections ordered by LayerId -------------------
|
735 |
|
736 |
DTDigiCollection::DigiRangeIterator dtLayerIt;
|
737 |
for (dtLayerIt = digis->begin();
|
738 |
dtLayerIt != digis->end(); ++dtLayerIt){ // loop on layerID -------
|
739 |
// The layerId
|
740 |
const DTLayerId layerId = (*dtLayerIt).first;
|
741 |
// const DTSuperLayerId slId = layerId.superlayerId();
|
742 |
int iw=2+layerId.wheel();
|
743 |
if(doWheel[iw])
|
744 |
{
|
745 |
// Get the iterators over the digis associated with this LayerId
|
746 |
const DTDigiCollection::Range& digiRange = (*dtLayerIt).second;
|
747 |
// Loop over all digis in the given range
|
748 |
for (DTDigiCollection::const_iterator digi = digiRange.first; // loop on digi --------
|
749 |
digi != digiRange.second;
|
750 |
digi++) {
|
751 |
const DTWireId wireId(layerId, (*digi).wire());
|
752 |
int ix = wireId.wire();
|
753 |
int iy = 20*(wireId.station()-1) + 4*(wireId.superlayer()-1) + wireId.layer();
|
754 |
int se = wireId.sector();
|
755 |
// occupancy scatter plot -----------------------------------
|
756 |
stringstream hTitleDigi;
|
757 |
hTitleDigi << "hDigiXY_" << Whname[iw] << "_S" << se ;
|
758 |
histo2d(hTitleDigi.str())->Fill( ix,iy ); // *** histos: hDigiXY_S1, ecc... **********
|
759 |
|
760 |
|
761 |
// the ttrigg used for this channel
|
762 |
float ttrig = theSync->offset(wireId);
|
763 |
|
764 |
float TDCtime = (*digi).time() - ttrig ; // plot the TDC times ttrigg-subtracted....
|
765 |
|
766 |
|
767 |
// if ( wireId.wheel() == 0 ) { // YB0 =========================
|
768 |
stringstream hTitle, hTitleSL, hTitleL, hTitleC;
|
769 |
hTitle << "htime_" << Whname[iw] << "_S" << wireId.sector() << "_MB" << wireId.station() ;
|
770 |
histo(hTitle.str())->Fill( TDCtime ); // *** histos: htime_1_MB1, ecc... **********
|
771 |
hTitleSL << "htime_" << Whname[iw] << "_S" << wireId.sector() << "_MB" << wireId.station() << "_SL"<< wireId.superlayer() ;
|
772 |
histo(hTitleSL.str())->Fill( TDCtime ); // *** histos: htime_S1_MB1_SL1, ecc... **********
|
773 |
hTitleL << "htime_" << Whname[iw] << "_S" << wireId.sector() << "_MB" << wireId.station() << "_SL"<< wireId.superlayer()
|
774 |
<< "_L"<< wireId.layer() ;
|
775 |
histo(hTitleL.str())->Fill( TDCtime ); // *** histos: htime_S1_MB1_SL1_L1, ecc... **********
|
776 |
if(doTBox && doTBoxWheel[iw])
|
777 |
if(doTBoxSector==0 || doTBoxSector== wireId.sector())
|
778 |
if(doTBoxChamber==0 || doTBoxChamber== wireId.station() )
|
779 |
if(doTBoxSuperLayer==0 || doTBoxSuperLayer==wireId.superlayer() )
|
780 |
if(doTBoxLayer==0 || doTBoxLayer==wireId.layer() )
|
781 |
{
|
782 |
hTitleC << "htime_" << Whname[iw] << "_S" << wireId.sector() << "_MB" << wireId.station() << "_SL"<< wireId.superlayer()
|
783 |
<< "_L"<< wireId.layer() << "_C"<< wireId.wire() ;
|
784 |
histo(hTitleC.str())->Fill( TDCtime ); // *** histos: htime_S1_MB1_SL1_L1_C1, ecc... **********
|
785 |
//cout << " Filling TBox: " << hTitleC.str() << endl ;
|
786 |
}
|
787 |
// } // endif YB0 ==============================================
|
788 |
|
789 |
|
790 |
} // next digi --------------------
|
791 |
}// End if doWheel
|
792 |
} // next LayerId -----------------
|
793 |
|
794 |
|
795 |
// get the tracking geometry
|
796 |
ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
|
797 |
eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
|
798 |
|
799 |
|
800 |
// Get the 1D rechits from the event --------------
|
801 |
Handle<DTRecHitCollection> dtRecHits;
|
802 |
event.getByLabel(theRecHits1DLabel, dtRecHits);
|
803 |
|
804 |
int nHitDT = dtRecHits->size();
|
805 |
histo("hnHitDT")->Fill(nHitDT);
|
806 |
|
807 |
int nHitDTWh[5]={0,0,0,0,0};
|
808 |
// ********* recHits loop ***********************
|
809 |
for (DTRecHitCollection::const_iterator hit = dtRecHits->begin();
|
810 |
hit!=dtRecHits->end(); ++hit) {
|
811 |
// Get the wireId of the rechit
|
812 |
DTWireId wireId = (*hit).wireId();
|
813 |
int iwI=2+wireId.wheel();
|
814 |
if(doWheel[iwI])nHitDTWh[iwI]++;
|
815 |
} // ********* end recHits loop *******************
|
816 |
|
817 |
for(int iw=0;iw<5;iw++){
|
818 |
if(doWheel[iw]){
|
819 |
stringstream hname;
|
820 |
hname << "hnHitDT" << Whname[iw] ;
|
821 |
histo(hname.str())->Fill(nHitDTWh[iw]);
|
822 |
}
|
823 |
}
|
824 |
|
825 |
} // end DTHits analyzer ===============================================
|
826 |
|
827 |
|
828 |
|
829 |
// ==========================================================================================================
|
830 |
// Segment analysis:
|
831 |
void DTOfflineAnalyzer::analyzeDTSegments(const Event & event,
|
832 |
const EventSetup& eventSetup){
|
833 |
// ==========================================================================================================
|
834 |
|
835 |
if (debug) cout << " analyzeDTSegments: " << " Run/Event " << event.id().run() << ":" << event.id().event() << endl;
|
836 |
|
837 |
char Whname[5][20]={"Wm2","Wm1","W0","W1","W2"};
|
838 |
|
839 |
// Get the DT Geometry
|
840 |
ESHandle<DTGeometry> dtGeom;
|
841 |
eventSetup.get<MuonGeometryRecord>().get(dtGeom);
|
842 |
|
843 |
// Get the digis from the event
|
844 |
Handle<DTLocalTriggerCollection> digis;
|
845 |
if (!mc) event.getByLabel(theDTLocalTriggerLabel, digis);
|
846 |
|
847 |
// Get the 4D rechit collection from the event -------------------
|
848 |
edm::Handle<DTRecSegment4DCollection> segs;
|
849 |
event.getByLabel(theRecHits4DLabel, segs);
|
850 |
if (debug) cout << "4d segments: " << segs->size() << endl;
|
851 |
|
852 |
// Get the 1D rechits from the event --------------
|
853 |
Handle<DTRecHitCollection> dtRecHits;
|
854 |
event.getByLabel(theRecHits1DLabel, dtRecHits);
|
855 |
if (debug) cout << "1d rechits: " << dtRecHits->size() << endl;
|
856 |
|
857 |
int nsegs = segs->size();
|
858 |
histo("hnSegDT")->Fill(nsegs);
|
859 |
const std::vector<DTChamber*> & chs = dtGeom->chambers();
|
860 |
|
861 |
|
862 |
int qual[5][4][14];
|
863 |
for (int iw=0; iw<5; iw++) // Wheel 1-5
|
864 |
for (int sec=1; sec<15; ++sec) // section 1 to 14
|
865 |
for (int ist=0; ist<4; ++ist) {
|
866 |
qual[iw][ist][sec-1] = -1;
|
867 |
}
|
868 |
|
869 |
if(doTrig)
|
870 |
{
|
871 |
// ======================================
|
872 |
// local trigger analysis
|
873 |
//=======================================
|
874 |
// get the DT local trigger collection =======================
|
875 |
edm::Handle<DTLocalTriggerCollection> allLocalTriggers;
|
876 |
event.getByLabel(theDTLocalTriggerLabel, allLocalTriggers);
|
877 |
DTLocalTriggerCollection::DigiRangeIterator chambIt;
|
878 |
// Loop over chambers present in DTLocalTriggerCollection
|
879 |
int SCsect=0; int SCst=0;
|
880 |
for (chambIt=allLocalTriggers->begin();chambIt!=allLocalTriggers->end();++chambIt){ // loop on chambers ------
|
881 |
const DTChamberId& id = (*chambIt).first;
|
882 |
SCst=id.station();
|
883 |
SCsect=id.sector();
|
884 |
int iw=2+id.wheel();
|
885 |
|
886 |
if(doWheel[iw]){
|
887 |
const DTLocalTriggerCollection::Range& range = (*chambIt).second;
|
888 |
int ntrCh=0;
|
889 |
// loop over triggers of this chamber
|
890 |
for (DTLocalTriggerCollection::const_iterator trigtrack = range.first;trigtrack!=range.second;++trigtrack){
|
891 |
if (trigtrack->quality()<7) {
|
892 |
ntrCh++;
|
893 |
if (ntrCh>4) break;
|
894 |
if (qual[iw][SCst-1][SCsect-1]!=-2) {
|
895 |
int iQual=trigtrack->quality();
|
896 |
if( iQual > qual[iw][SCst-1][SCsect-1] ) qual[iw][SCst-1][SCsect-1]= iQual; // store the best trigger quality for this station
|
897 |
} //end if qual != -2
|
898 |
} // quality <7
|
899 |
} // end loop on triggers in this chambers -------------
|
900 |
} // end if(doWheel[iw])
|
901 |
|
902 |
} //end loop on chambers -------
|
903 |
}
|
904 |
// ===== end local trigger analysis =========================================
|
905 |
|
906 |
// counters for segments in sectors
|
907 |
int nSegSect[5][15];
|
908 |
for (int iw=0; iw<5; iw++) // Wheel -2 (0) to 2 (4)
|
909 |
for (int sec=1; sec<=15; ++sec) { // section 1 to 14
|
910 |
nSegSect[iw][sec] = 0;
|
911 |
}
|
912 |
|
913 |
|
914 |
int NsegmH=0; int NsMB1=0; int NsHMB1=0;
|
915 |
double phi1[10]; double phi4[10]; int where1[10][2]; int where4[10][2]; int N1=0; int N4=0;
|
916 |
|
917 |
// loop on chambers ==============================================
|
918 |
for (std::vector<DTChamber*>::const_iterator ch = chs.begin();
|
919 |
ch!=chs.end() ; ++ch) {
|
920 |
DTChamberId chid((*ch)->id());
|
921 |
int iw= 2+chid.wheel();
|
922 |
DTRecSegment4DCollection::range segsch= segs->get(chid);
|
923 |
|
924 |
if(doWheel[iw])
|
925 |
{
|
926 |
|
927 |
|
928 |
// ********** loop on 4D segments *********************************
|
929 |
|
930 |
|
931 |
for (DTRecSegment4DCollection::const_iterator seg=segsch.first ;
|
932 |
seg!=segsch.second ; ++seg ) {
|
933 |
|
934 |
int ist = seg->chamberId().station();
|
935 |
if (ist==1) NsMB1++;
|
936 |
// int iwheel = seg->chamberId().wheel() + 3; // Wheel -2,.+2 => 1,...5
|
937 |
int isect = seg->chamberId().sector();
|
938 |
int iisect = isect;
|
939 |
if (isect == 13 ) isect = 4;
|
940 |
if (isect == 14 ) isect = 10;
|
941 |
|
942 |
const DTChamber* ch = dtGeom->chamber(seg->chamberId());
|
943 |
GlobalPoint glbPoint = ch->toGlobal((*seg).localPosition());
|
944 |
//GlobalVector glbDir = ch->toGlobal((*seg).localDirection()); // Not being used and in 62X gives erors for being set but not used
|
945 |
|
946 |
float radtodeg = 57.296;
|
947 |
|
948 |
float phiglobal = glbPoint.phi(); // phi position of reco segments
|
949 |
float zglobal = glbPoint.z(); // zed position of reco segments
|
950 |
histo2d("segphivsz")->Fill(zglobal,radtodeg*phiglobal);
|
951 |
histo("segphi")->Fill(radtodeg*phiglobal);
|
952 |
stringstream histoobj1;
|
953 |
histoobj1<<"segphiMB"<<ist;
|
954 |
histo(histoobj1.str())->Fill(radtodeg*phiglobal);
|
955 |
stringstream histoobj2;
|
956 |
histoobj2<<"segzMB"<<ist;
|
957 |
histo(histoobj2.str())->Fill(zglobal);
|
958 |
|
959 |
if (ist==1) {
|
960 |
if (N1<10) {
|
961 |
phi1[N1]=radtodeg*phiglobal;
|
962 |
where1[N1][0]=iw;
|
963 |
where1[N1][1]=isect;
|
964 |
N1++;
|
965 |
}
|
966 |
}
|
967 |
else if (ist==4) {
|
968 |
if (N4<10) {
|
969 |
phi4[N4]=radtodeg*phiglobal;
|
970 |
where4[N4][0]=iw;
|
971 |
where4[N4][1]=isect;
|
972 |
N4++;
|
973 |
}
|
974 |
}
|
975 |
|
976 |
// first the the two projection separately -----------------
|
977 |
// phi segment
|
978 |
if(debug) cout << seg->chamberId() << endl;
|
979 |
if(debug) cout << " 4D segm: x " << glbPoint.x() << " y " << glbPoint.y() << " z " << glbPoint.z() << endl;
|
980 |
const DTChamberRecSegment2D* phiSeg= (*seg).phiSegment();
|
981 |
// cout << -atan(glbDir.x()/ glbDir.y()) << endl;
|
982 |
float localPhi = (*seg).localDirection().x();
|
983 |
float localPhideg = radtodeg * atan(localPhi);
|
984 |
std::vector<DTRecHit1D> phiHits;
|
985 |
int NtkHit = 0;
|
986 |
if (phiSeg) {
|
987 |
phiHits = phiSeg->specificRecHits();
|
988 |
if(debug) cout << " Nhits in Phi-segment " << phiHits.size() << endl;
|
989 |
NtkHit = phiHits.size();
|
990 |
if (phiHits.size()>=6) { // Nhits > 6
|
991 |
stringstream hTitlePhi;
|
992 |
hTitlePhi << "hPhi_" << Whname[iw] << "_S" << isect << "_MB" << ist;
|
993 |
histo(hTitlePhi.str())->Fill( localPhideg ); // *** histos: hPhiS1_MB1, ecc... **********
|
994 |
|
995 |
float phiLocal= 57.296*atan((*seg).localDirection().x()/(*seg).localDirection().z());
|
996 |
if (phiHits.size()>6)
|
997 |
{
|
998 |
stringstream hTitlePhiHL;
|
999 |
hTitlePhiHL << "hPhiHL_" << Whname[iw] << "_S" << iisect << "_MB" << ist;
|
1000 |
histo(hTitlePhiHL.str())->Fill( phiLocal );
|
1001 |
NsegmH++;
|
1002 |
if (ist==1) NsHMB1++;
|
1003 |
|
1004 |
}
|
1005 |
int MBeffSec = 0; // don't use this station [ist,isec ]
|
1006 |
for ( int ist1=1; ist1 < 5; ++ist1)
|
1007 |
if (ist1 != ist && qual[iw][ist1-1][iisect-1] > -1 ) MBeffSec = 1;
|
1008 |
if(MBeffSec) // event triggered also by other stations on same sector;
|
1009 |
if (phiHits.size()>6 && abs(phiLocal) < 40. )
|
1010 |
{
|
1011 |
stringstream hNamePosHL;
|
1012 |
hNamePosHL << "hTrg_effdenum_" << Whname[iw] << "_S" << iisect << "_MB" << ist ;
|
1013 |
histo(hNamePosHL.str())->Fill((*seg).localPosition().x());
|
1014 |
|
1015 |
if(qual[iw][ist-1][iisect-1] > 4 ){
|
1016 |
stringstream hNamePosTrigHL;
|
1017 |
hNamePosTrigHL << "hTrg_effnum_" << Whname[iw] << "_S"<< iisect << "_MB" << ist ;
|
1018 |
histo(hNamePosTrigHL.str())->Fill((*seg).localPosition().x());
|
1019 |
}
|
1020 |
}
|
1021 |
|
1022 |
// if (abs(localPhi)< 0.36 ) { // phi < 20 deg
|
1023 |
if (abs(localPhideg)< 30. ) { // phi < 30 deg
|
1024 |
|
1025 |
// ---- trigger efficiency analysis -----------
|
1026 |
// set flag for trigger efficiency study: 1= use it (event triggered by other stations), 0= don't use it
|
1027 |
int MBeff = 0; // don't use this station [ist,isec ]
|
1028 |
for (int sec1=1; sec1<15; ++sec1) {
|
1029 |
for ( int ist1=1; ist1 < 5; ++ist1) {
|
1030 |
if( ist1 != ist || sec1 != iisect ) {
|
1031 |
if ( qual[iw][ist1-1][sec1-1] > 4 ) MBeff = 1; // event triggered also by other stations
|
1032 |
// in the SAME Wheel; use this station
|
1033 |
}
|
1034 |
} // next station
|
1035 |
} // next sector
|
1036 |
|
1037 |
if( MBeff == 1) { // event triggered by other stations
|
1038 |
float phiglobal = glbPoint.phi(); // phi position of reco segments
|
1039 |
if (phiHits.size()>=7) { // HH & HL potential candidates
|
1040 |
stringstream hTitlePhiGlob;
|
1041 |
hTitlePhiGlob << "hPhiGlob_" << Whname[iw] << "_MB" << ist;
|
1042 |
stringstream hTitlePhiTrigg;
|
1043 |
hTitlePhiTrigg << "hPhiTrigg_"<< Whname[iw] << "_MB" << ist;
|
1044 |
histo(hTitlePhiGlob.str())->Fill( phiglobal*radtodeg ); // *** histos: hPhiGlob_MB1, ecc... **********
|
1045 |
if( qual[iw][ist-1][iisect-1] > 4) histo(hTitlePhiTrigg.str())->Fill( phiglobal*radtodeg ); // *** hPhiTrigg_MB1, ...
|
1046 |
}
|
1047 |
}
|
1048 |
// end trigger efficiency analysis ------------
|
1049 |
// prepare vectors for re-fitting
|
1050 |
//float xfit[12], yfit [12]; // Not being used and in 62X gives erors for being set but not used
|
1051 |
//float sfit[12]; // flag (-1 or +1) for left/right semicell, input to fitline_t0 function // Not being used and in 62X gives erors for being set but not used
|
1052 |
DTSuperLayerId slid1(phiSeg->chamberId(),1);
|
1053 |
/// Mean timer analysis
|
1054 |
DTMeanTimer meanTimer1(dtGeom->superLayer(slid1), phiHits, eventSetup, theSync);
|
1055 |
vector<double> tMaxs1=meanTimer1.run();
|
1056 |
// refit: prepare the input vectors
|
1057 |
DTChamberId chId = phiSeg->chamberId();
|
1058 |
const DTChamber* chamb = dtGeom->chamber(chId);
|
1059 |
int nhitfit = 0; // nr. of hits in the re-fit
|
1060 |
float tmax123[] = {0.,0.,0.,0.};
|
1061 |
for (int isl=1; isl<4; isl=isl+2) { // loop on SL 1 & 3
|
1062 |
for (int il=1; il<5; il++) { // loop on layers
|
1063 |
DTLayerId layId = DTLayerId(chId,isl,il);
|
1064 |
const DTLayer* lay = chamb->layer(layId);
|
1065 |
GlobalPoint laypos = lay->position();
|
1066 |
LocalPoint laylocal = chamb->toLocal(laypos);
|
1067 |
double xextr = phiSeg->localPosition().x() + // segment extrap. to this layer
|
1068 |
( phiSeg->localDirection().x()/phiSeg->localDirection().z() ) * laylocal.z();
|
1069 |
std::vector< DTRecHit1D > specificHits = phiSeg->specificRecHits();
|
1070 |
for (unsigned int sphit = 0; sphit < specificHits.size(); ++sphit){ // loop on segment hits
|
1071 |
if ((specificHits[sphit]).wireId().layerId().superlayerId().superLayer() == isl &&
|
1072 |
(specificHits[sphit]).wireId().layer() == il ) {
|
1073 |
float xhit = (specificHits[sphit]).localPosition().x() + laylocal.x() ; // localPosition is in the layer (not in the cell)
|
1074 |
DTWireId wireId = (specificHits[sphit]).wireId();
|
1075 |
float ttrig = theSync->offset(wireId);
|
1076 |
//int ill = il; // Not being used and in 62X gives erors for being set but not used
|
1077 |
//if ( isl > 1) ill = il + 4; // Not being used and in 62X gives erors for being set but not used
|
1078 |
if (il == 1 || il == 3 ) tmax123[isl] = tmax123[isl] + 0.5*( (specificHits[sphit]).digiTime() - ttrig );
|
1079 |
if (il == 2) tmax123[isl] = tmax123[isl] + (specificHits[sphit]).digiTime() - ttrig;
|
1080 |
//xfit[nhitfit] = laylocal.z(); // input to fitline function // Not being used and in 62X gives erors for being set but not used
|
1081 |
//yfit[nhitfit] = xhit; // input to fitline function // Not being used and in 62X gives erors for being set but not used
|
1082 |
//sfit[nhitfit] = 1.; // mark left/right semi-cell (1=Right) input to fitline_t0 function ) // Not being used and in 62X gives erors for being set but not used
|
1083 |
//if( (specificHits[sphit]).lrSide() == 2 ) sfit[nhitfit] = -1.; // -1 = Left // Not being used and in 62X gives erors for being set but not used
|
1084 |
nhitfit++;
|
1085 |
// ============== histograms of residuals ======================
|
1086 |
stringstream hTitle;
|
1087 |
hTitle << "hResX_" << Whname[iw] << "_S" << isect << "_MB" << ist ;
|
1088 |
histo(hTitle.str())->Fill( xhit-xextr); // *** histos: hResX_S1_MB1, ecc... **********
|
1089 |
// ==============================================================
|
1090 |
} // endif hitlayer == layer
|
1091 |
} // end loop on hits
|
1092 |
} // end loop on layers
|
1093 |
} // end loop on SL
|
1094 |
|
1095 |
// ======= tmax plots =======================================
|
1096 |
stringstream hTitle1, hTitle2, hTitle3;
|
1097 |
hTitle1 << "htmax_" << Whname[iw] << "_S" << isect << "_MB" << ist << "_SL1";
|
1098 |
histo(hTitle1.str())->Fill( tmax123[1]);
|
1099 |
hTitle2 << "htmax_" << Whname[iw] << "_S"<< isect << "_MB" << ist << "_SL3";
|
1100 |
histo(hTitle2.str())->Fill( tmax123[3]);
|
1101 |
// ===========================================================
|
1102 |
} // endif abs(phiLocal) < 35 deg
|
1103 |
} // endif phiHts.size() >= 6
|
1104 |
|
1105 |
//Time of associated hits
|
1106 |
//cout << " Hits Wh" << iw-2 << " Sector "<< iisect << " MB " << ist << endl;
|
1107 |
std::vector<DTRecHit1D> ListTheRecHits=phiSeg->specificRecHits();
|
1108 |
vector<DTRecHit1D>::iterator TheRecHitAdd;
|
1109 |
for (TheRecHitAdd = ListTheRecHits.begin(); TheRecHitAdd != ListTheRecHits.end();
|
1110 |
++TheRecHitAdd)
|
1111 |
{
|
1112 |
DTRecHit1D TheRecHit =*TheRecHitAdd;
|
1113 |
DTWireId wireId = TheRecHit.wireId();
|
1114 |
int id_sl=wireId.superlayer();
|
1115 |
int Layer=wireId.layer();
|
1116 |
//int Wire=wireId.wire(); // Not being used and in 62X gives erors for being set but not used
|
1117 |
float TDCtime=TheRecHit.digiTime();
|
1118 |
float ttrig = theSync->offset(wireId);
|
1119 |
float ltime = TDCtime - ttrig ; // plot the TDC times ttrigg-subtracted....
|
1120 |
//cout << "SL " << id_sl << " L " << Layer << " C " << Wire << " Time " << ltime << " ... " << TDCtime << " " << endl;
|
1121 |
|
1122 |
stringstream hTitle;
|
1123 |
hTitle << "SegTimeBox_" << Whname[iw] << "_S" << iisect << "_MB" << ist << "_SL"<< id_sl << "_L" << Layer;
|
1124 |
histo(hTitle.str())->Fill(ltime);
|
1125 |
|
1126 |
stringstream hTitleSL;
|
1127 |
hTitleSL << "SegTimeBox_" << Whname[iw] << "_S" << iisect << "_MB" << ist << "_SL"<< id_sl;
|
1128 |
histo(hTitleSL.str())->Fill(ltime);
|
1129 |
|
1130 |
stringstream hTitleMB;
|
1131 |
hTitleMB << "SegTimeBox_" << Whname[iw] << "_S" << iisect << "_MB" << ist ;
|
1132 |
histo(hTitleMB.str())->Fill(ltime);
|
1133 |
}
|
1134 |
|
1135 |
|
1136 |
} // endif phiseg ---------------------------
|
1137 |
|
1138 |
// zed segment
|
1139 |
const DTSLRecSegment2D* zedSeg =(*seg).zSegment();
|
1140 |
//cout << "zedSeg " << zedSeg << endl;
|
1141 |
vector<DTRecHit1D> zedHits;
|
1142 |
if (zedSeg) {
|
1143 |
zedHits = zedSeg->specificRecHits();
|
1144 |
if(debug) cout << " Nhits in z-segment " << zedHits.size() << endl;
|
1145 |
NtkHit = NtkHit + zedHits.size();
|
1146 |
|
1147 |
//Time of associated hits
|
1148 |
|
1149 |
//cout << " Hits Wh" << iw-2 << " Sector "<< iisect << " MB " << ist << endl;
|
1150 |
DTSuperLayerId SLId=zedSeg->superLayerId();
|
1151 |
int id_sl=SLId.superlayer();
|
1152 |
std::vector<DTRecHit1D> ListTheRecHits=zedSeg->specificRecHits();
|
1153 |
vector<DTRecHit1D>::iterator TheRecHitAdd;
|
1154 |
for (TheRecHitAdd = ListTheRecHits.begin(); TheRecHitAdd != ListTheRecHits.end();
|
1155 |
++TheRecHitAdd)
|
1156 |
{
|
1157 |
DTRecHit1D TheRecHit =*TheRecHitAdd;
|
1158 |
DTWireId wireId = TheRecHit.wireId();
|
1159 |
int Layer=wireId.layer();
|
1160 |
//int Wire=wireId.wire(); // Not being used and in 62X gives erors for being set but not used
|
1161 |
float TDCtime=TheRecHit.digiTime();
|
1162 |
float ttrig = theSync->offset(wireId);
|
1163 |
float ltime = TDCtime - ttrig ; // plot the TDC times ttrigg-subtracted....
|
1164 |
//cout << "SL " << id_sl << " L " << Layer << " C " << Wire << " Time " << ltime << " ... " << TDCtime << " " << endl;
|
1165 |
|
1166 |
stringstream hTitle;
|
1167 |
hTitle << "SegTimeBox_" << Whname[iw] << "_S" << iisect << "_MB" << ist << "_SL"<< id_sl << "_L" << Layer;
|
1168 |
histo(hTitle.str())->Fill(ltime);
|
1169 |
|
1170 |
stringstream hTitleSL;
|
1171 |
hTitleSL << "SegTimeBox_" << Whname[iw] << "_S" << iisect << "_MB" << ist << "_SL"<< id_sl;
|
1172 |
histo(hTitleSL.str())->Fill(ltime);
|
1173 |
|
1174 |
stringstream hTitleMB;
|
1175 |
hTitleMB << "SegTimeBox_" << Whname[iw] << "_S" << iisect << "_MB" << ist ;
|
1176 |
histo(hTitleMB.str())->Fill(ltime);
|
1177 |
}
|
1178 |
} // endif zedSeg
|
1179 |
|
1180 |
|
1181 |
// ==== fill hit multiplicity histos per sector ===============
|
1182 |
stringstream hTitle;
|
1183 |
hTitle << "hNhits_" << Whname[iw] << "_S" << isect << "_MB" << ist ;
|
1184 |
histo(hTitle.str())->Fill( NtkHit ); // hNhits_S1_MB1, ....ecc
|
1185 |
|
1186 |
if (phiSeg && zedSeg) nSegSect[iw][isect]++;
|
1187 |
|
1188 |
|
1189 |
} // end loop 4D segment in chamber ========================
|
1190 |
} // end if(doWheel[iw])
|
1191 |
|
1192 |
} // end loop on all chambers =========================
|
1193 |
|
1194 |
histo("hnHSegDT")->Fill(float(NsegmH));
|
1195 |
histo("hnSegMB1")->Fill(float(NsMB1));
|
1196 |
histo("hnHSegMB1")->Fill(float(NsHMB1));
|
1197 |
|
1198 |
for (int iph4=0; iph4<N4; iph4++) {
|
1199 |
for (int iph1=0; iph1<N1; iph1++) {
|
1200 |
|
1201 |
if (where1[iph1][0]<where4[iph4][0]+2 && where1[iph1][0]>where4[iph4][0]-2 &&
|
1202 |
where1[iph1][1]<where4[iph4][1]+2 && where1[iph1][1]>where4[iph4][1]-2 ) {
|
1203 |
if (where4[iph4][1]<7 && where4[iph4][1]>1) histo("DifPhi4_1_top")->Fill(phi4[iph4]-phi1[iph1]);
|
1204 |
else if (where4[iph4][1]>7) histo("DifPhi4_1_bot")->Fill(phi4[iph4]-phi1[iph1]);
|
1205 |
histo("DifPhi4_1")->Fill(phi4[iph4]-phi1[iph1]);
|
1206 |
}
|
1207 |
}
|
1208 |
}
|
1209 |
|
1210 |
|
1211 |
// ==== fill segment multiplicity histos per sector ===============
|
1212 |
for (int iw=0; iw<5; iw++) // Wheels -2 (0) to 2 (4)
|
1213 |
{
|
1214 |
if(doWheel[iw])
|
1215 |
{
|
1216 |
for (int sec=1; sec<=12; ++sec) { // section 1 to 12
|
1217 |
stringstream hTitle;
|
1218 |
hTitle << "hNsegs_" << Whname[iw] << "_S" << sec;
|
1219 |
if( nSegSect[sec] > 0 ) histo(hTitle.str())->Fill( nSegSect[iw][sec]); // hNsegs_Sect1, ....ecc
|
1220 |
}
|
1221 |
}
|
1222 |
}
|
1223 |
// ================================================================
|
1224 |
|
1225 |
} // end DTsegments analyzer =============================================
|
1226 |
|
1227 |
|
1228 |
// ==========================================================================================================
|
1229 |
// StanAlone Track muon analysis
|
1230 |
void DTOfflineAnalyzer::analyzeSATrack(const Event & event,
|
1231 |
const EventSetup& eventSetup){
|
1232 |
// ==========================================================================================================
|
1233 |
|
1234 |
if (debug) cout << " analyzeSATracks : ------------------------------------------" << endl;
|
1235 |
char Whname[5][20]={"Wm2","Wm1","W0","W1","W2"};
|
1236 |
|
1237 |
MuonPatternRecoDumper muonDumper;
|
1238 |
|
1239 |
// Get the DT Geometry
|
1240 |
ESHandle<DTGeometry> dtGeom;
|
1241 |
eventSetup.get<MuonGeometryRecord>().get(dtGeom);
|
1242 |
// const std::vector<DTChamber*> & chs = dtGeom->chambers();
|
1243 |
|
1244 |
// Get the 4D rechit collection from the event -------------------
|
1245 |
edm::Handle<DTRecSegment4DCollection> segs;
|
1246 |
event.getByLabel(theRecHits4DLabel, segs);
|
1247 |
|
1248 |
// Get the 1D rechits from the event --------------
|
1249 |
Handle<DTRecHitCollection> dtRecHits;
|
1250 |
event.getByLabel(theRecHits1DLabel, dtRecHits);
|
1251 |
|
1252 |
// Get the RecTrack collection from the event
|
1253 |
Handle<reco::TrackCollection> staTracks;
|
1254 |
event.getByLabel(theSTAMuonLabel, staTracks);
|
1255 |
|
1256 |
ESHandle<MagneticField> theMGField;
|
1257 |
eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
|
1258 |
|
1259 |
ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
|
1260 |
eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
|
1261 |
|
1262 |
|
1263 |
reco::TrackCollection::const_iterator staTrack;
|
1264 |
|
1265 |
double recPt=0.;
|
1266 |
histo("hNSA")->Fill(staTracks->size());
|
1267 |
histo2d("hNSAVsNHits")->Fill(dtRecHits->size(),staTracks->size());
|
1268 |
histo2d("hNSAVsNSegs4D")->Fill(segs->size(),staTracks->size());
|
1269 |
|
1270 |
if (debug && staTracks->size() )
|
1271 |
cout << endl<<"Run/Event " << event.id().run() << ":" << event.id().event() <<
|
1272 |
" SA tracks " << staTracks->size() << endl;
|
1273 |
|
1274 |
// ********* loop on SA tracks ************************************************
|
1275 |
|
1276 |
for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
|
1277 |
reco::TransientTrack track(*staTrack,&*theMGField,theTrackingGeometry);
|
1278 |
|
1279 |
if (debug) {
|
1280 |
cout << muonDumper.dumpFTS(track.impactPointTSCP().theState());
|
1281 |
|
1282 |
recPt = track.impactPointTSCP().momentum().perp();
|
1283 |
cout<<" p: "<<track.impactPointTSCP().momentum().mag()<< " pT: "<<recPt<<endl;
|
1284 |
cout<<" normalized chi2: "<<track.normalizedChi2()<<endl;
|
1285 |
}
|
1286 |
|
1287 |
|
1288 |
if (debug) cout<<" Associated RecHits:"<<endl;
|
1289 |
|
1290 |
trackingRecHit_iterator rhbegin = staTrack->recHitsBegin();
|
1291 |
trackingRecHit_iterator rhend = staTrack->recHitsEnd();
|
1292 |
|
1293 |
// loop on associated rechits ----------------------------------------------------------
|
1294 |
int NHass = 0;
|
1295 |
int sect = 0;
|
1296 |
int iw=0;
|
1297 |
for(trackingRecHit_iterator recHit = rhbegin; recHit != rhend; ++recHit){
|
1298 |
const GeomDet* geomDet = theTrackingGeometry->idToDet((*recHit)->geographicalId());
|
1299 |
GlobalPoint gpos=geomDet->toGlobal((*recHit)->localPosition());
|
1300 |
|
1301 |
DetId theDetector=(*recHit)->geographicalId();
|
1302 |
if (theDetector.det() == 2 && theDetector.subdetId() == 1) // MUON && DT
|
1303 |
{
|
1304 |
NHass++;
|
1305 |
DTWireId wireId ;
|
1306 |
if ( const DTRecHit1D* dthit = dynamic_cast< const DTRecHit1D*> ((*recHit)->clone()) ) {
|
1307 |
wireId = dthit ->wireId();
|
1308 |
}
|
1309 |
if (NHass == 1 || sect==0) sect = wireId.sector(); // SomeTimes problems with hits, to recover if first is bad
|
1310 |
if (NHass == 1 || iw==-1) iw = 2+wireId.wheel(); // SomeTimes problems with hits, to recover if first is bad
|
1311 |
if (debug) cout<< wireId << " r: "<< gpos.perp() <<" x,y,z: "<< gpos.x() << " " << gpos.y() << " " << gpos.z() << " " << gpos.phi() << endl;
|
1312 |
histo2d("hHitsPosXYSA")->Fill(gpos.x(),gpos.y());
|
1313 |
histo2d("hHitsPosXYSA_1")->Fill(gpos.x(),gpos.y());
|
1314 |
histo2d("hHitsPosXYSA_2")->Fill(gpos.x(),gpos.y());
|
1315 |
histo2d("hHitsPosXYSA_3")->Fill(gpos.x(),gpos.y());
|
1316 |
histo2d("hHitsPosXYSA_4")->Fill(gpos.x(),gpos.y());
|
1317 |
histo2d("hHitsPosXZSA")->Fill(gpos.z(),gpos.x());
|
1318 |
histo2d("hHitsPosYZSA")->Fill(gpos.z(),gpos.y());
|
1319 |
if(doWheel[2+wireId.wheel()])
|
1320 |
{
|
1321 |
stringstream htit1, htit2, htit3, htit4, htit5, htit6, htit7;
|
1322 |
htit1 << "hHitsPosXYSA_" << Whname[iw] ; histo2d(htit1.str())->Fill(gpos.x(),gpos.y());
|
1323 |
htit2 << "hHitsPosXYSA_1_"<< Whname[iw] ; histo2d(htit2.str())->Fill(gpos.x(),gpos.y());
|
1324 |
htit3 << "hHitsPosXYSA_2_"<< Whname[iw] ; histo2d(htit3.str())->Fill(gpos.x(),gpos.y());
|
1325 |
htit4 << "hHitsPosXYSA_3_"<< Whname[iw] ; histo2d(htit4.str())->Fill(gpos.x(),gpos.y());
|
1326 |
htit5 << "hHitsPosXYSA_4_"<< Whname[iw] ; histo2d(htit5.str())->Fill(gpos.x(),gpos.y());
|
1327 |
htit6 << "hHitsPosXZSA_" << Whname[iw] ; histo2d(htit6.str())->Fill(gpos.z(),gpos.x());
|
1328 |
htit7 << "hHitsPosYZSA_" << Whname[iw] ; histo2d(htit7.str())->Fill(gpos.z(),gpos.y());
|
1329 |
}
|
1330 |
float radtodeg = 57.296 ;
|
1331 |
float phi = gpos.phi();
|
1332 |
stringstream hTitlePhihit;
|
1333 |
hTitlePhihit << "hPhiHit_" << Whname[iw] << "_MB" << wireId.station() ;
|
1334 |
if(doWheel[iw])if(wireId.superlayer() != 2) histo(hTitlePhihit.str())->Fill( radtodeg*phi); // hPhiHit_MB1, ....ecc
|
1335 |
}// if Rechit = MUON && DT
|
1336 |
} // next associated rechit --------------------------------
|
1337 |
|
1338 |
// ==== fill ass hit multiplicity histos per sector ===============
|
1339 |
if(NHass>0 && iw>-1) // Only Fill Tracks with DT Hits and containing hits with wire info
|
1340 |
{
|
1341 |
stringstream hTitle;
|
1342 |
hTitle << "hNhass_" << Whname[iw] << "_S" << sect ;
|
1343 |
if(doWheel[iw])histo(hTitle.str())->Fill( NHass); // hNhass_S1_MB1, ....ecc
|
1344 |
|
1345 |
double radius = 0;
|
1346 |
double posz = 0;
|
1347 |
if(track.impactPointTSCP().isValid())
|
1348 |
{
|
1349 |
double posx = track.impactPointTSCP().position().x();
|
1350 |
double posy = track.impactPointTSCP().position().y();
|
1351 |
posz = track.impactPointTSCP().position().z();
|
1352 |
radius = sqrt( posx*posx + posy*posy );
|
1353 |
}
|
1354 |
|
1355 |
// total hits in STA
|
1356 |
histo("hNhitsSA")->Fill(staTrack->recHitsSize());
|
1357 |
histo2d("hNHitsSAVsNHits")->Fill(dtRecHits->size(),staTrack->recHitsSize());
|
1358 |
histo2d("hNHitsSAVsNSegs4D")->Fill(segs->size(),staTrack->recHitsSize());
|
1359 |
|
1360 |
// chi2...
|
1361 |
histo("hChi2SA")->Fill(track.normalizedChi2());
|
1362 |
|
1363 |
// plots at Impact Point
|
1364 |
if(track.impactPointTSCP().isValid())
|
1365 |
{
|
1366 |
histo("hPIPSA")->Fill(track.impactPointTSCP().momentum().mag());
|
1367 |
histo("hPtIPSA")->Fill(recPt);
|
1368 |
histo("hPhiIPSA")->Fill(track.impactPointTSCP().momentum().phi());
|
1369 |
histo("hEtaIPSA")->Fill(track.impactPointTSCP().momentum().eta());
|
1370 |
histo("hrIPSA")->Fill(radius);
|
1371 |
histo("hzIPSA")->Fill(posz);
|
1372 |
histo2d("hrVszIPSA")->Fill(posz,radius);
|
1373 |
}
|
1374 |
//else
|
1375 |
// cout << "[DTOfflineAnalyzer]track.impactPointTSCP() not valid!!! Skiping the fill of histograms Ev:"
|
1376 |
// << event.id().event() << endl;
|
1377 |
|
1378 |
TrajectoryStateOnSurface innerTSOS = track.innermostMeasurementState();
|
1379 |
if (debug) {
|
1380 |
cout << "Inner TSOS:"<<endl;
|
1381 |
cout << muonDumper.dumpTSOS(innerTSOS);
|
1382 |
cout<<" p: "<<innerTSOS.globalMomentum().mag()<< " pT: "<<innerTSOS.globalMomentum().perp()<<endl;
|
1383 |
}
|
1384 |
|
1385 |
histo("hPInnerTSOSSA")->Fill(innerTSOS.globalMomentum().mag());
|
1386 |
histo("hPtInnerTSOSSA")->Fill(innerTSOS.globalMomentum().perp());
|
1387 |
histo("hPhiInnerTSOSSA")->Fill(innerTSOS.globalMomentum().phi());
|
1388 |
histo("hEtaInnerTSOSSA")->Fill(innerTSOS.globalMomentum().eta());
|
1389 |
|
1390 |
histo("hInnerRSA")->Fill(sqrt(staTrack->innerPosition().perp2()));
|
1391 |
histo("hOuterRSA")->Fill(sqrt(staTrack->outerPosition().perp2()));
|
1392 |
histo2d("hInnerOuterRSA")->Fill(sqrt(staTrack->innerPosition().perp2()),
|
1393 |
sqrt(staTrack->outerPosition().perp2()));
|
1394 |
|
1395 |
|
1396 |
// ---- start extrapolation analysis ------------------
|
1397 |
// try to extrapolate using thePropagator ------
|
1398 |
if (!thePropagator){
|
1399 |
ESHandle<Propagator> prop;
|
1400 |
eventSetup.get<TrackingComponentsRecord>().get(thePropagatorName, prop);
|
1401 |
thePropagator = prop->clone();
|
1402 |
thePropagator->setPropagationDirection(anyDirection);
|
1403 |
}
|
1404 |
|
1405 |
float radtodeg = 57.296 ;
|
1406 |
// Get a surface (here a cylinder of radius 1290mm) : ECAL
|
1407 |
float radiusECAL = 129.0; // radius in centimeter
|
1408 |
Cylinder::PositionType pos0;
|
1409 |
Cylinder::RotationType rot0;
|
1410 |
const Cylinder::CylinderPointer ecal = Cylinder::build(pos0, rot0,radiusECAL);
|
1411 |
TrajectoryStateOnSurface tsosAtEcal =
|
1412 |
thePropagator->propagate(*innerTSOS.freeState(), *ecal);
|
1413 |
if (tsosAtEcal.isValid()) {
|
1414 |
float phiEcal = -radtodeg*acos(tsosAtEcal.globalPosition().x()/tsosAtEcal.globalPosition().perp());
|
1415 |
float zEcal = tsosAtEcal.globalPosition().z();
|
1416 |
if (abs(zEcal) < 290. ) histo2d("hphivszECAL")->Fill(zEcal,phiEcal);
|
1417 |
}
|
1418 |
// else
|
1419 |
// cout << "Extrapolation to ECAL failed" << endl;
|
1420 |
|
1421 |
// Get a surface (here a cylinder of radius 1811 mm): HCAL
|
1422 |
float radiusHCAL = 181.1; // radius in centimeter
|
1423 |
const Cylinder::CylinderPointer hcal = Cylinder::build(pos0, rot0,radiusHCAL);
|
1424 |
TrajectoryStateOnSurface tsosAtHcal =
|
1425 |
thePropagator->propagate(*innerTSOS.freeState(), *hcal);
|
1426 |
if (tsosAtHcal.isValid()) {
|
1427 |
// cout << "extrap to HCAL : " << tsosAtHcal.globalPosition() << " r " <<
|
1428 |
// tsosAtHcal.globalPosition().perp() << endl;
|
1429 |
float phiHcal = -radtodeg*acos(tsosAtHcal.globalPosition().x()/tsosAtHcal.globalPosition().perp());
|
1430 |
float zHcal = tsosAtHcal.globalPosition().z();
|
1431 |
if (abs(zHcal) < 390. ) histo2d("hphivszHCAL")->Fill(zHcal,phiHcal);
|
1432 |
}
|
1433 |
// else
|
1434 |
// cout << "Extrapolation to HCAL failed" << endl;
|
1435 |
// --- end extraploation analysis -------------------------
|
1436 |
}
|
1437 |
else
|
1438 |
if (debug)cout << " [DTOfflineAnalyzer]: Track has not DT Triggers" << endl;
|
1439 |
|
1440 |
|
1441 |
} // next SA track ============================================
|
1442 |
|
1443 |
if (debug) cout<<"--- end event ------------------------------"<<endl;
|
1444 |
}
|
1445 |
|
1446 |
// ==========================================================================================================
|
1447 |
// trigger analysis
|
1448 |
void DTOfflineAnalyzer::analyzeTrigger(const Event & event,
|
1449 |
const EventSetup& eventSetup){
|
1450 |
// ==========================================================================================================
|
1451 |
char Whname[5][20]={"Wm2","Wm1","W0","W1","W2"};
|
1452 |
|
1453 |
if (debug) cout << " analyzeTrigger : ------------------------------------------" << endl;
|
1454 |
|
1455 |
|
1456 |
// Get the DT Geometry
|
1457 |
ESHandle<DTGeometry> dtGeom;
|
1458 |
eventSetup.get<MuonGeometryRecord>().get(dtGeom);
|
1459 |
// const std::vector<DTChamber*> & chs = dtGeom->chambers();
|
1460 |
|
1461 |
// get the DT local trigger collection =======================
|
1462 |
edm::Handle<DTLocalTriggerCollection> allLocalTriggers;
|
1463 |
event.getByLabel(theDTLocalTriggerLabel, allLocalTriggers);
|
1464 |
|
1465 |
bool hasTr[5][12][4];
|
1466 |
for (int iw=0;iw<5;iw++)
|
1467 |
for (int ise=0;ise<12;ise++)
|
1468 |
for(int ist=0;ist<4;ist++) hasTr[iw][ise][ist]=false;
|
1469 |
//bool SecthasTr[]={false,false,false,false,false,false,false,false,false,false,false,false};
|
1470 |
bool SecthasTr[5][12]={{false,false,false,false,false,false,false,false,false,false,false,false}
|
1471 |
,{false,false,false,false,false,false,false,false,false,false,false,false}
|
1472 |
,{false,false,false,false,false,false,false,false,false,false,false,false}
|
1473 |
,{false,false,false,false,false,false,false,false,false,false,false,false}
|
1474 |
,{false,false,false,false,false,false,false,false,false,false,false,false}};
|
1475 |
|
1476 |
int SCsect=0; int SCst=0;
|
1477 |
|
1478 |
|
1479 |
//int bx[5][4][5]; // Not being used and in 62X gives erors for being set but not used
|
1480 |
float bxbest[5][4][14];
|
1481 |
// float qual[]={-1,-1,-1,-1};
|
1482 |
int qual[5][4][14];
|
1483 |
for (int iw=0; iw<5; iw++) // Wheel -2 (0) to 2 (5)
|
1484 |
for (int sec=1; sec<15; ++sec) // section 1 to 14
|
1485 |
for (int ist=0; ist<4; ++ist) {
|
1486 |
qual[iw][ist][sec-1] = -1;
|
1487 |
bxbest[iw][ist][sec-1] = -1;
|
1488 |
}
|
1489 |
|
1490 |
|
1491 |
DTLocalTriggerCollection::DigiRangeIterator chambIt;
|
1492 |
|
1493 |
for (chambIt=allLocalTriggers->begin();chambIt!=allLocalTriggers->end();++chambIt){ // loop on chambers ------
|
1494 |
|
1495 |
const DTChamberId& id = (*chambIt).first;
|
1496 |
SCst=id.station();
|
1497 |
SCsect=id.sector();
|
1498 |
int iw=2+id.wheel();
|
1499 |
|
1500 |
if(doWheel[iw])
|
1501 |
{
|
1502 |
//bx[iw][SCst-1][0]=0; bx[iw][SCst-1][1]=0; // Not being used and in 62X gives erors for being set but not used
|
1503 |
|
1504 |
int countsec=-1;
|
1505 |
for (int ns=0; ns<12; ns++) {
|
1506 |
if (SCsect == sects[iw][ns] ) {
|
1507 |
countsec=ns;
|
1508 |
break;
|
1509 |
}
|
1510 |
else if (sects[iw][ns]==0) {
|
1511 |
sects[iw][ns]=SCsect;
|
1512 |
countsec=ns;
|
1513 |
break;
|
1514 |
}
|
1515 |
}
|
1516 |
|
1517 |
int ntrCh=0;
|
1518 |
|
1519 |
const DTLocalTriggerCollection::Range& range = (*chambIt).second;
|
1520 |
|
1521 |
|
1522 |
// Loop over triggers of this chamber -----------------------------------------------
|
1523 |
for (DTLocalTriggerCollection::const_iterator trigtrack = range.first;trigtrack!=range.second;++trigtrack){
|
1524 |
//if (trigtrack->quality()<7 && trigtrack->quality()>1) {
|
1525 |
if (trigtrack->quality()<7) {
|
1526 |
SecthasTr[iw][countsec]=true;
|
1527 |
hasTr[iw][SCsect-1][SCst-1]=true;
|
1528 |
}
|
1529 |
if (trigtrack->quality()<7) {
|
1530 |
//bx[iw][SCst-1][ntrCh]=trigtrack->bx(); // dice a che bx c'e' stato trigger // Not being used and in 62X gives erors for being set but not used
|
1531 |
float ibx=trigtrack->bx();
|
1532 |
ntrCh++;
|
1533 |
if (ntrCh>4) break;
|
1534 |
int iQual=trigtrack->quality();
|
1535 |
if (SCst==4) histo("TriggerQualityMB4")->Fill(iQual);
|
1536 |
else histo("TriggerQuality")->Fill(iQual);
|
1537 |
|
1538 |
|
1539 |
if( iQual > qual[iw][SCst-1][SCsect-1] ) {
|
1540 |
qual[iw][SCst-1][SCsect-1]= iQual; // store the quality for this station
|
1541 |
bxbest[iw][SCst-1][SCsect-1] = ibx;
|
1542 |
}
|
1543 |
} // endif quality <7
|
1544 |
} // end loop on triggers in this chamber --------------------------
|
1545 |
|
1546 |
// plot the highest quality phi-trigger
|
1547 |
stringstream hTitleTrigg;
|
1548 |
hTitleTrigg << "hTrigBits_" << Whname[iw] << "_S" << SCsect << "_MB" << SCst ;
|
1549 |
if(SCsect != 0) histo(hTitleTrigg.str())->Fill( qual[iw][SCst-1][SCsect-1] ); // *** histos: hTrigBits_S1_MB1, ecc... **********
|
1550 |
// plot the BXid of highest quality
|
1551 |
int iqual = qual[iw][SCst-1][SCsect-1];
|
1552 |
if(iqual < 4) iqual = 1; // flag for all uncorrelated phi trigger
|
1553 |
stringstream hTitleTriggBX;
|
1554 |
hTitleTriggBX << "hTrigBX_" << Whname[iw] << "_S" << SCsect << "_MB" << SCst << "_qual" << iqual;
|
1555 |
if(SCsect != 0) histo(hTitleTriggBX.str())->Fill( bxbest[iw][SCst-1][SCsect-1] ); // *** histos: hTrigBX_S1_MB1_qual1, ecc... **********
|
1556 |
|
1557 |
}// end doWheel
|
1558 |
} // end loop on chambers ----------------------------------------------
|
1559 |
|
1560 |
// Now let's Fill summary plots !
|
1561 |
|
1562 |
for(int iw=0;iw<5;iw++)
|
1563 |
{
|
1564 |
if(doWheel[iw])
|
1565 |
{
|
1566 |
int SectrigMFill=0;
|
1567 |
if (sects[iw][4]) SectrigMFill=1;
|
1568 |
|
1569 |
if (SecthasTr[iw][0] && !SecthasTr[iw][1] && !SecthasTr[iw][2] && !SecthasTr[iw][3] ) SectrigMFill = 3;
|
1570 |
if (!SecthasTr[iw][0] && SecthasTr[iw][1] && !SecthasTr[iw][2] && !SecthasTr[iw][3] ) SectrigMFill = 4;
|
1571 |
if (!SecthasTr[iw][0] && !SecthasTr[iw][1] && SecthasTr[iw][2] && !SecthasTr[iw][3] ) SectrigMFill = 5;
|
1572 |
if (!SecthasTr[iw][0] && !SecthasTr[iw][1] && !SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 6;
|
1573 |
|
1574 |
|
1575 |
if (SecthasTr[iw][0] && SecthasTr[iw][1] && !SecthasTr[iw][2] && !SecthasTr[iw][3] ) SectrigMFill = 8;
|
1576 |
if (SecthasTr[iw][0] && !SecthasTr[iw][1] && SecthasTr[iw][2] && !SecthasTr[iw][3] ) SectrigMFill = 9;
|
1577 |
if (SecthasTr[iw][0] && !SecthasTr[iw][1] && !SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 10;
|
1578 |
if (!SecthasTr[iw][0] && SecthasTr[iw][1] && SecthasTr[iw][2] && !SecthasTr[iw][3] ) SectrigMFill = 11;
|
1579 |
if (!SecthasTr[iw][0] && SecthasTr[iw][1] && !SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 12;
|
1580 |
if (!SecthasTr[iw][0] && !SecthasTr[iw][1] && SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 13;
|
1581 |
|
1582 |
if (SecthasTr[iw][0] && SecthasTr[iw][1] && SecthasTr[iw][2] && !SecthasTr[iw][3] ) SectrigMFill = 15;
|
1583 |
if (SecthasTr[iw][0] && SecthasTr[iw][1] && !SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 16;
|
1584 |
if (SecthasTr[iw][0] && !SecthasTr[iw][1] && SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 17;
|
1585 |
if (!SecthasTr[iw][0] && SecthasTr[iw][1] && SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 18;
|
1586 |
|
1587 |
if (SecthasTr[iw][0] && SecthasTr[iw][1] && SecthasTr[iw][2] && SecthasTr[iw][3] ) SectrigMFill = 20;
|
1588 |
|
1589 |
stringstream hname;
|
1590 |
hname << "SectorTriggerMatrix" << Whname[iw] ;
|
1591 |
histo(hname.str())->Fill(SectrigMFill);
|
1592 |
|
1593 |
for (int ns=0; ns<12; ns++) {
|
1594 |
|
1595 |
int sector=sects[iw][ns];
|
1596 |
|
1597 |
if (!sector) continue;
|
1598 |
|
1599 |
if (SecthasTr[iw][ns]){
|
1600 |
|
1601 |
|
1602 |
for (int ist=0; ist<4; ist++){
|
1603 |
stringstream hname2;
|
1604 |
hname2 << "TriggerInclusive" << Whname[iw] ;
|
1605 |
if (hasTr[iw][sector-1][ist]) histo(hname2.str())->Fill((sector-1)*5+ist+1);
|
1606 |
}
|
1607 |
|
1608 |
|
1609 |
int trigMFill=0;
|
1610 |
|
1611 |
if (hasTr[iw][sector-1][0] && !hasTr[iw][sector-1][1] && !hasTr[iw][sector-1][2] && !hasTr[iw][sector-1][3]) trigMFill = 2;
|
1612 |
if (!hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && !hasTr[iw][sector-1][2] && !hasTr[iw][sector-1][3]) trigMFill = 3;
|
1613 |
if (!hasTr[iw][sector-1][0] && !hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && !hasTr[iw][sector-1][3]) trigMFill = 4;
|
1614 |
if (!hasTr[iw][sector-1][0] && !hasTr[iw][sector-1][1] && !hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 5;
|
1615 |
if (hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && !hasTr[iw][sector-1][2] && !hasTr[iw][sector-1][3]) trigMFill = 7;
|
1616 |
if (hasTr[iw][sector-1][0] && !hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && !hasTr[iw][sector-1][3]) trigMFill = 8;
|
1617 |
if (hasTr[iw][sector-1][0] && !hasTr[iw][sector-1][1] && !hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 9;
|
1618 |
if (!hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && !hasTr[iw][sector-1][3]) trigMFill = 10;
|
1619 |
if (!hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && !hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 11;
|
1620 |
if (!hasTr[iw][sector-1][0] && !hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 12;
|
1621 |
if (hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && !hasTr[iw][sector-1][3]) trigMFill = 14;
|
1622 |
if (hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && !hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 15;
|
1623 |
if (hasTr[iw][sector-1][0] && !hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 16;
|
1624 |
if (!hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 17;
|
1625 |
if (hasTr[iw][sector-1][0] && hasTr[iw][sector-1][1] && hasTr[iw][sector-1][2] && hasTr[iw][sector-1][3]) trigMFill = 19;
|
1626 |
|
1627 |
stringstream hNameTrigMat;
|
1628 |
hNameTrigMat << "TriggerMatrix" << Whname[iw] << "_S" << sector ;
|
1629 |
histo(hNameTrigMat.str())->Fill(trigMFill);
|
1630 |
|
1631 |
} // if the sector has trigger
|
1632 |
} // loop on sectors
|
1633 |
} // If doWheel
|
1634 |
} // loop on wheels
|
1635 |
|
1636 |
|
1637 |
}
|
1638 |
|
1639 |
|
1640 |
|
1641 |
// utilities ###########################################
|
1642 |
|
1643 |
TH1F* DTOfflineAnalyzer::histo(const string& name) const{
|
1644 |
MonitorElement* me = theDQMStore->get(("DT/DTOfflineAnalyzer/"+name).c_str());
|
1645 |
if (!me) throw cms::Exception("DTOfflineAnalyzer") << " ME not existing " << name;
|
1646 |
TH1F* histo = me->getTH1F();
|
1647 |
if (!histo)cms::Exception("DTOfflineAnalyzer") << " Not a TH1F " << name;
|
1648 |
return histo;
|
1649 |
}
|
1650 |
|
1651 |
TH2F* DTOfflineAnalyzer::histo2d(const string& name) const{
|
1652 |
MonitorElement* me = theDQMStore->get(("DT/DTOfflineAnalyzer/"+name).c_str());
|
1653 |
if (!me) throw cms::Exception("DTOfflineAnalyzer") << " ME not existing " << name;
|
1654 |
TH2F* histo = me->getTH2F();
|
1655 |
if (!histo)cms::Exception("DTOfflineAnalyzer") << " Not a TH2F " << name;
|
1656 |
return histo;
|
1657 |
}
|
1658 |
|
1659 |
bool DTOfflineAnalyzer::getLCT(LCTType t) const {
|
1660 |
return LCT.test(t);
|
1661 |
}
|
1662 |
|
1663 |
string DTOfflineAnalyzer::toString(const DTLayerId& id) const {
|
1664 |
stringstream result;
|
1665 |
result << "_Wh" << id.wheel()
|
1666 |
<< "_Sec" << id.sector()
|
1667 |
<< "_St" << id.station()
|
1668 |
<< "_Sl" << id.superLayer()
|
1669 |
<< "_Lay" << id.layer();
|
1670 |
return result.str();
|
1671 |
}
|
1672 |
|
1673 |
string DTOfflineAnalyzer::toString(const DTSuperLayerId& id) const {
|
1674 |
stringstream result;
|
1675 |
result << "_Wh" << id.wheel()
|
1676 |
<< "_Sec" << id.sector()
|
1677 |
<< "_St" << id.station()
|
1678 |
<< "_Sl" << id.superLayer();
|
1679 |
return result.str();
|
1680 |
}
|
1681 |
|
1682 |
string DTOfflineAnalyzer::toString(const DTChamberId& id) const {
|
1683 |
stringstream result;
|
1684 |
result << "_Wh" << id.wheel()
|
1685 |
<< "_Sec" << id.sector()
|
1686 |
<< "_St" << id.station();
|
1687 |
return result.str();
|
1688 |
}
|
1689 |
|
1690 |
template<class T> string DTOfflineAnalyzer::hName(const string& s, const T& id) const {
|
1691 |
string name(toString(id));
|
1692 |
stringstream hName;
|
1693 |
hName << s << name;
|
1694 |
return hName.str();
|
1695 |
}
|
1696 |
|
1697 |
void DTOfflineAnalyzer::createTH1F(const std::string& name,
|
1698 |
const std::string& title,
|
1699 |
const std::string& suffix,
|
1700 |
int nbin,
|
1701 |
const double& binMin,
|
1702 |
const double& binMax) const {
|
1703 |
stringstream hName;
|
1704 |
stringstream hTitle;
|
1705 |
hName << name << suffix;
|
1706 |
hTitle << title << suffix;
|
1707 |
theDQMStore->setCurrentFolder("DT/DTOfflineAnalyzer");
|
1708 |
theDQMStore->book1D(hName.str().c_str(), hTitle.str().c_str(), nbin,binMin,binMax);
|
1709 |
//cout << "pasa ....." << endl;
|
1710 |
//TH1F * _h=new TH1F(hName.str().c_str(), hTitle.str().c_str(), nbin,binMin,binMax);
|
1711 |
//_h->SetDirectory(theFile); // Needed when the input is a root file
|
1712 |
}
|
1713 |
|
1714 |
void DTOfflineAnalyzer::createTH2F(const std::string& name,
|
1715 |
const std::string& title,
|
1716 |
const std::string& suffix,
|
1717 |
int nBinX,
|
1718 |
const double& binXMin,
|
1719 |
const double& binXMax,
|
1720 |
int nBinY,
|
1721 |
const double& binYMin,
|
1722 |
const double& binYMax) const {
|
1723 |
stringstream hName;
|
1724 |
stringstream hTitle;
|
1725 |
hName << name << suffix;
|
1726 |
hTitle << title << suffix;
|
1727 |
theDQMStore->setCurrentFolder("DT/DTOfflineAnalyzer");
|
1728 |
theDQMStore->book2D(hName.str().c_str(), hTitle.str().c_str(), nBinX,binXMin,binXMax, nBinY,binYMin,binYMax);
|
1729 |
//TH2F * _h=new TH2F(hName.str().c_str(), hTitle.str().c_str(), nBinX,binXMin,binXMax, nBinY,binYMin,binYMax);
|
1730 |
//_h->SetDirectory(theFile); // Needed when the input is a root file
|
1731 |
}
|
1732 |
|
1733 |
|
1734 |
// end utilities ...#######################################################
|