CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
MuonShowerInformationFiller Class Reference

#include <MuonShowerInformationFiller.h>

Classes

struct  AbsLessDPhi
 
struct  AbsLessDTheta
 
struct  LessAbsMag
 
struct  LessDPhi
 
struct  LessMag
 
struct  LessPerp
 
struct  LessPhi
 

Public Types

typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
 
typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
 
typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
 

Public Member Functions

void fillHitsByStation (const reco::Muon &)
 
reco::MuonShower fillShowerInformation (const reco::Muon &muon, const edm::Event &, const edm::EventSetup &)
 fill muon shower variables More...
 
 MuonShowerInformationFiller ()
 constructors More...
 
 MuonShowerInformationFiller (const edm::ParameterSet &, edm::ConsumesCollector &)
 
virtual void setEvent (const edm::Event &)
 pass the Event to the algorithm at each event More...
 
void setServices (const edm::EventSetup &)
 set the services needed More...
 
virtual ~MuonShowerInformationFiller ()
 destructor More...
 

Protected Member Functions

const MuonServiceProxygetService () const
 

Private Member Functions

GlobalPoint crossingPoint (const GlobalPoint &, const GlobalPoint &, const BarrelDetLayer *) const
 
GlobalPoint crossingPoint (const GlobalPoint &, const GlobalPoint &, const Cylinder &) const
 
GlobalPoint crossingPoint (const GlobalPoint &, const GlobalPoint &, const ForwardDetLayer *) const
 
GlobalPoint crossingPoint (const GlobalPoint &, const GlobalPoint &, const Disk &) const
 
std::vector< const GeomDet * > cscPositionToDets (const GlobalPoint &) const
 
std::vector< const GeomDet * > dtPositionToDets (const GlobalPoint &) const
 
MuonRecHitContainer findPerpCluster (MuonRecHitContainer &muonRecHits) const
 
TransientTrackingRecHit::ConstRecHitContainer findThetaCluster (TransientTrackingRecHit::ConstRecHitContainer &, const GlobalPoint &) const
 
std::vector< const GeomDet * > getCompatibleDets (const reco::Track &) const
 
TransientTrackingRecHit::ConstRecHitContainer hitsFromSegments (const GeomDet *, edm::Handle< DTRecSegment4DCollection >, edm::Handle< CSCSegmentCollection >) const
 

Private Attributes

std::string category_
 
std::vector< int > theAllStationHits
 
unsigned long long theCacheId_MT
 
unsigned long long theCacheId_TRH
 
std::vector< int > theCorrelatedStationHits
 
edm::ESHandle< CSCGeometrytheCSCGeometry
 
edm::InputTag theCSCRecHitLabel
 
edm::Handle< CSCRecHit2DCollectiontheCSCRecHits
 
edm::EDGetTokenT< CSCRecHit2DCollectiontheCSCRecHitToken
 
edm::Handle< CSCSegmentCollectiontheCSCSegments
 
edm::InputTag theCSCSegmentsLabel
 
edm::EDGetTokenT< CSCSegmentCollectiontheCSCSegmentsToken
 
edm::InputTag theDT4DRecSegmentLabel
 
edm::Handle< DTRecSegment4DCollectiontheDT4DRecSegments
 
edm::EDGetTokenT< DTRecSegment4DCollectiontheDT4DRecSegmentToken
 
edm::ESHandle< DTGeometrytheDTGeometry
 
edm::InputTag theDTRecHitLabel
 
edm::Handle< DTRecHitCollectiontheDTRecHits
 
edm::EDGetTokenT< DTRecHitCollectiontheDTRecHitToken
 
edm::ESHandle< MagneticFieldtheField
 
edm::ESHandle< TransientTrackingRecHitBuildertheMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
MuonServiceProxytheService
 
std::vector< float > theStationShowerDeltaR
 
std::vector< float > theStationShowerTSize
 
edm::ESHandle< GeometricSearchTrackertheTracker
 
edm::ESHandle< TransientTrackingRecHitBuildertheTrackerRecHitBuilder
 
std::string theTrackerRecHitBuilderName
 
edm::ESHandle< GlobalTrackingGeometrytheTrackingGeometry
 

Detailed Description

Description: class for muon shower identification

Author
: A. Svyatkovskiy, Purdue University

Definition at line 63 of file MuonShowerInformationFiller.h.

Member Typedef Documentation

Definition at line 67 of file MuonShowerInformationFiller.h.

Definition at line 65 of file MuonShowerInformationFiller.h.

Definition at line 66 of file MuonShowerInformationFiller.h.

Constructor & Destructor Documentation

MuonShowerInformationFiller::MuonShowerInformationFiller ( )
inline

constructors

Definition at line 71 of file MuonShowerInformationFiller.h.

71 {};
MuonShowerInformationFiller::MuonShowerInformationFiller ( const edm::ParameterSet par,
edm::ConsumesCollector iC 
)

Definition at line 68 of file MuonShowerInformationFiller.cc.

References category_, edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), MuonServiceProxy_cff::MuonServiceProxy, theAllStationHits, theCacheId_MT, theCacheId_TRH, theCorrelatedStationHits, theCSCRecHitLabel, theCSCRecHitToken, theCSCSegmentsLabel, theCSCSegmentsToken, theDT4DRecSegmentLabel, theDT4DRecSegmentToken, theDTRecHitLabel, theDTRecHitToken, theMuonRecHitBuilderName, theService, theStationShowerDeltaR, theStationShowerTSize, and theTrackerRecHitBuilderName.

