29 edm::LogInfo(
"RPCPointVsRecHit") <<
"Cannot find reference hit collection\n";
36 edm::LogInfo(
"RPCPointVsRecHit") <<
"Cannot find recHit collection\n";
43 int nRefHitBarrel = 0, nRefHitEndcap = 0;
44 for (RecHitIter refHitIter = refHitHandle->begin(); refHitIter != refHitHandle->end(); ++refHitIter) {
45 const RPCDetId detId = static_cast<const RPCDetId>(refHitIter->rpcId());
46 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId()));
50 const int region = roll->id().region();
51 const int ring = roll->id().ring();
53 const int station = roll->id().station();
70 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
71 int nRecHitBarrel = 0, nRecHitEndcap = 0;
72 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
73 const RPCDetId detId = static_cast<const RPCDetId>(recHitIter->rpcId());
74 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId()));
78 const int region = roll->id().region();
79 const int ring = roll->id().ring();
81 const int station = (roll->id().station());
89 sumClusterSizeBarrel += recHitIter->clusterSize();
96 sumClusterSizeEndcap += recHitIter->clusterSize();
102 const double nRecHit = nRecHitBarrel + nRecHitEndcap;
106 const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
109 if (nRecHitBarrel > 0) {
112 if (nRecHitEndcap > 0) {
118 typedef std::map<RecHitIter, RecHitIter> RecToRecHitMap;
119 RecToRecHitMap refToRecHitMap;
121 for (RecHitIter refHitIter = refHitHandle->begin(); refHitIter != refHitHandle->end(); ++refHitIter) {
122 const RPCDetId refDetId = static_cast<const RPCDetId>(refHitIter->rpcId());
123 const RPCRoll *refRoll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(refDetId));
127 const double refX = refHitIter->localPosition().x();
129 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
130 const RPCDetId recDetId = static_cast<const RPCDetId>(recHitIter->rpcId());
131 const RPCRoll *recRoll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(recDetId));
135 if (refDetId != recDetId)
138 const double recX = recHitIter->localPosition().x();
139 const double newDx = fabs(recX - refX);
142 RecToRecHitMap::const_iterator prevRefToReco = refToRecHitMap.find(refHitIter);
143 if (prevRefToReco == refToRecHitMap.end()) {
144 refToRecHitMap.insert(std::make_pair(refHitIter, recHitIter));
146 const double oldDx = fabs(prevRefToReco->second->localPosition().x() - refX);
149 refToRecHitMap[refHitIter] = recHitIter;
157 for (RecToRecHitMap::const_iterator
match = refToRecHitMap.begin();
match != refToRecHitMap.end(); ++
match) {
158 RecHitIter refHitIter =
match->first;
159 RecHitIter recHitIter =
match->second;
161 const RPCDetId detId = static_cast<const RPCDetId>(refHitIter->rpcId());
162 const RPCRoll *roll = dynamic_cast<const RPCRoll *>(rpcGeom->roll(detId));
164 const int region = roll->id().region();
165 const int ring = roll->id().ring();
167 const int station = roll->id().station();
171 const double refX = refHitIter->localPosition().x();
172 const double recX = recHitIter->localPosition().x();
173 const double errX =
sqrt(recHitIter->localPositionError().xx());
174 const double dX = recX - refX;
175 const double pull =
errX == 0 ? -999 : dX /
errX;