CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
MuonRecHitContainer findPhiCluster (MuonRecHitContainer &, const GlobalPoint &) 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
< CSCRecHit2DCollection
theCSCRecHits
 
edm::EDGetTokenT
< CSCRecHit2DCollection
theCSCRecHitToken
 
edm::Handle< CSCSegmentCollectiontheCSCSegments
 
edm::InputTag theCSCSegmentsLabel
 
edm::EDGetTokenT
< CSCSegmentCollection
theCSCSegmentsToken
 
edm::InputTag theDT4DRecSegmentLabel
 
edm::Handle
< DTRecSegment4DCollection
theDT4DRecSegments
 
edm::EDGetTokenT
< DTRecSegment4DCollection
theDT4DRecSegmentToken
 
edm::ESHandle< DTGeometrytheDTGeometry
 
edm::InputTag theDTRecHitLabel
 
edm::Handle< DTRecHitCollectiontheDTRecHits
 
edm::EDGetTokenT
< DTRecHitCollection
theDTRecHitToken
 
edm::ESHandle< MagneticFieldtheField
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
MuonServiceProxytheService
 
std::vector< float > theStationShowerDeltaR
 
std::vector< float > theStationShowerTSize
 
edm::ESHandle
< GeometricSearchTracker
theTracker
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTrackerRecHitBuilder
 
std::string theTrackerRecHitBuilderName
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 

Detailed Description

Description: class for muon shower identification

Author
: A. Svyatkovskiy, Purdue University

Definition at line 57 of file MuonShowerInformationFiller.h.

Member Typedef Documentation

Definition at line 63 of file MuonShowerInformationFiller.h.

Definition at line 61 of file MuonShowerInformationFiller.h.

Definition at line 62 of file MuonShowerInformationFiller.h.

Constructor & Destructor Documentation

MuonShowerInformationFiller::MuonShowerInformationFiller ( )
inline

constructors

Definition at line 68 of file MuonShowerInformationFiller.h.

68 {};
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.

68  :
69  theService(0),
70  theDTRecHitLabel(par.getParameter<InputTag>("DTRecSegmentLabel")),
71  theCSCRecHitLabel(par.getParameter<InputTag>("CSCRecSegmentLabel")),
72  theCSCSegmentsLabel(par.getParameter<InputTag>("CSCSegmentLabel")),
73  theDT4DRecSegmentLabel(par.getParameter<InputTag>("DT4DRecSegmentLabel"))
74 {
75 
80 
81 
82  edm::ParameterSet serviceParameters = par.getParameter<edm::ParameterSet>("ServiceParameters");
83  theService = new MuonServiceProxy(serviceParameters);
84 
85  theTrackerRecHitBuilderName = par.getParameter<string>("TrackerRecHitBuilder");
86  theMuonRecHitBuilderName = par.getParameter<string>("MuonRecHitBuilder");
87 
88  theCacheId_TRH = 0;
89  theCacheId_MT = 0;
90 
91  category_ = "MuonShowerInformationFiller";
92 
93  for (int istat = 0; istat < 4; istat++) {
94  theStationShowerDeltaR.push_back(0.);
95  theStationShowerTSize.push_back(0.);
96  theAllStationHits.push_back(0);
97  theCorrelatedStationHits.push_back(0);
98  }
99 
100 }
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 105 of file MuonShowerInformationFiller.cc.

References theService.

105  {
106  if (theService) delete theService;
107 }

Member Function Documentation

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

Definition at line 443 of file MuonShowerInformationFiller.cc.

References BarrelDetLayer::specificSurface().

Referenced by crossingPoint(), and getCompatibleDets().

445  {
446 
447  const BoundCylinder& bc = dl->specificSurface();
448  return crossingPoint(p1, p2, bc);
449 
450 }
GlobalPoint crossingPoint(const GlobalPoint &, const GlobalPoint &, const BarrelDetLayer *) const
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
GlobalPoint MuonShowerInformationFiller::crossingPoint ( const GlobalPoint p1,
const GlobalPoint p2,
const Cylinder cyl 
) const
private

Definition at line 452 of file MuonShowerInformationFiller.cc.

References a, n0, p2, Cylinder::radius(), CosmicsPD_Skims::radius, slope, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

454  {
455 
456  float radius = cyl.radius();
457 
458  GlobalVector dp = p1 - p2;
459  float slope = dp.x()/dp.y();
460  float a = p1.x() - slope * p1.y();
461 
462  float n2 = (1 + slope * slope);
463  float n1 = 2*a*slope;
464  float n0 = a*a - radius*radius;
465 
466  float y1 = 9999;
467  float y2 = 9999;
468  if ( n1*n1 - 4*n2*n0 > 0 ) {
469  y1 = (-n1 + sqrt(n1*n1 - 4*n2*n0) ) / (2 * n2);
470  y2 = (-n1 - sqrt(n1*n1 - 4*n2*n0) ) / (2 * n2);
471  }
472 
473  float x1 = p1.x() + slope * (y1 - p1.y());
474  float x2 = p1.x() + slope * (y2 - p1.y());
475 
476  float slopeZ = dp.z()/dp.y();
477 
478  float z1 = p1.z() + slopeZ * (y1 - p1.y());
479  float z2 = p1.z() + slopeZ * (y2 - p1.y());
480 
481  // there are two crossing points, return the one that is in the same quadrant as point of extrapolation
482  if ((p2.x()*x1 > 0) && (y1*p2.y() > 0) && (z1*p2.z() > 0)) {
483  return GlobalPoint(x1, y1, z1);
484  } else {
485  return GlobalPoint(x2, y2, z2);
486  }
487 
488 }
static const double slope[3]
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:67
int n0
Definition: AMPTWrapper.h:34
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
double p2[4]
Definition: TauolaWrapper.h:90
double a
Definition: hdecay.h:121
T x() const
Definition: PV3DBase.h:62
GlobalPoint MuonShowerInformationFiller::crossingPoint ( const GlobalPoint p1,
const GlobalPoint p2,
const ForwardDetLayer dl 
) const
private

