CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTRecHitQuality.cc
Go to the documentation of this file.
1 
2 /*
3  * See header file for a description of this class.
4  *
5  * \author G. Cerminara - INFN Torino
6  */
7 
8 #include "DTRecHitQuality.h"
10 
14 
20 
25 
26 
27 #include <iostream>
28 #include <map>
29 
30 using namespace std;
31 using namespace edm;
32 
33 // In phi SLs, The dependency on X and angle is specular in positive
34 // and negative wheels. Since positive and negative wheels are filled
35 // together into the same plots, it is useful to mirror negative wheels
36 // so that the actual dependency can be observerd instead of an artificially
37 // simmetrized one.
38 // Set mirrorMinusWheels to avoid this.
39 namespace {
40  bool mirrorMinusWheels = true;
41 }
42 
43 // Constructor
45  // Get the debug parameter for verbose output
46  debug = pset.getUntrackedParameter<bool>("debug");
47  // the name of the simhit collection
48  simHitLabel = pset.getUntrackedParameter<InputTag>("simHitLabel");
49  simHitToken_ = consumes<PSimHitContainer>(pset.getUntrackedParameter<InputTag>("simHitLabel"));
50  // the name of the 1D rec hit collection
51  recHitLabel = pset.getUntrackedParameter<InputTag>("recHitLabel");
52  recHitToken_ = consumes<DTRecHitCollection>(pset.getUntrackedParameter<InputTag>("recHitLabel"));
53  // the name of the 2D rec hit collection
54  segment2DLabel = pset.getUntrackedParameter<InputTag>("segment2DLabel");
55  segment2DToken_ = consumes<DTRecSegment2DCollection>(pset.getUntrackedParameter<InputTag>("segment2DLabel"));
56  // the name of the 4D rec hit collection
57  segment4DLabel = pset.getUntrackedParameter<InputTag>("segment4DLabel");
58  segment4DToken_ = consumes<DTRecSegment4DCollection>(pset.getUntrackedParameter<InputTag>("segment4DLabel"));
59  // Switches for analysis at various steps
60  doStep1 = pset.getUntrackedParameter<bool>("doStep1", false);
61  doStep2 = pset.getUntrackedParameter<bool>("doStep2", false);
62  doStep3 = pset.getUntrackedParameter<bool>("doStep3", false);
63  doall = pset.getUntrackedParameter<bool>("doall", false);
64  local = pset.getUntrackedParameter<bool>("local", true);
65 }
66 
68 
69  // ----------------------
70  // get hold of back-end interface
71  dbe_ = 0;
73  /*if ( dbe_ ) {
74  if (debug) {
75  dbe_->setVerbose(1);
76  } else {
77  dbe_->setVerbose(0);
78  }
79  }*/
80  dbe_->setVerbose(0);
81  /*if ( dbe_ ) {
82  if ( debug ) dbe_->showDirStructure();
83  }*/
84  if(doall && doStep1){
85  hRes_S1RPhi= new HRes1DHit("S1RPhi",dbe_,true,local); // RecHits, 1. step, RPhi
86  hRes_S1RPhi_W0= new HRes1DHit("S1RPhi_W0",dbe_,true,local); // RecHits, 1. step, RZ, wheel 0
87  hRes_S1RPhi_W1= new HRes1DHit("S1RPhi_W1",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-1
88  hRes_S1RPhi_W2= new HRes1DHit("S1RPhi_W2",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-2
89  hRes_S1RZ= new HRes1DHit("S1RZ",dbe_,true,local); // RecHits, 1. step, RZ
90  hRes_S1RZ_W0= new HRes1DHit("S1RZ_W0",dbe_,true,local); // RecHits, 1. step, RZ, wheel 0
91  hRes_S1RZ_W1= new HRes1DHit("S1RZ_W1",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-1
92  hRes_S1RZ_W2= new HRes1DHit("S1RZ_W2",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-2
93  hEff_S1RPhi= new HEff1DHit("S1RPhi",dbe_); // RecHits, 1. step, RPhi
94  hEff_S1RZ= new HEff1DHit("S1RZ",dbe_); // RecHits, 1. step, RZ
95  hEff_S1RZ_W0= new HEff1DHit("S1RZ_W0",dbe_); // RecHits, 1. step, RZ, wheel 0
96  hEff_S1RZ_W1= new HEff1DHit("S1RZ_W1",dbe_); // RecHits, 1. step, RZ, wheel +-1
97  hEff_S1RZ_W2= new HEff1DHit("S1RZ_W2",dbe_); // RecHits, 1. step, RZ, wheel +-2
98  }
99  if(doall && doStep2){
100  hRes_S2RPhi= new HRes1DHit("S2RPhi",dbe_,true,local); // RecHits, 2. step, RPhi
101  hRes_S2RPhi_W0= new HRes1DHit("S2RPhi_W0",dbe_,true,local); // RecHits, 2. step, RPhi, wheel 0
102  hRes_S2RPhi_W1= new HRes1DHit("S2RPhi_W1",dbe_,true,local); // RecHits, 2. step, RPhi, wheel +-1
103  hRes_S2RPhi_W2= new HRes1DHit("S2RPhi_W2",dbe_,true,local); // RecHits, 2. step, RPhi, wheel +-2
104  hRes_S2RZ= new HRes1DHit("S2RZ",dbe_,true,local); // RecHits, 2. step, RZ
105  hRes_S2RZ_W0= new HRes1DHit("S2RZ_W0",dbe_,true,local); // RecHits, 2. step, RZ, wheel 0
106  hRes_S2RZ_W1= new HRes1DHit("S2RZ_W1",dbe_,true,local); // RecHits, 2. step, RZ, wheel +-1
107  hRes_S2RZ_W2= new HRes1DHit("S2RZ_W2",dbe_,true,local); // RecHits, 2. step, RZ, wheel +-2
108  hEff_S2RPhi= new HEff1DHit("S2RPhi",dbe_); // RecHits, 2. step, RPhi
109  hEff_S2RZ_W0= new HEff1DHit("S2RZ_W0",dbe_); // RecHits, 2. step, RZ, wheel 0
110  hEff_S2RZ_W1= new HEff1DHit("S2RZ_W1",dbe_); // RecHits, 2. step, RZ, wheel +-1
111  hEff_S2RZ_W2= new HEff1DHit("S2RZ_W2",dbe_); // RecHits, 2. step, RZ, wheel +-2
112  hEff_S2RZ= new HEff1DHit("S2RZ",dbe_); // RecHits, 2. step, RZ
113  }
114  if(doStep3){
115  hRes_S3RPhi= new HRes1DHit("S3RPhi",dbe_,doall,local); // RecHits, 3. step, RPhi
116  hRes_S3RPhi_W0= new HRes1DHit("S3RPhi_W0",dbe_,doall,local); // RecHits, 3. step, RPhi, wheel 0
117  hRes_S3RPhi_W1= new HRes1DHit("S3RPhi_W1",dbe_,doall,local); // RecHits, 3. step, RPhi, wheel +-1
118  hRes_S3RPhi_W2= new HRes1DHit("S3RPhi_W2",dbe_,doall,local); // RecHits, 3. step, RPhi, wheel +-2
119  hRes_S3RZ= new HRes1DHit("S3RZ",dbe_,doall,local); // RecHits, 3. step, RZ
120  hRes_S3RZ_W0= new HRes1DHit("S3RZ_W0",dbe_,doall,local); // RecHits, 3. step, RZ, wheel 0
121  hRes_S3RZ_W1= new HRes1DHit("S3RZ_W1",dbe_,doall,local); // RecHits, 3. step, RZ, wheel +-1
122  hRes_S3RZ_W2= new HRes1DHit("S3RZ_W2",dbe_,doall,local); // RecHits, 3. step, RZ, wheel +-2
123 
124  if (local) {
125  // Plots with finer granularity, not to be included in DQM
126  TString name1="RPhi_W";
127  TString name2="RZ_W";
128  for (long w=0;w<=2;++w) {
129  for (long s=1;s<=4;++s){
130  hRes_S3RPhiWS[w][s-1] = new HRes1DHit(("S3"+name1+w+"_St"+s).Data(),dbe_,doall,local);
131  hEff_S1RPhiWS[w][s-1] = new HEff1DHit(("S1"+name1+w+"_St"+s).Data(),dbe_);
132  hEff_S3RPhiWS[w][s-1] = new HEff1DHit(("S3"+name1+w+"_St"+s).Data(),dbe_);
133  if (s!=4) {
134  hRes_S3RZWS[w][s-1] = new HRes1DHit(("S3"+name2+w+"_St"+s).Data(),dbe_,doall,local);
135  hEff_S1RZWS[w][s-1] = new HEff1DHit(("S1"+name2+w+"_St"+s).Data(),dbe_);
136  hEff_S3RZWS[w][s-1] = new HEff1DHit(("S3"+name2+w+"_St"+s).Data(),dbe_);
137  }
138  }
139  }
140  }
141 
142 
143  if(doall){
144  hEff_S3RPhi= new HEff1DHit("S3RPhi",dbe_); // RecHits, 3. step, RPhi
145  hEff_S3RZ= new HEff1DHit("S3RZ",dbe_); // RecHits, 3. step, RZ
146  hEff_S3RZ_W0= new HEff1DHit("S3RZ_W0",dbe_); // RecHits, 3. step, RZ, wheel 0
147  hEff_S3RZ_W1= new HEff1DHit("S3RZ_W1",dbe_); // RecHits, 3. step, RZ, wheel +-1
148  hEff_S3RZ_W2= new HEff1DHit("S3RZ_W2",dbe_); // RecHits, 3. step, RZ, wheel +-2
149  }
150  }
151 }
152 
153 
154 // Destructor
156 }
157 
158 
160  edm::EventSetup const& c){
161 
162 }
163 
165  // Write the histos to file
166  if(doall){
167  if(doStep1){
168  hEff_S1RPhi->ComputeEfficiency();
169  hEff_S1RZ->ComputeEfficiency();
170  hEff_S1RZ_W0->ComputeEfficiency();
171  hEff_S1RZ_W1->ComputeEfficiency();
172  hEff_S1RZ_W2->ComputeEfficiency();
173  }
174  if(doStep2){
175  hEff_S2RPhi->ComputeEfficiency();
176  hEff_S2RZ->ComputeEfficiency();
177  hEff_S2RZ_W0->ComputeEfficiency();
178  hEff_S2RZ_W1->ComputeEfficiency();
179  hEff_S2RZ_W2->ComputeEfficiency();
180  }
181  if(doStep3){
182  hEff_S3RPhi->ComputeEfficiency();
183  hEff_S3RZ->ComputeEfficiency();
184  hEff_S3RZ_W0->ComputeEfficiency();
185  hEff_S3RZ_W1->ComputeEfficiency();
186  hEff_S3RZ_W2->ComputeEfficiency();
187  }
188  }
189 }
190 
191 // The real analysis
192  void DTRecHitQuality::analyze(const Event & event, const EventSetup& eventSetup){
193  if(debug)
194  cout << "--- [DTRecHitQuality] Analysing Event: #Run: " << event.id().run()
195  << " #Event: " << event.id().event() << endl;
196  //theFile->cd();
197  // Get the DT Geometry
198  ESHandle<DTGeometry> dtGeom;
199  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
200 
201  // Get the SimHit collection from the event
203  event.getByToken(simHitToken_, simHits);
204 
205  // Map simhits per wire
206  map<DTWireId, PSimHitContainer > simHitsPerWire =
208 
209 
210 
211  //=======================================================================================
212  // RecHit analysis at Step 1
213  if(doStep1 && doall) {
214  if(debug)
215  cout << " -- DTRecHit S1: begin analysis:" << endl;
216  // Get the rechit collection from the event
217  Handle<DTRecHitCollection> dtRecHits;
218  event.getByToken(recHitToken_, dtRecHits);
219 
220  if(!dtRecHits.isValid()) {
221  if(debug) cout << "[DTRecHitQuality]**Warning: no 1DRechits with label: " << recHitLabel << " in this event, skipping!" << endl;
222  return;
223  }
224 
225  // Map rechits per wire
226  map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire =
227  map1DRecHitsPerWire(dtRecHits.product());
228 
229  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
230  }
231 
232 
233  //=======================================================================================
234  // RecHit analysis at Step 2
235  if(doStep2 && doall) {
236  if(debug)
237  cout << " -- DTRecHit S2: begin analysis:" << endl;
238 
239  // Get the 2D rechits from the event
241  event.getByToken(segment2DToken_, segment2Ds);
242 
243  if(!segment2Ds.isValid()) {
244  if(debug) cout << "[DTRecHitQuality]**Warning: no 2DSegments with label: " << segment2DLabel
245  << " in this event, skipping!" << endl;
246 
247  }
248  else{
249  // Map rechits per wire
250  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
251  map1DRecHitsPerWire(segment2Ds.product());
252 
253  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 2);
254  }
255  }
256 
257  //=======================================================================================
258  // RecHit analysis at Step 3
259  if(doStep3) {
260  if(debug)
261  cout << " -- DTRecHit S3: begin analysis:" << endl;
262 
263  // Get the 4D rechits from the event
265  event.getByToken(segment4DToken_, segment4Ds);
266 
267  if(!segment4Ds.isValid()) {
268  if(debug) cout << "[DTRecHitQuality]**Warning: no 4D Segments with label: " << segment4DLabel
269  << " in this event, skipping!" << endl;
270  return;
271  }
272 
273  // Map rechits per wire
274  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
275  map1DRecHitsPerWire(segment4Ds.product());
276 
277  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 3);
278  }
279 
280  }
281 
282 
283 
284 // Return a map between DTRecHit1DPair and wireId
285 map<DTWireId, vector<DTRecHit1DPair> >
287  map<DTWireId, vector<DTRecHit1DPair> > ret;
288 
289  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
290  rechit != dt1DRecHitPairs->end(); rechit++) {
291  ret[(*rechit).wireId()].push_back(*rechit);
292  }
293 
294  return ret;
295 }
296 
297 
298 // Return a map between DTRecHit1D at S2 and wireId
299 map<DTWireId, vector<DTRecHit1D> >
301  map<DTWireId, vector<DTRecHit1D> > ret;
302 
303  // Loop over all 2D segments
304  for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
305  segment != segment2Ds->end();
306  segment++) {
307  vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
308  // Loop over all component 1D hits
309  for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
310  hit != component1DHits.end();
311  hit++) {
312  ret[(*hit).wireId()].push_back(*hit);
313  }
314  }
315  return ret;
316 }
317 
318 
319 
320 // Return a map between DTRecHit1D at S3 and wireId
321 map<DTWireId, std::vector<DTRecHit1D> >
323  map<DTWireId, vector<DTRecHit1D> > ret;
324  // Loop over all 4D segments
325  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
326  segment != segment4Ds->end();
327  segment++) {
328  // Get component 2D segments
329  vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
330  // Loop over 2D segments:
331  for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
332  segment2D != segment2Ds.end();
333  segment2D++) {
334  // Get 1D component rechits
335  vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
336  // Loop over them
337  for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
338  hit != hits.end(); hit++) {
339  const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
340  ret[hit1D->wireId()].push_back(*hit1D);
341  }
342  }
343  }
344 
345  return ret;
346 }
347 
348 // Compute SimHit distance from wire (cm)
350  DTWireId wireId,
351  const PSimHit& hit) {
352  float xwire = layer->specificTopology().wirePosition(wireId.wire());
353  LocalPoint entryP = hit.entryPoint();
354  LocalPoint exitP = hit.exitPoint();
355  float xEntry = entryP.x()-xwire;
356  float xExit = exitP.x()-xwire;
357 
358  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));//FIXME: check...
359 }
360 
361 // Compute SimHit impact angle (in direction perp to wire), in the SL RF
363  DTWireId wireId,
364  const PSimHit& hit) {
365  LocalPoint entryP = hit.entryPoint();
366  LocalPoint exitP = hit.exitPoint();
367  float theta=(exitP.x()-entryP.x())/(exitP.z()-entryP.z());
368  return atan(theta);
369 }
370 
371 // Compute SimHit distance from FrontEnd
373  DTWireId wireId,
374  const PSimHit& hit) {
375  LocalPoint entryP = hit.entryPoint();
376  LocalPoint exitP = hit.exitPoint();
377  float wireLenght=layer->specificTopology().cellLenght();
378  // FIXME: should take only wireLenght/2.;
379  // moreover, pos+cellLenght/2. is shorter than the distance from FE.
380  // In fact it would make more sense to make plots vs y.
381  return (entryP.y()+exitP.y())/2.+wireLenght;
382 }
383 
384 
385 // Find the RecHit closest to the muon SimHit
386 template <typename type>
387 const type*
389  DTWireId wireId,
390  const vector<type>& recHits,
391  const float simHitDist) {
392  float res = 99999;
393  const type* theBestRecHit = 0;
394  // Loop over RecHits within the cell
395  for(typename vector<type>::const_iterator recHit = recHits.begin();
396  recHit != recHits.end();
397  recHit++) {
398  float distTmp = recHitDistFromWire(*recHit, layer);
399  if(fabs(distTmp-simHitDist) < res) {
400  res = fabs(distTmp-simHitDist);
401  theBestRecHit = &(*recHit);
402  }
403  } // End of loop over RecHits within the cell
404 
405  return theBestRecHit;
406 }
407 
408 
409 // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
410 float
412  // Compute the rechit distance from wire
413  return fabs(hitPair.localPosition(DTEnums::Left).x() -
414  hitPair.localPosition(DTEnums::Right).x())/2.;
415 }
416 
417 
418 
419 // Compute the distance from wire (cm) of a hits in a DTRecHit1D
420 float
422  return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
423 }
424 
425 
426 template <typename type>
428  const std::map<DTWireId, std::vector<PSimHit> >& simHitsPerWire,
429  const std::map<DTWireId, std::vector<type> >& recHitsPerWire,
430  int step) {
431  // Loop over cells with a muon SimHit
432  for(map<DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
433  wireAndSHits != simHitsPerWire.end();
434  wireAndSHits++) {
435  DTWireId wireId = (*wireAndSHits).first;
436  int wheel = wireId.wheel();
437  int sl = wireId.superLayer();
438 
439  vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
440 
441  // Get the layer
442  const DTLayer* layer = dtGeom->layer(wireId);
443 
444  // Look for a mu hit in the cell
445  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
446  if (muSimHit==0) {
447  if (debug)
448  cout << " No mu SimHit in channel: " << wireId << ", skipping! " << endl;
449  continue; // Skip this cell
450  }
451 
452  // Find the distance of the simhit from the wire
453  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
454  // Skip simhits out of the cell
455  if(simHitWireDist>2.1) {
456  if(debug)
457  cout << " [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
458  continue; // Skip this cell
459  }
460  GlobalPoint simHitGlobalPos = layer->toGlobal(muSimHit->localPosition());
461 
462  // find SH impact angle
463  float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
464 
465  // find SH distance from FE
466  float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
467 
468  bool recHitReconstructed = false;
469 
470  // Look for RecHits in the same cell
471  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
472  // No RecHit found in this cell
473  if(debug)
474  cout << " No RecHit found at Step: " << step << " in cell: " << wireId << endl;
475  } else {
476  recHitReconstructed = true;
477  // vector<type> recHits = (*wireAndRecHits).second;
478  vector<type> recHits = recHitsPerWire.at(wireId);
479  if(debug)
480  cout << " " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId << endl;
481 
482  // Find the best RecHit
483  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
484 
485 
486  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
487  if(debug)
488  cout << " SimHit distance from wire: " << simHitWireDist << endl
489  << " SimHit distance from FE: " << simHitFEDist << endl
490  << " SimHit angle in layer RF: " << simHitTheta << endl
491  << " RecHit distance from wire: " << recHitWireDist << endl;
492  float recHitErr = recHitPositionError(*theBestRecHit);
493  HRes1DHit *hRes = 0;
494  HRes1DHit *hResTot = 0;
495 
496  // Mirror angle in phi so that + and - wheels can be plotted together
497  if (mirrorMinusWheels && wheel<0 && sl!=2){
498  simHitTheta *= -1.;
499  // Note: local X, if used, would have to be mirrored as well
500  }
501 
502  // Fill residuals and pulls
503  // Select the histo to be filled
504  if(step == 1) {
505  // Step 1
506  if(sl != 2) {
507  hResTot = hRes_S1RPhi;
508  if(wheel == 0)
509  hRes = hRes_S1RPhi_W0;
510  if(abs(wheel) == 1)
511  hRes = hRes_S1RPhi_W1;
512  if(abs(wheel) == 2)
513  hRes = hRes_S1RPhi_W2;
514  } else {
515  hResTot = hRes_S1RZ;
516  if(wheel == 0)
517  hRes = hRes_S1RZ_W0;
518  if(abs(wheel) == 1)
519  hRes = hRes_S1RZ_W1;
520  if(abs(wheel) == 2)
521  hRes = hRes_S1RZ_W2;
522  }
523 
524  } else if(step == 2) {
525  // Step 2
526  if(sl != 2) {
527  hRes = hRes_S2RPhi;
528  if(wheel == 0)
529  hRes = hRes_S2RPhi_W0;
530  if(abs(wheel) == 1)
531  hRes = hRes_S2RPhi_W1;
532  if(abs(wheel) == 2)
533  hRes = hRes_S2RPhi_W2;
534  } else {
535  hResTot = hRes_S2RZ;
536  if(wheel == 0)
537  hRes = hRes_S2RZ_W0;
538  if(abs(wheel) == 1)
539  hRes = hRes_S2RZ_W1;
540  if(abs(wheel) == 2)
541  hRes = hRes_S2RZ_W2;
542  }
543 
544  } else if(step == 3) {
545  // Step 3
546  if(sl != 2) {
547  hResTot = hRes_S3RPhi;
548  if(wheel == 0)
549  hRes = hRes_S3RPhi_W0;
550  if(abs(wheel) == 1)
551  hRes = hRes_S3RPhi_W1;
552  if(abs(wheel) == 2)
553  hRes = hRes_S3RPhi_W2;
554  if (local) hRes_S3RPhiWS[abs(wheel)][wireId.station()-1]->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),simHitGlobalPos.phi(),recHitErr,wireId.station());
555 
556  } else {
557  hResTot = hRes_S3RZ;
558  if(wheel == 0)
559  hRes = hRes_S3RZ_W0;
560  if(abs(wheel) == 1)
561  hRes = hRes_S3RZ_W1;
562  if(abs(wheel) == 2)
563  hRes = hRes_S3RZ_W2;
564 
565  if (local) hRes_S3RZWS[abs(wheel)][wireId.station()-1]->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),simHitGlobalPos.phi(),recHitErr,wireId.station());
566  }
567  }
568  // Fill
569  hRes->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
570  simHitGlobalPos.phi(),recHitErr,wireId.station());
571  if(hResTot != 0)
572  hResTot->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
573  simHitGlobalPos.phi(),recHitErr,wireId.station());
574  }
575 
576  // Fill Efficiencies
577  if(doall){
578  HEff1DHit *hEff = 0;
579  HEff1DHit *hEffTot = 0;
580  if(step == 1) {
581  // Step 1
582  if(sl != 2) {
583  hEff = hEff_S1RPhi;
584  if (local) hEff_S1RPhiWS[abs(wheel)][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
585  } else {
586  hEffTot = hEff_S1RZ;
587  if(wheel == 0)
588  hEff = hEff_S1RZ_W0;
589  if(abs(wheel) == 1)
590  hEff = hEff_S1RZ_W1;
591  if(abs(wheel) == 2)
592  hEff = hEff_S1RZ_W2;
593  if (local) hEff_S1RZWS[abs(wheel)][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
594  }
595 
596  } else if(step == 2) {
597  // Step 2
598  if(sl != 2) {
599  hEff = hEff_S2RPhi;
600  } else {
601  hEffTot = hEff_S2RZ;
602  if(wheel == 0)
603  hEff = hEff_S2RZ_W0;
604  if(abs(wheel) == 1)
605  hEff = hEff_S2RZ_W1;
606  if(abs(wheel) == 2)
607  hEff = hEff_S2RZ_W2;
608  }
609 
610  } else if(step == 3) {
611  // Step 3
612  if(sl != 2) {
613  hEff = hEff_S3RPhi;
614  if (local) hEff_S3RPhiWS[abs(wheel)][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
615  } else {
616  hEffTot = hEff_S3RZ;
617  if(wheel == 0)
618  hEff = hEff_S3RZ_W0;
619  if(abs(wheel) == 1)
620  hEff = hEff_S3RZ_W1;
621  if(abs(wheel) == 2)
622  hEff = hEff_S3RZ_W2;
623  if (local) hEff_S3RZWS[abs(wheel)][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
624  }
625 
626  }
627  // Fill
628  hEff->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
629  if(hEffTot != 0)
630  hEffTot->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
631  }
632  }
633 }
634 
635 // Return the error on the measured (cm) coordinate
637  return sqrt(recHit.localPositionError(DTEnums::Left).xx());
638 }
639 
640 // Return the error on the measured (cm) coordinate
642  return sqrt(recHit.localPositionError().xx());
643 }
644 
type
Definition: HCALResponse.h:21
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
void Fill(float distSimHit, float etaSimHit, float phiSimHit, bool fillRecHit)
Definition: Histograms.h:217
float xx() const
Definition: LocalError.h:24
tuple ret
prodAgent to be discontinued
const double w
Definition: UKUtility.cc:23
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void Fill(float distSimHit, float thetaSimHit, float distFESimHit, float distRecHit, float etaSimHit, float phiSimHit, float errRecHit, int station)
Definition: Histograms.h:95
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:63
static const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
void compute(const DTGeometry *dtGeom, const std::map< DTWireId, std::vector< PSimHit > > &simHitsPerWire, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
Perform the real analysis.
virtual ~DTRecHitQuality()
Destructor.
float recHitPositionError(const DTRecHit1DPair &recHit)
virtual LocalError localPositionError() const
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
DTRecHitQuality(const edm::ParameterSet &pset)
Constructor.
Local3DPoint localPosition() const
Definition: PSimHit.h:44
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int superLayer() const
Return the superlayer number.
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
A set of histograms of residuals and pulls for 1D RecHits.
Definition: Histograms.h:26
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:75
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:66
float simHitImpactAngle(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
DQMStore * dbe_
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
int wire() const
Return the wire number.
Definition: DTWireId.h:56
#define debug
Definition: HDRShower.cc:19
float simHitDistFromFE(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
tuple simHits
Definition: trackerHits.py:16
virtual void beginRun(const edm::Run &iRun, const edm::EventSetup &setup)
T eta() const
Definition: PV3DBase.h:76
tuple cout
Definition: gather_cfg.py:145
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
int station() const
Return the station number.
Definition: DTChamberId.h:51
float cellLenght() const
Definition: DTTopology.h:73
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
T x() const
Definition: PV3DBase.h:62
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
Definition: Run.h:43
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
virtual LocalPoint localPosition() const
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107