25 LogDebug(
"MuonME0SegmentsValidation") <<
"Info : Loading Geometry information\n";
28 unsigned int nregion = 2;
30 edm::LogInfo(
"MuonME0SegmentsValidation") <<
"+++ Info : # of region : " << nregion << std::endl;
32 LogDebug(
"MuonME0SegmentsValidation") <<
"+++ Info : finish to get geometry information from ES.\n";
34 me0_simsegment_eta = ibooker.
book1D(
"me0_simsegment_eta",
"SimSegment Eta Distribution; #eta; entries", 8, 2.0, 2.8);
35 me0_simsegment_pt = ibooker.
book1D(
"me0_simsegment_pt",
"SimSegment pT Distribution; p_{T}; entries", 20, 0.0, 100.0);
37 ibooker.
book1D(
"me0_simsegment_phi",
"SimSegments phi Distribution; #phi; entries", 18, -
M_PI, +
M_PI);
40 ibooker.
book1D(
"me0_matchedsimsegment_eta",
"Matched SimSegment Eta Distribution; #eta; entries", 8, 2.0, 2.8);
42 ibooker.
book1D(
"me0_matchedsimsegment_pt",
"Matched SimSegment pT Distribution; p_{T}; entries", 20, 0.0, 100.0);
44 "me0_matchedsimsegment_phi",
"Matched SimSegments phi Distribution; #phi; entries", 18, -
M_PI, +
M_PI);
50 ibooker.
book1D(
"me0_seg_NumberRH",
"Number of fitted RecHits; # RecHits; entries", 11, -0.5, 10.5);
52 ibooker.
book1D(
"me0_seg_NumberRHSig",
"Number of fitted Signal RecHits; # RecHits; entries", 11, -0.5, 10.5);
54 ibooker.
book1D(
"me0_seg_NumberRHBkg",
"Number of fitted BKG RecHits; # RecHits; entries", 11, -0.5, 10.5);
62 ibooker.
book1D(
"me0_seg_size",
"Segment Multiplicity; Number of ME0 segments; entries", 200, 0, 200);
64 for (
unsigned int region_num = 0; region_num < nregion; region_num++) {
66 for (
unsigned int layer_num = 0; layer_num < 6; layer_num++) {
70 BookHistXY(ibooker,
"me0_specRH",
"Segment RecHits", region_num, layer_num);
78 std::string histo_label_DeltaX =
"Segment RecHits Delta X : region" +
regionLabel[region_num] +
" layer " +
79 layerLabel[layer_num] +
" " +
" ; x_{SimHit} - x_{Segment RecHits} ; entries";
80 std::string histo_label_DeltaY =
"Segment RecHits Delta Y : region" +
regionLabel[region_num] +
" layer " +
81 layerLabel[layer_num] +
" " +
" ; y_{SimHit} - y_{Segment RecHit} ; entries";
84 ibooker.
book1D(histo_name_DeltaX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
86 ibooker.
book1D(histo_name_DeltaY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
94 " ; #frac{x_{SimHit} - x_{Segment "
95 "RecHit}}{#sigma_{x,RecHit}} ; entries";
98 " ; #frac{y_{SimHit} - y_{Segment "
99 "RecHit}}{#sigma_{y,RecHit}} ; entries";
102 ibooker.
book1D(histo_name_PullX.c_str(), histo_label_DeltaX.c_str(), 100, -10, 10);
104 ibooker.
book1D(histo_name_PullY.c_str(), histo_label_DeltaY.c_str(), 100, -10, 10);
129 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0Digis by Token InputTagToken";
134 edm::LogError(
"ME0SegmentsValidation") <<
"Cannot get ME0RecHits/ME0Segments by Token InputTagToken";
139 edm::LogError(
"ME0HitsValidation") <<
"Cannot get ME0Hits by Token simInputTagToken";
148 edm::SimTrackContainer::const_iterator
simTrack;
156 for (edm::PSimHitContainer::const_iterator itHit = ME0Hits->begin(); itHit != ME0Hits->end(); ++itHit) {
157 int particleType_sh = itHit->particleType();
158 int evtId_sh = itHit->eventId().event();
159 int bx_sh = itHit->eventId().bunchCrossing();
160 int procType_sh = itHit->processType();
161 if (!(
abs(particleType_sh) == 13 && evtId_sh == 0 && bx_sh == 0 && procType_sh == 0))
166 selectedME0Hits.push_back(*itHit);
172 if (selectedME0Hits.size() >= 3) {
183 for (
auto me0s = ME0Segments->begin(); me0s != ME0Segments->end(); me0s++) {
187 auto segLP = me0s->localPosition();
188 auto segLD = me0s->localDirection();
189 auto me0rhs = me0s->specificRecHits();
195 int numberRH = me0rhs.size();
197 float ndof = me0s->degreesOfFreedom();
198 double time = me0s->time();
199 double timeErr = me0s->timeErr();
213 std::vector<ME0RecHit> selectedME0RecHits;
215 for (
auto rh = me0rhs.begin(); rh != me0rhs.end(); rh++) {
216 auto me0id = rh->me0Id();
218 auto rhLP = rh->localPosition();
223 selectedME0RecHits.push_back(*rh);
228 auto erhLEP = rh->localPositionError();
229 auto rhGP = rhr->toGlobal(rhLP);
230 auto rhLPSegm =
chamber->toLocal(rhGP);
231 float xe = segLP.x() + segLD.x() * rhLPSegm.z() / segLD.z();
232 float ye = segLP.y() + segLD.y() * rhLPSegm.z() / segLD.z();
233 float ze = rhLPSegm.z();
235 auto extSegm = rhr->toLocal(
chamber->toGlobal(extrPoint));
237 int region = me0id.region();
238 int layer = me0id.layer();
242 float xErr = erhLEP.xx();
244 float yErr = erhLEP.yy();
246 float globalR = rhGP.perp();
247 float globalX = rhGP.x();
248 float globalY = rhGP.y();
249 float globalZ = rhGP.z();
251 float xExt = extSegm.x();
252 float yExt = extSegm.y();
254 float pull_x = (
x - xExt) /
sqrt(xErr);
255 float pull_y = (
y - yExt) /
sqrt(yErr);
262 int layer_num = layer - 1;
280 for (
auto const &st : myMap) {
282 int num_sh = st.second.size();
283 bool isThereOneSegmentMatched =
false;
285 for (
auto const &seg : myMapSeg) {
287 int num_sh_matched = 0;
288 if (seg.second.empty())
291 for (
auto const &sh : st.second) {
294 for (
auto const &rh : seg.second) {
297 auto me0id = rh.me0Id();
298 int region_rh = (
int)me0id.region();
299 int layer_rh = (
int)me0id.layer();
300 int chamber_rh = (
int)me0id.chamber();
301 int roll_rh = (
int)me0id.roll();
304 int region_sh =
id.region();
305 int layer_sh =
id.layer();
306 int chamber_sh =
id.chamber();
307 int roll_sh =
id.roll();
309 if (!(region_sh == region_rh && chamber_sh == chamber_rh && layer_sh == layer_rh && roll_sh == roll_rh))
317 float dphi_glob = gp_sh.
phi() -
gp.phi();
318 float deta_glob = gp_sh.
eta() -
gp.eta();
329 quality = num_sh_matched / (1.0 * num_sh);
331 isThereOneSegmentMatched =
true;
336 if (isThereOneSegmentMatched) {
350 int roll_rh = (
int)me0id.
roll();
353 float l_x_rh = rhLP.
x();
354 float l_y_rh = rhLP.
y();
363 int layer_dg = (
int)
id.layer();
364 int roll_dg = (
int)
id.roll();
367 if (region_rh != region_dg)
369 if (layer_rh != layer_dg)
371 if (chamber_rh != chamber_dg)
373 if (roll_rh != roll_dg)
377 for (digiItr = (*cItr).second.first; digiItr != (*cItr).second.second; ++digiItr) {
378 float l_x_dg = digiItr->x();
379 float l_y_dg = digiItr->y();
381 if (l_x_rh != l_x_dg)
383 if (l_y_rh != l_y_dg)
387 isPrompt = digiItr->prompt();
391 std::pair<int, int>
result;
404 if ((*t).momentum().pt() <
pt_min_)
407 if (eta < eta_min_ || eta >
eta_max_)
413 edm::PSimHitContainer::const_iterator itHit) {
416 int trackId_sim = itHit->trackId();
417 if (trackId == trackId_sim)