Definition at line 494 of file MuonShowerInformationFiller.cc.

References crossingPoint(), and ForwardDetLayer::specificSurface().

496  {
497 
498  const BoundDisk& bc = dl->specificSurface();
499  return crossingPoint(p1, p2, bc);
500 
501 }
virtual const BoundDisk & specificSurface() const
GlobalPoint crossingPoint(const GlobalPoint &, const GlobalPoint &, const BarrelDetLayer *) const
GlobalPoint MuonShowerInformationFiller::crossingPoint ( const GlobalPoint ,
const GlobalPoint ,
const Disk  
) const
private
vector< const GeomDet * > MuonShowerInformationFiller::cscPositionToDets ( const GlobalPoint gp) const
private

Definition at line 602 of file MuonShowerInformationFiller.cc.

References category_, SiPixelRawToDigiRegional_cfi::deltaPhi, i, LogTrace, M_PI, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), query::result, relativeConstraints::ring, mergeVDriftHistosByStation::sectors, relativeConstraints::station, theService, and PV3DBase< T, PVType, FrameType >::z().

Referenced by getCompatibleDets().

602  {
603 
604  // determine the endcap side
605  int endcap = 0;
606  if (gp.z() > 0) {endcap = 1;} else {endcap = 2;}
607 
608  // determine the csc station and range of rings
609  int station = 5;
610 
611  // check all rings in a station
612  if ( fabs(gp.z()) > 1000. && fabs(gp.z()) < 1055.0 ) {
613  station = 4;
614  }
615  else if ( fabs(gp.z()) > 910.0 && fabs(gp.z()) < 965.0) {
616  station = 3;
617  }
618  else if ( fabs(gp.z()) > 800.0 && fabs(gp.z()) < 860.0) {
619  station = 2;
620  }
621  else if ( fabs(gp.z()) > 570.0 && fabs(gp.z()) < 730.0) {
622  station = 1;
623  }
624 
625  vector<int> sectors;
626 
627  float phistep1 = M_PI/18.; //for all the rings except first rings for stations > 1
628  float phistep2 = M_PI/9.;
629  float phigp = (float)gp.phi();
630 
631  int ring = -1;
632 
633  // determine the ring
634  if (station == 1) {
635 
636 //FIX ME!!!
637  if (gp.perp() > 100 && gp.perp() < 270) ring = 1;
638  else if (gp.perp() > 270 && gp.perp() < 450) ring = 2;
639  else if (gp.perp() > 450 && gp.perp() < 695) ring = 3;
640  else if (gp.perp() > 100 && gp.perp() < 270) ring = 4;
641 
642  }
643  else if (station == 2) {
644 
645  if (gp.perp() > 140 && gp.perp() < 350) ring = 1;
646  else if (gp.perp() > 350 && gp.perp() < 700) ring = 2;
647 
648  }
649  else if (station == 3) {
650 
651  if (gp.perp() > 160 && gp.perp() < 350) ring = 1;
652  else if (gp.perp() > 350 && gp.perp() < 700) ring = 2;
653 
654  }
655  else if (station == 4) {
656 
657  if (gp.perp() > 175 && gp.perp() < 350) ring = 1;
658  else if (gp.perp() > 350 && gp.perp() < 700) ring = 2;
659 
660  }
661 
662  if (station > 1 && ring == 1) {
663 
664  // we have 18 sectors in that case
665  for (int i = 0; i < 18; i++) {
666  if ( fabs(deltaPhi(phigp, i*phistep2)) < phistep2 ) sectors.push_back(i+1);
667  }
668 
669  } else {
670 
671  // we have 36 sectors in that case
672  for (int i = 0; i < 36; i++) {
673  if ( fabs(deltaPhi(phigp, i*phistep1)) < phistep1 ) sectors.push_back(i+1);
674  }
675 }
676 
677  LogTrace(category_) << "CSC position to dets" << endl;
678  LogTrace(category_) << "ring: " << ring << endl;
679  LogTrace(category_) << "endcap: " << endcap << endl;
680  LogTrace(category_) << "station: " << station << endl;
681  LogTrace(category_) << "CSC number of sectors to consider: " << sectors.size() << endl;
682 
683 
684  // check exceptional cases
685  vector<const GeomDet*> result;
686  if (station > 4 || station < 1) return result;
687  if (endcap == 0) return result;
688  if (ring == -1) return result;
689 
690  int minlayer = 1;
691  int maxlayer = 6;
692 
693  for (vector<int>::const_iterator isector = sectors.begin(); isector != sectors.end(); ++isector) {
694  for (int ilayer = minlayer; ilayer != maxlayer + 1; ++ ilayer) {
695  CSCDetId cscid(endcap, station, ring, (*isector), ilayer);
696  result.push_back(theService->trackingGeometry()->idToDet(cscid));
697  }
698  }
699 
700  return result;
701 
702 }
int i
Definition: DBlmapReader.cc:9
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
#define LogTrace(id)
#define M_PI
vector< const GeomDet * > MuonShowerInformationFiller::dtPositionToDets ( const GlobalPoint gp) const
private

