14 refHitToken_ = consumes<RPCRecHitCollection>(
pset.getParameter<
edm::InputTag>(
"refHit"));
15 recHitToken_ = consumes<RPCRecHitCollection>(
pset.getParameter<
edm::InputTag>(
"recHit"));
24 auto rpcGeom =
eventSetup.getHandle(rpcGeomToken_);
28 if (!
event.getByToken(refHitToken_, refHitHandle)) {
29 edm::LogInfo(
"RPCPointVsRecHit") <<
"Cannot find reference hit collection\n";
35 if (!
event.getByToken(recHitToken_, recHitHandle)) {
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) {
58 h_.refHitOccupancyBarrel_wheel->Fill(
ring);
59 h_.refHitOccupancyBarrel_station->Fill(
station);
60 h_.refHitOccupancyBarrel_wheel_station->Fill(
ring,
station);
66 h_.nRefHitBarrel->Fill(nRefHitBarrel);
67 h_.nRefHitEndcap->Fill(nRefHitEndcap);
70 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
71 int nRecHitBarrel = 0, nRecHitEndcap = 0;
72 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
85 h_.clusterSize->Fill(recHitIter->clusterSize());
89 sumClusterSizeBarrel += recHitIter->clusterSize();
90 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
91 h_.recHitOccupancyBarrel_wheel->Fill(
ring);
92 h_.recHitOccupancyBarrel_station->Fill(
station);
93 h_.recHitOccupancyBarrel_wheel_station->Fill(
ring,
station);
96 sumClusterSizeEndcap += recHitIter->clusterSize();
97 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
102 const double nRecHit = nRecHitBarrel + nRecHitEndcap;
103 h_.nRecHitBarrel->Fill(nRecHitBarrel);
104 h_.nRecHitEndcap->Fill(nRecHitEndcap);
106 const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
107 h_.avgClusterSize->Fill(
double(sumClusterSize) / nRecHit);
109 if (nRecHitBarrel > 0) {
110 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel) / nRecHitBarrel);
112 if (nRecHitEndcap > 0) {
113 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap) / nRecHitEndcap);
118 typedef std::map<RecHitIter, RecHitIter> RecToRecHitMap;
119 RecToRecHitMap refToRecHitMap;
121 for (RecHitIter refHitIter = refHitHandle->begin(); refHitIter != refHitHandle->end(); ++refHitIter) {
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) {
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;
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;
181 h_.resBarrel->Fill(dX);
182 h_.pullBarrel->Fill(pull);
183 h_.matchOccupancyBarrel_wheel->Fill(
ring);
184 h_.matchOccupancyBarrel_station->Fill(
station);
185 h_.matchOccupancyBarrel_wheel_station->Fill(
ring,
station);
187 h_.res_wheel_res->Fill(
ring, dX);
188 h_.res_station_res->Fill(
station, dX);
189 h_.pull_wheel_pull->Fill(
ring, pull);
190 h_.pull_station_pull->Fill(
station, pull);
192 h_.resEndcap->Fill(dX);
193 h_.pullEndcap->Fill(pull);
198 h_.res_ring_res->Fill(
ring, dX);
200 h_.pull_ring_pull->Fill(
ring, pull);
209 h_.bookHistograms(booker, subDir_);
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
C::const_iterator const_iterator
constant access iterator type
#define DEFINE_FWK_MODULE(type)
Log< level::Info, false > LogInfo
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
RPCPointVsRecHit(const edm::ParameterSet &pset)
RPCPointVsRecHit::MonitorElement * MEP