CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
void dqmBeginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
 DTCalibValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~DTCalibValidation ()
 Destructor. More...
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
 
- 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)
 

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_
 
int wrongSegment
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Analysis on DT residuals to validate the kFactor

Author
G. Mila - INFN Torino

Definition at line 43 of file DTCalibValidation.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 34 of file DTCalibValidation.cc.

References HLT_25ns14e33_v1_cff::InputTag, nevent, and Parameters::parameters.

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

Destructor.

Definition at line 61 of file DTCalibValidation.cc.

61  {
62 
63  //FR the following was previously in the endJob
64 
65  LogVerbatim("DTCalibValidation") << "Segments used to compute residuals: " << rightSegment;
66  LogVerbatim("DTCalibValidation") << "Segments not used to compute residuals: " << wrongSegment;
67 
68 }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 77 of file DTCalibValidation.cc.

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

77  {
78 
79  ++nevent;
80  LogTrace("DTCalibValidation") << "[DTCalibValidation] Analyze #Run: " << event.id().run()
81  << " #Event: " << nevent;
82 
83  // RecHit mapping at Step 1 -------------------------------
84  map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire_1S;
85 
86  // RecHit mapping at Step 2 ------------------------------
87  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire_2S;
88 
89  if(detailedAnalysis){
90  LogTrace("DTCalibValidation") << " -- DTRecHit S1: begin analysis:";
91  // Get the rechit collection from the event
93  event.getByToken(recHits1DToken_, dtRecHits);
94  recHitsPerWire_1S = map1DRecHitsPerWire(dtRecHits.product());
95 
96  LogTrace("DTCalibValidation") << " -- DTRecHit S2: begin analysis:";
97  // Get the 2D rechits from the event
99  event.getByToken(segment2DToken_, segment2Ds);
100  recHitsPerWire_2S = map1DRecHitsPerWire(segment2Ds.product());
101  }
102 
103  // RecHit mapping at Step 3 ---------------------------------
104  LogTrace("DTCalibValidation") << " -- DTRecHit S3: begin analysis:";
105  // Get the 4D rechits from the event
107  event.getByToken(segment4DToken_, segment4Ds);
108  map<DTWireId,vector<DTRecHit1D> > recHitsPerWire_3S = map1DRecHitsPerWire(segment4Ds.product());
109 
110 
111  // Loop over all 4D segments
112  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
113  segment != segment4Ds->end();
114  ++segment) {
115 
116  if(detailedAnalysis){
117  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 1";
118  compute(dtGeom.product(), (*segment), recHitsPerWire_1S, 1);
119 
120  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 2";
121  compute(dtGeom.product(), (*segment), recHitsPerWire_2S, 2);
122  }
123 
124  LogTrace("DTCalibValidation") << "Anlysis on recHit at step 3";
125  compute(dtGeom.product(), (*segment), recHitsPerWire_3S, 3);
126  }
127 
128 }
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: Handle.h:81
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_
void DTCalibValidation::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
protectedvirtual

Implements DQMEDAnalyzer.

Definition at line 408 of file DTCalibValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), mergeVDriftHistosByStation::histos, LogTrace, DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), DTChamberId::station(), relativeConstraints::station, cmsPerfCommons::Step, relval_parameters_module::step, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