Definition at line 533 of file MuonShowerInformationFiller.cc.

References category_, SiPixelRawToDigiRegional_cfi::deltaPhi, LogTrace, M_PI, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), query::result, mergeVDriftHistosByStation::sectors, relativeConstraints::station, theService, and PV3DBase< T, PVType, FrameType >::z().

Referenced by getCompatibleDets().

533  {
534 
535  int minwheel = -3;
536  int maxwheel = -3;
537  if ( gp.z() < -680.0 ) { minwheel = -3; maxwheel = -3;}
538  else if ( gp.z() < -396.0 ) { minwheel = -2; maxwheel = -1;}
539  else if (gp.z() < -126.8) { minwheel = -2; maxwheel = 0; }
540  else if (gp.z() < 126.8) { minwheel = -1; maxwheel = 1; }
541  else if (gp.z() < 396.0) { minwheel = 0; maxwheel = 2; }
542  else if (gp.z() < 680.0) { minwheel = 1; maxwheel = 2; }
543  else { minwheel = 3; maxwheel = 3; }
544 
545  int station = 5;
546  if ( gp.perp() > 680.0 && gp.perp() < 755.0 ) station = 4;
547  else if ( gp.perp() > 580.0 ) station = 3;
548  else if ( gp.perp() > 480.0 ) station = 2;
549  else if ( gp.perp() > 380.0 ) station = 1;
550  else station = 0;
551 
552  vector<int> sectors;
553 
554  float phistep = M_PI/6;
555 
556  float phigp = (float)gp.phi();
557 
558  if ( fabs(deltaPhi(phigp, 0*phistep)) < phistep ) sectors.push_back(1);
559  if ( fabs(deltaPhi(phigp, phistep)) < phistep ) sectors.push_back(2);
560  if ( fabs(deltaPhi(phigp, 2*phistep)) < phistep ) sectors.push_back(3);
561  if ( fabs(deltaPhi(phigp, 3*phistep)) < phistep ) {
562  sectors.push_back(4);
563  if (station == 4) sectors.push_back(13);
564  }
565  if ( fabs(deltaPhi(phigp, 4*phistep)) < phistep ) sectors.push_back(5);
566  if ( fabs(deltaPhi(phigp, 5*phistep)) < phistep ) sectors.push_back(6);
567  if ( fabs(deltaPhi(phigp, 6*phistep)) < phistep ) sectors.push_back(7);
568  if ( fabs(deltaPhi(phigp, 7*phistep)) < phistep ) sectors.push_back(8);
569  if ( fabs(deltaPhi(phigp, 8*phistep)) < phistep ) sectors.push_back(9);
570  if ( fabs(deltaPhi(phigp, 9*phistep)) < phistep ) {
571  sectors.push_back(10);
572  if (station == 4) sectors.push_back(14);
573  }
574  if ( fabs(deltaPhi(phigp, 10*phistep)) < phistep ) sectors.push_back(11);
575  if ( fabs(deltaPhi(phigp, 11*phistep)) < phistep ) sectors.push_back(12);
576 
577  LogTrace(category_) << "DT position to dets" << endl;
578  LogTrace(category_) << "number of sectors to consider: " << sectors.size() << endl;
579  LogTrace(category_) << "station: " << station << " wheels: " << minwheel << " " << maxwheel << endl;
580 
581  vector<const GeomDet*> result;
582  if (station > 4 || station < 1) return result;
583  if (minwheel > 2 || maxwheel < -2) return result;
584 
585  for (vector<int>::const_iterator isector = sectors.begin(); isector != sectors.end(); ++isector ) {
586  for (int iwheel = minwheel; iwheel != maxwheel + 1; ++iwheel) {
587  DTChamberId chamberid(iwheel, station, (*isector));
588  result.push_back(theService->trackingGeometry()->idToDet(chamberid));
589  }
590  }
591 
592  LogTrace(category_) << "number of GeomDets for this track: " << result.size() << endl;
593 
594  return result;
595 
596 }
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
#define LogTrace(id)
#define M_PI
void MuonShowerInformationFiller::fillHitsByStation ( const reco::Muon muon)

Definition at line 707 of file MuonShowerInformationFiller.cc.

