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

Detailed Description

Analysis on DT residuals to validate the kFactor

Date:
2010/01/05 10:14:39
Revision:
1.6
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 cmsCodeRules.cppFunctionSkipper::operator, ExpressReco_HICollisions_FallBack::parameters, and CrabTask::pset.

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 }
tuple pset
Definition: CrabTask.py:85
edm::ParameterSet parameters
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
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 124 of file DTCalibValidation.cc.

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

124  {
125 
126  ++nevent;
127  LogTrace("DTCalibValidation") << "[DTCalibValidation] Analyze #Run: " << event.id().run()
128  << " #Event: " << nevent;
129 
130  // RecHit mapping at Step 1 -------------------------------
131  map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire_1S;
132 
133  // RecHit mapping at Step 2 ------------------------------
134  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire_2S;
135 
136  if(detailedAnalysis){
137  LogTrace("DTCalibValidation") << " -- DTRecHit S1: begin analysis:";
138  // Get the rechit collection from the event
139  Handle<DTRecHitCollection> dtRecHits;
140  event.getByLabel(recHits1DLabel, dtRecHits);
141  recHitsPerWire_1S = map1DRecHitsPerWire(dtRecHits.product());
142 
143  LogTrace("DTCalibValidation") << " -- DTRecHit S2: begin analysis:";
144  // Get the 2D rechits from the event
146  event.getByLabel(segment2DLabel, segment2Ds);
147  recHitsPerWire_2S = map1DRecHitsPerWire(segment2Ds.product());
148  }
149 
150  // RecHit mapping at Step 3 ---------------------------------
151  LogTrace("DTCalibValidation") << " -- DTRecHit S3: begin analysis:";
152  // Get the 4D rechits from the event
154  event.getByLabel(segment4DLabel, segment4Ds);
155  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire_3S = map1DRecHitsPerWire(segment4Ds.product());
156 
157 
158  // Loop over all 4D segments
159  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
160  segment != segment4Ds->end();
161  ++segment) {
162 
163  if(detailedAnalysis){
164  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 1";
165  compute(dtGeom.product(), (*segment), recHitsPerWire_1S, 1);
166 
167  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 2";
168  compute(dtGeom.product(), (*segment), recHitsPerWire_2S, 2);
169  }
170 
171  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 3";
172  compute(dtGeom.product(), (*segment), recHitsPerWire_3S, 3);
173  }
174 
175 }
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 ExpressReco_HICollisions_FallBack::detailedAnalysis, nevent, ExpressReco_HICollisions_FallBack::parameters, and ExpressReco_HICollisions_FallBack::recHits1DLabel.

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(), ExpressReco_HICollisions_FallBack::detailedAnalysis, edm::EventSetup::get(), and ExpressReco_HICollisions_FallBack::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  DTChamberId chId = (*ch_it)->id();
88  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
89  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
90  // Loop over the SLs
91  for(; sl_it != sl_end; ++sl_it) {
92  DTSuperLayerId slId = (*sl_it)->id();
93  if(detailedAnalysis){
94  // Loop over the 3 steps
95  for(int step = 1; step <= 3; ++step) bookHistos(slId,step);
96  } else {
97  // Only step 3
98  bookHistos(slId,3);
99  }
100  }
101  }
102 
103 }
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 481 of file DTCalibValidation.cc.

References ExpressReco_HICollisions_FallBack::detailedAnalysis, combine::histos, LogTrace, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, cmsPerfCommons::Step, ExpressReco_HICollisions_FallBack::step, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

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

