CMS 3D CMS Logo

CkfDebugger.cc
Go to the documentation of this file.
1 #include "CkfDebugger.h"
12 #include "TSOSFromSimHitFactory.h"
17 
19 
25 // #include "RecoTracker/TkDetLayers/interface/PixelBarrelLayer.h"
26 
29 
30 #include <iostream>
31 #include <iomanip>
32 #include <sstream>
33 
34 using namespace std;
35 
36 inline DetId gluedId(const DetId& du) {
37  unsigned int mask = ~3; // mask the last two bits
38  return DetId(du.rawId() & mask);
39 }
40 
42  : theTrackerToken(iC.esConsumes()),
43  theFieldToken(iC.esConsumes()),
44  theTopoHandToken(iC.esConsumes()),
45  theNavToken(iC.esConsumes(edm::ESInputTag("", "SimpleNavigationSchool"))),
46  trackerHitAssociatorConfig_(std::move(iC)),
47  totSeeds(0) {}
48 
50  file = new TFile("out.root", "recreate");
51  hchi2seedAll = new TH1F("hchi2seedAll", "hchi2seedAll", 2000, 0, 200);
52  hchi2seedProb = new TH1F("hchi2seedProb", "hchi2seedProb", 2000, 0, 200);
53 
55 
57 
58  //Retrieve tracker topology from geometry
60 
62 
63  for (int i = 0; i != 17; i++) {
64  dump.push_back(0);
65  }
66 
67  std::stringstream title;
68  for (int i = 0; i != 6; i++)
69  for (int j = 0; j != 9; j++) {
70  if (i == 0 && j > 2)
71  break;
72  if (i == 1 && j > 1)
73  break;
74  if (i == 2 && j > 3)
75  break;
76  if (i == 3 && j > 2)
77  break;
78  if (i == 4 && j > 5)
79  break;
80  if (i == 5 && j > 8)
81  break;
82  dump2[pair<int, int>(i, j)] = 0;
83  dump3[pair<int, int>(i, j)] = 0;
84  dump4[pair<int, int>(i, j)] = 0;
85  dump5[pair<int, int>(i, j)] = 0;
86  dump6[pair<int, int>(i, j)] = 0;
87  title.str("");
88  title << "pullX_" << i + 1 << "-" << j + 1 << "_sh-rh";
89  hPullX_shrh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
90  title.str("");
91  title << "pullY_" << i + 1 << "-" << j + 1 << "_sh-rh";
92  hPullY_shrh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
93  title.str("");
94  title << "pullX_" << i + 1 << "-" << j + 1 << "_sh-st";
95  hPullX_shst[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
96  title.str("");
97  title << "pullY_" << i + 1 << "-" << j + 1 << "_sh-st";
98  hPullY_shst[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
99  title.str("");
100  title << "pullX_" << i + 1 << "-" << j + 1 << "_st-rh";
101  hPullX_strh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
102  title.str("");
103  title << "pullY_" << i + 1 << "-" << j + 1 << "_st-rh";
104  hPullY_strh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
105  title.str("");
106  title << "PullGP_X_" << i + 1 << "-" << j + 1 << "_sh-st";
107  hPullGP_X_shst[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
108  title.str("");
109  title << "PullGP_Y_" << i + 1 << "-" << j + 1 << "_sh-st";
110  hPullGP_Y_shst[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
111  title.str("");
112  title << "PullGP_Z_" << i + 1 << "-" << j + 1 << "_sh-st";
113  hPullGP_Z_shst[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
114  if (((i == 2 || i == 4) && (j == 0 || j == 1)) || (i == 3 || i == 5)) {
115  title.str("");
116  title << "pullM_" << i + 1 << "-" << j + 1 << "_sh-rh";
117  hPullM_shrh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
118  title.str("");
119  title << "pullS_" << i + 1 << "-" << j + 1 << "_sh-rh";
120  hPullS_shrh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
121  title.str("");
122  title << "pullM_" << i + 1 << "-" << j + 1 << "_sh-st";
123  hPullM_shst[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
124  title.str("");
125  title << "pullS_" << i + 1 << "-" << j + 1 << "_sh-st";
126  hPullS_shst[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
127  title.str("");
128  title << "pullM_" << i + 1 << "-" << j + 1 << "_st-rh";
129  hPullM_strh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
130  title.str("");
131  title << "pullS_" << i + 1 << "-" << j + 1 << "_st-rh";
132  hPullS_strh[title.str()] = new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
133  }
134  }
135 
136  hPullGPXvsGPX_shst = new TH2F("PullGPXvsGPX_shst", "PullGPXvsGPX_shst", 1000, -50, 50, 100, -50, 50);
137  hPullGPXvsGPY_shst = new TH2F("PullGPXvsGPY_shst", "PullGPXvsGPY_shst", 1000, -50, 50, 100, -50, 50);
138  hPullGPXvsGPZ_shst = new TH2F("PullGPXvsGPZ_shst", "PullGPXvsGPZ_shst", 1000, -50, 50, 200, -100, 100);
139  hPullGPXvsGPr_shst = new TH2F("PullGPXvsGPr_shst", "PullGPXvsGPr_shst", 1000, -50, 50, 300, -150, 150);
140  hPullGPXvsGPeta_shst = new TH2F("PullGPXvsGPeta_shst", "PullGPXvsGPeta_shst", 1000, -50, 50, 50, -2.5, 2.5);
141  hPullGPXvsGPphi_shst = new TH2F("PullGPXvsGPphi_shst", "PullGPXvsGPphi_shst", 1000, -50, 50, 63, 0, 6.3);
142 
143  seedWithDelta = 0;
144  problems = 0;
145  no_sim_hit = 0;
146  no_layer = 0;
147  layer_not_found = 0;
148  det_not_found = 0;
149  chi2gt30 = 0;
150  chi2gt30delta = 0;
151  chi2gt30deltaSeed = 0;
152  chi2ls30 = 0;
154  no_component = 0;
155  only_one_component = 0;
156  matched_not_found = 0;
160  propagation = 0;
161  other = 0;
162  totchi2gt30 = 0;
163 }
164 
166  edm::LogVerbatim("CkfDebugger") << "\nEVENT #" << iEvent.id();
167 
169  iEvent, trackerHitAssociatorConfig_); //delete deleteHitAssociator() in TrackCandMaker.cc
170 
171  std::map<unsigned int, std::vector<PSimHit> >& theHitsMap = hitAssociator->SimHitMap;
172  idHitsMap.clear();
173 
174  for (std::map<unsigned int, std::vector<PSimHit> >::iterator it = theHitsMap.begin(); it != theHitsMap.end(); it++) {
175  for (std::vector<PSimHit>::iterator isim = it->second.begin(); isim != it->second.end(); ++isim) {
176  idHitsMap[isim->trackId()].push_back(&*isim);
177  }
178  }
179 
180  for (std::map<unsigned int, std::vector<PSimHit*> >::iterator it = idHitsMap.begin(); it != idHitsMap.end(); it++) {
181  sort(it->second.begin(), it->second.end(), [](auto* a, auto* b) { return a->timeOfFlight() < b->timeOfFlight(); });
182  for (std::vector<PSimHit*>::iterator isim = it->second.begin(); isim != it->second.end(); ++isim) {
183  const GeomDetUnit* detUnit = theTrackerGeom->idToDetUnit(DetId((*isim)->detUnitId()));
184  dumpSimHit(SimHit((*isim), detUnit));
185  }
186  }
187 }
188 
189 void CkfDebugger::dumpSimHit(const SimHit& hit) const {
190  GlobalPoint pos = hit.globalPosition();
191  edm::LogVerbatim("CkfDebugger") << "SimHit pos" << pos << " r=" << pos.perp() << " phi=" << pos.phi()
192  << " trackId=" << hit.trackId() << " particleType=" << hit.particleType()
193  << " pabs=" << hit.pabs() << " processType=" << hit.processType();
194 }
195 
197  const std::vector<TrajectoryMeasurement>& meas,
198  const MeasurementTrackerEvent* aMeasurementTracker,
199  const Propagator* propagator,
201  const TransientTrackingRecHitBuilder* aTTRHBuilder) {
202  LogTrace("CkfDebugger") << "\nnow in analyseCompatibleMeasurements";
203  LogTrace("CkfDebugger") << "number of input hits:" << meas.size();
204  for (std::vector<TrajectoryMeasurement>::const_iterator tmpIt = meas.begin(); tmpIt != meas.end(); tmpIt++) {
205  if (tmpIt->recHit()->isValid())
206  LogTrace("CkfDebugger") << "valid hit at position:" << tmpIt->recHit()->globalPosition();
207  }
209  theChi2 = estimator;
210  theMeasurementTracker = aMeasurementTracker;
211  theGeomSearchTracker = theMeasurementTracker->geometricSearchTracker();
212  theTTRHBuilder = aTTRHBuilder;
213  unsigned int trajId = 0;
214  if (!correctTrajectory(traj, trajId)) {
215  LogTrace("CkfDebugger") << "trajectory not correct";
216  return true;
217  } // only correct trajectories analysed
218  LogTrace("CkfDebugger") << "correct trajectory";
219 
220  if (traj.measurements().size() == 2) {
221  if (testSeed(traj.firstMeasurement().recHit(),
222  traj.lastMeasurement().recHit(),
223  traj.lastMeasurement().updatedState()) == -1) {
224  LogTrace("CkfDebugger") << "Seed has delta";
225  seedWithDelta++;
226  return false; //true;//false?
227  }
228  }
229 
230  //const PSimHit* correctHit = nextCorrectHit(traj, trajId);
231  //if ( correctHit == 0) return true; // no more simhits on this track
232  std::vector<const PSimHit*> correctHits = nextCorrectHits(traj, trajId);
233  if (correctHits.empty())
234  return true; // no more simhits on this track
235 
236  for (std::vector<const PSimHit*>::iterator corHit = correctHits.begin(); corHit != correctHits.end(); corHit++) {
237  for (std::vector<TM>::const_iterator i = meas.begin(); i != meas.end(); i++) {
238  if (correctMeas(*i, *corHit)) {
239  LogTrace("CkfDebugger") << "Correct hit found at position " << i - meas.begin();
240  return true;
241  }
242  }
243  }
244 
245  //debug why the first hit in correctHits is not found
246  //FIXME should loop over all hits
247  const PSimHit* correctHit = *(correctHits.begin());
248 
249  // correct hit not found
250  edm::LogVerbatim("CkfDebugger") << std::endl
251  << "CkfDebugger: problem found: correct hit not found by findCompatibleMeasurements";
252  edm::LogVerbatim("CkfDebugger") << "The correct hit position is " << position(correctHit) << " lp "
253  << correctHit->localPosition();
254  edm::LogVerbatim("CkfDebugger") << "The size of the meas vector is " << meas.size();
255  dump[0]++;
256  problems++;
257 
258  for (std::vector<TM>::const_iterator i = meas.begin(); i != meas.end(); i++) {
259  edm::LogVerbatim("CkfDebugger") << "Is the hit valid? " << i->recHit()->isValid();
260  if (i->recHit()->isValid()) {
261  edm::LogVerbatim("CkfDebugger") << "RecHit at " << i->recHit()->globalPosition() << " layer "
262  << ((i->recHit()->det()->geographicalId().rawId() >> 16) & 0xF) << " subdet "
263  << i->recHit()->det()->geographicalId().subdetId() << " Chi2 " << i->estimate();
264  } else if (i->recHit()->det() == nullptr) {
265  edm::LogVerbatim("CkfDebugger") << "Invalid RecHit returned with zero Det pointer";
266  } else if (i->recHit()->det() == det(correctHit)) {
267  edm::LogVerbatim("CkfDebugger") << "Invalid hit returned in correct Det";
268  } else {
269  edm::LogVerbatim("CkfDebugger") << "Invalid hit returned in Det at gpos " << i->recHit()->det()->position()
270  << " correct Det is at " << det(correctHit)->position();
271  }
272  }
273 
274  //Look if the correct RecHit exists
275  std::pair<CTTRHp, double> correctRecHit = analyseRecHitExistance(*correctHit, traj.lastMeasurement().updatedState());
276  if (correctRecHit.first == nullptr) {
277  //the hit does not exist or is uncorrectly matched
278  if (fabs(correctRecHit.second - 0) < 0.01) {
279  dump[1]++;
280  } //other
281  if (fabs(correctRecHit.second + 1) < 0.01) {
282  dump[8]++;
283  } //propagation
284  if (fabs(correctRecHit.second + 2) < 0.01) {
285  dump[9]++;
286  } //No component is found
287  if (fabs(correctRecHit.second + 3) < 0.01) {
288  dump[10]++;
289  } //Partner measurementDet not found
290  if (fabs(correctRecHit.second + 4) < 0.01) {
291  dump[11]++;
292  } //glued MeasurementDet not found
293  if (fabs(correctRecHit.second + 5) < 0.01) {
294  dump[12]++;
295  } //matched not found
296  if (fabs(correctRecHit.second + 6) < 0.01) {
297  dump[13]++;
298  } //Matched not associated
299  if (fabs(correctRecHit.second + 7) < 0.01) {
300  dump[14]++;
301  } //Only one component is found
302  if (fabs(correctRecHit.second + 8) < 0.01) {
303  dump[15]++;
304  } //not found (is not a glued det)
305  } else {
306  //the hit exists: why wasn't it found?
307  int result = analyseRecHitNotFound(traj, correctRecHit.first);
308  if (result == 5) {
309  if (correctRecHit.second > 30) {
310  edm::LogVerbatim("CkfDebugger") << "Outling RecHit at pos=" << correctRecHit.first->globalPosition()
311  << " from SimHit at pos=" << position(correctHit)
312  << " det=" << correctHit->detUnitId()
313  << " process=" << correctHit->processType();
314  if (hasDelta(correctHit)) {
315  edm::LogVerbatim("CkfDebugger") << "there are deltas on this det";
316  chi2gt30delta++;
317  dump5[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
318  (layer(correctRecHit.first->det())) - 1)]++;
319  } else {
320  edm::LogVerbatim("CkfDebugger") << "no deltas on this det";
321  dump[5]++;
322  chi2gt30++;
323  dump3[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
324  (layer(correctRecHit.first->det())) - 1)]++;
325  CTTRHp h1 = traj.measurements()[0].recHit();
326  CTTRHp h2 = traj.measurements()[1].recHit();
327  TSOS t = traj.measurements()[1].updatedState();
328  double chi2 = testSeed(h1, h2, t);
329  if (chi2 == -1) {
330  edm::LogVerbatim("CkfDebugger") << "there were deltas in the seed";
332  } else {
333  hchi2seedProb->Fill(chi2);
334  edm::LogVerbatim("CkfDebugger") << "no deltas in the seed. What is wrong?";
335 
337  correctRecHit.first->det()->surface());
338  TSOS simDetState =
340 
341  if (true /*detState.globalMomentum().y()>0*/) {
342  int subdetId = correctRecHit.first->det()->geographicalId().subdetId();
343  int layerId = layer(correctRecHit.first->det());
344 
345  LogTrace("CkfDebugger") << "position(correctHit)=" << position(correctHit);
346  LogTrace("CkfDebugger") << "correctRecHit.first->globalPosition()="
347  << correctRecHit.first->globalPosition();
348  LogTrace("CkfDebugger") << "detState.globalPosition()=" << detState.globalPosition();
349  LogTrace("CkfDebugger") << "simDetState.globalPosition()=" << simDetState.globalPosition();
350 
351  LogTrace("CkfDebugger") << "correctHit->localPosition()=" << correctHit->localPosition();
352  LogTrace("CkfDebugger") << "correctRecHit.first->localPosition()="
353  << correctRecHit.first->localPosition();
354  LogTrace("CkfDebugger") << "correctRecHit.first->localPositionError()="
355  << correctRecHit.first->localPositionError();
356  LogTrace("CkfDebugger") << "detState.localPosition()=" << detState.localPosition();
357  LogTrace("CkfDebugger") << "detState.localError().positionError()="
358  << detState.localError().positionError();
359  LogTrace("CkfDebugger") << "simDetState.localPosition()=" << simDetState.localPosition();
360  LogTrace("CkfDebugger") << "simDetState.localError().positionError()="
361  << simDetState.localError().positionError();
362  double pullx_shrh = (correctHit->localPosition().x() - correctRecHit.first->localPosition().x()) /
363  sqrt(correctRecHit.first->localPositionError().xx());
364  double pully_shrh = 0;
365  if (correctRecHit.first->localPositionError().yy() != 0)
366  pully_shrh = (correctHit->localPosition().y() - correctRecHit.first->localPosition().y()) /
367  sqrt(correctRecHit.first->localPositionError().yy());
368  double pullx_shst = (correctHit->localPosition().x() - simDetState.localPosition().x()) /
369  sqrt(simDetState.localError().positionError().xx());
370  double pully_shst = (correctHit->localPosition().y() - simDetState.localPosition().y()) /
371  sqrt(simDetState.localError().positionError().yy());
372 
373  LogTrace("CkfDebugger") << "pullx(sh-rh)=" << pullx_shrh;
374  LogTrace("CkfDebugger") << "pully(sh-rh)=" << pully_shrh;
375  LogTrace("CkfDebugger") << "pullx(sh-st)=" << pullx_shst;
376  LogTrace("CkfDebugger") << "pully(sh-st)=" << pully_shst;
377 
378  LogTrace("CkfDebugger") << "pullx(st-rh)="
379  << (detState.localPosition().x() - correctRecHit.first->localPosition().x()) /
380  sqrt(correctRecHit.first->localPositionError().xx() +
381  detState.localError().positionError().xx());
382 
383  std::pair<double, double> pulls = computePulls(correctRecHit.first, detState);
384  if (subdetId > 0 && subdetId < 7 && layerId > 0 && layerId < 10) {
385  stringstream title;
386  title.str("");
387  title << "pullX_" << subdetId << "-" << layerId << "_sh-rh";
388  hPullX_shrh[title.str()]->Fill(pullx_shrh);
389  title.str("");
390  title << "pullY_" << subdetId << "-" << layerId << "_sh-rh";
391  hPullY_shrh[title.str()]->Fill(pully_shrh);
392  title.str("");
393  title << "pullX_" << subdetId << "-" << layerId << "_sh-st";
394  hPullX_shst[title.str()]->Fill(pullx_shst);
395  title.str("");
396  title << "pullY_" << subdetId << "-" << layerId << "_sh-st";
397  hPullY_shst[title.str()]->Fill(pully_shst);
398  title.str("");
399  title << "pullX_" << subdetId << "-" << layerId << "_st-rh";
400  hPullX_strh[title.str()]->Fill(pulls.first);
401  title.str("");
402  title << "pullY_" << subdetId << "-" << layerId << "_st-rh";
403  hPullY_strh[title.str()]->Fill(pulls.second);
404 
405  GlobalPoint shGPos = position(correctHit);
406  GlobalPoint stGPos = simDetState.globalPosition();
407  GlobalError stGPosErr = simDetState.cartesianError().position();
408  double pullGPx = (shGPos.x() - stGPos.x()) / sqrt(stGPosErr.cxx());
409  title.str("");
410  title << "PullGP_X_" << subdetId << "-" << layerId << "_sh-st";
411  hPullGP_X_shst[title.str()]->Fill(pullGPx);
412  title.str("");
413  title << "PullGP_Y_" << subdetId << "-" << layerId << "_sh-st";
414  hPullGP_Y_shst[title.str()]->Fill((shGPos.y() - stGPos.y()) / sqrt(stGPosErr.cyy()));
415  title.str("");
416  title << "PullGP_Z_" << subdetId << "-" << layerId << "_sh-st";
417  hPullGP_Z_shst[title.str()]->Fill((shGPos.z() - stGPos.z()) / sqrt(stGPosErr.czz()));
418 
419  if (subdetId == 3 && layerId == 1) {
420  hPullGPXvsGPX_shst->Fill(pullGPx, shGPos.x());
421  hPullGPXvsGPY_shst->Fill(pullGPx, shGPos.y());
422  hPullGPXvsGPZ_shst->Fill(pullGPx, shGPos.z());
423  hPullGPXvsGPr_shst->Fill(pullGPx, shGPos.mag());
424  hPullGPXvsGPeta_shst->Fill(pullGPx, shGPos.eta());
425  hPullGPXvsGPphi_shst->Fill(pullGPx, shGPos.phi());
426  }
427  if (dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())) {
428  LogTrace("CkfDebugger") << "MONO HIT";
429  auto m = dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())->monoHit();
430  CTTRHp tMonoHit = theTTRHBuilder->build(&m);
431  const PSimHit sMonoHit = *(hitAssociator->associateHit(*tMonoHit->hit()).begin());
433  tMonoHit->det()->surface());
434  double pullM_shrh = (sMonoHit.localPosition().x() - tMonoHit->localPosition().x()) /
435  sqrt(tMonoHit->localPositionError().xx());
436  double pullM_shst = (sMonoHit.localPosition().x() - monoState.localPosition().x()) /
437  sqrt(monoState.localError().positionError().xx());
438  std::pair<double, double> pullsMono = computePulls(tMonoHit, monoState);
439  title.str("");
440  title << "pullM_" << subdetId << "-" << layerId << "_sh-rh";
441  hPullM_shrh[title.str()]->Fill(pullM_shrh);
442  title.str("");
443  title << "pullM_" << subdetId << "-" << layerId << "_sh-st";
444  hPullM_shst[title.str()]->Fill(pullM_shst);
445  title.str("");
446  title << "pullM_" << subdetId << "-" << layerId << "_st-rh";
447  hPullM_strh[title.str()]->Fill(pullsMono.first);
448 
449  LogTrace("CkfDebugger") << "STEREO HIT";
450  auto s = dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())->stereoHit();
451  CTTRHp tStereoHit = theTTRHBuilder->build(&s);
452  const PSimHit sStereoHit = *(hitAssociator->associateHit(*tStereoHit->hit()).begin());
454  tStereoHit->det()->surface());
455  double pullS_shrh = (sStereoHit.localPosition().x() - tStereoHit->localPosition().x()) /
456  sqrt(tStereoHit->localPositionError().xx());
457  double pullS_shst = (sStereoHit.localPosition().x() - stereoState.localPosition().x()) /
458  sqrt(stereoState.localError().positionError().xx());
459  std::pair<double, double> pullsStereo = computePulls(tStereoHit, stereoState);
460  title.str("");
461  title << "pullS_" << subdetId << "-" << layerId << "_sh-rh";
462  hPullS_shrh[title.str()]->Fill(pullS_shrh);
463  title.str("");
464  title << "pullS_" << subdetId << "-" << layerId << "_sh-st";
465  hPullS_shst[title.str()]->Fill(pullS_shst);
466  title.str("");
467  title << "pullS_" << subdetId << "-" << layerId << "_st-rh";
468  hPullS_strh[title.str()]->Fill(pullsStereo.first);
469  }
470  } else
471  edm::LogVerbatim("CkfDebugger")
472  << "unexpected result: wrong det or layer id " << subdetId << " " << layerId << " "
473  << correctRecHit.first->det()->geographicalId().rawId();
474  }
475  }
476  }
477  } else {
478  edm::LogVerbatim("CkfDebugger") << "unexpected result " << correctRecHit.second;
479  dump[6]++;
480  chi2ls30++;
481  }
482  } else
483  dump[result]++;
484  if (result == 3) {
485  dump2[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
486  (layer(correctRecHit.first->det())) - 1)]++;
487  }
488  if (result == 4) {
489  dump4[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
490  (layer(correctRecHit.first->det())) - 1)]++;
491  }
492  if (correctRecHit.second > 30) {
493  dump[7]++;
494  totchi2gt30++;
495  }
496  }
497  return false;
498 }
499 
500 bool CkfDebugger::correctTrajectory(const Trajectory& traj, unsigned int& trajId) const {
501  LogTrace("CkfDebugger") << "now in correctTrajectory";
503 
504  std::vector<SimHitIdpr> currentTrackId = hitAssociator->associateHitId(*hits.front()->hit());
505  if (currentTrackId.empty())
506  return false;
507 
508  for (Trajectory::RecHitContainer::const_iterator rh = hits.begin(); rh != hits.end(); ++rh) {
509  //if invalid hit exit
510  if (!(*rh)->hit()->isValid()) {
511  //LogTrace("CkfDebugger") << "invalid hit" ;
512  return false;
513  }
514 
515  //if hits from deltas exit
516  bool nogoodhit = true;
517  std::vector<PSimHit> assSimHits = hitAssociator->associateHit(*(*rh)->hit());
518  for (std::vector<PSimHit>::iterator shit = assSimHits.begin(); shit != assSimHits.end(); shit++) {
519  if (goodSimHit(*shit))
520  nogoodhit = false;
521  }
522  if (nogoodhit)
523  return false;
524 
525  //all hits must be associated to the same sim track
526  bool test = true;
527  std::vector<SimHitIdpr> nextTrackId = hitAssociator->associateHitId(*(*rh)->hit());
528  for (std::vector<SimHitIdpr>::iterator i = currentTrackId.begin(); i != currentTrackId.end(); i++) {
529  for (std::vector<SimHitIdpr>::iterator j = nextTrackId.begin(); j != nextTrackId.end(); j++) {
530  if (i->first == j->first)
531  test = false;
532  //LogTrace("CkfDebugger") << "valid " << *i << " " << *j ;
533  trajId = j->first;
534  }
535  }
536  if (test) { /*LogTrace("CkfDebugger") << "returning false" ;*/
537  return false;
538  }
539  // std::vector<PSimHit*> simTrackHits = idHitsMap[trajId];
540  // if (!goodSimHit(simTrackHits.))
541  }
542  //LogTrace("CkfDebugger") << "returning true" ;
543  return true;
544 }
545 
547  LogTrace("CkfDebugger") << "now in assocTrackId";
548 
549  if (!rechit->hit()->isValid()) {
550  return -1;
551  }
552 
553  std::vector<SimHitIdpr> ids = hitAssociator->associateHitId(*rechit->hit());
554  if (!ids.empty()) {
555  return ids[0].first; //FIXME if size>1!!
556  } else {
557  return -1;
558  }
559 }
560 
561 vector<const PSimHit*> CkfDebugger::nextCorrectHits(const Trajectory& traj, unsigned int& trajId) {
562  std::vector<const PSimHit*> result;
563  // find the component of the RecHit at largest distance from origin (FIXME: should depend on propagation direction)
564  LogTrace("CkfDebugger") << "now in nextCorrectHits";
566  TransientTrackingRecHit::RecHitContainer comp = lastRecHit->transientHits();
567  if (!comp.empty()) {
568  float maxR = 0;
569  for (TransientTrackingRecHit::RecHitContainer::const_iterator ch = comp.begin(); ch != comp.end(); ++ch) {
570  if ((*ch)->globalPosition().mag() > maxR)
571  lastRecHit = *ch;
572  maxR = (*ch)->globalPosition().mag();
573  }
574  }
575  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: lastRecHit is at gpos " << lastRecHit->globalPosition() << " layer "
576  << layer((lastRecHit->det())) << " subdet "
577  << lastRecHit->det()->geographicalId().subdetId();
578 
579  //find the simHits associated to the recHit
580  const std::vector<PSimHit>& pSimHitVec = hitAssociator->associateHit(*lastRecHit->hit());
581  for (std::vector<PSimHit>::const_iterator shit = pSimHitVec.begin(); shit != pSimHitVec.end(); shit++) {
582  const GeomDetUnit* detUnit = theTrackerGeom->idToDetUnit(DetId(shit->detUnitId()));
583  LogTrace("CkfDebugger") << "from hitAssociator SimHits are at GP=" << detUnit->toGlobal(shit->localPosition())
584  << " traId=" << shit->trackId() << " particleType " << shit->particleType()
585  << " pabs=" << shit->pabs() << " detUnitId=" << shit->detUnitId() << " layer "
586  << layer((det(&*shit))) << " subdet " << det(&*shit)->geographicalId().subdetId();
587  }
588 
589  //choose the simHit from the same track that has the highest tof
590  const PSimHit* lastPSH = nullptr;
591  if (!pSimHitVec.empty()) {
592  float maxTOF = 0;
593  for (std::vector<PSimHit>::const_iterator ch = pSimHitVec.begin(); ch != pSimHitVec.end(); ++ch) {
594  if ((ch->trackId() == trajId) && (ch->timeOfFlight() > maxTOF) && (goodSimHit(*ch))) {
595  lastPSH = &*ch;
596  maxTOF = lastPSH->timeOfFlight();
597  }
598  }
599  } else
600  return result; //return empty vector: no more hits on the sim track
601  if (lastPSH == nullptr)
602  return result; //return empty vector: no more good hits on the sim track
603  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: corresponding SimHit is at gpos " << position(&*lastPSH);
604 
605  //take the simHits on the simTrack that are in the nextLayer (could be > 1 if overlap or matched)
606  std::vector<PSimHit*> trackHits = idHitsMap[trajId];
607  if (fabs((double)(trackHits.back()->detUnitId() - lastPSH->detUnitId())) < 1)
608  return result; //end of sim track
609  std::vector<PSimHit*>::iterator currentIt = trackHits.end();
610  for (std::vector<PSimHit*>::iterator it = trackHits.begin(); it != trackHits.end(); it++) {
611  if (goodSimHit(**it) && //good hit
612  (lastPSH->timeOfFlight() < (*it)->timeOfFlight()) && //greater tof
613  //( fabs((double)((*it)->detUnitId()-(lastPSH->detUnitId()) ))>1) && //not components of the same matched hit
614  ((det(lastPSH)->geographicalId().subdetId() != det(*it)->geographicalId().subdetId()) ||
615  (layer(det(lastPSH)) != layer(det(*it)))) //change layer or detector(tib,tob,...)
616  ) {
617  edm::LogVerbatim("CkfDebugger") << "Next good PSimHit is at gpos " << position(*it);
618  result.push_back(*it);
619  currentIt = it;
620  break;
621  }
622  }
623  bool samelayer = true;
624  if (currentIt != (trackHits.end() - 1) && currentIt != trackHits.end()) {
625  for (std::vector<PSimHit*>::iterator nextIt = currentIt; (samelayer && nextIt != trackHits.end()); nextIt++) {
626  if (goodSimHit(**nextIt)) {
627  if ((det(*nextIt)->geographicalId().subdetId() == det(*currentIt)->geographicalId().subdetId()) &&
628  (layer(det(*nextIt)) == layer(det(*currentIt)))) {
629  result.push_back(*nextIt);
630  } else
631  samelayer = false;
632  }
633  }
634  }
635 
636  return result;
637 }
638 
639 bool CkfDebugger::goodSimHit(const PSimHit& sh) const {
640  if (sh.pabs() > 0.9)
641  return true; // GeV, reject delta rays from association
642  else
643  return false;
644 }
645 
646 bool CkfDebugger::associated(CTTRHp rechit, const PSimHit& pSimHit) const {
647  LogTrace("CkfDebugger") << "now in associated";
648 
649  if (!rechit->isValid())
650  return false;
651  // LogTrace("CkfDebugger") << "rec hit valid" ;
652  const std::vector<PSimHit>& pSimHitVec = hitAssociator->associateHit(*rechit->hit());
653  // LogTrace("CkfDebugger") << "size=" << pSimHitVec.size() ;
654  for (std::vector<PSimHit>::const_iterator shit = pSimHitVec.begin(); shit != pSimHitVec.end(); shit++) {
655  //const GeomDetUnit* detUnit = theTrackerGeom->idToDetUnit( DetId(shit->detUnitId()));
656  // LogTrace("CkfDebugger") << "pSimHit.timeOfFlight()=" << pSimHit.timeOfFlight()
657  // << " pSimHit.pabs()=" << pSimHit.pabs() << " GP=" << position(&pSimHit);
658  // LogTrace("CkfDebugger") << "(*shit).timeOfFlight()=" << (*shit).timeOfFlight()
659  // << " (*shit).pabs()=" << (*shit).pabs() << " GP=" << detUnit->toGlobal( shit->localPosition());
660  if ((fabs((*shit).timeOfFlight() - pSimHit.timeOfFlight()) < 1e-9) &&
661  (fabs((*shit).pabs() - pSimHit.pabs()) < 1e-9))
662  return true;
663  }
664  return false;
665 }
666 
667 bool CkfDebugger::correctMeas(const TM& tm, const PSimHit* correctHit) const {
668  LogTrace("CkfDebugger") << "now in correctMeas";
669  const CTTRHp& recHit = tm.recHit();
670  if (recHit->isValid())
671  LogTrace("CkfDebugger") << "hit at position:" << recHit->globalPosition();
673  if (comp.empty()) {
674  // LogTrace("CkfDebugger") << "comp.empty()==true" ;
675  return associated(recHit, *correctHit);
676  } else {
677  for (TransientTrackingRecHit::RecHitContainer::const_iterator ch = comp.begin(); ch != comp.end(); ++ch) {
678  if (associated(recHit, *correctHit)) {
679  // check if the other components are associated to the same trackId
680  for (TransientTrackingRecHit::RecHitContainer::const_iterator ch2 = comp.begin(); ch2 != comp.end(); ++ch2) {
681  if (ch2 == ch)
682  continue;
684  // LogTrace("CkfDebugger") << "correctHit->trackId()=" << correctHit->trackId() ;
685  bool test = true;
686  std::vector<SimHitIdpr> ids = hitAssociator->associateHitId(*(*ch2)->hit());
687  for (std::vector<SimHitIdpr>::iterator j = ids.begin(); j != ids.end(); j++) {
688  // LogTrace("CkfDebugger") << "j=" <<j->first;
689  if (correctHit->trackId() == j->first) {
690  test = false;
691  // LogTrace("CkfDebugger") << correctHit->trackId()<< " " <<j->first;
692  }
693  }
694  if (assocTrackId(*ch2) != ((int)(correctHit->trackId()))) {
695  LogTrace("CkfDebugger") << "returning false 1"; /*return false;*/
696  } //fixme
697  if (test) {
698  // LogTrace("CkfDebugger") << "returning false 2" ;
699  return false; // not all components from same simtrack
700  }
701  // if (assocTrackId( **ch2) != ((int)( correctHit->trackId())) ) {
702  // return false; // not all components from same simtrack
703  // }
704  }
705  return true; // if all components from same simtrack
706  }
707  }
708  return false;
709  }
710 }
711 
712 //this checks only if there is the rechit on the det where the sim hit is
713 pair<CTTRHp, double> CkfDebugger::analyseRecHitExistance(const PSimHit& sh, const TSOS& startingState) {
714  LogTrace("CkfDebugger") << "now in analyseRecHitExistance";
715 
716 #if 0
717  std::pair<CTTRHp, double> result;
718 
719  const MeasurementDet* simHitDet = theMeasurementTracker->idToDet( DetId( sh.detUnitId()));
720  TSOS simHitState = TSOSFromSimHitFactory()(sh, *det(&sh), *theMagField);
721  MeasurementDet::RecHitContainer recHits = simHitDet->recHits( simHitState);//take all hits from det
722 
723  //check if the hit is not present or is a problem of association
724  TSOS firstDetState = theForwardPropagator->propagate( startingState, det(&sh)->surface());
725  if (!firstDetState.isValid()) {
726  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: propagation failed from state " << startingState << " to first det surface "
727  << position(&sh) ;
728  propagation++;
729  return std::pair<CTTRHp, double>((CTTRHp)(0),-1);
730  }
731 
732  bool found = false;
733  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
734  if ( associated( *rh, sh)) {
735  found = true;
736  result = std::pair<CTTRHp, double>(*rh,theChi2->estimate( firstDetState, **rh).second);
737  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
738  << (**rh).localPosition()
739  << " gpos " << (**rh).globalPosition()
740  << " layer " << layer((**rh).det())
741  << " subdet " << (**rh).det()->geographicalId().subdetId()
742  << " Chi2 " << theChi2->estimate( firstDetState, **rh).second;
743  }
744  }
745  if (!found) {
746  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: there is no RecHit associated to the correct SimHit." ;
747  edm::LogVerbatim("CkfDebugger") << " There are " << recHits.size() << " RecHits in the simHit DetUnit" ;
748  edm::LogVerbatim("CkfDebugger") << "SH GP=" << position(&sh) << " subdet=" << det(&sh)->geographicalId().subdetId()
749  << " layer=" << layer(det(&sh)) ;
750  int y=0;
751  for (MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++)
752  edm::LogVerbatim("CkfDebugger") << "RH#" << y++ << " GP=" << (**rh).globalPosition() << " subdet=" << (**rh).det()->geographicalId().subdetId()
753  << " layer=" << layer((**rh).det()) ;
754  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
755  edm::LogVerbatim("CkfDebugger") << "Non-associated RecHit at pos " << (**rh).localPosition() ;
756  }
757  }
758 
759  bool found2 = false;
760  const PSimHit* sh2;
761  StripSubdetector subdet( det(&sh)->geographicalId());
762  if (!subdet.glued()) {
763  edm::LogVerbatim("CkfDebugger") << "The DetUnit is not part of a GluedDet" ;
764  if (found) {
765  if (result.second>30){
766  LogTrace("CkfDebugger") << "rh->parameters()=" << result.first->parameters() ;
767  LogTrace("CkfDebugger") << "rh->parametersError()=" << result.first->parametersError() ;
768  MeasurementExtractor me(firstDetState);
769  AlgebraicVector r(result.first->parameters() - me.measuredParameters(*result.first));
770  LogTrace("CkfDebugger") << "me.measuredParameters(**rh)=" << me.measuredParameters(*result.first) ;
771  LogTrace("CkfDebugger") << "me.measuredError(**rh)=" << me.measuredError(*result.first) ;
772  AlgebraicSymMatrix R(result.first->parametersError() + me.measuredError(*result.first));
773  LogTrace("CkfDebugger") << "r=" << r ;
774  LogTrace("CkfDebugger") << "R=" << R ;
775  int ierr;
776  R.invert(ierr);
777  LogTrace("CkfDebugger") << "R(-1)=" << R ;
778  LogTrace("CkfDebugger") << "chi2=" << R.similarity(r) ;
779  }
780  return result;
781  }
782  else {
784  return std::pair<CTTRHp, double>((CTTRHp)(0),-8);//not found (is not a glued det)
785  }
786  } else {
787  edm::LogVerbatim("CkfDebugger") << "The DetUnit is part of a GluedDet" ;
788  DetId partnerDetId = DetId( subdet.partnerDetId());
789 
790  sh2 = pSimHit( sh.trackId(), partnerDetId);
791  if (sh2 == 0) {
792  edm::LogVerbatim("CkfDebugger") << "Partner DetUnit does not have a SimHit from the same track" ;
793  if (found) {
794  //projected rec hit
795  TrackingRecHitProjector<ProjectedRecHit2D> proj;
796  DetId gid = gluedId( subdet);
797  const MeasurementDet* gluedDet = theMeasurementTracker->idToDet( gid);
798  TSOS gluedTSOS = theForwardPropagator->propagate(startingState, gluedDet->geomDet().surface());
799  CTTRHp projHit = proj.project( *result.first,gluedDet->geomDet(),gluedTSOS).get();
800  //LogTrace("CkfDebugger") << proj.project( *result.first,gluedDet->geomDet(),gluedTSOS)->parameters() ;
801  //LogTrace("CkfDebugger") << projHit->parametersError() ;
802  double chi2 = theChi2->estimate(gluedTSOS, *proj.project( *result.first,gluedDet->geomDet(),gluedTSOS)).second;
803  return std::pair<CTTRHp, double>(projHit,chi2);
804  }
805  }
806  else {
807  edm::LogVerbatim("CkfDebugger") << "Partner DetUnit has a good SimHit at gpos " << position(sh2)
808  << " lpos " << sh2->localPosition() ;
809  //}
810 
811  const MeasurementDet* partnerDet = theMeasurementTracker->idToDet( partnerDetId);
812  if (partnerDet == 0) {
813  edm::LogVerbatim("CkfDebugger") << "Partner measurementDet not found!!!" ;
815  return std::pair<CTTRHp, double>((CTTRHp)(0),-3);
816  }
817  TSOS simHitState2 = TSOSFromSimHitFactory()(*sh2, *det(sh2), *theMagField);
818  MeasurementDet::RecHitContainer recHits2 = partnerDet->recHits( simHitState2);
819 
820  TSOS secondDetState = theForwardPropagator->propagate( startingState, det(sh2)->surface());
821  if (!secondDetState.isValid()) {
822  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: propagation failed from state " << startingState << " to second det surface "
823  << position(sh2) ;
824  propagation++;
825  return std::pair<CTTRHp, double>((CTTRHp)(0),-1);
826  }
827 
828  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits2.begin(); rh != recHits2.end(); rh++) {
829  if ( associated( *rh, *sh2)) {
830  found2 = true;
831  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
832  << (**rh).localPosition()
833  << " gpos " << (**rh).globalPosition()
834  << " Chi2 " << theChi2->estimate( secondDetState, **rh).second
835  ;
836  }
837  }
838  if (!found2) {
839  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: there is no RecHit associated to the correct SimHit." ;
840  LogTrace("CkfDebugger") << " There are " << recHits.size() << " RecHits in the simHit DetUnit" ;
841  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
842  LogTrace("CkfDebugger") << "Non-associated RecHit at pos " << (**rh).localPosition() ;
843  }
844  }
845  }
846  }
847 
849  if (found && found2) {
850  // look in the glued det
851  DetId gid = gluedId( subdet);
852  const MeasurementDet* gluedDet = theMeasurementTracker->idToDet( gid);
853  if ( gluedDet == 0) {
854  edm::LogVerbatim("CkfDebugger") << "CkfDebugger ERROR: glued MeasurementDet not found!" ;
856  return std::pair<CTTRHp, double>((CTTRHp)(0),-4);
857  }
858 
859  TSOS gluedDetState = theForwardPropagator->propagate( startingState, gluedDet->surface());
860  if (!gluedDetState.isValid()) {
861  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: propagation failed from state " << startingState << " to det surface "
862  << gluedDet->position() ;
863  propagation++;
864  return std::pair<CTTRHp, double>((CTTRHp)(0),-1);
865  }
866 
867  gluedHits = gluedDet->recHits( gluedDetState);
868  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: the GluedDet returned " << gluedHits.size() << " hits" ;
869  if (gluedHits.size()==0){
870  edm::LogVerbatim("CkfDebugger") << "Found and associated mono and stereo recHits but not matched!!!" ;
872  return std::pair<CTTRHp, double>((CTTRHp)(0),-5);
873  }
874  bool found3 = false;
875  for ( MeasurementDet::RecHitContainer::const_iterator rh = gluedHits.begin(); rh != gluedHits.end(); rh++) {
876  if ( associated( *rh, sh) && associated( *rh, *sh2)) {
877  double chi2 = theChi2->estimate(gluedDetState, **rh).second;
878  edm::LogVerbatim("CkfDebugger") << "Matched hit at lpos " << (**rh).localPosition()
879  << " gpos " << (**rh).globalPosition()
880  << " has Chi2 " << chi2
881  ;
882  result = std::pair<CTTRHp, double>(&**rh,chi2);
883  found3 = true;
884  if (chi2>30){
885  LogTrace("CkfDebugger") << "rh->parameters()=" << (*rh)->parameters() ;
886  LogTrace("CkfDebugger") << "rh->parametersError()=" << (*rh)->parametersError() ;
887  MeasurementExtractor me(gluedDetState);
888  AlgebraicVector r((*rh)->parameters() - me.measuredParameters(**rh));
889  LogTrace("CkfDebugger") << "me.measuredParameters(**rh)=" << me.measuredParameters(**rh) ;
890  LogTrace("CkfDebugger") << "me.measuredError(**rh)=" << me.measuredError(**rh) ;
891  AlgebraicSymMatrix R((*rh)->parametersError() + me.measuredError(**rh));
892  LogTrace("CkfDebugger") << "r=" << r ;
893  LogTrace("CkfDebugger") << "R=" << R ;
894  int ierr;
895  R.invert(ierr);
896  LogTrace("CkfDebugger") << "R(-1)=" << R ;
897  LogTrace("CkfDebugger") << "chi2=" << R.similarity(r) ;
898  }
899  break;
900  }
901  }
902  if (found3) return result;
903  else {
904  edm::LogVerbatim("CkfDebugger") << "Found and associated mono and stereo recHits. Matched found but not associated!!!" ;
906  return std::pair<CTTRHp, double>((CTTRHp)(0),-6);
907  }
908  }
909  else if ( (found && !found2) || (!found && found2) ) {
910  edm::LogVerbatim("CkfDebugger") << "Only one component is found" ;
912  return std::pair<CTTRHp, double>((CTTRHp)(0),-7);
913  }
914  else {
915  edm::LogVerbatim("CkfDebugger") << "No component is found" ;
916  no_component++;
917  return std::pair<CTTRHp, double>((CTTRHp)(0),-2);
918  }
919  other++;
920 #endif
921  return std::pair<CTTRHp, double>((CTTRHp)(nullptr), 0); //other
922 }
923 
924 const PSimHit* CkfDebugger::pSimHit(unsigned int tkId, DetId detId) {
925  for (std::vector<PSimHit*>::iterator shi = idHitsMap[tkId].begin(); shi != idHitsMap[tkId].end(); ++shi) {
926  if ((*shi)->detUnitId() == detId.rawId() &&
927  //(shi)->trackId() == tkId &&
928  goodSimHit(**shi)) {
929  return (*shi);
930  }
931  }
932  return nullptr;
933 }
934 
935 int CkfDebugger::analyseRecHitNotFound(const Trajectory& traj, CTTRHp correctRecHit) {
936  unsigned int correctDetId = correctRecHit->det()->geographicalId().rawId();
937  int correctLayId = layer(correctRecHit->det());
938  LogTrace("CkfDebugger") << "correct layer id=" << correctLayId;
939 
940  TSOS currentState(traj.lastMeasurement().updatedState());
941  std::vector<const DetLayer*> nl =
942  theNavSchool->nextLayers(*traj.lastLayer(), *currentState.freeState(), traj.direction());
943  if (nl.empty()) {
944  edm::LogVerbatim("CkfDebugger") << "no compatible layers";
945  no_layer++;
946  return 2;
947  }
948 
949  TkLayerLess lless; //FIXME - was lless(traj.direction())
950  const DetLayer* detLayer = nullptr;
951  bool navLayerAfter = false;
952  bool test = false;
953  for (std::vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
954  if (dynamic_cast<const BarrelDetLayer*>(*il)) {
955  const BarrelDetLayer* pbl = dynamic_cast<const BarrelDetLayer*>(*il);
956  LogTrace("CkfDebugger") << "pbl->specificSurface().bounds().length()="
957  << pbl->specificSurface().bounds().length();
958  LogTrace("CkfDebugger") << "pbl->specificSurface().bounds().width()=" << pbl->specificSurface().bounds().width();
959  }
960  int layId = layer(((*(*il)->basicComponents().begin())));
961  LogTrace("CkfDebugger") << " subdet=" << (*(*il)->basicComponents().begin())->geographicalId().subdetId()
962  << "layer id=" << layId;
963  if (layId == correctLayId) {
964  test = true;
965  detLayer = &**il;
966  break;
967  }
968  if (lless(*il, theGeomSearchTracker->detLayer(correctRecHit->det()->geographicalId())))
969  navLayerAfter = true; //it is enough that only one layer is after the correct one?
970  }
971 
972  if (test) {
973  edm::LogVerbatim("CkfDebugger") << "correct layer taken into account. layer id: " << correctLayId;
974  } else if (navLayerAfter) {
975  edm::LogVerbatim("CkfDebugger") << "SimHit layer after the layers returned by Navigation.";
976  edm::LogVerbatim("CkfDebugger") << "Probably a missing SimHit.";
977  edm::LogVerbatim("CkfDebugger") << "check: " << (correctRecHit->det()->geographicalId().subdetId()) << " "
978  << (layer(correctRecHit->det()));
979  dump6[pair<int, int>((correctRecHit->det()->geographicalId().subdetId() - 1), (layer(correctRecHit->det())) - 1)]++;
980  no_sim_hit++;
981  return 16;
982  } else {
983  edm::LogVerbatim("CkfDebugger") << "correct layer NOT taken into account. correct layer id: " << correctLayId;
984  layer_not_found++;
985  return 3;
986  }
987 
989  std::vector<DetWithState> compatDets = detLayer->compatibleDets(currentState, *theForwardPropagator, *theChi2);
990  // LogTrace("CkfDebugger") << "DEBUGGER" ;
991  // LogTrace("CkfDebugger") << "runned compatDets." ;
992  // LogTrace("CkfDebugger") << "started from the following TSOS:" ;
993  // LogTrace("CkfDebugger") << currentState ;
994  // LogTrace("CkfDebugger") << "number of dets found=" << compatDets.size() ;
995  // for (std::vector<DetWithState>::iterator det=compatDets.begin();det!=compatDets.end();det++){
996  // unsigned int detId = det->first->geographicalId().rawId();
997  // LogTrace("CkfDebugger") << "detId=" << detId ;
998  // }
999  bool test2 = false;
1000  for (std::vector<DetWithState>::iterator det = compatDets.begin(); det != compatDets.end(); det++) {
1001  unsigned int detId = det->first->geographicalId().rawId();
1002  // LogTrace("CkfDebugger") << "detId=" << detId
1003  // << "\ncorrectRecHit->det()->geographicalId().rawId()=" << correctRecHit->det()->geographicalId().rawId()
1004  // << "\ngluedId(correctRecHit->det()->geographicalId()).rawId()=" << gluedId(correctRecHit->det()->geographicalId()).rawId()
1005  // ;
1006  if (detId == gluedId(correctRecHit->det()->geographicalId()).rawId()) {
1007  test2 = true;
1008  break;
1009  }
1010  }
1011 
1012  if (test2) {
1013  edm::LogVerbatim("CkfDebugger") << "correct det taken into account. correctDetId is: " << correctDetId
1014  << ". please check chi2.";
1015  return 5;
1016  } else {
1017  edm::LogVerbatim("CkfDebugger") << "correct det NOT taken into account. correctDetId: " << correctDetId;
1018  det_not_found++;
1019  return 4;
1020  }
1021 }
1022 
1023 double CkfDebugger::testSeed(CTTRHp recHit1, CTTRHp recHit2, TSOS state) {
1024  //edm::LogVerbatim("CkfDebugger") << "CkfDebugger::testSeed";
1025  //test Deltas
1026  const std::vector<PSimHit>& pSimHitVec1 = hitAssociator->associateHit(*recHit1->hit());
1027  const std::vector<PSimHit>& pSimHitVec2 = hitAssociator->associateHit(*recHit2->hit());
1028 
1029  if (pSimHitVec1.empty() || pSimHitVec2.empty() || hasDelta(&(*pSimHitVec1.begin())) ||
1030  hasDelta(&(*pSimHitVec2.begin()))) {
1031  edm::LogVerbatim("CkfDebugger") << "Seed has delta or problems";
1032  return -1;
1033  }
1034 
1035  // LogTrace("CkfDebugger") << "state=\n" << state ;
1036  // double stlp1 = state.localParameters().vector()[0];
1037  // double stlp2 = state.localParameters().vector()[1];
1038  // double stlp3 = state.localParameters().vector()[2];
1039  // double stlp4 = state.localParameters().vector()[3];
1040  // double stlp5 = state.localParameters().vector()[4];
1041 
1042  if (!pSimHitVec2.empty()) {
1043  const PSimHit& simHit = *pSimHitVec2.begin();
1044 
1045  double shlp1 = -1 / simHit.momentumAtEntry().mag();
1046  double shlp2 = simHit.momentumAtEntry().x() / simHit.momentumAtEntry().z();
1047  double shlp3 = simHit.momentumAtEntry().y() / simHit.momentumAtEntry().z();
1048  double shlp4 = simHit.localPosition().x();
1049  double shlp5 = simHit.localPosition().y();
1051  v[0] = shlp1;
1052  v[1] = shlp2;
1053  v[2] = shlp3;
1054  v[3] = shlp4;
1055  v[4] = shlp5;
1056 
1057  // LogTrace("CkfDebugger") << "simHit.localPosition()=" << simHit.localPosition() ;
1058  // LogTrace("CkfDebugger") << "simHit.momentumAtEntry()=" << simHit.momentumAtEntry() ;
1059  // LogTrace("CkfDebugger") << "recHit2->localPosition()=" << recHit2->localPosition() ;
1060  // LogTrace("CkfDebugger") << "recHit2->localPositionError()=" << recHit2->localPositionError() ;
1061  // LogTrace("CkfDebugger") << "state.localPosition()=" << state.localPosition() ;
1062  // LogTrace("CkfDebugger") << "state.localError().positionError()=" << state.localError().positionError() ;
1063 
1064  // LogTrace("CkfDebugger") << "pullx(sh-rh)=" << (simHit.localPosition().x()-recHit2->localPosition().x())/sqrt(recHit2->localPositionError().xx()) ;
1065  // LogTrace("CkfDebugger") << "pullx(sh-st)=" << (simHit.localPosition().x()-state.localPosition().x())/sqrt(state.localError().positionError().xx()) ;
1066  // LogTrace("CkfDebugger") << "pullx(st-rh)=" << (state.localPosition().x()-recHit2->localPosition().x())/
1067  // sqrt(recHit2->localPositionError().xx()+state.localError().positionError().xx()) ;
1068 
1069  // LogTrace("CkfDebugger") << "local parameters" ;
1070  // LogTrace("CkfDebugger") << left;
1071  // LogTrace("CkfDebugger") << setw(15) << stlp1 << setw(15) << shlp1 << setw(15) << sqrt(state.localError().matrix()[0][0])
1072  // << setw(15) << (stlp1-shlp1)/stlp1 << setw(15) << (stlp1-shlp1)/sqrt(state.localError().matrix()[0][0]) ;
1073  // LogTrace("CkfDebugger") << setw(15) << stlp2 << setw(15) << shlp2 << setw(15) << sqrt(state.localError().matrix()[1][1])
1074  // << setw(15) << (stlp2-shlp2)/stlp2 << setw(15) << (stlp2-shlp2)/sqrt(state.localError().matrix()[1][1]) ;
1075  // LogTrace("CkfDebugger") << setw(15) << stlp3 << setw(15) << shlp3 << setw(15) << sqrt(state.localError().matrix()[2][2])
1076  // << setw(15) << (stlp3-shlp3)/stlp3 << setw(15) << (stlp3-shlp3)/sqrt(state.localError().matrix()[2][2]) ;
1077  // LogTrace("CkfDebugger") << setw(15) << stlp4 << setw(15) << shlp4 << setw(15) << sqrt(state.localError().matrix()[3][3])
1078  // << setw(15) << (stlp4-shlp4)/stlp4 << setw(15) << (stlp4-shlp4)/sqrt(state.localError().matrix()[3][3]) ;
1079  // LogTrace("CkfDebugger") << setw(15) << stlp5 << setw(15) << shlp5 << setw(15) << sqrt(state.localError().matrix()[4][4]) <<
1080  // setw(15) << (stlp5-shlp5)/stlp5 << setw(15) << (stlp5-shlp5)/sqrt(state.localError().matrix()[4][4]) ;
1081 
1082  AlgebraicSymMatrix55 R = state.localError().matrix();
1083  R.Invert();
1084  double chi2 = ROOT::Math::Similarity(v - state.localParameters().vector(), R);
1085  LogTrace("CkfDebugger") << "chi2=" << chi2;
1086  return chi2;
1087  }
1088 
1089  return 0; //fixme
1090 }
1091 
1093  for (int it = 0; it != ((int)(dump.size())); it++)
1094  edm::LogVerbatim("CkfDebugger") << "dump " << it << " " << dump[it];
1095 
1096  edm::LogVerbatim("CkfDebugger");
1097  edm::LogVerbatim("CkfDebugger") << "seedWithDelta=" << ((double)seedWithDelta / totSeeds);
1098  edm::LogVerbatim("CkfDebugger") << "problems=" << ((double)problems / totSeeds);
1099  edm::LogVerbatim("CkfDebugger") << "no_sim_hit=" << ((double)no_sim_hit / totSeeds);
1100  edm::LogVerbatim("CkfDebugger") << "no_layer=" << ((double)no_layer / totSeeds);
1101  edm::LogVerbatim("CkfDebugger") << "layer_not_found=" << ((double)layer_not_found / totSeeds);
1102  edm::LogVerbatim("CkfDebugger") << "det_not_found=" << ((double)det_not_found / totSeeds);
1103  edm::LogVerbatim("CkfDebugger") << "chi2gt30=" << ((double)chi2gt30 / totSeeds);
1104  edm::LogVerbatim("CkfDebugger") << "chi2gt30deltaSeed=" << ((double)chi2gt30deltaSeed / totSeeds);
1105  edm::LogVerbatim("CkfDebugger") << "chi2gt30delta=" << ((double)chi2gt30delta / totSeeds);
1106  edm::LogVerbatim("CkfDebugger") << "chi2ls30=" << ((double)chi2ls30 / totSeeds);
1107  edm::LogVerbatim("CkfDebugger") << "simple_hit_not_found=" << ((double)simple_hit_not_found / totSeeds);
1108  edm::LogVerbatim("CkfDebugger") << "no_component=" << ((double)no_component / totSeeds);
1109  edm::LogVerbatim("CkfDebugger") << "only_one_component=" << ((double)only_one_component / totSeeds);
1110  edm::LogVerbatim("CkfDebugger") << "matched_not_found=" << ((double)matched_not_found / totSeeds);
1111  edm::LogVerbatim("CkfDebugger") << "matched_not_associated=" << ((double)matched_not_associated / totSeeds);
1112  edm::LogVerbatim("CkfDebugger") << "partner_det_not_fuond=" << ((double)partner_det_not_fuond / totSeeds);
1113  edm::LogVerbatim("CkfDebugger") << "glued_det_not_fuond=" << ((double)glued_det_not_fuond / totSeeds);
1114  edm::LogVerbatim("CkfDebugger") << "propagation=" << ((double)propagation / totSeeds);
1115  edm::LogVerbatim("CkfDebugger") << "other=" << ((double)other / totSeeds);
1116  edm::LogVerbatim("CkfDebugger") << "totchi2gt30=" << ((double)totchi2gt30 / totSeeds);
1117  edm::LogVerbatim("CkfDebugger") << "totSeeds=" << totSeeds;
1118  edm::LogVerbatim("CkfDebugger");
1119 
1120  edm::LogVerbatim("CkfDebugger") << "layer navigation problems:";
1121  for (int i = 0; i != 6; i++)
1122  for (int j = 0; j != 9; j++) {
1123  if (i == 0 && j > 2)
1124  break;
1125  if (i == 1 && j > 1)
1126  break;
1127  if (i == 2 && j > 3)
1128  break;
1129  if (i == 3 && j > 2)
1130  break;
1131  if (i == 4 && j > 5)
1132  break;
1133  if (i == 5 && j > 8)
1134  break;
1135  edm::LogVerbatim("CkfDebugger") << "det=" << i + 1 << " lay=" << j + 1 << " " << dump2[pair<int, int>(i, j)];
1136  }
1137  edm::LogVerbatim("CkfDebugger") << "\nlayer with hit having chi2>30:";
1138  for (int i = 0; i != 6; i++)
1139  for (int j = 0; j != 9; j++) {
1140  if (i == 0 && j > 2)
1141  break;
1142  if (i == 1 && j > 1)
1143  break;
1144  if (i == 2 && j > 3)
1145  break;
1146  if (i == 3 && j > 2)
1147  break;
1148  if (i == 4 && j > 5)
1149  break;
1150  if (i == 5 && j > 8)
1151  break;
1152  edm::LogVerbatim("CkfDebugger") << "det=" << i + 1 << " lay=" << j + 1 << " " << dump3[pair<int, int>(i, j)];
1153  }
1154  edm::LogVerbatim("CkfDebugger") << "\nlayer with hit having chi2>30 for delta rays:";
1155  for (int i = 0; i != 6; i++)
1156  for (int j = 0; j != 9; j++) {
1157  if (i == 0 && j > 2)
1158  break;
1159  if (i == 1 && j > 1)
1160  break;
1161  if (i == 2 && j > 3)
1162  break;
1163  if (i == 3 && j > 2)
1164  break;
1165  if (i == 4 && j > 5)
1166  break;
1167  if (i == 5 && j > 8)
1168  break;
1169  edm::LogVerbatim("CkfDebugger") << "det=" << i + 1 << " lay=" << j + 1 << " " << dump5[pair<int, int>(i, j)];
1170  }
1171  edm::LogVerbatim("CkfDebugger") << "\nlayer with det not found:";
1172  for (int i = 0; i != 6; i++)
1173  for (int j = 0; j != 9; j++) {
1174  if (i == 0 && j > 2)
1175  break;
1176  if (i == 1 && j > 1)
1177  break;
1178  if (i == 2 && j > 3)
1179  break;
1180  if (i == 3 && j > 2)
1181  break;
1182  if (i == 4 && j > 5)
1183  break;
1184  if (i == 5 && j > 8)
1185  break;
1186  edm::LogVerbatim("CkfDebugger") << "det=" << i + 1 << " lay=" << j + 1 << " " << dump4[pair<int, int>(i, j)];
1187  }
1188  edm::LogVerbatim("CkfDebugger") << "\nlayer with correct RecHit after missing Sim Hit:";
1189  for (int i = 0; i != 6; i++)
1190  for (int j = 0; j != 9; j++) {
1191  if (i == 0 && j > 2)
1192  break;
1193  if (i == 1 && j > 1)
1194  break;
1195  if (i == 2 && j > 3)
1196  break;
1197  if (i == 3 && j > 2)
1198  break;
1199  if (i == 4 && j > 5)
1200  break;
1201  if (i == 5 && j > 8)
1202  break;
1203  edm::LogVerbatim("CkfDebugger") << "det=" << i + 1 << " lay=" << j + 1 << " " << dump6[pair<int, int>(i, j)];
1204  }
1205  hchi2seedAll->Write();
1206  hchi2seedProb->Write();
1207  std::stringstream title;
1208  for (int i = 0; i != 6; i++)
1209  for (int j = 0; j != 9; j++) {
1210  if (i == 0 && j > 2)
1211  break;
1212  if (i == 1 && j > 1)
1213  break;
1214  if (i == 2 && j > 3)
1215  break;
1216  if (i == 3 && j > 2)
1217  break;
1218  if (i == 4 && j > 5)
1219  break;
1220  if (i == 5 && j > 8)
1221  break;
1222  title.str("");
1223  title << "pullX_" << i + 1 << "-" << j + 1 << "_sh-rh";
1224  hPullX_shrh[title.str()]->Write();
1225  title.str("");
1226  title << "pullY_" << i + 1 << "-" << j + 1 << "_sh-rh";
1227  hPullY_shrh[title.str()]->Write();
1228  title.str("");
1229  title << "pullX_" << i + 1 << "-" << j + 1 << "_sh-st";
1230  hPullX_shst[title.str()]->Write();
1231  title.str("");
1232  title << "pullY_" << i + 1 << "-" << j + 1 << "_sh-st";
1233  hPullY_shst[title.str()]->Write();
1234  title.str("");
1235  title << "pullX_" << i + 1 << "-" << j + 1 << "_st-rh";
1236  hPullX_strh[title.str()]->Write();
1237  title.str("");
1238  title << "pullY_" << i + 1 << "-" << j + 1 << "_st-rh";
1239  hPullY_strh[title.str()]->Write();
1240  title.str("");
1241  title << "PullGP_X_" << i + 1 << "-" << j + 1 << "_sh-st";
1242  hPullGP_X_shst[title.str()]->Write();
1243  title.str("");
1244  title << "PullGP_Y_" << i + 1 << "-" << j + 1 << "_sh-st";
1245  hPullGP_Y_shst[title.str()]->Write();
1246  title.str("");
1247  title << "PullGP_Z_" << i + 1 << "-" << j + 1 << "_sh-st";
1248  hPullGP_Z_shst[title.str()]->Write();
1249  if (((i == 2 || i == 4) && (j == 0 || j == 1)) || (i == 3 || i == 5)) {
1250  title.str("");
1251  title << "pullM_" << i + 1 << "-" << j + 1 << "_sh-rh";
1252  hPullM_shrh[title.str()]->Write();
1253  title.str("");
1254  title << "pullS_" << i + 1 << "-" << j + 1 << "_sh-rh";
1255  hPullS_shrh[title.str()]->Write();
1256  title.str("");
1257  title << "pullM_" << i + 1 << "-" << j + 1 << "_sh-st";
1258  hPullM_shst[title.str()]->Write();
1259  title.str("");
1260  title << "pullS_" << i + 1 << "-" << j + 1 << "_sh-st";
1261  hPullS_shst[title.str()]->Write();
1262  title.str("");
1263  title << "pullM_" << i + 1 << "-" << j + 1 << "_st-rh";
1264  hPullM_strh[title.str()]->Write();
1265  title.str("");
1266  title << "pullS_" << i + 1 << "-" << j + 1 << "_st-rh";
1267  hPullS_strh[title.str()]->Write();
1268  }
1269  }
1270  hPullGPXvsGPX_shst->Write();
1271  hPullGPXvsGPY_shst->Write();
1272  hPullGPXvsGPZ_shst->Write();
1273  hPullGPXvsGPr_shst->Write();
1274  hPullGPXvsGPeta_shst->Write();
1275  hPullGPXvsGPphi_shst->Write();
1276 
1277  //file->Write();
1278  file->Close();
1279 }
Log< level::Info, true > LogVerbatim
unsigned int partnerDetId() const
std::map< std::string, TH1F * > hPullM_shst
Definition: CkfDebugger.h:228
const TrackerTopology * theTopo
Definition: CkfDebugger.h:115
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
bool hasDelta(const PSimHit *correctHit)
Definition: CkfDebugger.h:143
std::pair< CTTRHp, double > analyseRecHitExistance(const PSimHit &sh, const TSOS &startingState)
Definition: CkfDebugger.cc:713
void printSimHits(const edm::Event &iEvent)
Definition: CkfDebugger.cc:165
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: Trajectory.h:288
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::map< std::string, TH1F * > hPullS_strh
Definition: CkfDebugger.h:231
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Definition: CkfDebugger.h:111
const LocalTrajectoryError & localError() const
std::map< std::string, TH1F * > hPullX_shrh
Definition: CkfDebugger.h:219
unsigned int detUnitId() const
Definition: PSimHit.h:97
TH2F * hPullGPXvsGPeta_shst
Definition: CkfDebugger.h:241
void dumpSimHit(const SimHit &hit) const
Definition: CkfDebugger.cc:189
virtual const GeomDet & geomDet() const
std::pair< double, double > computePulls(CTTRHp recHit, TSOS startingState)
Definition: CkfDebugger.h:167
const MagneticField * theMagField
Definition: CkfDebugger.h:102
T z() const
Definition: PV3DBase.h:61
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
const TransientTrackingRecHitBuilder * theTTRHBuilder
Definition: CkfDebugger.h:114
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
std::map< std::pair< int, int >, int > dump6
Definition: CkfDebugger.h:214
const GeometricSearchTracker * theGeomSearchTracker
Definition: CkfDebugger.h:103
T eta() const
Definition: PV3DBase.h:73
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
const MeasurementTrackerEvent * theMeasurementTracker
Definition: CkfDebugger.h:113
std::map< std::pair< int, int >, int > dump3
Definition: CkfDebugger.h:211
unsigned int glued() const
glued
Global3DPoint position(const PSimHit *sh) const
Definition: CkfDebugger.h:156
std::vector< ConstRecHitPointer > RecHitContainer
int assocTrackId(CTTRHp rechit) const
Definition: CkfDebugger.cc:546
int partner_det_not_fuond
Definition: CkfDebugger.h:259
std::vector< const PSimHit * > nextCorrectHits(const Trajectory &, unsigned int &)
Definition: CkfDebugger.cc:561
LocalError positionError() const
const SurfaceType & surface() const
int det_not_found
Definition: CkfDebugger.h:249
bool correctMeas(const TM &tm, const PSimHit *correctHit) const
Definition: CkfDebugger.cc:667
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
std::map< std::pair< int, int >, int > dump2
Definition: CkfDebugger.h:210
int seedWithDelta
Definition: CkfDebugger.h:244
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:150
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
Definition: CkfDebugger.h:107
constexpr uint32_t mask
Definition: gpuClustering.h:26
const CartesianTrajectoryError cartesianError() const
const MeasurementEstimator * theChi2
Definition: CkfDebugger.h:104
int matched_not_found
Definition: CkfDebugger.h:257
bool correctTrajectory(const Trajectory &, unsigned int &) const
Definition: CkfDebugger.cc:500
#define LogTrace(id)
DataContainer const & measurements() const
Definition: Trajectory.h:178
const GeomDetUnit * det(const PSimHit *sh) const
Definition: CkfDebugger.h:159
float yy() const
Definition: LocalError.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int analyseRecHitNotFound(const Trajectory &, CTTRHp)
Definition: CkfDebugger.cc:935
int iEvent
Definition: GenABIO.cc:224
const Surface::PositionType & position() const
GlobalPoint globalPosition() const
double testSeed(CTTRHp, CTTRHp, TrajectoryStateOnSurface)
std::map< std::pair< int, int >, int > dump4
Definition: CkfDebugger.h:212
int matched_not_associated
Definition: CkfDebugger.h:258
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
std::map< std::string, TH1F * > hPullS_shrh
Definition: CkfDebugger.h:227
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
const GlobalError position() const
Position error submatrix.
int only_one_component
Definition: CkfDebugger.h:256
T sqrt(T t)
Definition: SSEVec.h:19
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
PropagationDirection const & direction() const
Definition: Trajectory.cc:133
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186
unsigned short processType() const
Definition: PSimHit.h:120
edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > theNavToken
Definition: CkfDebugger.h:109
TH2F * hPullGPXvsGPr_shst
Definition: CkfDebugger.h:240
T mag() const
Definition: PV3DBase.h:64
int glued_det_not_fuond
Definition: CkfDebugger.h:260
TH1F * hchi2seedAll
Definition: CkfDebugger.h:217
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&... args) const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
TrackerHitAssociator * hitAssociator
Definition: CkfDebugger.h:112
TH2F * hPullGPXvsGPY_shst
Definition: CkfDebugger.h:238
TransientTrackingRecHit::ConstRecHitPointer CTTRHp
Definition: CkfDebugger.h:44
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
unsigned int trackId() const
Definition: PSimHit.h:106
std::map< std::string, TH1F * > hPullY_shrh
Definition: CkfDebugger.h:220
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
bool associated(CTTRHp rechit, const PSimHit &sh) const
Definition: CkfDebugger.cc:646
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &) const =0
DetId gluedId(const DetId &du)
Definition: CkfDebugger.cc:36
const Propagator * theForwardPropagator
Definition: CkfDebugger.h:105
int chi2gt30deltaSeed
Definition: CkfDebugger.h:252
Definition: DetId.h:17
CLHEP::HepVector AlgebraicVector
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:42
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
std::map< std::string, TH1F * > hPullX_shst
Definition: CkfDebugger.h:221
int simple_hit_not_found
Definition: CkfDebugger.h:254
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Local3DPoint localPosition() const
Definition: PSimHit.h:52
std::map< std::string, TH1F * > hPullGP_Y_shst
Definition: CkfDebugger.h:234
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:67
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
double b
Definition: hdecay.h:120
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
TFile * file
Definition: CkfDebugger.h:216
TrajectoryStateOnSurface const & updatedState() const
const Surface & surface() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
Definition: CkfDebugger.h:106
const TrackerGeometry * theTrackerGeom
Definition: CkfDebugger.h:101
std::map< std::string, TH1F * > hPullM_shrh
Definition: CkfDebugger.h:226
TrackingRecHit::ConstRecHitContainer RecHitContainer
bool goodSimHit(const PSimHit &sh) const
Definition: CkfDebugger.cc:639
HLT enums.
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:166
NavigationSchool const * theNavSchool
Definition: CkfDebugger.h:116
bool analyseCompatibleMeasurements(const Trajectory &, const std::vector< TrajectoryMeasurement > &, const MeasurementTrackerEvent *, const Propagator *, const Chi2MeasurementEstimatorBase *, const TransientTrackingRecHitBuilder *)
Definition: CkfDebugger.cc:196
std::map< std::pair< int, int >, int > dump5
Definition: CkfDebugger.h:213
double a
Definition: hdecay.h:121
TH2F * hPullGPXvsGPX_shst
Definition: CkfDebugger.h:237
std::map< std::string, TH1F * > hPullGP_Z_shst
Definition: CkfDebugger.h:235
CLHEP::HepSymMatrix AlgebraicSymMatrix
void setConditions(edm::EventSetup const &es)
Definition: CkfDebugger.cc:49
std::map< std::string, TH1F * > hPullX_strh
Definition: CkfDebugger.h:223
CkfDebugger(edm::ConsumesCollector iC)
Definition: CkfDebugger.cc:41
edm::ESGetToken< TrackerTopology, IdealGeometryRecord > theTopoHandToken
Definition: CkfDebugger.h:108
int layer_not_found
Definition: CkfDebugger.h:248
float timeOfFlight() const
Definition: PSimHit.h:73
int no_component
Definition: CkfDebugger.h:255
TH2F * hPullGPXvsGPZ_shst
Definition: CkfDebugger.h:239
std::vector< int > dump
Definition: CkfDebugger.h:209
std::map< std::string, TH1F * > hPullS_shst
Definition: CkfDebugger.h:229
const PSimHit * pSimHit(unsigned int tkId, DetId detId)
Definition: CkfDebugger.cc:924
int layer(const GeomDet *det)
Definition: CkfDebugger.h:161
std::map< std::string, TH1F * > hPullY_shst
Definition: CkfDebugger.h:222
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
std::map< std::string, TH1F * > hPullM_strh
Definition: CkfDebugger.h:230
std::map< unsigned int, std::vector< PSimHit * > > idHitsMap
Definition: CkfDebugger.h:118
float xx() const
Definition: LocalError.h:22
def move(src, dest)
Definition: eostools.py:511
TH1F * hchi2seedProb
Definition: CkfDebugger.h:217
std::map< std::string, TH1F * > hPullY_strh
Definition: CkfDebugger.h:224
TH2F * hPullGPXvsGPphi_shst
Definition: CkfDebugger.h:242
ConstRecHitPointer const & recHit() const
int chi2gt30delta
Definition: CkfDebugger.h:251
std::map< std::string, TH1F * > hPullGP_X_shst
Definition: CkfDebugger.h:233