CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DTCalibValidation Class Reference

#include <DTCalibValidation.h>

Inheritance diagram for DTCalibValidation:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c) override
 BeginRun. More...
 
 DTCalibValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
 ~DTCalibValidation () override
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

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
 
const DTGeometrydtGeom
 
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
 
edm::ESGetToken< DTGeometry, MuonGeometryRecordmuonGeomToken_
 
int nevent
 
edm::ParameterSet parameters
 
edm::EDGetTokenT< DTRecHitCollectionrecHits1DToken_
 
int rightSegment
 
edm::EDGetTokenT< DTRecSegment2DCollectionsegment2DToken_
 
edm::EDGetTokenT< DTRecSegment4DCollectionsegment4DToken_
 
int wrongSegment
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Analysis on DT residuals to validate the kFactor

Author
G. Mila - INFN Torino

Definition at line 40 of file DTCalibValidation.h.

Constructor & Destructor Documentation

◆ DTCalibValidation()

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

Constructor.

Definition at line 30 of file DTCalibValidation.cc.

References detailedAnalysis, edm::ParameterSet::getUntrackedParameter(), ProducerED_cfi::InputTag, nevent, parameters, muonDTDigis_cfi::pset, recHits1DToken_, rightSegment, segment2DToken_, segment4DToken_, and wrongSegment.