69  : theService(nullptr),
70  theDTRecHitLabel(par.getParameter<InputTag>("DTRecSegmentLabel")),
71  theCSCRecHitLabel(par.getParameter<InputTag>("CSCRecSegmentLabel")),
72  theCSCSegmentsLabel(par.getParameter<InputTag>("CSCSegmentLabel")),
73  theDT4DRecSegmentLabel(par.getParameter<InputTag>("DT4DRecSegmentLabel")) {
78 
79  edm::ParameterSet serviceParameters = par.getParameter<edm::ParameterSet>("ServiceParameters");
80  theService = new MuonServiceProxy(serviceParameters);
81 
82  theTrackerRecHitBuilderName = par.getParameter<string>("TrackerRecHitBuilder");
83  theMuonRecHitBuilderName = par.getParameter<string>("MuonRecHitBuilder");
84 
85  theCacheId_TRH = 0;
86  theCacheId_MT = 0;
87 
88  category_ = "MuonShowerInformationFiller";
89 
90  for (int istat = 0; istat < 4; istat++) {
91  theStationShowerDeltaR.push_back(0.);
92  theStationShowerTSize.push_back(0.);
93  theAllStationHits.push_back(0);
94  theCorrelatedStationHits.push_back(0);
95  }
96 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< CSCSegmentCollection > theCSCSegmentsToken
edm::EDGetTokenT< CSCRecHit2DCollection > theCSCRecHitToken
edm::EDGetTokenT< DTRecSegment4DCollection > theDT4DRecSegmentToken
edm::EDGetTokenT< DTRecHitCollection > theDTRecHitToken
MuonShowerInformationFiller::~MuonShowerInformationFiller ( )
virtual

destructor

Definition at line 101 of file MuonShowerInformationFiller.cc.

References theService.

101  {
102  if (theService)
103  delete theService;
104 }

Member Function Documentation

GlobalPoint MuonShowerInformationFiller::crossingPoint ( const GlobalPoint p1,
const GlobalPoint p2,
const BarrelDetLayer dl 
) const
private

Definition at line 396 of file MuonShowerInformationFiller.cc.

References BarrelDetLayer::specificSurface().

Referenced by crossingPoint(), and getCompatibleDets().

398  {
399  const BoundCylinder& bc = dl->specificSurface();
400  return crossingPoint(p1, p2, bc);
401 }
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
GlobalPoint crossingPoint(const GlobalPoint &, const GlobalPoint &, const BarrelDetLayer *) const
GlobalPoint MuonShowerInformationFiller::crossingPoint ( const GlobalPoint p1,
const GlobalPoint p2,
const Cylinder cyl 
) const
private

Definition at line 403 of file MuonShowerInformationFiller.cc.

References a, Calorimetry_cff::dp, n0, p2, Cylinder::radius(), CosmicsPD_Skims::radius, slope, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, PV3DBase< T, PVType, FrameType >::y(), testProducerWithPsetDescEmpty_cfi::y1, testProducerWithPsetDescEmpty_cfi::y2, PV3DBase< T, PVType, FrameType >::z(), and testProducerWithPsetDescEmpty_cfi::z2.

405  {
406  float radius = cyl.radius();
407 
408  GlobalVector dp = p1 - p2;
409  float slope = dp.x() / dp.y();
410  float a = p1.x() - slope * p1.y();
411 
412  float n2 = (1 + slope * slope);
413  float n1 = 2 * a * slope;
414  float n0 = a * a - radius * radius;
415 
416  float y1 = 9999;
417  float y2 = 9999;
418  if (n1 * n1 - 4 * n2 * n0 > 0) {
419  y1 = (-n1 + sqrt(n1 * n1 - 4 * n2 * n0)) / (2 * n2);
420  y2 = (-n1 - sqrt(n1 * n1 - 4 * n2 * n0)) / (2 * n2);
421  }
422 
423  float x1 = p1.x() + slope * (y1 - p1.y());
424  float x2 = p1.x() + slope * (y2 - p1.y());
425 
426  float slopeZ = dp.z() / dp.y();
427 
428  float z1 = p1.z() + slopeZ * (y1 - p1.y());
429  float z2 = p1.z() + slopeZ * (y2 - p1.y());
430 
431  // there are two crossing points, return the one that is in the same quadrant as point of extrapolation
432  if ((p2.x() * x1 > 0) && (y1 * p2.y() > 0) && (z1 * p2.z() > 0)) {
433  return GlobalPoint(x1, y1, z1);
434  } else {
435  return GlobalPoint(x2, y2, z2);
436  }
437 }
static const double slope[3]
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64
int n0
Definition: AMPTWrapper.h:44
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
double p2[4]
Definition: TauolaWrapper.h:90
double a
Definition: hdecay.h:119
T x() const
Definition: PV3DBase.h:59
GlobalPoint MuonShowerInformationFiller::crossingPoint ( const GlobalPoint p1,
const GlobalPoint p2,
const ForwardDetLayer dl 
) const
private
GlobalPoint MuonShowerInformationFiller::crossingPoint ( const GlobalPoint ,
const GlobalPoint ,
const Disk  
) const
private
vector< const GeomDet * > MuonShowerInformationFiller::cscPositionToDets ( const GlobalPoint gp) const
private

Definition at line 576 of file MuonShowerInformationFiller.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), category_, SiPixelRawToDigiRegional_cfi::deltaPhi, makeMuonMisalignmentScenario::endcap, dqmMemoryStats::float, mps_fire::i, LogTrace, M_PI, PV3DBase< T, PVType, FrameType >::perp(), mps_fire::result, relativeConstraints::ring, volumeBasedMagneticField_1103l_cfi::sectors, relativeConstraints::station, theService, and PV3DBase< T, PVType, FrameType >::z().

Referenced by getCompatibleDets().

576  {
577  // determine the endcap side
578  int endcap = 0;
579  if (gp.z() > 0) {
580  endcap = 1;
581  } else {
582  endcap = 2;
583  }
584 
585  // determine the csc station and range of rings
586  int station = 5;
587 
588  // check all rings in a station
589  if (fabs(gp.z()) > 1000. && fabs(gp.z()) < 1055.0) {
590  station = 4;
591  } else if (fabs(gp.z()) > 910.0 && fabs(gp.z()) < 965.0) {
592  station = 3;
593  } else if (fabs(gp.z()) > 800.0 && fabs(gp.z()) < 860.0) {
594  station = 2;
595  } else if (fabs(gp.z()) > 570.0 && fabs(gp.z()) < 730.0) {
596  station = 1;
597  }
598 
599  vector<int> sectors;
600 
601  float phistep1 = M_PI / 18.; //for all the rings except first rings for stations > 1
602  float phistep2 = M_PI / 9.;
603  float phigp = (float)gp.barePhi();
604 
605  int ring = -1;
606 
607  // determine the ring
608  if (station == 1) {
609  //FIX ME!!!
610  if (gp.perp() > 100 && gp.perp() < 270)
611  ring = 1;
612  else if (gp.perp() > 270 && gp.perp() < 450)
613  ring = 2;
614  else if (gp.perp() > 450 && gp.perp() < 695)
615  ring = 3;
616  else if (gp.perp() > 100 && gp.perp() < 270)
617  ring = 4;
618 
619  } else if (station == 2) {
620  if (gp.perp() > 140 && gp.perp() < 350)
621  ring = 1;
622  else if (gp.perp() > 350 && gp.perp() < 700)
623  ring = 2;
624 
625  } else if (station == 3) {
626  if (gp.perp() > 160 && gp.perp() < 350)
627  ring = 1;
628  else if (gp.perp() > 350 && gp.perp() < 700)
629  ring = 2;
630 
631  } else if (station == 4) {
632  if (gp.perp() > 175 && gp.perp() < 350)
633  ring = 1;
634  else if (gp.perp() > 350 && gp.perp() < 700)
635  ring = 2;
636  }
637 
638  if (station > 1 && ring == 1) {
639  // we have 18 sectors in that case
640  for (int i = 0; i < 18; i++) {
641  if (fabs(deltaPhi(phigp, i * phistep2)) < phistep2)
642  sectors.push_back(i + 1);
643  }
644 
645  } else {
646  // we have 36 sectors in that case
647  for (int i = 0; i < 36; i++) {
648  if (fabs(deltaPhi(phigp, i * phistep1)) < phistep1)
649  sectors.push_back(i + 1);
650  }
651  }
652 
653  LogTrace(category_) << "CSC position to dets" << endl;
654  LogTrace(category_) << "ring: " << ring << endl;
655  LogTrace(category_) << "endcap: " << endcap << endl;
656  LogTrace(category_) << "station: " << station << endl;
657  LogTrace(category_) << "CSC number of sectors to consider: " << sectors.size() << endl;
658 
659  // check exceptional cases
660  vector<const GeomDet*> result;
661  if (station > 4 || station < 1)
662  return result;
663  if (endcap == 0)
664  return result;
665  if (ring == -1)
666  return result;
667 
668  int minlayer = 1;
669  int maxlayer = 6;
670 
671  for (vector<int>::const_iterator isector = sectors.begin(); isector != sectors.end(); ++isector) {
672  for (int ilayer = minlayer; ilayer != maxlayer + 1; ++ilayer) {
673  CSCDetId cscid(endcap, station, ring, (*isector), ilayer);
674  result.push_back(theService->trackingGeometry()->idToDet(cscid));
675  }
676  }
677 
678  return result;
679 }
T perp() const
Definition: PV3DBase.h:69
T barePhi() const
Definition: PV3DBase.h:65
T z() const
Definition: PV3DBase.h:61
#define LogTrace(id)
#define M_PI
vector< const GeomDet * > MuonShowerInformationFiller::dtPositionToDets ( const GlobalPoint gp) const
private

