354 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
362 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
370 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
374 typedef std::pair<TrackingParticleRef, TrackPSimHitRef> SimHitTPPair;
375 typedef std::vector<SimHitTPPair> SimHitTPAssociationList;
380 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
388 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
392 typedef edm::PSimHitContainer::const_iterator SimHitIter;
394 typedef std::vector<TrackPSimHitRef> SimHitRefs;
397 SimHitRefs muonSimHits, pthrSimHits;
399 for (
int i=0,
n=simParticleHandle->size();
i<
n; ++
i )
402 if ( simParticle->pt() < 1.0
or simParticle->p() < 2.5 )
continue;
405 SimHitRefs simHitsFromParticle;
406 auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
409 for (
auto simParticleToHit = range.first; simParticleToHit != range.second; ++simParticleToHit )
411 auto simHit = simParticleToHit->second;
412 const DetId detId(simHit->detUnitId());
415 simHitsFromParticle.push_back(simParticleToHit->second);
417 const int nRPCHit = simHitsFromParticle.size();
418 const bool hasRPCHit = nRPCHit > 0;
420 if (
abs(simParticle->pdgId()) == 13 )
422 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
425 int nRPCHitBarrel = 0;
426 int nRPCHitEndcap = 0;
427 for (
auto simHit : simHitsFromParticle )
430 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
431 if ( !roll )
continue;
433 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
434 else ++nRPCHitEndcap;
439 if ( nRPCHitBarrel and nRPCHitEndcap )
446 else if ( nRPCHitBarrel )
453 else if ( nRPCHitEndcap )
469 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
474 switch ( simParticle->pdgId() )
492 int nRefHitBarrel = 0, nRefHitEndcap = 0;
493 for (
auto simHit : muonSimHits )
496 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
498 const int region = roll->
id().
region();
525 for (
auto simHit : pthrSimHits )
528 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
530 const int region = roll->
id().
region();
531 const int ring = roll->
id().
ring();
533 const int station = roll->
id().
station();
559 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
560 int nRecHitBarrel = 0, nRecHitEndcap = 0;
561 for ( RecHitIter recHitIter = recHitHandle->begin();
562 recHitIter != recHitHandle->end(); ++recHitIter )
565 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
566 if ( !roll )
continue;
568 const int region = roll->
id().
region();
569 const int ring = roll->
id().
ring();
571 const int station = roll->
id().
station();
580 sumClusterSizeBarrel += recHitIter->clusterSize();
589 sumClusterSizeEndcap += recHitIter->clusterSize();
596 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
601 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
604 if ( nRecHitBarrel > 0 )
608 if ( nRecHitEndcap > 0 )
615 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
616 SimToRecHitMap simToRecHitMap;
618 for (
auto simHit : muonSimHits )
623 const double simX = simHit->localPosition().x();
625 for ( RecHitIter recHitIter = recHitHandle->begin();
626 recHitIter != recHitHandle->end(); ++recHitIter )
629 const RPCRoll* recRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
630 if ( !recRoll )
continue;
632 if ( simDetId != recDetId )
continue;
634 const double recX = recHitIter->localPosition().x();
635 const double newDx = fabs(recX - simX);
638 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(simHit);
639 if ( prevSimToReco == simToRecHitMap.end() )
641 simToRecHitMap.insert(std::make_pair(simHit, recHitIter));
645 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
649 simToRecHitMap[simHit] = recHitIter;
657 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
658 for (
auto match : simToRecHitMap )
661 RecHitIter recHitIter =
match.second;
664 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
666 const int region = roll->
id().
region();
667 const int ring = roll->
id().
ring();
669 const int station = roll->
id().
station();
673 const double simX = simHit->localPosition().x();
674 const double recX = recHitIter->localPosition().x();
675 const double errX =
sqrt(recHitIter->localPositionError().xx());
676 const double dX = recX - simX;
677 const double pull = errX == 0 ? -999 : dX/errX;
722 if ( !
muon->isGlobalMuon() )
continue;
724 int nRPCHitBarrel = 0;
725 int nRPCHitEndcap = 0;
729 recHit != glbTrack->recHitsEnd(); ++recHit )
731 if ( !(*recHit)->isValid() )
continue;
732 const DetId detId = (*recHit)->geographicalId();
736 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
737 else ++nRPCHitEndcap;
740 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
742 if ( nRPCHitBarrel and nRPCHitEndcap )
749 else if ( nRPCHitBarrel )
756 else if ( nRPCHitEndcap )
772 for ( RecHitIter recHitIter = recHitHandle->begin();
773 recHitIter != recHitHandle->end(); ++recHitIter )
776 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
778 const int region = roll->
id().
region();
779 const int ring = roll->
id().
ring();
781 const int station = roll->
id().
station();
785 bool matched =
false;
786 for (
auto match : simToRecHitMap )
788 if ( recHitIter ==
match.second )
811 int nPunchMatched = 0;
813 for (
auto simHit : pthrSimHits )
815 const int absSimHitPType =
abs(simHit->particleType());
816 if ( absSimHitPType == 13 )
continue;
819 if ( simDetId == detId ) ++nPunchMatched;
822 if ( nPunchMatched > 0 )
840 for ( RecHitIter recHitIter = recHitHandle->begin();
841 recHitIter != recHitHandle->end(); ++recHitIter )
844 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
846 const int region = roll->
id().
region();
853 const double recX = recHitIter->localPosition().x();
854 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
856 bool matched =
false;
857 for ( SimHitIter simHitIter = simHitHandle->begin();
858 simHitIter != simHitHandle->end(); ++simHitIter )
860 const RPCDetId simDetId =
static_cast<const RPCDetId>(simHitIter->detUnitId());
861 const RPCRoll* simRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(simDetId));
862 if ( !simRoll )
continue;
864 if ( simDetId != recDetId )
continue;
866 const double simX = simHitIter->localPosition().x();
867 const double dX = fabs(recX-simX);
869 if ( dX/recErrX < 5 )
MEP h_recoMuonOverlap_eta
MEP refHitOccupancyEndcap_disk_ring
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::InputTag simHitAssocLabel_
std::map< int, int > detIdToIndexMapEndcap_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
MEP umOccupancyEndcap_disk
MEP h_nRPCHitPerRecoMuonBarrel
std::map< int, int > detIdToIndexMapBarrel_
MEP h_nRPCHitPerSimMuonBarrel
MEP h_nRPCHitPerSimMuonOverlap
MEP matchOccupancyEndcap_disk
MEP h_recPunchOccupancyEndcap_disk_ring
MEP h_refPunchOccupancyBarrel_wheel
MEP h_refPunchOccupancyEndcap_disk
MEP h_matchOccupancyBarrel_detId
MEP h_recPunchOccupancyEndcap_disk
MEP matchOccupancyEndcap_disk_ring
uint32_t rawId() const
get the raw id
MEP umOccupancyBarrel_wheel_station
C::const_iterator const_iterator
constant access iterator type
MEP h_matchOccupancyEndcap_detId
edm::InputTag recHitLabel_
MEP umOccupancyBarrel_wheel
MEP h_noiseOccupancyBarrel_detId
edm::InputTag simParticleLabel_
MEP h_nRPCHitPerSimMuonEndcap
MEP h_nRPCHitPerRecoMuonEndcap
MEP refHitOccupancyBarrel_station
MEP recHitOccupancyEndcap_disk
MEP h_recoMuonOverlap_phi
edm::InputTag simHitLabel_
MEP h_recPunchOccupancyBarrel_wheel_station
MEP h_refPunchOccupancyBarrel_wheel_station
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
MEP recHitOccupancyBarrel_station
MEP h_refPunchOccupancyEndcap_disk_ring
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MEP recHitOccupancyBarrel_wheel_station
MEP matchOccupancyBarrel_wheel
MEP umOccupancyEndcap_disk_ring
MEP h_refPunchOccupancyBarrel_station
MEP h_nRPCHitPerRecoMuonOverlap
MEP h_refOccupancyBarrel_detId
MEP matchOccupancyBarrel_station
MEP recHitOccupancyEndcap_disk_ring
MEP h_recPunchOccupancyBarrel_wheel
MEP h_refOccupancyEndcap_detId
edm::Ref< edm::PSimHitContainer > TrackPSimHitRef
MEP matchOccupancyBarrel_wheel_station
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
MEP recHitOccupancyBarrel_wheel
MEP refHitOccupancyBarrel_wheel_station
Detector det() const
get the detector field from this detid
MEP h_noiseOccupancyEndcap_detId
MEP refHitOccupancyEndcap_disk
MEP umOccupancyBarrel_station
MEP refHitOccupancyBarrel_wheel
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
MEP h_recPunchOccupancyBarrel_station