References funct::abs(), begin, category_, MuonSubdetId::CSC, SiPixelRawToDigiRegional_cfi::deltaPhi, DetId::det(), cond::rpcobgas::detid, MuonSubdetId::DT, relativeConstraints::empty, end, findPerpCluster(), findPhiCluster(), findThetaCluster(), getCompatibleDets(), reco::Muon::globalTrack(), hitsFromSegments(), iseed, reco::Muon::isGlobalMuon(), reco::Muon::isStandAloneMuon(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), DTChamberId::maxLayerId, DTChamberId::maxSuperLayerId, DTChamberId::minLayerId, DTChamberId::minSuperLayerId, DetId::Muon, reco::Muon::outerTrack(), funct::pow(), DetId::rawId(), relativeConstraints::ring, MuonSubdetId::RPC, MuonTransientTrackingRecHit::specificBuild(), mathSSE::sqrt(), relativeConstraints::station, DetId::subdetId(), groupFilesInBlocks::temp, theAllStationHits, theCorrelatedStationHits, theCSCRecHits, theCSCSegments, theDT4DRecSegments, theDTRecHits, theStationShowerDeltaR, and theStationShowerTSize.

Referenced by fillShowerInformation().

707  {
708 
709  reco::TrackRef track;
710  if ( muon.isGlobalMuon() ) track = muon.globalTrack();
711  else if ( muon.isStandAloneMuon() ) track = muon.outerTrack();
712  else return;
713 
714  // split 1D rechits by station
715  vector<MuonRecHitContainer> muonRecHits(4);
716 
717  // split rechits from segs by station
718  vector<TransientTrackingRecHit::ConstRecHitContainer> muonCorrelatedHits(4);
719 
720  // get vector of GeomDets compatible with a track
721  vector<const GeomDet*> compatibleLayers = getCompatibleDets(*track);
722 
723  // for special cases: CSC station 1
724  MuonRecHitContainer tmpCSC1;
725  bool dtOverlapToCheck = false;
726  bool cscOverlapToCheck = false;
727 
728  for (vector<const GeomDet*>::const_iterator igd = compatibleLayers.begin(); igd != compatibleLayers.end(); igd++ ) {
729 
730  // get det id
731  DetId geoId = (*igd)->geographicalId();
732 
733  // skip tracker hits
734  if (geoId.det()!= DetId::Muon) continue;
735 
736  // DT
737  if ( geoId.subdetId() == MuonSubdetId::DT ) {
738 
739  // get station
740  DTChamberId detid(geoId.rawId());
741  int station = detid.station();
742  int wheel = detid.wheel();
743 
744  // get rechits from segments per station
746  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_begin = muonCorrelatedHitsTmp.begin();
747  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_end = muonCorrelatedHitsTmp.end();
748 
749  for (; hits_begin!= hits_end;++hits_begin) {
750  muonCorrelatedHits.at(station-1).push_back(*hits_begin);
751  }
752 
753  //check overlap certain wheels and stations
754  if (abs(wheel) == 2 && station != 4 && station != 1) dtOverlapToCheck = true;
755 
756  // loop over all superlayers of a DT chamber
757  for (int isuperlayer = DTChamberId::minSuperLayerId; isuperlayer != DTChamberId::maxSuperLayerId + 1; ++isuperlayer) {
758  // loop over all layers inside the superlayer
759  for (int ilayer = DTChamberId::minLayerId; ilayer != DTChamberId::maxLayerId+1; ++ilayer) {
760  DTLayerId lid(detid, isuperlayer, ilayer);
761  DTRecHitCollection::range dRecHits = theDTRecHits->get(lid);
762  for (DTRecHitCollection::const_iterator rechit = dRecHits.first; rechit != dRecHits.second;++rechit) {
763  vector<const TrackingRecHit*> subrechits = (*rechit).recHits();
764  for (vector<const TrackingRecHit*>::iterator irechit = subrechits.begin(); irechit != subrechits.end(); ++irechit) {
765  muonRecHits.at(station-1).push_back(MuonTransientTrackingRecHit::specificBuild((&**igd),&**irechit));
766  }
767  }
768  }
769  }
770  }
771  else if (geoId.subdetId() == MuonSubdetId::CSC) {
772 
773  // get station
774  CSCDetId did(geoId.rawId());
775  int station = did.station();
776  int ring = did.ring();
777 
778  //get rechits from segments by station
780  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_begin = muonCorrelatedHitsTmp.begin();
781  TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_end = muonCorrelatedHitsTmp.end();
782 
783  for (; hits_begin!= hits_end;++hits_begin) {
784  muonCorrelatedHits.at(station-1).push_back(*hits_begin);
785  }
786 
787  if ((station == 1 && ring == 3) && dtOverlapToCheck) cscOverlapToCheck = true;
788 
789  // split 1D rechits by station
790  CSCRecHit2DCollection::range dRecHits = theCSCRecHits->get(did);
791  for (CSCRecHit2DCollection::const_iterator rechit = dRecHits.first; rechit != dRecHits.second; ++rechit) {
792 
793  if (!cscOverlapToCheck) {
794  muonRecHits.at(station-1).push_back(MuonTransientTrackingRecHit::specificBuild((&**igd),&*rechit));
795  } else {
796  tmpCSC1.push_back(MuonTransientTrackingRecHit::specificBuild((&**igd),&*rechit));
797 
798  //sort by perp, then insert to appropriate container
800  if (temp.empty()) continue;
801 
802  float center;
803  if (temp.size() > 1) {
804  center = (temp.front()->globalPosition().perp() + temp.back()->globalPosition().perp())/2.;
805  } else {
806  center = temp.front()->globalPosition().perp();
807  }
808  temp.clear();
809 
810  if (center > 550.) {
811  muonRecHits.at(2).insert(muonRecHits.at(2).end(),tmpCSC1.begin(),tmpCSC1.end());
812  } else {
813  muonRecHits.at(1).insert(muonRecHits.at(1).end(),tmpCSC1.begin(),tmpCSC1.end());
814  }
815  tmpCSC1.clear();
816  }
817  }
818  } else if (geoId.subdetId() == MuonSubdetId::RPC) {
819  LogTrace(category_) << "Wrong subdet id" << endl;
820  }
821  }//loop over GeomDets compatible with a track
822 
823  // calculate number of all and correlated hits
824  for (int stat = 0; stat < 4; stat++) {
825  theCorrelatedStationHits[stat] = muonCorrelatedHits.at(stat).size();
826  theAllStationHits[stat] = muonRecHits[stat].size();
827  }
828  LogTrace(category_) << "Hits used by the segments, by station "
829  << theCorrelatedStationHits.at(0) << " "
830  << theCorrelatedStationHits.at(1) << " "
831  << theCorrelatedStationHits.at(2) << " "
832  << theCorrelatedStationHits.at(3) << endl;
833 
834  LogTrace(category_) << "All DT 1D/CSC 2D hits, by station "
835  << theAllStationHits.at(0) << " "
836  << theAllStationHits.at(1) << " "
837  << theAllStationHits.at(2) << " "
838  << theAllStationHits.at(3) << endl;
839 
840  //station shower sizes
841  MuonTransientTrackingRecHit::MuonRecHitContainer muonRecHitsPhiTemp, muonRecHitsPhiBest;
842  TransientTrackingRecHit::ConstRecHitContainer muonRecHitsThetaTemp, muonRecHitsThetaBest;
843 
844  // send station hits to the clustering algorithm
845  for ( int stat = 0; stat != 4; stat++ ) {
846  if (!muonRecHits[stat].empty()) {
847  stable_sort(muonRecHits[stat].begin(), muonRecHits[stat].end(), LessPhi());
848 
849  float dphimax = 0;
850  for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator iseed = muonRecHits[stat].begin(); iseed != muonRecHits[stat].end(); ++iseed) {
851  if (!(*iseed)->isValid()) continue;
852  GlobalPoint refpoint = (*iseed)->globalPosition(); //starting from the one with smallest value of phi
853  muonRecHitsPhiTemp.clear();
854  muonRecHitsPhiTemp = findPhiCluster(muonRecHits[stat], refpoint); //get clustered hits for this iseed
855  if (muonRecHitsPhiTemp.size() > 1) {
856  float dphi = fabs(deltaPhi((float)muonRecHitsPhiTemp.back()->globalPosition().phi(), (float)muonRecHitsPhiTemp.front()->globalPosition().phi()));
857  if (dphi > dphimax) {
858  dphimax = dphi;
859  muonRecHitsPhiBest = muonRecHitsPhiTemp;
860  }
861  } //at least two hits
862  }//loop over seeds
863 
864  //fill showerTs
865  if (!muonRecHitsPhiBest.empty()) {
866  muonRecHits[stat] = muonRecHitsPhiBest;
867  stable_sort(muonRecHits[stat].begin(), muonRecHits[stat].end(), LessAbsMag());
868  muonRecHits[stat].front();
869  GlobalPoint refpoint = muonRecHits[stat].front()->globalPosition();
870  theStationShowerTSize.at(stat) = refpoint.mag() * dphimax;
871  }
872 
873  //for theta
874  if (!muonCorrelatedHits.at(stat).empty()) {
875 
876  float dthetamax = 0;
877  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator iseed = muonCorrelatedHits.at(stat).begin(); iseed != muonCorrelatedHits.at(stat).end(); ++iseed) {
878  if (!(*iseed)->isValid()) continue;
879  GlobalPoint refpoint = (*iseed)->globalPosition(); //starting from the one with smallest value of phi
880  muonRecHitsThetaTemp.clear();
881  muonRecHitsThetaTemp = findThetaCluster(muonCorrelatedHits.at(stat), refpoint);
882  }//loop over seeds
883  if (muonRecHitsThetaTemp.size() > 1) {
884  float dtheta = fabs((float)muonRecHitsThetaTemp.back()->globalPosition().theta() - (float)muonRecHitsThetaTemp.front()->globalPosition().theta());
885  if (dtheta > dthetamax) {
886  dthetamax = dtheta;
887  muonRecHitsThetaBest = muonRecHitsThetaTemp;
888  }
889  } //at least two hits
890  }//not empty container2
891 
892  //fill deltaRs
893  if (muonRecHitsThetaBest.size() > 1 && muonRecHitsPhiBest.size() > 1)
894  theStationShowerDeltaR.at(stat) = sqrt(pow(muonRecHitsPhiBest.front()->globalPosition().phi()-muonRecHitsPhiBest.back()->globalPosition().phi(),2)+pow(muonRecHitsThetaBest.front()->globalPosition().theta()-muonRecHitsThetaBest.back()->globalPosition().theta(),2));
895 
896  }//not empty container
897  }//loop over station
898 
899  LogTrace(category_) << "deltaR around a track containing all the station hits, by station "
900  << theStationShowerDeltaR.at(0) << " "
901  << theStationShowerDeltaR.at(1) << " "
902  << theStationShowerDeltaR.at(2) << " "
903  << theStationShowerDeltaR.at(3) << endl;
904 
905 
906  LogTrace(category_) << "Transverse cluster size, by station "
907  << theStationShowerTSize.at(0) << " "
908  << theStationShowerTSize.at(1) << " "
909  << theStationShowerTSize.at(2) << " "
910  << theStationShowerTSize.at(3) << endl;
911 
912  return;
913 
914 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
bool isGlobalMuon() const
Definition: Muon.h:218
bool isStandAloneMuon() const
Definition: Muon.h:220
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int CSC
Definition: MuonSubdetId.h:13
T mag() const
Definition: PV3DBase.h:67
static const int maxLayerId
highest layer id
Definition: DTChamberId.h:85
T sqrt(T t)
Definition: SSEVec.h:48
edm::Handle< DTRecHitCollection > theDTRecHits
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:83
#define end
Definition: vmac.h:37
static const int maxSuperLayerId
highest superlayer id
Definition: DTChamberId.h:81
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
#define LogTrace(id)
edm::Handle< CSCSegmentCollection > theCSCSegments
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:51
TransientTrackingRecHit::ConstRecHitContainer findThetaCluster(TransientTrackingRecHit::ConstRecHitContainer &, const GlobalPoint &) const
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:18
TransientTrackingRecHit::ConstRecHitContainer hitsFromSegments(const GeomDet *, edm::Handle< DTRecSegment4DCollection >, edm::Handle< CSCSegmentCollection >) const
int iseed
Definition: AMPTWrapper.h:124
std::vector< const GeomDet * > getCompatibleDets(const reco::Track &) const
edm::Handle< CSCRecHit2DCollection > theCSCRecHits
static const int minSuperLayerId
loweset super layer id. 0 indicates a full chamber
Definition: DTChamberId.h:79
#define begin
Definition: vmac.h:30
static const int RPC
Definition: MuonSubdetId.h:14
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
int station() const
Definition: CSCDetId.h:99
static const int DT
Definition: MuonSubdetId.h:12
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
MuonRecHitContainer findPerpCluster(MuonRecHitContainer &muonRecHits) const
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
std::vector< MuonRecHitPointer > MuonRecHitContainer
MuonRecHitContainer findPhiCluster(MuonRecHitContainer &, const GlobalPoint &) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
edm::Handle< DTRecSegment4DCollection > theDT4DRecSegments
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:54
reco::MuonShower MuonShowerInformationFiller::fillShowerInformation ( const reco::Muon muon,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

fill muon shower variables

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

112  {
113 
114  reco::MuonShower returnShower;
115 
116  // Update the services
117  theService->update(iSetup);
118  setEvent(iEvent);
119  setServices(theService->eventSetup());
120 
121  fillHitsByStation(muon);
122  std::vector<int> nStationHits = theAllStationHits;
123  std::vector<int> nStationCorrelatedHits = theCorrelatedStationHits;
124  std::vector<float> stationShowerSizeT = theStationShowerTSize;
125  std::vector<float> stationShowerDeltaR = theStationShowerDeltaR;
126 
127  returnShower.nStationHits = nStationHits;
128  returnShower.nStationCorrelatedHits = nStationCorrelatedHits;
129  returnShower.stationShowerSizeT = stationShowerSizeT;
130  returnShower.stationShowerDeltaR = stationShowerDeltaR;
131 
132  return returnShower;
133 
134 }
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:8
std::vector< int > nStationCorrelatedHits
number of the muon RecHits used by segments per chamber crossed by a track
Definition: MuonShower.h:10
void fillHitsByStation(const reco::Muon &)
std::vector< float > stationShowerSizeT
the transverse size of the hit cluster
Definition: MuonShower.h:12
std::vector< float > stationShowerDeltaR
the radius of the cone containing the all the hits around the track
Definition: MuonShower.h:14
MuonTransientTrackingRecHit::MuonRecHitContainer MuonShowerInformationFiller::findPerpCluster ( MuonTransientTrackingRecHit::MuonRecHitContainer muonRecHits) const
private

Definition at line 337 of file MuonShowerInformationFiller.cc.

References perp(), query::result, and relval_parameters_module::step.

Referenced by fillHitsByStation().

337  {
338 
339  if ( muonRecHits.empty() ) return muonRecHits;
340 
341  stable_sort(muonRecHits.begin(), muonRecHits.end(), LessPerp());
342 
343  MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
344  seedhit = min_element(muonRecHits.begin(), muonRecHits.end(), LessPerp());
345 
346  MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ihigh = seedhit;
347  MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ilow = seedhit;
348 
349  float step = 0.1;
350  while (ihigh != muonRecHits.end()-1 && ( fabs((*(ihigh+1))->globalPosition().perp() - (*ihigh)->globalPosition().perp() ) < step) ) {
351  ihigh++;
352  }
353  while (ilow != muonRecHits.begin() && ( fabs((*ilow)->globalPosition().perp() - (*(ilow -1))->globalPosition().perp()) < step ) ) {
354  ilow--;
355  }
356 
358 
359  return result;
360 
361 }
tuple result
Definition: query.py:137
T perp() const
Magnitude of transverse component.
std::vector< MuonRecHitPointer > MuonRecHitContainer
MuonTransientTrackingRecHit::MuonRecHitContainer MuonShowerInformationFiller::findPhiCluster ( MuonTransientTrackingRecHit::MuonRecHitContainer muonRecHits,
const GlobalPoint refpoint 
) const
private

Definition at line 280 of file MuonShowerInformationFiller.cc.

References category_, SiPixelRawToDigiRegional_cfi::deltaPhi, LogTrace, phi, query::result, and relval_parameters_module::step.

Referenced by fillHitsByStation().

281  {
282 
283  if ( muonRecHits.empty() ) return muonRecHits;
284 
285  //clustering step by phi
286  float step = 0.05;
288 
289  stable_sort(muonRecHits.begin(), muonRecHits.end(), AbsLessDPhi(refpoint));
290 
291  for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ihit = muonRecHits.begin(); ihit != muonRecHits.end() - 1; ++ihit) {
292  if (fabs(deltaPhi((*(ihit+1))->globalPosition().phi(), (*ihit)->globalPosition().phi() )) < step) {
293  result.push_back(*ihit);
294  } else {
295  break;
296  }
297  }
298 
299  LogTrace(category_) << "phi front: " << muonRecHits.front()->globalPosition().phi() << endl;
300  LogTrace(category_) << "phi back: " << muonRecHits.back()->globalPosition().phi() << endl;
301 
302  return result;
303 
304 }
tuple result
Definition: query.py:137
#define LogTrace(id)
std::vector< MuonRecHitPointer > MuonRecHitContainer
Definition: DDAxes.h:10
TransientTrackingRecHit::ConstRecHitContainer MuonShowerInformationFiller::findThetaCluster ( TransientTrackingRecHit::ConstRecHitContainer muonRecHits,
const GlobalPoint refpoint 
) const
private

