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);
49 for (
int i=0;
i!=17;
i++){
53 std::stringstream
title;
54 for (
int i=0;
i!=6;
i++)
55 for (
int j=0;
j!=9;
j++){
56 if (
i==0 &&
j>2)
break;
57 if (
i==1 &&
j>1)
break;
58 if (
i==2 &&
j>3)
break;
59 if (
i==3 &&
j>2)
break;
60 if (
i==4 &&
j>5)
break;
61 if (
i==5 &&
j>8)
break;
68 title <<
"pullX_" << i+1 <<
"-" <<
j+1 <<
"_sh-rh";
69 hPullX_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
71 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
72 hPullY_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
74 title <<
"pullX_" << i+1 <<
"-" << j+1 <<
"_sh-st";
75 hPullX_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
77 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_sh-st";
78 hPullY_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
80 title <<
"pullX_" << i+1 <<
"-" << j+1 <<
"_st-rh";
81 hPullX_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
83 title <<
"pullY_" << i+1 <<
"-" << j+1 <<
"_st-rh";
84 hPullY_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
86 title <<
"PullGP_X_" << i+1 <<
"-" << j+1 <<
"_sh-st";
87 hPullGP_X_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
89 title <<
"PullGP_Y_" << i+1 <<
"-" << j+1 <<
"_sh-st";
90 hPullGP_Y_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
92 title <<
"PullGP_Z_" << i+1 <<
"-" << j+1 <<
"_sh-st";
93 hPullGP_Z_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
94 if ( ((i==2||i==4)&&(j==0||j==1)) || (i==3||i==5) ){
96 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
97 hPullM_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
99 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_sh-rh";
100 hPullS_shrh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
102 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_sh-st";
103 hPullM_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
105 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_sh-st";
106 hPullS_shst[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
108 title <<
"pullM_" << i+1 <<
"-" << j+1 <<
"_st-rh";
109 hPullM_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
111 title <<
"pullS_" << i+1 <<
"-" << j+1 <<
"_st-rh";
112 hPullS_strh[title.str()] =
new TH1F(title.str().c_str(),title.str().c_str(),1000,-50,50);
116 hPullGPXvsGPX_shst =
new TH2F(
"PullGPXvsGPX_shst",
"PullGPXvsGPX_shst",1000,-50,50,100,-50,50);
117 hPullGPXvsGPY_shst =
new TH2F(
"PullGPXvsGPY_shst",
"PullGPXvsGPY_shst",1000,-50,50,100,-50,50);
118 hPullGPXvsGPZ_shst =
new TH2F(
"PullGPXvsGPZ_shst",
"PullGPXvsGPZ_shst",1000,-50,50,200,-100,100);
119 hPullGPXvsGPr_shst =
new TH2F(
"PullGPXvsGPr_shst",
"PullGPXvsGPr_shst",1000,-50,50,300,-150,150);
120 hPullGPXvsGPeta_shst =
new TH2F(
"PullGPXvsGPeta_shst",
"PullGPXvsGPeta_shst",1000,-50,50,50,-2.5,2.5);
121 hPullGPXvsGPphi_shst =
new TH2F(
"PullGPXvsGPphi_shst",
"PullGPXvsGPphi_shst",1000,-50,50,63,0,6.3);
154 for (
std::map<
unsigned int, std::vector<PSimHit> >::iterator it=theHitsMap.begin();
155 it!=theHitsMap.end();it++){
156 for (std::vector<PSimHit>::iterator isim = it->second.begin();
157 isim != it->second.end(); ++isim){
158 idHitsMap[isim->trackId()].push_back(&*isim);
162 for (
std::map<
unsigned int,std::vector<PSimHit*> >::iterator it=
idHitsMap.begin();
165 for (std::vector<PSimHit*>::iterator isim = it->second.begin();
166 isim != it->second.end(); ++isim){
178 <<
" r=" << pos.
perp() <<
" phi=" << pos.
phi()
179 <<
" trackId=" << hit.
trackId()
181 <<
" pabs=" << hit.
pabs()
182 <<
" processType=" << hit. processType();
187 const std::vector<TrajectoryMeasurement>& meas,
193 LogTrace(
"CkfDebugger") <<
"\nnow in analyseCompatibleMeasurements" ;
194 LogTrace(
"CkfDebugger") <<
"number of input hits:" << meas.size() ;
195 for(std::vector<TrajectoryMeasurement>::const_iterator tmpIt=meas.begin();tmpIt!=meas.end();tmpIt++){
196 if (tmpIt->recHit()->isValid())
LogTrace(
"CkfDebugger") <<
"valid hit at position:" << tmpIt->recHit()->globalPosition() ;
203 unsigned int trajId = 0;
205 LogTrace(
"CkfDebugger") <<
"trajectory not correct" ;
208 LogTrace(
"CkfDebugger") <<
"correct trajectory" ;
212 LogTrace(
"CkfDebugger") <<
"Seed has delta" ;
220 std::vector<const PSimHit*> correctHits =
nextCorrectHits(traj, trajId);
221 if ( correctHits.size() == 0)
return true;
223 for (std::vector<const PSimHit*>::iterator corHit=correctHits.begin();corHit!=correctHits.end();corHit++){
224 for (std::vector<TM>::const_iterator
i=meas.begin();
i!=meas.end();
i++) {
226 LogTrace(
"CkfDebugger") <<
"Correct hit found at position " <<
i-meas.begin() ;
234 const PSimHit* correctHit = *(correctHits.begin());
237 edm::LogVerbatim(
"CkfDebugger") << std::endl <<
"CkfDebugger: problem found: correct hit not found by findCompatibleMeasurements" ;
239 edm::LogVerbatim(
"CkfDebugger") <<
"The size of the meas vector is " << meas.size() ;
242 for (std::vector<TM>::const_iterator
i=meas.begin();
i!=meas.end();
i++) {
243 edm::LogVerbatim(
"CkfDebugger") <<
"Is the hit valid? " <<
i->recHit()->isValid() ;
244 if (
i->recHit()->isValid()) {
246 <<
" layer " << ((
i->recHit()->det()->geographicalId().rawId() >>16) & 0xF)
247 <<
" subdet " <<
i->recHit()->det()->geographicalId().subdetId()
248 <<
" Chi2 " <<
i->estimate() ;
250 else if (
i->recHit()->det() == 0) {
251 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid RecHit returned with zero Det pointer" ;
253 else if (
i->recHit()->det() ==
det(correctHit)) {
257 edm::LogVerbatim(
"CkfDebugger") <<
"Invalid hit returned in Det at gpos " <<
i->recHit()->det()->position()
258 <<
" correct Det is at " <<
det(correctHit)->
position() ;
263 std::pair<CTTRHp, double> correctRecHit =
265 if (correctRecHit.first==0 ) {
267 if ( fabs(correctRecHit.second-0)<0.01 ) {
dump[1]++;}
268 if ( fabs(correctRecHit.second+1)<0.01 ) {
dump[8]++;}
269 if ( fabs(correctRecHit.second+2)<0.01 ) {
dump[9]++;}
270 if ( fabs(correctRecHit.second+3)<0.01 ) {
dump[10]++;}
271 if ( fabs(correctRecHit.second+4)<0.01 ) {
dump[11]++;}
272 if ( fabs(correctRecHit.second+5)<0.01 ) {
dump[12]++;}
273 if ( fabs(correctRecHit.second+6)<0.01 ) {
dump[13]++;}
274 if ( fabs(correctRecHit.second+7)<0.01 ) {
dump[14]++;}
275 if ( fabs(correctRecHit.second+8)<0.01 ) {
dump[15]++;}
281 if (correctRecHit.second>30) {
282 edm::LogVerbatim(
"CkfDebugger") <<
"Outling RecHit at pos=" << correctRecHit.first->globalPosition()
283 <<
" from SimHit at pos="<<
position(correctHit)
288 dump5[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
293 dump3[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
304 edm::LogVerbatim(
"CkfDebugger") <<
"no deltas in the seed. What is wrong?" ;
310 int subdetId = correctRecHit.first->det()->geographicalId().subdetId();
311 int layerId =
layer(correctRecHit.first->det());
314 LogTrace(
"CkfDebugger") <<
"position(correctHit)=" <<
position(correctHit) ;
315 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->globalPosition()=" << correctRecHit.first->globalPosition() ;
320 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPosition()=" << correctRecHit.first->localPosition() ;
321 LogTrace(
"CkfDebugger") <<
"correctRecHit.first->localPositionError()=" << correctRecHit.first->localPositionError() ;
326 double pullx_shrh = (correctHit->
localPosition().
x()-correctRecHit.first->localPosition().x())/
327 sqrt(correctRecHit.first->localPositionError().xx());
328 double pully_shrh = 0;
329 if (correctRecHit.first->localPositionError().yy()!=0)
330 pully_shrh = (correctHit->
localPosition().
y()-correctRecHit.first->localPosition().y())/
331 sqrt(correctRecHit.first->localPositionError().yy());
337 LogTrace(
"CkfDebugger") <<
"pullx(sh-rh)=" << pullx_shrh ;
338 LogTrace(
"CkfDebugger") <<
"pully(sh-rh)=" << pully_shrh ;
339 LogTrace(
"CkfDebugger") <<
"pullx(sh-st)=" << pullx_shst ;
340 LogTrace(
"CkfDebugger") <<
"pully(sh-st)=" << pully_shst ;
342 LogTrace(
"CkfDebugger") <<
"pullx(st-rh)=" << (detState.
localPosition().
x()-correctRecHit.first->localPosition().x())/
345 std::pair<double,double> pulls =
computePulls(correctRecHit.first, detState);
346 if (subdetId>0 &&subdetId<7 && layerId>0 && layerId<10) {
349 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-rh";
352 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-rh";
355 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_sh-st";
358 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_sh-st";
361 title <<
"pullX_" << subdetId <<
"-" << layerId <<
"_st-rh";
364 title <<
"pullY_" << subdetId <<
"-" << layerId <<
"_st-rh";
370 double pullGPx = (shGPos.
x()-stGPos.
x())/
sqrt(stGPosErr.
cxx());
372 title <<
"PullGP_X_" << subdetId <<
"-" << layerId <<
"_sh-st";
375 title <<
"PullGP_Y_" << subdetId <<
"-" << layerId <<
"_sh-st";
378 title <<
"PullGP_Z_" << subdetId <<
"-" << layerId <<
"_sh-st";
381 if (subdetId==3&&layerId==1){
389 if (dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())) {
390 LogTrace(
"CkfDebugger") <<
"MONO HIT";
395 double pullM_shrh = (sMonoHit.
localPosition().
x()-tMonoHit->localPosition().x())/
396 sqrt(tMonoHit->localPositionError().xx());
399 std::pair<double,double> pullsMono =
computePulls(tMonoHit, monoState);
401 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-rh";
404 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_sh-st";
407 title <<
"pullM_" << subdetId <<
"-" << layerId <<
"_st-rh";
410 LogTrace(
"CkfDebugger") <<
"STEREO HIT";
415 double pullS_shrh = (sStereoHit.
localPosition().
x()-tStereoHit->localPosition().x())/
416 sqrt(tStereoHit->localPositionError().xx());
419 std::pair<double,double> pullsStereo =
computePulls(tStereoHit, stereoState);
421 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-rh";
424 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_sh-st";
427 title <<
"pullS_" << subdetId <<
"-" << layerId <<
"_st-rh";
431 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result: wrong det or layer id "
432 << subdetId <<
" " << layerId <<
" "
433 << correctRecHit.first->det()->geographicalId().rawId();
439 edm::LogVerbatim(
"CkfDebugger") <<
"unexpected result " << correctRecHit.second ;
445 dump2[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
448 dump4[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(
layer(correctRecHit.first->det()))-1)]++;
450 if (correctRecHit.second>30) {
460 LogTrace(
"CkfDebugger") <<
"now in correctTrajectory" ;
464 if (currentTrackId.size() == 0)
return false;
466 for (Trajectory::RecHitContainer::const_iterator rh=hits.begin(); rh!=hits.end(); ++rh) {
469 if (!(*rh)->hit()->isValid()) {
475 bool nogoodhit =
true;
477 for (std::vector<PSimHit>::iterator shit=assSimHits.begin();shit!=assSimHits.end();shit++){
480 if (nogoodhit)
return false;
485 for (std::vector<SimHitIdpr>::iterator
i=currentTrackId.begin();
i!=currentTrackId.end();
i++){
486 for (std::vector<SimHitIdpr>::iterator
j=nextTrackId.begin();
j!=nextTrackId.end();
j++){
487 if (
i->first ==
j->first) test =
false;
492 if (test) {
return false;}
502 LogTrace(
"CkfDebugger") <<
"now in assocTrackId" ;
504 if (!rechit->hit()->isValid()) {
520 std::vector<const PSimHit*>
result;
522 LogTrace(
"CkfDebugger") <<
"now in nextCorrectHits" ;
527 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
528 ch!=comp.end(); ++ch) {
529 if ((*ch)->globalPosition().mag() > maxR) lastRecHit = *ch;
530 maxR = (*ch)->globalPosition().mag();
533 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: lastRecHit is at gpos " << lastRecHit->globalPosition()
534 <<
" layer " <<
layer((lastRecHit->det()))
535 <<
" subdet " << lastRecHit->det()->geographicalId().subdetId() ;
539 for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
541 LogTrace(
"CkfDebugger") <<
"from hitAssociator SimHits are at GP=" << detUnit->
toGlobal( shit->localPosition())
542 <<
" traId=" << shit->trackId() <<
" particleType " << shit->particleType()
543 <<
" pabs=" << shit->pabs() <<
" detUnitId=" << shit->detUnitId() <<
" layer " <<
layer((
det(&*shit)))
549 if (!pSimHitVec.empty()) {
551 for (std::vector<PSimHit>::const_iterator ch=pSimHitVec.begin(); ch!=pSimHitVec.end(); ++ch) {
552 if ( ( ch->trackId()== trajId) && (ch->timeOfFlight() > maxTOF) && (
goodSimHit(*ch) )) {
559 if (lastPSH == 0)
return result;
563 std::vector<PSimHit*> trackHits =
idHitsMap[trajId];
564 if (fabs((
double)(trackHits.back()->detUnitId()-lastPSH->
detUnitId()))<1 )
return result;
565 std::vector<PSimHit*>::iterator currentIt = trackHits.end();
566 for (std::vector<PSimHit*>::iterator it=trackHits.begin();
567 it!=trackHits.end();it++){
575 result.push_back(*it);
580 bool samelayer =
true;
581 if (currentIt!=(trackHits.end()-1) && currentIt!=trackHits.end()) {
582 for (std::vector<PSimHit*>::iterator nextIt = currentIt; (samelayer && nextIt!=trackHits.end()) ;nextIt++){
586 result.push_back(*nextIt);
588 else samelayer =
false;
598 if (sh.
pabs() > 0.9)
return true;
605 LogTrace(
"CkfDebugger") <<
"now in associated" ;
607 if (!rechit->isValid())
return false;
611 for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
617 if ( ( fabs((*shit).timeOfFlight()-pSimHit.
timeOfFlight())<1
e-9 ) &&
618 ( fabs((*shit).pabs()-pSimHit.
pabs())<1
e-9 ) )
return true;
625 LogTrace(
"CkfDebugger") <<
"now in correctMeas" ;
627 if (recHit->isValid())
LogTrace(
"CkfDebugger") <<
"hit at position:" << recHit->globalPosition() ;
634 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
635 ch!=comp.end(); ++ch) {
638 for (TransientTrackingRecHit::RecHitContainer::const_iterator ch2=comp.begin();
639 ch2!=comp.end(); ++ch2) {
640 if (ch2 == ch)
continue;
645 for (std::vector<SimHitIdpr>::iterator
j=ids.begin();
j!=ids.end();
j++){
647 if (correctHit->
trackId()==
j->first) {
671 LogTrace(
"CkfDebugger") <<
"now in analyseRecHitExistance" ;
673 std::pair<CTTRHp, double>
result;
681 if (!firstDetState.
isValid()) {
682 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to first det surface "
685 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
689 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
692 result = std::pair<CTTRHp, double>(*rh,
theChi2->
estimate( firstDetState, **rh).second);
693 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
694 << (**rh).localPosition()
695 <<
" gpos " << (**rh).globalPosition()
696 <<
" layer " <<
layer((**rh).det())
697 <<
" subdet " << (**rh).det()->geographicalId().subdetId()
702 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
703 edm::LogVerbatim(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
707 for (MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++)
708 edm::LogVerbatim(
"CkfDebugger") <<
"RH#" << y++ <<
" GP=" << (**rh).globalPosition() <<
" subdet=" << (**rh).det()->geographicalId().subdetId()
709 <<
" layer=" <<
layer((**rh).det()) ;
710 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
711 edm::LogVerbatim(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
718 if (!subdet.
glued()) {
719 edm::LogVerbatim(
"CkfDebugger") <<
"The DetUnit is not part of a GluedDet" ;
721 if (result.second>30){
722 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << result.first->parameters() ;
723 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << result.first->parametersError() ;
733 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
734 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
740 return std::pair<CTTRHp, double>((
CTTRHp)(0),-8);
748 edm::LogVerbatim(
"CkfDebugger") <<
"Partner DetUnit does not have a SimHit from the same track" ;
759 return std::pair<CTTRHp, double>(projHit,chi2);
764 <<
" lpos " << sh2->localPosition() ;
768 if (partnerDet == 0) {
771 return std::pair<CTTRHp, double>((
CTTRHp)(0),-3);
777 if (!secondDetState.
isValid()) {
778 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to second det surface "
781 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
784 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits2.begin(); rh != recHits2.end(); rh++) {
787 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
788 << (**rh).localPosition()
789 <<
" gpos " << (**rh).globalPosition()
795 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: there is no RecHit associated to the correct SimHit." ;
796 LogTrace(
"CkfDebugger") <<
" There are " << recHits.size() <<
" RecHits in the simHit DetUnit" ;
797 for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
798 LogTrace(
"CkfDebugger") <<
"Non-associated RecHit at pos " << (**rh).localPosition() ;
805 if (found && found2) {
809 if ( gluedDet == 0) {
810 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger ERROR: glued MeasurementDet not found!" ;
812 return std::pair<CTTRHp, double>((
CTTRHp)(0),-4);
816 if (!gluedDetState.
isValid()) {
817 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: propagation failed from state " << startingState <<
" to det surface "
820 return std::pair<CTTRHp, double>((
CTTRHp)(0),-1);
823 gluedHits = gluedDet->
recHits( gluedDetState);
824 edm::LogVerbatim(
"CkfDebugger") <<
"CkfDebugger: the GluedDet returned " << gluedHits.size() <<
" hits" ;
825 if (gluedHits.size()==0){
826 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits but not matched!!!" ;
828 return std::pair<CTTRHp, double>((
CTTRHp)(0),-5);
831 for ( MeasurementDet::RecHitContainer::const_iterator rh = gluedHits.begin(); rh != gluedHits.end(); rh++) {
834 edm::LogVerbatim(
"CkfDebugger") <<
"Matched hit at lpos " << (**rh).localPosition()
835 <<
" gpos " << (**rh).globalPosition()
836 <<
" has Chi2 " << chi2
838 result = std::pair<CTTRHp, double>(&**rh,chi2);
841 LogTrace(
"CkfDebugger") <<
"rh->parameters()=" << (*rh)->parameters() ;
842 LogTrace(
"CkfDebugger") <<
"rh->parametersError()=" << (*rh)->parametersError() ;
852 LogTrace(
"CkfDebugger") <<
"R(-1)=" <<
R ;
853 LogTrace(
"CkfDebugger") <<
"chi2=" <<
R.similarity(r) ;
858 if (found3)
return result;
860 edm::LogVerbatim(
"CkfDebugger") <<
"Found and associated mono and stereo recHits. Matched found but not associated!!!" ;
862 return std::pair<CTTRHp, double>((
CTTRHp)(0),-6);
865 else if ( (found && !found2) || (!found && found2) ) {
868 return std::pair<CTTRHp, double>((
CTTRHp)(0),-7);
873 return std::pair<CTTRHp, double>((
CTTRHp)(0),-2);
876 return std::pair<CTTRHp, double>((
CTTRHp)(0),0);
882 if ( (*shi)->detUnitId() == detId.
rawId() &&
893 unsigned int correctDetId = correctRecHit->det()->geographicalId().rawId();
894 int correctLayId =
layer(correctRecHit->det());
895 LogTrace(
"CkfDebugger") <<
"correct layer id=" << correctLayId ;
906 bool navLayerAfter =
false;
908 for (std::vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
909 if ( dynamic_cast<const BarrelDetLayer*>(*il) ){
914 int layId =
layer(((*(*il)->basicComponents().begin())));
915 LogTrace(
"CkfDebugger") <<
" subdet=" << (*(*il)->basicComponents().begin())->geographicalId().subdetId() <<
"layer id=" << layId ;
916 if (layId==correctLayId) {
922 navLayerAfter =
true;
926 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer taken into account. layer id: " << correctLayId ;
927 }
else if (navLayerAfter){
928 edm::LogVerbatim(
"CkfDebugger")<<
"SimHit layer after the layers returned by Navigation.";
930 edm::LogVerbatim(
"CkfDebugger")<<
"check: " << (correctRecHit->det()->geographicalId().subdetId()) <<
" " << (
layer(correctRecHit->det()));
931 dump6[pair<int,int>((correctRecHit->det()->geographicalId().subdetId()-1),(
layer(correctRecHit->det()))-1)]++;
935 edm::LogVerbatim(
"CkfDebugger") <<
"correct layer NOT taken into account. correct layer id: " << correctLayId ;
952 for (std::vector<DetWithState>::iterator
det=compatDets.begin();
det!=compatDets.end();
det++){
958 if (detId==
gluedId(correctRecHit->det()->geographicalId()).rawId()) {
965 edm::LogVerbatim(
"CkfDebugger") <<
"correct det taken into account. correctDetId is: " << correctDetId
966 <<
". please check chi2." ;
970 edm::LogVerbatim(
"CkfDebugger") <<
"correct det NOT taken into account. correctDetId: " << correctDetId ;
982 if ( pSimHitVec1.size()==0 || pSimHitVec2.size()==0 ||
hasDelta(&(*pSimHitVec1.begin())) ||
hasDelta(&(*pSimHitVec2.begin())) ) {
994 if (pSimHitVec2.size()!=0) {
995 const PSimHit& simHit = *pSimHitVec2.begin();
1037 LogTrace(
"CkfDebugger") <<
"chi2=" << chi2 ;
1047 for (
int it=0; it!=((int)(
dump.size())); it++)
1075 for (
int i=0;
i!=6;
i++)
1076 for (
int j=0;
j!=9;
j++){
1077 if (
i==0 &&
j>2)
break;
1078 if (
i==1 &&
j>1)
break;
1079 if (
i==2 &&
j>3)
break;
1080 if (
i==3 &&
j>2)
break;
1081 if (
i==4 &&
j>5)
break;
1082 if (
i==5 &&
j>8)
break;
1086 for (
int i=0;
i!=6;
i++)
1087 for (
int j=0;
j!=9;
j++){
1088 if (
i==0 &&
j>2)
break;
1089 if (
i==1 &&
j>1)
break;
1090 if (
i==2 &&
j>3)
break;
1091 if (
i==3 &&
j>2)
break;
1092 if (
i==4 &&
j>5)
break;
1093 if (
i==5 &&
j>8)
break;
1096 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with hit having chi2>30 for delta rays:" ;
1097 for (
int i=0;
i!=6;
i++)
1098 for (
int j=0;
j!=9;
j++){
1099 if (
i==0 &&
j>2)
break;
1100 if (
i==1 &&
j>1)
break;
1101 if (
i==2 &&
j>3)
break;
1102 if (
i==3 &&
j>2)
break;
1103 if (
i==4 &&
j>5)
break;
1104 if (
i==5 &&
j>8)
break;
1108 for (
int i=0;
i!=6;
i++)
1109 for (
int j=0;
j!=9;
j++){
1110 if (
i==0 &&
j>2)
break;
1111 if (
i==1 &&
j>1)
break;
1112 if (
i==2 &&
j>3)
break;
1113 if (
i==3 &&
j>2)
break;
1114 if (
i==4 &&
j>5)
break;
1115 if (
i==5 &&
j>8)
break;
1118 edm::LogVerbatim(
"CkfDebugger") <<
"\nlayer with correct RecHit after missing Sim Hit:" ;
1119 for (
int i=0;
i!=6;
i++)
1120 for (
int j=0;
j!=9;
j++){
1121 if (
i==0 &&
j>2)
break;
1122 if (
i==1 &&
j>1)
break;
1123 if (
i==2 &&
j>3)
break;
1124 if (
i==3 &&
j>2)
break;
1125 if (
i==4 &&
j>5)
break;
1126 if (
i==5 &&
j>8)
break;
1131 std::stringstream
title;
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;
1141 title <<
"pullX_" <<
i+1 <<
"-" <<
j+1 <<
"_sh-rh";
1144 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1147 title <<
"pullX_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1150 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1153 title <<
"pullX_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1156 title <<
"pullY_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1159 title <<
"PullGP_X_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1162 title <<
"PullGP_Y_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1165 title <<
"PullGP_Z_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1167 if ( ((
i==2||
i==4)&&(j==0||j==1)) || (
i==3||
i==5) ){
1169 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1172 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_sh-rh";
1175 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1178 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_sh-st";
1181 title <<
"pullM_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
1184 title <<
"pullS_" <<
i+1 <<
"-" << j+1 <<
"_st-rh";
GlobalPoint globalPosition() const
std::map< std::string, TH1F * > hPullS_shrh
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
virtual float length() const =0
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
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const
Geom::Phi< T > phi() const
const CartesianTrajectoryError cartesianError() const
std::map< std::string, TH1F * > hPullY_strh
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
std::map< std::string, TH1F * > hPullM_shrh
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const BoundSurface & 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)
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)
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
TrajectoryStateOnSurface updatedState() const
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
const Bounds & bounds() 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
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
const GeomDetUnit * det(const PSimHit *sh) const
const BoundPlane & surface() const
The nominal surface of the GeomDet.
bool goodSimHit(const PSimHit &sh) const
std::map< std::string, TH1F * > hPullY_shrh
TH2F * hPullGPXvsGPX_shst
const Surface & surface() const
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
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 float width() const =0
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