326 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
334 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
342 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
350 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
358 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
362 typedef edm::PSimHitContainer::const_iterator SimHitIter;
364 typedef std::vector<TrackPSimHitRef> SimHitRefs;
367 SimHitRefs muonSimHits, pthrSimHits;
369 for (
int i=0,
n=simParticleHandle->size();
i<
n; ++
i )
372 if ( simParticle->pt() < 1.0
or simParticle->p() < 2.5 )
continue;
375 SimHitRefs simHitsFromParticle;
376 auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
379 for (
auto simParticleToHit = range.first; simParticleToHit != range.second; ++simParticleToHit )
381 auto simHit = simParticleToHit->second;
385 simHitsFromParticle.push_back(simParticleToHit->second);
387 const int nRPCHit = simHitsFromParticle.size();
388 const bool hasRPCHit = nRPCHit > 0;
390 if (
abs(simParticle->pdgId()) == 13 )
392 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
395 int nRPCHitBarrel = 0;
396 int nRPCHitEndcap = 0;
397 for (
auto simHit : simHitsFromParticle )
401 if ( !roll )
continue;
403 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
404 else ++nRPCHitEndcap;
409 if ( nRPCHitBarrel and nRPCHitEndcap )
416 else if ( nRPCHitBarrel )
423 else if ( nRPCHitEndcap )
439 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
444 switch ( simParticle->pdgId() )
462 int nRefHitBarrel = 0, nRefHitEndcap = 0;
463 for (
auto simHit : muonSimHits )
468 const int region = roll->
id().
region();
495 for (
auto simHit : pthrSimHits )
500 const int region = roll->
id().
region();
501 const int ring = roll->
id().
ring();
503 const int station = roll->
id().
station();
529 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
530 int nRecHitBarrel = 0, nRecHitEndcap = 0;
531 for ( RecHitIter recHitIter = recHitHandle->begin();
532 recHitIter != recHitHandle->end(); ++recHitIter )
536 if ( !roll )
continue;
538 const int region = roll->
id().
region();
539 const int ring = roll->
id().
ring();
541 const int station = roll->
id().
station();
545 const double time = recHitIter->timeError() >= 0 ? recHitIter->time() : recHitIter->BunchX()*25;
552 sumClusterSizeBarrel += recHitIter->clusterSize();
563 sumClusterSizeEndcap += recHitIter->clusterSize();
579 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
584 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
587 if ( nRecHitBarrel > 0 )
591 if ( nRecHitEndcap > 0 )
598 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
599 SimToRecHitMap simToRecHitMap;
601 for (
auto simHit : muonSimHits )
606 const double simX =
simHit->localPosition().x();
608 for ( RecHitIter recHitIter = recHitHandle->begin();
609 recHitIter != recHitHandle->end(); ++recHitIter )
613 if ( !recRoll )
continue;
615 if ( simDetId != recDetId )
continue;
617 const double recX = recHitIter->localPosition().x();
618 const double newDx = fabs(recX - simX);
621 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(
simHit);
622 if ( prevSimToReco == simToRecHitMap.end() )
624 simToRecHitMap.insert(std::make_pair(
simHit, recHitIter));
628 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
632 simToRecHitMap[
simHit] = recHitIter;
640 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
641 for (
auto match : simToRecHitMap )
644 RecHitIter recHitIter =
match.second;
649 const int region = roll->
id().
region();
650 const int ring = roll->
id().
ring();
652 const int station = roll->
id().
station();
656 const double simX = simHit->localPosition().x();
657 const double recX = recHitIter->localPosition().x();
658 const double errX =
sqrt(recHitIter->localPositionError().xx());
659 const double dX = recX - simX;
660 const double pull = errX == 0 ? -999 : dX/
errX;
702 for ( reco::MuonCollection::const_iterator
muon = muonHandle->begin();
705 if ( !
muon->isGlobalMuon() )
continue;
707 int nRPCHitBarrel = 0;
708 int nRPCHitEndcap = 0;
714 if ( !(*recHit)->isValid() )
continue;
715 const DetId detId = (*recHit)->geographicalId();
719 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
720 else ++nRPCHitEndcap;
723 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
725 if ( nRPCHitBarrel and nRPCHitEndcap )
732 else if ( nRPCHitBarrel )
739 else if ( nRPCHitEndcap )
755 for ( RecHitIter recHitIter = recHitHandle->begin();
756 recHitIter != recHitHandle->end(); ++recHitIter )
761 const int region = roll->
id().
region();
762 const int ring = roll->
id().
ring();
764 const int station = roll->
id().
station();
769 for (
auto match : simToRecHitMap )
771 if ( recHitIter ==
match.second )
780 int nPunchMatched = 0;
782 for (
auto simHit : pthrSimHits )
784 const int absSimHitPType =
abs(simHit->particleType());
785 if ( absSimHitPType == 13 )
continue;
788 if ( simDetId == detId ) ++nPunchMatched;
791 if ( nPunchMatched > 0 )
809 for ( RecHitIter recHitIter = recHitHandle->begin();
810 recHitIter != recHitHandle->end(); ++recHitIter )
815 const int region = roll->
id().
region();
822 const double recX = recHitIter->localPosition().x();
823 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
825 bool matched =
false;
826 for ( SimHitIter simHitIter = simHitHandle->begin();
827 simHitIter != simHitHandle->end(); ++simHitIter )
829 const RPCDetId simDetId =
static_cast<const RPCDetId>(simHitIter->detUnitId());
831 if ( !simRoll )
continue;
833 if ( simDetId != recDetId )
continue;
835 const double simX = simHitIter->localPosition().x();
836 const double dX = fabs(recX-simX);
838 if ( dX/recErrX < 5 )
MEP h_recoMuonOverlap_eta
MEP refHitOccupancyEndcap_disk_ring
edm::EDGetTokenT< RecHits > recHitToken_
std::map< int, int > detIdToIndexMapEndcap_
edm::EDGetTokenT< SimHitAssoc > simHitAssocToken_
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
edm::EDGetTokenT< SimParticles > simParticleToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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 h_matchOccupancyEndcap_detId
MEP h_noiseOccupancyBarrel_detId
MEP h_nRPCHitPerSimMuonEndcap
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
MEP h_nRPCHitPerRecoMuonEndcap
MEP refHitOccupancyBarrel_station
MEP recHitOccupancyEndcap_disk
MEP h_recoMuonOverlap_phi
Abs< T >::type abs(const T &t)
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
MEP recHitOccupancyBarrel_wheel_station
MEP matchOccupancyBarrel_wheel
MEP h_refPunchOccupancyBarrel_station
MEP h_nRPCHitPerRecoMuonOverlap
MEP h_refOccupancyBarrel_detId
MEP matchOccupancyBarrel_station
MEP recHitOccupancyEndcap_disk_ring
MEP h_recPunchOccupancyBarrel_wheel
edm::EDGetTokenT< reco::MuonCollection > muonToken_
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.
edm::EDGetTokenT< SimHits > simHitToken_
MEP recHitOccupancyBarrel_wheel
MEP refHitOccupancyBarrel_wheel_station
Detector det() const
get the detector field from this detid
MEP h_noiseOccupancyEndcap_detId
MEP refHitOccupancyEndcap_disk
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
MEP refHitOccupancyBarrel_wheel
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
MEP h_recPunchOccupancyBarrel_station