39 file =
new TFile(
"out.root",
"recreate");
40 hchi2seedAll =
new TH1F(
"hchi2seedAll",
"hchi2seedAll",2000,0,200);
41 hchi2seedProb =
new TH1F(
"hchi2seedProb",
"hchi2seedProb",2000,0,200);
60 for (
int i=0;
i!=17;
i++){
64 std::stringstream
title;
65 for (
int i=0;
i!=6;
i++)
66 for (
int j=0;
j!=9;
j++){
67 if (
i==0 &&
j>2)
break;
68 if (
i==1 &&
j>1)
break;
69 if (
i==2 &&
j>3)
break;
70 if (
i==3 &&
j>2)
break;
71 if (
i==4 &&
j>5)
break;
72 if (
i==5 &&
j>8)
break;
79 title <<
"pullX_" << i+1 <<
"-" <<
j+1 <<
"_sh-rh";
80 hPullX_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
82 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
83 hPullY_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
85 title <<
"pullX_" << i+1 <<
"-" << j+1 <<
"_sh-st";
86 hPullX_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
88 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_sh-st";
89 hPullY_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
91 title <<
"pullX_" << i+1 <<
"-" << j+1 <<
"_st-rh";
92 hPullX_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
94 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_st-rh";
95 hPullY_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
97 title <<
"PullGP_X_" << i+1 <<
"-" << j+1 <<
"_sh-st";
98 hPullGP_X_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
100 title <<
"PullGP_Y_" << i+1 <<
"-" << j+1 <<
"_sh-st";
101 hPullGP_Y_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
103 title <<
"PullGP_Z_" << i+1 <<
"-" << j+1 <<
"_sh-st";
104 hPullGP_Z_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
105 if ( ((i==2||i==4)&&(j==0||j==1)) || (i==3||i==5) ){
107 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
108 hPullM_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
110 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
111 hPullS_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
113 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_sh-st";
114 hPullM_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
116 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_sh-st";
117 hPullS_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
119 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_st-rh";
120 hPullM_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
122 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_st-rh";
123 hPullS_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
127 hPullGPXvsGPX_shst =
new TH2F(
"PullGPXvsGPX_shst",
"PullGPXvsGPX_shst",1000,-50,50,100,-50,50);
128 hPullGPXvsGPY_shst =
new TH2F(
"PullGPXvsGPY_shst",
"PullGPXvsGPY_shst",1000,-50,50,100,-50,50);
129 hPullGPXvsGPZ_shst =
new TH2F(
"PullGPXvsGPZ_shst",
"PullGPXvsGPZ_shst",1000,-50,50,200,-100,100);
130 hPullGPXvsGPr_shst =
new TH2F(
"PullGPXvsGPr_shst",
"PullGPXvsGPr_shst",1000,-50,50,300,-150,150);
131 hPullGPXvsGPeta_shst =
new TH2F(
"PullGPXvsGPeta_shst",
"PullGPXvsGPeta_shst",1000,-50,50,50,-2.5,2.5);
132 hPullGPXvsGPphi_shst =
new TH2F(
"PullGPXvsGPphi_shst",
"PullGPXvsGPphi_shst",1000,-50,50,63,0,6.3);
165 for (
std::map<
unsigned int, std::vector<PSimHit> >::iterator it=theHitsMap.begin();
166 it!=theHitsMap.end();it++){
167 for (std::vector<PSimHit>::iterator isim = it->second.begin();
168 isim != it->second.end(); ++isim){
169 idHitsMap[isim->trackId()].push_back(&*isim);
173 for (
std::map<
unsigned int,std::vector<PSimHit*> >::iterator it=
idHitsMap.begin();
176 for (std::vector<PSimHit*>::iterator isim = it->second.begin();
177 isim != it->second.end(); ++isim){
189 <<
" r=" << pos.
perp() <<
" phi=" << pos.
phi()
190 <<
" trackId=" << hit.
trackId()
192 <<
" pabs=" << hit.
pabs()
193 <<
" processType=" << hit. processType();
198 const std::vector<TrajectoryMeasurement>& meas,
204 LogTrace(
"CkfDebugger") <<
"\nnow in analyseCompatibleMeasurements" ;
205 LogTrace(
"CkfDebugger") <<
"number of input hits:" << meas.size() ;
206 for(std::vector<TrajectoryMeasurement>::const_iterator tmpIt=meas.begin();tmpIt!=meas.end();tmpIt++){
207 if (tmpIt->recHit()->isValid())
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" ;
223 LogTrace(
"CkfDebugger") <<
"Seed has delta" ;
231 std::vector<const PSimHit*> correctHits =
nextCorrectHits(traj, trajId);
232 if ( correctHits.size() == 0)
return true;
234 for (std::vector<const PSimHit*>::iterator corHit=correctHits.begin();corHit!=correctHits.end();corHit++){
235 for (std::vector<TM>::const_iterator
i=meas.begin();
i!=meas.end();
i++) {
237 LogTrace(
"CkfDebugger") <<
"Correct hit found at position " <<
i-meas.begin() ;
245 const PSimHit* correctHit = *(correctHits.begin());
248 edm::LogVerbatim(
"CkfDebugger") << std::endl <<
"CkfDebugger: problem found: correct hit not found by findCompatibleMeasurements" ;
250 edm::LogVerbatim(
"CkfDebugger") <<
"The size of the meas vector is " << meas.size() ;
253 for (std::vector<TM>::const_iterator
i=meas.begin();
i!=meas.end();
i++) {
254 edm::LogVerbatim(
"CkfDebugger") <<
"Is the hit valid? " <<
i->recHit()->isValid() ;
255 if (
i->recHit()->isValid()) {
257 <<
" layer " << ((
i->recHit()->det()->geographicalId().rawId() >>16) & 0xF)
258 <<
" subdet " <<
i->recHit()->det()->geographicalId().subdetId()
259 <<
" Chi2 " <<
i->estimate() ;
261 else if (
i->recHit()->det() == 0) {
262 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid RecHit returned with zero Det pointer" ;
264 else if (
i->recHit()->det() ==
det(correctHit)) {
268 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid hit returned in Det at gpos " <<
i->recHit()->det()->position()
269 <<
" correct Det is at " <<
det(correctHit)->
position() ;
274 std::pair<CTTRHp, double> correctRecHit =
276 if (correctRecHit.first==0 ) {
278 if ( fabs(correctRecHit.second-0)<0.01 ) {
dump[1]++;}
279 if ( fabs(correctRecHit.second+1)<0.01 ) {
dump[8]++;}
280 if ( fabs(correctRecHit.second+2)<0.01 ) {
dump[9]++;}
281 if ( fabs(correctRecHit.second+3)<0.01 ) {
dump[10]++;}
282 if ( fabs(correctRecHit.second+4)<0.01 ) {
dump[11]++;}
283 if ( fabs(correctRecHit.second+5)<0.01 ) {
dump[12]++;}
284 if ( fabs(correctRecHit.second+6)<0.01 ) {
dump[13]++;}
285 if ( fabs(correctRecHit.second+7)<0.01 ) {
dump[14]++;}
286 if ( fabs(correctRecHit.second+8)<0.01 ) {
dump[15]++;}
292 if (correctRecHit.second>30) {
293 edm::LogVerbatim(
"CkfDebugger") <<
"Outling RecHit at pos=" << correctRecHit.first->globalPosition()
294 <<
" from SimHit at pos="<<
position(correctHit)
299 dump5[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
304 dump3[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
315 edm::LogVerbatim(
"CkfDebugger") <<
"no deltas in the seed. What is wrong?" ;
321 int subdetId = correctRecHit.first->det()->geographicalId().subdetId();
322 int layerId =
layer(correctRecHit.first->det());
325 LogTrace(
"CkfDebugger") <<
"position(correctHit)=" <<
position(correctHit) ;
326 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->globalPosition()=" << correctRecHit.first->globalPosition() ;
331 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPosition()=" << correctRecHit.first->localPosition() ;
332 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPositionError()=" << correctRecHit.first->localPositionError() ;
337 double pullx_shrh = (correctHit->
localPosition().
x()-correctRecHit.first->localPosition().x())/
338 sqrt(correctRecHit.first->localPositionError().xx());
339 double pully_shrh = 0;
340 if (correctRecHit.first->localPositionError().yy()!=0)
341 pully_shrh = (correctHit->
localPosition().
y()-correctRecHit.first->localPosition().y())/
342 sqrt(correctRecHit.first->localPositionError().yy());
348 LogTrace(
"CkfDebugger") <<
"pullx(sh-rh)=" << pullx_shrh ;
349 LogTrace(
"CkfDebugger") <<
"pully(sh-rh)=" << pully_shrh ;
350 LogTrace(
"CkfDebugger") <<
"pullx(sh-st)=" << pullx_shst ;
351 LogTrace(
"CkfDebugger") <<
"pully(sh-st)=" << pully_shst ;
353 LogTrace(
"CkfDebugger") <<
"pullx(st-rh)=" << (detState.
localPosition().
x()-correctRecHit.first->localPosition().x())/
356 std::pair<double,double> pulls =
computePulls(correctRecHit.first, detState);
357 if (subdetId>0 &&subdetId<7 && layerId>0 && layerId<10) {
360 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-rh";
363 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-rh";
366 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-st";
369 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-st";
372 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_st-rh";
375 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_st-rh";
381 double pullGPx = (shGPos.
x()-stGPos.
x())/
sqrt(stGPosErr.
cxx());
383 title <<
"PullGP_X_" << subdetId <<
"-" << layerId <<
"_sh-st";
386 title <<
"PullGP_Y_" << subdetId <<
"-" << layerId <<
"_sh-st";
389 title <<
"PullGP_Z_" << subdetId <<
"-" << layerId <<
"_sh-st";
392 if (subdetId==3&&layerId==1){
400 if (dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())) {
401 LogTrace(
"CkfDebugger") <<
"MONO HIT";
406 double pullM_shrh = (sMonoHit.
localPosition().
x()-tMonoHit->localPosition().x())/
407 sqrt(tMonoHit->localPositionError().xx());
410 std::pair<double,double> pullsMono =
computePulls(tMonoHit, monoState);
412 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-rh";
415 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-st";
418 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_st-rh";
421 LogTrace(
"CkfDebugger") <<
"STEREO HIT";
426 double pullS_shrh = (sStereoHit.
localPosition().
x()-tStereoHit->localPosition().x())/
427 sqrt(tStereoHit->localPositionError().xx());
430 std::pair<double,double> pullsStereo =
computePulls(tStereoHit, stereoState);
432 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-rh";
435 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-st";
438 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_st-rh";
442 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result: wrong det or layer id "
443 << subdetId <<
" " << layerId <<
" "
444 << correctRecHit.first->det()->geographicalId().rawId();
450 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result " << correctRecHit.second ;
456 dump2[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
459 dump4[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
461 if (correctRecHit.second>30) {
471 LogTrace(
"CkfDebugger") <<
"now in correctTrajectory" ;
475 if (currentTrackId.size() == 0)
return false;
477 for (Trajectory::RecHitContainer::const_iterator rh=hits.begin(); rh!=hits.end(); ++rh) {
480 if (!(*rh)->hit()->isValid()) {
486 bool nogoodhit =
true;
488 for (std::vector<PSimHit>::iterator shit=assSimHits.begin();shit!=assSimHits.end();shit++){
491 if (nogoodhit)
return false;
496 for (std::vector<SimHitIdpr>::iterator
i=currentTrackId.begin();
i!=currentTrackId.end();
i++){
497 for (std::vector<SimHitIdpr>::iterator
j=nextTrackId.begin();
j!=nextTrackId.end();
j++){
498 if (
i->first ==
j->first) test =
false;
503 if (test) {
return false;}
513 LogTrace(
"CkfDebugger") <<
"now in assocTrackId" ;
515 if (!rechit->hit()->isValid()) {
531 std::vector<const PSimHit*>
result;
533 LogTrace(
"CkfDebugger") <<
"now in nextCorrectHits" ;
538 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
539 ch!=comp.end(); ++ch) {
540 if ((*ch)->globalPosition().mag() > maxR) lastRecHit = *ch;
541 maxR = (*ch)->globalPosition().mag();
544 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: lastRecHit is at gpos " << lastRecHit->globalPosition()
545 <<
" layer " <<
layer((lastRecHit->det()))
546 <<
" subdet " << lastRecHit->det()->geographicalId().subdetId() ;
550 for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
552 LogTrace(
"CkfDebugger") <<
"from hitAssociator SimHits are at GP=" << detUnit->
toGlobal( shit->localPosition())
553 <<
" traId=" << shit->trackId() <<
" particleType " << shit->particleType()
554 <<
" pabs=" << shit->pabs() <<
" detUnitId=" << shit->detUnitId() <<
" layer " <<
layer((
det(&*shit)))
560 if (!pSimHitVec.empty()) {
562 for (std::vector<PSimHit>::const_iterator ch=pSimHitVec.begin(); ch!=pSimHitVec.end(); ++ch) {
563 if ( ( ch->trackId()== trajId) && (ch->timeOfFlight() > maxTOF) && (
goodSimHit(*ch) )) {
570 if (lastPSH == 0)
return result;
574 std::vector<PSimHit*> trackHits =
idHitsMap[trajId];
575 if (fabs((
double)(trackHits.back()->detUnitId()-lastPSH->
detUnitId()))<1 )
return result;
576 std::vector<PSimHit*>::iterator currentIt = trackHits.end();
577 for (std::vector<PSimHit*>::iterator it=trackHits.begin();
578 it!=trackHits.end();it++){
586 result.push_back(*it);
591 bool samelayer =
true;
592 if (currentIt!=(trackHits.end()-1) && currentIt!=trackHits.end()) {
593 for (std::vector<PSimHit*>::iterator nextIt = currentIt; (samelayer && nextIt!=trackHits.end()) ;nextIt++){
597 result.push_back(*nextIt);
599 else samelayer =
false;
609 if (sh.
pabs() > 0.9)
return true;
616 LogTrace(
"CkfDebugger") <<
"now in associated" ;
618 if (!rechit->isValid())
return false;
622 for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
628 if ( ( fabs((*shit).timeOfFlight()-pSimHit.
timeOfFlight())<1
e-9 ) &&
629 ( fabs((*shit).pabs()-pSimHit.
pabs())<1
e-9 ) )
return true;
636 LogTrace(
"CkfDebugger") <<
"now in correctMeas" ;
638 if (recHit->isValid())
LogTrace(
"CkfDebugger") <<
"hit at position:" << recHit->globalPosition() ;
645 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
646 ch!=comp.end(); ++ch) {
649 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch2=comp.begin();
650 ch2!=comp.end(); ++ch2) {
651 if (ch2 == ch)
continue;
656 for (std::vector<SimHitIdpr>::iterator
j=ids.begin();
j!=ids.end();
j++){
658 if (correctHit->
trackId()==
j->first) {
682 LogTrace(
"CkfDebugger") <<
"now in analyseRecHitExistance" ;
685 std::pair<CTTRHp, double>
result;
693 if (!firstDetState.
isValid()) {
694 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to first det surface "
697 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
701 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
704 result = std::pair<CTTRHp, double>(*rh,
theChi2->
estimate( firstDetState, **rh).second);
705 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
706 << (**rh).localPosition()
707 <<
" gpos " << (**rh).globalPosition()
708 <<
" layer " <<
layer((**rh).det())
709 <<
" subdet " << (**rh).det()->geographicalId().subdetId()
714 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
715 edm::LogVerbatim(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
719 for (MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++)
720 edm::LogVerbatim(
"CkfDebugger") <<
"RH#" << y++ <<
" GP=" << (**rh).globalPosition() <<
" subdet=" << (**rh).det()->geographicalId().subdetId()
721 <<
" layer=" <<
layer((**rh).det()) ;
722 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
723 edm::LogVerbatim(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
730 if (!subdet.
glued()) {
731 edm::LogVerbatim(
"CkfDebugger") <<
"The DetUnit is not part of a GluedDet" ;
733 if (result.second>30){
734 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << result.first->parameters() ;
735 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << result.first->parametersError() ;
745 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
746 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
752 return std::pair<CTTRHp, double>((
CTTRHp)(0),-8);
760 edm::LogVerbatim(
"CkfDebugger") <<
"Partner DetUnit does not have a SimHit from the same track" ;
763 TrackingRecHitProjector<ProjectedRecHit2D> proj;
767 CTTRHp projHit = proj.project( *result.first,gluedDet->
geomDet(),gluedTSOS).
get();
770 double chi2 =
theChi2->
estimate(gluedTSOS, *proj.project( *result.first,gluedDet->
geomDet(),gluedTSOS)).second;
771 return std::pair<CTTRHp, double>(projHit,chi2);
776 <<
" lpos " << sh2->localPosition() ;
780 if (partnerDet == 0) {
783 return std::pair<CTTRHp, double>((
CTTRHp)(0),-3);
789 if (!secondDetState.
isValid()) {
790 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to second det surface "
793 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
796 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits2.begin(); rh != recHits2.end(); rh++) {
799 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
800 << (**rh).localPosition()
801 <<
" gpos " << (**rh).globalPosition()
807 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
808 LogTrace(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
809 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
810 LogTrace(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
817 if (found && found2) {
821 if ( gluedDet == 0) {
822 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger ERROR: glued MeasurementDet not found!" ;
824 return std::pair<CTTRHp, double>((
CTTRHp)(0),-4);
828 if (!gluedDetState.
isValid()) {
829 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to det surface "
832 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
835 gluedHits = gluedDet->
recHits( gluedDetState);
836 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: the GluedDet returned " << gluedHits.size() <<
" hits" ;
837 if (gluedHits.size()==0){
838 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits but not matched!!!" ;
840 return std::pair<CTTRHp, double>((
CTTRHp)(0),-5);
843 for ( MeasurementDet::RecHitContainer::const_iterator rh = gluedHits.begin(); rh != gluedHits.end(); rh++) {
846 edm::LogVerbatim(
"CkfDebugger") <<
"Matched hit at lpos " << (**rh).localPosition()
847 <<
" gpos " << (**rh).globalPosition()
848 <<
" has Chi2 " << chi2
850 result = std::pair<CTTRHp, double>(&**rh,chi2);
853 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << (*rh)->parameters() ;
854 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << (*rh)->parametersError() ;
864 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
865 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
870 if (found3)
return result;
872 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits. Matched found but not associated!!!" ;
874 return std::pair<CTTRHp, double>((
CTTRHp)(0),-6);
877 else if ( (found && !found2) || (!found && found2) ) {
880 return std::pair<CTTRHp, double>((
CTTRHp)(0),-7);
885 return std::pair<CTTRHp, double>((
CTTRHp)(0),-2);
889 return std::pair<CTTRHp, double>((
CTTRHp)(0),0);
895 if ( (*shi)->detUnitId() == detId.
rawId() &&
906 unsigned int correctDetId = correctRecHit->det()->geographicalId().rawId();
907 int correctLayId =
layer(correctRecHit->det());
908 LogTrace(
"CkfDebugger") <<
"correct layer id=" << correctLayId ;
919 bool navLayerAfter =
false;
921 for (std::vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
922 if ( dynamic_cast<const BarrelDetLayer*>(*il) ){
924 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().length()=" << pbl->
specificSurface().bounds().length() ;
925 LogTrace(
"CkfDebugger") <<
"pbl->specificSurface().bounds().width()=" << pbl->
specificSurface().bounds().width() ;
927 int layId =
layer(((*(*il)->basicComponents().begin())));
928 LogTrace(
"CkfDebugger") <<
" subdet=" << (*(*il)->basicComponents().begin())->geographicalId().subdetId() <<
"layer id=" << layId ;
929 if (layId==correctLayId) {
935 navLayerAfter =
true;
939 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer taken into account. layer id: " << correctLayId ;
940 }
else if (navLayerAfter){
941 edm::LogVerbatim(
"CkfDebugger")<<
"SimHit layer after the layers returned by Navigation.";
943 edm::LogVerbatim(
"CkfDebugger")<<
"check: " << (correctRecHit->det()->geographicalId().subdetId()) <<
" " << (
layer(correctRecHit->det()));
944 dump6[pair<int,int>((correctRecHit->det()->geographicalId().subdetId()-1),(
layer(correctRecHit->det()))-1)]++;
948 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer NOT taken into account. correct layer id: " << correctLayId ;
965 for (std::vector<DetWithState>::iterator
det=compatDets.begin();
det!=compatDets.end();
det++){
971 if (detId==
gluedId(correctRecHit->det()->geographicalId()).rawId()) {
978 edm::LogVerbatim(
"CkfDebugger") <<
"correct det taken into account. correctDetId is: " << correctDetId
979 <<
". please check chi2." ;
983 edm::LogVerbatim(
"CkfDebugger") <<
"correct det NOT taken into account. correctDetId: " << correctDetId ;
995 if ( pSimHitVec1.size()==0 || pSimHitVec2.size()==0 ||
hasDelta(&(*pSimHitVec1.begin())) ||
hasDelta(&(*pSimHitVec2.begin())) ) {
1007 if (pSimHitVec2.size()!=0) {
1008 const PSimHit& simHit = *pSimHitVec2.begin();
1050 LogTrace(
"CkfDebugger") <<
"chi2=" << chi2 ;
1060 for (
int it=0; it!=((int)(
dump.size())); it++)
1088 for (
int i=0;
i!=6;
i++)
1089 for (
int j=0;
j!=9;
j++){
1090 if (
i==0 &&
j>2)
break;
1091 if (
i==1 &&
j>1)
break;
1092 if (
i==2 &&
j>3)
break;
1093 if (
i==3 &&
j>2)
break;
1094 if (
i==4 &&
j>5)
break;
1095 if (
i==5 &&
j>8)
break;
1099 for (
int i=0;
i!=6;
i++)
1100 for (
int j=0;
j!=9;
j++){
1101 if (
i==0 &&
j>2)
break;
1102 if (
i==1 &&
j>1)
break;
1103 if (
i==2 &&
j>3)
break;
1104 if (
i==3 &&
j>2)
break;
1105 if (
i==4 &&
j>5)
break;
1106 if (
i==5 &&
j>8)
break;
1109 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with hit having chi2>30 for delta rays:" ;
1110 for (
int i=0;
i!=6;
i++)
1111 for (
int j=0;
j!=9;
j++){
1112 if (
i==0 &&
j>2)
break;
1113 if (
i==1 &&
j>1)
break;
1114 if (
i==2 &&
j>3)
break;
1115 if (
i==3 &&
j>2)
break;
1116 if (
i==4 &&
j>5)
break;
1117 if (
i==5 &&
j>8)
break;
1121 for (
int i=0;
i!=6;
i++)
1122 for (
int j=0;
j!=9;
j++){
1123 if (
i==0 &&
j>2)
break;
1124 if (
i==1 &&
j>1)
break;
1125 if (
i==2 &&
j>3)
break;
1126 if (
i==3 &&
j>2)
break;
1127 if (
i==4 &&
j>5)
break;
1128 if (
i==5 &&
j>8)
break;
1131 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with correct RecHit after missing Sim Hit:" ;
1132 for (
int i=0;
i!=6;
i++)
1133 for (
int j=0;
j!=9;
j++){
1134 if (
i==0 &&
j>2)
break;
1135 if (
i==1 &&
j>1)
break;
1136 if (
i==2 &&
j>3)
break;
1137 if (
i==3 &&
j>2)
break;
1138 if (
i==4 &&
j>5)
break;
1139 if (
i==5 &&
j>8)
break;
1144 std::stringstream
title;
1145 for (
int i=0;
i!=6;
i++)
1146 for (
int j=0;
j!=9;
j++){
1147 if (
i==0 &&
j>2)
break;
1148 if (
i==1 &&
j>1)
break;
1149 if (
i==2 &&
j>3)
break;
1150 if (
i==3 &&
j>2)
break;
1151 if (
i==4 &&
j>5)
break;
1152 if (
i==5 &&
j>8)
break;
1154 title <<
"pullX_" <<
i+1 <<
"-" <<
j+1 <<
"_sh-rh";
1157 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1160 title <<
"pullX_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1163 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1166 title <<
"pullX_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1169 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1172 title <<
"PullGP_X_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1175 title <<
"PullGP_Y_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1178 title <<
"PullGP_Z_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1180 if ( ((
i==2||
i==4)&&(j==0||j==1)) || (
i==3||
i==5) ){
1182 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1185 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1188 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1191 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1194 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1197 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
GlobalPoint globalPosition() const
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
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
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
virtual const GeomDet & geomDet() const
Geom::Phi< T > phi() const
const CartesianTrajectoryError cartesianError() const
std::vector< ConstRecHitPointer > RecHitContainer
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
const Plane & surface() const
The nominal surface of the GeomDet.
std::map< std::string, TH1F * > hPullM_shst
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
uint32_t rawId() const
get the raw id
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
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
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
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
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 RecHitContainer recHits(const TrajectoryStateOnSurface &, const MeasurementTrackerEvent &) const =0
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
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
NavigationDirection.
T const * product() const
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
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
TrackingRecHit::ConstRecHitContainer RecHitContainer
const GeomDetUnit * det(const PSimHit *sh) const
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
NavigationSchool const * theNavSchool
bool goodSimHit(const PSimHit &sh) const
std::map< std::string, TH1F * > hPullY_shrh
TH2F * hPullGPXvsGPX_shst
CLHEP::HepSymMatrix AlgebraicSymMatrix
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
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
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
DetId gluedId(const DetId &du)
bool analyseCompatibleMeasurements(const Trajectory &, const std::vector< TrajectoryMeasurement > &, const MeasurementTracker *, const Propagator *, const Chi2MeasurementEstimatorBase *, const TransientTrackingRecHitBuilder *)
unsigned int detUnitId() const
std::map< std::pair< int, int >, int > dump4
TH2F * hPullGPXvsGPphi_shst
std::map< std::pair< int, int >, int > dump3