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
DTCalibValidation Class Reference

#include <DTCalibValidation.h>

Inheritance diagram for DTCalibValidation:
edm::EDAnalyzer

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
void beginJob ()
 BeginJob. More...
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 BeginRun. More...
 
 DTCalibValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 Endjob. More...
 
virtual ~DTCalibValidation ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void bookHistos (DTSuperLayerId slId, int step)
 
template<typename type >
void compute (const DTGeometry *dtGeom, const DTRecSegment4D &segment, std::map< DTWireId, std::vector< type > > recHitsPerWire, int step)
 
void fillHistos (DTSuperLayerId slId, float distance, float residualOnDistance, float position, float residualOnPosition, 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 recHitPosition (const DTRecHit1DPair &hitPair, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
 
float recHitPosition (const DTRecHit1D &recHit, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
 

Private Attributes

bool detailedAnalysis
 
edm::ESHandle< DTGeometrydtGeom
 
std::map< std::pair
< DTSuperLayerId, int >
, std::vector< MonitorElement * > > 
histosPerSL
 
int nevent
 
edm::ParameterSet parameters
 
std::string recHits1DLabel
 
int rightSegment
 
std::string segment2DLabel
 
std::string segment4DLabel
 
DQMStoretheDbe
 
int wrongSegment
 

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)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Analysis on DT residuals to validate the kFactor

Date:
2010/06/22 19:10:06
Revision:
1.7
Author
G. Mila - INFN Torino

Definition at line 40 of file DTCalibValidation.h.

Constructor & Destructor Documentation

DTCalibValidation::DTCalibValidation ( const edm::ParameterSet pset)

Constructor.

Definition at line 36 of file DTCalibValidation.cc.

References cppFunctionSkipper::operator, and Parameters::parameters.

36  {
37 
38  //debug = pset.getUntrackedParameter<bool>("debug",false);
39 
40  // Get the DQM needed services
41 
42  // To remove into CMSSW versions before 20X
44  // To add into CMSSW versions before 20X
45  /*theDbe = edm::Service<DaqMonitorBEInterface>().operator->();
46  theDbe->setVerbose(1);
47  edm::Service<MonitorDaemon>().operator->();*/
48 
49  theDbe->setCurrentFolder("DT/DTCalibValidation");
50 
51  parameters = pset;
52 }
edm::ParameterSet parameters
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
DTCalibValidation::~DTCalibValidation ( )
virtual

Destructor.

Definition at line 55 of file DTCalibValidation.cc.

55  {
56 }

Member Function Documentation

void DTCalibValidation::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 123 of file DTCalibValidation.cc.

References bookConverter::compute(), LogTrace, nevent, and edm::Handle< T >::product().

123  {
124 
125  ++nevent;
126  LogTrace("DTCalibValidation") << "[DTCalibValidation] Analyze #Run: " << event.id().run()
127  << " #Event: " << nevent;
128 
129  // RecHit mapping at Step 1 -------------------------------
130  map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire_1S;
131 
132  // RecHit mapping at Step 2 ------------------------------
133  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire_2S;
134 
135  if(detailedAnalysis){
136  LogTrace("DTCalibValidation") << " -- DTRecHit S1: begin analysis:";
137  // Get the rechit collection from the event
138  Handle<DTRecHitCollection> dtRecHits;
139  event.getByLabel(recHits1DLabel, dtRecHits);
140  recHitsPerWire_1S = map1DRecHitsPerWire(dtRecHits.product());
141 
142  LogTrace("DTCalibValidation") << " -- DTRecHit S2: begin analysis:";
143  // Get the 2D rechits from the event
145  event.getByLabel(segment2DLabel, segment2Ds);
146  recHitsPerWire_2S = map1DRecHitsPerWire(segment2Ds.product());
147  }
148 
149  // RecHit mapping at Step 3 ---------------------------------
150  LogTrace("DTCalibValidation") << " -- DTRecHit S3: begin analysis:";
151  // Get the 4D rechits from the event
153  event.getByLabel(segment4DLabel, segment4Ds);
154  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire_3S = map1DRecHitsPerWire(segment4Ds.product());
155 
156 
157  // Loop over all 4D segments
158  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
159  segment != segment4Ds->end();
160  ++segment) {
161 
162  if(detailedAnalysis){
163  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 1";
164  compute(dtGeom.product(), (*segment), recHitsPerWire_1S, 1);
165 
166  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 2";
167  compute(dtGeom.product(), (*segment), recHitsPerWire_2S, 2);
168  }
169 
170  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 3";
171  compute(dtGeom.product(), (*segment), recHitsPerWire_3S, 3);
172  }
173 
174 }
edm::ESHandle< DTGeometry > dtGeom
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
void compute(const DTGeometry *dtGeom, const DTRecSegment4D &segment, std::map< DTWireId, std::vector< type > > recHitsPerWire, int step)
std::string recHits1DLabel
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
#define LogTrace(id)
std::string segment2DLabel
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
std::string segment4DLabel
void DTCalibValidation::beginJob ( void  )
virtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file DTCalibValidation.cc.

References nevent, and Parameters::parameters.

59  {
60 
61  // the name of the rechits collection at step 1
62  recHits1DLabel = parameters.getUntrackedParameter<string>("recHits1DLabel");
63  // the name of the 2D segments
64  segment2DLabel = parameters.getUntrackedParameter<string>("segment2DLabel");
65  // the name of the 4D segments
66  segment4DLabel = parameters.getUntrackedParameter<string>("segment4DLabel");
67  // the counter of segments not used to compute residuals
68  wrongSegment = 0;
69  // the counter of segments used to compute residuals
70  rightSegment = 0;
71  // the analysis type
72  detailedAnalysis = parameters.getUntrackedParameter<bool>("detailedAnalysis",false);
73 
74  nevent=0;
75 
76 }
T getUntrackedParameter(std::string const &, T const &) const
std::string recHits1DLabel
std::string segment2DLabel
std::string segment4DLabel
edm::ParameterSet parameters
void DTCalibValidation::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
virtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file DTCalibValidation.cc.

References bookHistos(), edm::EventSetup::get(), and launcher::step.

78  {
79 
80  // get the geometry
81  setup.get<MuonGeometryRecord>().get(dtGeom);
82 
83  // Loop over all the chambers
84  vector<DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
85  vector<DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
86  for (; ch_it != ch_end; ++ch_it) {
87  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
88  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
89  // Loop over the SLs
90  for(; sl_it != sl_end; ++sl_it) {
91  DTSuperLayerId slId = (*sl_it)->id();
92  if(detailedAnalysis){
93  // Loop over the 3 steps
94  for(int step = 1; step <= 3; ++step) bookHistos(slId,step);
95  } else {
96  // Only step 3
97  bookHistos(slId,3);
98  }
99  }
100  }
101 
102 }
list step
Definition: launcher.py:15
edm::ESHandle< DTGeometry > dtGeom
const T & get() const
Definition: EventSetup.h:55
void bookHistos(DTSuperLayerId slId, int step)
void DTCalibValidation::bookHistos ( DTSuperLayerId  slId,
int  step 
)
private

Definition at line 480 of file DTCalibValidation.cc.

References mergeVDriftHistosByStation::histos, LogTrace, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, launcher::step, cmsPerfCommons::Step, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

480  {
481  LogTrace("DTCalibValidation") << " Booking histos for SL: " << slId;
482 
483  // Compose the chamber name
484  stringstream wheel; wheel << slId.wheel();
485  stringstream station; station << slId.station();
486  stringstream sector; sector << slId.sector();
487  stringstream superLayer; superLayer << slId.superlayer();
488  // Define the step
489  stringstream Step; Step << step;
490 
491 
492  string slHistoName =
493  "_STEP" + Step.str() +
494  "_W" + wheel.str() +
495  "_St" + station.str() +
496  "_Sec" + sector.str() +
497  "_SL" + superLayer.str();
498 
499  theDbe->setCurrentFolder("DT/DTCalibValidation/Wheel" + wheel.str() +
500  "/Station" + station.str() +
501  "/Sector" + sector.str());
502  // Create the monitor elements
503  vector<MonitorElement *> histos;
504  // Note hte order matters
505  histos.push_back(theDbe->book1D("hResDist"+slHistoName,
506  "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
507  200, -0.4, 0.4));
508  histos.push_back(theDbe->book2D("hResDistVsDist"+slHistoName,
509  "Residuals on the distance (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
510  100, 0, 2.5, 200, -0.4, 0.4));
511  if(detailedAnalysis){
512  histos.push_back(theDbe->book1D("hResPos"+slHistoName,
513  "Residuals on the position from wire (rec_hit - segm_extr) (cm)",
514  200, -0.4, 0.4));
515  histos.push_back(theDbe->book2D("hResPosVsPos"+slHistoName,
516  "Residuals on the position (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
517  200, -2.5, 2.5, 200, -0.4, 0.4));
518  }
519 
520  histosPerSL[make_pair(slId, step)] = histos;
521 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
list step
Definition: launcher.py:15
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
#define LogTrace(id)
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:63
int station() const
Return the station number.
Definition: DTChamberId.h:53
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
template<typename type >
void DTCalibValidation::compute ( const DTGeometry dtGeom,
const DTRecSegment4D segment,
std::map< DTWireId, std::vector< type > >  recHitsPerWire,
int  step 
)
private

Definition at line 350 of file DTCalibValidation.cc.

References DTGeometry::chamber(), filterCSVwithJSON::copy, funct::cos(), DTRecSegment4D::dimension(), DTGeometry::layer(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), LogTrace, DTRecSegment4D::phiSegment(), DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), DTSuperLayerId::superlayer(), PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().

353  {
354  bool computeResidual = true;
355 
356  // Get all 1D RecHits at step 3 within the 4D segment
357  vector<DTRecHit1D> recHits1D_S3;
358 
359  // Get 1D RecHits at Step 3 and select only events with
360  // 8 hits in phi and 4 hits in theta (if any)
361  const DTChamberRecSegment2D* phiSeg = segment.phiSegment();
362  if(phiSeg){
363  vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
364  if(phiRecHits.size() != 8) {
365  LogTrace("DTCalibValidation") << "[DTCalibValidation] Phi segments has: " << phiRecHits.size()
366  << " hits, skipping"; // FIXME: info output
367  computeResidual = false;
368  }
369  copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
370  }
371  if(!phiSeg){
372  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the phi segment! ";
373  computeResidual = false;
374  }
375 
376  if(segment.dimension() == 4) {
377  const DTSLRecSegment2D* zSeg = segment.zSegment();
378  if(zSeg){
379  vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
380  if(zRecHits.size() != 4) {
381  LogTrace("DTCalibValidation") << "[DTCalibValidation] Theta segments has: " << zRecHits.size()
382  << " hits, skipping"; // FIXME: info output
383  computeResidual = false;
384  }
385  copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
386  }
387  if(!zSeg){
388  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the z segment! ";
389  computeResidual = false;
390  }
391  }
392 
393  if(!computeResidual)
394  ++wrongSegment;
395  if(computeResidual){
396  ++rightSegment;
397  // Loop over 1D RecHit inside 4D segment
398  for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
399  recHit1D != recHits1D_S3.end();
400  ++recHit1D) {
401  const DTWireId wireId = (*recHit1D).wireId();
402 
403  // Get the layer and the wire position
404  const DTLayer* layer = dtGeom->layer(wireId);
405  float wireX = layer->specificTopology().wirePosition(wireId.wire());
406 
407  // Extrapolate the segment to the z of the wire
408  // Get wire position in chamber RF
409  // (y and z must be those of the hit to be coherent in the transf. of RF in case of rotations of the layer alignment)
410  LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
411  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
412  const DTChamber* chamber = dtGeom->chamber((*recHit1D).wireId().layerId().chamberId());
413  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
414 
415  // Segment position at Wire z in chamber local frame
416  LocalPoint segPosAtZWire = segment.localPosition()
417  + segment.localDirection()*wirePosInChamber.z()/cos(segment.localDirection().theta());
418 
419  // Compute the distance of the segment from the wire
420  int sl = wireId.superlayer();
421  float SegmDistance = -1;
422  if(sl == 1 || sl == 3) {
423  // RPhi SL
424  SegmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
425  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
426  } else if(sl == 2) {
427  // RZ SL
428  SegmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
429  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
430  }
431  if(SegmDistance > 2.1)
432  LogTrace("DTCalibValidation") << " Warning: dist segment-wire: " << SegmDistance;
433 
434  // Look for RecHits in the same cell
435  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
436  LogTrace("DTCalibValidation") << " No RecHit found at Step: " << step << " in cell: " << wireId;
437  } else {
438  vector<type> recHits = recHitsPerWire[wireId];
439  LogTrace("DTCalibValidation") << " " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId;
440 
441  // Get the layer
442  const DTLayer* layer = dtGeom->layer(wireId);
443  // Find the best RecHits
444  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, SegmDistance);
445  // Compute the distance of the recHit from the wire
446  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
447  LogTrace("DTCalibValidation") << "recHitWireDist: " << recHitWireDist;
448 
449  // Compute the residuals
450  float residualOnDistance = recHitWireDist - SegmDistance;
451  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnDistance: " << residualOnDistance;
452  float residualOnPosition = -1;
453  float recHitPos = -1;
454  if(sl == 1 || sl == 3) {
455  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.x(), sl);
456  residualOnPosition = recHitPos - segPosAtZWire.x();
457  }
458  else{
459  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.y(), sl);
460  residualOnPosition = recHitPos - segPosAtZWire.y();
461  }
462  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnPosition: " << residualOnPosition;
463 
464  // Fill the histos
465  if(sl == 1 || sl == 3)
466  fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.x() - segPosAtZWire.x()), residualOnPosition, step);
467  else
468  fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.y() - segPosAtZWire.y()), residualOnPosition, step);
469 
470 
471  }
472  }
473  }
474 
475 }
type
Definition: HCALResponse.h:22
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
list step
Definition: launcher.py:15
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:115
virtual LocalVector localDirection() const
Local direction in Chamber frame.
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance, float position, float residualOnPosition, int step)
virtual LocalPoint localPosition() const
Local position in Chamber frame.
#define LogTrace(id)
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
virtual int dimension() const
Dimension (in parameter space)
int wire() const
Return the wire number.
Definition: DTWireId.h:58
int superlayer() const
Return the superlayer number (deprecated method name)
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
const DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:105
float recHitPosition(const DTRecHit1DPair &hitPair, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
T x() const
Definition: PV3DBase.h:61
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
void DTCalibValidation::endJob ( void  )
virtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file DTCalibValidation.cc.

References dumpDBToFile_GT_ttrig_cfg::outputFileName, and Parameters::parameters.

105  {
106 
107  LogVerbatim("DTCalibValidation") << "Segments used to compute residuals: " << rightSegment;
108  LogVerbatim("DTCalibValidation") << "Segments not used to compute residuals: " << wrongSegment;
109 
110  //theDbe->showDirStructure();
111  bool outputMEsInRootFile = parameters.getParameter<bool>("OutputMEsInRootFile");
112  std::string outputFileName = parameters.getParameter<std::string>("OutputFileName");
113  if(outputMEsInRootFile){
115  theDbe->save(outputFileName);
116  }
117 
118  theDbe->rmdir("DT/DTCalibValidation");
119 }
T getParameter(std::string const &) const
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
edm::ParameterSet parameters
void showDirStructure(void) const
Definition: DQMStore.cc:2761
void DTCalibValidation::fillHistos ( DTSuperLayerId  slId,
float  distance,
float  residualOnDistance,
float  position,
float  residualOnPosition,
int  step 
)
private

Definition at line 526 of file DTCalibValidation.cc.

References mergeVDriftHistosByStation::histos.

531  {
532  // FIXME: optimization of the number of searches
533  vector<MonitorElement *> histos = histosPerSL[make_pair(slId,step)];
534  histos[0]->Fill(residualOnDistance);
535  histos[1]->Fill(distance, residualOnDistance);
536  if(detailedAnalysis){
537  histos[2]->Fill(residualOnPosition);
538  histos[3]->Fill(position, residualOnPosition);
539  }
540 }
list step
Definition: launcher.py:15
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
static int position[264][3]
Definition: ReadPGInfo.cc:509
template<typename type >
const type * DTCalibValidation::findBestRecHit ( const DTLayer layer,
DTWireId  wireId,
const std::vector< type > &  recHits,
const float  simHitDist 
)
private

Definition at line 243 of file DTCalibValidation.cc.

246  {
247  float res = 99999;
248  const type* theBestRecHit = 0;
249  // Loop over RecHits within the cell
250  for(typename vector<type>::const_iterator recHit = recHits.begin();
251  recHit != recHits.end();
252  ++recHit) {
253  float distTmp = recHitDistFromWire(*recHit, layer);
254  if(fabs(distTmp-segmDist) < res) {
255  res = fabs(distTmp-segmDist);
256  theBestRecHit = &(*recHit);
257  }
258  } // End of loop over RecHits within the cell
259 
260  return theBestRecHit;
261 }
type
Definition: HCALResponse.h:22
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
map< DTWireId, vector< DTRecHit1DPair > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecHitCollection dt1DRecHitPairs)
private

