31 if ( !event.
getByToken(refHitToken_, refHitHandle) )
33 edm::LogInfo(
"RPCPointVsRecHit") <<
"Cannot find reference hit collection\n";
39 if ( !event.
getByToken(recHitToken_, recHitHandle) )
41 edm::LogInfo(
"RPCPointVsRecHit") <<
"Cannot find recHit collection\n";
48 int nRefHitBarrel = 0, nRefHitEndcap = 0;
49 for ( RecHitIter refHitIter = refHitHandle->begin();
50 refHitIter != refHitHandle->end(); ++refHitIter )
54 if ( !roll )
continue;
56 const int region = roll->
id().
region();
65 h_.refHitOccupancyBarrel_wheel->Fill(ring);
66 h_.refHitOccupancyBarrel_station->Fill(station);
67 h_.refHitOccupancyBarrel_wheel_station->Fill(ring, station);
71 h_.refHitOccupancyEndcap_disk->Fill(region*station);
72 h_.refHitOccupancyEndcap_disk_ring->Fill(region*station, ring);
76 h_.nRefHitBarrel->Fill(nRefHitBarrel);
77 h_.nRefHitEndcap->Fill(nRefHitEndcap);
80 int sumClusterSizeBarrel = 0, sumClusterSizeEndcap = 0;
81 int nRecHitBarrel = 0, nRecHitEndcap = 0;
82 for ( RecHitIter recHitIter = recHitHandle->begin();
83 recHitIter != recHitHandle->end(); ++recHitIter )
87 if ( !roll )
continue;
89 const int region = roll->
id().
region();
96 h_.clusterSize->Fill(recHitIter->clusterSize());
101 sumClusterSizeBarrel += recHitIter->clusterSize();
102 h_.clusterSizeBarrel->Fill(recHitIter->clusterSize());
103 h_.recHitOccupancyBarrel_wheel->Fill(ring);
104 h_.recHitOccupancyBarrel_station->Fill(station);
105 h_.recHitOccupancyBarrel_wheel_station->Fill(ring, station);
110 sumClusterSizeEndcap += recHitIter->clusterSize();
111 h_.clusterSizeEndcap->Fill(recHitIter->clusterSize());
112 h_.recHitOccupancyEndcap_disk->Fill(region*station);
113 h_.recHitOccupancyEndcap_disk_ring->Fill(ring, region*station);
117 const double nRecHit = nRecHitBarrel+nRecHitEndcap;
118 h_.nRecHitBarrel->Fill(nRecHitBarrel);
119 h_.nRecHitEndcap->Fill(nRecHitEndcap);
122 const int sumClusterSize = sumClusterSizeBarrel+sumClusterSizeEndcap;
123 h_.avgClusterSize->Fill(
double(sumClusterSize)/nRecHit);
125 if ( nRecHitBarrel > 0 )
127 h_.avgClusterSizeBarrel->Fill(
double(sumClusterSizeBarrel)/nRecHitBarrel);
129 if ( nRecHitEndcap > 0 )
131 h_.avgClusterSizeEndcap->Fill(
double(sumClusterSizeEndcap)/nRecHitEndcap);
136 typedef std::map<RecHitIter, RecHitIter> RecToRecHitMap;
137 RecToRecHitMap refToRecHitMap;
139 for ( RecHitIter refHitIter = refHitHandle->begin();
140 refHitIter != refHitHandle->end(); ++refHitIter )
144 if ( !refRoll )
continue;
146 const double refX = refHitIter->localPosition().x();
148 for ( RecHitIter recHitIter = recHitHandle->begin();
149 recHitIter != recHitHandle->end(); ++recHitIter )
153 if ( !recRoll )
continue;
155 if ( refDetId != recDetId )
continue;
157 const double recX = recHitIter->localPosition().x();
158 const double newDx = fabs(recX - refX);
161 RecToRecHitMap::const_iterator prevRefToReco = refToRecHitMap.find(refHitIter);
162 if ( prevRefToReco == refToRecHitMap.end() )
164 refToRecHitMap.insert(std::make_pair(refHitIter, recHitIter));
168 const double oldDx = fabs(prevRefToReco->second->localPosition().x() - refX);
172 refToRecHitMap[refHitIter] = recHitIter;
180 for ( RecToRecHitMap::const_iterator
match = refToRecHitMap.begin();
183 RecHitIter refHitIter =
match->first;
184 RecHitIter recHitIter =
match->second;
189 const int region = roll->
id().
region();
196 const double refX = refHitIter->localPosition().x();
197 const double recX = recHitIter->localPosition().x();
198 const double errX =
sqrt(recHitIter->localPositionError().xx());
199 const double dX = recX - refX;
200 const double pull = errX == 0 ? -999 : dX/
errX;
207 h_.resBarrel->Fill(dX);
208 h_.pullBarrel->Fill(pull);
209 h_.matchOccupancyBarrel_wheel->Fill(ring);
210 h_.matchOccupancyBarrel_station->Fill(station);
211 h_.matchOccupancyBarrel_wheel_station->Fill(ring, station);
213 h_.res_wheel_res->Fill(ring, dX);
214 h_.res_station_res->Fill(station, dX);
215 h_.pull_wheel_pull->Fill(ring, pull);
216 h_.pull_station_pull->Fill(station, pull);
220 h_.resEndcap->Fill(dX);
221 h_.pullEndcap->Fill(pull);
222 h_.matchOccupancyEndcap_disk->Fill(region*station);
223 h_.matchOccupancyEndcap_disk_ring->Fill(region*station, ring);
225 h_.res_disk_res->Fill(region*station, dX);
226 h_.res_ring_res->Fill(ring, dX);
227 h_.pull_disk_pull->Fill(region*station, pull);
228 h_.pull_ring_pull->Fill(ring, pull);
238 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
#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.