CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTRecHitQuality Class Reference

#include <DTRecHitQuality.h>

Inheritance diagram for DTRecHitQuality:
edm::EDAnalyzer

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 Perform the real analysis. More...
 
 DTRecHitQuality (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 
virtual ~DTRecHitQuality ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

template<typename type >
void compute (const DTGeometry *dtGeom, std::map< DTWireId, std::vector< PSimHit > > simHitsPerWire, std::map< DTWireId, std::vector< type > > recHitsPerWire, int step)
 
template<typename type >
const typefindBestRecHit (const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
 
std::map< DTWireId,
std::vector< DTRecHit1DPair > > 
map1DRecHitsPerWire (const DTRecHitCollection *dt1DRecHitPairs)
 
std::map< DTWireId,
std::vector< DTRecHit1D > > 
map1DRecHitsPerWire (const DTRecSegment2DCollection *segment2Ds)
 
std::map< DTWireId,
std::vector< DTRecHit1D > > 
map1DRecHitsPerWire (const DTRecSegment4DCollection *segment4Ds)
 
float recHitDistFromWire (const DTRecHit1DPair &hitPair, const DTLayer *layer)
 
float recHitDistFromWire (const DTRecHit1D &recHit, const DTLayer *layer)
 
float recHitPositionError (const DTRecHit1DPair &recHit)
 
float recHitPositionError (const DTRecHit1D &recHit)
 
float simHitDistFromFE (const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
 
float simHitDistFromWire (const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
 
float simHitImpactAngle (const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
 

Private Attributes

bool debug
 
bool doStep1
 
bool doStep2
 
bool doStep3
 
HEff1DHithEff_S1RPhi
 
HEff1DHithEff_S1RZ
 
HEff1DHithEff_S1RZ_W0
 
HEff1DHithEff_S1RZ_W1
 
HEff1DHithEff_S1RZ_W2
 
HEff1DHithEff_S2RPhi
 
HEff1DHithEff_S2RZ
 
HEff1DHithEff_S2RZ_W0
 
HEff1DHithEff_S2RZ_W1
 
HEff1DHithEff_S2RZ_W2
 
HEff1DHithEff_S3RPhi
 
HEff1DHithEff_S3RZ
 
HEff1DHithEff_S3RZ_W0
 
HEff1DHithEff_S3RZ_W1
 
HEff1DHithEff_S3RZ_W2
 
HRes1DHithRes_S1RPhi
 
HRes1DHithRes_S1RZ
 
HRes1DHithRes_S1RZ_W0
 
HRes1DHithRes_S1RZ_W1
 
HRes1DHithRes_S1RZ_W2
 
HRes1DHithRes_S2RPhi
 
HRes1DHithRes_S2RZ
 
HRes1DHithRes_S2RZ_W0
 
HRes1DHithRes_S2RZ_W1
 
HRes1DHithRes_S2RZ_W2
 
HRes1DHithRes_S3RPhi
 
HRes1DHithRes_S3RZ
 
HRes1DHithRes_S3RZ_W0
 
HRes1DHithRes_S3RZ_W1
 
HRes1DHithRes_S3RZ_W2
 
std::string recHitLabel
 
std::string rootFileName
 
std::string segment2DLabel
 
std::string segment4DLabel
 
std::string simHitLabel
 
TFile * theFile
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Basic analyzer class which accesses 1D DTRecHits and plot resolution comparing reconstructed and simulated quantities

Date:
2007/06/18 15:29:13
Revision:
1.4
Author
G. Cerminara - INFN Torino

Definition at line 39 of file DTRecHitQuality.h.

Constructor & Destructor Documentation

DTRecHitQuality::DTRecHitQuality ( const edm::ParameterSet pset)

Constructor.

Definition at line 36 of file DTRecHitQuality.cc.

References debug, edm::ParameterSet::getUntrackedParameter(), dtT0WireCalibration_cfg::rootFileName, and interactiveExample::theFile.

36  {
37  // Get the debug parameter for verbose output
38  debug = pset.getUntrackedParameter<bool>("debug");
39  rootFileName = pset.getUntrackedParameter<string>("rootFileName");
40  // the name of the simhit collection
41  simHitLabel = pset.getUntrackedParameter<string>("simHitLabel", "SimG4Object");
42  // the name of the 1D rec hit collection
43  recHitLabel = pset.getUntrackedParameter<string>("recHitLabel", "DTRecHit1DProducer");
44  // the name of the 2D rec hit collection
45  segment2DLabel = pset.getUntrackedParameter<string>("segment2DLabel");
46  // the name of the 4D rec hit collection
47  segment4DLabel = pset.getUntrackedParameter<string>("segment4DLabel");
48 
49  // Switches for analysis at various steps
50  doStep1 = pset.getUntrackedParameter<bool>("doStep1", false);
51  doStep2 = pset.getUntrackedParameter<bool>("doStep2", false);
52  doStep3 = pset.getUntrackedParameter<bool>("doStep3", false);
53 
54  // Create the root file
55  theFile = new TFile(rootFileName.c_str(), "RECREATE");
56  theFile->cd();
57 
58 
59  hRes_S1RPhi= new HRes1DHit("S1RPhi"); // RecHits, 1. step, RPhi
60  hRes_S2RPhi= new HRes1DHit("S2RPhi"); // RecHits, 2. step, RPhi
61  hRes_S3RPhi= new HRes1DHit("S3RPhi"); // RecHits, 3. step, RPhi
62 
63  hRes_S1RZ= new HRes1DHit("S1RZ"); // RecHits, 1. step, RZ
64  hRes_S2RZ= new HRes1DHit("S2RZ"); // RecHits, 2. step, RZ
65  hRes_S3RZ= new HRes1DHit("S3RZ"); // RecHits, 3. step, RZ
66 
67  hRes_S1RZ_W0= new HRes1DHit("S1RZ_W0"); // RecHits, 1. step, RZ, wheel 0
68  hRes_S2RZ_W0= new HRes1DHit("S2RZ_W0"); // RecHits, 2. step, RZ, wheel 0
69  hRes_S3RZ_W0= new HRes1DHit("S3RZ_W0"); // RecHits, 3. step, RZ, wheel 0
70 
71  hRes_S1RZ_W1= new HRes1DHit("S1RZ_W1"); // RecHits, 1. step, RZ, wheel +-1
72  hRes_S2RZ_W1= new HRes1DHit("S2RZ_W1"); // RecHits, 2. step, RZ, wheel +-1
73  hRes_S3RZ_W1= new HRes1DHit("S3RZ_W1"); // RecHits, 3. step, RZ, wheel +-1
74 
75  hRes_S1RZ_W2= new HRes1DHit("S1RZ_W2"); // RecHits, 1. step, RZ, wheel +-2
76  hRes_S2RZ_W2= new HRes1DHit("S2RZ_W2"); // RecHits, 2. step, RZ, wheel +-2
77  hRes_S3RZ_W2= new HRes1DHit("S3RZ_W2"); // RecHits, 3. step, RZ, wheel +-2
78 
79  hEff_S1RPhi= new HEff1DHit("S1RPhi"); // RecHits, 1. step, RPhi
80  hEff_S2RPhi= new HEff1DHit("S2RPhi"); // RecHits, 2. step, RPhi
81  hEff_S3RPhi= new HEff1DHit("S3RPhi"); // RecHits, 3. step, RPhi
82 
83  hEff_S1RZ= new HEff1DHit("S1RZ"); // RecHits, 1. step, RZ
84  hEff_S2RZ= new HEff1DHit("S2RZ"); // RecHits, 2. step, RZ
85  hEff_S3RZ= new HEff1DHit("S3RZ"); // RecHits, 3. step, RZ
86 
87  hEff_S1RZ_W0= new HEff1DHit("S1RZ_W0"); // RecHits, 1. step, RZ, wheel 0
88  hEff_S2RZ_W0= new HEff1DHit("S2RZ_W0"); // RecHits, 2. step, RZ, wheel 0
89  hEff_S3RZ_W0= new HEff1DHit("S3RZ_W0"); // RecHits, 3. step, RZ, wheel 0
90 
91  hEff_S1RZ_W1= new HEff1DHit("S1RZ_W1"); // RecHits, 1. step, RZ, wheel +-1
92  hEff_S2RZ_W1= new HEff1DHit("S2RZ_W1"); // RecHits, 2. step, RZ, wheel +-1
93  hEff_S3RZ_W1= new HEff1DHit("S3RZ_W1"); // RecHits, 3. step, RZ, wheel +-1
94 
95  hEff_S1RZ_W2= new HEff1DHit("S1RZ_W2"); // RecHits, 1. step, RZ, wheel +-2
96  hEff_S2RZ_W2= new HEff1DHit("S2RZ_W2"); // RecHits, 2. step, RZ, wheel +-2
97  hEff_S3RZ_W2= new HEff1DHit("S3RZ_W2"); // RecHits, 3. step, RZ, wheel +-2
98 }
T getUntrackedParameter(std::string const &, T const &) const
HEff1DHit * hEff_S3RZ
HEff1DHit * hEff_S2RZ_W0
HEff1DHit * hEff_S2RZ
HEff1DHit * hEff_S3RPhi
A set of histograms for efficiency 1D DT RecHits.
Definition: Histograms.h:139
HRes1DHit * hRes_S1RZ
HRes1DHit * hRes_S3RZ_W2
HEff1DHit * hEff_S1RZ_W2
HEff1DHit * hEff_S3RZ_W1
HRes1DHit * hRes_S1RZ_W2
std::string simHitLabel
HRes1DHit * hRes_S1RPhi
HRes1DHit * hRes_S2RZ_W1
A set of histograms of residuals and pulls for 1D RecHits.
Definition: Histograms.h:25
HEff1DHit * hEff_S3RZ_W2
HEff1DHit * hEff_S1RZ_W0
HRes1DHit * hRes_S2RZ_W0
std::string rootFileName
HEff1DHit * hEff_S2RZ_W1
HRes1DHit * hRes_S1RZ_W1
HEff1DHit * hEff_S3RZ_W0
HEff1DHit * hEff_S2RZ_W2
HRes1DHit * hRes_S2RPhi
HEff1DHit * hEff_S1RPhi
std::string segment4DLabel
HEff1DHit * hEff_S1RZ
HRes1DHit * hRes_S3RPhi
HEff1DHit * hEff_S2RPhi
HEff1DHit * hEff_S1RZ_W1
HRes1DHit * hRes_S3RZ_W0
std::string recHitLabel
HRes1DHit * hRes_S3RZ_W1
HRes1DHit * hRes_S3RZ
HRes1DHit * hRes_S2RZ
HRes1DHit * hRes_S2RZ_W2
HRes1DHit * hRes_S1RZ_W0
std::string segment2DLabel
DTRecHitQuality::~DTRecHitQuality ( )
virtual

Destructor.

Definition at line 103 of file DTRecHitQuality.cc.

103  {
104  }

Member Function Documentation

void DTRecHitQuality::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Perform the real analysis.

Implements edm::EDAnalyzer.

Definition at line 178 of file DTRecHitQuality.cc.

References bookConverter::compute(), gather_cfg::cout, debug, edm::EventSetup::get(), DTHitQualityUtils::mapSimHitsPerWire(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), trackerHits::simHits, and interactiveExample::theFile.

178  {
179  if(debug)
180  cout << "--- [DTRecHitQuality] Analysing Event: #Run: " << event.id().run()
181  << " #Event: " << event.id().event() << endl;
182  theFile->cd();
183  // Get the DT Geometry
184  ESHandle<DTGeometry> dtGeom;
185  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
186 
187 
188  // Get the SimHit collection from the event
190  event.getByLabel(simHitLabel, "MuonDTHits", simHits);
191 
192  // Map simhits per wire
193  map<DTWireId, PSimHitContainer > simHitsPerWire =
195 
196 
197 
198 
199  //=======================================================================================
200  // RecHit analysis at Step 1
201  if(doStep1) {
202  if(debug)
203  cout << " -- DTRecHit S1: begin analysis:" << endl;
204  // Get the rechit collection from the event
205  Handle<DTRecHitCollection> dtRecHits;
206  event.getByLabel(recHitLabel, dtRecHits);
207 
208  // Map rechits per wire
209  map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire =
210  map1DRecHitsPerWire(dtRecHits.product());
211 
212  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
213  }
214 
215 
216 
217  //=======================================================================================
218  // RecHit analysis at Step 2
219  if(doStep2) {
220  if(debug)
221  cout << " -- DTRecHit S2: begin analysis:" << endl;
222 
223  // Get the 2D rechits from the event
225  event.getByLabel(segment2DLabel, segment2Ds);
226 
227  // Map rechits per wire
228  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
229  map1DRecHitsPerWire(segment2Ds.product());
230 
231  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 2);
232  }
233 
234 
235  //=======================================================================================
236  // RecHit analysis at Step 3
237  if(doStep3) {
238  if(debug)
239  cout << " -- DTRecHit S3: begin analysis:" << endl;
240 
241  // Get the 4D rechits from the event
243  event.getByLabel(segment4DLabel, segment4Ds);
244 
245  // Map rechits per wire
246  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire =
247  map1DRecHitsPerWire(segment4Ds.product());
248 
249  compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 3);
250  }
251 
252  }
std::string simHitLabel
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
void compute(const DTGeometry *dtGeom, std::map< DTWireId, std::vector< PSimHit > > simHitsPerWire, std::map< DTWireId, std::vector< type > > recHitsPerWire, int step)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::string segment4DLabel
tuple simHits
Definition: trackerHits.py:16
T const * product() const
Definition: Handle.h:74
std::string recHitLabel
tuple cout
Definition: gather_cfg.py:41
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
std::string segment2DLabel
template<typename type >
void DTRecHitQuality::compute ( const DTGeometry dtGeom,
std::map< DTWireId, std::vector< PSimHit > >  simHitsPerWire,
std::map< DTWireId, std::vector< type > >  recHitsPerWire,
int  step 
)
private

Definition at line 396 of file DTRecHitQuality.cc.

References abs, gather_cfg::cout, debug, PV3DBase< T, PVType, FrameType >::eta(), HRes1DHit::Fill(), HEff1DHit::Fill(), DTHitQualityUtils::findMuSimHit(), DTGeometry::layer(), PSimHit::localPosition(), python.multivaluedict::map(), PV3DBase< T, PVType, FrameType >::phi(), DTSuperLayerId::superLayer(), DTSuperLayerId::superlayer(), GeomDet::toGlobal(), and DTChamberId::wheel().

399  {
400  // Loop over cells with a muon SimHit
401  for(map<DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
402  wireAndSHits != simHitsPerWire.end();
403  wireAndSHits++) {
404  DTWireId wireId = (*wireAndSHits).first;
405  vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
406 
407  // Get the layer
408  const DTLayer* layer = dtGeom->layer(wireId);
409 
410  // Look for a mu hit in the cell
411  const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
412  if (muSimHit==0) {
413  if (debug)
414  cout << " No mu SimHit in channel: " << wireId << ", skipping! " << endl;
415  continue; // Skip this cell
416  }
417 
418  // Find the distance of the simhit from the wire
419  float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
420  // Skip simhits out of the cell
421  if(simHitWireDist>2.1) {
422  if(debug)
423  cout << " [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
424  continue; // Skip this cell
425  }
426  GlobalPoint simHitGlobalPos = layer->toGlobal(muSimHit->localPosition());
427 
428  // find SH impact angle
429  float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
430 
431  // find SH distance from FE
432  float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
433 
434  bool recHitReconstructed = false;
435 
436  // Look for RecHits in the same cell
437  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
438  // No RecHit found in this cell
439  if(debug)
440  cout << " No RecHit found at Step: " << step << " in cell: " << wireId << endl;
441  } else {
442  recHitReconstructed = true;
443  // vector<type> recHits = (*wireAndRecHits).second;
444  vector<type> recHits = recHitsPerWire[wireId];
445  if(debug)
446  cout << " " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId << endl;
447 
448  // Find the best RecHit
449  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
450 
451 
452  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
453  if(debug)
454  cout << " SimHit distance from wire: " << simHitWireDist << endl
455  << " SimHit distance from FE: " << simHitFEDist << endl
456  << " SimHit distance angle " << simHitTheta << endl
457  << " RecHit distance from wire: " << recHitWireDist << endl;
458  float recHitErr = recHitPositionError(*theBestRecHit);
459 
460  HRes1DHit *hRes = 0;
461  HRes1DHit *hResTot = 0;
462 
463  // Fill residuals and pulls
464  // Select the histo to be filled
465  if(step == 1) {
466  // Step 1
467  if(wireId.superLayer() != 2) {
468  hRes = hRes_S1RPhi;
469  } else {
470  hResTot = hRes_S1RZ;
471  if(wireId.wheel() == 0)
472  hRes = hRes_S1RZ_W0;
473  if(abs(wireId.wheel()) == 1)
474  hRes = hRes_S1RZ_W1;
475  if(abs(wireId.wheel()) == 2)
476  hRes = hRes_S1RZ_W2;
477  }
478 
479  } else if(step == 2) {
480  // Step 2
481  if(wireId.superlayer() != 2) {
482  hRes = hRes_S2RPhi;
483  } else {
484  hResTot = hRes_S2RZ;
485  if(wireId.wheel() == 0)
486  hRes = hRes_S2RZ_W0;
487  if(abs(wireId.wheel()) == 1)
488  hRes = hRes_S2RZ_W1;
489  if(abs(wireId.wheel()) == 2)
490  hRes = hRes_S2RZ_W2;
491  }
492 
493  } else if(step == 3) {
494  // Step 3
495  if(wireId.superlayer() != 2) {
496  hRes = hRes_S3RPhi;
497  } else {
498  hResTot = hRes_S3RZ;
499  if(wireId.wheel() == 0)
500  hRes = hRes_S3RZ_W0;
501  if(abs(wireId.wheel()) == 1)
502  hRes = hRes_S3RZ_W1;
503  if(abs(wireId.wheel()) == 2)
504  hRes = hRes_S3RZ_W2;
505  }
506 
507  }
508  // Fill
509  hRes->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
510  simHitGlobalPos.phi(),recHitErr);
511  if(hResTot != 0)
512  hResTot->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
513  simHitGlobalPos.phi(),recHitErr);
514 
515  }
516 
517  // Fill Efficiencies
518  HEff1DHit *hEff = 0;
519  HEff1DHit *hEffTot = 0;
520 
521  if(step == 1) {
522  // Step 1
523  if(wireId.superlayer() != 2) {
524  hEff = hEff_S1RPhi;
525  } else {
526  hEffTot = hEff_S1RZ;
527  if(wireId.wheel() == 0)
528  hEff = hEff_S1RZ_W0;
529  if(abs(wireId.wheel()) == 1)
530  hEff = hEff_S1RZ_W1;
531  if(abs(wireId.wheel()) == 2)
532  hEff = hEff_S1RZ_W2;
533  }
534 
535  } else if(step == 2) {
536  // Step 2
537  if(wireId.superlayer() != 2) {
538  hEff = hEff_S2RPhi;
539  } else {
540  hEffTot = hEff_S2RZ;
541  if(wireId.wheel() == 0)
542  hEff = hEff_S2RZ_W0;
543  if(abs(wireId.wheel()) == 1)
544  hEff = hEff_S2RZ_W1;
545  if(abs(wireId.wheel()) == 2)
546  hEff = hEff_S2RZ_W2;
547  }
548 
549  } else if(step == 3) {
550  // Step 3
551  if(wireId.superlayer() != 2) {
552  hEff = hEff_S3RPhi;
553  } else {
554  hEffTot = hEff_S3RZ;
555  if(wireId.wheel() == 0)
556  hEff = hEff_S3RZ_W0;
557  if(abs(wireId.wheel()) == 1)
558  hEff = hEff_S3RZ_W1;
559  if(abs(wireId.wheel()) == 2)
560  hEff = hEff_S3RZ_W2;
561  }
562 
563  }
564  // Fill
565  hEff->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
566  if(hEffTot != 0)
567  hEffTot->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
568  }
569 }
type
Definition: HCALResponse.h:22
void Fill(float distSimHit, float etaSimHit, float phiSimHit, bool fillRecHit)
Definition: Histograms.h:202
HEff1DHit * hEff_S3RZ
HEff1DHit * hEff_S2RZ_W0
HEff1DHit * hEff_S2RZ
list step
Definition: launcher.py:15
HEff1DHit * hEff_S3RPhi
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
A set of histograms for efficiency 1D DT RecHits.
Definition: Histograms.h:139
Geom::Phi< T > phi() 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 Fill(float distSimHit, float thetaSimHit, float distFESimHit, float distRecHit, float etaSimHit, float phiSimHit, float errRecHit)
Definition: Histograms.h:77
HRes1DHit * hRes_S1RZ
float recHitPositionError(const DTRecHit1DPair &recHit)
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:115
HRes1DHit * hRes_S3RZ_W2
float simHitDistFromWire(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
HEff1DHit * hEff_S1RZ_W2
Local3DPoint localPosition() const
Definition: PSimHit.h:44
HEff1DHit * hEff_S3RZ_W1
HRes1DHit * hRes_S1RZ_W2
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
HRes1DHit * hRes_S1RPhi
int superLayer() const
Return the superlayer number.
HRes1DHit * hRes_S2RZ_W1
A set of histograms of residuals and pulls for 1D RecHits.
Definition: Histograms.h:25
float simHitImpactAngle(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
HEff1DHit * hEff_S3RZ_W2
HEff1DHit * hEff_S1RZ_W0
HRes1DHit * hRes_S2RZ_W0
HEff1DHit * hEff_S2RZ_W1
int superlayer() const
Return the superlayer number (deprecated method name)
HRes1DHit * hRes_S1RZ_W1
HEff1DHit * hEff_S3RZ_W0
HEff1DHit * hEff_S2RZ_W2
HRes1DHit * hRes_S2RPhi
HEff1DHit * hEff_S1RPhi
float simHitDistFromFE(const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
HEff1DHit * hEff_S1RZ
HRes1DHit * hRes_S3RPhi
HEff1DHit * hEff_S2RPhi
T eta() const
Definition: PV3DBase.h:70
HEff1DHit * hEff_S1RZ_W1
HRes1DHit * hRes_S3RZ_W0
HRes1DHit * hRes_S3RZ_W1
HRes1DHit * hRes_S3RZ
HRes1DHit * hRes_S2RZ
tuple cout
Definition: gather_cfg.py:41
HRes1DHit * hRes_S2RZ_W2
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
HRes1DHit * hRes_S1RZ_W0
void DTRecHitQuality::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 108 of file DTRecHitQuality.cc.

References interactiveExample::theFile.

108  {
109  // Write the histos to file
110  theFile->cd();
111 
115 
119 
123 
127 
131 
132  // Write histos to file
133  hRes_S1RPhi->Write();
134  hRes_S2RPhi->Write();
135  hRes_S3RPhi->Write();
136 
137  hRes_S1RZ->Write();
138  hRes_S2RZ->Write();
139  hRes_S3RZ->Write();
140 
141  hRes_S1RZ_W0->Write();
142  hRes_S2RZ_W0->Write();
143  hRes_S3RZ_W0->Write();
144 
145  hRes_S1RZ_W1->Write();
146  hRes_S2RZ_W1->Write();
147  hRes_S3RZ_W1->Write();
148 
149  hRes_S1RZ_W2->Write();
150  hRes_S2RZ_W2->Write();
151  hRes_S3RZ_W2->Write();
152 
153 
154  hEff_S1RPhi->Write();
155  hEff_S2RPhi->Write();
156  hEff_S3RPhi->Write();
157 
158  hEff_S1RZ->Write();
159  hEff_S2RZ->Write();
160  hEff_S3RZ->Write();
161 
162  hEff_S1RZ_W0->Write();
163  hEff_S2RZ_W0->Write();
164  hEff_S3RZ_W0->Write();
165 
166  hEff_S1RZ_W1->Write();
167  hEff_S2RZ_W1->Write();
168  hEff_S3RZ_W1->Write();
169 
170  hEff_S1RZ_W2->Write();
171  hEff_S2RZ_W2->Write();
172  hEff_S3RZ_W2->Write();
173 
174  theFile->Close();
175 }
HEff1DHit * hEff_S3RZ
HEff1DHit * hEff_S2RZ_W0
HEff1DHit * hEff_S2RZ
HEff1DHit * hEff_S3RPhi
HRes1DHit * hRes_S1RZ
void ComputeEfficiency()
Definition: Histograms.h:219
HRes1DHit * hRes_S3RZ_W2
HEff1DHit * hEff_S1RZ_W2
HEff1DHit * hEff_S3RZ_W1
HRes1DHit * hRes_S1RZ_W2
HRes1DHit * hRes_S1RPhi
HRes1DHit * hRes_S2RZ_W1
void Write()
Definition: Histograms.h:272
HEff1DHit * hEff_S3RZ_W2
HEff1DHit * hEff_S1RZ_W0
HRes1DHit * hRes_S2RZ_W0
HEff1DHit * hEff_S2RZ_W1
HRes1DHit * hRes_S1RZ_W1
HEff1DHit * hEff_S3RZ_W0
HEff1DHit * hEff_S2RZ_W2
HRes1DHit * hRes_S2RPhi
HEff1DHit * hEff_S1RPhi
HEff1DHit * hEff_S1RZ
HRes1DHit * hRes_S3RPhi
HEff1DHit * hEff_S2RPhi
HEff1DHit * hEff_S1RZ_W1
HRes1DHit * hRes_S3RZ_W0
HRes1DHit * hRes_S3RZ_W1
void Write()
Definition: Histograms.h:103
HRes1DHit * hRes_S3RZ
HRes1DHit * hRes_S2RZ
HRes1DHit * hRes_S2RZ_W2
HRes1DHit * hRes_S1RZ_W0
template<typename type >
const type * DTRecHitQuality::findBestRecHit ( const DTLayer layer,
DTWireId  wireId,
const std::vector< type > &  recHits,
const float  simHitDist 
)
private

Definition at line 357 of file DTRecHitQuality.cc.

360  {
361  float res = 99999;
362  const type* theBestRecHit = 0;
363  // Loop over RecHits within the cell
364  for(typename vector<type>::const_iterator recHit = recHits.begin();
365  recHit != recHits.end();
366  recHit++) {
367  float distTmp = recHitDistFromWire(*recHit, layer);
368  if(fabs(distTmp-simHitDist) < res) {
369  res = fabs(distTmp-simHitDist);
370  theBestRecHit = &(*recHit);
371  }
372  } // End of loop over RecHits within the cell
373 
374  return theBestRecHit;
375 }
type
Definition: HCALResponse.h:22
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
map< DTWireId, vector< DTRecHit1DPair > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecHitCollection dt1DRecHitPairs)
private

Definition at line 258 of file DTRecHitQuality.cc.

References runTheMatrix::ret.

258  {
259  map<DTWireId, vector<DTRecHit1DPair> > ret;
260 
261  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
262  rechit != dt1DRecHitPairs->end(); rechit++) {
263  ret[(*rechit).wireId()].push_back(*rechit);
264  }
265 
266  return ret;
267 }
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:46
map< DTWireId, vector< DTRecHit1D > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecSegment2DCollection segment2Ds)
private

