29 if (!event.
getByToken(refHitToken_, refHitHandle)) {
30 edm::LogInfo(
"RPCPointVsRecHit") <<
"Cannot find reference hit collection\n";
36 if (!event.
getByToken(recHitToken_, recHitHandle)) {
37 edm::LogInfo(
"RPCPointVsRecHit") <<
"Cannot find recHit collection\n";
44 int nRefHitBarrel = 0, nRefHitEndcap = 0;
45 for (RecHitIter refHitIter = refHitHandle->begin(); refHitIter != refHitHandle->end(); ++refHitIter) {
51 const int region = roll->
id().
region();
59 h_.refHitOccupancyBarrel_wheel->Fill(ring);
60 h_.refHitOccupancyBarrel_station->Fill(station);
61 h_.refHitOccupancyBarrel_wheel_station->Fill(ring, station);
63 h_.refHitOccupancyEndcap_disk->Fill(region * station);
64 h_.refHitOccupancyEndcap_disk_ring->Fill(region * station, ring);
67 h_.nRefHitBarrel->Fill(nRefHitBarrel);
68 h_.nRefHitEndcap->Fill(nRefHitEndcap);
71 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
72 int nRecHitBarrel = 0, nRecHitEndcap = 0;
73 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
79 const int region = roll->
id().
region();
86 h_.clusterSize->Fill(recHitIter->clusterSize());
90 sumClusterSizeBarrel += recHitIter->clusterSize();
91 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
92 h_.recHitOccupancyBarrel_wheel->Fill(ring);
93 h_.recHitOccupancyBarrel_station->Fill(station);
94 h_.recHitOccupancyBarrel_wheel_station->Fill(ring, station);
97 sumClusterSizeEndcap += recHitIter->clusterSize();
98 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
99 h_.recHitOccupancyEndcap_disk->Fill(region * station);
100 h_.recHitOccupancyEndcap_disk_ring->Fill(ring, region * station);
103 const double nRecHit = nRecHitBarrel + nRecHitEndcap;
104 h_.nRecHitBarrel->Fill(nRecHitBarrel);
105 h_.nRecHitEndcap->Fill(nRecHitEndcap);
107 const int sumClusterSize = sumClusterSizeBarrel + sumClusterSizeEndcap;
108 h_.avgClusterSize->Fill(
double(sumClusterSize) / nRecHit);
110 if (nRecHitBarrel > 0) {
111 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel) / nRecHitBarrel);
113 if (nRecHitEndcap > 0) {
114 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap) / nRecHitEndcap);
119 typedef std::map<RecHitIter, RecHitIter> RecToRecHitMap;
120 RecToRecHitMap refToRecHitMap;
122 for (RecHitIter refHitIter = refHitHandle->begin(); refHitIter != refHitHandle->end(); ++refHitIter) {
128 const double refX = refHitIter->localPosition().x();
130 for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) {
136 if (refDetId != recDetId)
139 const double recX = recHitIter->localPosition().x();
140 const double newDx = fabs(recX - refX);
143 RecToRecHitMap::const_iterator prevRefToReco = refToRecHitMap.find(refHitIter);
144 if (prevRefToReco == refToRecHitMap.end()) {
145 refToRecHitMap.insert(std::make_pair(refHitIter, recHitIter));
147 const double oldDx = fabs(prevRefToReco->second->localPosition().x() - refX);
150 refToRecHitMap[refHitIter] = recHitIter;
158 for (RecToRecHitMap::const_iterator
match = refToRecHitMap.begin();
match != refToRecHitMap.end(); ++
match) {
159 RecHitIter refHitIter =
match->first;
160 RecHitIter recHitIter =
match->second;
165 const int region = roll->
id().
region();
172 const double refX = refHitIter->localPosition().x();
173 const double recX = recHitIter->localPosition().x();
174 const double errX =
sqrt(recHitIter->localPositionError().xx());
175 const double dX = recX - refX;
176 const double pull = errX == 0 ? -999 : dX /
errX;
182 h_.resBarrel->Fill(dX);
183 h_.pullBarrel->Fill(pull);
184 h_.matchOccupancyBarrel_wheel->Fill(ring);
185 h_.matchOccupancyBarrel_station->Fill(station);
186 h_.matchOccupancyBarrel_wheel_station->Fill(ring, station);
188 h_.res_wheel_res->Fill(ring, dX);
189 h_.res_station_res->Fill(station, dX);
190 h_.pull_wheel_pull->Fill(ring, pull);
191 h_.pull_station_pull->Fill(station, pull);
193 h_.resEndcap->Fill(dX);
194 h_.pullEndcap->Fill(pull);
195 h_.matchOccupancyEndcap_disk->Fill(region * station);
196 h_.matchOccupancyEndcap_disk_ring->Fill(region * station, ring);
198 h_.res_disk_res->Fill(region * station, dX);
199 h_.res_ring_res->Fill(ring, dX);
200 h_.pull_disk_pull->Fill(region * station, pull);
201 h_.pull_ring_pull->Fill(ring, pull);
210 h_.bookHistograms(booker, subDir_);
T getParameter(std::string const &) const
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
C::const_iterator const_iterator
constant access iterator type
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
RPCPointVsRecHit(const edm::ParameterSet &pset)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.