408  {
409 
410  //FR substitute the DQMStore instance by ibooker
411  ibooker.setCurrentFolder("DT/DTCalibValidation");
412 
413  DTSuperLayerId slId;
414 
415  // Loop over all the chambers
416  vector<const DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin();
417  vector<const DTChamber*>::const_iterator ch_end = dtGeom->chambers().end();
418  for (; ch_it != ch_end; ++ch_it) {
419  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
420  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
421  // Loop over the SLs
422  for(; sl_it != sl_end; ++sl_it) {
423  slId = (*sl_it)->id();
424 
425  int firstStep=1;
426  if(!detailedAnalysis) firstStep=3;
427  // Loop over the 3 steps
428  for(int step = firstStep; step <= 3; ++step) {
429 
430  LogTrace("DTCalibValidation") << " Booking histos for SL: " << slId;
431 
432  // Compose the chamber name
433  stringstream wheel; wheel << slId.wheel();
434  stringstream station; station << slId.station();
435  stringstream sector; sector << slId.sector();
436  stringstream superLayer; superLayer << slId.superlayer();
437  // Define the step
438  stringstream Step; Step << step;
439 
440 
441  string slHistoName =
442  "_STEP" + Step.str() +
443  "_W" + wheel.str() +
444  "_St" + station.str() +
445  "_Sec" + sector.str() +
446  "_SL" + superLayer.str();
447 
448  ibooker.setCurrentFolder("DT/DTCalibValidation/Wheel" + wheel.str() +
449  "/Station" + station.str() +
450  "/Sector" + sector.str());
451  // Create the monitor elements
452  vector<MonitorElement *> histos;
453  // Note the order matters
454  histos.push_back(ibooker.book1D("hResDist"+slHistoName,
455  "Residuals on the distance from wire (rec_hit - segm_extr) (cm)",
456  200, -0.4, 0.4));
457  histos.push_back(ibooker.book2D("hResDistVsDist"+slHistoName,
458  "Residuals on the distance (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
459  100, 0, 2.5, 200, -0.4, 0.4));
460  if(detailedAnalysis){
461  histos.push_back(ibooker.book1D("hResPos"+slHistoName,
462  "Residuals on the position from wire (rec_hit - segm_extr) (cm)",
463  200, -0.4, 0.4));
464  histos.push_back(ibooker.book2D("hResPosVsPos"+slHistoName,
465  "Residuals on the position (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
466  200, -2.5, 2.5, 200, -0.4, 0.4));
467  }
468 
469  histosPerSL[make_pair(slId, step)] = histos;
470  }
471  }
472  }
473 }
edm::ESHandle< DTGeometry > dtGeom
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
#define LogTrace(id)
int superlayer() const
Return the superlayer number (deprecated method name)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void DTCalibValidation::bookHistos ( DTSuperLayerId  slId,
int  step 
)
private
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 281 of file DTCalibValidation.cc.

References DTGeometry::chamber(), filterCSVwithJSON::copy, funct::cos(), DTRecSegment4D::dimension(), DTGeometry::layer(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), LogTrace, DTRecSegment4D::phiSegment(), HLT_25ns14e33_v3_cff::recHits, 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().

284  {
285  bool computeResidual = true;
286 
287  // Get all 1D RecHits at step 3 within the 4D segment
288  vector<DTRecHit1D> recHits1D_S3;
289 
290  // Get 1D RecHits at Step 3 and select only events with
291  // 8 hits in phi and 4 hits in theta (if any)
292  const DTChamberRecSegment2D* phiSeg = segment.phiSegment();
293  if(phiSeg){
294  vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
295  if(phiRecHits.size() != 8) {
296  LogTrace("DTCalibValidation") << "[DTCalibValidation] Phi segments has: " << phiRecHits.size()
297  << " hits, skipping"; // FIXME: info output
298  computeResidual = false;
299  }
300  copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
301  }
302  if(!phiSeg){
303  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the phi segment! ";
304  computeResidual = false;
305  }
306 
307  if(segment.dimension() == 4) {
308  const DTSLRecSegment2D* zSeg = segment.zSegment();
309  if(zSeg){
310  vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
311  if(zRecHits.size() != 4) {
312  LogTrace("DTCalibValidation") << "[DTCalibValidation] Theta segments has: " << zRecHits.size()
313  << " hits, skipping"; // FIXME: info output
314  computeResidual = false;
315  }
316  copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
317  }
318  if(!zSeg){
319  LogTrace("DTCalibValidation") << " [DTCalibValidation] 4D segment has not the z segment! ";
320  computeResidual = false;
321  }
322  }
323 
324  if(!computeResidual)
325  ++wrongSegment;
326  if(computeResidual){
327  ++rightSegment;
328  // Loop over 1D RecHit inside 4D segment
329  for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
330  recHit1D != recHits1D_S3.end();
331  ++recHit1D) {
332  const DTWireId wireId = (*recHit1D).wireId();
333 
334  // Get the layer and the wire position
335  const DTLayer* layer = dtGeom->layer(wireId);
336  float wireX = layer->specificTopology().wirePosition(wireId.wire());
337 
338  // Extrapolate the segment to the z of the wire
339  // Get wire position in chamber RF
340  // (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)
341  LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
342  GlobalPoint wirePosGlob = layer->toGlobal(wirePosInLay);
343  const DTChamber* chamber = dtGeom->chamber((*recHit1D).wireId().layerId().chamberId());
344  LocalPoint wirePosInChamber = chamber->toLocal(wirePosGlob);
345 
346  // Segment position at Wire z in chamber local frame
347  LocalPoint segPosAtZWire = segment.localPosition()
348  + segment.localDirection()*wirePosInChamber.z()/cos(segment.localDirection().theta());
349 
350  // Compute the distance of the segment from the wire
351  int sl = wireId.superlayer();
352  float SegmDistance = -1;
353  if(sl == 1 || sl == 3) {
354  // RPhi SL
355  SegmDistance = fabs(wirePosInChamber.x() - segPosAtZWire.x());
356  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
357  } else if(sl == 2) {
358  // RZ SL
359  SegmDistance = fabs(segPosAtZWire.y() - wirePosInChamber.y());
360  LogTrace("DTCalibValidation") << "SegmDistance: " << SegmDistance;
361  }
362  if(SegmDistance > 2.1)
363  LogTrace("DTCalibValidation") << " Warning: dist segment-wire: " << SegmDistance;
364 
365  // Look for RecHits in the same cell
366  if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
367  LogTrace("DTCalibValidation") << " No RecHit found at Step: " << step << " in cell: " << wireId;
368  } else {
369  vector<type> recHits = recHitsPerWire.at(wireId);
370  LogTrace("DTCalibValidation") << " " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId;
371 
372  // Get the layer
373  const DTLayer* layer = dtGeom->layer(wireId);
374  // Find the best RecHits
375  const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, SegmDistance);
376  // Compute the distance of the recHit from the wire
377  float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
378  LogTrace("DTCalibValidation") << "recHitWireDist: " << recHitWireDist;
379 
380  // Compute the residuals
381  float residualOnDistance = recHitWireDist - SegmDistance;
382  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnDistance: " << residualOnDistance;
383  float residualOnPosition = -1;
384  float recHitPos = -1;
385  if(sl == 1 || sl == 3) {
386  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.x(), sl);
387  residualOnPosition = recHitPos - segPosAtZWire.x();
388  }
389  else{
390  recHitPos = recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.y(), sl);
391  residualOnPosition = recHitPos - segPosAtZWire.y();
392  }
393  LogTrace("DTCalibValidation") << "WireId: " << wireId << " ResidualOnPosition: " << residualOnPosition;
394 
395  // Fill the histos
396  if(sl == 1 || sl == 3)
397  fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.x() - segPosAtZWire.x()), residualOnPosition, step);
398  else
399  fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.y() - segPosAtZWire.y()), residualOnPosition, step);
400 
401  }
402  }
403  }
404 
405 }
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:52
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
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::dqmBeginRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