Definition at line 272 of file DTRecHitQuality.cc.

References runTheMatrix::ret.

272  {
273  map<DTWireId, vector<DTRecHit1D> > ret;
274 
275  // Loop over all 2D segments
276  for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
277  segment != segment2Ds->end();
278  segment++) {
279  vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
280  // Loop over all component 1D hits
281  for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
282  hit != component1DHits.end();
283  hit++) {
284  ret[(*hit).wireId()].push_back(*hit);
285  }
286  }
287  return ret;
288 }
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:46
map< DTWireId, std::vector< DTRecHit1D > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecSegment4DCollection segment4Ds)
private

Definition at line 294 of file DTRecHitQuality.cc.

References runTheMatrix::ret, and DTRecHit1D::wireId().

294  {
295  map<DTWireId, vector<DTRecHit1D> > ret;
296  // Loop over all 4D segments
297  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
298  segment != segment4Ds->end();
299  segment++) {
300  // Get component 2D segments
301  vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
302  // Loop over 2D segments:
303  for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
304  segment2D != segment2Ds.end();
305  segment2D++) {
306  // Get 1D component rechits
307  vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
308  // Loop over them
309  for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
310  hit != hits.end(); hit++) {
311  const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
312  ret[hit1D->wireId()].push_back(*hit1D);
313  }
314  }
315  }
316 
317  return ret;
318 }
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:46
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109
float DTRecHitQuality::recHitDistFromWire ( const DTRecHit1DPair hitPair,
const DTLayer layer 
)
private