354  {
355  bool computeResidual = true;
356 
357  // Get all 1D RecHits at step 3 within the 4D segment
358  vector<DTRecHit1D> recHits1D_S3;
359 
360  // Get 1D RecHits at Step 3 and select only events with
361  // 8 hits in phi and 4 hits in theta (if any)
362  const DTChamberRecSegment2D* phiSeg = segment.phiSegment();
363  if(phiSeg){
364  vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
365  if(phiRecHits.size() != 8) {
366  LogTrace("DTCalibValidation") << "[DTCalibValidation] Phi segments has: " << phiRecHits.size()
367  << " hits, skipping"; // FIXME: info output
368  computeResidual = false;
369  }
370  copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
371  }
372  if(!phiSeg){
373  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the phi segment! ";
374  computeResidual = false;
375  }
376 
377  if(segment.dimension() == 4) {
378  const DTSLRecSegment2D* zSeg = segment.zSegment();
379  if(zSeg){
380  vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
381  if(zRecHits.size() != 4) {
382  LogTrace("DTCalibValidation") << "[DTCalibValidation] Theta segments has: " << zRecHits.size()
383  << " hits, skipping"; // FIXME: info output
384  computeResidual = false;
385  }
386  copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
387  }
388  if(!zSeg){
389  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the z segment! ";
390  computeResidual = false;
391  }
392  }
393 
394  if(!computeResidual)
395  ++wrongSegment;
396  if(computeResidual){
397  ++rightSegment;
398  // Loop over 1D RecHit inside 4D segment
399  for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
400  recHit1D != recHits1D_S3.end();
401  ++recHit1D) {
402  const DTWireId wireId = (*recHit1D).wireId();
403 
404  // Get the layer and the wire position
405  const DTLayer* layer = dtGeom->layer(wireId);
406  float wireX = layer->specificTopology().wirePosition(wireId.wire());
407 
408  // Extrapolate the segment to the z of the wire
409  // Get wire position in chamber RF
410  // (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)
411  LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
412  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
413  const DTChamber* chamber = dtGeom->chamber((*recHit1D).wireId().layerId().chamberId());
414  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
415 
416  // Segment position at Wire z in chamber local frame
417  LocalPoint segPosAtZWire = segment.localPosition()
418  + segment.localDirection()*wirePosInChamber.z()/cos(segment.localDirection().theta());
419 
420  // Compute the distance of the segment from the wire
421  int sl = wireId.superlayer();
422  float SegmDistance = -1;
423  if(sl == 1 || sl == 3) {
424  // RPhi SL
425  SegmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
426  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
427  } else if(sl == 2) {
428  // RZ SL
429  SegmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
430  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
431  }
432  if(SegmDistance > 2.1)
433  LogTrace("DTCalibValidation") << " Warning: dist segment-wire: " << SegmDistance;
434 
435  // Look for RecHits in the same cell
436  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
437  LogTrace("DTCalibValidation") << " No RecHit found at Step: " << step << " in cell: " << wireId;
438  } else {
439  vector<type> recHits = recHitsPerWire[wireId];
440  LogTrace("DTCalibValidation") << " " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId;
441 
442  // Get the layer
443  const DTLayer* layer = dtGeom->layer(wireId);
444  // Find the best RecHits
445  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, SegmDistance);
446  // Compute the distance of the recHit from the wire
447  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
448  LogTrace("DTCalibValidation") << "recHitWireDist: " << recHitWireDist;
449 
450  // Compute the residuals
451  float residualOnDistance = recHitWireDist - SegmDistance;
452  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnDistance: " << residualOnDistance;
453  float residualOnPosition = -1;
454  float recHitPos = -1;
455  if(sl == 1 || sl == 3) {
456  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.x(), sl);
457  residualOnPosition = recHitPos - segPosAtZWire.x();
458  }
459  else{
460  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.y(), sl);
461  residualOnPosition = recHitPos - segPosAtZWire.y();
462  }
463  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnPosition: " << residualOnPosition;
464 
465  // Fill the histos
466  if(sl == 1 || sl == 3)
467  fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.x() - segPosAtZWire.x()), residualOnPosition, step);
468  else
469  fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.y() - segPosAtZWire.y()), residualOnPosition, step);
470 
471 
472  }
473  }
474  }
475 
476 }
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:73
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
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:49
T y() const
Definition: PV3DBase.h:57
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:64
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
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:58
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:56
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 106 of file DTCalibValidation.cc.

