283 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
290 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
297 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
304 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
311 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
315 typedef edm::PSimHitContainer::const_iterator SimHitIter;
317 typedef std::vector<TrackPSimHitRef> SimHitRefs;
320 SimHitRefs muonSimHits, pthrSimHits;
322 for (
int i = 0,
n = simParticleHandle->size();
i <
n; ++
i) {
324 if (simParticle->pt() < 1.0
or simParticle->p() < 2.5)
328 SimHitRefs simHitsFromParticle;
329 auto range = std::equal_range(simHitsTPAssoc->begin(),
330 simHitsTPAssoc->end(),
333 for (
auto simParticleToHit =
range.first; simParticleToHit !=
range.second; ++simParticleToHit) {
334 auto simHit = simParticleToHit->second;
339 simHitsFromParticle.push_back(simParticleToHit->second);
341 const int nRPCHit = simHitsFromParticle.size();
342 const bool hasRPCHit = nRPCHit > 0;
344 if (
abs(simParticle->pdgId()) == 13) {
345 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
348 int nRPCHitBarrel = 0;
349 int nRPCHitEndcap = 0;
350 for (
const auto &
simHit : simHitsFromParticle) {
356 if (rpcDetId.
region() == 0)
364 if (nRPCHitBarrel and nRPCHitEndcap) {
369 }
else if (nRPCHitBarrel) {
374 }
else if (nRPCHitEndcap) {
387 switch (simParticle->pdgId()) {
426 int nRefHitBarrel = 0, nRefHitEndcap = 0;
427 for (
const auto &
simHit : muonSimHits) {
458 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
459 int nRecHitBarrel = 0, nRecHitEndcap = 0;
460 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
473 const double time = recHitIter->timeError() >= 0 ? recHitIter->time() : recHitIter->BunchX() * 25;
479 sumClusterSizeBarrel += recHitIter->clusterSize();
490 sumClusterSizeEndcap += recHitIter->clusterSize();
500 if (
roll->isIRPC()) {
506 const double nRecHit = nRecHitBarrel + nRecHitEndcap;
510 const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
513 if (nRecHitBarrel > 0) {
516 if (nRecHitEndcap > 0) {
522 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
523 SimToRecHitMap simToRecHitMap;
525 for (
const auto &
simHit : muonSimHits) {
530 const double simX =
simHit->localPosition().x();
532 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
534 const RPCRoll *recRoll =
dynamic_cast<const RPCRoll *
>(rpcGeom->roll(recDetId));
538 if (simDetId != recDetId)
541 const double recX = recHitIter->localPosition().x();
542 const double newDx = fabs(recX - simX);
545 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(
simHit);
546 if (prevSimToReco == simToRecHitMap.end()) {
547 simToRecHitMap.insert(std::make_pair(
simHit, recHitIter));
549 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
552 simToRecHitMap[
simHit] = recHitIter;
560 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
561 for (
const auto &
match : simToRecHitMap) {
563 RecHitIter recHitIter =
match.second;
575 const double simX =
simHit->localPosition().x();
576 const double recX = recHitIter->localPosition().x();
577 const double errX =
sqrt(recHitIter->localPositionError().xx());
578 const double dX = recX - simX;
579 const double pull =
errX == 0 ? -999 :
dX /
errX;
617 for (reco::MuonCollection::const_iterator
muon = muonHandle->begin();
muon != muonHandle->end(); ++
muon) {
618 if (!
muon->isGlobalMuon())
621 int nRPCHitBarrel = 0;
622 int nRPCHitEndcap = 0;
626 if (!(*recHit)->isValid())
628 const DetId detId = (*recHit)->geographicalId();
633 if (rpcDetId.
region() == 0)
639 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
641 if (nRPCHitBarrel and nRPCHitEndcap) {
646 }
else if (nRPCHitBarrel) {
651 }
else if (nRPCHitEndcap) {
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_
MEP h_nRPCHitPerRecoMuonBarrel
std::map< int, int > detIdToIndexMapBarrel_
MEP h_nRPCHitPerSimMuonBarrel
MEP h_nRPCHitPerSimMuonOverlap
MEP matchOccupancyEndcap_disk
MEP h_matchOccupancyBarrel_detId
MEP matchOccupancyEndcap_disk_ring
MEP h_allOccupancyEndcap_detId
C::const_iterator const_iterator
constant access iterator type
MEP h_matchOccupancyEndcap_detId
MEP h_allOccupancyBarrel_detId
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeomToken_
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 recHitOccupancyBarrel_station
MEP recHitOccupancyBarrel_wheel_station
MEP matchOccupancyBarrel_wheel
Log< level::Info, false > LogInfo
MEP h_nRPCHitPerRecoMuonOverlap
float dX(const MatchPair &match)
MEP h_refOccupancyBarrel_detId
MEP matchOccupancyBarrel_station
MEP recHitOccupancyEndcap_disk_ring
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
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
MEP refHitOccupancyEndcap_disk
MEP refHitOccupancyBarrel_wheel