Definition at line 476 of file MuonShowerInformationFiller.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), category_, SiPixelRawToDigiRegional_cfi::deltaPhi, dqmMemoryStats::float, LogTrace, M_PI, PV3DBase< T, PVType, FrameType >::perp(), mps_fire::result, volumeBasedMagneticField_1103l_cfi::sectors, relativeConstraints::station, theService, and PV3DBase< T, PVType, FrameType >::z().

Referenced by getCompatibleDets().

476  {
477  int minwheel = -3;
478  int maxwheel = -3;
479  if (gp.z() < -680.0) {
480  minwheel = -3;
481  maxwheel = -3;
482  } else if (gp.z() < -396.0) {
483  minwheel = -2;
484  maxwheel = -1;
485  } else if (gp.z() < -126.8) {
486  minwheel = -2;
487  maxwheel = 0;
488  } else if (gp.z() < 126.8) {
489  minwheel = -1;
490  maxwheel = 1;
491  } else if (gp.z() < 396.0) {
492  minwheel = 0;
493  maxwheel = 2;
494  } else if (gp.z() < 680.0) {
495  minwheel = 1;
496  maxwheel = 2;
497  } else {
498  minwheel = 3;
499  maxwheel = 3;
500  }
501 
502  int station = 5;
503  if (gp.perp() > 680.0 && gp.perp() < 755.0)
504  station = 4;
505  else if (gp.perp() > 580.0)
506  station = 3;
507  else if (gp.perp() > 480.0)
508  station = 2;
509  else if (gp.perp() > 380.0)
510  station = 1;
511  else
512  station = 0;
513 
514  vector<int> sectors;
515 
516  float phistep = M_PI / 6;
517 
518  float phigp = (float)gp.barePhi();
519 
520  if (fabs(deltaPhi(phigp, 0 * phistep)) < phistep)
521  sectors.push_back(1);
522  if (fabs(deltaPhi(phigp, phistep)) < phistep)
523  sectors.push_back(2);
524  if (fabs(deltaPhi(phigp, 2 * phistep)) < phistep)
525  sectors.push_back(3);
526  if (fabs(deltaPhi(phigp, 3 * phistep)) < phistep) {
527  sectors.push_back(4);
528  if (station == 4)
529  sectors.push_back(13);
530  }
531  if (fabs(deltaPhi(phigp, 4 * phistep)) < phistep)
532  sectors.push_back(5);
533  if (fabs(deltaPhi(phigp, 5 * phistep)) < phistep)
534  sectors.push_back(6);
535  if (fabs(deltaPhi(phigp, 6 * phistep)) < phistep)
536  sectors.push_back(7);
537  if (fabs(deltaPhi(phigp, 7 * phistep)) < phistep)
538  sectors.push_back(8);
539  if (fabs(deltaPhi(phigp, 8 * phistep)) < phistep)
540  sectors.push_back(9);
541  if (fabs(deltaPhi(phigp, 9 * phistep)) < phistep) {
542  sectors.push_back(10);
543  if (station == 4)
544  sectors.push_back(14);
545  }
546  if (fabs(deltaPhi(phigp, 10 * phistep)) < phistep)
547  sectors.push_back(11);
548  if (fabs(deltaPhi(phigp, 11 * phistep)) < phistep)
549  sectors.push_back(12);
550 
551  LogTrace(category_) << "DT position to dets" << endl;
552  LogTrace(category_) << "number of sectors to consider: " << sectors.size() << endl;
553  LogTrace(category_) << "station: " << station << " wheels: " << minwheel << " " << maxwheel << endl;
554 
555  vector<const GeomDet*> result;
556  if (station > 4 || station < 1)
557  return result;
558  if (minwheel > 2 || maxwheel < -2)
559  return result;
560 
561  for (vector<int>::const_iterator isector = sectors.begin(); isector != sectors.end(); ++isector) {
562  for (int iwheel = minwheel; iwheel != maxwheel + 1; ++iwheel) {
563  DTChamberId chamberid(iwheel, station, (*isector));
564  result.push_back(theService->trackingGeometry()->idToDet(chamberid));
565  }
566  }
567 
568  LogTrace(category_) << "number of GeomDets for this track: " << result.size() << endl;
569 
570  return result;
571 }
T perp() const
Definition: PV3DBase.h:69
T barePhi() const
Definition: PV3DBase.h:65
T z() const
Definition: PV3DBase.h:61
#define LogTrace(id)
#define M_PI
void MuonShowerInformationFiller::fillHitsByStation ( const reco::Muon muon)

Definition at line 684 of file MuonShowerInformationFiller.cc.

References funct::abs(), begin, category_, filterCSVwithJSON::copy, MuonSubdetId::CSC, SiPixelRawToDigiRegional_cfi::deltaPhi, DetId::det(), MuonSubdetId::DT, end, findPerpCluster(), findThetaCluster(), dqmMemoryStats::float, getCompatibleDets(), reco::Muon::globalTrack(), hitsFromSegments(), iseed, reco::Muon::isGlobalMuon(), reco::Muon::isStandAloneMuon(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), SiStripPI::max, DTChamberId::maxLayerId, DTChamberId::maxSuperLayerId, min(), DTChamberId::minLayerId, DTChamberId::minSuperLayerId, DetId::Muon, reco::Muon::outerTrack(), phi, funct::pow(), DetId::rawId(), relativeConstraints::ring, MuonSubdetId::RPC, MuonTransientTrackingRecHit::specificBuild(), mathSSE::sqrt(), hgcalPlots::stat, relativeConstraints::station, DetId::subdetId(), groupFilesInBlocks::temp, theAllStationHits, theCorrelatedStationHits, theCSCRecHits, theCSCSegments, theDT4DRecSegments, theDTRecHits, theStationShowerDeltaR, theStationShowerTSize, HLT_2018_cff::track, pileupCalc::upper, and makeMuonMisalignmentScenario::wheel.

Referenced by fillShowerInformation().

