CMS 3D CMS Logo

SiStripRecHitsValid.cc
Go to the documentation of this file.
2 
3 //needed for the geometry:
11 
12 //--- for RecHit
17 
19 
20 using namespace std;
21 using namespace edm;
22 
23 //Constructor
25  : m_geomToken(esConsumes()),
26  m_topoToken(esConsumes()),
27  m_topoTokenBR(esConsumes<edm::Transition::BeginRun>()),
28  m_SiStripDetCablingToken(esConsumes<edm::Transition::BeginRun>()),
29  conf_(ps),
30  trackerHitAssociatorConfig_(ps, consumesCollector())
31 // matchedRecHits_( ps.getParameter<edm::InputTag>("matchedRecHits") ),
32 // rphiRecHits_( ps.getParameter<edm::InputTag>("rphiRecHits") ),
33 // stereoRecHits_( ps.getParameter<edm::InputTag>("stereoRecHits") )
34 {
35  matchedRecHitsToken_ = consumes<SiStripMatchedRecHit2DCollection>(ps.getParameter<edm::InputTag>("matchedRecHits"));
36 
37  rphiRecHitsToken_ = consumes<SiStripRecHit2DCollection>(ps.getParameter<edm::InputTag>("rphiRecHits"));
38 
39  stereoRecHitsToken_ = consumes<SiStripRecHit2DCollection>(ps.getParameter<edm::InputTag>("stereoRecHits"));
40 
41  topFolderName_ = conf_.getParameter<std::string>("TopFolderName");
42 
43  SubDetList_ = conf_.getParameter<std::vector<std::string> >("SubDetList");
44 
45  edm::ParameterSet ParametersNumTotrphi = conf_.getParameter<edm::ParameterSet>("TH1NumTotrphi");
46  switchNumTotrphi = ParametersNumTotrphi.getParameter<bool>("switchon");
47 
48  edm::ParameterSet ParametersNumTotStereo = conf_.getParameter<edm::ParameterSet>("TH1NumTotStereo");
49  switchNumTotStereo = ParametersNumTotStereo.getParameter<bool>("switchon");
50 
51  edm::ParameterSet ParametersNumTotMatched = conf_.getParameter<edm::ParameterSet>("TH1NumTotMatched");
52  switchNumTotMatched = ParametersNumTotMatched.getParameter<bool>("switchon");
53 
54  edm::ParameterSet ParametersNumrphi = conf_.getParameter<edm::ParameterSet>("TH1Numrphi");
55  switchNumrphi = ParametersNumrphi.getParameter<bool>("switchon");
56 
57  edm::ParameterSet ParametersBunchrphi = conf_.getParameter<edm::ParameterSet>("TH1Bunchrphi");
58  switchBunchrphi = ParametersBunchrphi.getParameter<bool>("switchon");
59 
60  edm::ParameterSet ParametersEventrphi = conf_.getParameter<edm::ParameterSet>("TH1Eventrphi");
61  switchEventrphi = ParametersEventrphi.getParameter<bool>("switchon");
62 
63  edm::ParameterSet ParametersNumStereo = conf_.getParameter<edm::ParameterSet>("TH1NumStereo");
64  switchNumStereo = ParametersNumStereo.getParameter<bool>("switchon");
65 
66  edm::ParameterSet ParametersBunchStereo = conf_.getParameter<edm::ParameterSet>("TH1BunchStereo");
67  switchBunchStereo = ParametersBunchStereo.getParameter<bool>("switchon");
68 
69  edm::ParameterSet ParametersEventStereo = conf_.getParameter<edm::ParameterSet>("TH1EventStereo");
70  switchEventStereo = ParametersEventStereo.getParameter<bool>("switchon");
71 
72  edm::ParameterSet ParametersNumMatched = conf_.getParameter<edm::ParameterSet>("TH1NumMatched");
73  switchNumMatched = ParametersNumMatched.getParameter<bool>("switchon");
74 
75  edm::ParameterSet ParametersBunchMatched = conf_.getParameter<edm::ParameterSet>("TH1BunchMatched");
76  switchBunchMatched = ParametersBunchMatched.getParameter<bool>("switchon");
77 
78  edm::ParameterSet ParametersEventMatched = conf_.getParameter<edm::ParameterSet>("TH1EventMatched");
79  switchEventMatched = ParametersEventMatched.getParameter<bool>("switchon");
80 
81  edm::ParameterSet ParametersWclusrphi = conf_.getParameter<edm::ParameterSet>("TH1Wclusrphi");
82  switchWclusrphi = ParametersWclusrphi.getParameter<bool>("switchon");
83 
84  edm::ParameterSet ParametersAdcrphi = conf_.getParameter<edm::ParameterSet>("TH1Adcrphi");
85  switchAdcrphi = ParametersAdcrphi.getParameter<bool>("switchon");
86 
87  edm::ParameterSet ParametersPosxrphi = conf_.getParameter<edm::ParameterSet>("TH1Posxrphi");
88  switchPosxrphi = ParametersPosxrphi.getParameter<bool>("switchon");
89 
90  edm::ParameterSet ParametersResolxrphi = conf_.getParameter<edm::ParameterSet>("TH1Resolxrphi");
91  switchResolxrphi = ParametersResolxrphi.getParameter<bool>("switchon");
92 
93  edm::ParameterSet ParametersResrphi = conf_.getParameter<edm::ParameterSet>("TH1Resrphi");
94  switchResrphi = ParametersResrphi.getParameter<bool>("switchon");
95 
96  edm::ParameterSet ParametersPullLFrphi = conf_.getParameter<edm::ParameterSet>("TH1PullLFrphi");
97  switchPullLFrphi = ParametersPullLFrphi.getParameter<bool>("switchon");
98 
99  edm::ParameterSet ParametersPullMFrphi = conf_.getParameter<edm::ParameterSet>("TH1PullMFrphi");
100  switchPullMFrphi = ParametersPullMFrphi.getParameter<bool>("switchon");
101 
102  edm::ParameterSet ParametersChi2rphi = conf_.getParameter<edm::ParameterSet>("TH1Chi2rphi");
103  switchChi2rphi = ParametersChi2rphi.getParameter<bool>("switchon");
104 
105  edm::ParameterSet ParametersNsimHitrphi = conf_.getParameter<edm::ParameterSet>("TH1NsimHitrphi");
106  switchNsimHitrphi = ParametersNsimHitrphi.getParameter<bool>("switchon");
107 
108  edm::ParameterSet ParametersWclusStereo = conf_.getParameter<edm::ParameterSet>("TH1WclusStereo");
109  switchWclusStereo = ParametersWclusStereo.getParameter<bool>("switchon");
110 
111  edm::ParameterSet ParametersAdcStereo = conf_.getParameter<edm::ParameterSet>("TH1AdcStereo");
112  switchAdcStereo = ParametersAdcStereo.getParameter<bool>("switchon");
113 
114  edm::ParameterSet ParametersPosxStereo = conf_.getParameter<edm::ParameterSet>("TH1PosxStereo");
115  switchPosxStereo = ParametersPosxStereo.getParameter<bool>("switchon");
116 
117  edm::ParameterSet ParametersResolxStereo = conf_.getParameter<edm::ParameterSet>("TH1ResolxStereo");
118  switchResolxStereo = ParametersResolxStereo.getParameter<bool>("switchon");
119 
120  edm::ParameterSet ParametersResStereo = conf_.getParameter<edm::ParameterSet>("TH1ResStereo");
121  switchResStereo = ParametersResStereo.getParameter<bool>("switchon");
122 
123  edm::ParameterSet ParametersPullLFStereo = conf_.getParameter<edm::ParameterSet>("TH1PullLFStereo");
124  switchPullLFStereo = ParametersPullLFStereo.getParameter<bool>("switchon");
125 
126  edm::ParameterSet ParametersPullMFStereo = conf_.getParameter<edm::ParameterSet>("TH1PullMFStereo");
127  switchPullMFStereo = ParametersPullMFStereo.getParameter<bool>("switchon");
128 
129  edm::ParameterSet ParametersChi2Stereo = conf_.getParameter<edm::ParameterSet>("TH1Chi2Stereo");
130  switchChi2Stereo = ParametersChi2Stereo.getParameter<bool>("switchon");
131 
132  edm::ParameterSet ParametersNsimHitStereo = conf_.getParameter<edm::ParameterSet>("TH1NsimHitStereo");
133  switchNsimHitStereo = ParametersNsimHitStereo.getParameter<bool>("switchon");
134 
135  edm::ParameterSet ParametersPosxMatched = conf_.getParameter<edm::ParameterSet>("TH1PosxMatched");
136  switchPosxMatched = ParametersPosxMatched.getParameter<bool>("switchon");
137 
138  edm::ParameterSet ParametersPosyMatched = conf_.getParameter<edm::ParameterSet>("TH1PosyMatched");
139  switchPosyMatched = ParametersPosyMatched.getParameter<bool>("switchon");
140 
141  edm::ParameterSet ParametersResolxMatched = conf_.getParameter<edm::ParameterSet>("TH1ResolxMatched");
142  switchResolxMatched = ParametersResolxMatched.getParameter<bool>("switchon");
143 
144  edm::ParameterSet ParametersResolyMatched = conf_.getParameter<edm::ParameterSet>("TH1ResolyMatched");
145  switchResolyMatched = ParametersResolyMatched.getParameter<bool>("switchon");
146 
147  edm::ParameterSet ParametersResxMatched = conf_.getParameter<edm::ParameterSet>("TH1ResxMatched");
148  switchResxMatched = ParametersResxMatched.getParameter<bool>("switchon");
149 
150  edm::ParameterSet ParametersResyMatched = conf_.getParameter<edm::ParameterSet>("TH1ResyMatched");
151  switchResyMatched = ParametersResyMatched.getParameter<bool>("switchon");
152 
153  edm::ParameterSet ParametersChi2Matched = conf_.getParameter<edm::ParameterSet>("TH1Chi2Matched");
154  switchChi2Matched = ParametersChi2Matched.getParameter<bool>("switchon");
155 
156  edm::ParameterSet ParametersNsimHitMatched = conf_.getParameter<edm::ParameterSet>("TH1NsimHitMatched");
157  switchNsimHitMatched = ParametersNsimHitMatched.getParameter<bool>("switchon");
158 }
159 
161 
162 //--------------------------------------------------------------------------------------------
165  edm::LogInfo("SiStripRecHitsValid") << "SiStripRecHitsValid::beginRun: "
166  << " Creating MEs for new Cabling ";
167 
168  createMEs(ibooker, es);
169  }
170 }
171 
173  LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
174 
175  //Retrieve tracker topology from geometry
176  const TrackerTopology* const tTopo = &es.getData(m_topoToken);
177 
178  // Step A: Get Inputs
182  e.getByToken(matchedRecHitsToken_, rechitsmatched);
183  e.getByToken(rphiRecHitsToken_, rechitsrphi);
184  e.getByToken(stereoRecHitsToken_, rechitsstereo);
185 
186  //Variables in order to count total num of rechitrphi,rechitstereo, rechitmatched in subdetectors
187  std::map<std::string, int> totnumrechitrphi;
188  std::map<std::string, int> totnumrechitstereo;
189  std::map<std::string, int> totnumrechitmatched;
190  int totrechitrphi = 0;
191  int totrechitstereo = 0;
192  int totrechitmatched = 0;
193 
195 
197 
198  SiStripHistoId hidmanager;
199  SiStripFolderOrganizer fold_organ;
200  for (auto const& theDetSet : *rechitsrphi) {
201  DetId detid = theDetSet.detId();
202  uint32_t myid = detid.rawId();
203  totrechitrphi += theDetSet.size();
204 
205  std::string label = hidmanager.getSubdetid(myid, tTopo, true);
206  std::map<std::string, LayerMEs>::iterator iLayerME = LayerMEsMap.find(label);
207  std::pair<std::string, int32_t> det_lay_pair = fold_organ.GetSubDetAndLayer(myid, tTopo, true);
208 
209  totnumrechitrphi[det_lay_pair.first] = totnumrechitrphi[det_lay_pair.first] + theDetSet.size();
210  //loop over rechits-rphi in the same subdetector
211  if (iLayerME != LayerMEsMap.end()) {
212  for (auto const& rechit : theDetSet) {
213  const GeomDetUnit* det = tracker.idToDetUnit(detid);
214  const StripTopology& topol = static_cast<const StripGeomDetUnit*>(det)->specificTopology();
215  //analyze RecHits
216  rechitanalysis(rechit, topol, associate);
217  // fill the result in a histogram
218  fillME(iLayerME->second.meWclusrphi, rechitpro.clusiz);
219  fillME(iLayerME->second.meAdcrphi, rechitpro.cluchg);
220  fillME(iLayerME->second.mePosxrphi, rechitpro.x);
221  fillME(iLayerME->second.meResolxrphi, rechitpro.resolxx);
222  fillME(iLayerME->second.meNsimHitrphi, rechitpro.NsimHit);
223  if (rechitpro.NsimHit > 0) {
224  std::map<std::string, SubDetMEs>::iterator iSubDetME = SubDetMEsMap.find(det_lay_pair.first);
225  fillME(iSubDetME->second.meBunchrphi, rechitpro.bunch);
226  if (rechitpro.bunch == 0)
227  fillME(iSubDetME->second.meEventrphi, rechitpro.event);
228  }
229  if (rechitpro.resx != -999999. || rechitpro.pullMF != -999999. || rechitpro.chi2 != -999999.) {
230  fillME(iLayerME->second.meResrphi, rechitpro.resx);
231  fillME(iLayerME->second.mePullLFrphi, rechitpro.resx / sqrt(rechitpro.resolxx));
232  fillME(iLayerME->second.mePullMFrphi, rechitpro.pullMF);
233  fillME(iLayerME->second.meChi2rphi, rechitpro.chi2);
234  }
235  }
236  }
237  }
238 
239  // start loops over detectors with detected rechitsstereo
240  for (auto const& theDetSet : *rechitsstereo) {
241  DetId detid = theDetSet.detId();
242  uint32_t myid = detid.rawId();
243  totrechitstereo += theDetSet.size();
244 
245  std::string label = hidmanager.getSubdetid(myid, tTopo, true);
246  std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME = StereoAndMatchedMEsMap.find(label);
247  std::pair<std::string, int32_t> det_lay_pair = fold_organ.GetSubDetAndLayer(myid, tTopo, true);
248 
249  totnumrechitstereo[det_lay_pair.first] = totnumrechitstereo[det_lay_pair.first] + theDetSet.size();
250  //loop over rechits-stereo in the same subdetector
251  if (iStereoAndMatchedME != StereoAndMatchedMEsMap.end()) {
252  for (auto const& rechit : theDetSet) {
253  const GeomDetUnit* det = tracker.idToDetUnit(detid);
254  const StripTopology& topol = static_cast<const StripGeomDetUnit*>(det)->specificTopology();
255  //analyze RecHits
256  rechitanalysis(rechit, topol, associate);
257  // fill the result in a histogram
258  fillME(iStereoAndMatchedME->second.meWclusStereo, rechitpro.clusiz);
259  fillME(iStereoAndMatchedME->second.meAdcStereo, rechitpro.cluchg);
260  fillME(iStereoAndMatchedME->second.mePosxStereo, rechitpro.x);
261  fillME(iStereoAndMatchedME->second.meResolxStereo, sqrt(rechitpro.resolxx));
262  fillME(iStereoAndMatchedME->second.meNsimHitStereo, rechitpro.NsimHit);
263  if (rechitpro.NsimHit > 0) {
264  std::map<std::string, SubDetMEs>::iterator iSubDetME = SubDetMEsMap.find(det_lay_pair.first);
265  fillME(iSubDetME->second.meBunchStereo, rechitpro.bunch);
266  if (rechitpro.bunch == 0)
267  fillME(iSubDetME->second.meEventStereo, rechitpro.event);
268  }
269  if (rechitpro.resx != -999999. || rechitpro.pullMF != -999999. || rechitpro.chi2 != -999999.) {
270  fillME(iStereoAndMatchedME->second.meResStereo, rechitpro.resx);
271  fillME(iStereoAndMatchedME->second.mePullLFStereo, rechitpro.resx / sqrt(rechitpro.resolxx));
272  fillME(iStereoAndMatchedME->second.mePullMFStereo, rechitpro.pullMF);
273  fillME(iStereoAndMatchedME->second.meChi2Stereo, rechitpro.chi2);
274  }
275  }
276  }
277  }
278 
279  // start loops over detectors with detected rechitmatched
280  for (auto const& theDetSet : *rechitsmatched) {
281  DetId detid = theDetSet.detId();
282  uint32_t myid = detid.rawId();
283  totrechitmatched += theDetSet.size();
284 
285  std::string label = hidmanager.getSubdetid(myid, tTopo, true);
286  std::map<std::string, StereoAndMatchedMEs>::iterator iStereoAndMatchedME = StereoAndMatchedMEsMap.find(label);
287  std::pair<std::string, int32_t> det_lay_pair = fold_organ.GetSubDetAndLayer(myid, tTopo, true);
288 
289  totnumrechitmatched[det_lay_pair.first] = totnumrechitmatched[det_lay_pair.first] + theDetSet.size();
290  //loop over rechits-matched in the same subdetector
291  if (iStereoAndMatchedME != StereoAndMatchedMEsMap.end()) {
292  for (auto const& rechit : theDetSet) {
293  const GluedGeomDet* gluedDet = static_cast<const GluedGeomDet*>(tracker.idToDet(rechit.geographicalId()));
294  //analyze RecHits
295  rechitanalysis_matched(rechit, gluedDet, associate);
296  // fill the result in a histogram
297  fillME(iStereoAndMatchedME->second.mePosxMatched, rechitpro.x);
298  fillME(iStereoAndMatchedME->second.mePosyMatched, rechitpro.y);
299  fillME(iStereoAndMatchedME->second.meResolxMatched, sqrt(rechitpro.resolxx));
300  fillME(iStereoAndMatchedME->second.meResolyMatched, sqrt(rechitpro.resolyy));
301  fillME(iStereoAndMatchedME->second.meNsimHitMatched, rechitpro.NsimHit);
302  if (rechitpro.NsimHit > 0) {
303  std::map<std::string, SubDetMEs>::iterator iSubDetME = SubDetMEsMap.find(det_lay_pair.first);
304  fillME(iSubDetME->second.meBunchMatched, rechitpro.bunch);
305  if (rechitpro.bunch == 0)
306  fillME(iSubDetME->second.meEventMatched, rechitpro.event);
307  }
308  if (rechitpro.resx != -999999. || rechitpro.resy != -999999. || rechitpro.chi2 != -999999.) {
309  fillME(iStereoAndMatchedME->second.meResxMatched, rechitpro.resx);
310  fillME(iStereoAndMatchedME->second.meResyMatched, rechitpro.resy);
311  fillME(iStereoAndMatchedME->second.meChi2Matched, rechitpro.chi2);
312  }
313  }
314  }
315  } //End of loops over detectors
316 
317  //now fill the cumulative histograms of the hits
318  for (std::vector<std::string>::iterator iSubdet = SubDetList_.begin(); iSubdet != SubDetList_.end(); ++iSubdet) {
319  std::map<std::string, SubDetMEs>::iterator iSubDetME = SubDetMEsMap.find((*iSubdet));
320  fillME(iSubDetME->second.meNumrphi, totnumrechitrphi[(*iSubdet)]);
321  fillME(iSubDetME->second.meNumStereo, totnumrechitstereo[(*iSubdet)]);
322  fillME(iSubDetME->second.meNumMatched, totnumrechitmatched[(*iSubdet)]);
323  }
324 
325  fillME(totalMEs.meNumTotrphi, totrechitrphi);
326  fillME(totalMEs.meNumTotStereo, totrechitstereo);
327  fillME(totalMEs.meNumTotMatched, totrechitmatched);
328 }
329 
330 //needed by to do the residual for matched hits
331 std::pair<LocalPoint, LocalVector> SiStripRecHitsValid::projectHit(const PSimHit& hit,
332  const StripGeomDetUnit* stripDet,
333  const BoundPlane& plane) {
334  // const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(hit.det());
335  //if (stripDet == nullptr) throw MeasurementDetException("HitMatcher hit is not on StripGeomDetUnit");
336 
337  const StripTopology& topol = stripDet->specificTopology();
338  GlobalPoint globalpos = stripDet->surface().toGlobal(hit.localPosition());
339  LocalPoint localHit = plane.toLocal(globalpos);
340  //track direction
341  LocalVector locdir = hit.localDirection();
342  //rotate track in new frame
343 
344  GlobalVector globaldir = stripDet->surface().toGlobal(locdir);
345  LocalVector dir = plane.toLocal(globaldir);
346  double scale = -localHit.z() / dir.z();
347 
348  LocalPoint projectedPos = localHit + scale * dir;
349 
350  double selfAngle = topol.stripAngle(topol.strip(hit.localPosition()));
351 
352  LocalVector stripDir(sin(selfAngle), cos(selfAngle), 0); // vector along strip in hit frame
353 
354  LocalVector localStripDir(plane.toLocal(stripDet->surface().toGlobal(stripDir)));
355 
356  return std::pair<LocalPoint, LocalVector>(projectedPos, localStripDir);
357 }
358 //--------------------------------------------------------------------------------------------
360  const StripTopology& topol,
361  TrackerHitAssociator& associate) {
362  rechitpro.resx = -999999.;
363  rechitpro.resy = -999999.;
364  rechitpro.pullMF = -999999.;
365  rechitpro.chi2 = -999999.;
366  rechitpro.bunch = -999999.;
367  rechitpro.event = -999999.;
368 
369  LocalPoint position = rechit.localPosition();
371  MeasurementPoint Mposition = topol.measurementPosition(position);
373  const auto& amplitudes = (rechit.cluster())->amplitudes();
374  int totcharge = 0;
375  for (auto ia : amplitudes) {
376  totcharge += ia;
377  }
378  rechitpro.x = position.x();
379  rechitpro.y = position.y();
380  //rechitpro.z = position.z();
381  rechitpro.resolxx = error.xx();
382  //rechitpro.resolxy = error.xy();
383  rechitpro.resolyy = error.yy();
384  rechitpro.clusiz = amplitudes.size();
385  rechitpro.cluchg = totcharge;
386 
387  auto const& matched = associate.associateHit(rechit);
388  rechitpro.NsimHit = matched.size();
389 
390  if (!matched.empty()) {
391  float mindist = std::numeric_limits<float>::max();
392  float dist = std::numeric_limits<float>::max();
393  PSimHit const* closest = nullptr;
394 
395  for (auto const& m : matched) {
396  dist = fabs(rechitpro.x - m.localPosition().x());
397  if (dist < mindist) {
398  mindist = dist;
399  closest = &m;
400  }
401  }
402 
403  if (!closest)
404  return;
405 
406  rechitpro.bunch = closest->eventId().bunchCrossing();
407  rechitpro.event = closest->eventId().event();
408  rechitpro.resx = rechitpro.x - closest->localPosition().x();
409  rechitpro.pullMF = (Mposition.x() - (topol.measurementPosition(closest->localPosition())).x()) / sqrt(Merror.uu());
410 
411  //chi2test compare rechit errors with the simhit position ( using null matrix for the simhit).
412  //Can spot problems in the geometry better than a simple residual. (thanks to BorisM)
413  AlgebraicVector rhparameters(2); //= rechit.parameters();
414  rhparameters[0] = position.x();
415  rhparameters[1] = position.y();
416  AlgebraicVector shparameters(2);
417  shparameters[0] = closest->localPosition().x();
418  shparameters[1] = closest->localPosition().y();
419  AlgebraicVector r(rhparameters - shparameters);
420  AlgebraicSymMatrix R(2); // = rechit.parametersError();
421  R[0][0] = error.xx();
422  R[0][1] = error.xy();
423  R[1][1] = error.yy();
424  int ierr;
425  R.invert(ierr); // if (ierr != 0) throw exception;
426  float est = R.similarity(r);
427  rechitpro.chi2 = est;
428  }
429 }
430 
431 //--------------------------------------------------------------------------------------------
433  const GluedGeomDet* gluedDet,
434  TrackerHitAssociator& associate) {
435  rechitpro.resx = -999999.;
436  rechitpro.resy = -999999.;
437  rechitpro.pullMF = -999999.;
438  rechitpro.chi2 = -999999.;
439  rechitpro.bunch = -999999.;
440  rechitpro.event = -999999.;
441  rechitpro.clusiz = -999999.;
442  rechitpro.cluchg = -999999.;
443 
444  LocalPoint position = rechit.localPosition();
446 
447  rechitpro.x = position.x();
448  rechitpro.y = position.y();
449  //rechitpro.z = position.z();
450  rechitpro.resolxx = error.xx();
451  //rechitpro.resolxy = error.xy();
452  rechitpro.resolyy = error.yy();
453 
454  auto const& matched = associate.associateHit(rechit);
455  rechitpro.NsimHit = matched.size();
456 
457  if (matched.empty())
458  return;
459  float mindist = std::numeric_limits<float>::max();
460  float dist = std::numeric_limits<float>::max();
461  float dist2 = std::numeric_limits<float>::max();
462  float distx = std::numeric_limits<float>::max();
463  float disty = std::numeric_limits<float>::max();
464  PSimHit const* closest = nullptr;
465  std::pair<LocalPoint, LocalVector> closestPair;
466 
467  const StripGeomDetUnit* partnerstripdet = static_cast<const StripGeomDetUnit*>(gluedDet->stereoDet());
468  std::pair<LocalPoint, LocalVector> hitPair;
469 
470  for (auto const& m : matched) {
471  SiStripDetId hitDetId(m.detUnitId());
472  if (hitDetId.stereo()) { // project from the stereo sensor
473  //project simhit;
474  hitPair = projectHit(m, partnerstripdet, gluedDet->surface());
475  distx = rechitpro.x - hitPair.first.x();
476  disty = rechitpro.y - hitPair.first.y();
477  dist2 = distx * distx + disty * disty;
478  dist = sqrt(dist2);
479  if (dist < mindist) {
480  mindist = dist;
481  closestPair = hitPair;
482  closest = &m;
483  }
484  }
485  }
486  if (!closest)
487  return;
488  rechitpro.bunch = closest->eventId().bunchCrossing();
489  rechitpro.event = closest->eventId().event();
490  rechitpro.resx = rechitpro.x - closestPair.first.x();
491  rechitpro.resy = rechitpro.y - closestPair.first.y();
492 
493  //chi2test compare rechit errors with the simhit position ( using null matrix for the simhit).
494  //Can spot problems in the geometry better than a simple residual. (thanks to BorisM)
495  AlgebraicVector rhparameters(2); //= rechit.parameters();
496  rhparameters[0] = position.x();
497  rhparameters[1] = position.y();
498  LocalPoint sh = closestPair.first;
499  AlgebraicVector shparameters(2);
500  shparameters[0] = sh.x();
501  shparameters[1] = sh.y();
502  AlgebraicVector r(rhparameters - shparameters);
503  AlgebraicSymMatrix R(2); // = rechit.parametersError();
504  R[0][0] = error.xx();
505  R[0][1] = error.xy();
506  R[1][1] = error.yy();
507  int ierr;
508  R.invert(ierr); // if (ierr != 0) throw exception;
509  float est = R.similarity(r);
510  rechitpro.chi2 = est;
511 }
512 
513 //--------------------------------------------------------------------------------------------
515  //Retrieve tracker topology from geometry
516  const TrackerTopology* const tTopo = &es.getData(m_topoTokenBR);
517 
518  // take from eventSetup the SiStripDetCabling object - here will use SiStripDetControl later on
520 
521  // get list of active detectors from SiStripDetCabling
522  std::vector<uint32_t> activeDets;
524 
525  SiStripFolderOrganizer folder_organizer;
526  // folder_organizer.setSiStripFolderName(topFolderName_);
527  std::string curfold = topFolderName_;
528  folder_organizer.setSiStripFolderName(curfold);
529  folder_organizer.setSiStripFolder();
530 
531  createTotalMEs(ibooker);
532  // loop over detectors and book MEs
533  edm::LogInfo("SiStripTkRecHits|SiStripRecHitsValid") << "nr. of activeDets: " << activeDets.size();
534  const std::string &tec = "TEC", tid = "TID", tob = "TOB", tib = "TIB";
535  for (auto detid_iterator = activeDets.begin(), detid_end = activeDets.end(); detid_iterator != detid_end;
536  ++detid_iterator) {
537  uint32_t detid = (*detid_iterator);
538  // remove any eventual zero elements - there should be none, but just in case
539  if (detid == 0) {
540  activeDets.erase(detid_iterator);
541  continue;
542  }
543 
544  // Create Layer Level MEs
545  std::pair<std::string, int32_t> det_layer_pair = folder_organizer.GetSubDetAndLayer(detid, tTopo, true);
546  SiStripHistoId hidmanager;
547  std::string label = hidmanager.getSubdetid(detid, tTopo, true);
548 
549  if (LayerMEsMap.find(label) == LayerMEsMap.end()) {
550  // get detids for the layer
551  // Keep in mind that when we are on the TID or TEC we deal with rings not wheel
552  int32_t lnumber = det_layer_pair.second;
553  const std::string& lname = det_layer_pair.first;
554  std::vector<uint32_t> layerDetIds;
555  if (lname == tec) {
556  if (lnumber > 0) {
557  SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 2, 0, 0, 0, abs(lnumber), 0);
558  } else if (lnumber < 0) {
559  SiStripSubStructure::getTECDetectors(activeDets, layerDetIds, tTopo, 1, 0, 0, 0, abs(lnumber), 0);
560  }
561  } else if (lname == tid) {
562  if (lnumber > 0) {
563  SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 2, 0, abs(lnumber), 0);
564  } else if (lnumber < 0) {
565  SiStripSubStructure::getTIDDetectors(activeDets, layerDetIds, tTopo, 1, 0, abs(lnumber), 0);
566  }
567  } else if (lname == tob) {
568  SiStripSubStructure::getTOBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0);
569  } else if (lname == tib) {
570  SiStripSubStructure::getTIBDetectors(activeDets, layerDetIds, tTopo, lnumber, 0, 0, 0);
571  }
572  LayerDetMap[label] = layerDetIds;
573 
574  // book Layer MEs
575  folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second, true);
576  createLayerMEs(ibooker, label);
577  }
578  // book sub-detector plots
579  if (SubDetMEsMap.find(det_layer_pair.first) == SubDetMEsMap.end()) {
580  auto sdet_pair = folder_organizer.getSubDetFolderAndTag(detid, tTopo);
581  ibooker.setCurrentFolder(sdet_pair.first);
582  createSubDetMEs(ibooker, det_layer_pair.first);
583  }
584  //Create StereoAndMatchedMEs
586  // get detids for the stereo and matched layer. We are going to need a bool for these layers
587  bool isStereo = false;
588  // Keep in mind that when we are on the TID or TEC we deal with rings not wheel
589  std::vector<uint32_t> stereoandmatchedDetIds;
590  int32_t stereolnumber = det_layer_pair.second;
591  const std::string& stereolname = det_layer_pair.first;
592  if (stereolname == tec && (tTopo->tecIsStereo(detid))) {
593  if (stereolnumber > 0) {
595  activeDets, stereoandmatchedDetIds, tTopo, 2, 0, 0, 0, abs(stereolnumber), 1);
596  isStereo = true;
597  } else if (stereolnumber < 0) {
599  activeDets, stereoandmatchedDetIds, tTopo, 1, 0, 0, 0, abs(stereolnumber), 1);
600  isStereo = true;
601  }
602  } else if (stereolname == tid && (tTopo->tidIsStereo(detid))) {
603  if (stereolnumber > 0) {
604  SiStripSubStructure::getTIDDetectors(activeDets, stereoandmatchedDetIds, tTopo, 2, 0, abs(stereolnumber), 1);
605  isStereo = true;
606  } else if (stereolnumber < 0) {
607  SiStripSubStructure::getTIDDetectors(activeDets, stereoandmatchedDetIds, tTopo, 1, 0, abs(stereolnumber), 1);
608  isStereo = true;
609  }
610  } else if (stereolname == tob && (tTopo->tobIsStereo(detid))) {
611  SiStripSubStructure::getTOBDetectors(activeDets, stereoandmatchedDetIds, tTopo, stereolnumber, 0, 0);
612  isStereo = true;
613  } else if (stereolname == tib && (tTopo->tibIsStereo(detid))) {
614  SiStripSubStructure::getTIBDetectors(activeDets, stereoandmatchedDetIds, tTopo, stereolnumber, 0, 0, 0);
615  isStereo = true;
616  }
617 
618  StereoAndMatchedDetMap[label] = stereoandmatchedDetIds;
619 
620  if (isStereo) {
621  //book StereoAndMatched MEs
622  folder_organizer.setLayerFolder(detid, tTopo, det_layer_pair.second, true);
623  //Create the Monitor Elements only when we have a stereo module
625  }
626  }
627  } //end of loop over detectors
628 }
629 //------------------------------------------------------------------------------------------
631  totalMEs.meNumTotrphi = nullptr;
632  totalMEs.meNumTotStereo = nullptr;
633  totalMEs.meNumTotMatched = nullptr;
634 
635  //NumTotrphi
636  if (switchNumTotrphi) {
637  totalMEs.meNumTotrphi = bookME1D(ibooker, "TH1NumTotrphi", "TH1NumTotrphi", "Num of RecHits rphi");
638  totalMEs.meNumTotrphi->setAxisTitle("Total number of RecHits");
639  }
640  //NumTotStereo
641  if (switchNumTotStereo) {
642  totalMEs.meNumTotStereo = bookME1D(ibooker, "TH1NumTotStereo", "TH1NumTotStereo", "Num of RecHits stereo");
643  totalMEs.meNumTotStereo->setAxisTitle("Total number of RecHits (stereo)");
644  }
645  //NumTotMatched
646  if (switchNumTotMatched) {
647  totalMEs.meNumTotMatched = bookME1D(ibooker, "TH1NumTotMatched", "TH1NumTotMatched", "Num of RecHits matched");
648  totalMEs.meNumTotMatched->setAxisTitle("Total number of matched RecHits");
649  }
650 }
651 //------------------------------------------------------------------------------------------
653  SiStripHistoId hidmanager;
654  LayerMEs layerMEs;
655 
656  layerMEs.meWclusrphi = nullptr;
657  layerMEs.meAdcrphi = nullptr;
658  layerMEs.mePosxrphi = nullptr;
659  layerMEs.meResolxrphi = nullptr;
660  layerMEs.meResrphi = nullptr;
661  layerMEs.mePullLFrphi = nullptr;
662  layerMEs.mePullMFrphi = nullptr;
663  layerMEs.meChi2rphi = nullptr;
664  layerMEs.meNsimHitrphi = nullptr;
665 
666  //Wclusrphi
667  if (switchWclusrphi) {
668  layerMEs.meWclusrphi = bookME1D(ibooker,
669  "TH1Wclusrphi",
670  hidmanager.createHistoLayer("Wclus_rphi", "layer", label, "").c_str(),
671  "Cluster Width - Number of strips that belong to the RecHit cluster");
672  layerMEs.meWclusrphi->setAxisTitle("Cluster Width [nr strips] in " + label);
673  }
674  //Adcrphi
675  if (switchAdcrphi) {
676  layerMEs.meAdcrphi = bookME1D(ibooker,
677  "TH1Adcrphi",
678  hidmanager.createHistoLayer("Adc_rphi", "layer", label, "").c_str(),
679  "RecHit Cluster Charge");
680  layerMEs.meAdcrphi->setAxisTitle("cluster charge [ADC] in " + label);
681  }
682  //Posxrphi
683  if (switchPosxrphi) {
684  layerMEs.mePosxrphi = bookME1D(ibooker,
685  "TH1Posxrphi",
686  hidmanager.createHistoLayer("Posx_rphi", "layer", label, "").c_str(),
687  "RecHit x coord.");
688  layerMEs.mePosxrphi->setAxisTitle("x RecHit coord. (local frame) in " + label);
689  }
690  //Resolxrphi
691  if (switchResolxrphi) {
692  layerMEs.meResolxrphi = bookME1D(ibooker,
693  "TH1Resolxrphi",
694  hidmanager.createHistoLayer("Resolx_rphi", "layer", label, "").c_str(),
695  "RecHit resol(x) coord."); //<resolor>~20micron
696  layerMEs.meResolxrphi->setAxisTitle("resol(x) RecHit coord. (local frame) in " + label);
697  }
698  //Resrphi
699  if (switchResrphi) {
700  layerMEs.meResrphi = bookME1D(ibooker,
701  "TH1Resrphi",
702  hidmanager.createHistoLayer("Res_rphi", "layer", label, "").c_str(),
703  "Residuals of the hit x coordinate");
704  layerMEs.meResrphi->setAxisTitle("RecHit Res(x) in " + label);
705  }
706  //PullLFrphi
707  if (switchPullLFrphi) {
708  layerMEs.mePullLFrphi = bookME1D(ibooker,
709  "TH1PullLFrphi",
710  hidmanager.createHistoLayer("Pull_LF_rphi", "layer", label, "").c_str(),
711  "Pull distribution");
712  layerMEs.mePullLFrphi->setAxisTitle("Pull distribution (local frame) in " + label);
713  }
714  //PullMFrphi
715  if (switchPullMFrphi) {
716  layerMEs.mePullMFrphi = bookME1D(ibooker,
717  "TH1PullMFrphi",
718  hidmanager.createHistoLayer("Pull_MF_rphi", "layer", label, "").c_str(),
719  "Pull distribution");
720  layerMEs.mePullMFrphi->setAxisTitle("Pull distribution (measurement frame) in " + label);
721  }
722  //Chi2rphi
723  if (switchChi2rphi) {
724  layerMEs.meChi2rphi = bookME1D(ibooker,
725  "TH1Chi2rphi",
726  hidmanager.createHistoLayer("Chi2_rphi", "layer", label, "").c_str(),
727  "RecHit Chi2 test");
728  layerMEs.meChi2rphi->setAxisTitle("RecHit Chi2 test in " + label);
729  }
730  //NsimHitrphi
731  if (switchNsimHitrphi) {
732  layerMEs.meNsimHitrphi = bookME1D(ibooker,
733  "TH1NsimHitrphi",
734  hidmanager.createHistoLayer("NsimHit_rphi", "layer", label, "").c_str(),
735  "No. of assoc. simHits");
736  layerMEs.meNsimHitrphi->setAxisTitle("Number of assoc. simHits in " + label);
737  }
738 
739  LayerMEsMap[label] = layerMEs;
740 }
741 //------------------------------------------------------------------------------------------
743  SiStripHistoId hidmanager;
744  StereoAndMatchedMEs stereoandmatchedMEs;
745 
746  stereoandmatchedMEs.meWclusStereo = nullptr;
747  stereoandmatchedMEs.meAdcStereo = nullptr;
748  stereoandmatchedMEs.mePosxStereo = nullptr;
749  stereoandmatchedMEs.meResolxStereo = nullptr;
750  stereoandmatchedMEs.meResStereo = nullptr;
751  stereoandmatchedMEs.mePullLFStereo = nullptr;
752  stereoandmatchedMEs.mePullMFStereo = nullptr;
753  stereoandmatchedMEs.meChi2Stereo = nullptr;
754  stereoandmatchedMEs.meNsimHitStereo = nullptr;
755  stereoandmatchedMEs.mePosxMatched = nullptr;
756  stereoandmatchedMEs.mePosyMatched = nullptr;
757  stereoandmatchedMEs.meResolxMatched = nullptr;
758  stereoandmatchedMEs.meResolyMatched = nullptr;
759  stereoandmatchedMEs.meResxMatched = nullptr;
760  stereoandmatchedMEs.meResyMatched = nullptr;
761  stereoandmatchedMEs.meChi2Matched = nullptr;
762  stereoandmatchedMEs.meNsimHitMatched = nullptr;
763 
764  //WclusStereo
765  if (switchWclusStereo) {
766  stereoandmatchedMEs.meWclusStereo =
767  bookME1D(ibooker,
768  "TH1WclusStereo",
769  hidmanager.createHistoLayer("Wclus_stereo", "layer", label, "").c_str(),
770  "Cluster Width - Number of strips that belong to the RecHit cluster");
771  stereoandmatchedMEs.meWclusStereo->setAxisTitle("Cluster Width [nr strips] in stereo modules in " + label);
772  }
773  //AdcStereo
774  if (switchAdcStereo) {
775  stereoandmatchedMEs.meAdcStereo = bookME1D(ibooker,
776  "TH1AdcStereo",
777  hidmanager.createHistoLayer("Adc_stereo", "layer", label, "").c_str(),
778  "RecHit Cluster Charge");
779  stereoandmatchedMEs.meAdcStereo->setAxisTitle("cluster charge [ADC] in stereo modules in " + label);
780  }
781  //PosxStereo
782  if (switchPosxStereo) {
783  stereoandmatchedMEs.mePosxStereo = bookME1D(ibooker,
784  "TH1PosxStereo",
785  hidmanager.createHistoLayer("Posx_stereo", "layer", label, "").c_str(),
786  "RecHit x coord.");
787  stereoandmatchedMEs.mePosxStereo->setAxisTitle("x RecHit coord. (local frame) in stereo modules in " + label);
788  }
789  //ResolxStereo
790  if (switchResolxStereo) {
791  stereoandmatchedMEs.meResolxStereo =
792  bookME1D(ibooker,
793  "TH1ResolxStereo",
794  hidmanager.createHistoLayer("Resolx_stereo", "layer", label, "").c_str(),
795  "RecHit resol(x) coord.");
796  stereoandmatchedMEs.meResolxStereo->setAxisTitle("resol(x) RecHit coord. (local frame) in stereo modules in " +
797  label);
798  }
799  //ResStereo
800  if (switchResStereo) {
801  stereoandmatchedMEs.meResStereo = bookME1D(ibooker,
802  "TH1ResStereo",
803  hidmanager.createHistoLayer("Res_stereo", "layer", label, "").c_str(),
804  "Residuals of the hit x coordinate");
805  stereoandmatchedMEs.meResStereo->setAxisTitle("RecHit Res(x) in stereo modules in " + label);
806  }
807  //PullLFStereo
808  if (switchPullLFStereo) {
809  stereoandmatchedMEs.mePullLFStereo =
810  bookME1D(ibooker,
811  "TH1PullLFStereo",
812  hidmanager.createHistoLayer("Pull_LF_stereo", "layer", label, "").c_str(),
813  "Pull distribution");
814  stereoandmatchedMEs.mePullLFStereo->setAxisTitle("Pull distribution (local frame) in stereo modules in " + label);
815  }
816  //PullMFStereo
817  if (switchPullMFStereo) {
818  stereoandmatchedMEs.mePullMFStereo =
819  bookME1D(ibooker,
820  "TH1PullMFStereo",
821  hidmanager.createHistoLayer("Pull_MF_stereo", "layer", label, "").c_str(),
822  "Pull distribution");
823  stereoandmatchedMEs.mePullMFStereo->setAxisTitle("Pull distribution (measurement frame) in stereo modules in " +
824  label);
825  }
826  //Chi2Stereo
827  if (switchChi2Stereo) {
828  stereoandmatchedMEs.meChi2Stereo = bookME1D(ibooker,
829  "TH1Chi2Stereo",
830  hidmanager.createHistoLayer("Chi2_stereo", "layer", label, "").c_str(),
831  "RecHit Chi2 test");
832  stereoandmatchedMEs.meChi2Stereo->setAxisTitle("RecHit Chi2 test in stereo modules in " + label);
833  }
834  //NsimHitStereo
835  if (switchNsimHitStereo) {
836  stereoandmatchedMEs.meNsimHitStereo =
837  bookME1D(ibooker,
838  "TH1NsimHitStereo",
839  hidmanager.createHistoLayer("NsimHit_stereo", "layer", label, "").c_str(),
840  "No. of assoc. simHits");
841  stereoandmatchedMEs.meNsimHitStereo->setAxisTitle("Number of assoc. simHits in stereo modules in " + label);
842  }
843  //PosxMatched
844  if (switchPosxMatched) {
845  stereoandmatchedMEs.mePosxMatched =
846  bookME1D(ibooker,
847  "TH1PosxMatched",
848  hidmanager.createHistoLayer("Posx_matched", "layer", label, "").c_str(),
849  "RecHit x coord.");
850  stereoandmatchedMEs.mePosxMatched->setAxisTitle("x coord. matched RecHit (local frame) in " + label);
851  }
852  //PosyMatched
853  if (switchPosyMatched) {
854  stereoandmatchedMEs.mePosyMatched =
855  bookME1D(ibooker,
856  "TH1PosyMatched",
857  hidmanager.createHistoLayer("Posy_matched", "layer", label, "").c_str(),
858  "RecHit y coord.");
859  stereoandmatchedMEs.mePosyMatched->setAxisTitle("y coord. matched RecHit (local frame) in " + label);
860  }
861  //ResolxMatched
862  if (switchResolxMatched) {
863  stereoandmatchedMEs.meResolxMatched =
864  bookME1D(ibooker,
865  "TH1ResolxMatched",
866  hidmanager.createHistoLayer("Resolx_matched", "layer", label, "").c_str(),
867  "RecHit resol(x) coord.");
868  stereoandmatchedMEs.meResolxMatched->setAxisTitle("resol(x) coord. matched RecHit (local frame) in " + label);
869  }
870  //ResolyMatched
871  if (switchResolyMatched) {
872  stereoandmatchedMEs.meResolyMatched =
873  bookME1D(ibooker,
874  "TH1ResolyMatched",
875  hidmanager.createHistoLayer("Resoly_matched", "layer", label, "").c_str(),
876  "RecHit resol(y) coord.");
877  stereoandmatchedMEs.meResolyMatched->setAxisTitle("resol(y) coord. matched RecHit (local frame) in " + label);
878  }
879  //ResxMatched
880  if (switchResxMatched) {
881  stereoandmatchedMEs.meResxMatched =
882  bookME1D(ibooker,
883  "TH1ResxMatched",
884  hidmanager.createHistoLayer("Resx_matched", "layer", label, "").c_str(),
885  "Residuals of the hit x coord.");
886  stereoandmatchedMEs.meResxMatched->setAxisTitle("Res(x) in matched RecHit in " + label);
887  }
888  //ResyMatched
889  if (switchResyMatched) {
890  stereoandmatchedMEs.meResyMatched =
891  bookME1D(ibooker,
892  "TH1ResyMatched",
893  hidmanager.createHistoLayer("Resy_matched", "layer", label, "").c_str(),
894  "Residuals of the hit y coord.");
895  stereoandmatchedMEs.meResyMatched->setAxisTitle("Res(y) in matched RecHit in " + label);
896  }
897  //Chi2Matched
898  if (switchChi2Matched) {
899  stereoandmatchedMEs.meChi2Matched =
900  bookME1D(ibooker,
901  "TH1Chi2Matched",
902  hidmanager.createHistoLayer("Chi2_matched", "layer", label, "").c_str(),
903  "RecHit Chi2 test");
904  stereoandmatchedMEs.meChi2Matched->setAxisTitle("Matched RecHit Chi2 test in " + label);
905  }
906  //NsimHitMatched
907  if (switchNsimHitMatched) {
908  stereoandmatchedMEs.meNsimHitMatched =
909  bookME1D(ibooker,
910  "TH1NsimHitMatched",
911  hidmanager.createHistoLayer("NsimHit_matched", "layer", label, "").c_str(),
912  "No. of assoc. simHits");
913  stereoandmatchedMEs.meNsimHitMatched->setAxisTitle("Number of assoc. simHits in " + label);
914  }
915 
916  StereoAndMatchedMEsMap[label] = stereoandmatchedMEs;
917 }
918 //------------------------------------------------------------------------------------------
920  SubDetMEs subdetMEs;
921  subdetMEs.meNumrphi = nullptr;
922  subdetMEs.meBunchrphi = nullptr;
923  subdetMEs.meEventrphi = nullptr;
924  subdetMEs.meNumStereo = nullptr;
925  subdetMEs.meBunchStereo = nullptr;
926  subdetMEs.meEventStereo = nullptr;
927  subdetMEs.meNumMatched = nullptr;
928  subdetMEs.meBunchMatched = nullptr;
929  subdetMEs.meEventMatched = nullptr;
930 
932  //Numrphi
933  if (switchNumrphi) {
934  HistoName = "TH1Numrphi__" + label;
935  subdetMEs.meNumrphi = bookME1D(ibooker, "TH1Numrphi", HistoName.c_str(), "Num of RecHits");
936  subdetMEs.meNumrphi->setAxisTitle("Total number of RecHits in " + label);
937  }
938  //Bunchrphi
939  if (switchBunchrphi) {
940  HistoName = "TH1Bunchrphi__" + label;
941  subdetMEs.meBunchrphi = bookME1D(ibooker, "TH1Bunchrphi", HistoName.c_str(), "Bunch Crossing");
942  subdetMEs.meBunchrphi->setAxisTitle("Bunch crossing in " + label);
943  }
944  //Eventrphi
945  if (switchEventrphi) {
946  HistoName = "TH1Eventrphi__" + label;
947  subdetMEs.meEventrphi = bookME1D(ibooker, "TH1Eventrphi", HistoName.c_str(), "Event (in-time bunch)");
948  subdetMEs.meEventrphi->setAxisTitle("Event (in-time bunch) in " + label);
949  }
950  //NumStereo
951  if (switchNumStereo) {
952  HistoName = "TH1NumStereo__" + label;
953  subdetMEs.meNumStereo = bookME1D(ibooker, "TH1NumStereo", HistoName.c_str(), "Num of RecHits in stereo modules");
954  subdetMEs.meNumStereo->setAxisTitle("Total number of RecHits, stereo modules in " + label);
955  }
956  //BunchStereo
957  if (switchBunchStereo) {
958  HistoName = "TH1BunchStereo__" + label;
959  subdetMEs.meBunchStereo = bookME1D(ibooker, "TH1BunchStereo", HistoName.c_str(), "Bunch Crossing");
960  subdetMEs.meBunchStereo->setAxisTitle("Bunch crossing, stereo modules in " + label);
961  }
962  //EventStereo
963  if (switchEventStereo) {
964  HistoName = "TH1EventStereo__" + label;
965  subdetMEs.meEventStereo = bookME1D(ibooker, "TH1EventStereo", HistoName.c_str(), "Event (in-time bunch)");
966  subdetMEs.meEventStereo->setAxisTitle("Event (in-time bunch), stereo modules in " + label);
967  }
968  //NumMatched
969  if (switchNumMatched) {
970  HistoName = "TH1NumMatched__" + label;
971  subdetMEs.meNumMatched = bookME1D(ibooker, "TH1NumMatched", HistoName.c_str(), "Num of matched RecHits");
972  subdetMEs.meNumMatched->setAxisTitle("Total number of matched RecHits in " + label);
973  }
974  //BunchMatched
975  if (switchBunchMatched) {
976  HistoName = "TH1BunchMatched__" + label;
977  subdetMEs.meBunchMatched = bookME1D(ibooker, "TH1BunchMatched", HistoName.c_str(), "Bunch Crossing");
978  subdetMEs.meBunchMatched->setAxisTitle("Bunch crossing, matched RecHits in " + label);
979  }
980  //EventMatched
981  if (switchEventMatched) {
982  HistoName = "TH1EventMatched__" + label;
983  subdetMEs.meEventMatched = bookME1D(ibooker, "TH1EventMatched", HistoName.c_str(), "Event (in-time bunch)");
984  subdetMEs.meEventMatched->setAxisTitle("Event (in-time bunch), matched RecHits in " + label);
985  }
986 
987  SubDetMEsMap[label] = subdetMEs;
988 }
989 //------------------------------------------------------------------------------------------
991  const char* ParameterSetLabel,
992  const char* HistoName,
993  const char* HistoTitle) {
995  return ibooker.book1D(HistoName,
996  HistoTitle,
997  parameters.getParameter<int32_t>("Nbinx"),
998  parameters.getParameter<double>("xmin"),
999  parameters.getParameter<double>("xmax"));
1000 }
1001 
1002 //define this as a plug-in
RecHitProperties rechitpro
std::vector< std::string > SubDetList_
float uu() const
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESWatcher< SiStripDetCablingRcd > watchSiStripDetCablingRcd_
void rechitanalysis_matched(SiStripMatchedRecHit2D const rechit, const GluedGeomDet *gluedDet, TrackerHitAssociator &associate)
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0)
void createStereoAndMatchedMEs(DQMStore::IBooker &ibooker, std::string label)
void setSiStripFolderName(std::string name)
int event() const
get the contents of the subdetector field (should be protected?)
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es) override
virtual float stripAngle(float strip) const =0
std::pair< const std::string, const char * > getSubDetFolderAndTag(const uint32_t &detid, const TrackerTopology *tTopo)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
T z() const
Definition: PV3DBase.h:61
void createSubDetMEs(DQMStore::IBooker &ibooker, std::string label)
TrackerHitAssociator::Config trackerHitAssociatorConfig_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::map< std::string, SubDetMEs > SubDetMEsMap
void rechitanalysis(SiStripRecHit2D const rechit, const StripTopology &topol, TrackerHitAssociator &associate)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::map< std::string, StereoAndMatchedMEs > StereoAndMatchedMEsMap
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0)
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=false)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoToken
T x() const
Definition: PV2DBase.h:43
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, const TrackerTopology *trackerTopology, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0)
ClusterRef cluster() const
bool tibIsStereo(const DetId &id) const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
virtual float strip(const LocalPoint &) const =0
edm::EDGetTokenT< SiStripRecHit2DCollection > stereoRecHitsToken_
bool tobIsStereo(const DetId &id) const
char const * label
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
const edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > m_SiStripDetCablingToken
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::map< std::string, std::vector< uint32_t > > LayerDetMap
T sqrt(T t)
Definition: SSEVec.h:19
int bunchCrossing() const
get the detector field from this detid
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
void createMEs(DQMStore::IBooker &ibooker, const edm::EventSetup &es)
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::EDGetTokenT< SiStripRecHit2DCollection > rphiRecHitsToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_topoTokenBR
std::string getSubdetid(uint32_t id, const TrackerTopology *tTopo, bool flag_ring)
EncodedEventId eventId() const
Definition: PSimHit.h:108
MonitorElement * bookME1D(DQMStore::IBooker &ibooker, const char *ParameterSetLabel, const char *HistoName, const char *HistoTitle)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
SiStripRecHitsValid(const edm::ParameterSet &conf)
Log< level::Info, false > LogInfo
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
LocalError localPositionError() const override
Definition: DetId.h:17
std::map< std::string, LayerMEs > LayerMEsMap
edm::ESHandle< SiStripDetCabling > SiStripDetCabling_
CLHEP::HepVector AlgebraicVector
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Local3DPoint localPosition() const
Definition: PSimHit.h:52
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_geomToken
bool tecIsStereo(const DetId &id) const
std::pair< LocalPoint, LocalVector > projectHit(const PSimHit &hit, const StripGeomDetUnit *stripDet, const BoundPlane &plane)
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::string HistoName
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=false)
bool tidIsStereo(const DetId &id) const
void createTotalMEs(DQMStore::IBooker &ibooker)
edm::ParameterSet conf_
edm::EDGetTokenT< SiStripMatchedRecHit2DCollection > matchedRecHitsToken_
HLT enums.
LocalPoint localPosition() const override
static int position[264][3]
Definition: ReadPGInfo.cc:289
CLHEP::HepSymMatrix AlgebraicSymMatrix
void createLayerMEs(DQMStore::IBooker &ibooker, std::string label)
void fillME(MonitorElement *ME, float value1)
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, const TrackerTopology *trackerTopology, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0)
std::string createHistoLayer(std::string description, std::string id_type, std::string path, std::string flag)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::map< std::string, std::vector< uint32_t > > StereoAndMatchedDetMap
Definition: Run.h:45
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)