37 unsigned int mask = ~3;
42 : trackerHitAssociatorConfig_(std::
move(iC)), totSeeds(0) {
43 file =
new TFile(
"out.root",
"recreate");
44 hchi2seedAll =
new TH1F(
"hchi2seedAll",
"hchi2seedAll", 2000, 0, 200);
45 hchi2seedProb =
new TH1F(
"hchi2seedProb",
"hchi2seedProb", 2000, 0, 200);
64 for (
int i = 0;
i != 17;
i++) {
68 std::stringstream
title;
69 for (
int i = 0;
i != 6;
i++)
70 for (
int j = 0;
j != 9;
j++) {
83 dump2[pair<int, int>(
i,
j)] = 0;
84 dump3[pair<int, int>(
i,
j)] = 0;
85 dump4[pair<int, int>(
i,
j)] = 0;
86 dump5[pair<int, int>(
i,
j)] = 0;
87 dump6[pair<int, int>(
i,
j)] = 0;
89 title <<
"pullX_" << i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
90 hPullX_shrh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
92 title <<
"pullY_" << i + 1 <<
"-" << j + 1 <<
"_sh-rh";
93 hPullY_shrh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
95 title <<
"pullX_" << i + 1 <<
"-" << j + 1 <<
"_sh-st";
96 hPullX_shst[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
98 title <<
"pullY_" << i + 1 <<
"-" << j + 1 <<
"_sh-st";
99 hPullY_shst[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
101 title <<
"pullX_" << i + 1 <<
"-" << j + 1 <<
"_st-rh";
102 hPullX_strh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
104 title <<
"pullY_" << i + 1 <<
"-" << j + 1 <<
"_st-rh";
105 hPullY_strh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
107 title <<
"PullGP_X_" << i + 1 <<
"-" << j + 1 <<
"_sh-st";
108 hPullGP_X_shst[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
110 title <<
"PullGP_Y_" << i + 1 <<
"-" << j + 1 <<
"_sh-st";
111 hPullGP_Y_shst[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
113 title <<
"PullGP_Z_" << i + 1 <<
"-" << j + 1 <<
"_sh-st";
114 hPullGP_Z_shst[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
115 if (((i == 2 || i == 4) && (j == 0 || j == 1)) || (i == 3 || i == 5)) {
117 title <<
"pullM_" << i + 1 <<
"-" << j + 1 <<
"_sh-rh";
118 hPullM_shrh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
120 title <<
"pullS_" << i + 1 <<
"-" << j + 1 <<
"_sh-rh";
121 hPullS_shrh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
123 title <<
"pullM_" << i + 1 <<
"-" << j + 1 <<
"_sh-st";
124 hPullM_shst[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
126 title <<
"pullS_" << i + 1 <<
"-" << j + 1 <<
"_sh-st";
127 hPullS_shst[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
129 title <<
"pullM_" << i + 1 <<
"-" << j + 1 <<
"_st-rh";
130 hPullM_strh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
132 title <<
"pullS_" << i + 1 <<
"-" << j + 1 <<
"_st-rh";
133 hPullS_strh[title.str()] =
new TH1F(title.str().c_str(), title.str().c_str(), 1000, -50, 50);
137 hPullGPXvsGPX_shst =
new TH2F(
"PullGPXvsGPX_shst",
"PullGPXvsGPX_shst", 1000, -50, 50, 100, -50, 50);
138 hPullGPXvsGPY_shst =
new TH2F(
"PullGPXvsGPY_shst",
"PullGPXvsGPY_shst", 1000, -50, 50, 100, -50, 50);
139 hPullGPXvsGPZ_shst =
new TH2F(
"PullGPXvsGPZ_shst",
"PullGPXvsGPZ_shst", 1000, -50, 50, 200, -100, 100);
140 hPullGPXvsGPr_shst =
new TH2F(
"PullGPXvsGPr_shst",
"PullGPXvsGPr_shst", 1000, -50, 50, 300, -150, 150);
141 hPullGPXvsGPeta_shst =
new TH2F(
"PullGPXvsGPeta_shst",
"PullGPXvsGPeta_shst", 1000, -50, 50, 50, -2.5, 2.5);
142 hPullGPXvsGPphi_shst =
new TH2F(
"PullGPXvsGPphi_shst",
"PullGPXvsGPphi_shst", 1000, -50, 50, 63, 0, 6.3);
175 for (std::map<
unsigned int, std::vector<PSimHit> >::iterator it = theHitsMap.begin(); it != theHitsMap.end(); it++) {
176 for (std::vector<PSimHit>::iterator isim = it->second.begin(); isim != it->second.end(); ++isim) {
177 idHitsMap[isim->trackId()].push_back(&*isim);
181 for (std::map<
unsigned int, std::vector<PSimHit*> >::iterator it =
idHitsMap.begin(); it !=
idHitsMap.end(); it++) {
182 sort(it->second.begin(), it->second.end(), [](
auto*
a,
auto*
b) {
return a->timeOfFlight() <
b->timeOfFlight(); });
183 for (std::vector<PSimHit*>::iterator isim = it->second.begin(); isim != it->second.end(); ++isim) {
198 const std::vector<TrajectoryMeasurement>& meas,
203 LogTrace(
"CkfDebugger") <<
"\nnow in analyseCompatibleMeasurements";
204 LogTrace(
"CkfDebugger") <<
"number of input hits:" << meas.size();
205 for (std::vector<TrajectoryMeasurement>::const_iterator tmpIt = meas.begin(); tmpIt != meas.end(); tmpIt++) {
206 if (tmpIt->recHit()->isValid())
207 LogTrace(
"CkfDebugger") <<
"valid hit at position:" << tmpIt->recHit()->globalPosition();
214 unsigned int trajId = 0;
216 LogTrace(
"CkfDebugger") <<
"trajectory not correct";
219 LogTrace(
"CkfDebugger") <<
"correct trajectory";
225 LogTrace(
"CkfDebugger") <<
"Seed has delta";
233 std::vector<const PSimHit*> correctHits =
nextCorrectHits(traj, trajId);
234 if (correctHits.empty())
237 for (std::vector<const PSimHit*>::iterator corHit = correctHits.begin(); corHit != correctHits.end(); corHit++) {
238 for (std::vector<TM>::const_iterator
i = meas.begin();
i != meas.end();
i++) {
240 LogTrace(
"CkfDebugger") <<
"Correct hit found at position " <<
i - meas.begin();
248 const PSimHit* correctHit = *(correctHits.begin());
252 <<
"CkfDebugger: problem found: correct hit not found by findCompatibleMeasurements";
255 edm::LogVerbatim(
"CkfDebugger") <<
"The size of the meas vector is " << meas.size();
259 for (std::vector<TM>::const_iterator
i = meas.begin();
i != meas.end();
i++) {
260 edm::LogVerbatim(
"CkfDebugger") <<
"Is the hit valid? " <<
i->recHit()->isValid();
261 if (
i->recHit()->isValid()) {
262 edm::LogVerbatim(
"CkfDebugger") <<
"RecHit at " <<
i->recHit()->globalPosition() <<
" layer "
263 << ((
i->recHit()->det()->geographicalId().rawId() >> 16) & 0xF) <<
" subdet "
264 <<
i->recHit()->det()->geographicalId().subdetId() <<
" Chi2 " <<
i->estimate();
265 }
else if (
i->recHit()->det() ==
nullptr) {
266 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid RecHit returned with zero Det pointer";
267 }
else if (
i->recHit()->det() ==
det(correctHit)) {
270 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid hit returned in Det at gpos " <<
i->recHit()->det()->position()
271 <<
" correct Det is at " <<
det(correctHit)->
position();
277 if (correctRecHit.first ==
nullptr) {
279 if (fabs(correctRecHit.second - 0) < 0.01) {
282 if (fabs(correctRecHit.second + 1) < 0.01) {
285 if (fabs(correctRecHit.second + 2) < 0.01) {
288 if (fabs(correctRecHit.second + 3) < 0.01) {
291 if (fabs(correctRecHit.second + 4) < 0.01) {
294 if (fabs(correctRecHit.second + 5) < 0.01) {
297 if (fabs(correctRecHit.second + 6) < 0.01) {
300 if (fabs(correctRecHit.second + 7) < 0.01) {
303 if (fabs(correctRecHit.second + 8) < 0.01) {
310 if (correctRecHit.second > 30) {
311 edm::LogVerbatim(
"CkfDebugger") <<
"Outling RecHit at pos=" << correctRecHit.first->globalPosition()
312 <<
" from SimHit at pos=" <<
position(correctHit)
318 dump5[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
319 (
layer(correctRecHit.first->det())) - 1)]++;
324 dump3[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
325 (
layer(correctRecHit.first->det())) - 1)]++;
338 correctRecHit.first->det()->
surface());
343 int subdetId = correctRecHit.first->det()->geographicalId().subdetId();
344 int layerId =
layer(correctRecHit.first->det());
347 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->globalPosition()="
348 << correctRecHit.first->globalPosition();
353 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPosition()="
354 << correctRecHit.first->localPosition();
355 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPositionError()="
356 << correctRecHit.first->localPositionError();
358 LogTrace(
"CkfDebugger") <<
"detState.localError().positionError()="
361 LogTrace(
"CkfDebugger") <<
"simDetState.localError().positionError()="
363 double pullx_shrh = (correctHit->
localPosition().
x() - correctRecHit.first->localPosition().x()) /
364 sqrt(correctRecHit.first->localPositionError().xx());
365 double pully_shrh = 0;
366 if (correctRecHit.first->localPositionError().yy() != 0)
367 pully_shrh = (correctHit->
localPosition().
y() - correctRecHit.first->localPosition().y()) /
368 sqrt(correctRecHit.first->localPositionError().yy());
374 LogTrace(
"CkfDebugger") <<
"pullx(sh-rh)=" << pullx_shrh;
375 LogTrace(
"CkfDebugger") <<
"pully(sh-rh)=" << pully_shrh;
376 LogTrace(
"CkfDebugger") <<
"pullx(sh-st)=" << pullx_shst;
377 LogTrace(
"CkfDebugger") <<
"pully(sh-st)=" << pully_shst;
379 LogTrace(
"CkfDebugger") <<
"pullx(st-rh)="
380 << (detState.
localPosition().
x() - correctRecHit.first->localPosition().x()) /
381 sqrt(correctRecHit.first->localPositionError().xx() +
384 std::pair<double, double> pulls =
computePulls(correctRecHit.first, detState);
385 if (subdetId > 0 && subdetId < 7 && layerId > 0 && layerId < 10) {
388 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-rh";
391 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-rh";
394 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-st";
397 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-st";
400 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_st-rh";
403 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_st-rh";
409 double pullGPx = (shGPos.
x() - stGPos.
x()) /
sqrt(stGPosErr.
cxx());
411 title <<
"PullGP_X_" << subdetId <<
"-" << layerId <<
"_sh-st";
414 title <<
"PullGP_Y_" << subdetId <<
"-" << layerId <<
"_sh-st";
417 title <<
"PullGP_Z_" << subdetId <<
"-" << layerId <<
"_sh-st";
420 if (subdetId == 3 && layerId == 1) {
428 if (dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())) {
429 LogTrace(
"CkfDebugger") <<
"MONO HIT";
435 double pullM_shrh = (sMonoHit.
localPosition().
x() - tMonoHit->localPosition().x()) /
436 sqrt(tMonoHit->localPositionError().xx());
439 std::pair<double, double> pullsMono =
computePulls(tMonoHit, monoState);
441 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-rh";
444 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-st";
447 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_st-rh";
450 LogTrace(
"CkfDebugger") <<
"STEREO HIT";
456 double pullS_shrh = (sStereoHit.
localPosition().
x() - tStereoHit->localPosition().x()) /
457 sqrt(tStereoHit->localPositionError().xx());
460 std::pair<double, double> pullsStereo =
computePulls(tStereoHit, stereoState);
462 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-rh";
465 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-st";
468 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_st-rh";
473 <<
"unexpected result: wrong det or layer id " << subdetId <<
" " << layerId <<
" "
474 << correctRecHit.first->det()->geographicalId().rawId();
479 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result " << correctRecHit.second;
486 dump2[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
487 (
layer(correctRecHit.first->det())) - 1)]++;
490 dump4[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
491 (
layer(correctRecHit.first->det())) - 1)]++;
493 if (correctRecHit.second > 30) {
502 LogTrace(
"CkfDebugger") <<
"now in correctTrajectory";
506 if (currentTrackId.empty())
509 for (Trajectory::RecHitContainer::const_iterator rh = hits.begin(); rh != hits.end(); ++rh) {
511 if (!(*rh)->hit()->isValid()) {
517 bool nogoodhit =
true;
519 for (std::vector<PSimHit>::iterator shit = assSimHits.begin(); shit != assSimHits.end(); shit++) {
529 for (std::vector<SimHitIdpr>::iterator
i = currentTrackId.begin();
i != currentTrackId.end();
i++) {
530 for (std::vector<SimHitIdpr>::iterator
j = nextTrackId.begin();
j != nextTrackId.end();
j++) {
531 if (
i->first ==
j->first)
548 LogTrace(
"CkfDebugger") <<
"now in assocTrackId";
550 if (!rechit->hit()->isValid()) {
563 std::vector<const PSimHit*>
result;
565 LogTrace(
"CkfDebugger") <<
"now in nextCorrectHits";
570 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch = comp.begin(); ch != comp.end(); ++ch) {
571 if ((*ch)->globalPosition().mag() > maxR)
573 maxR = (*ch)->globalPosition().mag();
576 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: lastRecHit is at gpos " << lastRecHit->globalPosition() <<
" layer "
577 <<
layer((lastRecHit->det())) <<
" subdet "
578 << lastRecHit->det()->geographicalId().subdetId();
582 for (std::vector<PSimHit>::const_iterator shit = pSimHitVec.begin(); shit != pSimHitVec.end(); shit++) {
584 LogTrace(
"CkfDebugger") <<
"from hitAssociator SimHits are at GP=" << detUnit->
toGlobal(shit->localPosition())
585 <<
" traId=" << shit->trackId() <<
" particleType " << shit->particleType()
586 <<
" pabs=" << shit->pabs() <<
" detUnitId=" << shit->detUnitId() <<
" layer "
591 const PSimHit* lastPSH =
nullptr;
592 if (!pSimHitVec.empty()) {
594 for (std::vector<PSimHit>::const_iterator ch = pSimHitVec.begin(); ch != pSimHitVec.end(); ++ch) {
595 if ((ch->trackId() == trajId) && (ch->timeOfFlight() > maxTOF) && (
goodSimHit(*ch))) {
602 if (lastPSH ==
nullptr)
607 std::vector<PSimHit*> trackHits =
idHitsMap[trajId];
608 if (fabs((
double)(trackHits.back()->detUnitId() - lastPSH->
detUnitId())) < 1)
610 std::vector<PSimHit*>::iterator currentIt = trackHits.end();
611 for (std::vector<PSimHit*>::iterator it = trackHits.begin(); it != trackHits.end(); it++) {
619 result.push_back(*it);
624 bool samelayer =
true;
625 if (currentIt != (trackHits.end() - 1) && currentIt != trackHits.end()) {
626 for (std::vector<PSimHit*>::iterator nextIt = currentIt; (samelayer && nextIt != trackHits.end()); nextIt++) {
630 result.push_back(*nextIt);
648 LogTrace(
"CkfDebugger") <<
"now in associated";
650 if (!rechit->isValid())
655 for (std::vector<PSimHit>::const_iterator shit = pSimHitVec.begin(); shit != pSimHitVec.end(); shit++) {
661 if ((fabs((*shit).timeOfFlight() - pSimHit.
timeOfFlight()) < 1
e-9) &&
662 (fabs((*shit).pabs() - pSimHit.
pabs()) < 1
e-9))
669 LogTrace(
"CkfDebugger") <<
"now in correctMeas";
671 if (recHit->isValid())
672 LogTrace(
"CkfDebugger") <<
"hit at position:" << recHit->globalPosition();
678 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch = comp.begin(); ch != comp.end(); ++ch) {
681 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch2 = comp.begin(); ch2 != comp.end(); ++ch2) {
688 for (std::vector<SimHitIdpr>::iterator
j = ids.begin();
j != ids.end();
j++) {
690 if (correctHit->
trackId() ==
j->first) {
696 LogTrace(
"CkfDebugger") <<
"returning false 1";
715 LogTrace(
"CkfDebugger") <<
"now in analyseRecHitExistance";
718 std::pair<CTTRHp, double>
result;
726 if (!firstDetState.
isValid()) {
727 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to first det surface "
730 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
734 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
737 result = std::pair<CTTRHp, double>(*rh,
theChi2->
estimate( firstDetState, **rh).second);
738 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
739 << (**rh).localPosition()
740 <<
" gpos " << (**rh).globalPosition()
741 <<
" layer " <<
layer((**rh).det())
742 <<
" subdet " << (**rh).det()->geographicalId().subdetId()
747 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
748 edm::LogVerbatim(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
752 for (MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++)
753 edm::LogVerbatim(
"CkfDebugger") <<
"RH#" << y++ <<
" GP=" << (**rh).globalPosition() <<
" subdet=" << (**rh).det()->geographicalId().subdetId()
754 <<
" layer=" <<
layer((**rh).det()) ;
755 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
756 edm::LogVerbatim(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
763 if (!subdet.
glued()) {
764 edm::LogVerbatim(
"CkfDebugger") <<
"The DetUnit is not part of a GluedDet" ;
766 if (result.second>30){
767 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << result.first->parameters() ;
768 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << result.first->parametersError() ;
778 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
779 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
785 return std::pair<CTTRHp, double>((
CTTRHp)(0),-8);
793 edm::LogVerbatim(
"CkfDebugger") <<
"Partner DetUnit does not have a SimHit from the same track" ;
796 TrackingRecHitProjector<ProjectedRecHit2D> proj;
800 CTTRHp projHit = proj.project( *result.first,gluedDet->
geomDet(),gluedTSOS).
get();
804 return std::pair<CTTRHp, double>(projHit,
chi2);
809 <<
" lpos " << sh2->localPosition() ;
813 if (partnerDet == 0) {
816 return std::pair<CTTRHp, double>((
CTTRHp)(0),-3);
822 if (!secondDetState.
isValid()) {
823 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to second det surface "
826 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
829 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits2.begin(); rh != recHits2.end(); rh++) {
832 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
833 << (**rh).localPosition()
834 <<
" gpos " << (**rh).globalPosition()
840 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
841 LogTrace(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
842 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
843 LogTrace(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
850 if (found && found2) {
854 if ( gluedDet == 0) {
855 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger ERROR: glued MeasurementDet not found!" ;
857 return std::pair<CTTRHp, double>((
CTTRHp)(0),-4);
861 if (!gluedDetState.
isValid()) {
862 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to det surface "
865 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
868 gluedHits = gluedDet->
recHits( gluedDetState);
869 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: the GluedDet returned " << gluedHits.size() <<
" hits" ;
870 if (gluedHits.size()==0){
871 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits but not matched!!!" ;
873 return std::pair<CTTRHp, double>((
CTTRHp)(0),-5);
876 for ( MeasurementDet::RecHitContainer::const_iterator rh = gluedHits.begin(); rh != gluedHits.end(); rh++) {
879 edm::LogVerbatim(
"CkfDebugger") <<
"Matched hit at lpos " << (**rh).localPosition()
880 <<
" gpos " << (**rh).globalPosition()
881 <<
" has Chi2 " <<
chi2
883 result = std::pair<CTTRHp, double>(&**rh,
chi2);
886 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << (*rh)->parameters() ;
887 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << (*rh)->parametersError() ;
897 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
898 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
903 if (found3)
return result;
905 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits. Matched found but not associated!!!" ;
907 return std::pair<CTTRHp, double>((
CTTRHp)(0),-6);
910 else if ( (found && !found2) || (!found && found2) ) {
913 return std::pair<CTTRHp, double>((
CTTRHp)(0),-7);
918 return std::pair<CTTRHp, double>((
CTTRHp)(0),-2);
922 return std::pair<CTTRHp, double>((
CTTRHp)(
nullptr), 0);
927 if ((*shi)->detUnitId() == detId.
rawId() &&
937 unsigned int correctDetId = correctRecHit->det()->geographicalId().rawId();
938 int correctLayId =
layer(correctRecHit->det());
939 LogTrace(
"CkfDebugger") <<
"correct layer id=" << correctLayId;
942 std::vector<const DetLayer*> nl =
952 bool navLayerAfter =
false;
954 for (std::vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
955 if (dynamic_cast<const BarrelDetLayer*>(*il)) {
957 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().length()="
959 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().width()=" << pbl->
specificSurface().bounds().width();
961 int layId =
layer(((*(*il)->basicComponents().begin())));
962 LogTrace(
"CkfDebugger") <<
" subdet=" << (*(*il)->basicComponents().begin())->geographicalId().subdetId()
963 <<
"layer id=" << layId;
964 if (layId == correctLayId) {
970 navLayerAfter =
true;
974 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer taken into account. layer id: " << correctLayId;
975 }
else if (navLayerAfter) {
976 edm::LogVerbatim(
"CkfDebugger") <<
"SimHit layer after the layers returned by Navigation.";
978 edm::LogVerbatim(
"CkfDebugger") <<
"check: " << (correctRecHit->det()->geographicalId().subdetId()) <<
" "
979 << (
layer(correctRecHit->det()));
980 dump6[pair<int, int>((correctRecHit->det()->geographicalId().subdetId() - 1), (
layer(correctRecHit->det())) - 1)]++;
984 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer NOT taken into account. correct layer id: " << correctLayId;
1001 for (std::vector<DetWithState>::iterator
det = compatDets.begin();
det != compatDets.end();
det++) {
1007 if (detId ==
gluedId(correctRecHit->det()->geographicalId()).rawId()) {
1014 edm::LogVerbatim(
"CkfDebugger") <<
"correct det taken into account. correctDetId is: " << correctDetId
1015 <<
". please check chi2.";
1018 edm::LogVerbatim(
"CkfDebugger") <<
"correct det NOT taken into account. correctDetId: " << correctDetId;
1030 if (pSimHitVec1.empty() || pSimHitVec2.empty() ||
hasDelta(&(*pSimHitVec1.begin())) ||
1031 hasDelta(&(*pSimHitVec2.begin()))) {
1043 if (!pSimHitVec2.empty()) {
1044 const PSimHit& simHit = *pSimHitVec2.begin();
1094 for (
int it = 0; it != ((int)(
dump.size())); it++)
1122 for (
int i = 0;
i != 6;
i++)
1123 for (
int j = 0;
j != 9;
j++) {
1124 if (
i == 0 &&
j > 2)
1126 if (
i == 1 &&
j > 1)
1128 if (
i == 2 &&
j > 3)
1130 if (
i == 3 &&
j > 2)
1132 if (
i == 4 &&
j > 5)
1134 if (
i == 5 &&
j > 8)
1139 for (
int i = 0;
i != 6;
i++)
1140 for (
int j = 0;
j != 9;
j++) {
1141 if (
i == 0 &&
j > 2)
1143 if (
i == 1 &&
j > 1)
1145 if (
i == 2 &&
j > 3)
1147 if (
i == 3 &&
j > 2)
1149 if (
i == 4 &&
j > 5)
1151 if (
i == 5 &&
j > 8)
1155 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with hit having chi2>30 for delta rays:";
1156 for (
int i = 0;
i != 6;
i++)
1157 for (
int j = 0;
j != 9;
j++) {
1158 if (
i == 0 &&
j > 2)
1160 if (
i == 1 &&
j > 1)
1162 if (
i == 2 &&
j > 3)
1164 if (
i == 3 &&
j > 2)
1166 if (
i == 4 &&
j > 5)
1168 if (
i == 5 &&
j > 8)
1173 for (
int i = 0;
i != 6;
i++)
1174 for (
int j = 0;
j != 9;
j++) {
1175 if (
i == 0 &&
j > 2)
1177 if (
i == 1 &&
j > 1)
1179 if (
i == 2 &&
j > 3)
1181 if (
i == 3 &&
j > 2)
1183 if (
i == 4 &&
j > 5)
1185 if (
i == 5 &&
j > 8)
1189 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with correct RecHit after missing Sim Hit:";
1190 for (
int i = 0;
i != 6;
i++)
1191 for (
int j = 0;
j != 9;
j++) {
1192 if (
i == 0 &&
j > 2)
1194 if (
i == 1 &&
j > 1)
1196 if (
i == 2 &&
j > 3)
1198 if (
i == 3 &&
j > 2)
1200 if (
i == 4 &&
j > 5)
1202 if (
i == 5 &&
j > 8)
1208 std::stringstream
title;
1209 for (
int i = 0;
i != 6;
i++)
1210 for (
int j = 0;
j != 9;
j++) {
1211 if (
i == 0 &&
j > 2)
1213 if (
i == 1 &&
j > 1)
1215 if (
i == 2 &&
j > 3)
1217 if (
i == 3 &&
j > 2)
1219 if (
i == 4 &&
j > 5)
1221 if (
i == 5 &&
j > 8)
1224 title <<
"pullX_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
1227 title <<
"pullY_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-rh";
1230 title <<
"pullX_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-st";
1233 title <<
"pullY_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-st";
1236 title <<
"pullX_" <<
i + 1 <<
"-" << j + 1 <<
"_st-rh";
1239 title <<
"pullY_" <<
i + 1 <<
"-" << j + 1 <<
"_st-rh";
1242 title <<
"PullGP_X_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-st";
1245 title <<
"PullGP_Y_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-st";
1248 title <<
"PullGP_Z_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-st";
1250 if (((
i == 2 ||
i == 4) && (j == 0 || j == 1)) || (
i == 3 ||
i == 5)) {
1252 title <<
"pullM_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-rh";
1255 title <<
"pullS_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-rh";
1258 title <<
"pullM_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-st";
1261 title <<
"pullS_" <<
i + 1 <<
"-" << j + 1 <<
"_sh-st";
1264 title <<
"pullM_" <<
i + 1 <<
"-" << j + 1 <<
"_st-rh";
1267 title <<
"pullS_" <<
i + 1 <<
"-" << j + 1 <<
"_st-rh";
Log< level::Info, true > LogVerbatim
unsigned short processType() const
std::map< std::string, TH1F * > hPullM_shst
GlobalPoint globalPosition() const
const TrackerTopology * theTopo
bool hasDelta(const PSimHit *correctHit)
std::pair< CTTRHp, double > analyseRecHitExistance(const PSimHit &sh, const TSOS &startingState)
bool correctMeas(const TM &tm, const PSimHit *correctHit) const
void printSimHits(const edm::Event &iEvent)
ConstRecHitPointer const & recHit() const
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::map< std::string, TH1F * > hPullS_strh
TrackerHitAssociator::Config trackerHitAssociatorConfig_
std::map< std::string, TH1F * > hPullX_shrh
const LocalTrajectoryParameters & localParameters() const
TH2F * hPullGPXvsGPeta_shst
void dumpSimHit(const SimHit &hit) const
std::pair< double, double > computePulls(CTTRHp recHit, TSOS startingState)
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
const MagneticField * theMagField
LocalPoint localPosition() const
const TransientTrackingRecHitBuilder * theTTRHBuilder
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::map< std::pair< int, int >, int > dump6
const GeometricSearchTracker * theGeomSearchTracker
const MeasurementTrackerEvent * theMeasurementTracker
virtual const GeomDet & geomDet() const
Geom::Phi< T > phi() const
constexpr uint32_t rawId() const
get the raw id
const CartesianTrajectoryError cartesianError() const
std::map< std::pair< int, int >, int > dump3
std::vector< ConstRecHitPointer > RecHitContainer
GlobalPoint globalPosition() const
ConstRecHitContainer recHits() const
const Surface & surface() const
int partner_det_not_fuond
std::vector< const PSimHit * > nextCorrectHits(const Trajectory &, unsigned int &)
unsigned int partnerDetId() const
const Plane & surface() const
The nominal surface of the GeomDet.
std::map< std::pair< int, int >, int > dump2
LocalError positionError() const
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const MeasurementEstimator * theChi2
unsigned int trackId() const
PropagationDirection const & direction() const
DataContainer const & measurements() const
AlgebraicVector5 vector() const
int analyseRecHitNotFound(const Trajectory &, CTTRHp)
const SurfaceType & surface() const
unsigned int glued() const
glued
const Surface::PositionType & position() const
The position (origin of the R.F.)
float timeOfFlight() const
double testSeed(CTTRHp, CTTRHp, TrajectoryStateOnSurface)
std::map< std::pair< int, int >, int > dump4
int matched_not_associated
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
std::map< std::string, TH1F * > hPullS_shrh
Local3DPoint localPosition() const
bool associated(CTTRHp rechit, const PSimHit &sh) const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TrajectoryMeasurement const & lastMeasurement() const
int assocTrackId(CTTRHp rechit) const
TH2F * hPullGPXvsGPr_shst
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
TrackerHitAssociator * hitAssociator
TH2F * hPullGPXvsGPY_shst
DetId geographicalId() const
The label of this GeomDet.
CkfDebugger(edm::EventSetup const &es, edm::ConsumesCollector &&iC)
TransientTrackingRecHit::ConstRecHitPointer CTTRHp
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
std::map< std::string, TH1F * > hPullY_shrh
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
const Surface::PositionType & position() const
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &) const =0
DetId gluedId(const DetId &du)
const Propagator * theForwardPropagator
bool correctTrajectory(const Trajectory &, unsigned int &) const
CLHEP::HepVector AlgebraicVector
TrajectoryMeasurement const & firstMeasurement() const
ConstRecHitContainer RecHitContainer
std::map< std::string, TH1F * > hPullX_shst
const GlobalError position() const
Position error submatrix.
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
std::map< std::string, TH1F * > hPullGP_Y_shst
T const * product() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
unsigned short processType() const
const TrackerGeometry * theTrackerGeom
std::map< std::string, TH1F * > hPullM_shrh
TrackingRecHit::ConstRecHitContainer RecHitContainer
const GeomDetUnit * det(const PSimHit *sh) const
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
NavigationSchool const * theNavSchool
bool analyseCompatibleMeasurements(const Trajectory &, const std::vector< TrajectoryMeasurement > &, const MeasurementTrackerEvent *, const Propagator *, const Chi2MeasurementEstimatorBase *, const TransientTrackingRecHitBuilder *)
bool goodSimHit(const PSimHit &sh) const
std::map< std::pair< int, int >, int > dump5
TH2F * hPullGPXvsGPX_shst
std::map< std::string, TH1F * > hPullGP_Z_shst
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::map< std::string, TH1F * > hPullX_strh
unsigned int trackId() const
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
tuple MeasurementTrackerEvent
TrajectoryStateOnSurface const & updatedState() const
TH2F * hPullGPXvsGPZ_shst
std::map< std::string, TH1F * > hPullS_shst
const PSimHit * pSimHit(unsigned int tkId, DetId detId)
int layer(const GeomDet *det)
std::map< std::string, TH1F * > hPullY_shst
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
Global3DPoint position(const PSimHit *sh) const
std::map< std::string, TH1F * > hPullM_strh
std::map< unsigned int, std::vector< PSimHit * > > idHitsMap
std::map< std::string, TH1F * > hPullY_strh
unsigned int detUnitId() const
TH2F * hPullGPXvsGPphi_shst
std::map< std::string, TH1F * > hPullGP_X_shst