684  {
686  if (muon.isGlobalMuon())
687  track = muon.globalTrack();
688  else if (muon.isStandAloneMuon())
689  track = muon.outerTrack();
690  else
691  return;
692 
693  // split 1D rechits by station
694  vector<MuonRecHitContainer> muonRecHits(4);
695 
696  // split rechits from segs by station
697  vector<TransientTrackingRecHit::ConstRecHitContainer> muonCorrelatedHits(4);
698 
699  // get vector of GeomDets compatible with a track
700  vector<const GeomDet*> compatibleLayers = getCompatibleDets(*track);
701 
702  // for special cases: CSC station 1
703  MuonRecHitContainer tmpCSC1;
704  bool dtOverlapToCheck = false;
705  bool cscOverlapToCheck = false;
706 
707  for (vector<const GeomDet*>::const_iterator igd = compatibleLayers.begin(); igd != compatibleLayers.end(); igd++) {
708  // get det id
709  DetId geoId = (*igd)->geographicalId();
710 
711  // skip tracker hits
712  if (geoId.det() != DetId::Muon)
713  continue;
714 
715  // DT
716  if (geoId.subdetId() == MuonSubdetId::DT) {
717  // get station
718  DTChamberId detid(geoId.rawId());
719  int station = detid.station();
720  int wheel = detid.wheel();
721 
722  // get rechits from segments per station
723  TransientTrackingRecHit::ConstRecHitContainer muonCorrelatedHitsTmp =
725  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_begin = muonCorrelatedHitsTmp.begin();
726  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_end = muonCorrelatedHitsTmp.end();
727 
728  for (; hits_begin != hits_end; ++hits_begin) {
729  muonCorrelatedHits.at(station - 1).push_back(*hits_begin);
730  }
731 
732  //check overlap certain wheels and stations
733  if (abs(wheel) == 2 && station != 4 && station != 1)
734  dtOverlapToCheck = true;
735 
736  // loop over all superlayers of a DT chamber
737  for (int isuperlayer = DTChamberId::minSuperLayerId; isuperlayer != DTChamberId::maxSuperLayerId + 1;
738  ++isuperlayer) {
739  // loop over all layers inside the superlayer
740  for (int ilayer = DTChamberId::minLayerId; ilayer != DTChamberId::maxLayerId + 1; ++ilayer) {
741  DTLayerId lid(detid, isuperlayer, ilayer);
742  DTRecHitCollection::range dRecHits = theDTRecHits->get(lid);
743  for (DTRecHitCollection::const_iterator rechit = dRecHits.first; rechit != dRecHits.second; ++rechit) {
744  vector<const TrackingRecHit*> subrechits = (*rechit).recHits();
745  for (vector<const TrackingRecHit*>::iterator irechit = subrechits.begin(); irechit != subrechits.end();
746  ++irechit) {
747  muonRecHits.at(station - 1).push_back(MuonTransientTrackingRecHit::specificBuild((&**igd), &**irechit));
748  }
749  }
750  }
751  }
752  } else if (geoId.subdetId() == MuonSubdetId::CSC) {
753  // get station
754  CSCDetId did(geoId.rawId());
755  int station = did.station();
756  int ring = did.ring();
757 
758  //get rechits from segments by station
759  TransientTrackingRecHit::ConstRecHitContainer muonCorrelatedHitsTmp =
761  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_begin = muonCorrelatedHitsTmp.begin();
762  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_end = muonCorrelatedHitsTmp.end();
763 
764  for (; hits_begin != hits_end; ++hits_begin) {
765  muonCorrelatedHits.at(station - 1).push_back(*hits_begin);
766  }
767 
768  if ((station == 1 && ring == 3) && dtOverlapToCheck)
769  cscOverlapToCheck = true;
770 
771  // split 1D rechits by station
772  CSCRecHit2DCollection::range dRecHits = theCSCRecHits->get(did);
773  for (CSCRecHit2DCollection::const_iterator rechit = dRecHits.first; rechit != dRecHits.second; ++rechit) {
774  if (!cscOverlapToCheck) {
775  muonRecHits.at(station - 1).push_back(MuonTransientTrackingRecHit::specificBuild((&**igd), &*rechit));
776  } else {
777  tmpCSC1.push_back(MuonTransientTrackingRecHit::specificBuild((&**igd), &*rechit));
778 
779  //sort by perp, then insert to appropriate container
781  if (temp.empty())
782  continue;
783 
784  float center;
785  if (temp.size() > 1) {
786  center = (temp.front()->globalPosition().perp() + temp.back()->globalPosition().perp()) / 2.;
787  } else {
788  center = temp.front()->globalPosition().perp();
789  }
790  temp.clear();
791 
792  if (center > 550.) {
793  muonRecHits.at(2).insert(muonRecHits.at(2).end(), tmpCSC1.begin(), tmpCSC1.end());
794  } else {
795  muonRecHits.at(1).insert(muonRecHits.at(1).end(), tmpCSC1.begin(), tmpCSC1.end());
796  }
797  tmpCSC1.clear();
798  }
799  }
800  } else if (geoId.subdetId() == MuonSubdetId::RPC) {
801  LogTrace(category_) << "Wrong subdet id" << endl;
802  }
803  } //loop over GeomDets compatible with a track
804 
805  // calculate number of all and correlated hits
806  for (int stat = 0; stat < 4; stat++) {
807  theCorrelatedStationHits[stat] = muonCorrelatedHits.at(stat).size();
808  theAllStationHits[stat] = muonRecHits[stat].size();
809  }
810  LogTrace(category_) << "Hits used by the segments, by station " << theCorrelatedStationHits.at(0) << " "
811  << theCorrelatedStationHits.at(1) << " " << theCorrelatedStationHits.at(2) << " "
812  << theCorrelatedStationHits.at(3) << endl;
813 
814  LogTrace(category_) << "All DT 1D/CSC 2D hits, by station " << theAllStationHits.at(0) << " "
815  << theAllStationHits.at(1) << " " << theAllStationHits.at(2) << " " << theAllStationHits.at(3)
816  << endl;
817 
818  //station shower sizes
820  TransientTrackingRecHit::ConstRecHitContainer muonRecHitsThetaTemp, muonRecHitsThetaBest;
821  // send station hits to the clustering algorithm
822  for (int stat = 0; stat != 4; stat++) {
823  const size_t nhit = muonRecHits[stat].size();
824  if (nhit < 2)
825  continue; // Require at least 2 hits
826  muonRecHitsPhiBest.clear();
827  muonRecHitsPhiBest.reserve(nhit);
828 
829  // Cluster seeds by global position phi. Best cluster is chosen to give greatest dphi
830  // Sort by phi (complexity = NLogN with enough memory, or = NLog^2N for insufficient mem)
831  stable_sort(muonRecHits[stat].begin(), muonRecHits[stat].end(), LessPhi());
832 
833  // Search for gaps (complexity = N)
834  std::vector<size_t> clUppers;
835  for (size_t ihit = 0; ihit < nhit; ++ihit) {
836  const size_t jhit = (ihit + 1) % nhit;
837  const double phi1 = muonRecHits[stat].at(ihit)->globalPosition().barePhi();
838  const double phi2 = muonRecHits[stat].at(jhit)->globalPosition().barePhi();
839 
840  const double dphi = std::abs(deltaPhi(phi1, phi2));
841  if (dphi >= 0.05)
842  clUppers.push_back(ihit);
843  }
844 
845  //station shower sizes
846  double dphimax = 0;
847  if (clUppers.empty()) {
848  // No gaps - there is only one cluster. Take all of them
849  const double refPhi = muonRecHits[stat].at(0)->globalPosition().barePhi();
850  double dphilo = 0, dphihi = 0;
851  for (auto& hit : muonRecHits[stat]) {
852  muonRecHitsPhiBest.push_back(hit);
853  const double phi = hit->globalPosition().barePhi();
854  dphilo = std::min(dphilo, deltaPhi(refPhi, phi));
855  dphihi = std::max(dphihi, deltaPhi(refPhi, phi));
856  }
857  dphimax = std::abs(dphihi + dphilo);
858  } else {
859  // Loop over gaps to find the one with maximum dphi(begin, end)
860  // By construction, number of gap must be greater than 1.
861  size_t bestUpper = 0, bestLower = 0;
862  for (auto icl = clUppers.begin(); icl != clUppers.end(); ++icl) {
863  // upper bound of this cluster
864  const size_t upper = *icl;
865  // lower bound is +1 of preceeding upper bound
866  const auto prevCl = (icl == clUppers.begin()) ? clUppers.end() : icl;
867  const size_t lower = (*(prevCl - 1) + 1) % nhit;
868 
869  // At least two hit for a cluster
870  if (upper == lower)
871  continue;
872 
873  const double phi1 = muonRecHits[stat].at(upper)->globalPosition().barePhi();
874  const double phi2 = muonRecHits[stat].at(lower)->globalPosition().barePhi();
875 
876  const double dphi = std::abs(deltaPhi(phi1, phi2));
877  if (dphimax < dphi) {
878  dphimax = dphi;
879  bestUpper = upper;
880  bestLower = lower;
881  }
882  }
883 
884  if (bestUpper > bestLower) {
885  muonRecHitsPhiBest.reserve(bestUpper - bestLower + 1);
886  std::copy(muonRecHits[stat].begin() + bestLower,
887  muonRecHits[stat].begin() + bestUpper + 1,
888  std::back_inserter(muonRecHitsPhiBest));
889  } else if (bestUpper < bestLower) {
890  muonRecHitsPhiBest.reserve(bestUpper + (nhit - bestLower) + 1);
891  std::copy(muonRecHits[stat].begin(),
892  muonRecHits[stat].begin() + bestUpper + 1,
893  std::back_inserter(muonRecHitsPhiBest));
894  std::copy(
895  muonRecHits[stat].begin() + bestLower, muonRecHits[stat].end(), std::back_inserter(muonRecHitsPhiBest));
896  }
897  }
898 
899  //fill showerTs
900  if (!muonRecHitsPhiBest.empty()) {
901  muonRecHits[stat] = muonRecHitsPhiBest;
902  stable_sort(muonRecHits[stat].begin(), muonRecHits[stat].end(), LessAbsMag());
903  muonRecHits[stat].front();
904  GlobalPoint refpoint = muonRecHits[stat].front()->globalPosition();
905  theStationShowerTSize.at(stat) = refpoint.mag() * dphimax;
906  }
907 
908  //for theta
909  if (!muonCorrelatedHits.at(stat).empty()) {
910  float dthetamax = 0;
911  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator iseed = muonCorrelatedHits.at(stat).begin();
912  iseed != muonCorrelatedHits.at(stat).end();
913  ++iseed) {
914  if (!(*iseed)->isValid())
915  continue;
916  GlobalPoint refpoint = (*iseed)->globalPosition(); //starting from the one with smallest value of phi
917  muonRecHitsThetaTemp.clear();
918  muonRecHitsThetaTemp = findThetaCluster(muonCorrelatedHits.at(stat), refpoint);
919  if (muonRecHitsThetaTemp.size() > 1) {
920  float dtheta = fabs((float)muonRecHitsThetaTemp.back()->globalPosition().theta() -
921  (float)muonRecHitsThetaTemp.front()->globalPosition().theta());
922  if (dtheta > dthetamax) {
923  dthetamax = dtheta;
924  muonRecHitsThetaBest = muonRecHitsThetaTemp;
925  }
926  } //at least two hits
927  } //loop over seeds
928  } //not empty container2
929 
930  //fill deltaRs
931  if (muonRecHitsThetaBest.size() > 1 && muonRecHitsPhiBest.size() > 1)
932  theStationShowerDeltaR.at(stat) = sqrt(pow(deltaPhi(muonRecHitsPhiBest.front()->globalPosition().barePhi(),
933  muonRecHitsPhiBest.back()->globalPosition().barePhi()),
934  2) +
935  pow(muonRecHitsThetaBest.front()->globalPosition().theta() -
936  muonRecHitsThetaBest.back()->globalPosition().theta(),
937  2));
938 
939  } //loop over station
940 
941  LogTrace(category_) << "deltaR around a track containing all the station hits, by station "
942  << theStationShowerDeltaR.at(0) << " " << theStationShowerDeltaR.at(1) << " "
943  << theStationShowerDeltaR.at(2) << " " << theStationShowerDeltaR.at(3) << endl;
944 
945  LogTrace(category_) << "Transverse cluster size, by station " << theStationShowerTSize.at(0) << " "
946  << theStationShowerTSize.at(1) << " " << theStationShowerTSize.at(2) << " "
947  << theStationShowerTSize.at(3) << endl;
948 
949  return;
950 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
bool isStandAloneMuon() const override
Definition: Muon.h:300
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
T mag() const
Definition: PV3DBase.h:64
static const int maxLayerId
highest layer id
Definition: DTChamberId.h:70
bool isGlobalMuon() const override
Definition: Muon.h:298
T sqrt(T t)
Definition: SSEVec.h:19
edm::Handle< DTRecHitCollection > theDTRecHits
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int minLayerId
lowest layer id. 0 indicates a full SL
Definition: DTChamberId.h:68
#define end
Definition: vmac.h:39
T min(T a, T b)
Definition: MathUtil.h:58
static const int maxSuperLayerId
highest superlayer id
Definition: DTChamberId.h:66
#define LogTrace(id)
edm::Handle< CSCSegmentCollection > theCSCSegments
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:48
TransientTrackingRecHit::ConstRecHitContainer findThetaCluster(TransientTrackingRecHit::ConstRecHitContainer &, const GlobalPoint &) const
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:17
TransientTrackingRecHit::ConstRecHitContainer hitsFromSegments(const GeomDet *, edm::Handle< DTRecSegment4DCollection >, edm::Handle< CSCSegmentCollection >) const
int iseed
Definition: AMPTWrapper.h:134
std::vector< const GeomDet * > getCompatibleDets(const reco::Track &) const
edm::Handle< CSCRecHit2DCollection > theCSCRecHits
static constexpr int RPC
Definition: MuonSubdetId.h:13
static const int minSuperLayerId
loweset super layer id. 0 indicates a full chamber
Definition: DTChamberId.h:64
#define begin
Definition: vmac.h:32
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
int station() const
Definition: CSCDetId.h:79
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12
MuonRecHitContainer findPerpCluster(MuonRecHitContainer &muonRecHits) const
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
std::vector< MuonRecHitPointer > MuonRecHitContainer
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
edm::Handle< DTRecSegment4DCollection > theDT4DRecSegments
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:51
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
reco::MuonShower MuonShowerInformationFiller::fillShowerInformation ( const reco::Muon muon,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

fill muon shower variables

Definition at line 109 of file MuonShowerInformationFiller.cc.

References fillHitsByStation(), reco::MuonShower::nStationCorrelatedHits, reco::MuonShower::nStationHits, setEvent(), setServices(), reco::MuonShower::stationShowerDeltaR, reco::MuonShower::stationShowerSizeT, theAllStationHits, theCorrelatedStationHits, theService, theStationShowerDeltaR, and theStationShowerTSize.

Referenced by MuonShowerInformationProducer::produce().

111  {
112  reco::MuonShower returnShower;
113 
114  // Update the services
115  theService->update(iSetup);
116  setEvent(iEvent);
117  setServices(theService->eventSetup());
118 
119  fillHitsByStation(muon);
120  std::vector<int> nStationHits = theAllStationHits;
121  std::vector<int> nStationCorrelatedHits = theCorrelatedStationHits;
122  std::vector<float> stationShowerSizeT = theStationShowerTSize;
123  std::vector<float> stationShowerDeltaR = theStationShowerDeltaR;
124 
125  returnShower.nStationHits = nStationHits;
126  returnShower.nStationCorrelatedHits = nStationCorrelatedHits;
127  returnShower.stationShowerSizeT = stationShowerSizeT;
128  returnShower.stationShowerDeltaR = stationShowerDeltaR;
129 
130  return returnShower;
131 }
virtual void setEvent(const edm::Event &)
pass the Event to the algorithm at each event
void setServices(const edm::EventSetup &)
set the services needed
std::vector< int > nStationHits
number of all the muon RecHits per chamber crossed by a track (1D hits)
Definition: MuonShower.h:9
std::vector< int > nStationCorrelatedHits
number of the muon RecHits used by segments per chamber crossed by a track
Definition: MuonShower.h:11
void fillHitsByStation(const reco::Muon &)
std::vector< float > stationShowerSizeT
the transverse size of the hit cluster
Definition: MuonShower.h:13
std::vector< float > stationShowerDeltaR
the radius of the cone containing the all the hits around the track
Definition: MuonShower.h:15
MuonTransientTrackingRecHit::MuonRecHitContainer MuonShowerInformationFiller::findPerpCluster ( MuonTransientTrackingRecHit::MuonRecHitContainer muonRecHits) const
private

Definition at line 294 of file MuonShowerInformationFiller.cc.

References perp(), and mps_fire::result.

Referenced by fillHitsByStation().

295  {
296  if (muonRecHits.empty())
297  return muonRecHits;
298 
299  stable_sort(muonRecHits.begin(), muonRecHits.end(), LessPerp());
300 
301  MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator seedhit =
302  min_element(muonRecHits.begin(), muonRecHits.end(), LessPerp());
303 
304  MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ihigh = seedhit;
305  MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ilow = seedhit;
306 
307  float step = 0.1;
308  while (ihigh != muonRecHits.end() - 1 &&
309  (fabs((*(ihigh + 1))->globalPosition().perp() - (*ihigh)->globalPosition().perp()) < step)) {
310  ihigh++;
311  }
312  while (ilow != muonRecHits.begin() &&
313  (fabs((*ilow)->globalPosition().perp() - (*(ilow - 1))->globalPosition().perp()) < step)) {
314  ilow--;
315  }
316 
318 
319  return result;
320 }
T perp() const
Magnitude of transverse component.
step
Definition: StallMonitor.cc:94
std::vector< MuonRecHitPointer > MuonRecHitContainer
TransientTrackingRecHit::ConstRecHitContainer MuonShowerInformationFiller::findThetaCluster ( TransientTrackingRecHit::ConstRecHitContainer muonRecHits,
const GlobalPoint refpoint 
) const
private

Definition at line 267 of file MuonShowerInformationFiller.cc.

References mps_fire::result, and theta().

Referenced by fillHitsByStation().

268  {
269  if (muonRecHits.empty())
270  return muonRecHits;
271 
272  //clustering step by theta
273  float step = 0.05;
275 
276  stable_sort(muonRecHits.begin(), muonRecHits.end(), AbsLessDTheta(refpoint));
277 
278  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit = muonRecHits.begin();
279  ihit != muonRecHits.end() - 1;
280  ++ihit) {
281  if (fabs((*(ihit + 1))->globalPosition().theta() - (*ihit)->globalPosition().theta()) < step) {
282  result.push_back(*ihit);
283  } else {
284  break;
285  }
286  }
287 
288  return result;
289 }
Geom::Theta< T > theta() const
std::vector< ConstRecHitPointer > ConstRecHitContainer
step
Definition: StallMonitor.cc:94
vector< const GeomDet * > MuonShowerInformationFiller::getCompatibleDets ( const reco::Track track) const
private

