37 unsigned int mask = ~3;
46 trackerHitAssociatorConfig_(
std::
move(iC)),
50 file =
new TFile(
"out.root",
"recreate");
51 hchi2seedAll =
new TH1F(
"hchi2seedAll",
"hchi2seedAll", 2000, 0, 200);
52 hchi2seedProb =
new TH1F(
"hchi2seedProb",
"hchi2seedProb", 2000, 0, 200);
63 for (
int i = 0;
i != 17;
i++) {
67 std::stringstream
title;
68 for (
int i = 0;
i != 6;
i++)
69 for (
int j = 0;
j != 9;
j++) {
82 dump2[pair<int, int>(
i,
j)] = 0;
83 dump3[pair<int, int>(
i,
j)] = 0;
84 dump4[pair<int, int>(
i,
j)] = 0;
85 dump5[pair<int, int>(
i,
j)] = 0;
86 dump6[pair<int, int>(
i,
j)] = 0;
88 title <<
"pullX_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
91 title <<
"pullY_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
94 title <<
"pullX_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
97 title <<
"pullY_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
100 title <<
"pullX_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
103 title <<
"pullY_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
106 title <<
"PullGP_X_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
109 title <<
"PullGP_Y_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
112 title <<
"PullGP_Z_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
114 if (((
i == 2 ||
i == 4) && (
j == 0 ||
j == 1)) || (
i == 3 ||
i == 5)) {
116 title <<
"pullM_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
119 title <<
"pullS_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
122 title <<
"pullM_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
125 title <<
"pullS_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
128 title <<
"pullM_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
131 title <<
"pullS_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
136 hPullGPXvsGPX_shst =
new TH2F(
"PullGPXvsGPX_shst",
"PullGPXvsGPX_shst", 1000, -50, 50, 100, -50, 50);
137 hPullGPXvsGPY_shst =
new TH2F(
"PullGPXvsGPY_shst",
"PullGPXvsGPY_shst", 1000, -50, 50, 100, -50, 50);
138 hPullGPXvsGPZ_shst =
new TH2F(
"PullGPXvsGPZ_shst",
"PullGPXvsGPZ_shst", 1000, -50, 50, 200, -100, 100);
139 hPullGPXvsGPr_shst =
new TH2F(
"PullGPXvsGPr_shst",
"PullGPXvsGPr_shst", 1000, -50, 50, 300, -150, 150);
140 hPullGPXvsGPeta_shst =
new TH2F(
"PullGPXvsGPeta_shst",
"PullGPXvsGPeta_shst", 1000, -50, 50, 50, -2.5, 2.5);
141 hPullGPXvsGPphi_shst =
new TH2F(
"PullGPXvsGPphi_shst",
"PullGPXvsGPphi_shst", 1000, -50, 50, 63, 0, 6.3);
174 for (
std::map<
unsigned int, std::vector<PSimHit> >::iterator it = theHitsMap.begin(); it != theHitsMap.end(); it++) {
175 for (std::vector<PSimHit>::iterator isim = it->second.begin(); isim != it->second.end(); ++isim) {
176 idHitsMap[isim->trackId()].push_back(&*isim);
181 sort(it->second.begin(), it->second.end(), [](
auto*
a,
auto*
b) {
return a->timeOfFlight() <
b->timeOfFlight(); });
182 for (std::vector<PSimHit*>::iterator isim = it->second.begin(); isim != it->second.end(); ++isim) {
192 <<
" trackId=" <<
hit.trackId() <<
" particleType=" <<
hit.particleType()
193 <<
" pabs=" <<
hit.pabs() <<
" processType=" <<
hit.processType();
197 const std::vector<TrajectoryMeasurement>& meas,
202 LogTrace(
"CkfDebugger") <<
"\nnow in analyseCompatibleMeasurements";
203 LogTrace(
"CkfDebugger") <<
"number of input hits:" << meas.size();
204 for (std::vector<TrajectoryMeasurement>::const_iterator tmpIt = meas.begin(); tmpIt != meas.end(); tmpIt++) {
205 if (tmpIt->recHit()->isValid())
206 LogTrace(
"CkfDebugger") <<
"valid hit at position:" << tmpIt->recHit()->globalPosition();
213 unsigned int trajId = 0;
215 LogTrace(
"CkfDebugger") <<
"trajectory not correct";
218 LogTrace(
"CkfDebugger") <<
"correct trajectory";
224 LogTrace(
"CkfDebugger") <<
"Seed has delta";
232 std::vector<const PSimHit*> correctHits =
nextCorrectHits(traj, trajId);
233 if (correctHits.empty())
236 for (std::vector<const PSimHit*>::iterator corHit = correctHits.begin(); corHit != correctHits.end(); corHit++) {
237 for (std::vector<TM>::const_iterator
i = meas.begin();
i != meas.end();
i++) {
239 LogTrace(
"CkfDebugger") <<
"Correct hit found at position " <<
i - meas.begin();
247 const PSimHit* correctHit = *(correctHits.begin());
251 <<
"CkfDebugger: problem found: correct hit not found by findCompatibleMeasurements";
254 edm::LogVerbatim(
"CkfDebugger") <<
"The size of the meas vector is " << meas.size();
258 for (std::vector<TM>::const_iterator
i = meas.begin();
i != meas.end();
i++) {
259 edm::LogVerbatim(
"CkfDebugger") <<
"Is the hit valid? " <<
i->recHit()->isValid();
260 if (
i->recHit()->isValid()) {
261 edm::LogVerbatim(
"CkfDebugger") <<
"RecHit at " <<
i->recHit()->globalPosition() <<
" layer " 262 << ((
i->recHit()->det()->geographicalId().rawId() >> 16) & 0xF) <<
" subdet " 263 <<
i->recHit()->det()->geographicalId().subdetId() <<
" Chi2 " <<
i->estimate();
264 }
else if (
i->recHit()->det() ==
nullptr) {
265 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid RecHit returned with zero Det pointer";
266 }
else if (
i->recHit()->det() ==
det(correctHit)) {
269 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid hit returned in Det at gpos " <<
i->recHit()->det()->position()
270 <<
" correct Det is at " <<
det(correctHit)->
position();
276 if (correctRecHit.first ==
nullptr) {
278 if (fabs(correctRecHit.second - 0) < 0.01) {
281 if (fabs(correctRecHit.second + 1) < 0.01) {
284 if (fabs(correctRecHit.second + 2) < 0.01) {
287 if (fabs(correctRecHit.second + 3) < 0.01) {
290 if (fabs(correctRecHit.second + 4) < 0.01) {
293 if (fabs(correctRecHit.second + 5) < 0.01) {
296 if (fabs(correctRecHit.second + 6) < 0.01) {
299 if (fabs(correctRecHit.second + 7) < 0.01) {
302 if (fabs(correctRecHit.second + 8) < 0.01) {
309 if (correctRecHit.second > 30) {
310 edm::LogVerbatim(
"CkfDebugger") <<
"Outling RecHit at pos=" << correctRecHit.first->globalPosition()
311 <<
" from SimHit at pos=" <<
position(correctHit)
317 dump5[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
318 (
layer(correctRecHit.first->det())) - 1)]++;
323 dump3[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
324 (
layer(correctRecHit.first->det())) - 1)]++;
337 correctRecHit.first->det()->
surface());
342 int subdetId = correctRecHit.first->det()->geographicalId().subdetId();
343 int layerId =
layer(correctRecHit.first->det());
346 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->globalPosition()=" 347 << correctRecHit.first->globalPosition();
352 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPosition()=" 353 << correctRecHit.first->localPosition();
354 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPositionError()=" 355 << correctRecHit.first->localPositionError();
357 LogTrace(
"CkfDebugger") <<
"detState.localError().positionError()=" 360 LogTrace(
"CkfDebugger") <<
"simDetState.localError().positionError()=" 362 double pullx_shrh = (correctHit->
localPosition().
x() - correctRecHit.first->localPosition().x()) /
363 sqrt(correctRecHit.first->localPositionError().xx());
364 double pully_shrh = 0;
365 if (correctRecHit.first->localPositionError().yy() != 0)
366 pully_shrh = (correctHit->
localPosition().
y() - correctRecHit.first->localPosition().y()) /
367 sqrt(correctRecHit.first->localPositionError().yy());
373 LogTrace(
"CkfDebugger") <<
"pullx(sh-rh)=" << pullx_shrh;
374 LogTrace(
"CkfDebugger") <<
"pully(sh-rh)=" << pully_shrh;
375 LogTrace(
"CkfDebugger") <<
"pullx(sh-st)=" << pullx_shst;
376 LogTrace(
"CkfDebugger") <<
"pully(sh-st)=" << pully_shst;
378 LogTrace(
"CkfDebugger") <<
"pullx(st-rh)=" 379 << (detState.
localPosition().
x() - correctRecHit.first->localPosition().x()) /
380 sqrt(correctRecHit.first->localPositionError().xx() +
383 std::pair<double, double> pulls =
computePulls(correctRecHit.first, detState);
384 if (subdetId > 0 && subdetId < 7 && layerId > 0 && layerId < 10) {
387 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-rh";
390 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-rh";
393 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-st";
396 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-st";
399 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_st-rh";
402 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_st-rh";
408 double pullGPx = (shGPos.
x() - stGPos.
x()) /
sqrt(stGPosErr.
cxx());
410 title <<
"PullGP_X_" << subdetId <<
"-" << layerId <<
"_sh-st";
413 title <<
"PullGP_Y_" << subdetId <<
"-" << layerId <<
"_sh-st";
416 title <<
"PullGP_Z_" << subdetId <<
"-" << layerId <<
"_sh-st";
419 if (subdetId == 3 && layerId == 1) {
427 if (dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())) {
428 LogTrace(
"CkfDebugger") <<
"MONO HIT";
434 double pullM_shrh = (sMonoHit.
localPosition().
x() - tMonoHit->localPosition().x()) /
435 sqrt(tMonoHit->localPositionError().xx());
438 std::pair<double, double> pullsMono =
computePulls(tMonoHit, monoState);
440 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-rh";
443 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-st";
446 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_st-rh";
449 LogTrace(
"CkfDebugger") <<
"STEREO HIT";
455 double pullS_shrh = (sStereoHit.
localPosition().
x() - tStereoHit->localPosition().x()) /
456 sqrt(tStereoHit->localPositionError().xx());
459 std::pair<double, double> pullsStereo =
computePulls(tStereoHit, stereoState);
461 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-rh";
464 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-st";
467 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_st-rh";
472 <<
"unexpected result: wrong det or layer id " << subdetId <<
" " << layerId <<
" " 473 << correctRecHit.first->det()->geographicalId().rawId();
478 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result " << correctRecHit.second;
485 dump2[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
486 (
layer(correctRecHit.first->det())) - 1)]++;
489 dump4[pair<int, int>((correctRecHit.first->det()->geographicalId().subdetId() - 1),
490 (
layer(correctRecHit.first->det())) - 1)]++;
492 if (correctRecHit.second > 30) {
501 LogTrace(
"CkfDebugger") <<
"now in correctTrajectory";
505 if (currentTrackId.empty())
508 for (Trajectory::RecHitContainer::const_iterator rh =
hits.begin(); rh !=
hits.end(); ++rh) {
510 if (!(*rh)->hit()->isValid()) {
516 bool nogoodhit =
true;
518 for (std::vector<PSimHit>::iterator shit = assSimHits.begin(); shit != assSimHits.end(); shit++) {
528 for (std::vector<SimHitIdpr>::iterator
i = currentTrackId.begin();
i != currentTrackId.end();
i++) {
529 for (std::vector<SimHitIdpr>::iterator
j = nextTrackId.begin();
j != nextTrackId.end();
j++) {
530 if (
i->first ==
j->first)
547 LogTrace(
"CkfDebugger") <<
"now in assocTrackId";
549 if (!rechit->hit()->isValid()) {
562 std::vector<const PSimHit*>
result;
564 LogTrace(
"CkfDebugger") <<
"now in nextCorrectHits";
569 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch =
comp.begin(); ch !=
comp.end(); ++ch) {
570 if ((*ch)->globalPosition().mag() > maxR)
572 maxR = (*ch)->globalPosition().mag();
575 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: lastRecHit is at gpos " << lastRecHit->globalPosition() <<
" layer " 576 <<
layer((lastRecHit->det())) <<
" subdet " 577 << lastRecHit->det()->geographicalId().subdetId();
581 for (std::vector<PSimHit>::const_iterator shit = pSimHitVec.begin(); shit != pSimHitVec.end(); shit++) {
583 LogTrace(
"CkfDebugger") <<
"from hitAssociator SimHits are at GP=" << detUnit->
toGlobal(shit->localPosition())
584 <<
" traId=" << shit->trackId() <<
" particleType " << shit->particleType()
585 <<
" pabs=" << shit->pabs() <<
" detUnitId=" << shit->detUnitId() <<
" layer " 590 const PSimHit* lastPSH =
nullptr;
591 if (!pSimHitVec.empty()) {
593 for (std::vector<PSimHit>::const_iterator ch = pSimHitVec.begin(); ch != pSimHitVec.end(); ++ch) {
594 if ((ch->trackId() == trajId) && (ch->timeOfFlight() > maxTOF) && (
goodSimHit(*ch))) {
601 if (lastPSH ==
nullptr)
606 std::vector<PSimHit*> trackHits =
idHitsMap[trajId];
607 if (fabs((
double)(trackHits.back()->detUnitId() - lastPSH->
detUnitId())) < 1)
609 std::vector<PSimHit*>::iterator currentIt = trackHits.end();
610 for (std::vector<PSimHit*>::iterator it = trackHits.begin(); it != trackHits.end(); it++) {
623 bool samelayer =
true;
624 if (currentIt != (trackHits.end() - 1) && currentIt != trackHits.end()) {
625 for (std::vector<PSimHit*>::iterator nextIt = currentIt; (samelayer && nextIt != trackHits.end()); nextIt++) {
629 result.push_back(*nextIt);
647 LogTrace(
"CkfDebugger") <<
"now in associated";
649 if (!rechit->isValid())
654 for (std::vector<PSimHit>::const_iterator shit = pSimHitVec.begin(); shit != pSimHitVec.end(); shit++) {
668 LogTrace(
"CkfDebugger") <<
"now in correctMeas";
671 LogTrace(
"CkfDebugger") <<
"hit at position:" <<
recHit->globalPosition();
677 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch =
comp.begin(); ch !=
comp.end(); ++ch) {
680 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch2 =
comp.begin(); ch2 !=
comp.end(); ++ch2) {
687 for (std::vector<SimHitIdpr>::iterator
j = ids.begin();
j != ids.end();
j++) {
689 if (correctHit->
trackId() ==
j->first) {
695 LogTrace(
"CkfDebugger") <<
"returning false 1";
714 LogTrace(
"CkfDebugger") <<
"now in analyseRecHitExistance";
717 std::pair<CTTRHp, double>
result;
725 if (!firstDetState.
isValid()) {
726 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to first det surface " 729 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
733 for ( MeasurementDet::RecHitContainer::const_iterator rh =
recHits.begin(); rh !=
recHits.end(); rh++) {
737 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos " 738 << (**rh).localPosition()
739 <<
" gpos " << (**rh).globalPosition()
740 <<
" layer " <<
layer((**rh).det())
741 <<
" subdet " << (**rh).det()->geographicalId().subdetId()
746 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
751 for (MeasurementDet::RecHitContainer::const_iterator rh =
recHits.begin(); rh !=
recHits.end(); rh++)
752 edm::LogVerbatim(
"CkfDebugger") <<
"RH#" <<
y++ <<
" GP=" << (**rh).globalPosition() <<
" subdet=" << (**rh).det()->geographicalId().subdetId()
753 <<
" layer=" <<
layer((**rh).det()) ;
754 for ( MeasurementDet::RecHitContainer::const_iterator rh =
recHits.begin(); rh !=
recHits.end(); rh++) {
755 edm::LogVerbatim(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
762 if (!subdet.
glued()) {
763 edm::LogVerbatim(
"CkfDebugger") <<
"The DetUnit is not part of a GluedDet" ;
766 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" <<
result.first->parameters() ;
767 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" <<
result.first->parametersError() ;
770 LogTrace(
"CkfDebugger") <<
"me.measuredParameters(**rh)=" <<
me.measuredParameters(*
result.first) ;
771 LogTrace(
"CkfDebugger") <<
"me.measuredError(**rh)=" <<
me.measuredError(*
result.first) ;
777 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
778 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(
r) ;
784 return std::pair<CTTRHp, double>((
CTTRHp)(0),-8);
792 edm::LogVerbatim(
"CkfDebugger") <<
"Partner DetUnit does not have a SimHit from the same track" ;
795 TrackingRecHitProjector<ProjectedRecHit2D>
proj;
803 return std::pair<CTTRHp, double>(projHit,
chi2);
808 <<
" lpos " << sh2->localPosition() ;
812 if (partnerDet == 0) {
815 return std::pair<CTTRHp, double>((
CTTRHp)(0),-3);
821 if (!secondDetState.
isValid()) {
822 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to second det surface " 825 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
828 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits2.begin(); rh != recHits2.end(); rh++) {
831 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos " 832 << (**rh).localPosition()
833 <<
" gpos " << (**rh).globalPosition()
839 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
840 LogTrace(
"CkfDebugger") <<
" There are " <<
recHits.size() <<
" RecHits in the simHit DetUnit" ;
841 for ( MeasurementDet::RecHitContainer::const_iterator rh =
recHits.begin(); rh !=
recHits.end(); rh++) {
842 LogTrace(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
849 if (
found && found2) {
853 if ( gluedDet == 0) {
854 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger ERROR: glued MeasurementDet not found!" ;
856 return std::pair<CTTRHp, double>((
CTTRHp)(0),-4);
860 if (!gluedDetState.
isValid()) {
861 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to det surface " 864 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
867 gluedHits = gluedDet->
recHits( gluedDetState);
868 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: the GluedDet returned " << gluedHits.size() <<
" hits" ;
869 if (gluedHits.size()==0){
870 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits but not matched!!!" ;
872 return std::pair<CTTRHp, double>((
CTTRHp)(0),-5);
875 for ( MeasurementDet::RecHitContainer::const_iterator rh = gluedHits.begin(); rh != gluedHits.end(); rh++) {
878 edm::LogVerbatim(
"CkfDebugger") <<
"Matched hit at lpos " << (**rh).localPosition()
879 <<
" gpos " << (**rh).globalPosition()
880 <<
" has Chi2 " <<
chi2 882 result = std::pair<CTTRHp, double>(&**rh,
chi2);
885 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << (*rh)->parameters() ;
886 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << (*rh)->parametersError() ;
889 LogTrace(
"CkfDebugger") <<
"me.measuredParameters(**rh)=" <<
me.measuredParameters(**rh) ;
890 LogTrace(
"CkfDebugger") <<
"me.measuredError(**rh)=" <<
me.measuredError(**rh) ;
896 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
897 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(
r) ;
902 if (found3)
return result;
904 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits. Matched found but not associated!!!" ;
906 return std::pair<CTTRHp, double>((
CTTRHp)(0),-6);
909 else if ( (
found && !found2) || (!
found && found2) ) {
912 return std::pair<CTTRHp, double>((
CTTRHp)(0),-7);
917 return std::pair<CTTRHp, double>((
CTTRHp)(0),-2);
921 return std::pair<CTTRHp, double>((
CTTRHp)(
nullptr), 0);
925 for (std::vector<PSimHit*>::iterator shi =
idHitsMap[tkId].begin(); shi !=
idHitsMap[tkId].end(); ++shi) {
926 if ((*shi)->detUnitId() ==
detId.rawId() &&
936 unsigned int correctDetId = correctRecHit->det()->geographicalId().rawId();
937 int correctLayId =
layer(correctRecHit->det());
938 LogTrace(
"CkfDebugger") <<
"correct layer id=" << correctLayId;
941 std::vector<const DetLayer*> nl =
951 bool navLayerAfter =
false;
953 for (std::vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
954 if (dynamic_cast<const BarrelDetLayer*>(*il)) {
956 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().length()=" 958 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().width()=" << pbl->
specificSurface().bounds().width();
960 int layId =
layer(((*(*il)->basicComponents().begin())));
961 LogTrace(
"CkfDebugger") <<
" subdet=" << (*(*il)->basicComponents().begin())->geographicalId().subdetId()
962 <<
"layer id=" << layId;
963 if (layId == correctLayId) {
969 navLayerAfter =
true;
973 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer taken into account. layer id: " << correctLayId;
974 }
else if (navLayerAfter) {
975 edm::LogVerbatim(
"CkfDebugger") <<
"SimHit layer after the layers returned by Navigation.";
977 edm::LogVerbatim(
"CkfDebugger") <<
"check: " << (correctRecHit->det()->geographicalId().subdetId()) <<
" " 978 << (
layer(correctRecHit->det()));
979 dump6[pair<int, int>((correctRecHit->det()->geographicalId().subdetId() - 1), (
layer(correctRecHit->det())) - 1)]++;
983 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer NOT taken into account. correct layer id: " << correctLayId;
1000 for (std::vector<DetWithState>::iterator
det = compatDets.begin();
det != compatDets.end();
det++) {
1013 edm::LogVerbatim(
"CkfDebugger") <<
"correct det taken into account. correctDetId is: " << correctDetId
1014 <<
". please check chi2.";
1017 edm::LogVerbatim(
"CkfDebugger") <<
"correct det NOT taken into account. correctDetId: " << correctDetId;
1029 if (pSimHitVec1.empty() || pSimHitVec2.empty() ||
hasDelta(&(*pSimHitVec1.begin())) ||
1030 hasDelta(&(*pSimHitVec2.begin()))) {
1042 if (!pSimHitVec2.empty()) {
1045 double shlp1 = -1 /
simHit.momentumAtEntry().mag();
1046 double shlp2 =
simHit.momentumAtEntry().x() /
simHit.momentumAtEntry().z();
1047 double shlp3 =
simHit.momentumAtEntry().y() /
simHit.momentumAtEntry().z();
1048 double shlp4 =
simHit.localPosition().x();
1049 double shlp5 =
simHit.localPosition().y();
1084 double chi2 = ROOT::Math::Similarity(
v -
state.localParameters().vector(),
R);
1093 for (
int it = 0; it != ((
int)(
dump.size())); it++)
1121 for (
int i = 0;
i != 6;
i++)
1122 for (
int j = 0;
j != 9;
j++) {
1123 if (
i == 0 &&
j > 2)
1125 if (
i == 1 &&
j > 1)
1127 if (
i == 2 &&
j > 3)
1129 if (
i == 3 &&
j > 2)
1131 if (
i == 4 &&
j > 5)
1133 if (
i == 5 &&
j > 8)
1138 for (
int i = 0;
i != 6;
i++)
1139 for (
int j = 0;
j != 9;
j++) {
1140 if (
i == 0 &&
j > 2)
1142 if (
i == 1 &&
j > 1)
1144 if (
i == 2 &&
j > 3)
1146 if (
i == 3 &&
j > 2)
1148 if (
i == 4 &&
j > 5)
1150 if (
i == 5 &&
j > 8)
1154 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with hit having chi2>30 for delta rays:";
1155 for (
int i = 0;
i != 6;
i++)
1156 for (
int j = 0;
j != 9;
j++) {
1157 if (
i == 0 &&
j > 2)
1159 if (
i == 1 &&
j > 1)
1161 if (
i == 2 &&
j > 3)
1163 if (
i == 3 &&
j > 2)
1165 if (
i == 4 &&
j > 5)
1167 if (
i == 5 &&
j > 8)
1172 for (
int i = 0;
i != 6;
i++)
1173 for (
int j = 0;
j != 9;
j++) {
1174 if (
i == 0 &&
j > 2)
1176 if (
i == 1 &&
j > 1)
1178 if (
i == 2 &&
j > 3)
1180 if (
i == 3 &&
j > 2)
1182 if (
i == 4 &&
j > 5)
1184 if (
i == 5 &&
j > 8)
1188 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with correct RecHit after missing Sim Hit:";
1189 for (
int i = 0;
i != 6;
i++)
1190 for (
int j = 0;
j != 9;
j++) {
1191 if (
i == 0 &&
j > 2)
1193 if (
i == 1 &&
j > 1)
1195 if (
i == 2 &&
j > 3)
1197 if (
i == 3 &&
j > 2)
1199 if (
i == 4 &&
j > 5)
1201 if (
i == 5 &&
j > 8)
1207 std::stringstream
title;
1208 for (
int i = 0;
i != 6;
i++)
1209 for (
int j = 0;
j != 9;
j++) {
1210 if (
i == 0 &&
j > 2)
1212 if (
i == 1 &&
j > 1)
1214 if (
i == 2 &&
j > 3)
1216 if (
i == 3 &&
j > 2)
1218 if (
i == 4 &&
j > 5)
1220 if (
i == 5 &&
j > 8)
1223 title <<
"pullX_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
1226 title <<
"pullY_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
1229 title <<
"pullX_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
1232 title <<
"pullY_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
1235 title <<
"pullX_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
1238 title <<
"pullY_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
1241 title <<
"PullGP_X_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
1244 title <<
"PullGP_Y_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
1247 title <<
"PullGP_Z_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
1249 if (((
i == 2 ||
i == 4) && (
j == 0 ||
j == 1)) || (
i == 3 ||
i == 5)) {
1251 title <<
"pullM_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
1254 title <<
"pullS_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-rh";
1257 title <<
"pullM_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
1260 title <<
"pullS_" <<
i + 1 <<
"-" <<
j + 1 <<
"_sh-st";
1263 title <<
"pullM_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
1266 title <<
"pullS_" <<
i + 1 <<
"-" <<
j + 1 <<
"_st-rh";
Log< level::Info, true > LogVerbatim
unsigned int partnerDetId() const
std::map< std::string, TH1F * > hPullM_shst
const TrackerTopology * theTopo
bool hasDelta(const PSimHit *correctHit)
std::pair< CTTRHp, double > analyseRecHitExistance(const PSimHit &sh, const TSOS &startingState)
void printSimHits(const edm::Event &iEvent)
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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_
const LocalTrajectoryError & localError() const
std::map< std::string, TH1F * > hPullX_shrh
unsigned int detUnitId() const
LocalPoint localPosition() const
TH2F * hPullGPXvsGPeta_shst
void dumpSimHit(const SimHit &hit) const
virtual const GeomDet & geomDet() const
std::pair< double, double > computePulls(CTTRHp recHit, TSOS startingState)
const MagneticField * theMagField
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
const TransientTrackingRecHitBuilder * theTTRHBuilder
Geom::Phi< T > phi() const
std::map< std::pair< int, int >, int > dump6
const GeometricSearchTracker * theGeomSearchTracker
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
const MeasurementTrackerEvent * theMeasurementTracker
std::map< std::pair< int, int >, int > dump3
unsigned int glued() const
glued
Global3DPoint position(const PSimHit *sh) const
std::vector< ConstRecHitPointer > RecHitContainer
int assocTrackId(CTTRHp rechit) const
int partner_det_not_fuond
std::vector< const PSimHit * > nextCorrectHits(const Trajectory &, unsigned int &)
LocalError positionError() const
const SurfaceType & surface() const
bool correctMeas(const TM &tm, const PSimHit *correctHit) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
std::map< std::pair< int, int >, int > dump2
TrajectoryMeasurement const & lastMeasurement() const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
const CartesianTrajectoryError cartesianError() const
const MeasurementEstimator * theChi2
bool correctTrajectory(const Trajectory &, unsigned int &) const
DataContainer const & measurements() const
const GeomDetUnit * det(const PSimHit *sh) const
int analyseRecHitNotFound(const Trajectory &, CTTRHp)
const Surface::PositionType & position() const
GlobalPoint globalPosition() 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
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
const GlobalError position() const
Position error submatrix.
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
PropagationDirection const & direction() const
ConstRecHitContainer recHits() const
unsigned short processType() const
edm::ESGetToken< NavigationSchool, NavigationSchoolRecord > theNavToken
TH2F * hPullGPXvsGPr_shst
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&... args) const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
TrackerHitAssociator * hitAssociator
TH2F * hPullGPXvsGPY_shst
TransientTrackingRecHit::ConstRecHitPointer CTTRHp
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
unsigned int trackId() const
std::map< std::string, TH1F * > hPullY_shrh
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
bool associated(CTTRHp rechit, const PSimHit &sh) const
DetId geographicalId() const
The label of this GeomDet.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &) const =0
DetId gluedId(const DetId &du)
const Propagator * theForwardPropagator
CLHEP::HepVector AlgebraicVector
ConstRecHitContainer RecHitContainer
const Plane & surface() const
The nominal surface of the GeomDet.
std::map< std::string, TH1F * > hPullX_shst
constexpr uint32_t rawId() const
get the raw id
Local3DPoint localPosition() const
std::map< std::string, TH1F * > hPullGP_Y_shst
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
virtual const BoundCylinder & specificSurface() const final
Extension of the interface.
const Surface::PositionType & position() const
The position (origin of the R.F.)
TrajectoryStateOnSurface const & updatedState() const
const Surface & surface() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > theTrackerToken
const TrackerGeometry * theTrackerGeom
std::map< std::string, TH1F * > hPullM_shrh
TrackingRecHit::ConstRecHitContainer RecHitContainer
bool goodSimHit(const PSimHit &sh) const
TrajectoryMeasurement const & firstMeasurement() const
NavigationSchool const * theNavSchool
bool analyseCompatibleMeasurements(const Trajectory &, const std::vector< TrajectoryMeasurement > &, const MeasurementTrackerEvent *, const Propagator *, const Chi2MeasurementEstimatorBase *, const TransientTrackingRecHitBuilder *)
std::map< std::pair< int, int >, int > dump5
TH2F * hPullGPXvsGPX_shst
std::map< std::string, TH1F * > hPullGP_Z_shst
CLHEP::HepSymMatrix AlgebraicSymMatrix
void setConditions(edm::EventSetup const &es)
std::map< std::string, TH1F * > hPullX_strh
CkfDebugger(edm::ConsumesCollector iC)
edm::ESGetToken< TrackerTopology, IdealGeometryRecord > theTopoHandToken
float timeOfFlight() 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
std::map< std::string, TH1F * > hPullM_strh
std::map< unsigned int, std::vector< PSimHit * > > idHitsMap
std::map< std::string, TH1F * > hPullY_strh
TH2F * hPullGPXvsGPphi_shst
ConstRecHitPointer const & recHit() const
std::map< std::string, TH1F * > hPullGP_X_shst