31  : muonGeomToken_(esConsumes<edm::Transition::BeginRun>()) {
32  parameters = pset;
33 
34  //FR the following was previously in the beginJob
35 
36  // the name of the rechits collection at step 1
38  consumes<DTRecHitCollection>(edm::InputTag(parameters.getUntrackedParameter<string>("recHits1DLabel")));
39  // the name of the 2D segments
41  consumes<DTRecSegment2DCollection>(edm::InputTag(parameters.getUntrackedParameter<string>("segment2DLabel")));
42  // the name of the 4D segments
44  consumes<DTRecSegment4DCollection>(edm::InputTag(parameters.getUntrackedParameter<string>("segment4DLabel")));
45  // the counter of segments not used to compute residuals
46  wrongSegment = 0;
47  // the counter of segments used to compute residuals
48  rightSegment = 0;
49  // the analysis type
50  detailedAnalysis = parameters.getUntrackedParameter<bool>("detailedAnalysis", false);
51 
52  nevent = 0;
53 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
edm::ParameterSet parameters
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_

◆ ~DTCalibValidation()

DTCalibValidation::~DTCalibValidation ( )
override

Destructor.

Definition at line 55 of file DTCalibValidation.cc.

References rightSegment, and wrongSegment.

55  {
56  //FR the following was previously in the endJob
57 
58  LogVerbatim("DTCalibValidation") << "Segments used to compute residuals: " << rightSegment;
59  LogVerbatim("DTCalibValidation") << "Segments not used to compute residuals: " << wrongSegment;
60 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 67 of file DTCalibValidation.cc.

References compute(), detailedAnalysis, dtGeom, LogTrace, map1DRecHitsPerWire(), nevent, edm::Handle< T >::product(), recHits1DToken_, segment2DToken_, and segment4DToken_.

67  {
68  ++nevent;
69  LogTrace("DTCalibValidation") << "[DTCalibValidation] Analyze #Run: " << event.id().run() << " #Event: " << nevent;
70 
71  // RecHit mapping at Step 1 -------------------------------
72  map<DTWireId, vector<DTRecHit1DPair> > recHitsPerWire_1S;
73 
74  // RecHit mapping at Step 2 ------------------------------
75  map<DTWireId, vector<DTRecHit1D> > recHitsPerWire_2S;
76 
77  if (detailedAnalysis) {
78  LogTrace("DTCalibValidation") << " -- DTRecHit S1: begin analysis:";
79  // Get the rechit collection from the event
81  event.getByToken(recHits1DToken_, dtRecHits);
82  recHitsPerWire_1S = map1DRecHitsPerWire(dtRecHits.product());
83 
84  LogTrace("DTCalibValidation") << " -- DTRecHit S2: begin analysis:";
85  // Get the 2D rechits from the event
87  event.getByToken(segment2DToken_, segment2Ds);
88  recHitsPerWire_2S = map1DRecHitsPerWire(segment2Ds.product());
89  }
90 
91  // RecHit mapping at Step 3 ---------------------------------
92  LogTrace("DTCalibValidation") << " -- DTRecHit S3: begin analysis:";
93  // Get the 4D rechits from the event
95  event.getByToken(segment4DToken_, segment4Ds);
96  map<DTWireId, vector<DTRecHit1D> > recHitsPerWire_3S = map1DRecHitsPerWire(segment4Ds.product());
97 
98  // Loop over all 4D segments
99  for (DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin(); segment != segment4Ds->end();
100  ++segment) {
101  if (detailedAnalysis) {
102  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 1";
103  compute(dtGeom, (*segment), recHitsPerWire_1S, 1);
104 
105  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 2";
106  compute(dtGeom, (*segment), recHitsPerWire_2S, 2);
107  }
108 
109  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 3";
110  compute(dtGeom, (*segment), recHitsPerWire_3S, 3);
111  }
112 }
const DTGeometry * dtGeom
T const * product() const
Definition: Handle.h:70
#define LogTrace(id)
void compute(const DTGeometry *dtGeom, const DTRecSegment4D &segment, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_

◆ bookHistograms()

void DTCalibValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 374 of file DTCalibValidation.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), DTGeometry::chambers(), detailedAnalysis, dtGeom, combine::histos, histosPerSL, LogTrace, hgcalTBTopologyTester_cfi::sector, DTChamberId::sector(), dqm::implementation::NavigatorBase::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

376  {
377  //FR substitute the DQMStore instance by ibooker
378  ibooker.setCurrentFolder("DT/DTCalibValidation");
379 
380  DTSuperLayerId slId;
381 
382  // Loop over all the chambers
383  vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
384  vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
385  for (; ch_it != ch_end; ++ch_it) {
386  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
387  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
388  // Loop over the SLs
389  for (; sl_it != sl_end; ++sl_it) {
390  slId = (*sl_it)->id();
391 
392  int firstStep = 1;
393  if (!detailedAnalysis)
394  firstStep = 3;
395  // Loop over the 3 steps
396  for (int step = firstStep; step <= 3; ++step) {
397  LogTrace("DTCalibValidation") << " Booking histos for SL: " << slId;
398 
399  // Compose the chamber name
400  stringstream wheel;
401  wheel << slId.wheel();
402  stringstream station;
403  station << slId.station();
404  stringstream sector;
405  sector << slId.sector();
406  stringstream superLayer;
407  superLayer << slId.superlayer();
408  // Define the step
409  stringstream Step;
410  Step << step;
411 
412  string slHistoName = "_STEP" + Step.str() + "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() +
413  "_SL" + superLayer.str();
414 
415  ibooker.setCurrentFolder("DT/DTCalibValidation/Wheel" + wheel.str() + "/Station" + station.str() + "/Sector" +
416  sector.str());
417  // Create the monitor elements
418  vector<MonitorElement*> histos;
419  // Note the order matters
420  histos.push_back(ibooker.book1D(
421  "hResDist" + slHistoName, "Residuals on the distance from wire (rec_hit - segm_extr) (cm)", 200, -0.4, 0.4));
422  histos.push_back(
423  ibooker.book2D("hResDistVsDist" + slHistoName,
424  "Residuals on the distance (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
425  100,
426  0,
427  2.5,
428  200,
429  -0.4,
430  0.4));
431  if (detailedAnalysis) {
432  histos.push_back(ibooker.book1D("hResPos" + slHistoName,
433  "Residuals on the position from wire (rec_hit - segm_extr) (cm)",
434  200,
435  -0.4,
436  0.4));
437  histos.push_back(
438  ibooker.book2D("hResPosVsPos" + slHistoName,
439  "Residuals on the position (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
440  200,
441  -2.5,
442  2.5,
443  200,
444  -0.4,
445  0.4));
446  }
447 
448  histosPerSL[make_pair(slId, step)] = histos;
449  }
450  }
451  }
452 }
int station() const
Return the station number.
Definition: DTChamberId.h:42
const DTGeometry * dtGeom
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
#define LogTrace(id)
int superlayer() const
Return the superlayer number (deprecated method name)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
histos
Definition: combine.py:4
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
int sector() const
Definition: DTChamberId.h:49
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
Definition: DTGeometry.cc:84
step
Definition: StallMonitor.cc:98
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookHistos()

void DTCalibValidation::bookHistos ( DTSuperLayerId  slId,
int  step 
)
private

◆ compute()

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 241 of file DTCalibValidation.cc.

References relativeConstraints::chamber, DTGeometry::chamber(), filterCSVwithJSON::copy, funct::cos(), DTRecSegment4D::dimension(), dtGeom, fillHistos(), findBestRecHit(), DTGeometry::layer(), pixelTopology::layer, DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), LogTrace, DTRecSegment4D::phiSegment(), recHitDistFromWire(), recHitPosition(), FastTrackerRecHitMaskProducer_cfi::recHits, rightSegment, DTRecSegment2D::specificRecHits(), DTSuperLayerId::superlayer(), PV3DBase< T, PVType, FrameType >::theta(), DTWireId::wire(), wrongSegment, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().

Referenced by analyze().

244  {
245  bool computeResidual = true;
246 
247  // Get all 1D RecHits at step 3 within the 4D segment
248  vector<DTRecHit1D> recHits1D_S3;
249 
250  // Get 1D RecHits at Step 3 and select only events with
251  // 8 hits in phi and 4 hits in theta (if any)
252  const DTChamberRecSegment2D* phiSeg = segment.phiSegment();
253  if (phiSeg) {
254  vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
255  if (phiRecHits.size() != 8) {
256  LogTrace("DTCalibValidation") << "[DTCalibValidation] Phi segments has: " << phiRecHits.size()
257  << " hits, skipping"; // FIXME: info output
258  computeResidual = false;
259  }
260  copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
261  }
262  if (!phiSeg) {
263  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the phi segment! ";
264  computeResidual = false;
265  }
266 
267  if (segment.dimension() == 4) {
268  const DTSLRecSegment2D* zSeg = segment.zSegment();
269  if (zSeg) {
270  vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
271  if (zRecHits.size() != 4) {
272  LogTrace("DTCalibValidation") << "[DTCalibValidation] Theta segments has: " << zRecHits.size()
273  << " hits, skipping"; // FIXME: info output
274  computeResidual = false;
275  }
276  copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
277  }
278  if (!zSeg) {
279  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the z segment! ";
280  computeResidual = false;
281  }
282  }
283 
284  if (!computeResidual)
285  ++wrongSegment;
286  if (computeResidual) {
287  ++rightSegment;
288  // Loop over 1D RecHit inside 4D segment
289  for (vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin(); recHit1D != recHits1D_S3.end();
290  ++recHit1D) {
291  const DTWireId wireId = (*recHit1D).wireId();
292 
293  // Get the layer and the wire position
294  const DTLayer* layer = dtGeom->layer(wireId);
295  float wireX = layer->specificTopology().wirePosition(wireId.wire());
296 
297  // Extrapolate the segment to the z of the wire
298  // Get wire position in chamber RF
299  // (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)
300  LocalPoint wirePosInLay(wireX, (*recHit1D).localPosition().y(), (*recHit1D).localPosition().z());
301  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
302  const DTChamber* chamber = dtGeom->chamber((*recHit1D).wireId().layerId().chamberId());
303  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
304 
305  // Segment position at Wire z in chamber local frame
306  LocalPoint segPosAtZWire = segment.localPosition() + segment.localDirection() * wirePosInChamber.z() /
307  cos(segment.localDirection().theta());
308 
309  // Compute the distance of the segment from the wire
310  int sl = wireId.superlayer();
311  float SegmDistance = -1;
312  if (sl == 1 || sl == 3) {
313  // RPhi SL
314  SegmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
315  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
316  } else if (sl == 2) {
317  // RZ SL
318  SegmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
319  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
320  }
321  if (SegmDistance > 2.1)
322  LogTrace("DTCalibValidation") << " Warning: dist segment-wire: " << SegmDistance;
323 
324  // Look for RecHits in the same cell
325  if (recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
326  LogTrace("DTCalibValidation") << " No RecHit found at Step: " << step << " in cell: " << wireId;
327  } else {
328  const vector<type>& recHits = recHitsPerWire.at(wireId);
329  LogTrace("DTCalibValidation") << " " << recHits.size() << " RecHits, Step " << step
330  << " in channel: " << wireId;
331 
332  // Get the layer
333  const DTLayer* layer = dtGeom->layer(wireId);
334  // Find the best RecHits
335  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, SegmDistance);
336  // Compute the distance of the recHit from the wire
337  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
338  LogTrace("DTCalibValidation") << "recHitWireDist: " << recHitWireDist;
339 
340  // Compute the residuals
341  float residualOnDistance = recHitWireDist - SegmDistance;
342  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnDistance: " << residualOnDistance;
343  float residualOnPosition = -1;
344  float recHitPos = -1;
345  if (sl == 1 || sl == 3) {
346  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.x(), sl);
347  residualOnPosition = recHitPos - segPosAtZWire.x();
348  } else {
349  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.y(), sl);
350  residualOnPosition = recHitPos - segPosAtZWire.y();
351  }
352  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnPosition: " << residualOnPosition;
353 
354  // Fill the histos
355  if (sl == 1 || sl == 3)
356  fillHistos(wireId.superlayerId(),
357  SegmDistance,
358  residualOnDistance,
359  (wirePosInChamber.x() - segPosAtZWire.x()),
360  residualOnPosition,
361  step);
362  else
363  fillHistos(wireId.superlayerId(),
364  SegmDistance,
365  residualOnDistance,
366  (wirePosInChamber.y() - segPosAtZWire.y()),
367  residualOnPosition,
368  step);
369  }
370  }
371  }
372 }
const DTGeometry * dtGeom
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
int wire() const
Return the wire number.
Definition: DTWireId.h:42
T z() const
Definition: PV3DBase.h:61
LocalVector localDirection() const override
Local direction in Chamber frame.
int dimension() const override
Dimension (in parameter space)
LocalPoint localPosition() const override
Local position in Chamber frame.
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
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)
int superlayer() const
Return the superlayer number (deprecated method name)
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
step
Definition: StallMonitor.cc:98
float recHitPosition(const DTRecHit1DPair &hitPair, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

◆ dqmBeginRun()

void DTCalibValidation::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

BeginRun.

Reimplemented from DQMEDAnalyzer.

Definition at line 62 of file DTCalibValidation.cc.

References dtGeom, muonGeomToken_, and singleTopDQM_cfi::setup.

62  {
63  // get the geometry
64  dtGeom = &setup.getData(muonGeomToken_);
65 }
const DTGeometry * dtGeom
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_

◆ fillHistos()

void DTCalibValidation::fillHistos ( DTSuperLayerId  slId,
float  distance,
float  residualOnDistance,
float  position,
float  residualOnPosition,
int  step 
)
private

Definition at line 455 of file DTCalibValidation.cc.

References detailedAnalysis, HLT_2023v12_cff::distance, combine::histos, histosPerSL, and position.

Referenced by compute().

456  {
457  // FIXME: optimization of the number of searches
458  vector<MonitorElement*> histos = histosPerSL[make_pair(slId, step)];
459  histos[0]->Fill(residualOnDistance);
460  histos[1]->Fill(distance, residualOnDistance);
461  if (detailedAnalysis) {
462  histos[2]->Fill(residualOnPosition);
463  histos[3]->Fill(position, residualOnPosition);
464  }
465 }
histos
Definition: combine.py:4
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
step
Definition: StallMonitor.cc:98

◆ findBestRecHit()

template<typename type >
const type * DTCalibValidation::findBestRecHit ( const DTLayer layer,
DTWireId  wireId,
const std::vector< type > &  recHits,
const float  simHitDist 
)
private

Definition at line 170 of file DTCalibValidation.cc.

References pixelTopology::layer, rpcPointValidation_cfi::recHit, recHitDistFromWire(), and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by compute().

173  {
174  float res = 99999;
175  const type* theBestRecHit = nullptr;
176  // Loop over RecHits within the cell
177  for (typename vector<type>::const_iterator recHit = recHits.begin(); recHit != recHits.end(); ++recHit) {
178  float distTmp = recHitDistFromWire(*recHit, layer);
179  if (fabs(distTmp - segmDist) < res) {
180  res = fabs(distTmp - segmDist);
181  theBestRecHit = &(*recHit);
182  }
183  } // End of loop over RecHits within the cell
184 
185  return theBestRecHit;
186 }
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
Definition: Electron.h:6
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer

◆ map1DRecHitsPerWire() [1/3]

map< DTWireId, vector< DTRecHit1DPair > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecHitCollection dt1DRecHitPairs)
private