References ExpressReco_HICollisions_FallBack::outputFileName, and ExpressReco_HICollisions_FallBack::parameters.

106  {
107 
108  LogVerbatim("DTCalibValidation") << "Segments used to compute residuals: " << rightSegment;
109  LogVerbatim("DTCalibValidation") << "Segments not used to compute residuals: " << wrongSegment;
110 
111  //theDbe->showDirStructure();
112  bool outputMEsInRootFile = parameters.getParameter<bool>("OutputMEsInRootFile");
113  std::string outputFileName = parameters.getParameter<std::string>("OutputFileName");
114  if(outputMEsInRootFile){
116  theDbe->save(outputFileName);
117  }
118 
119  theDbe->rmdir("DT/DTCalibValidation");
120 }
T getParameter(std::string const &) const
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2296
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:1883
edm::ParameterSet parameters
void showDirStructure(void) const
Definition: DQMStore.cc:2539
void DTCalibValidation::fillHistos ( DTSuperLayerId  slId,
float  distance,
float  residualOnDistance,
float  position,
float  residualOnPosition,
int  step 
)
private

Definition at line 527 of file DTCalibValidation.cc.

References ExpressReco_HICollisions_FallBack::detailedAnalysis, and combine::histos.

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

Definition at line 244 of file DTCalibValidation.cc.

247  {
248  float res = 99999;
249  const type* theBestRecHit = 0;
250  // Loop over RecHits within the cell
251  for(typename vector<type>::const_iterator recHit = recHits.begin();
252  recHit != recHits.end();
253  ++recHit) {
254  float distTmp = recHitDistFromWire(*recHit, layer);
255  if(fabs(distTmp-segmDist) < res) {
256  res = fabs(distTmp-segmDist);
257  theBestRecHit = &(*recHit);
258  }
259  } // End of loop over RecHits within the cell
260 
261  return theBestRecHit;
262 }
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 180 of file DTCalibValidation.cc.

References runTheMatrix::ret.

180  {
181  map<DTWireId, vector<DTRecHit1DPair> > ret;
182 
183  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
184  rechit != dt1DRecHitPairs->end(); ++rechit) {
185  ret[(*rechit).wireId()].push_back(*rechit);
186  }
187 
188  return ret;
189 }
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 194 of file DTCalibValidation.cc.

References runTheMatrix::ret.

194  {
195  map<DTWireId, vector<DTRecHit1D> > ret;
196 
197  // Loop over all 2D segments
198  for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
199  segment != segment2Ds->end();
200  ++segment) {
201  vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
202  // Loop over all component 1D hits
203  for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
204  hit != component1DHits.end(); ++hit) {
205  ret[(*hit).wireId()].push_back(*hit);
206  }
207  }
208  return ret;
209 }
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 213 of file DTCalibValidation.cc.

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

213  {
214  map<DTWireId, vector<DTRecHit1D> > ret;
215  // Loop over all 4D segments
216  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
217  segment != segment4Ds->end();
218  ++segment) {
219  // Get component 2D segments
220  vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
221  // Loop over 2D segments:
222  for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
223  segment2D != segment2Ds.end();
224  ++segment2D) {
225  // Get 1D component rechits
226  vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
227  // Loop over them
228  for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
229  hit != hits.end(); ++hit) {
230  const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
231  ret[hit1D->wireId()].push_back(*hit1D);
232  }
233  }
234  }
235 
236  return ret;
237 }
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 267 of file DTCalibValidation.cc.

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

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

Definition at line 275 of file DTCalibValidation.cc.

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

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

Definition at line 303 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().

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

Definition at line 331 of file DTCalibValidation.cc.

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

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

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.