Definition at line 325 of file MuonShowerInformationFiller.cc.

References begin, category_, crossingPoint(), cscPositionToDets(), dtPositionToDets(), end, reco::TrackBase::eta(), TrajectoryStateOnSurface::globalPosition(), trajectoryStateTransform::innerStateOnSurface(), LogTrace, trajectoryStateTransform::outerStateOnSurface(), reco::TrackBase::p(), reco::TrackBase::phi(), theService, dqmMemoryStats::total, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by fillHitsByStation().

325  {
326  vector<const GeomDet*> total;
327  total.reserve(1000);
328 
329  LogTrace(category_) << "Consider a track " << track.p() << " eta: " << track.eta() << " phi " << track.phi() << endl;
330 
332  track, *theService->trackingGeometry(), &*theService->magneticField());
334  track, *theService->trackingGeometry(), &*theService->magneticField());
335 
336  GlobalPoint innerPos = innerTsos.globalPosition();
337  GlobalPoint outerPos = outerTsos.globalPosition();
338 
339  vector<GlobalPoint> allCrossingPoints;
340 
341  const vector<const DetLayer*>& dtlayers = theService->detLayerGeometry()->allDTLayers();
342 
343  for (auto iLayer = dtlayers.begin(); iLayer != dtlayers.end(); ++iLayer) {
344  // crossing points of track with cylinder
345  GlobalPoint xPoint = crossingPoint(innerPos, outerPos, dynamic_cast<const BarrelDetLayer*>(*iLayer));
346 
347  // check if point is inside the detector
348  if ((fabs(xPoint.y()) < 1000.0) && (fabs(xPoint.z()) < 1500) &&
349  (!(xPoint.y() == 0 && xPoint.x() == 0 && xPoint.z() == 0)))
350  allCrossingPoints.push_back(xPoint);
351  }
352 
353  stable_sort(allCrossingPoints.begin(), allCrossingPoints.end(), LessMag(innerPos));
354 
355  vector<const GeomDet*> tempDT;
356 
357  for (vector<GlobalPoint>::const_iterator ipos = allCrossingPoints.begin(); ipos != allCrossingPoints.end(); ++ipos) {
358  tempDT = dtPositionToDets(*ipos);
359  vector<const GeomDet*>::const_iterator begin = tempDT.begin();
360  vector<const GeomDet*>::const_iterator end = tempDT.end();
361 
362  for (; begin != end; ++begin) {
363  total.push_back(*begin);
364  }
365  }
366  allCrossingPoints.clear();
367 
368  const vector<const DetLayer*>& csclayers = theService->detLayerGeometry()->allCSCLayers();
369  for (auto iLayer = csclayers.begin(); iLayer != csclayers.end(); ++iLayer) {
370  GlobalPoint xPoint = crossingPoint(innerPos, outerPos, dynamic_cast<const ForwardDetLayer*>(*iLayer));
371 
372  // check if point is inside the detector
373  if ((fabs(xPoint.y()) < 1000.0) && (fabs(xPoint.z()) < 1500.0) &&
374  (!(xPoint.y() == 0 && xPoint.x() == 0 && xPoint.z() == 0)))
375  allCrossingPoints.push_back(xPoint);
376  }
377  stable_sort(allCrossingPoints.begin(), allCrossingPoints.end(), LessMag(innerPos));
378 
379  vector<const GeomDet*> tempCSC;
380  for (vector<GlobalPoint>::const_iterator ipos = allCrossingPoints.begin(); ipos != allCrossingPoints.end(); ++ipos) {
381  tempCSC = cscPositionToDets(*ipos);
382  vector<const GeomDet*>::const_iterator begin = tempCSC.begin();
383  vector<const GeomDet*>::const_iterator end = tempCSC.end();
384 
385  for (; begin != end; ++begin) {
386  total.push_back(*begin);
387  }
388  }
389 
390  return total;
391 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:599
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:614
std::vector< const GeomDet * > dtPositionToDets(const GlobalPoint &) const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:617
T z() const
Definition: PV3DBase.h:61
GlobalPoint crossingPoint(const GlobalPoint &, const GlobalPoint &, const BarrelDetLayer *) const
#define end
Definition: vmac.h:39
#define LogTrace(id)
std::vector< const GeomDet * > cscPositionToDets(const GlobalPoint &) const
#define begin
Definition: vmac.h:32
T x() const
Definition: PV3DBase.h:59
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
const MuonServiceProxy* MuonShowerInformationFiller::getService ( ) const
inlineprotected