BeginRun.

Reimplemented from DQMEDAnalyzer.

Definition at line 70 of file DTCalibValidation.cc.

References edm::EventSetup::get().

70  {
71 
72  // get the geometry
73  setup.get<MuonGeometryRecord>().get(dtGeom);
74 
75  }
edm::ESHandle< DTGeometry > dtGeom
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void DTCalibValidation::fillHistos ( DTSuperLayerId  slId,
float  distance,
float  residualOnDistance,
float  position,
float  residualOnPosition,
int  step 
)
private

Definition at line 477 of file DTCalibValidation.cc.

References mergeVDriftHistosByStation::histos.

482  {
483  // FIXME: optimization of the number of searches
484  vector<MonitorElement *> histos = histosPerSL[make_pair(slId,step)];
485  histos[0]->Fill(residualOnDistance);
486  histos[1]->Fill(distance, residualOnDistance);
487  if(detailedAnalysis){
488  histos[2]->Fill(residualOnPosition);
489  histos[3]->Fill(position, residualOnPosition);
490  }
491 }
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
static int position[264][3]
Definition: ReadPGInfo.cc:509
template<typename type >
const type * DTCalibValidation::findBestRecHit ( const DTLayer layer,
DTWireId  wireId,
const std::vector< type > &  recHits,
const float  simHitDist 
)
private

Definition at line 197 of file DTCalibValidation.cc.

200  {
201  float res = 99999;
202  const type* theBestRecHit = 0;
203  // Loop over RecHits within the cell
204  for(typename vector<type>::const_iterator recHit = recHits.begin();
205  recHit != recHits.end();
206  ++recHit) {
207  float distTmp = recHitDistFromWire(*recHit, layer);
208  if(fabs(distTmp-segmDist) < res) {
209  res = fabs(distTmp-segmDist);
210  theBestRecHit = &(*recHit);
211  }
212  } // End of loop over RecHits within the cell
213 
214  return theBestRecHit;
215 }
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 133 of file DTCalibValidation.cc.

References run_regression::ret.

133  {
134  map<DTWireId, vector<DTRecHit1DPair> > ret;
135 
136  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
137  rechit != dt1DRecHitPairs->end(); ++rechit) {
138  ret[(*rechit).wireId()].push_back(*rechit);
139  }
140 
141  return ret;
142 }
map< DTWireId, vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment2DCollection segment2Ds)
private

