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 edm::EDConsumerBase

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void bookHistos (DTSuperLayerId slId, int step)
 
template<typename type >
void compute (const DTGeometry *dtGeom, const DTRecSegment4D &segment, const 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
 
edm::EDGetTokenT
< DTRecHitCollection
recHits1DToken_
 
int rightSegment
 
edm::EDGetTokenT
< DTRecSegment2DCollection
segment2DToken_
 
edm::EDGetTokenT
< DTRecSegment4DCollection
segment4DToken_
 
DQMStoretheDbe
 
int wrongSegment
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Analysis on DT residuals to validate the kFactor

Author
G. Mila - INFN Torino

Definition at line 38 of file DTCalibValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 34 of file DTCalibValidation.cc.

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

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

Destructor.

Definition at line 53 of file DTCalibValidation.cc.

53  {
54 }

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(), LogTrace, nevent, and edm::Handle< T >::product().

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.getByToken(recHits1DToken_, 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.getByToken(segment2DToken_, 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.getByToken(segment4DToken_, 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
void compute(const DTGeometry *dtGeom, const DTRecSegment4D &segment, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
#define LogTrace(id)
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_
void DTCalibValidation::beginJob ( void  )
virtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file DTCalibValidation.cc.

References nevent, and Parameters::parameters.

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 79 of file DTCalibValidation.cc.

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

79  {
80 
81  // get the geometry
82  setup.get<MuonGeometryRecord>().get(dtGeom);
83 
84  // Loop over all the chambers
85  vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
86  vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
87  for (; ch_it != ch_end; ++ch_it) {
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 mergeVDriftHistosByStation::histos, LogTrace, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, cmsPerfCommons::Step, relval_parameters_module::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:942
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:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
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:1070
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
template<typename type >
void DTCalibValidation::compute ( const DTGeometry dtGeom,
const DTRecSegment4D segment,
const 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.at(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:21
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
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:47
T y() const
Definition: PV3DBase.h:63
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:75
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
virtual LocalVector localDirection() const
Local direction in Chamber frame.
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
T z() const
Definition: PV3DBase.h:64
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:56
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:100
float recHitPosition(const DTRecHit1DPair &hitPair, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
T x() const
Definition: PV3DBase.h:62
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 dumpDBToFile_GT_ttrig_cfg::outputFileName, Parameters::parameters, and AlCaHLTBitMon_QueryRunRegistry::string.

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");
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:3046
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2485
edm::ParameterSet parameters
void showDirStructure(void) const
Definition: DQMStore.cc:3277
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 mergeVDriftHistosByStation::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
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:21
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 run_regression::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 }
map< DTWireId, vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment2DCollection segment2Ds)
private

Definition at line 194 of file DTCalibValidation.cc.

References run_regression::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 }
map< DTWireId, std::vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment4DCollection segment4Ds)
private

Definition at line 213 of file DTCalibValidation.cc.

References run_regression::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 }
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
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:62
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:86
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
int wire() const
Return the wire number.
Definition: DTWireId.h:56
T x() const
Definition: PV3DBase.h:62
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
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:47
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
T x() const
Definition: PV3DBase.h:62
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:47
T y() const
Definition: PV3DBase.h:63
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:60
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

bool DTCalibValidation::detailedAnalysis
private

Definition at line 75 of file DTCalibValidation.h.

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

Definition at line 77 of file DTCalibValidation.h.

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

Definition at line 131 of file DTCalibValidation.h.

int DTCalibValidation::nevent
private

Definition at line 73 of file DTCalibValidation.h.

edm::ParameterSet DTCalibValidation::parameters
private
edm::EDGetTokenT<DTRecHitCollection> DTCalibValidation::recHits1DToken_
private

Definition at line 80 of file DTCalibValidation.h.

int DTCalibValidation::rightSegment
private

Definition at line 72 of file DTCalibValidation.h.

edm::EDGetTokenT<DTRecSegment2DCollection> DTCalibValidation::segment2DToken_
private

Definition at line 82 of file DTCalibValidation.h.

edm::EDGetTokenT<DTRecSegment4DCollection> DTCalibValidation::segment4DToken_
private

Definition at line 84 of file DTCalibValidation.h.

DQMStore* DTCalibValidation::theDbe
private

Definition at line 64 of file DTCalibValidation.h.

int DTCalibValidation::wrongSegment
private

Definition at line 71 of file DTCalibValidation.h.