Definition at line 380 of file DTRecHitQuality.cc.

References DTEnums::Left, DTRecHit1DPair::localPosition(), DTEnums::Right, and PV3DBase< T, PVType, FrameType >::x().

380  {
381  // Compute the rechit distance from wire
382  return fabs(hitPair.localPosition(DTEnums::Left).x() -
383  hitPair.localPosition(DTEnums::Right).x())/2.;
384 }
T x() const
Definition: PV3DBase.h:56
virtual LocalPoint localPosition() const
float DTRecHitQuality::recHitDistFromWire ( const DTRecHit1D recHit,
const DTLayer layer 
)
private

Definition at line 390 of file DTRecHitQuality.cc.

References DTRecHit1D::localPosition(), DTLayer::specificTopology(), DTWireId::wire(), DTRecHit1D::wireId(), DTTopology::wirePosition(), and PV3DBase< T, PVType, FrameType >::x().

390  {
391  return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
392 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:73
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
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
T x() const
Definition: PV3DBase.h:56
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109
float DTRecHitQuality::recHitPositionError ( const DTRecHit1DPair recHit)
private

Definition at line 572 of file DTRecHitQuality.cc.

References DTEnums::Left, DTRecHit1DPair::localPositionError(), mathSSE::sqrt(), and LocalError::xx().

572  {
573  return sqrt(recHit.localPositionError(DTEnums::Left).xx());
574 }
float xx() const
Definition: LocalError.h:19
virtual LocalError localPositionError() const
T sqrt(T t)
Definition: SSEVec.h:28
float DTRecHitQuality::recHitPositionError ( const DTRecHit1D recHit)
private

Definition at line 577 of file DTRecHitQuality.cc.

References DTRecHit1D::localPositionError(), mathSSE::sqrt(), and LocalError::xx().

577  {
578  return sqrt(recHit.localPositionError().xx());
579 }
float xx() const
Definition: LocalError.h:19
T sqrt(T t)
Definition: SSEVec.h:28
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: DTRecHit1D.h:68
float DTRecHitQuality::simHitDistFromFE ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
)
private