Definition at line 147 of file DTCalibValidation.cc.

References run_regression::ret.

147  {
148  map<DTWireId, vector<DTRecHit1D> > ret;
149 
150  // Loop over all 2D segments
151  for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
152  segment != segment2Ds->end();
153  ++segment) {
154  vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
155  // Loop over all component 1D hits
156  for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
157  hit != component1DHits.end(); ++hit) {
158  ret[(*hit).wireId()].push_back(*hit);
159  }
160  }
161  return ret;
162 }
map< DTWireId, std::vector< DTRecHit1D > > DTCalibValidation::map1DRecHitsPerWire ( const DTRecSegment4DCollection segment4Ds)
private

Definition at line 166 of file DTCalibValidation.cc.

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

166  {
167  map<DTWireId, vector<DTRecHit1D> > ret;
168  // Loop over all 4D segments
169  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
170  segment != segment4Ds->end();
171  ++segment) {
172  // Get component 2D segments
173  vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
174  // Loop over 2D segments:
175  for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
176  segment2D != segment2Ds.end();
177  ++segment2D) {
178  // Get 1D component rechits
179  vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
180  // Loop over them
181  for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
182  hit != hits.end(); ++hit) {
183  const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
184  ret[hit1D->wireId()].push_back(*hit1D);
185  }
186  }
187  }
188 
189  return ret;
190 }
DTWireId wireId() const
Return the wireId.
Definition: DTRecHit1D.h:107
float DTCalibValidation::recHitDistFromWire ( const DTRecHit1DPair hitPair,
const DTLayer layer 
)
private

Definition at line 220 of file DTCalibValidation.cc.

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

220  {
221  return fabs(hitPair.localPosition(DTEnums::Left).x() -
222  hitPair.localPosition(DTEnums::Right).x())/2.;
223 }
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const
float DTCalibValidation::recHitDistFromWire ( const DTRecHit1D recHit,
const DTLayer layer 
)
private

Definition at line 228 of file DTCalibValidation.cc.

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

228  {
229  return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
230 
231 }
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 235 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().

235  {
236 
237  // Get the layer and the wire position
238  GlobalPoint hitPosGlob_right = layer->toGlobal(hitPair.localPosition(DTEnums::Right));
239  LocalPoint hitPosInChamber_right = chamber->toLocal(hitPosGlob_right);
240  GlobalPoint hitPosGlob_left = layer->toGlobal(hitPair.localPosition(DTEnums::Left));
241  LocalPoint hitPosInChamber_left = chamber->toLocal(hitPosGlob_left);
242 
243  float recHitPos=-1;
244  if(sl != 2){
245  if(fabs(hitPosInChamber_left.x()-segmentPos)<fabs(hitPosInChamber_right.x()-segmentPos))
246  recHitPos = hitPosInChamber_left.x();
247  else
248  recHitPos = hitPosInChamber_right.x();
249  }
250  else{
251  if(fabs(hitPosInChamber_left.y()-segmentPos)<fabs(hitPosInChamber_right.y()-segmentPos))
252  recHitPos = hitPosInChamber_left.y();
253  else
254  recHitPos = hitPosInChamber_right.y();
255  }
256 
257  return recHitPos;
258 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
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 263 of file DTCalibValidation.cc.

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

263  {
264 
265  // Get the layer and the wire position
266  GlobalPoint recHitPosGlob = layer->toGlobal(recHit.localPosition());
267  LocalPoint recHitPosInChamber = chamber->toLocal(recHitPosGlob);
268 
269  float recHitPos = -1;
270  if(sl != 2)
271  recHitPos = recHitPosInChamber.x();
272  else
273  recHitPos = recHitPosInChamber.y();
274 
275  return recHitPos;
276 
277 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
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 72 of file DTCalibValidation.h.

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

Definition at line 74 of file DTCalibValidation.h.

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

Definition at line 128 of file DTCalibValidation.h.

int DTCalibValidation::nevent
private

Definition at line 70 of file DTCalibValidation.h.

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

Definition at line 77 of file DTCalibValidation.h.

int DTCalibValidation::rightSegment
private

Definition at line 69 of file DTCalibValidation.h.

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

Definition at line 79 of file DTCalibValidation.h.

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

Definition at line 81 of file DTCalibValidation.h.

int DTCalibValidation::wrongSegment
private

Definition at line 68 of file DTCalibValidation.h.