CMS 3D CMS Logo

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