Definition at line 344 of file DTRecHitQuality.cc.

References DTTopology::cellLenght(), PSimHit::entryPoint(), PSimHit::exitPoint(), DTLayer::specificTopology(), and PV3DBase< T, PVType, FrameType >::y().

346  {
347  LocalPoint entryP = hit.entryPoint();
348  LocalPoint exitP = hit.exitPoint();
349  float wireLenght=layer->specificTopology().cellLenght();
350  return (entryP.y()+exitP.y())/2.+wireLenght;
351 }
T y() const
Definition: PV3DBase.h:57
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
const float cellLenght() const
Definition: DTTopology.h:75
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
float DTRecHitQuality::simHitDistFromWire ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
)
private

Definition at line 321 of file DTRecHitQuality.cc.

References PSimHit::entryPoint(), PSimHit::exitPoint(), DTLayer::specificTopology(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

323  {
324  float xwire = layer->specificTopology().wirePosition(wireId.wire());
325  LocalPoint entryP = hit.entryPoint();
326  LocalPoint exitP = hit.exitPoint();
327  float xEntry = entryP.x()-xwire;
328  float xExit = exitP.x()-xwire;
329 
330  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));//FIXME: check...
331 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:73
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
T z() const
Definition: PV3DBase.h:58
int wire() const
Return the wire number.
Definition: DTWireId.h:58
T x() const
Definition: PV3DBase.h:56
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
float DTRecHitQuality::simHitImpactAngle ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
)
private