Definition at line 90 of file MuonShowerInformationFiller.h.

90 { return theService; }
TransientTrackingRecHit::ConstRecHitContainer MuonShowerInformationFiller::hitsFromSegments ( const GeomDet geomDet,
edm::Handle< DTRecSegment4DCollection dtSegments,
edm::Handle< CSCSegmentCollection cscSegments 
) const
private

Definition at line 173 of file MuonShowerInformationFiller.cc.

References MuonTransientTrackingRecHitBreaker::breakInSubRecHits(), category_, MuonSubdetId::CSC, MuonSubdetId::DT, GeomDet::geographicalId(), LogTrace, mag(), FastTimerService_cff::range, DetId::rawId(), MuonTransientTrackingRecHit::specificBuild(), and DetId::subdetId().

Referenced by fillHitsByStation().

176  {
178 
179  DetId geoId = geomDet->geographicalId();
180 
181  if (geoId.subdetId() == MuonSubdetId::DT) {
182  DTChamberId chamberId(geoId.rawId());
183 
184  // loop on segments 4D
186  for (chamberIdIt = dtSegments->id_begin(); chamberIdIt != dtSegments->id_end(); ++chamberIdIt) {
187  if (*chamberIdIt != chamberId)
188  continue;
189 
190  // Get the range for the corresponding ChamberId
191  DTRecSegment4DCollection::range range = dtSegments->get((*chamberIdIt));
192 
193  for (DTRecSegment4DCollection::const_iterator iseg = range.first; iseg != range.second; ++iseg) {
194  if (iseg->dimension() != 4)
195  continue;
196  segments.push_back(MuonTransientTrackingRecHit::specificBuild(geomDet, &*iseg));
197  }
198  }
199  } else if (geoId.subdetId() == MuonSubdetId::CSC) {
200  CSCDetId did(geoId.rawId());
201 
202  for (CSCSegmentCollection::id_iterator chamberId = cscSegments->id_begin(); chamberId != cscSegments->id_end();
203  ++chamberId) {
204  if ((*chamberId).chamber() != did.chamber())
205  continue;
206 
207  // Get the range for the corresponding ChamberId
208  CSCSegmentCollection::range range = cscSegments->get((*chamberId));
209 
210  for (CSCSegmentCollection::const_iterator iseg = range.first; iseg != range.second; ++iseg) {
211  if (iseg->dimension() != 3)
212  continue;
213  segments.push_back(MuonTransientTrackingRecHit::specificBuild(geomDet, &*iseg));
214  }
215  }
216  } else {
217  LogTrace(category_) << "Segments are not built in RPCs" << endl;
218  }
219 
221 
222  if (segments.empty())
223  return allhitscorrelated;
224 
225  TransientTrackingRecHit::ConstRecHitPointer muonRecHit(segments.front());
226  allhitscorrelated = MuonTransientTrackingRecHitBreaker::breakInSubRecHits(muonRecHit, 2);
227 
228  if (segments.size() == 1)
229  return allhitscorrelated;
230 
231  for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator iseg = segments.begin() + 1;
232  iseg != segments.end();
233  ++iseg) {
237 
238  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit1 = hits1.begin(); ihit1 != hits1.end();
239  ++ihit1) {
240  bool usedbefore = false;
241  //unused DetId thisID = (*ihit1)->geographicalId();
242  //LocalPoint lp1dinsegHit = (*ihit1)->localPosition();
243  GlobalPoint gp1dinsegHit = (*ihit1)->globalPosition();
244 
245  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit2 = allhitscorrelated.begin();
246  ihit2 != allhitscorrelated.end();
247  ++ihit2) {
248  //unused DetId thisID2 = (*ihit2)->geographicalId();
249  //LocalPoint lp1dinsegHit2 = (*ihit2)->localPosition();
250  GlobalPoint gp1dinsegHit2 = (*ihit2)->globalPosition();
251 
252  if ((gp1dinsegHit2 - gp1dinsegHit).mag() < 1.0)
253  usedbefore = true;
254  }
255  if (!usedbefore)
256  allhitscorrelated.push_back(*ihit1);
257  }
258  }
259 
260  return allhitscorrelated;
261 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
identifier iterator
Definition: RangeMap.h:130
static TransientTrackingRecHit::ConstRecHitContainer breakInSubRecHits(TransientTrackingRecHit::ConstRecHitPointer, int granularity)
takes a muon rechit and returns its sub-rechits given a certain granularity
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
#define LogTrace(id)
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:17
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
std::vector< MuonRecHitPointer > MuonRecHitContainer
void MuonShowerInformationFiller::setEvent ( const edm::Event event)
virtual

