37 file =
new TFile(
"out.root",
"recreate");
38 hchi2seedAll =
new TH1F(
"hchi2seedAll",
"hchi2seedAll",2000,0,200);
39 hchi2seedProb =
new TH1F(
"hchi2seedProb",
"hchi2seedProb",2000,0,200);
55 for (
int i=0;
i!=17;
i++){
59 std::stringstream
title;
60 for (
int i=0;
i!=6;
i++)
61 for (
int j=0;
j!=9;
j++){
62 if (
i==0 &&
j>2)
break;
63 if (
i==1 &&
j>1)
break;
64 if (
i==2 &&
j>3)
break;
65 if (
i==3 &&
j>2)
break;
66 if (
i==4 &&
j>5)
break;
67 if (
i==5 &&
j>8)
break;
74 title <<
"pullX_" << i+1 <<
"-" <<
j+1 <<
"_sh-rh";
75 hPullX_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
77 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
78 hPullY_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
80 title <<
"pullX_" << i+1 <<
"-" << j+1 <<
"_sh-st";
81 hPullX_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
83 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_sh-st";
84 hPullY_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
86 title <<
"pullX_" << i+1 <<
"-" << j+1 <<
"_st-rh";
87 hPullX_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
89 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_st-rh";
90 hPullY_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
92 title <<
"PullGP_X_" << i+1 <<
"-" << j+1 <<
"_sh-st";
93 hPullGP_X_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
95 title <<
"PullGP_Y_" << i+1 <<
"-" << j+1 <<
"_sh-st";
96 hPullGP_Y_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
98 title <<
"PullGP_Z_" << i+1 <<
"-" << j+1 <<
"_sh-st";
99 hPullGP_Z_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
100 if ( ((i==2||i==4)&&(j==0||j==1)) || (i==3||i==5) ){
102 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
103 hPullM_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
105 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
106 hPullS_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
108 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_sh-st";
109 hPullM_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
111 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_sh-st";
112 hPullS_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
114 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_st-rh";
115 hPullM_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
117 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_st-rh";
118 hPullS_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
122 hPullGPXvsGPX_shst =
new TH2F(
"PullGPXvsGPX_shst",
"PullGPXvsGPX_shst",1000,-50,50,100,-50,50);
123 hPullGPXvsGPY_shst =
new TH2F(
"PullGPXvsGPY_shst",
"PullGPXvsGPY_shst",1000,-50,50,100,-50,50);
124 hPullGPXvsGPZ_shst =
new TH2F(
"PullGPXvsGPZ_shst",
"PullGPXvsGPZ_shst",1000,-50,50,200,-100,100);
125 hPullGPXvsGPr_shst =
new TH2F(
"PullGPXvsGPr_shst",
"PullGPXvsGPr_shst",1000,-50,50,300,-150,150);
126 hPullGPXvsGPeta_shst =
new TH2F(
"PullGPXvsGPeta_shst",
"PullGPXvsGPeta_shst",1000,-50,50,50,-2.5,2.5);
127 hPullGPXvsGPphi_shst =
new TH2F(
"PullGPXvsGPphi_shst",
"PullGPXvsGPphi_shst",1000,-50,50,63,0,6.3);
160 for (
std::map<
unsigned int, std::vector<PSimHit> >::iterator it=theHitsMap.begin();
161 it!=theHitsMap.end();it++){
162 for (std::vector<PSimHit>::iterator isim = it->second.begin();
163 isim != it->second.end(); ++isim){
164 idHitsMap[isim->trackId()].push_back(&*isim);
168 for (
std::map<
unsigned int,std::vector<PSimHit*> >::iterator it=
idHitsMap.begin();
171 for (std::vector<PSimHit*>::iterator isim = it->second.begin();
172 isim != it->second.end(); ++isim){
184 <<
" r=" << pos.
perp() <<
" phi=" << pos.
phi()
185 <<
" trackId=" << hit.
trackId()
187 <<
" pabs=" << hit.
pabs()
188 <<
" processType=" << hit. processType();
193 const std::vector<TrajectoryMeasurement>& meas,
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())
LogTrace(
"CkfDebugger") <<
"valid hit at position:" << tmpIt->recHit()->globalPosition() ;
209 unsigned int trajId = 0;
211 LogTrace(
"CkfDebugger") <<
"trajectory not correct" ;
214 LogTrace(
"CkfDebugger") <<
"correct trajectory" ;
218 LogTrace(
"CkfDebugger") <<
"Seed has delta" ;
226 std::vector<const PSimHit*> correctHits =
nextCorrectHits(traj, trajId);
227 if ( correctHits.size() == 0)
return true;
229 for (std::vector<const PSimHit*>::iterator corHit=correctHits.begin();corHit!=correctHits.end();corHit++){
230 for (std::vector<TM>::const_iterator
i=meas.begin();
i!=meas.end();
i++) {
232 LogTrace(
"CkfDebugger") <<
"Correct hit found at position " <<
i-meas.begin() ;
240 const PSimHit* correctHit = *(correctHits.begin());
243 edm::LogVerbatim(
"CkfDebugger") << std::endl <<
"CkfDebugger: problem found: correct hit not found by findCompatibleMeasurements" ;
245 edm::LogVerbatim(
"CkfDebugger") <<
"The size of the meas vector is " << meas.size() ;
248 for (std::vector<TM>::const_iterator
i=meas.begin();
i!=meas.end();
i++) {
249 edm::LogVerbatim(
"CkfDebugger") <<
"Is the hit valid? " <<
i->recHit()->isValid() ;
250 if (
i->recHit()->isValid()) {
252 <<
" layer " << ((
i->recHit()->det()->geographicalId().rawId() >>16) & 0xF)
253 <<
" subdet " <<
i->recHit()->det()->geographicalId().subdetId()
254 <<
" Chi2 " <<
i->estimate() ;
256 else if (
i->recHit()->det() == 0) {
257 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid RecHit returned with zero Det pointer" ;
259 else if (
i->recHit()->det() ==
det(correctHit)) {
263 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid hit returned in Det at gpos " <<
i->recHit()->det()->position()
264 <<
" correct Det is at " <<
det(correctHit)->
position() ;
269 std::pair<CTTRHp, double> correctRecHit =
271 if (correctRecHit.first==0 ) {
273 if ( fabs(correctRecHit.second-0)<0.01 ) {
dump[1]++;}
274 if ( fabs(correctRecHit.second+1)<0.01 ) {
dump[8]++;}
275 if ( fabs(correctRecHit.second+2)<0.01 ) {
dump[9]++;}
276 if ( fabs(correctRecHit.second+3)<0.01 ) {
dump[10]++;}
277 if ( fabs(correctRecHit.second+4)<0.01 ) {
dump[11]++;}
278 if ( fabs(correctRecHit.second+5)<0.01 ) {
dump[12]++;}
279 if ( fabs(correctRecHit.second+6)<0.01 ) {
dump[13]++;}
280 if ( fabs(correctRecHit.second+7)<0.01 ) {
dump[14]++;}
281 if ( fabs(correctRecHit.second+8)<0.01 ) {
dump[15]++;}
287 if (correctRecHit.second>30) {
288 edm::LogVerbatim(
"CkfDebugger") <<
"Outling RecHit at pos=" << correctRecHit.first->globalPosition()
289 <<
" from SimHit at pos="<<
position(correctHit)
294 dump5[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
299 dump3[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
310 edm::LogVerbatim(
"CkfDebugger") <<
"no deltas in the seed. What is wrong?" ;
316 int subdetId = correctRecHit.first->det()->geographicalId().subdetId();
317 int layerId =
layer(correctRecHit.first->det());
320 LogTrace(
"CkfDebugger") <<
"position(correctHit)=" <<
position(correctHit) ;
321 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->globalPosition()=" << correctRecHit.first->globalPosition() ;
326 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPosition()=" << correctRecHit.first->localPosition() ;
327 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPositionError()=" << correctRecHit.first->localPositionError() ;
332 double pullx_shrh = (correctHit->
localPosition().
x()-correctRecHit.first->localPosition().x())/
333 sqrt(correctRecHit.first->localPositionError().xx());
334 double pully_shrh = 0;
335 if (correctRecHit.first->localPositionError().yy()!=0)
336 pully_shrh = (correctHit->
localPosition().
y()-correctRecHit.first->localPosition().y())/
337 sqrt(correctRecHit.first->localPositionError().yy());
343 LogTrace(
"CkfDebugger") <<
"pullx(sh-rh)=" << pullx_shrh ;
344 LogTrace(
"CkfDebugger") <<
"pully(sh-rh)=" << pully_shrh ;
345 LogTrace(
"CkfDebugger") <<
"pullx(sh-st)=" << pullx_shst ;
346 LogTrace(
"CkfDebugger") <<
"pully(sh-st)=" << pully_shst ;
348 LogTrace(
"CkfDebugger") <<
"pullx(st-rh)=" << (detState.
localPosition().
x()-correctRecHit.first->localPosition().x())/
351 std::pair<double,double> pulls =
computePulls(correctRecHit.first, detState);
352 if (subdetId>0 &&subdetId<7 && layerId>0 && layerId<10) {
355 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-rh";
358 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-rh";
361 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-st";
364 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-st";
367 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_st-rh";
370 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_st-rh";
376 double pullGPx = (shGPos.
x()-stGPos.
x())/
sqrt(stGPosErr.
cxx());
378 title <<
"PullGP_X_" << subdetId <<
"-" << layerId <<
"_sh-st";
381 title <<
"PullGP_Y_" << subdetId <<
"-" << layerId <<
"_sh-st";
384 title <<
"PullGP_Z_" << subdetId <<
"-" << layerId <<
"_sh-st";
387 if (subdetId==3&&layerId==1){
395 if (dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())) {
396 LogTrace(
"CkfDebugger") <<
"MONO HIT";
397 auto m =
dynamic_cast<const SiStripMatchedRecHit2D*
>(correctRecHit.first->hit())->monoHit();
401 double pullM_shrh = (sMonoHit.
localPosition().
x()-tMonoHit->localPosition().x())/
402 sqrt(tMonoHit->localPositionError().xx());
405 std::pair<double,double> pullsMono =
computePulls(tMonoHit, monoState);
407 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-rh";
410 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-st";
413 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_st-rh";
416 LogTrace(
"CkfDebugger") <<
"STEREO HIT";
417 auto s=
dynamic_cast<const SiStripMatchedRecHit2D*
>(correctRecHit.first->hit())->stereoHit();
421 double pullS_shrh = (sStereoHit.
localPosition().
x()-tStereoHit->localPosition().x())/
422 sqrt(tStereoHit->localPositionError().xx());
425 std::pair<double,double> pullsStereo =
computePulls(tStereoHit, stereoState);
427 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-rh";
430 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-st";
433 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_st-rh";
437 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result: wrong det or layer id "
438 << subdetId <<
" " << layerId <<
" "
439 << correctRecHit.first->det()->geographicalId().rawId();
445 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result " << correctRecHit.second ;
451 dump2[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
454 dump4[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
456 if (correctRecHit.second>30) {
466 LogTrace(
"CkfDebugger") <<
"now in correctTrajectory" ;
470 if (currentTrackId.size() == 0)
return false;
472 for (Trajectory::RecHitContainer::const_iterator rh=hits.begin(); rh!=hits.end(); ++rh) {
475 if (!(*rh)->hit()->isValid()) {
481 bool nogoodhit =
true;
483 for (std::vector<PSimHit>::iterator shit=assSimHits.begin();shit!=assSimHits.end();shit++){
486 if (nogoodhit)
return false;
491 for (std::vector<SimHitIdpr>::iterator
i=currentTrackId.begin();
i!=currentTrackId.end();
i++){
492 for (std::vector<SimHitIdpr>::iterator
j=nextTrackId.begin();
j!=nextTrackId.end();
j++){
493 if (
i->first ==
j->first) test =
false;
498 if (test) {
return false;}
508 LogTrace(
"CkfDebugger") <<
"now in assocTrackId" ;
510 if (!rechit->hit()->isValid()) {
526 std::vector<const PSimHit*>
result;
528 LogTrace(
"CkfDebugger") <<
"now in nextCorrectHits" ;
533 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
534 ch!=comp.end(); ++ch) {
535 if ((*ch)->globalPosition().mag() > maxR) lastRecHit = *ch;
536 maxR = (*ch)->globalPosition().mag();
539 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: lastRecHit is at gpos " << lastRecHit->globalPosition()
540 <<
" layer " <<
layer((lastRecHit->det()))
541 <<
" subdet " << lastRecHit->det()->geographicalId().subdetId() ;
545 for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
547 LogTrace(
"CkfDebugger") <<
"from hitAssociator SimHits are at GP=" << detUnit->
toGlobal( shit->localPosition())
548 <<
" traId=" << shit->trackId() <<
" particleType " << shit->particleType()
549 <<
" pabs=" << shit->pabs() <<
" detUnitId=" << shit->detUnitId() <<
" layer " <<
layer((
det(&*shit)))
555 if (!pSimHitVec.empty()) {
557 for (std::vector<PSimHit>::const_iterator ch=pSimHitVec.begin(); ch!=pSimHitVec.end(); ++ch) {
558 if ( ( ch->trackId()== trajId) && (ch->timeOfFlight() > maxTOF) && (
goodSimHit(*ch) )) {
565 if (lastPSH == 0)
return result;
569 std::vector<PSimHit*> trackHits =
idHitsMap[trajId];
570 if (fabs((
double)(trackHits.back()->detUnitId()-lastPSH->
detUnitId()))<1 )
return result;
571 std::vector<PSimHit*>::iterator currentIt = trackHits.end();
572 for (std::vector<PSimHit*>::iterator it=trackHits.begin();
573 it!=trackHits.end();it++){
581 result.push_back(*it);
586 bool samelayer =
true;
587 if (currentIt!=(trackHits.end()-1) && currentIt!=trackHits.end()) {
588 for (std::vector<PSimHit*>::iterator nextIt = currentIt; (samelayer && nextIt!=trackHits.end()) ;nextIt++){
592 result.push_back(*nextIt);
594 else samelayer =
false;
604 if (sh.
pabs() > 0.9)
return true;
611 LogTrace(
"CkfDebugger") <<
"now in associated" ;
613 if (!rechit->isValid())
return false;
617 for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
623 if ( ( fabs((*shit).timeOfFlight()-pSimHit.
timeOfFlight())<1
e-9 ) &&
624 ( fabs((*shit).pabs()-pSimHit.
pabs())<1
e-9 ) )
return true;
631 LogTrace(
"CkfDebugger") <<
"now in correctMeas" ;
633 if (recHit->isValid())
LogTrace(
"CkfDebugger") <<
"hit at position:" << recHit->globalPosition() ;
640 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
641 ch!=comp.end(); ++ch) {
644 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch2=comp.begin();
645 ch2!=comp.end(); ++ch2) {
646 if (ch2 == ch)
continue;
651 for (std::vector<SimHitIdpr>::iterator
j=ids.begin();
j!=ids.end();
j++){
653 if (correctHit->
trackId()==
j->first) {
677 LogTrace(
"CkfDebugger") <<
"now in analyseRecHitExistance" ;
679 std::pair<CTTRHp, double>
result;
687 if (!firstDetState.
isValid()) {
688 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to first det surface "
691 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
695 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
698 result = std::pair<CTTRHp, double>(*rh,
theChi2->
estimate( firstDetState, **rh).second);
699 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
700 << (**rh).localPosition()
701 <<
" gpos " << (**rh).globalPosition()
702 <<
" layer " <<
layer((**rh).det())
703 <<
" subdet " << (**rh).det()->geographicalId().subdetId()
708 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
709 edm::LogVerbatim(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
713 for (MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++)
714 edm::LogVerbatim(
"CkfDebugger") <<
"RH#" << y++ <<
" GP=" << (**rh).globalPosition() <<
" subdet=" << (**rh).det()->geographicalId().subdetId()
715 <<
" layer=" <<
layer((**rh).det()) ;
716 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
717 edm::LogVerbatim(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
724 if (!subdet.
glued()) {
725 edm::LogVerbatim(
"CkfDebugger") <<
"The DetUnit is not part of a GluedDet" ;
727 if (result.second>30){
728 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << result.first->parameters() ;
729 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << result.first->parametersError() ;
739 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
740 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
746 return std::pair<CTTRHp, double>((
CTTRHp)(0),-8);
754 edm::LogVerbatim(
"CkfDebugger") <<
"Partner DetUnit does not have a SimHit from the same track" ;
765 return std::pair<CTTRHp, double>(projHit,chi2);
770 <<
" lpos " << sh2->localPosition() ;
774 if (partnerDet == 0) {
777 return std::pair<CTTRHp, double>((
CTTRHp)(0),-3);
783 if (!secondDetState.
isValid()) {
784 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to second det surface "
787 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
790 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits2.begin(); rh != recHits2.end(); rh++) {
793 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
794 << (**rh).localPosition()
795 <<
" gpos " << (**rh).globalPosition()
801 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
802 LogTrace(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
803 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
804 LogTrace(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
811 if (found && found2) {
815 if ( gluedDet == 0) {
816 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger ERROR: glued MeasurementDet not found!" ;
818 return std::pair<CTTRHp, double>((
CTTRHp)(0),-4);
822 if (!gluedDetState.
isValid()) {
823 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to det surface "
826 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
829 gluedHits = gluedDet->
recHits( gluedDetState);
830 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: the GluedDet returned " << gluedHits.size() <<
" hits" ;
831 if (gluedHits.size()==0){
832 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits but not matched!!!" ;
834 return std::pair<CTTRHp, double>((
CTTRHp)(0),-5);
837 for ( MeasurementDet::RecHitContainer::const_iterator rh = gluedHits.begin(); rh != gluedHits.end(); rh++) {
840 edm::LogVerbatim(
"CkfDebugger") <<
"Matched hit at lpos " << (**rh).localPosition()
841 <<
" gpos " << (**rh).globalPosition()
842 <<
" has Chi2 " << chi2
844 result = std::pair<CTTRHp, double>(&**rh,chi2);
847 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << (*rh)->parameters() ;
848 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << (*rh)->parametersError() ;
858 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
859 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
864 if (found3)
return result;
866 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits. Matched found but not associated!!!" ;
868 return std::pair<CTTRHp, double>((
CTTRHp)(0),-6);
871 else if ( (found && !found2) || (!found && found2) ) {
874 return std::pair<CTTRHp, double>((
CTTRHp)(0),-7);
879 return std::pair<CTTRHp, double>((
CTTRHp)(0),-2);
882 return std::pair<CTTRHp, double>((
CTTRHp)(0),0);
888 if ( (*shi)->detUnitId() == detId.
rawId() &&
899 unsigned int correctDetId = correctRecHit->det()->geographicalId().rawId();
900 int correctLayId =
layer(correctRecHit->det());
901 LogTrace(
"CkfDebugger") <<
"correct layer id=" << correctLayId ;
912 bool navLayerAfter =
false;
914 for (std::vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
915 if ( dynamic_cast<const BarrelDetLayer*>(*il) ){
917 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().length()=" << pbl->
specificSurface().bounds().length() ;
918 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().width()=" << pbl->
specificSurface().bounds().width() ;
920 int layId =
layer(((*(*il)->basicComponents().begin())));
921 LogTrace(
"CkfDebugger") <<
" subdet=" << (*(*il)->basicComponents().begin())->geographicalId().subdetId() <<
"layer id=" << layId ;
922 if (layId==correctLayId) {
928 navLayerAfter =
true;
932 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer taken into account. layer id: " << correctLayId ;
933 }
else if (navLayerAfter){
934 edm::LogVerbatim(
"CkfDebugger")<<
"SimHit layer after the layers returned by Navigation.";
936 edm::LogVerbatim(
"CkfDebugger")<<
"check: " << (correctRecHit->det()->geographicalId().subdetId()) <<
" " << (
layer(correctRecHit->det()));
937 dump6[pair<int,int>((correctRecHit->det()->geographicalId().subdetId()-1),(
layer(correctRecHit->det()))-1)]++;
941 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer NOT taken into account. correct layer id: " << correctLayId ;
958 for (std::vector<DetWithState>::iterator
det=compatDets.begin();
det!=compatDets.end();
det++){
964 if (detId==
gluedId(correctRecHit->det()->geographicalId()).rawId()) {
971 edm::LogVerbatim(
"CkfDebugger") <<
"correct det taken into account. correctDetId is: " << correctDetId
972 <<
". please check chi2." ;
976 edm::LogVerbatim(
"CkfDebugger") <<
"correct det NOT taken into account. correctDetId: " << correctDetId ;
988 if ( pSimHitVec1.size()==0 || pSimHitVec2.size()==0 ||
hasDelta(&(*pSimHitVec1.begin())) ||
hasDelta(&(*pSimHitVec2.begin())) ) {
1000 if (pSimHitVec2.size()!=0) {
1001 const PSimHit& simHit = *pSimHitVec2.begin();
1043 LogTrace(
"CkfDebugger") <<
"chi2=" << chi2 ;
1053 for (
int it=0; it!=((int)(
dump.size())); it++)
1081 for (
int i=0;
i!=6;
i++)
1082 for (
int j=0;
j!=9;
j++){
1083 if (
i==0 &&
j>2)
break;
1084 if (
i==1 &&
j>1)
break;
1085 if (
i==2 &&
j>3)
break;
1086 if (
i==3 &&
j>2)
break;
1087 if (
i==4 &&
j>5)
break;
1088 if (
i==5 &&
j>8)
break;
1092 for (
int i=0;
i!=6;
i++)
1093 for (
int j=0;
j!=9;
j++){
1094 if (
i==0 &&
j>2)
break;
1095 if (
i==1 &&
j>1)
break;
1096 if (
i==2 &&
j>3)
break;
1097 if (
i==3 &&
j>2)
break;
1098 if (
i==4 &&
j>5)
break;
1099 if (
i==5 &&
j>8)
break;
1102 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with hit having chi2>30 for delta rays:" ;
1103 for (
int i=0;
i!=6;
i++)
1104 for (
int j=0;
j!=9;
j++){
1105 if (
i==0 &&
j>2)
break;
1106 if (
i==1 &&
j>1)
break;
1107 if (
i==2 &&
j>3)
break;
1108 if (
i==3 &&
j>2)
break;
1109 if (
i==4 &&
j>5)
break;
1110 if (
i==5 &&
j>8)
break;
1114 for (
int i=0;
i!=6;
i++)
1115 for (
int j=0;
j!=9;
j++){
1116 if (
i==0 &&
j>2)
break;
1117 if (
i==1 &&
j>1)
break;
1118 if (
i==2 &&
j>3)
break;
1119 if (
i==3 &&
j>2)
break;
1120 if (
i==4 &&
j>5)
break;
1121 if (
i==5 &&
j>8)
break;
1124 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with correct RecHit after missing Sim Hit:" ;
1125 for (
int i=0;
i!=6;
i++)
1126 for (
int j=0;
j!=9;
j++){
1127 if (
i==0 &&
j>2)
break;
1128 if (
i==1 &&
j>1)
break;
1129 if (
i==2 &&
j>3)
break;
1130 if (
i==3 &&
j>2)
break;
1131 if (
i==4 &&
j>5)
break;
1132 if (
i==5 &&
j>8)
break;
1137 std::stringstream
title;
1138 for (
int i=0;
i!=6;
i++)
1139 for (
int j=0;
j!=9;
j++){
1140 if (
i==0 &&
j>2)
break;
1141 if (
i==1 &&
j>1)
break;
1142 if (
i==2 &&
j>3)
break;
1143 if (
i==3 &&
j>2)
break;
1144 if (
i==4 &&
j>5)
break;
1145 if (
i==5 &&
j>8)
break;
1147 title <<
"pullX_" <<
i+1 <<
"-" <<
j+1 <<
"_sh-rh";
1150 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1153 title <<
"pullX_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1156 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1159 title <<
"pullX_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1162 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1165 title <<
"PullGP_X_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1168 title <<
"PullGP_Y_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1171 title <<
"PullGP_Z_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1173 if ( ((
i==2||
i==4)&&(j==0||j==1)) || (
i==3||
i==5) ){
1175 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1178 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1181 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1184 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1187 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1190 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
GlobalPoint globalPosition() const
std::map< std::string, TH1F * > hPullS_shrh
const TrackerTopology * theTopo
bool hasDelta(const PSimHit *correctHit)
std::pair< CTTRHp, double > analyseRecHitExistance(const PSimHit &sh, const TSOS &startingState)
std::map< std::string, TH1F * > hPullY_shst
bool correctMeas(const TM &tm, const PSimHit *correctHit) const
void printSimHits(const edm::Event &iEvent)
std::map< std::pair< int, int >, int > dump6
ConstRecHitPointer const & recHit() const
const MeasurementTracker * theMeasurementTracker
const LocalTrajectoryParameters & localParameters() const
std::pair< double, double > computePulls(CTTRHp recHit, TSOS startingState)
TH2F * hPullGPXvsGPeta_shst
void dumpSimHit(const SimHit &hit) const
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
const MagneticField * theMagField
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const =0
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::string, TH1F * > hPullGP_Z_shst
const GeometricSearchTracker * theGeomSearchTracker
TransientTrackingRecHit::ConstRecHitContainer RecHitContainer
virtual const GeomDet & geomDet() const
Geom::Phi< T > phi() const
const CartesianTrajectoryError cartesianError() const
std::map< std::string, TH1F * > hPullY_strh
GlobalPoint globalPosition() const
std::map< std::string, TH1F * > hPullM_shrh
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const Surface & surface() const
std::map< std::string, TH1F * > hPullX_shst
int partner_det_not_fuond
std::vector< const PSimHit * > nextCorrectHits(const Trajectory &, unsigned int &)
unsigned int partnerDetId() const
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit)
const Plane & surface() const
The nominal surface of the GeomDet.
std::map< std::string, TH1F * > hPullM_shst
LocalError positionError() const
std::vector< ConstRecHitPointer > RecHitContainer
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
const MeasurementEstimator * theChi2
unsigned int trackId() const
ConstRecHitContainer recHits(bool splitting=false) const
RecHitPointer project(const TransientTrackingRecHit &hit, const GeomDet &det, const TrajectoryStateOnSurface &ts) const
PropagationDirection const & direction() const
uint32_t rawId() const
get the raw id
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &) const =0
DataContainer const & measurements() const
AlgebraicVector5 vector() const
CkfDebugger(edm::EventSetup const &es)
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.)
std::map< std::string, TH1F * > hPullGP_Y_shst
int layer(const GeomDetUnit *det)
float timeOfFlight() const
double testSeed(CTTRHp, CTTRHp, TrajectoryStateOnSurface)
int matched_not_associated
Local3DPoint localPosition() const
bool associated(CTTRHp rechit, const PSimHit &sh) const
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
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.
TransientTrackingRecHit::ConstRecHitPointer CTTRHp
const AlgebraicSymMatrix55 & matrix() const
std::map< std::string, TH1F * > hPullX_shrh
const LocalTrajectoryError & localError() const
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::map< std::string, TH1F * > hPullGP_X_shst
const Surface::PositionType & position() const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
const Propagator * theForwardPropagator
bool correctTrajectory(const Trajectory &, unsigned int &) const
CLHEP::HepVector AlgebraicVector
std::map< std::string, TH1F * > hPullM_strh
TrajectoryMeasurement const & firstMeasurement() const
std::map< std::string, TH1F * > hPullS_shst
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const GlobalError position() const
Position error submatrix.
ConstRecHitContainer RecHitContainer
std::map< std::pair< int, int >, int > dump2
T const * product() const
std::map< std::string, TH1F * > hPullS_strh
unsigned short processType() const
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const TrackerGeometry * theTrackerGeom
const GeomDetUnit * det(const PSimHit *sh) const
bool goodSimHit(const PSimHit &sh) const
std::map< std::string, TH1F * > hPullY_shrh
TH2F * hPullGPXvsGPX_shst
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< PSimHit > associateHit(const TrackingRecHit &thit)
unsigned int trackId() const
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
std::map< std::string, TH1F * > hPullX_strh
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
TrajectoryStateOnSurface const & updatedState() const
TH2F * hPullGPXvsGPZ_shst
const PSimHit * pSimHit(unsigned int tkId, DetId detId)
std::map< std::pair< int, int >, int > dump5
Global3DPoint position(const PSimHit *sh) const
std::map< unsigned int, std::vector< PSimHit * > > idHitsMap
virtual const BoundCylinder & specificSurface() const GCC11_FINAL
Extension of the interface.
DetId gluedId(const DetId &du)
bool analyseCompatibleMeasurements(const Trajectory &, const std::vector< TrajectoryMeasurement > &, const MeasurementTracker *, const Propagator *, const Chi2MeasurementEstimatorBase *, const TransientTrackingRecHitBuilder *)
std::vector< const DetLayer * > nextLayers(Args &&...args) const
unsigned int detUnitId() const
std::map< std::pair< int, int >, int > dump4
TH2F * hPullGPXvsGPphi_shst
std::map< std::pair< int, int >, int > dump3