Definition at line 334 of file DTRecHitQuality.cc.

References PSimHit::entryPoint(), PSimHit::exitPoint(), theta(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

336  {
337  LocalPoint entryP = hit.entryPoint();
338  LocalPoint exitP = hit.exitPoint();
339  float theta=(exitP.x()-entryP.x())/(exitP.z()-entryP.z());
340  return atan(theta);
341 }
Geom::Theta< T > theta() const
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
T z() const
Definition: PV3DBase.h:58
T x() const
Definition: PV3DBase.h:56
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35

Member Data Documentation

bool DTRecHitQuality::debug
private

Definition at line 62 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep1
private

Definition at line 71 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep2
private

Definition at line 72 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep3
private

Definition at line 73 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S1RPhi
private

Definition at line 156 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S1RZ
private

Definition at line 160 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S1RZ_W0
private

Definition at line 164 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S1RZ_W1
private

Definition at line 168 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S1RZ_W2
private

Definition at line 172 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S2RPhi
private

Definition at line 157 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S2RZ
private

Definition at line 161 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S2RZ_W0
private

Definition at line 165 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S2RZ_W1
private

Definition at line 169 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S2RZ_W2
private

Definition at line 173 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S3RPhi
private

Definition at line 158 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S3RZ
private

Definition at line 162 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S3RZ_W0
private

Definition at line 166 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S3RZ_W1
private

Definition at line 170 of file DTRecHitQuality.h.

HEff1DHit* DTRecHitQuality::hEff_S3RZ_W2
private

Definition at line 174 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S1RPhi
private

Definition at line 135 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S1RZ
private

Definition at line 139 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S1RZ_W0
private

Definition at line 143 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S1RZ_W1
private

Definition at line 147 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S1RZ_W2
private

Definition at line 151 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S2RPhi
private

Definition at line 136 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S2RZ
private

Definition at line 140 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S2RZ_W0
private

Definition at line 144 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S2RZ_W1
private

Definition at line 148 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S2RZ_W2
private

Definition at line 152 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S3RPhi
private

Definition at line 137 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S3RZ
private

Definition at line 141 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S3RZ_W0
private

Definition at line 145 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S3RZ_W1
private

Definition at line 149 of file DTRecHitQuality.h.

HRes1DHit* DTRecHitQuality::hRes_S3RZ_W2
private

Definition at line 153 of file DTRecHitQuality.h.

std::string DTRecHitQuality::recHitLabel
private

Definition at line 66 of file DTRecHitQuality.h.

std::string DTRecHitQuality::rootFileName
private

Definition at line 64 of file DTRecHitQuality.h.

std::string DTRecHitQuality::segment2DLabel
private

Definition at line 67 of file DTRecHitQuality.h.

std::string DTRecHitQuality::segment4DLabel
private

Definition at line 68 of file DTRecHitQuality.h.

std::string DTRecHitQuality::simHitLabel
private

Definition at line 65 of file DTRecHitQuality.h.

TFile* DTRecHitQuality::theFile
private

Definition at line 60 of file DTRecHitQuality.h.