Definition at line 179 of file DTCalibValidation.cc.

References run_regression::ret.

179  {
180  map<DTWireId, vector<DTRecHit1DPair> > ret;
181 
182  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
183  rechit != dt1DRecHitPairs->end(); ++rechit) {
184  ret[(*rechit).wireId()].push_back(*rechit);
185  }
186 
187  return ret;
188 }
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
map< DTWireId, vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment2DCollection segment2Ds)
private

Definition at line 193 of file DTCalibValidation.cc.

References run_regression::ret.

193  {
194  map<DTWireId, vector<DTRecHit1D> > ret;
195 
196  // Loop over all 2D segments
197  for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
198  segment != segment2Ds->end();
199  ++segment) {
200  vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
201  // Loop over all component 1D hits
202  for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
203  hit != component1DHits.end(); ++hit) {
204  ret[(*hit).wireId()].push_back(*hit);
205  }
206  }
207  return ret;
208 }
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
map< DTWireId, std::vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment4DCollection segment4Ds)
private

Definition at line 212 of file DTCalibValidation.cc.

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

212  {
213  map<DTWireId, vector<DTRecHit1D> > ret;
214  // Loop over all 4D segments
215  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
216  segment != segment4Ds->end();
217  ++segment) {
218  // Get component 2D segments
219  vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
220  // Loop over 2D segments:
221  for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
222  segment2D != segment2Ds.end();
223  ++segment2D) {
224  // Get 1D component rechits
225  vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
226  // Loop over them
227  for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
228  hit != hits.end(); ++hit) {
229  const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
230  ret[hit1D->wireId()].push_back(*hit1D);
231  }
232  }
233  }
234 
235  return ret;
236 }
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109
float DTCalibValidation::recHitDistFromWire ( const DTRecHit1DPair hitPair,
const DTLayer layer 
)
private

