350 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
358 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
366 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
374 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
382 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
386 typedef edm::PSimHitContainer::const_iterator SimHitIter;
388 typedef std::vector<TrackPSimHitRef> SimHitRefs;
391 SimHitRefs muonSimHits, pthrSimHits;
393 for (
int i=0,
n=simParticleHandle->size();
i<
n; ++
i )
396 if ( simParticle->pt() < 1.0
or simParticle->p() < 2.5 )
continue;
399 SimHitRefs simHitsFromParticle;
400 auto range = std::equal_range(simHitsTPAssoc->begin(), simHitsTPAssoc->end(),
403 for (
auto simParticleToHit = range.first; simParticleToHit != range.second; ++simParticleToHit )
405 auto simHit = simParticleToHit->second;
406 const DetId detId(simHit->detUnitId());
409 simHitsFromParticle.push_back(simParticleToHit->second);
411 const int nRPCHit = simHitsFromParticle.size();
412 const bool hasRPCHit = nRPCHit > 0;
414 if (
abs(simParticle->pdgId()) == 13 )
416 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
419 int nRPCHitBarrel = 0;
420 int nRPCHitEndcap = 0;
421 for (
auto simHit : simHitsFromParticle )
424 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
425 if ( !roll )
continue;
427 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
428 else ++nRPCHitEndcap;
433 if ( nRPCHitBarrel and nRPCHitEndcap )
440 else if ( nRPCHitBarrel )
447 else if ( nRPCHitEndcap )
463 pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
468 switch ( simParticle->pdgId() )
486 int nRefHitBarrel = 0, nRefHitEndcap = 0;
487 for (
auto simHit : muonSimHits )
490 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
492 const int region = roll->
id().
region();
519 for (
auto simHit : pthrSimHits )
522 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
524 const int region = roll->
id().
region();
525 const int ring = roll->
id().
ring();
527 const int station = roll->
id().
station();
553 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
554 int nRecHitBarrel = 0, nRecHitEndcap = 0;
555 for ( RecHitIter recHitIter = recHitHandle->begin();
556 recHitIter != recHitHandle->end(); ++recHitIter )
559 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
560 if ( !roll )
continue;
562 const int region = roll->
id().
region();
563 const int ring = roll->
id().
ring();
565 const int station = roll->
id().
station();
574 sumClusterSizeBarrel += recHitIter->clusterSize();
583 sumClusterSizeEndcap += recHitIter->clusterSize();
590 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
595 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
598 if ( nRecHitBarrel > 0 )
602 if ( nRecHitEndcap > 0 )
609 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
610 SimToRecHitMap simToRecHitMap;
612 for (
auto simHit : muonSimHits )
617 const double simX = simHit->localPosition().x();
619 for ( RecHitIter recHitIter = recHitHandle->begin();
620 recHitIter != recHitHandle->end(); ++recHitIter )
623 const RPCRoll* recRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
624 if ( !recRoll )
continue;
626 if ( simDetId != recDetId )
continue;
628 const double recX = recHitIter->localPosition().x();
629 const double newDx = fabs(recX - simX);
632 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(simHit);
633 if ( prevSimToReco == simToRecHitMap.end() )
635 simToRecHitMap.insert(std::make_pair(simHit, recHitIter));
639 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
643 simToRecHitMap[simHit] = recHitIter;
651 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
652 for (
auto match : simToRecHitMap )
655 RecHitIter recHitIter =
match.second;
658 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
660 const int region = roll->
id().
region();
661 const int ring = roll->
id().
ring();
663 const int station = roll->
id().
station();
667 const double simX = simHit->localPosition().x();
668 const double recX = recHitIter->localPosition().x();
669 const double errX =
sqrt(recHitIter->localPositionError().xx());
670 const double dX = recX - simX;
671 const double pull = errX == 0 ? -999 : dX/errX;
713 for ( reco::MuonCollection::const_iterator
muon = muonHandle->begin();
716 if ( !
muon->isGlobalMuon() )
continue;
718 int nRPCHitBarrel = 0;
719 int nRPCHitEndcap = 0;
723 recHit != glbTrack->recHitsEnd(); ++recHit )
725 if ( !(*recHit)->isValid() )
continue;
726 const DetId detId = (*recHit)->geographicalId();
730 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
731 else ++nRPCHitEndcap;
734 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
736 if ( nRPCHitBarrel and nRPCHitEndcap )
743 else if ( nRPCHitBarrel )
750 else if ( nRPCHitEndcap )
766 for ( RecHitIter recHitIter = recHitHandle->begin();
767 recHitIter != recHitHandle->end(); ++recHitIter )
770 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
772 const int region = roll->
id().
region();
773 const int ring = roll->
id().
ring();
775 const int station = roll->
id().
station();
779 bool matched =
false;
780 for (
auto match : simToRecHitMap )
782 if ( recHitIter ==
match.second )
805 int nPunchMatched = 0;
807 for (
auto simHit : pthrSimHits )
809 const int absSimHitPType =
abs(simHit->particleType());
810 if ( absSimHitPType == 13 )
continue;
813 if ( simDetId == detId ) ++nPunchMatched;
816 if ( nPunchMatched > 0 )
834 for ( RecHitIter recHitIter = recHitHandle->begin();
835 recHitIter != recHitHandle->end(); ++recHitIter )
838 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
840 const int region = roll->
id().
region();
847 const double recX = recHitIter->localPosition().x();
848 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
850 bool matched =
false;
851 for ( SimHitIter simHitIter = simHitHandle->begin();
852 simHitIter != simHitHandle->end(); ++simHitIter )
854 const RPCDetId simDetId =
static_cast<const RPCDetId>(simHitIter->detUnitId());
855 const RPCRoll* simRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(simDetId));
856 if ( !simRoll )
continue;
858 if ( simDetId != recDetId )
continue;
860 const double simX = simHitIter->localPosition().x();
861 const double dX = fabs(recX-simX);
863 if ( dX/recErrX < 5 )
MEP h_recoMuonOverlap_eta
MEP refHitOccupancyEndcap_disk_ring
edm::EDGetTokenT< RecHits > recHitToken_
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
edm::EDGetTokenT< SimHitAssoc > simHitAssocToken_
static bool simHitTPAssociationListGreater(SimHitTPPair i, SimHitTPPair j)
edm::EDGetTokenT< SimParticles > simParticleToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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
MEP h_matchOccupancyEndcap_detId
MEP umOccupancyBarrel_wheel
MEP h_noiseOccupancyBarrel_detId
MEP h_nRPCHitPerSimMuonEndcap
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 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
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
MEP umOccupancyBarrel_station
MEP refHitOccupancyBarrel_wheel
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
MEP h_recPunchOccupancyBarrel_station