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;
382 const DetId detId(simHit->detUnitId());
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 )
400 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(rpcDetId));
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 )
466 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
495 for (
auto simHit : pthrSimHits )
498 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
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 )
535 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId()));
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();
550 sumClusterSizeBarrel += recHitIter->clusterSize();
559 sumClusterSizeEndcap += recHitIter->clusterSize();
566 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
571 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
574 if ( nRecHitBarrel > 0 )
578 if ( nRecHitEndcap > 0 )
585 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
586 SimToRecHitMap simToRecHitMap;
588 for (
auto simHit : muonSimHits )
593 const double simX = simHit->localPosition().x();
595 for ( RecHitIter recHitIter = recHitHandle->begin();
596 recHitIter != recHitHandle->end(); ++recHitIter )
599 const RPCRoll* recRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
600 if ( !recRoll )
continue;
602 if ( simDetId != recDetId )
continue;
604 const double recX = recHitIter->localPosition().x();
605 const double newDx = fabs(recX - simX);
608 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(simHit);
609 if ( prevSimToReco == simToRecHitMap.end() )
611 simToRecHitMap.insert(std::make_pair(simHit, recHitIter));
615 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
619 simToRecHitMap[simHit] = recHitIter;
627 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
628 for (
auto match : simToRecHitMap )
631 RecHitIter recHitIter =
match.second;
634 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
636 const int region = roll->
id().
region();
637 const int ring = roll->
id().
ring();
639 const int station = roll->
id().
station();
643 const double simX = simHit->localPosition().x();
644 const double recX = recHitIter->localPosition().x();
645 const double errX =
sqrt(recHitIter->localPositionError().xx());
646 const double dX = recX - simX;
647 const double pull = errX == 0 ? -999 : dX/errX;
689 for ( reco::MuonCollection::const_iterator
muon = muonHandle->begin();
692 if ( !
muon->isGlobalMuon() )
continue;
694 int nRPCHitBarrel = 0;
695 int nRPCHitEndcap = 0;
699 recHit != glbTrack->recHitsEnd(); ++recHit )
701 if ( !(*recHit)->isValid() )
continue;
702 const DetId detId = (*recHit)->geographicalId();
706 if ( rpcDetId.
region() == 0 ) ++nRPCHitBarrel;
707 else ++nRPCHitEndcap;
710 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
712 if ( nRPCHitBarrel and nRPCHitEndcap )
719 else if ( nRPCHitBarrel )
726 else if ( nRPCHitEndcap )
742 for ( RecHitIter recHitIter = recHitHandle->begin();
743 recHitIter != recHitHandle->end(); ++recHitIter )
746 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(detId));
748 const int region = roll->
id().
region();
749 const int ring = roll->
id().
ring();
751 const int station = roll->
id().
station();
755 bool matched =
false;
756 for (
auto match : simToRecHitMap )
758 if ( recHitIter ==
match.second )
781 int nPunchMatched = 0;
783 for (
auto simHit : pthrSimHits )
785 const int absSimHitPType =
abs(simHit->particleType());
786 if ( absSimHitPType == 13 )
continue;
789 if ( simDetId == detId ) ++nPunchMatched;
792 if ( nPunchMatched > 0 )
810 for ( RecHitIter recHitIter = recHitHandle->begin();
811 recHitIter != recHitHandle->end(); ++recHitIter )
814 const RPCRoll* roll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(recDetId));
816 const int region = roll->
id().
region();
823 const double recX = recHitIter->localPosition().x();
824 const double recErrX =
sqrt(recHitIter->localPositionError().xx());
826 bool matched =
false;
827 for ( SimHitIter simHitIter = simHitHandle->begin();
828 simHitIter != simHitHandle->end(); ++simHitIter )
830 const RPCDetId simDetId =
static_cast<const RPCDetId>(simHitIter->detUnitId());
831 const RPCRoll* simRoll =
dynamic_cast<const RPCRoll*
>(rpcGeom->roll(simDetId));
832 if ( !simRoll )
continue;
834 if ( simDetId != recDetId )
continue;
836 const double simX = simHitIter->localPosition().x();
837 const double dX = fabs(recX-simX);
839 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
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
MEP umOccupancyBarrel_station
MEP refHitOccupancyBarrel_wheel
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
MEP h_recPunchOccupancyBarrel_station