Definition at line 266 of file DTCalibValidation.cc.

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

266  {
267  return fabs(hitPair.localPosition(DTEnums::Left).x() -
268  hitPair.localPosition(DTEnums::Right).x())/2.;
269 }
T x() const
Definition: PV3DBase.h:61
virtual LocalPoint localPosition() const
float DTCalibValidation::recHitDistFromWire ( const DTRecHit1D recHit,
const DTLayer layer 
)
private

Definition at line 274 of file DTCalibValidation.cc.

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

274  {
275  return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
276 
277  //to check the compatibility position / distance
278  /* // Get the recHit and the wire position
279  const DTChamber* chamber = (*layer).chamber();
280  GlobalPoint recHitPosGlob = layer->toGlobal(recHit.localPosition());
281  LocalPoint recHitPosInChamber = chamber->toLocal(recHitPosGlob);
282  float wireX = layer->specificTopology().wirePosition(recHit.wireId().wire());
283  LocalPoint wirePosInLay(wireX,recHit.localPosition().y(),0);
284  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
285  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
286 
287  float recHitDist = -1;
288  if(recHit.wireId().layerId().superlayerId().superlayer() != 2)
289  recHitDist = fabs(recHitPosInChamber.x()-wirePosInChamber.x());
290  else
291  recHitDist = fabs(recHitPosInChamber.y()-wirePosInChamber.y());
292 
293  return recHitDist; */
294 
295 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
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:61
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:109
float DTCalibValidation::recHitPosition ( const DTRecHit1DPair hitPair,
const DTLayer layer,
const DTChamber chamber,
float  segmPos,
int  sl 
)
private

Definition at line 302 of file DTCalibValidation.cc.

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

302  {
303 
304  // Get the layer and the wire position
305  GlobalPoint hitPosGlob_right = layer->toGlobal(hitPair.localPosition(DTEnums::Right));
306  LocalPoint hitPosInChamber_right = chamber->toLocal(hitPosGlob_right);
307  GlobalPoint hitPosGlob_left = layer->toGlobal(hitPair.localPosition(DTEnums::Left));
308  LocalPoint hitPosInChamber_left = chamber->toLocal(hitPosGlob_left);
309 
310  float recHitPos=-1;
311  if(sl != 2){
312  if(fabs(hitPosInChamber_left.x()-segmentPos)<fabs(hitPosInChamber_right.x()-segmentPos))
313  recHitPos = hitPosInChamber_left.x();
314  else
315  recHitPos = hitPosInChamber_right.x();
316  }
317  else{
318  if(fabs(hitPosInChamber_left.y()-segmentPos)<fabs(hitPosInChamber_right.y()-segmentPos))
319  recHitPos = hitPosInChamber_left.y();
320  else
321  recHitPos = hitPosInChamber_right.y();
322  }
323 
324  return recHitPos;
325 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
T x() const
Definition: PV3DBase.h:61
virtual LocalPoint localPosition() const
float DTCalibValidation::recHitPosition ( const DTRecHit1D recHit,
const DTLayer layer,
const DTChamber chamber,
float  segmPos,
int  sl 
)
private

Definition at line 330 of file DTCalibValidation.cc.

References DTRecHit1D::localPosition(), GeomDet::toGlobal(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

330  {
331 
332  // Get the layer and the wire position
333  GlobalPoint recHitPosGlob = layer->toGlobal(recHit.localPosition());
334  LocalPoint recHitPosInChamber = chamber->toLocal(recHitPosGlob);
335 
336  float recHitPos = -1;
337  if(sl != 2)
338  recHitPos = recHitPosInChamber.x();
339  else
340  recHitPos = recHitPosInChamber.y();
341 
342  return recHitPos;
343 
344 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:62
T x() const
Definition: PV3DBase.h:61

Member Data Documentation

bool DTCalibValidation::detailedAnalysis
private

Definition at line 77 of file DTCalibValidation.h.

edm::ESHandle<DTGeometry> DTCalibValidation::dtGeom
private

Definition at line 79 of file DTCalibValidation.h.

std::map<std::pair<DTSuperLayerId,int>, std::vector<MonitorElement*> > DTCalibValidation::histosPerSL
private

Definition at line 133 of file DTCalibValidation.h.

int DTCalibValidation::nevent
private

Definition at line 75 of file DTCalibValidation.h.

edm::ParameterSet DTCalibValidation::parameters
private
std::string DTCalibValidation::recHits1DLabel
private

Definition at line 82 of file DTCalibValidation.h.

int DTCalibValidation::rightSegment
private

Definition at line 74 of file DTCalibValidation.h.

std::string DTCalibValidation::segment2DLabel
private

Definition at line 84 of file DTCalibValidation.h.

std::string DTCalibValidation::segment4DLabel
private

Definition at line 86 of file DTCalibValidation.h.

DQMStore* DTCalibValidation::theDbe
private

Definition at line 66 of file DTCalibValidation.h.

int DTCalibValidation::wrongSegment
private

Definition at line 73 of file DTCalibValidation.h.