Definition at line 310 of file MuonShowerInformationFiller.cc.

References query::result, relval_parameters_module::step, and theta().

Referenced by fillHitsByStation().

311  {
312 
313  if ( muonRecHits.empty() ) return muonRecHits;
314 
315  //clustering step by theta
316  float step = 0.05;
318 
319  stable_sort(muonRecHits.begin(), muonRecHits.end(), AbsLessDTheta(refpoint));
320 
321  for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit = muonRecHits.begin(); ihit != muonRecHits.end() - 1; ++ihit) {
322  if (fabs((*(ihit+1))->globalPosition().theta() - (*ihit)->globalPosition().theta() ) < step) {
323  result.push_back(*ihit);
324  } else {
325  break;
326  }
327  }
328 
329  return result;
330 
331 }
Geom::Theta< T > theta() const
tuple result
Definition: query.py:137
std::vector< ConstRecHitPointer > ConstRecHitContainer
vector< const GeomDet * > MuonShowerInformationFiller::getCompatibleDets ( const reco::Track track) const
private

Definition at line 366 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, pileupDistInMC::total, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by fillHitsByStation().

366  {
367 
368  vector<const GeomDet*> total;
369  total.reserve(1000);
370 
371  LogTrace(category_) << "Consider a track " << track.p() << " eta: " << track.eta() << " phi " << track.phi() << endl;
372 
373 
374  TrajectoryStateOnSurface innerTsos = trajectoryStateTransform::innerStateOnSurface(track, *theService->trackingGeometry(), &*theService->magneticField());
375  TrajectoryStateOnSurface outerTsos = trajectoryStateTransform::outerStateOnSurface(track, *theService->trackingGeometry(), &*theService->magneticField());
376 
377  GlobalPoint innerPos = innerTsos.globalPosition();
378  GlobalPoint outerPos = outerTsos.globalPosition();
379 
380  vector<GlobalPoint> allCrossingPoints;
381 
382  const vector<const DetLayer*>& dtlayers = theService->detLayerGeometry()->allDTLayers();
383 
384  for (auto iLayer = dtlayers.begin(); iLayer != dtlayers.end(); ++iLayer) {
385 
386  // crossing points of track with cylinder
387  GlobalPoint xPoint = crossingPoint(innerPos, outerPos, dynamic_cast<const BarrelDetLayer*>(*iLayer));
388 
389  // check if point is inside the detector
390  if ((fabs(xPoint.y()) < 1000.0) && (fabs(xPoint.z()) < 1500 ) &&
391  (!(xPoint.y() == 0 && xPoint.x() == 0 && xPoint.z() == 0))) allCrossingPoints.push_back(xPoint);
392  }
393 
394  stable_sort(allCrossingPoints.begin(), allCrossingPoints.end(), LessMag(innerPos) );
395 
396  vector<const GeomDet*> tempDT;
397 
398  for (vector<GlobalPoint>::const_iterator ipos = allCrossingPoints.begin(); ipos != allCrossingPoints.end(); ++ipos) {
399 
400  tempDT = dtPositionToDets(*ipos);
401  vector<const GeomDet*>::const_iterator begin = tempDT.begin();
402  vector<const GeomDet*>::const_iterator end = tempDT.end();
403 
404  for (; begin!=end;++begin) {
405  total.push_back(*begin);
406  }
407 
408  }
409  allCrossingPoints.clear();
410 
411  const vector<const DetLayer*>& csclayers = theService->detLayerGeometry()->allCSCLayers();
412  for (auto iLayer = csclayers.begin(); iLayer != csclayers.end(); ++iLayer) {
413 
414  GlobalPoint xPoint = crossingPoint(innerPos, outerPos, dynamic_cast<const ForwardDetLayer*>(*iLayer));
415 
416  // check if point is inside the detector
417  if ((fabs(xPoint.y()) < 1000.0) && (fabs(xPoint.z()) < 1500.0)
418  && (!(xPoint.y() == 0 && xPoint.x() == 0 && xPoint.z() == 0))) allCrossingPoints.push_back(xPoint);
419  }
420  stable_sort(allCrossingPoints.begin(), allCrossingPoints.end(), LessMag(innerPos) );
421 
422  vector<const GeomDet*> tempCSC;
423  for (vector<GlobalPoint>::const_iterator ipos = allCrossingPoints.begin(); ipos != allCrossingPoints.end(); ++ipos) {
424 
425  tempCSC = cscPositionToDets(*ipos);
426  vector<const GeomDet*>::const_iterator begin = tempCSC.begin();
427  vector<const GeomDet*>::const_iterator end = tempCSC.end();
428 
429  for (; begin!=end;++begin) {
430  total.push_back(*begin);
431  }
432 
433  }
434 
435  return total;
436 
437 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:663
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:693
std::vector< const GeomDet * > dtPositionToDets(const GlobalPoint &) const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:699
T z() const
Definition: PV3DBase.h:64
GlobalPoint crossingPoint(const GlobalPoint &, const GlobalPoint &, const BarrelDetLayer *) const
#define end
Definition: vmac.h:37
#define LogTrace(id)
std::vector< const GeomDet * > cscPositionToDets(const GlobalPoint &) const
#define begin
Definition: vmac.h:30
T x() const
Definition: PV3DBase.h:62
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
const MuonServiceProxy* MuonShowerInformationFiller::getService ( ) const
inlineprotected

Definition at line 88 of file MuonShowerInformationFiller.h.

References theService.

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

Definition at line 181 of file MuonShowerInformationFiller.cc.

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

Referenced by fillHitsByStation().

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

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

Referenced by fillShowerInformation().

139  {
140 
141  // get all the necesary products
142  event.getByToken(theDTRecHitToken, theDTRecHits);
143  event.getByToken(theCSCRecHitToken, theCSCRecHits);
144  event.getByToken(theCSCSegmentsToken, theCSCSegments);
145  event.getByToken(theDT4DRecSegmentToken, theDT4DRecSegments);
146 
147  for (int istat = 0; istat < 4; istat++) {
148  theStationShowerDeltaR.at(istat) = 0.;
149  theStationShowerTSize.at(istat) = 0.;
150  theAllStationHits.at(istat) = 0;
151  theCorrelatedStationHits.at(istat) = 0;
152  }
153 }
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 159 of file MuonShowerInformationFiller.cc.

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

Referenced by fillShowerInformation().

159  {
160 
161  // DetLayer Geometry
163  setup.get<IdealMagneticFieldRecord>().get(theField);
165  setup.get<MuonGeometryRecord>().get(theCSCGeometry);
166  setup.get<MuonGeometryRecord>().get(theDTGeometry);
167 
168  // Transient Rechit Builders
169  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
170  if ( newCacheId_TRH != theCacheId_TRH ) {
173  }
174 
175 }
edm::ESHandle< MagneticField > theField
edm::ESHandle< GeometricSearchTracker > theTracker
edm::ESHandle< CSCGeometry > theCSCGeometry
edm::ESHandle< DTGeometry > theDTGeometry
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
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 181 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

unsigned long long MuonShowerInformationFiller::theCacheId_TRH
private

Definition at line 180 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setServices().

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

Definition at line 211 of file MuonShowerInformationFiller.h.

Referenced by setServices().

edm::InputTag MuonShowerInformationFiller::theCSCRecHitLabel
private

Definition at line 190 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

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

Definition at line 195 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

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

Definition at line 200 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

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

Definition at line 196 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

edm::InputTag MuonShowerInformationFiller::theCSCSegmentsLabel
private

Definition at line 191 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

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

Definition at line 201 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

edm::InputTag MuonShowerInformationFiller::theDT4DRecSegmentLabel
private

Definition at line 192 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

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

Definition at line 197 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

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

Definition at line 202 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

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

Definition at line 212 of file MuonShowerInformationFiller.h.

Referenced by setServices().

edm::InputTag MuonShowerInformationFiller::theDTRecHitLabel
private

Definition at line 189 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller().

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

Definition at line 194 of file MuonShowerInformationFiller.h.

Referenced by fillHitsByStation(), and setEvent().

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

Definition at line 199 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setEvent().

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

Definition at line 210 of file MuonShowerInformationFiller.h.

Referenced by setServices().

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

Definition at line 187 of file MuonShowerInformationFiller.h.

Referenced by setServices().

std::string MuonShowerInformationFiller::theMuonRecHitBuilderName
private

Definition at line 186 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 208 of file MuonShowerInformationFiller.h.

Referenced by setServices().

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

Definition at line 184 of file MuonShowerInformationFiller.h.

Referenced by setServices().

std::string MuonShowerInformationFiller::theTrackerRecHitBuilderName
private

Definition at line 183 of file MuonShowerInformationFiller.h.

Referenced by MuonShowerInformationFiller(), and setServices().

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

Definition at line 209 of file MuonShowerInformationFiller.h.

Referenced by setServices().