pass the Event to the algorithm at each event

Definition at line 136 of file MuonShowerInformationFiller.cc.

References theAllStationHits, theCorrelatedStationHits, theCSCRecHits, theCSCRecHitToken, theCSCSegments, theCSCSegmentsToken, theDT4DRecSegments, theDT4DRecSegmentToken, theDTRecHits, theDTRecHitToken, theStationShowerDeltaR, and theStationShowerTSize.

Referenced by fillShowerInformation().

136  {
137  // get all the necesary products
138  event.getByToken(theDTRecHitToken, theDTRecHits);
139  event.getByToken(theCSCRecHitToken, theCSCRecHits);
140  event.getByToken(theCSCSegmentsToken, theCSCSegments);
141  event.getByToken(theDT4DRecSegmentToken, theDT4DRecSegments);
142 
143  for (int istat = 0; istat < 4; istat++) {
144  theStationShowerDeltaR.at(istat) = 0.;
145  theStationShowerTSize.at(istat) = 0.;
146  theAllStationHits.at(istat) = 0;
147  theCorrelatedStationHits.at(istat) = 0;
148  }
149 }
edm::EDGetTokenT< CSCSegmentCollection > theCSCSegmentsToken
edm::EDGetTokenT< CSCRecHit2DCollection > theCSCRecHitToken
edm::Handle< DTRecHitCollection > theDTRecHits
edm::Handle< CSCSegmentCollection > theCSCSegments
edm::EDGetTokenT< DTRecSegment4DCollection > theDT4DRecSegmentToken
edm::Handle< CSCRecHit2DCollection > theCSCRecHits
edm::EDGetTokenT< DTRecHitCollection > theDTRecHitToken
edm::Handle< DTRecSegment4DCollection > theDT4DRecSegments
void MuonShowerInformationFiller::setServices ( const edm::EventSetup setup)