Definition at line 115 of file DTCalibValidation.cc.

References runTheMatrix::ret.

Referenced by analyze().

116  {
117  map<DTWireId, vector<DTRecHit1DPair> > ret;
118 
119  for (DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin(); rechit != dt1DRecHitPairs->end();
120  ++rechit) {
121  ret[(*rechit).wireId()].push_back(*rechit);
122  }
123 
124  return ret;
125 }
ret
prodAgent to be discontinued
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43

◆ map1DRecHitsPerWire() [2/3]

map< DTWireId, vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment2DCollection segment2Ds)
private

Definition at line 128 of file DTCalibValidation.cc.

References runTheMatrix::ret.

128  {
129  map<DTWireId, vector<DTRecHit1D> > ret;
130 
131  // Loop over all 2D segments
132  for (DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin(); segment != segment2Ds->end();
133  ++segment) {
134  vector<DTRecHit1D> component1DHits = (*segment).specificRecHits();
135  // Loop over all component 1D hits
136  for (vector<DTRecHit1D>::const_iterator hit = component1DHits.begin(); hit != component1DHits.end(); ++hit) {
137  ret[(*hit).wireId()].push_back(*hit);
138  }
139  }
140  return ret;
141 }
ret
prodAgent to be discontinued
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43

◆ map1DRecHitsPerWire() [3/3]

