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  * $Date: 2010/09/17 10:58:56 $
6  * $Revision: 1.16 $
7  * \author G. Cerminara - INFN Torino
8  */
9 
10 #include "DTRecHitQuality.h"
12 
16 
22 
27 
28 
29 #include <iostream>
30 #include <map>
31 
32 using namespace std;
33 using namespace edm;
34 
35 
36 
37 
38 // Constructor
40  // Get the debug parameter for verbose output
41  debug = pset.getUntrackedParameter<bool>("debug");
42  // the name of the simhit collection
43  simHitLabel = pset.getUntrackedParameter<InputTag>("simHitLabel");
44  // the name of the 1D rec hit collection
45  recHitLabel = pset.getUntrackedParameter<InputTag>("recHitLabel");
46  // the name of the 2D rec hit collection
47  segment2DLabel = pset.getUntrackedParameter<InputTag>("segment2DLabel");
48  // the name of the 4D rec hit collection
49  segment4DLabel = pset.getUntrackedParameter<InputTag>("segment4DLabel");
50 
51  // Switches for analysis at various steps
52  doStep1 = pset.getUntrackedParameter<bool>("doStep1", false);
53  doStep2 = pset.getUntrackedParameter<bool>("doStep2", false);
54  doStep3 = pset.getUntrackedParameter<bool>("doStep3", false);
55  doall = pset.getUntrackedParameter<bool>("doall", false);
56  local = pset.getUntrackedParameter<bool>("local", true);
57  // if(doall) doStep1
58  // Create the root file
59  //theFile = new TFile(rootFileName.c_str(), "RECREATE");
60  //theFile->cd();
61 
62 
63  // ----------------------
64  // get hold of back-end interface
65  dbe_ = 0;
66  dbe_ = Service<DQMStore>().operator->();
67  /*if ( dbe_ ) {
68  if (debug) {
69  dbe_->setVerbose(1);
70  } else {
71  dbe_->setVerbose(0);
72  }
73  }*/
74  dbe_->setVerbose(0);
75  /*if ( dbe_ ) {
76  if ( debug ) dbe_->showDirStructure();
77  }*/
78  if(doall && doStep1){
79  hRes_S1RPhi= new HRes1DHit("S1RPhi",dbe_,true,local); // RecHits, 1. step, RPhi
80  hRes_S1RPhi_W0= new HRes1DHit("S1RPhi_W0",dbe_,true,local); // RecHits, 1. step, RZ, wheel 0
81  hRes_S1RPhi_W1= new HRes1DHit("S1RPhi_W1",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-1
82  hRes_S1RPhi_W2= new HRes1DHit("S1RPhi_W2",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-2
83  hRes_S1RZ= new HRes1DHit("S1RZ",dbe_,true,local); // RecHits, 1. step, RZ
84  hRes_S1RZ_W0= new HRes1DHit("S1RZ_W0",dbe_,true,local); // RecHits, 1. step, RZ, wheel 0
85  hRes_S1RZ_W1= new HRes1DHit("S1RZ_W1",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-1
86  hRes_S1RZ_W2= new HRes1DHit("S1RZ_W2",dbe_,true,local); // RecHits, 1. step, RZ, wheel +-2
87  hEff_S1RPhi= new HEff1DHit("S1RPhi",dbe_); // RecHits, 1. step, RPhi
88  hEff_S1RZ= new HEff1DHit("S1RZ",dbe_); // RecHits, 1. step, RZ
89  hEff_S1RZ_W0= new HEff1DHit("S1RZ_W0",dbe_); // RecHits, 1. step, RZ, wheel 0
90  hEff_S1RZ_W1= new HEff1DHit("S1RZ_W1",dbe_); // RecHits, 1. step, RZ, wheel +-1
91  hEff_S1RZ_W2= new HEff1DHit("S1RZ_W2",dbe_); // RecHits, 1. step, RZ, wheel +-2
92  }
93  if(doall && doStep2){
94  hRes_S2RPhi= new HRes1DHit("S2RPhi",dbe_,true,local); // RecHits, 2. step, RPhi
95  hRes_S2RPhi_W0= new HRes1DHit("S2RPhi_W0",dbe_,true,local); // RecHits, 2. step, RPhi, wheel 0
96  hRes_S2RPhi_W1= new HRes1DHit("S2RPhi_W1",dbe_,true,local); // RecHits, 2. step, RPhi, wheel +-1
97  hRes_S2RPhi_W2= new HRes1DHit("S2RPhi_W2",dbe_,true,local); // RecHits, 2. step, RPhi, wheel +-2
98  hRes_S2RZ= new HRes1DHit("S2RZ",dbe_,true,local); // RecHits, 2. step, RZ
99  hRes_S2RZ_W0= new HRes1DHit("S2RZ_W0",dbe_,true,local); // RecHits, 2. step, RZ, wheel 0
100  hRes_S2RZ_W1= new HRes1DHit("S2RZ_W1",dbe_,true,local); // RecHits, 2. step, RZ, wheel +-1
101  hRes_S2RZ_W2= new HRes1DHit("S2RZ_W2",dbe_,true,local); // RecHits, 2. step, RZ, wheel +-2
102  hEff_S2RPhi= new HEff1DHit("S2RPhi",dbe_); // RecHits, 2. step, RPhi
103  hEff_S2RZ_W0= new HEff1DHit("S2RZ_W0",dbe_); // RecHits, 2. step, RZ, wheel 0
104  hEff_S2RZ_W1= new HEff1DHit("S2RZ_W1",dbe_); // RecHits, 2. step, RZ, wheel +-1
105  hEff_S2RZ_W2= new HEff1DHit("S2RZ_W2",dbe_); // RecHits, 2. step, RZ, wheel +-2
106  hEff_S2RZ= new HEff1DHit("S2RZ",dbe_); // RecHits, 2. step, RZ
107  }
108  if(doStep3){
109  hRes_S3RPhi= new HRes1DHit("S3RPhi",dbe_,doall,local); // RecHits, 3. step, RPhi
110  hRes_S3RPhi_W0= new HRes1DHit("S3RPhi_W0",dbe_,doall,local); // RecHits, 3. step, RPhi, wheel 0
111  hRes_S3RPhi_W1= new HRes1DHit("S3RPhi_W1",dbe_,doall,local); // RecHits, 3. step, RPhi, wheel +-1
112  hRes_S3RPhi_W2= new HRes1DHit("S3RPhi_W2",dbe_,doall,local); // RecHits, 3. step, RPhi, wheel +-2
113  hRes_S3RZ= new HRes1DHit("S3RZ",dbe_,doall,local); // RecHits, 3. step, RZ
114  hRes_S3RZ_W0= new HRes1DHit("S3RZ_W0",dbe_,doall,local); // RecHits, 3. step, RZ, wheel 0
115  hRes_S3RZ_W1= new HRes1DHit("S3RZ_W1",dbe_,doall,local); // RecHits, 3. step, RZ, wheel +-1
116  hRes_S3RZ_W2= new HRes1DHit("S3RZ_W2",dbe_,doall,local); // RecHits, 3. step, RZ, wheel +-2
117  if(doall){
118  hEff_S3RPhi= new HEff1DHit("S3RPhi",dbe_); // RecHits, 3. step, RPhi
119  hEff_S3RZ= new HEff1DHit("S3RZ",dbe_); // RecHits, 3. step, RZ
120  hEff_S3RZ_W0= new HEff1DHit("S3RZ_W0",dbe_); // RecHits, 3. step, RZ, wheel 0
121  hEff_S3RZ_W1= new HEff1DHit("S3RZ_W1",dbe_); // RecHits, 3. step, RZ, wheel +-1
122  hEff_S3RZ_W2= new HEff1DHit("S3RZ_W2",dbe_); // RecHits, 3. step, RZ, wheel +-2
123  }
124  }
125 }
126 
127 
128 // Destructor
130 }
131 
132 
134  edm::EventSetup const& c){
135 
136 }
137 
139  // Write the histos to file
140  if(doall){
141  if(doStep1){
142  hEff_S1RPhi->ComputeEfficiency();
143  hEff_S1RZ->ComputeEfficiency();
144  hEff_S1RZ_W0->ComputeEfficiency();
145  hEff_S1RZ_W1->ComputeEfficiency();
146  hEff_S1RZ_W2->ComputeEfficiency();
147  }
148  if(doStep2){
149  hEff_S2RPhi->ComputeEfficiency();
150  hEff_S2RZ->ComputeEfficiency();
151  hEff_S2RZ_W0->ComputeEfficiency();
152  hEff_S2RZ_W1->ComputeEfficiency();
153  hEff_S2RZ_W2->ComputeEfficiency();
154  }
155  if(doStep3){
156  hEff_S3RPhi->ComputeEfficiency();
157  hEff_S3RZ->ComputeEfficiency();
158  hEff_S3RZ_W0->ComputeEfficiency();
159  hEff_S3RZ_W1->ComputeEfficiency();
160  hEff_S3RZ_W2->ComputeEfficiency();
161  }
162  }
163  //if ( rootFileName.size() != 0 && dbe_ ) dbe_->save(rootFileName);
164 
165  // Write histos to file
166  /*hRes_S1RPhi->Write();
167  hRes_S2RPhi->Write();
168  hRes_S3RPhi->Write();
169 
170  hRes_S1RZ->Write();
171  hRes_S2RZ->Write();
172  hRes_S3RZ->Write();
173 
174  hRes_S1RZ_W0->Write();
175  hRes_S2RZ_W0->Write();
176  hRes_S3RZ_W0->Write();
177 
178  hRes_S1RZ_W1->Write();
179  hRes_S2RZ_W1->Write();
180  hRes_S3RZ_W1->Write();
181 
182  hRes_S1RZ_W2->Write();
183  hRes_S2RZ_W2->Write();
184  hRes_S3RZ_W2->Write();
185 
186 
187  hEff_S1RPhi->Write();
188  hEff_S2RPhi->Write();
189  hEff_S3RPhi->Write();
190 
191  hEff_S1RZ->Write();
192  hEff_S2RZ->Write();
193  hEff_S3RZ->Write();
194 
195  hEff_S1RZ_W0->Write();
196  hEff_S2RZ_W0->Write();
197  hEff_S3RZ_W0->Write();
198 
199  hEff_S1RZ_W1->Write();
200  hEff_S2RZ_W1->Write();
201  hEff_S3RZ_W1->Write();
202 
203  hEff_S1RZ_W2->Write();
204  hEff_S2RZ_W2->Write();
205  hEff_S3RZ_W2->Write();*/
206 
207  //theFile->Close();
208 }
209 
210 // The real analysis
211  void DTRecHitQuality::analyze(const Event & event, const EventSetup& eventSetup){
212  if(debug)
213  cout << "--- [DTRecHitQuality] Analysing Event: #Run: " << event.id().run()
214  << " #Event: " << event.id().event() << endl;
215  //theFile->cd();
216  // Get the DT Geometry
217  ESHandle<DTGeometry> dtGeom;
218  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
219 
220  // Get the SimHit collection from the event
222  event.getByLabel(simHitLabel, simHits);
223 
224  // Map simhits per wire
225  map<DTWireId, PSimHitContainer > simHitsPerWire =
227 
228 
229 
230  //=======================================================================================
231  // RecHit analysis at Step 1
232  if(doStep1 && doall) {
233  if(debug)
234  cout << " -- DTRecHit S1: begin analysis:" << endl;
235  // Get the rechit collection from the event
236  Handle<DTRecHitCollection> dtRecHits;
237  event.getByLabel(recHitLabel, dtRecHits);
238 
239  if(!dtRecHits.isValid()) {
240  if(debug) cout << "[DTRecHitQuality]**Warning: no 1DRechits with label: " << recHitLabel << " in this event, skipping!" << endl;
241  return;
242  }
243 
244  // Map rechits per wire
245  map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire =
246  map1DRecHitsPerWire(dtRecHits.product());
247 
248  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
249  }
250 
251 
252  //=======================================================================================
253  // RecHit analysis at Step 2
254  if(doStep2 && doall) {
255  if(debug)
256  cout << " -- DTRecHit S2: begin analysis:" << endl;
257 
258  // Get the 2D rechits from the event
260  event.getByLabel(segment2DLabel, segment2Ds);
261 
262  if(!segment2Ds.isValid()) {
263  if(debug) cout << "[DTRecHitQuality]**Warning: no 2DSegments with label: " << segment2DLabel
264  << " in this event, skipping!" << endl;
265 
266  }
267  else{
268  // Map rechits per wire
269  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
270  map1DRecHitsPerWire(segment2Ds.product());
271 
272  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 2);
273  }
274  }
275 
276  //=======================================================================================
277  // RecHit analysis at Step 3
278  if(doStep3) {
279  if(debug)
280  cout << " -- DTRecHit S3: begin analysis:" << endl;
281 
282  // Get the 4D rechits from the event
284  event.getByLabel(segment4DLabel, segment4Ds);
285 
286  if(!segment4Ds.isValid()) {
287  if(debug) cout << "[DTRecHitQuality]**Warning: no 4D Segments with label: " << segment4DLabel
288  << " in this event, skipping!" << endl;
289  return;
290  }
291 
292  // Map rechits per wire
293  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
294  map1DRecHitsPerWire(segment4Ds.product());
295 
296  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 3);
297  }
298 
299  }
300 
301 
302 
303 // Return a map between DTRecHit1DPair and wireId
304 map<DTWireId, vector<DTRecHit1DPair> >
306  map<DTWireId, vector<DTRecHit1DPair> > ret;
307 
308  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
309  rechit != dt1DRecHitPairs->end(); rechit++) {
310  ret[(*rechit).wireId()].push_back(*rechit);
311  }
312 
313  return ret;
314 }
315 
316 
317 // Return a map between DTRecHit1D at S2 and wireId
318 map<DTWireId, vector<DTRecHit1D> >
320  map<DTWireId, vector<DTRecHit1D> > ret;
321 
322  // Loop over all 2D segments
323  for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
324  segment != segment2Ds->end();
325  segment++) {
326  vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
327  // Loop over all component 1D hits
328  for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
329  hit != component1DHits.end();
330  hit++) {
331  ret[(*hit).wireId()].push_back(*hit);
332  }
333  }
334  return ret;
335 }
336 
337 
338 
339 // Return a map between DTRecHit1D at S3 and wireId
340 map<DTWireId, std::vector<DTRecHit1D> >
342  map<DTWireId, vector<DTRecHit1D> > ret;
343  // Loop over all 4D segments
344  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
345  segment != segment4Ds->end();
346  segment++) {
347  // Get component 2D segments
348  vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
349  // Loop over 2D segments:
350  for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
351  segment2D != segment2Ds.end();
352  segment2D++) {
353  // Get 1D component rechits
354  vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
355  // Loop over them
356  for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
357  hit != hits.end(); hit++) {
358  const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
359  ret[hit1D->wireId()].push_back(*hit1D);
360  }
361  }
362  }
363 
364  return ret;
365 }
366 
367 // Compute SimHit distance from wire (cm)
369  DTWireId wireId,
370  const PSimHit& hit) {
371  float xwire = layer->specificTopology().wirePosition(wireId.wire());
372  LocalPoint entryP = hit.entryPoint();
373  LocalPoint exitP = hit.exitPoint();
374  float xEntry = entryP.x()-xwire;
375  float xExit = exitP.x()-xwire;
376 
377  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));//FIXME: check...
378 }
379 
380 // Compute SimHit impact angle (in direction perp to wire)
382  DTWireId wireId,
383  const PSimHit& hit) {
384  LocalPoint entryP = hit.entryPoint();
385  LocalPoint exitP = hit.exitPoint();
386  float theta=(exitP.x()-entryP.x())/(exitP.z()-entryP.z());
387  return atan(theta);
388 }
389 
390 // Compute SimHit distance from FrontEnd
392  DTWireId wireId,
393  const PSimHit& hit) {
394  LocalPoint entryP = hit.entryPoint();
395  LocalPoint exitP = hit.exitPoint();
396  float wireLenght=layer->specificTopology().cellLenght();
397  return (entryP.y()+exitP.y())/2.+wireLenght;
398 }
399 
400 
401 // Find the RecHit closest to the muon SimHit
402 template <typename type>
403 const type*
405  DTWireId wireId,
406  const vector<type>& recHits,
407  const float simHitDist) {
408  float res = 99999;
409  const type* theBestRecHit = 0;
410  // Loop over RecHits within the cell
411  for(typename vector<type>::const_iterator recHit = recHits.begin();
412  recHit != recHits.end();
413  recHit++) {
414  float distTmp = recHitDistFromWire(*recHit, layer);
415  if(fabs(distTmp-simHitDist) < res) {
416  res = fabs(distTmp-simHitDist);
417  theBestRecHit = &(*recHit);
418  }
419  } // End of loop over RecHits within the cell
420 
421  return theBestRecHit;
422 }
423 
424 
425 // Compute the distance from wire (cm) of a hits in a DTRecHit1DPair
426 float
428  // Compute the rechit distance from wire
429  return fabs(hitPair.localPosition(DTEnums::Left).x() -
430  hitPair.localPosition(DTEnums::Right).x())/2.;
431 }
432 
433 
434 
435 // Compute the distance from wire (cm) of a hits in a DTRecHit1D
436 float
438  return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
439 }
440 
441 
442 template <typename type>
444  std::map<DTWireId, std::vector<PSimHit> > simHitsPerWire,
445  std::map<DTWireId, std::vector<type> > recHitsPerWire,
446  int step) {
447  // Loop over cells with a muon SimHit
448  for(map<DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
449  wireAndSHits != simHitsPerWire.end();
450  wireAndSHits++) {
451  DTWireId wireId = (*wireAndSHits).first;
452  vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
453 
454  // Get the layer
455  const DTLayer* layer = dtGeom->layer(wireId);
456 
457  // Look for a mu hit in the cell
458  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
459  if (muSimHit==0) {
460  if (debug)
461  cout << " No mu SimHit in channel: " << wireId << ", skipping! " << endl;
462  continue; // Skip this cell
463  }
464 
465  // Find the distance of the simhit from the wire
466  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
467  // Skip simhits out of the cell
468  if(simHitWireDist>2.1) {
469  if(debug)
470  cout << " [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
471  continue; // Skip this cell
472  }
473  GlobalPoint simHitGlobalPos = layer->toGlobal(muSimHit->localPosition());
474 
475  // find SH impact angle
476  float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
477 
478  // find SH distance from FE
479  float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
480 
481  bool recHitReconstructed = false;
482 
483  // Look for RecHits in the same cell
484  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
485  // No RecHit found in this cell
486  if(debug)
487  cout << " No RecHit found at Step: " << step << " in cell: " << wireId << endl;
488  } else {
489  recHitReconstructed = true;
490  // vector<type> recHits = (*wireAndRecHits).second;
491  vector<type> recHits = recHitsPerWire[wireId];
492  if(debug)
493  cout << " " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId << endl;
494 
495  // Find the best RecHit
496  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
497 
498 
499  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
500  if(debug)
501  cout << " SimHit distance from wire: " << simHitWireDist << endl
502  << " SimHit distance from FE: " << simHitFEDist << endl
503  << " SimHit distance angle " << simHitTheta << endl
504  << " RecHit distance from wire: " << recHitWireDist << endl;
505  float recHitErr = recHitPositionError(*theBestRecHit);
506  HRes1DHit *hRes = 0;
507  HRes1DHit *hResTot = 0;
508 
509  // Fill residuals and pulls
510  // Select the histo to be filled
511  if(step == 1) {
512  // Step 1
513  if(wireId.superLayer() != 2) {
514  hResTot = hRes_S1RPhi;
515  if(wireId.wheel() == 0)
516  hRes = hRes_S1RPhi_W0;
517  if(abs(wireId.wheel()) == 1)
518  hRes = hRes_S1RPhi_W1;
519  if(abs(wireId.wheel()) == 2)
520  hRes = hRes_S1RPhi_W2;
521  } else {
522  hResTot = hRes_S1RZ;
523  if(wireId.wheel() == 0)
524  hRes = hRes_S1RZ_W0;
525  if(abs(wireId.wheel()) == 1)
526  hRes = hRes_S1RZ_W1;
527  if(abs(wireId.wheel()) == 2)
528  hRes = hRes_S1RZ_W2;
529  }
530 
531  } else if(step == 2) {
532  // Step 2
533  if(wireId.superlayer() != 2) {
534  hRes = hRes_S2RPhi;
535  if(wireId.wheel() == 0)
536  hRes = hRes_S2RPhi_W0;
537  if(abs(wireId.wheel()) == 1)
538  hRes = hRes_S2RPhi_W1;
539  if(abs(wireId.wheel()) == 2)
540  hRes = hRes_S2RPhi_W2;
541  } else {
542  hResTot = hRes_S2RZ;
543  if(wireId.wheel() == 0)
544  hRes = hRes_S2RZ_W0;
545  if(abs(wireId.wheel()) == 1)
546  hRes = hRes_S2RZ_W1;
547  if(abs(wireId.wheel()) == 2)
548  hRes = hRes_S2RZ_W2;
549  }
550 
551  } else if(step == 3) {
552  // Step 3
553  if(wireId.superlayer() != 2) {
554  hResTot = hRes_S3RPhi;
555  if(wireId.wheel() == 0)
556  hRes = hRes_S3RPhi_W0;
557  if(abs(wireId.wheel()) == 1)
558  hRes = hRes_S3RPhi_W1;
559  if(abs(wireId.wheel()) == 2)
560  hRes = hRes_S3RPhi_W2;
561  } else {
562  hResTot = hRes_S3RZ;
563  if(wireId.wheel() == 0)
564  hRes = hRes_S3RZ_W0;
565  if(abs(wireId.wheel()) == 1)
566  hRes = hRes_S3RZ_W1;
567  if(abs(wireId.wheel()) == 2)
568  hRes = hRes_S3RZ_W2;
569  }
570 
571  }
572  // Fill
573  hRes->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
574  simHitGlobalPos.phi(),recHitErr,wireId.station());
575  if(hResTot != 0)
576  hResTot->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
577  simHitGlobalPos.phi(),recHitErr,wireId.station());
578  }
579 
580  // Fill Efficiencies
581  if(doall){
582  HEff1DHit *hEff = 0;
583  HEff1DHit *hEffTot = 0;
584  if(step == 1) {
585  // Step 1
586  if(wireId.superlayer() != 2) {
587  hEff = hEff_S1RPhi;
588  } else {
589  hEffTot = hEff_S1RZ;
590  if(wireId.wheel() == 0)
591  hEff = hEff_S1RZ_W0;
592  if(abs(wireId.wheel()) == 1)
593  hEff = hEff_S1RZ_W1;
594  if(abs(wireId.wheel()) == 2)
595  hEff = hEff_S1RZ_W2;
596  }
597 
598  } else if(step == 2) {
599  // Step 2
600  if(wireId.superlayer() != 2) {
601  hEff = hEff_S2RPhi;
602  } else {
603  hEffTot = hEff_S2RZ;
604  if(wireId.wheel() == 0)
605  hEff = hEff_S2RZ_W0;
606  if(abs(wireId.wheel()) == 1)
607  hEff = hEff_S2RZ_W1;
608  if(abs(wireId.wheel()) == 2)
609  hEff = hEff_S2RZ_W2;
610  }
611 
612  } else if(step == 3) {
613  // Step 3
614  if(wireId.superlayer() != 2) {
615  hEff = hEff_S3RPhi;
616  } else {
617  hEffTot = hEff_S3RZ;
618  if(wireId.wheel() == 0)
619  hEff = hEff_S3RZ_W0;
620  if(abs(wireId.wheel()) == 1)
621  hEff = hEff_S3RZ_W1;
622  if(abs(wireId.wheel()) == 2)
623  hEff = hEff_S3RZ_W2;
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:88
void Fill(float distSimHit, float etaSimHit, float phiSimHit, bool fillRecHit)
Definition: Histograms.h:219
float xx() const
Definition: LocalError.h:24
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
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:97
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.
#define abs(x)
Definition: mlp_lapack.h:159
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.
dictionary map
Definition: Association.py:205
float recHitPositionError(const DTRecHit1DPair &recHit)
virtual LocalError localPositionError() const
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:112
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
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:48
T z() const
Definition: PV3DBase.h:64
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
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:28
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:76
void compute(const DTGeometry *dtGeom, std::map< DTWireId, std::vector< PSimHit > > simHitsPerWire, std::map< DTWireId, std::vector< type > > recHitsPerWire, int step)
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:68
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:62
int wire() const
Return the wire number.
Definition: DTWireId.h:58
int superlayer() const
Return the superlayer number (deprecated method name)
float simHitDistFromFE(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
tuple simHits
Definition: trackerHits.py:16
T const * product() const
Definition: Handle.h:74
T eta() const
Definition: PV3DBase.h:76
tuple cout
Definition: gather_cfg.py:121
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
int station() const
Return the station number.
Definition: DTChamberId.h:53
#define debug
Definition: MEtoEDMFormat.h:34
float cellLenght() const
Definition: DTTopology.h:75
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
T x() const
Definition: PV3DBase.h:62
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
virtual LocalPoint localPosition() const
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109