271 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find simHit collection\n";
278 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find recHit collection\n";
285 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle collection\n";
292 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find TrackingParticle to SimHit association map\n";
299 edm::LogInfo(
"RPCRecHitValid") <<
"Cannot find muon collection\n";
303 typedef edm::PSimHitContainer::const_iterator SimHitIter;
305 typedef std::vector<TrackPSimHitRef> SimHitRefs;
308 SimHitRefs muonSimHits;
310 for (
int i = 0,
n = simParticleHandle->size();
i <
n; ++
i) {
312 if (simParticle->pt() < 1.0
or simParticle->p() < 2.5)
316 SimHitRefs simHitsFromParticle;
317 auto range = std::equal_range(simHitsTPAssoc->begin(),
318 simHitsTPAssoc->end(),
321 for (
auto simParticleToHit =
range.first; simParticleToHit !=
range.second; ++simParticleToHit) {
322 auto simHit = simParticleToHit->second;
327 simHitsFromParticle.push_back(simParticleToHit->second);
329 const int nRPCHit = simHitsFromParticle.size();
330 const bool hasRPCHit = nRPCHit > 0;
332 if (
abs(simParticle->pdgId()) == 13) {
333 muonSimHits.insert(muonSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end());
336 int nRPCHitBarrel = 0;
337 int nRPCHitEndcap = 0;
338 for (
const auto &
simHit : simHitsFromParticle) {
344 if (rpcDetId.region() == 0)
352 if (nRPCHitBarrel and nRPCHitEndcap) {
357 }
else if (nRPCHitBarrel) {
362 }
else if (nRPCHitEndcap) {
375 switch (simParticle->pdgId()) {
414 int nRefHitBarrel = 0, nRefHitEndcap = 0;
415 for (
const auto &
simHit : muonSimHits) {
443 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
444 int nRecHitBarrel = 0, nRecHitEndcap = 0;
445 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
455 const double time = recHitIter->timeError() >= 0 ? recHitIter->time() : recHitIter->BunchX() * 25;
461 sumClusterSizeBarrel += recHitIter->clusterSize();
472 sumClusterSizeEndcap += recHitIter->clusterSize();
482 if (
roll->isIRPC()) {
488 const double nRecHit = nRecHitBarrel + nRecHitEndcap;
492 const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
495 if (nRecHitBarrel > 0) {
498 if (nRecHitEndcap > 0) {
504 typedef std::map<TrackPSimHitRef, RecHitIter> SimToRecHitMap;
505 SimToRecHitMap simToRecHitMap;
507 for (
const auto &
simHit : muonSimHits) {
510 const double simX =
simHit->localPosition().x();
512 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
513 const RPCDetId recDetId{recHitIter->rpcId()};
514 const RPCRoll *recRoll = rpcGeom->roll(recDetId);
518 if (simDetId != recDetId)
521 const double recX = recHitIter->localPosition().x();
522 const double newDx = fabs(recX - simX);
525 SimToRecHitMap::const_iterator prevSimToReco = simToRecHitMap.find(
simHit);
526 if (prevSimToReco == simToRecHitMap.end()) {
527 simToRecHitMap.insert(std::make_pair(
simHit, recHitIter));
529 const double oldDx = fabs(prevSimToReco->second->localPosition().x() - simX);
532 simToRecHitMap[
simHit] = recHitIter;
540 int nMatchHitBarrel = 0, nMatchHitEndcap = 0;
541 for (
const auto &
match : simToRecHitMap) {
543 RecHitIter recHitIter =
match.second;
552 const double simX =
simHit->localPosition().x();
553 const double recX = recHitIter->localPosition().x();
554 const double errX =
sqrt(recHitIter->localPositionError().xx());
555 const double dX = recX - simX;
556 const double pull =
errX == 0 ? -999 :
dX /
errX;
591 for (reco::MuonCollection::const_iterator
muon = muonHandle->begin();
muon != muonHandle->end(); ++
muon) {
592 if (!
muon->isGlobalMuon())
595 int nRPCHitBarrel = 0;
596 int nRPCHitEndcap = 0;
600 if (!(*recHit)->isValid())
602 const DetId detId = (*recHit)->geographicalId();
607 if (rpcDetId.
region() == 0)
613 const int nRPCHit = nRPCHitBarrel + nRPCHitEndcap;
615 if (nRPCHitBarrel and nRPCHitEndcap) {
620 }
else if (nRPCHitBarrel) {
625 }
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