map< DTWireId, std::vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment4DCollection segment4Ds)
private

Definition at line 144 of file DTCalibValidation.cc.

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

145  {
146  map<DTWireId, vector<DTRecHit1D> > ret;
147  // Loop over all 4D segments
148  for (DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin(); segment != segment4Ds->end();
149  ++segment) {
150  // Get component 2D segments
151  vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
152  // Loop over 2D segments:
153  for (vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin(); segment2D != segment2Ds.end();
154  ++segment2D) {
155  // Get 1D component rechits
156  vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
157  // Loop over them
158  for (vector<const TrackingRecHit*>::const_iterator hit = hits.begin(); hit != hits.end(); ++hit) {
159  const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
160  ret[hit1D->wireId()].push_back(*hit1D);
161  }
162  }
163  }
164 
165  return ret;
166 }
ret
prodAgent to be discontinued
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:76

◆ recHitDistFromWire() [1/2]

float DTCalibValidation::recHitDistFromWire ( const DTRecHit1DPair hitPair,
const DTLayer layer 
)
private

Definition at line 189 of file DTCalibValidation.cc.

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

Referenced by compute(), and findBestRecHit().

189  {
190  return fabs(hitPair.localPosition(DTEnums::Left).x() - hitPair.localPosition(DTEnums::Right).x()) / 2.;
191 }
LocalPoint localPosition() const override
T x() const
Definition: PV3DBase.h:59