set the services needed

Definition at line 154 of file MuonShowerInformationFiller.cc.

References edm::EventSetup::get(), theCacheId_TRH, theCSCGeometry, theDTGeometry, theField, theMuonRecHitBuilder, theMuonRecHitBuilderName, theTracker, theTrackerRecHitBuilder, theTrackerRecHitBuilderName, and theTrackingGeometry.

Referenced by fillShowerInformation().

154  {
155  // DetLayer Geometry
157  setup.get<IdealMagneticFieldRecord>().get(theField);
159  setup.get<MuonGeometryRecord>().get(theCSCGeometry);
160  setup.get<MuonGeometryRecord>().get(theDTGeometry);
161 
162  // Transient Rechit Builders
163  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
164  if (newCacheId_TRH != theCacheId_TRH) {
167  }
168 }
edm::ESHandle< MagneticField > theField
edm::ESHandle< GeometricSearchTracker > theTracker
edm::ESHandle< CSCGeometry > theCSCGeometry
edm::ESHandle< DTGeometry > theDTGeometry
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
T get() const
Definition: EventSetup.h:73
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry

Member Data Documentation

std::string MuonShowerInformationFiller::category_
private
std::vector<int> MuonShowerInformationFiller::theAllStationHits
private
unsigned long long MuonShowerInformationFiller::theCacheId_MT
private

Definition at line 186 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

unsigned long long MuonShowerInformationFiller::theCacheId_TRH
private

Definition at line 185 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setServices().

std::vector<int> MuonShowerInformationFiller::theCorrelatedStationHits
private
edm::ESHandle<CSCGeometry> MuonShowerInformationFiller::theCSCGeometry
private

Definition at line 213 of file MuonShowerInformationFiller.h.

Referenced by setServices().

edm::InputTag MuonShowerInformationFiller::theCSCRecHitLabel
private

Definition at line 195 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

edm::Handle<CSCRecHit2DCollection> MuonShowerInformationFiller::theCSCRecHits
private

Definition at line 200 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

edm::EDGetTokenT<CSCRecHit2DCollection> MuonShowerInformationFiller::theCSCRecHitToken
private

Definition at line 205 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

edm::Handle<CSCSegmentCollection> MuonShowerInformationFiller::theCSCSegments
private

Definition at line 201 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

edm::InputTag MuonShowerInformationFiller::theCSCSegmentsLabel
private

Definition at line 196 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

edm::EDGetTokenT<CSCSegmentCollection> MuonShowerInformationFiller::theCSCSegmentsToken
private

Definition at line 206 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

edm::InputTag MuonShowerInformationFiller::theDT4DRecSegmentLabel
private

Definition at line 197 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

edm::Handle<DTRecSegment4DCollection> MuonShowerInformationFiller::theDT4DRecSegments
private

Definition at line 202 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

edm::EDGetTokenT<DTRecSegment4DCollection> MuonShowerInformationFiller::theDT4DRecSegmentToken
private

Definition at line 207 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

edm::ESHandle<DTGeometry> MuonShowerInformationFiller::theDTGeometry
private

Definition at line 214 of file MuonShowerInformationFiller.h.

Referenced by setServices().

edm::InputTag MuonShowerInformationFiller::theDTRecHitLabel
private

Definition at line 194 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

edm::Handle<DTRecHitCollection> MuonShowerInformationFiller::theDTRecHits
private

Definition at line 199 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

edm::EDGetTokenT<DTRecHitCollection> MuonShowerInformationFiller::theDTRecHitToken
private

Definition at line 204 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

edm::ESHandle<MagneticField> MuonShowerInformationFiller::theField
private

Definition at line 212 of file MuonShowerInformationFiller.h.

Referenced by setServices().

edm::ESHandle<TransientTrackingRecHitBuilder> MuonShowerInformationFiller::theMuonRecHitBuilder
private

Definition at line 192 of file MuonShowerInformationFiller.h.

Referenced by setServices().

std::string MuonShowerInformationFiller::theMuonRecHitBuilderName
private

Definition at line 191 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setServices().

MuonServiceProxy* MuonShowerInformationFiller::theService
private
std::vector<float> MuonShowerInformationFiller::theStationShowerDeltaR
private
std::vector<float> MuonShowerInformationFiller::theStationShowerTSize
private
edm::ESHandle<GeometricSearchTracker> MuonShowerInformationFiller::theTracker
private

Definition at line 210 of file MuonShowerInformationFiller.h.

Referenced by setServices().

edm::ESHandle<TransientTrackingRecHitBuilder> MuonShowerInformationFiller::theTrackerRecHitBuilder
private

Definition at line 189 of file MuonShowerInformationFiller.h.

Referenced by setServices().

std::string MuonShowerInformationFiller::theTrackerRecHitBuilderName
private

Definition at line 188 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setServices().

edm::ESHandle<GlobalTrackingGeometry> MuonShowerInformationFiller::theTrackingGeometry
private

Definition at line 211 of file MuonShowerInformationFiller.h.

Referenced by setServices().