◆ recHitDistFromWire() [2/2]

float DTCalibValidation::recHitDistFromWire ( const DTRecHit1D recHit,
const DTLayer layer 
)
private

Definition at line 194 of file DTCalibValidation.cc.

References pixelTopology::layer, and rpcPointValidation_cfi::recHit.

194  {
195  return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
196 }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer

◆ recHitPosition() [1/2]

float DTCalibValidation::recHitPosition ( const DTRecHit1DPair hitPair,
const DTLayer layer,
const DTChamber chamber,
float  segmPos,
int  sl 
)
private

Definition at line 199 of file DTCalibValidation.cc.

References relativeConstraints::chamber, pixelTopology::layer, DTEnums::Left, DTRecHit1DPair::localPosition(), DTEnums::Right, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by compute().

200  {
201  // Get the layer and the wire position
202  GlobalPoint hitPosGlob_right = layer->toGlobal(hitPair.localPosition(DTEnums::Right));
203  LocalPoint hitPosInChamber_right = chamber->toLocal(hitPosGlob_right);
204  GlobalPoint hitPosGlob_left = layer->toGlobal(hitPair.localPosition(DTEnums::Left));
205  LocalPoint hitPosInChamber_left = chamber->toLocal(hitPosGlob_left);
206 
207  float recHitPos = -1;
208  if (sl != 2) {
209  if (fabs(hitPosInChamber_left.x() - segmentPos) < fabs(hitPosInChamber_right.x() - segmentPos))
210  recHitPos = hitPosInChamber_left.x();
211  else
212  recHitPos = hitPosInChamber_right.x();
213  } else {
214  if (fabs(hitPosInChamber_left.y() - segmentPos) < fabs(hitPosInChamber_right.y() - segmentPos))
215  recHitPos = hitPosInChamber_left.y();
216  else
217  recHitPos = hitPosInChamber_right.y();
218  }
219 
220  return recHitPos;
221 }
LocalPoint localPosition() const override
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60

◆ recHitPosition() [2/2]

float DTCalibValidation::recHitPosition ( const DTRecHit1D recHit,
const DTLayer layer,
const DTChamber chamber,
float  segmPos,
int  sl 
)
private

Definition at line 224 of file DTCalibValidation.cc.

References relativeConstraints::chamber, pixelTopology::layer, rpcPointValidation_cfi::recHit, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

225  {
226  // Get the layer and the wire position
227  GlobalPoint recHitPosGlob = layer->toGlobal(recHit.localPosition());
228  LocalPoint recHitPosInChamber = chamber->toLocal(recHitPosGlob);
229 
230  float recHitPos = -1;
231  if (sl != 2)
232  recHitPos = recHitPosInChamber.x();
233  else
234  recHitPos = recHitPosInChamber.y();
235 
236  return recHitPos;
237 }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60

Member Data Documentation

◆ detailedAnalysis

bool DTCalibValidation::detailedAnalysis
private

Definition at line 65 of file DTCalibValidation.h.

Referenced by analyze(), bookHistograms(), DTCalibValidation(), and fillHistos().

◆ dtGeom

const DTGeometry* DTCalibValidation::dtGeom
private

Definition at line 68 of file DTCalibValidation.h.

Referenced by analyze(), bookHistograms(), compute(), and dqmBeginRun().

◆ histosPerSL

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

Definition at line 119 of file DTCalibValidation.h.

Referenced by bookHistograms(), and fillHistos().

◆ muonGeomToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTCalibValidation::muonGeomToken_
private

Definition at line 67 of file DTCalibValidation.h.

Referenced by dqmBeginRun().

◆ nevent

int DTCalibValidation::nevent
private

Definition at line 63 of file DTCalibValidation.h.

Referenced by analyze(), and DTCalibValidation().

◆ parameters

edm::ParameterSet DTCalibValidation::parameters
private

Definition at line 60 of file DTCalibValidation.h.

Referenced by DTCalibValidation().

◆ recHits1DToken_

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

Definition at line 71 of file DTCalibValidation.h.

Referenced by analyze(), and DTCalibValidation().

◆ rightSegment

int DTCalibValidation::rightSegment
private

Definition at line 62 of file DTCalibValidation.h.

Referenced by compute(), DTCalibValidation(), and ~DTCalibValidation().

◆ segment2DToken_

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

Definition at line 73 of file DTCalibValidation.h.

Referenced by analyze(), and DTCalibValidation().

◆ segment4DToken_

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

Definition at line 75 of file DTCalibValidation.h.

Referenced by analyze(), and DTCalibValidation().

◆ wrongSegment

int DTCalibValidation::wrongSegment
private

Definition at line 61 of file DTCalibValidation.h.

Referenced by compute(), DTCalibValidation(), and ~DTCalibValidation().