CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CkfDebugger.cc
Go to the documentation of this file.
15 
18 
24 // #include "RecoTracker/TkDetLayers/interface/PixelBarrelLayer.h"
25 
28 
29 #include <iostream>
30 #include <iomanip>
31 #include <sstream>
32 
33 using namespace std;
34 
35 CkfDebugger::CkfDebugger( edm::EventSetup const & es ):totSeeds(0)
36 {
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);
40 
42  es.get<TrackerDigiGeometryRecord>().get(tracker);
43  theTrackerGeom = &(*tracker);
44 
46  es.get<IdealMagneticFieldRecord>().get(theField);
47  theMagField = &(*theField);
48 
49  for (int i=0; i!=17; i++){
50  dump.push_back(0);
51  }
52 
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;
62  dump2[pair<int,int>(i,j)]=0;
63  dump3[pair<int,int>(i,j)]=0;
64  dump4[pair<int,int>(i,j)]=0;
65  dump5[pair<int,int>(i,j)]=0;
66  dump6[pair<int,int>(i,j)]=0;
67  title.str("");
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);
70  title.str("");
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);
73  title.str("");
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);
76  title.str("");
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);
79  title.str("");
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);
82  title.str("");
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);
85  title.str("");
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);
88  title.str("");
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);
91  title.str("");
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) ){
95  title.str("");
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);
98  title.str("");
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);
101  title.str("");
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);
104  title.str("");
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);
107  title.str("");
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);
110  title.str("");
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);
113  }
114  }
115 
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);
122 
123  seedWithDelta=0;
124  problems=0;
125  no_sim_hit=0;
126  no_layer=0;
127  layer_not_found=0;
128  det_not_found=0;
129  chi2gt30=0;
130  chi2gt30delta=0;
132  chi2ls30=0;
134  no_component=0;
140  propagation=0;
141  other=0;
142  totchi2gt30=0;
143 }
144 
146 {
147  edm::LogVerbatim("CkfDebugger") << "\nEVENT #" << iEvent.id();
148 
149  hitAssociator = new TrackerHitAssociator(iEvent);//delete deleteHitAssociator() in TrackCandMaker.cc
150 
151  std::map<unsigned int, std::vector<PSimHit> >& theHitsMap = hitAssociator->SimHitMap;
152  idHitsMap.clear();
153 
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);
159  }
160  }
161 
162  for (std::map<unsigned int,std::vector<PSimHit*> >::iterator it=idHitsMap.begin();
163  it!=idHitsMap.end();it++){
164  sort(it->second.begin(),it->second.end(),less_mag());
165  for (std::vector<PSimHit*>::iterator isim = it->second.begin();
166  isim != it->second.end(); ++isim){
167  const GeomDetUnit* detUnit = theTrackerGeom->idToDetUnit( DetId((*isim)->detUnitId()));
168  dumpSimHit(SimHit( (*isim), detUnit));
169  }
170  }
171 
172 }
173 
175 {
177  edm::LogVerbatim("CkfDebugger") << "SimHit pos" << pos
178  << " r=" << pos.perp() << " phi=" << pos.phi()
179  << " trackId=" << hit.trackId()
180  << " particleType=" << hit.particleType()
181  << " pabs=" << hit.pabs()
182  << " processType=" << hit. processType();
183 }
184 
185 
187  const std::vector<TrajectoryMeasurement>& meas,
188  const MeasurementTracker* aMeasurementTracker,
189  const Propagator* propagator,
190  const Chi2MeasurementEstimatorBase* estimator,
191  const TransientTrackingRecHitBuilder* aTTRHBuilder)
192 {
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() ;
197  }
199  theChi2 = estimator;
200  theMeasurementTracker = aMeasurementTracker;
201  theGeomSearchTracker = theMeasurementTracker->geometricSearchTracker();
202  theTTRHBuilder = aTTRHBuilder;
203  unsigned int trajId = 0;
204  if ( !correctTrajectory(traj, trajId)) {
205  LogTrace("CkfDebugger") << "trajectory not correct" ;
206  return true;
207  } // only correct trajectories analysed
208  LogTrace("CkfDebugger") << "correct trajectory" ;
209 
210  if (traj.measurements().size() == 2){
211  if ( testSeed(traj.firstMeasurement().recHit(),traj.lastMeasurement().recHit(),traj.lastMeasurement().updatedState()) == -1 ) {
212  LogTrace("CkfDebugger") << "Seed has delta" ;
213  seedWithDelta++;
214  return false;//true;//false?
215  }
216  }
217 
218  //const PSimHit* correctHit = nextCorrectHit(traj, trajId);
219  //if ( correctHit == 0) return true; // no more simhits on this track
220  std::vector<const PSimHit*> correctHits = nextCorrectHits(traj, trajId);
221  if ( correctHits.size() == 0) return true; // no more simhits on this track
222 
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++) {
225  if (correctMeas( *i, *corHit)) {
226  LogTrace("CkfDebugger") << "Correct hit found at position " << i-meas.begin() ;
227  return true;
228  }
229  }
230  }
231 
232  //debug why the first hit in correctHits is not found
233  //FIXME should loop over all hits
234  const PSimHit* correctHit = *(correctHits.begin());
235 
236  // correct hit not found
237  edm::LogVerbatim("CkfDebugger") << std::endl << "CkfDebugger: problem found: correct hit not found by findCompatibleMeasurements" ;
238  edm::LogVerbatim("CkfDebugger") << "The correct hit position is " << position(correctHit) << " lp " << correctHit->localPosition() ;
239  edm::LogVerbatim("CkfDebugger") << "The size of the meas vector is " << meas.size() ;
240  dump[0]++;problems++;
241 
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()) {
245  edm::LogVerbatim("CkfDebugger") << "RecHit at " << i->recHit()->globalPosition()
246  << " layer " << ((i->recHit()->det()->geographicalId().rawId() >>16) & 0xF)
247  << " subdet " << i->recHit()->det()->geographicalId().subdetId()
248  << " Chi2 " << i->estimate() ;
249  }
250  else if (i->recHit()->det() == 0) {
251  edm::LogVerbatim("CkfDebugger") << "Invalid RecHit returned with zero Det pointer" ;
252  }
253  else if (i->recHit()->det() == det(correctHit)) {
254  edm::LogVerbatim("CkfDebugger") << "Invalid hit returned in correct Det" ;
255  }
256  else {
257  edm::LogVerbatim("CkfDebugger") << "Invalid hit returned in Det at gpos " << i->recHit()->det()->position()
258  << " correct Det is at " << det(correctHit)->position() ;
259  }
260  }
261 
262  //Look if the correct RecHit exists
263  std::pair<CTTRHp, double> correctRecHit =
264  analyseRecHitExistance( *correctHit, traj.lastMeasurement().updatedState());
265  if (correctRecHit.first==0 ) {
266  //the hit does not exist or is uncorrectly matched
267  if ( fabs(correctRecHit.second-0)<0.01 ) {dump[1]++;}//other
268  if ( fabs(correctRecHit.second+1)<0.01 ) {dump[8]++;}//propagation
269  if ( fabs(correctRecHit.second+2)<0.01 ) {dump[9]++;}//No component is found
270  if ( fabs(correctRecHit.second+3)<0.01 ) {dump[10]++;}//Partner measurementDet not found
271  if ( fabs(correctRecHit.second+4)<0.01 ) {dump[11]++;}//glued MeasurementDet not found
272  if ( fabs(correctRecHit.second+5)<0.01 ) {dump[12]++;}//matched not found
273  if ( fabs(correctRecHit.second+6)<0.01 ) {dump[13]++;}//Matched not associated
274  if ( fabs(correctRecHit.second+7)<0.01 ) {dump[14]++;}//Only one component is found
275  if ( fabs(correctRecHit.second+8)<0.01 ) {dump[15]++;}//not found (is not a glued det)
276  }
277  else {
278  //the hit exists: why wasn't it found?
279  int result = analyseRecHitNotFound(traj,correctRecHit.first);
280  if (result == 5){
281  if (correctRecHit.second>30) {
282  edm::LogVerbatim("CkfDebugger") << "Outling RecHit at pos=" << correctRecHit.first->globalPosition()
283  << " from SimHit at pos="<< position(correctHit)
284  << " det=" << correctHit->detUnitId() << " process=" << correctHit->processType() ;
285  if (hasDelta(correctHit)){
286  edm::LogVerbatim("CkfDebugger") << "there are deltas on this det" ;
287  chi2gt30delta++;
288  dump5[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(layer(correctRecHit.first->det()))-1)]++;
289  }else{
290  edm::LogVerbatim("CkfDebugger") << "no deltas on this det" ;
291  dump[5]++;
292  chi2gt30++;
293  dump3[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(layer(correctRecHit.first->det()))-1)]++;
294  CTTRHp h1 = traj.measurements()[0].recHit();
295  CTTRHp h2 = traj.measurements()[1].recHit();
296  TSOS t = traj.measurements()[1].updatedState();
297  double chi2 = testSeed(h1,h2,t);
298  if (chi2==-1) {
299  edm::LogVerbatim("CkfDebugger") << "there were deltas in the seed" ;
301  }
302  else {
303  hchi2seedProb->Fill(chi2);
304  edm::LogVerbatim("CkfDebugger") << "no deltas in the seed. What is wrong?" ;
305 
306  TSOS detState = theForwardPropagator->propagate( traj.lastMeasurement().updatedState(), correctRecHit.first->det()->surface());
307  TSOS simDetState = theForwardPropagator->propagate( traj.lastMeasurement().updatedState(), det(correctHit)->surface());
308 
309  if (true/*detState.globalMomentum().y()>0*/){
310  int subdetId = correctRecHit.first->det()->geographicalId().subdetId();
311  int layerId = layer(correctRecHit.first->det());
312 
313 
314  LogTrace("CkfDebugger") << "position(correctHit)=" << position(correctHit) ;
315  LogTrace("CkfDebugger") << "correctRecHit.first->globalPosition()=" << correctRecHit.first->globalPosition() ;
316  LogTrace("CkfDebugger") << "detState.globalPosition()=" << detState.globalPosition() ;
317  LogTrace("CkfDebugger") << "simDetState.globalPosition()=" << simDetState.globalPosition() ;
318 
319  LogTrace("CkfDebugger") << "correctHit->localPosition()=" << correctHit->localPosition() ;
320  LogTrace("CkfDebugger") << "correctRecHit.first->localPosition()=" << correctRecHit.first->localPosition() ;
321  LogTrace("CkfDebugger") << "correctRecHit.first->localPositionError()=" << correctRecHit.first->localPositionError() ;
322  LogTrace("CkfDebugger") << "detState.localPosition()=" << detState.localPosition() ;
323  LogTrace("CkfDebugger") << "detState.localError().positionError()=" << detState.localError().positionError() ;
324  LogTrace("CkfDebugger") << "simDetState.localPosition()=" << simDetState.localPosition() ;
325  LogTrace("CkfDebugger") << "simDetState.localError().positionError()=" << simDetState.localError().positionError() ;
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());
332  double pullx_shst = (correctHit->localPosition().x()-simDetState.localPosition().x())/
333  sqrt(simDetState.localError().positionError().xx());
334  double pully_shst = (correctHit->localPosition().y()-simDetState.localPosition().y())/
335  sqrt(simDetState.localError().positionError().yy());
336 
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 ;
341 
342  LogTrace("CkfDebugger") << "pullx(st-rh)=" << (detState.localPosition().x()-correctRecHit.first->localPosition().x())/
343  sqrt(correctRecHit.first->localPositionError().xx()+detState.localError().positionError().xx()) ;
344 
345  std::pair<double,double> pulls = computePulls(correctRecHit.first, detState);
346  if (subdetId>0 &&subdetId<7 && layerId>0 && layerId<10) {
347  stringstream title;
348  title.str("");
349  title << "pullX_" << subdetId << "-" << layerId << "_sh-rh";
350  hPullX_shrh[title.str()]->Fill( pullx_shrh );
351  title.str("");
352  title << "pullY_" << subdetId << "-" << layerId << "_sh-rh";
353  hPullY_shrh[title.str()]->Fill( pully_shrh );
354  title.str("");
355  title << "pullX_" << subdetId << "-" << layerId <<"_sh-st";
356  hPullX_shst[title.str()]->Fill( pullx_shst );
357  title.str("");
358  title << "pullY_" << subdetId << "-" << layerId <<"_sh-st";
359  hPullY_shst[title.str()]->Fill( pully_shst );
360  title.str("");
361  title << "pullX_" << subdetId << "-" << layerId <<"_st-rh";
362  hPullX_strh[title.str()]->Fill(pulls.first);
363  title.str("");
364  title << "pullY_" << subdetId << "-" << layerId <<"_st-rh";
365  hPullY_strh[title.str()]->Fill(pulls.second);
366 
367  GlobalPoint shGPos = position(correctHit);
368  GlobalPoint stGPos = simDetState.globalPosition();
369  GlobalError stGPosErr = simDetState.cartesianError().position();
370  double pullGPx = (shGPos.x()-stGPos.x())/sqrt(stGPosErr.cxx());
371  title.str("");
372  title << "PullGP_X_" << subdetId << "-" << layerId << "_sh-st";
373  hPullGP_X_shst[title.str()]->Fill(pullGPx);
374  title.str("");
375  title << "PullGP_Y_" << subdetId << "-" << layerId << "_sh-st";
376  hPullGP_Y_shst[title.str()]->Fill((shGPos.y()-stGPos.y())/sqrt(stGPosErr.cyy()));
377  title.str("");
378  title << "PullGP_Z_" << subdetId << "-" << layerId << "_sh-st";
379  hPullGP_Z_shst[title.str()]->Fill((shGPos.z()-stGPos.z())/sqrt(stGPosErr.czz()));
380 
381  if (subdetId==3&&layerId==1){
382  hPullGPXvsGPX_shst->Fill(pullGPx,shGPos.x());
383  hPullGPXvsGPY_shst->Fill(pullGPx,shGPos.y());
384  hPullGPXvsGPZ_shst->Fill(pullGPx,shGPos.z());
385  hPullGPXvsGPr_shst->Fill(pullGPx,shGPos.mag());
386  hPullGPXvsGPeta_shst->Fill(pullGPx,shGPos.eta());
387  hPullGPXvsGPphi_shst->Fill(pullGPx,shGPos.phi());
388  }
389  if (dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())) {
390  LogTrace("CkfDebugger") << "MONO HIT";
391  CTTRHp tMonoHit = theTTRHBuilder->build(dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())->monoHit());
392  const PSimHit sMonoHit = *(hitAssociator->associateHit(*tMonoHit->hit()).begin());
393  TSOS monoState = theForwardPropagator->propagate( traj.lastMeasurement().updatedState(), tMonoHit->det()->surface());
394  double pullM_shrh = (sMonoHit.localPosition().x()-tMonoHit->localPosition().x())/
395  sqrt(tMonoHit->localPositionError().xx());
396  double pullM_shst = (sMonoHit.localPosition().x()-monoState.localPosition().x())/
397  sqrt(monoState.localError().positionError().xx());
398  std::pair<double,double> pullsMono = computePulls(tMonoHit, monoState);
399  title.str("");
400  title << "pullM_" << subdetId << "-" << layerId << "_sh-rh";
401  hPullM_shrh[title.str()]->Fill(pullM_shrh);
402  title.str("");
403  title << "pullM_" << subdetId << "-" << layerId << "_sh-st";
404  hPullM_shst[title.str()]->Fill(pullM_shst);
405  title.str("");
406  title << "pullM_" << subdetId << "-" << layerId << "_st-rh";
407  hPullM_strh[title.str()]->Fill(pullsMono.first);
408 
409  LogTrace("CkfDebugger") << "STEREO HIT";
410  CTTRHp tStereoHit = theTTRHBuilder->build(dynamic_cast<const SiStripMatchedRecHit2D*>(correctRecHit.first->hit())->stereoHit());
411  const PSimHit sStereoHit = *(hitAssociator->associateHit(*tStereoHit->hit()).begin());
412  TSOS stereoState = theForwardPropagator->propagate( traj.lastMeasurement().updatedState(), tStereoHit->det()->surface());
413  double pullS_shrh = (sStereoHit.localPosition().x()-tStereoHit->localPosition().x())/
414  sqrt(tStereoHit->localPositionError().xx());
415  double pullS_shst = (sStereoHit.localPosition().x()-stereoState.localPosition().x())/
416  sqrt(stereoState.localError().positionError().xx());
417  std::pair<double,double> pullsStereo = computePulls(tStereoHit, stereoState);
418  title.str("");
419  title << "pullS_" << subdetId << "-" << layerId << "_sh-rh";
420  hPullS_shrh[title.str()]->Fill(pullS_shrh);
421  title.str("");
422  title << "pullS_" << subdetId << "-" << layerId << "_sh-st";
423  hPullS_shst[title.str()]->Fill(pullS_shst);
424  title.str("");
425  title << "pullS_" << subdetId << "-" << layerId << "_st-rh";
426  hPullS_strh[title.str()]->Fill(pullsStereo.first);
427  }
428  } else
429  edm::LogVerbatim("CkfDebugger") << "unexpected result: wrong det or layer id "
430  << subdetId << " " << layerId << " "
431  << correctRecHit.first->det()->geographicalId().rawId();
432  }
433  }
434  }
435  }
436  else {
437  edm::LogVerbatim("CkfDebugger") << "unexpected result " << correctRecHit.second ;
438  dump[6]++;chi2ls30++;
439  }
440  }
441  else dump[result]++;
442  if (result == 3){
443  dump2[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(layer(correctRecHit.first->det()))-1)]++;
444  }
445  if (result == 4){
446  dump4[pair<int,int>((correctRecHit.first->det()->geographicalId().subdetId()-1),(layer(correctRecHit.first->det()))-1)]++;
447  }
448  if (correctRecHit.second>30) {
449  dump[7]++;totchi2gt30++;
450  }
451  }
452  return false;
453 }
454 
455 
456 bool CkfDebugger::correctTrajectory( const Trajectory& traj,unsigned int& trajId) const
457 {
458  LogTrace("CkfDebugger") << "now in correctTrajectory" ;
459  Trajectory::RecHitContainer hits = traj.recHits();
460 
461  std::vector<SimHitIdpr> currentTrackId = hitAssociator->associateHitId(*hits.front()->hit());
462  if (currentTrackId.size() == 0) return false;
463 
464  for (Trajectory::RecHitContainer::const_iterator rh=hits.begin(); rh!=hits.end(); ++rh) {
465 
466  //if invalid hit exit
467  if (!(*rh)->hit()->isValid()) {
468  //LogTrace("CkfDebugger") << "invalid hit" ;
469  return false;
470  }
471 
472  //if hits from deltas exit
473  bool nogoodhit = true;
474  std::vector<PSimHit> assSimHits = hitAssociator->associateHit(*(*rh)->hit());
475  for (std::vector<PSimHit>::iterator shit=assSimHits.begin();shit!=assSimHits.end();shit++){
476  if (goodSimHit(*shit)) nogoodhit=false;
477  }
478  if (nogoodhit) return false;
479 
480  //all hits must be associated to the same sim track
481  bool test = true;
482  std::vector<SimHitIdpr> nextTrackId = hitAssociator->associateHitId(*(*rh)->hit());
483  for (std::vector<SimHitIdpr>::iterator i=currentTrackId.begin();i!=currentTrackId.end();i++){
484  for (std::vector<SimHitIdpr>::iterator j=nextTrackId.begin();j!=nextTrackId.end();j++){
485  if (i->first == j->first) test = false;
486  //LogTrace("CkfDebugger") << "valid " << *i << " " << *j ;
487  trajId = j->first;
488  }
489  }
490  if (test) {/*LogTrace("CkfDebugger") << "returning false" ;*/return false;}
491  // std::vector<PSimHit*> simTrackHits = idHitsMap[trajId];
492  // if (!goodSimHit(simTrackHits.))
493  }
494  //LogTrace("CkfDebugger") << "returning true" ;
495  return true;
496 }
497 
499 {
500  LogTrace("CkfDebugger") << "now in assocTrackId" ;
501 
502  if (!rechit->hit()->isValid()) {
503  return -1;
504  }
505 
506  std::vector<SimHitIdpr> ids = hitAssociator->associateHitId(*rechit->hit());
507  if (ids.size()!=0) {
508  return ids[0].first;//FIXME if size>1!!
509  }
510  else {
511  return -1;
512  }
513 }
514 
515 
516 vector<const PSimHit*> CkfDebugger::nextCorrectHits( const Trajectory& traj, unsigned int& trajId)
517 {
518  std::vector<const PSimHit*> result;
519  // find the component of the RecHit at largest distance from origin (FIXME: should depend on propagation direction)
520  LogTrace("CkfDebugger") << "now in nextCorrectHits" ;
522  TransientTrackingRecHit::RecHitContainer comp = lastRecHit->transientHits();
523  if (!comp.empty()) {
524  float maxR = 0;
525  for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
526  ch!=comp.end(); ++ch) {
527  if ((*ch)->globalPosition().mag() > maxR) lastRecHit = *ch;
528  maxR = (*ch)->globalPosition().mag();
529  }
530  }
531  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: lastRecHit is at gpos " << lastRecHit->globalPosition()
532  << " layer " << layer((lastRecHit->det()))
533  << " subdet " << lastRecHit->det()->geographicalId().subdetId() ;
534 
535  //find the simHits associated to the recHit
536  const std::vector<PSimHit>& pSimHitVec = hitAssociator->associateHit(*lastRecHit->hit());
537  for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
538  const GeomDetUnit* detUnit = theTrackerGeom->idToDetUnit( DetId(shit->detUnitId()));
539  LogTrace("CkfDebugger") << "from hitAssociator SimHits are at GP=" << detUnit->toGlobal( shit->localPosition())
540  << " traId=" << shit->trackId() << " particleType " << shit->particleType()
541  << " pabs=" << shit->pabs() << " detUnitId=" << shit->detUnitId() << " layer " << layer((det(&*shit)))
542  << " subdet " << det(&*shit)->geographicalId().subdetId() ;
543  }
544 
545  //choose the simHit from the same track that has the highest tof
546  const PSimHit * lastPSH = 0;
547  if (!pSimHitVec.empty()) {
548  float maxTOF = 0;
549  for (std::vector<PSimHit>::const_iterator ch=pSimHitVec.begin(); ch!=pSimHitVec.end(); ++ch) {
550  if ( ( ch->trackId()== trajId) && (ch->timeOfFlight() > maxTOF) && ( goodSimHit(*ch) )) {
551  lastPSH = &*ch;
552  maxTOF = lastPSH->timeOfFlight();
553  }
554  }
555  }
556  else return result;//return empty vector: no more hits on the sim track
557  if (lastPSH == 0) return result; //return empty vector: no more good hits on the sim track
558  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: corresponding SimHit is at gpos " << position(&*lastPSH) ;
559 
560  //take the simHits on the simTrack that are in the nextLayer (could be > 1 if overlap or matched)
561  std::vector<PSimHit*> trackHits = idHitsMap[trajId];
562  if (fabs((double)(trackHits.back()->detUnitId()-lastPSH->detUnitId()))<1 ) return result;//end of sim track
563  std::vector<PSimHit*>::iterator currentIt = trackHits.end();
564  for (std::vector<PSimHit*>::iterator it=trackHits.begin();
565  it!=trackHits.end();it++){
566  if (goodSimHit(**it) && //good hit
567  ( lastPSH->timeOfFlight()<(*it)->timeOfFlight() ) && //greater tof
568  //( fabs((double)((*it)->detUnitId()-(lastPSH->detUnitId()) ))>1) && //not components of the same matched hit
569  ( (det(lastPSH)->geographicalId().subdetId()!=det(*it)->geographicalId().subdetId()) ||
570  (layer(det(lastPSH))!=layer(det(*it)) ) ) //change layer or detector(tib,tob,...)
571  ){
572  edm::LogVerbatim("CkfDebugger") << "Next good PSimHit is at gpos " << position(*it) ;
573  result.push_back(*it);
574  currentIt = it;
575  break;
576  }
577  }
578  bool samelayer = true;
579  if (currentIt!=(trackHits.end()-1) && currentIt!=trackHits.end()) {
580  for (std::vector<PSimHit*>::iterator nextIt = currentIt; (samelayer && nextIt!=trackHits.end()) ;nextIt++){
581  if (goodSimHit(**nextIt)){
582  if ( (det(*nextIt)->geographicalId().subdetId()==det(*currentIt)->geographicalId().subdetId()) &&
583  (layer(det(*nextIt))==layer(det(*currentIt)) ) ) {
584  result.push_back(*nextIt);
585  }
586  else samelayer = false;
587  }
588  }
589  }
590 
591  return result;
592 }
593 
594 bool CkfDebugger::goodSimHit(const PSimHit& sh) const
595 {
596  if (sh.pabs() > 0.9) return true; // GeV, reject delta rays from association
597  else return false;
598 }
599 
600 
601 bool CkfDebugger::associated(CTTRHp rechit, const PSimHit& pSimHit) const
602 {
603  LogTrace("CkfDebugger") << "now in associated" ;
604 
605  if (!rechit->isValid()) return false;
606  // LogTrace("CkfDebugger") << "rec hit valid" ;
607  const std::vector<PSimHit>& pSimHitVec = hitAssociator->associateHit(*rechit->hit());
608  // LogTrace("CkfDebugger") << "size=" << pSimHitVec.size() ;
609  for (std::vector<PSimHit>::const_iterator shit=pSimHitVec.begin();shit!=pSimHitVec.end();shit++){
610  //const GeomDetUnit* detUnit = theTrackerGeom->idToDetUnit( DetId(shit->detUnitId()));
611  // LogTrace("CkfDebugger") << "pSimHit.timeOfFlight()=" << pSimHit.timeOfFlight()
612  // << " pSimHit.pabs()=" << pSimHit.pabs() << " GP=" << position(&pSimHit);
613  // LogTrace("CkfDebugger") << "(*shit).timeOfFlight()=" << (*shit).timeOfFlight()
614  // << " (*shit).pabs()=" << (*shit).pabs() << " GP=" << detUnit->toGlobal( shit->localPosition());
615  if ( ( fabs((*shit).timeOfFlight()-pSimHit.timeOfFlight())<1e-9 ) &&
616  ( fabs((*shit).pabs()-pSimHit.pabs())<1e-9 ) ) return true;
617  }
618  return false;
619 }
620 
621 bool CkfDebugger::correctMeas( const TM& tm, const PSimHit* correctHit) const
622 {
623  LogTrace("CkfDebugger") << "now in correctMeas" ;
624  CTTRHp recHit = tm.recHit();
625  if (recHit->isValid()) LogTrace("CkfDebugger") << "hit at position:" << recHit->globalPosition() ;
626  TransientTrackingRecHit::RecHitContainer comp = recHit->transientHits();
627  if (comp.empty()) {
628  // LogTrace("CkfDebugger") << "comp.empty()==true" ;
629  return associated( recHit, *correctHit);
630  }
631  else {
632  for (TransientTrackingRecHit::RecHitContainer::const_iterator ch=comp.begin();
633  ch!=comp.end(); ++ch) {
634  if ( associated( recHit, *correctHit)) {
635  // check if the other components are associated to the same trackId
636  for (TransientTrackingRecHit::RecHitContainer::const_iterator ch2=comp.begin();
637  ch2!=comp.end(); ++ch2) {
638  if (ch2 == ch) continue;
640  // LogTrace("CkfDebugger") << "correctHit->trackId()=" << correctHit->trackId() ;
641  bool test=true;
642  std::vector<SimHitIdpr> ids = hitAssociator->associateHitId(*(*ch2)->hit());
643  for (std::vector<SimHitIdpr>::iterator j=ids.begin();j!=ids.end();j++){
644  // LogTrace("CkfDebugger") << "j=" <<j->first;
645  if (correctHit->trackId()==j->first) {
646  test=false;
647  // LogTrace("CkfDebugger") << correctHit->trackId()<< " " <<j->first;
648  }
649  }
650  if (assocTrackId( *ch2) != ((int)( correctHit->trackId())) ) {LogTrace("CkfDebugger") << "returning false 1" ;/*return false;*/}//fixme
651  if (test) {
652  // LogTrace("CkfDebugger") << "returning false 2" ;
653  return false; // not all components from same simtrack
654  }
655  // if (assocTrackId( **ch2) != ((int)( correctHit->trackId())) ) {
656  // return false; // not all components from same simtrack
657  // }
658  }
659  return true; // if all components from same simtrack
660  }
661  }
662  return false;
663  }
664 }
665 
666 //this checks only if there is the rechit on the det where the sim hit is
667 pair<CTTRHp, double> CkfDebugger::analyseRecHitExistance( const PSimHit& sh, const TSOS& startingState)
668 {
669  LogTrace("CkfDebugger") << "now in analyseRecHitExistance" ;
670 
671  std::pair<CTTRHp, double> result;
672 
673  const MeasurementDet* simHitDet = theMeasurementTracker->idToDet( DetId( sh.detUnitId()));
674  TSOS simHitState = TSOSFromSimHitFactory()(sh, *det(&sh), *theMagField);
675  MeasurementDet::RecHitContainer recHits = simHitDet->recHits( simHitState);//take all hits from det
676 
677  //check if the hit is not present or is a problem of association
678  TSOS firstDetState = theForwardPropagator->propagate( startingState, det(&sh)->surface());
679  if (!firstDetState.isValid()) {
680  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: propagation failed from state " << startingState << " to first det surface "
681  << position(&sh) ;
682  propagation++;
683  return std::pair<CTTRHp, double>((CTTRHp)(0),-1);
684  }
685 
686  bool found = false;
687  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
688  if ( associated( *rh, sh)) {
689  found = true;
690  result = std::pair<CTTRHp, double>(*rh,theChi2->estimate( firstDetState, **rh).second);
691  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
692  << (**rh).localPosition()
693  << " gpos " << (**rh).globalPosition()
694  << " layer " << layer((**rh).det())
695  << " subdet " << (**rh).det()->geographicalId().subdetId()
696  << " Chi2 " << theChi2->estimate( firstDetState, **rh).second;
697  }
698  }
699  if (!found) {
700  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: there is no RecHit associated to the correct SimHit." ;
701  edm::LogVerbatim("CkfDebugger") << " There are " << recHits.size() << " RecHits in the simHit DetUnit" ;
702  edm::LogVerbatim("CkfDebugger") << "SH GP=" << position(&sh) << " subdet=" << det(&sh)->geographicalId().subdetId()
703  << " layer=" << layer(det(&sh)) ;
704  int y=0;
705  for (MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++)
706  edm::LogVerbatim("CkfDebugger") << "RH#" << y++ << " GP=" << (**rh).globalPosition() << " subdet=" << (**rh).det()->geographicalId().subdetId()
707  << " layer=" << layer((**rh).det()) ;
708  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
709  edm::LogVerbatim("CkfDebugger") << "Non-associated RecHit at pos " << (**rh).localPosition() ;
710  }
711  }
712 
713  bool found2 = false;
714  const PSimHit* sh2;
715  StripSubdetector subdet( det(&sh)->geographicalId());
716  if (!subdet.glued()) {
717  edm::LogVerbatim("CkfDebugger") << "The DetUnit is not part of a GluedDet" ;
718  if (found) {
719  if (result.second>30){
720  LogTrace("CkfDebugger") << "rh->parameters()=" << result.first->parameters() ;
721  LogTrace("CkfDebugger") << "rh->parametersError()=" << result.first->parametersError() ;
722  MeasurementExtractor me(firstDetState);
723  AlgebraicVector r(result.first->parameters() - me.measuredParameters(*result.first));
724  LogTrace("CkfDebugger") << "me.measuredParameters(**rh)=" << me.measuredParameters(*result.first) ;
725  LogTrace("CkfDebugger") << "me.measuredError(**rh)=" << me.measuredError(*result.first) ;
726  AlgebraicSymMatrix R(result.first->parametersError() + me.measuredError(*result.first));
727  LogTrace("CkfDebugger") << "r=" << r ;
728  LogTrace("CkfDebugger") << "R=" << R ;
729  int ierr;
730  R.invert(ierr);
731  LogTrace("CkfDebugger") << "R(-1)=" << R ;
732  LogTrace("CkfDebugger") << "chi2=" << R.similarity(r) ;
733  }
734  return result;
735  }
736  else {
738  return std::pair<CTTRHp, double>((CTTRHp)(0),-8);//not found (is not a glued det)
739  }
740  } else {
741  edm::LogVerbatim("CkfDebugger") << "The DetUnit is part of a GluedDet" ;
742  DetId partnerDetId = DetId( subdet.partnerDetId());
743 
744  sh2 = pSimHit( sh.trackId(), partnerDetId);
745  if (sh2 == 0) {
746  edm::LogVerbatim("CkfDebugger") << "Partner DetUnit does not have a SimHit from the same track" ;
747  if (found) {
748  //projected rec hit
750  DetId gid = gluedId( subdet);
751  const MeasurementDet* gluedDet = theMeasurementTracker->idToDet( gid);
752  TSOS gluedTSOS = theForwardPropagator->propagate(startingState, gluedDet->geomDet().surface());
753  CTTRHp projHit = proj.project( *result.first,gluedDet->geomDet(),gluedTSOS).get();
754  //LogTrace("CkfDebugger") << proj.project( *result.first,gluedDet->geomDet(),gluedTSOS)->parameters() ;
755  //LogTrace("CkfDebugger") << projHit->parametersError() ;
756  double chi2 = theChi2->estimate(gluedTSOS, *proj.project( *result.first,gluedDet->geomDet(),gluedTSOS)).second;
757  return std::pair<CTTRHp, double>(projHit,chi2);
758  }
759  }
760  else {
761  edm::LogVerbatim("CkfDebugger") << "Partner DetUnit has a good SimHit at gpos " << position(sh2)
762  << " lpos " << sh2->localPosition() ;
763  //}
764 
765  const MeasurementDet* partnerDet = theMeasurementTracker->idToDet( partnerDetId);
766  if (partnerDet == 0) {
767  edm::LogVerbatim("CkfDebugger") << "Partner measurementDet not found!!!" ;
769  return std::pair<CTTRHp, double>((CTTRHp)(0),-3);
770  }
771  TSOS simHitState2 = TSOSFromSimHitFactory()(*sh2, *det(sh2), *theMagField);
772  MeasurementDet::RecHitContainer recHits2 = partnerDet->recHits( simHitState2);
773 
774  TSOS secondDetState = theForwardPropagator->propagate( startingState, det(sh2)->surface());
775  if (!secondDetState.isValid()) {
776  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: propagation failed from state " << startingState << " to second det surface "
777  << position(sh2) ;
778  propagation++;
779  return std::pair<CTTRHp, double>((CTTRHp)(0),-1);
780  }
781 
782  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits2.begin(); rh != recHits2.end(); rh++) {
783  if ( associated( *rh, *sh2)) {
784  found2 = true;
785  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: A RecHit associated to the correct Simhit exists at lpos "
786  << (**rh).localPosition()
787  << " gpos " << (**rh).globalPosition()
788  << " Chi2 " << theChi2->estimate( secondDetState, **rh).second
789  ;
790  }
791  }
792  if (!found2) {
793  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: there is no RecHit associated to the correct SimHit." ;
794  LogTrace("CkfDebugger") << " There are " << recHits.size() << " RecHits in the simHit DetUnit" ;
795  for ( MeasurementDet::RecHitContainer::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++) {
796  LogTrace("CkfDebugger") << "Non-associated RecHit at pos " << (**rh).localPosition() ;
797  }
798  }
799  }
800  }
801 
803  if (found && found2) {
804  // look in the glued det
805  DetId gid = gluedId( subdet);
806  const MeasurementDet* gluedDet = theMeasurementTracker->idToDet( gid);
807  if ( gluedDet == 0) {
808  edm::LogVerbatim("CkfDebugger") << "CkfDebugger ERROR: glued MeasurementDet not found!" ;
810  return std::pair<CTTRHp, double>((CTTRHp)(0),-4);
811  }
812 
813  TSOS gluedDetState = theForwardPropagator->propagate( startingState, gluedDet->surface());
814  if (!gluedDetState.isValid()) {
815  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: propagation failed from state " << startingState << " to det surface "
816  << gluedDet->position() ;
817  propagation++;
818  return std::pair<CTTRHp, double>((CTTRHp)(0),-1);
819  }
820 
821  gluedHits = gluedDet->recHits( gluedDetState);
822  edm::LogVerbatim("CkfDebugger") << "CkfDebugger: the GluedDet returned " << gluedHits.size() << " hits" ;
823  if (gluedHits.size()==0){
824  edm::LogVerbatim("CkfDebugger") << "Found and associated mono and stereo recHits but not matched!!!" ;
826  return std::pair<CTTRHp, double>((CTTRHp)(0),-5);
827  }
828  bool found3 = false;
829  for ( MeasurementDet::RecHitContainer::const_iterator rh = gluedHits.begin(); rh != gluedHits.end(); rh++) {
830  if ( associated( *rh, sh) && associated( *rh, *sh2)) {
831  double chi2 = theChi2->estimate(gluedDetState, **rh).second;
832  edm::LogVerbatim("CkfDebugger") << "Matched hit at lpos " << (**rh).localPosition()
833  << " gpos " << (**rh).globalPosition()
834  << " has Chi2 " << chi2
835  ;
836  result = std::pair<CTTRHp, double>(&**rh,chi2);
837  found3 = true;
838  if (chi2>30){
839  LogTrace("CkfDebugger") << "rh->parameters()=" << (*rh)->parameters() ;
840  LogTrace("CkfDebugger") << "rh->parametersError()=" << (*rh)->parametersError() ;
841  MeasurementExtractor me(gluedDetState);
842  AlgebraicVector r((*rh)->parameters() - me.measuredParameters(**rh));
843  LogTrace("CkfDebugger") << "me.measuredParameters(**rh)=" << me.measuredParameters(**rh) ;
844  LogTrace("CkfDebugger") << "me.measuredError(**rh)=" << me.measuredError(**rh) ;
845  AlgebraicSymMatrix R((*rh)->parametersError() + me.measuredError(**rh));
846  LogTrace("CkfDebugger") << "r=" << r ;
847  LogTrace("CkfDebugger") << "R=" << R ;
848  int ierr;
849  R.invert(ierr);
850  LogTrace("CkfDebugger") << "R(-1)=" << R ;
851  LogTrace("CkfDebugger") << "chi2=" << R.similarity(r) ;
852  }
853  break;
854  }
855  }
856  if (found3) return result;
857  else {
858  edm::LogVerbatim("CkfDebugger") << "Found and associated mono and stereo recHits. Matched found but not associated!!!" ;
860  return std::pair<CTTRHp, double>((CTTRHp)(0),-6);
861  }
862  }
863  else if ( (found && !found2) || (!found && found2) ) {
864  edm::LogVerbatim("CkfDebugger") << "Only one component is found" ;
866  return std::pair<CTTRHp, double>((CTTRHp)(0),-7);
867  }
868  else {
869  edm::LogVerbatim("CkfDebugger") << "No component is found" ;
870  no_component++;
871  return std::pair<CTTRHp, double>((CTTRHp)(0),-2);
872  }
873  other++;
874  return std::pair<CTTRHp, double>((CTTRHp)(0),0);//other
875 }
876 
877 const PSimHit* CkfDebugger::pSimHit(unsigned int tkId, DetId detId)
878 {
879  for (std::vector<PSimHit*>::iterator shi=idHitsMap[tkId].begin(); shi!=idHitsMap[tkId].end(); ++shi) {
880  if ( (*shi)->detUnitId() == detId.rawId() &&
881  //(shi)->trackId() == tkId &&
882  goodSimHit(**shi) ) {
883  return (*shi);
884  }
885  }
886  return 0;
887 }
888 
889 int CkfDebugger::analyseRecHitNotFound(const Trajectory& traj, CTTRHp correctRecHit)
890 {
891  unsigned int correctDetId = correctRecHit->det()->geographicalId().rawId();
892  int correctLayId = layer(correctRecHit->det());
893  LogTrace("CkfDebugger") << "correct layer id=" << correctLayId ;
894 
895  TSOS currentState( traj.lastMeasurement().updatedState() );
896  std::vector<const DetLayer*> nl = traj.lastLayer()->nextLayers( *currentState.freeState(),traj.direction() );
897  if (nl.empty()) {
898  edm::LogVerbatim("CkfDebugger") << "no compatible layers" ;
899  no_layer++;return 2;
900  }
901 
902  TkLayerLess lless;//FIXME - was lless(traj.direction())
903  const DetLayer* detLayer = 0;
904  bool navLayerAfter = false;
905  bool test = false;
906  for (std::vector<const DetLayer*>::iterator il = nl.begin(); il != nl.end(); il++) {
907  if ( dynamic_cast<const BarrelDetLayer*>(*il) ){
908  const BarrelDetLayer* pbl = dynamic_cast<const BarrelDetLayer*>(*il);
909  LogTrace("CkfDebugger") << "pbl->specificSurface().bounds().length()=" << pbl->specificSurface().bounds().length() ;
910  LogTrace("CkfDebugger") << "pbl->specificSurface().bounds().width()=" << pbl->specificSurface().bounds().width() ;
911  }
912  int layId = layer(((*(*il)->basicComponents().begin())));
913  LogTrace("CkfDebugger") << " subdet=" << (*(*il)->basicComponents().begin())->geographicalId().subdetId() << "layer id=" << layId ;
914  if (layId==correctLayId) {
915  test = true;
916  detLayer = &**il;
917  break;
918  }
919  if ( lless( *il, theGeomSearchTracker->detLayer(correctRecHit->det()->geographicalId()) ))
920  navLayerAfter = true; //it is enough that only one layer is after the correct one?
921  }
922 
923  if (test) {
924  edm::LogVerbatim("CkfDebugger") << "correct layer taken into account. layer id: " << correctLayId ;
925  } else if (navLayerAfter){
926  edm::LogVerbatim("CkfDebugger")<< "SimHit layer after the layers returned by Navigation.";
927  edm::LogVerbatim("CkfDebugger")<< "Probably a missing SimHit." ;
928  edm::LogVerbatim("CkfDebugger")<< "check: " << (correctRecHit->det()->geographicalId().subdetId()) << " " << (layer(correctRecHit->det()));
929  dump6[pair<int,int>((correctRecHit->det()->geographicalId().subdetId()-1),(layer(correctRecHit->det()))-1)]++;
930  no_sim_hit++;return 16;
931  }
932  else {
933  edm::LogVerbatim("CkfDebugger") << "correct layer NOT taken into account. correct layer id: " << correctLayId ;
934  layer_not_found++;
935  return 3;
936  }
937 
939  std::vector<DetWithState> compatDets = detLayer->compatibleDets(currentState,*theForwardPropagator,*theChi2);
940  // LogTrace("CkfDebugger") << "DEBUGGER" ;
941  // LogTrace("CkfDebugger") << "runned compatDets." ;
942  // LogTrace("CkfDebugger") << "started from the following TSOS:" ;
943  // LogTrace("CkfDebugger") << currentState ;
944  // LogTrace("CkfDebugger") << "number of dets found=" << compatDets.size() ;
945  // for (std::vector<DetWithState>::iterator det=compatDets.begin();det!=compatDets.end();det++){
946  // unsigned int detId = det->first->geographicalId().rawId();
947  // LogTrace("CkfDebugger") << "detId=" << detId ;
948  // }
949  bool test2 = false;
950  for (std::vector<DetWithState>::iterator det=compatDets.begin();det!=compatDets.end();det++){
951  unsigned int detId = det->first->geographicalId().rawId();
952  // LogTrace("CkfDebugger") << "detId=" << detId
953  // << "\ncorrectRecHit->det()->geographicalId().rawId()=" << correctRecHit->det()->geographicalId().rawId()
954  // << "\ngluedId(correctRecHit->det()->geographicalId()).rawId()=" << gluedId(correctRecHit->det()->geographicalId()).rawId()
955  // ;
956  if (detId==gluedId(correctRecHit->det()->geographicalId()).rawId()) {
957  test2=true;
958  break;
959  }
960  }
961 
962  if (test2){
963  edm::LogVerbatim("CkfDebugger") << "correct det taken into account. correctDetId is: " << correctDetId
964  << ". please check chi2." ;
965  return 5;
966  }
967  else {
968  edm::LogVerbatim("CkfDebugger") << "correct det NOT taken into account. correctDetId: " << correctDetId ;
969  det_not_found++;return 4;
970  }
971 
972 }
973 
974 double CkfDebugger::testSeed(CTTRHp recHit1, CTTRHp recHit2, TSOS state){
975  //edm::LogVerbatim("CkfDebugger") << "CkfDebugger::testSeed";
976  //test Deltas
977  const std::vector<PSimHit>& pSimHitVec1 = hitAssociator->associateHit(*recHit1->hit());
978  const std::vector<PSimHit>& pSimHitVec2 = hitAssociator->associateHit(*recHit2->hit());
979 
980  if ( pSimHitVec1.size()==0 || pSimHitVec2.size()==0 || hasDelta(&(*pSimHitVec1.begin())) || hasDelta(&(*pSimHitVec2.begin())) ) {
981  edm::LogVerbatim("CkfDebugger") << "Seed has delta or problems" ;
982  return -1;
983  }
984 
985  // LogTrace("CkfDebugger") << "state=\n" << state ;
986  // double stlp1 = state.localParameters().vector()[0];
987  // double stlp2 = state.localParameters().vector()[1];
988  // double stlp3 = state.localParameters().vector()[2];
989  // double stlp4 = state.localParameters().vector()[3];
990  // double stlp5 = state.localParameters().vector()[4];
991 
992  if (pSimHitVec2.size()!=0) {
993  const PSimHit& simHit = *pSimHitVec2.begin();
994 
995  double shlp1 = -1/simHit.momentumAtEntry().mag();
996  double shlp2 = simHit.momentumAtEntry().x()/simHit.momentumAtEntry().z();
997  double shlp3 = simHit.momentumAtEntry().y()/simHit.momentumAtEntry().z();
998  double shlp4 = simHit.localPosition().x();
999  double shlp5 = simHit.localPosition().y();
1001  v[0] = shlp1;
1002  v[1] = shlp2;
1003  v[2] = shlp3;
1004  v[3] = shlp4;
1005  v[4] = shlp5;
1006 
1007  // LogTrace("CkfDebugger") << "simHit.localPosition()=" << simHit.localPosition() ;
1008  // LogTrace("CkfDebugger") << "simHit.momentumAtEntry()=" << simHit.momentumAtEntry() ;
1009  // LogTrace("CkfDebugger") << "recHit2->localPosition()=" << recHit2->localPosition() ;
1010  // LogTrace("CkfDebugger") << "recHit2->localPositionError()=" << recHit2->localPositionError() ;
1011  // LogTrace("CkfDebugger") << "state.localPosition()=" << state.localPosition() ;
1012  // LogTrace("CkfDebugger") << "state.localError().positionError()=" << state.localError().positionError() ;
1013 
1014  // LogTrace("CkfDebugger") << "pullx(sh-rh)=" << (simHit.localPosition().x()-recHit2->localPosition().x())/sqrt(recHit2->localPositionError().xx()) ;
1015  // LogTrace("CkfDebugger") << "pullx(sh-st)=" << (simHit.localPosition().x()-state.localPosition().x())/sqrt(state.localError().positionError().xx()) ;
1016  // LogTrace("CkfDebugger") << "pullx(st-rh)=" << (state.localPosition().x()-recHit2->localPosition().x())/
1017  // sqrt(recHit2->localPositionError().xx()+state.localError().positionError().xx()) ;
1018 
1019  // LogTrace("CkfDebugger") << "local parameters" ;
1020  // LogTrace("CkfDebugger") << left;
1021  // LogTrace("CkfDebugger") << setw(15) << stlp1 << setw(15) << shlp1 << setw(15) << sqrt(state.localError().matrix()[0][0])
1022  // << setw(15) << (stlp1-shlp1)/stlp1 << setw(15) << (stlp1-shlp1)/sqrt(state.localError().matrix()[0][0]) ;
1023  // LogTrace("CkfDebugger") << setw(15) << stlp2 << setw(15) << shlp2 << setw(15) << sqrt(state.localError().matrix()[1][1])
1024  // << setw(15) << (stlp2-shlp2)/stlp2 << setw(15) << (stlp2-shlp2)/sqrt(state.localError().matrix()[1][1]) ;
1025  // LogTrace("CkfDebugger") << setw(15) << stlp3 << setw(15) << shlp3 << setw(15) << sqrt(state.localError().matrix()[2][2])
1026  // << setw(15) << (stlp3-shlp3)/stlp3 << setw(15) << (stlp3-shlp3)/sqrt(state.localError().matrix()[2][2]) ;
1027  // LogTrace("CkfDebugger") << setw(15) << stlp4 << setw(15) << shlp4 << setw(15) << sqrt(state.localError().matrix()[3][3])
1028  // << setw(15) << (stlp4-shlp4)/stlp4 << setw(15) << (stlp4-shlp4)/sqrt(state.localError().matrix()[3][3]) ;
1029  // LogTrace("CkfDebugger") << setw(15) << stlp5 << setw(15) << shlp5 << setw(15) << sqrt(state.localError().matrix()[4][4]) <<
1030  // setw(15) << (stlp5-shlp5)/stlp5 << setw(15) << (stlp5-shlp5)/sqrt(state.localError().matrix()[4][4]) ;
1031 
1033  R.Invert();
1034  double chi2 = ROOT::Math::Similarity(v-state.localParameters().vector(), R);
1035  LogTrace("CkfDebugger") << "chi2=" << chi2 ;
1036  return chi2;
1037  }
1038 
1039  return 0;//fixme
1040 
1041 }
1042 
1043 
1045  for (int it=0; it!=((int)(dump.size())); it++)
1046  edm::LogVerbatim("CkfDebugger") << "dump " << it << " " << dump[it] ;
1047 
1048  edm::LogVerbatim("CkfDebugger") ;
1049  edm::LogVerbatim("CkfDebugger") << "seedWithDelta=" << ((double)seedWithDelta/totSeeds) ;
1050  edm::LogVerbatim("CkfDebugger") << "problems=" << ((double)problems/totSeeds) ;
1051  edm::LogVerbatim("CkfDebugger") << "no_sim_hit=" << ((double)no_sim_hit/totSeeds) ;
1052  edm::LogVerbatim("CkfDebugger") << "no_layer=" << ((double)no_layer/totSeeds) ;
1053  edm::LogVerbatim("CkfDebugger") << "layer_not_found=" << ((double)layer_not_found/totSeeds) ;
1054  edm::LogVerbatim("CkfDebugger") << "det_not_found=" << ((double)det_not_found/totSeeds) ;
1055  edm::LogVerbatim("CkfDebugger") << "chi2gt30=" << ((double)chi2gt30/totSeeds) ;
1056  edm::LogVerbatim("CkfDebugger") << "chi2gt30deltaSeed=" << ((double)chi2gt30deltaSeed/totSeeds) ;
1057  edm::LogVerbatim("CkfDebugger") << "chi2gt30delta=" << ((double)chi2gt30delta/totSeeds) ;
1058  edm::LogVerbatim("CkfDebugger") << "chi2ls30=" << ((double)chi2ls30/totSeeds) ;
1059  edm::LogVerbatim("CkfDebugger") << "simple_hit_not_found=" << ((double)simple_hit_not_found/totSeeds) ;
1060  edm::LogVerbatim("CkfDebugger") << "no_component=" << ((double)no_component/totSeeds) ;
1061  edm::LogVerbatim("CkfDebugger") << "only_one_component=" << ((double)only_one_component/totSeeds) ;
1062  edm::LogVerbatim("CkfDebugger") << "matched_not_found=" << ((double)matched_not_found/totSeeds) ;
1063  edm::LogVerbatim("CkfDebugger") << "matched_not_associated=" << ((double)matched_not_associated/totSeeds) ;
1064  edm::LogVerbatim("CkfDebugger") << "partner_det_not_fuond=" << ((double)partner_det_not_fuond/totSeeds) ;
1065  edm::LogVerbatim("CkfDebugger") << "glued_det_not_fuond=" << ((double)glued_det_not_fuond/totSeeds) ;
1066  edm::LogVerbatim("CkfDebugger") << "propagation=" << ((double)propagation/totSeeds) ;
1067  edm::LogVerbatim("CkfDebugger") << "other=" << ((double)other/totSeeds) ;
1068  edm::LogVerbatim("CkfDebugger") << "totchi2gt30=" << ((double)totchi2gt30/totSeeds) ;
1069  edm::LogVerbatim("CkfDebugger") << "totSeeds=" << totSeeds ;
1070  edm::LogVerbatim("CkfDebugger") ;
1071 
1072  edm::LogVerbatim("CkfDebugger") << "layer navigation problems:" ;
1073  for (int i=0; i!=6; i++)
1074  for (int j=0; j!=9; j++){
1075  if (i==0 && j>2) break;
1076  if (i==1 && j>1) break;
1077  if (i==2 && j>3) break;
1078  if (i==3 && j>2) break;
1079  if (i==4 && j>5) break;
1080  if (i==5 && j>8) break;
1081  edm::LogVerbatim("CkfDebugger") << "det=" << i+1 << " lay=" << j+1 << " " << dump2[pair<int,int>(i,j)] ;
1082  }
1083  edm::LogVerbatim("CkfDebugger") << "\nlayer with hit having chi2>30:" ;
1084  for (int i=0; i!=6; i++)
1085  for (int j=0; j!=9; j++){
1086  if (i==0 && j>2) break;
1087  if (i==1 && j>1) break;
1088  if (i==2 && j>3) break;
1089  if (i==3 && j>2) break;
1090  if (i==4 && j>5) break;
1091  if (i==5 && j>8) break;
1092  edm::LogVerbatim("CkfDebugger") << "det=" << i+1 << " lay=" << j+1 << " " << dump3[pair<int,int>(i,j)] ;
1093  }
1094  edm::LogVerbatim("CkfDebugger") << "\nlayer with hit having chi2>30 for delta rays:" ;
1095  for (int i=0; i!=6; i++)
1096  for (int j=0; j!=9; j++){
1097  if (i==0 && j>2) break;
1098  if (i==1 && j>1) break;
1099  if (i==2 && j>3) break;
1100  if (i==3 && j>2) break;
1101  if (i==4 && j>5) break;
1102  if (i==5 && j>8) break;
1103  edm::LogVerbatim("CkfDebugger") << "det=" << i+1 << " lay=" << j+1 << " " << dump5[pair<int,int>(i,j)] ;
1104  }
1105  edm::LogVerbatim("CkfDebugger") << "\nlayer with det not found:" ;
1106  for (int i=0; i!=6; i++)
1107  for (int j=0; j!=9; j++){
1108  if (i==0 && j>2) break;
1109  if (i==1 && j>1) break;
1110  if (i==2 && j>3) break;
1111  if (i==3 && j>2) break;
1112  if (i==4 && j>5) break;
1113  if (i==5 && j>8) break;
1114  edm::LogVerbatim("CkfDebugger") << "det=" << i+1 << " lay=" << j+1 << " " << dump4[pair<int,int>(i,j)] ;
1115  }
1116  edm::LogVerbatim("CkfDebugger") << "\nlayer with correct RecHit after missing Sim Hit:" ;
1117  for (int i=0; i!=6; i++)
1118  for (int j=0; j!=9; j++){
1119  if (i==0 && j>2) break;
1120  if (i==1 && j>1) break;
1121  if (i==2 && j>3) break;
1122  if (i==3 && j>2) break;
1123  if (i==4 && j>5) break;
1124  if (i==5 && j>8) break;
1125  edm::LogVerbatim("CkfDebugger") << "det=" << i+1 << " lay=" << j+1 << " " << dump6[pair<int,int>(i,j)] ;
1126  }
1127  hchi2seedAll->Write();
1128  hchi2seedProb->Write();
1129  std::stringstream title;
1130  for (int i=0; i!=6; i++)
1131  for (int j=0; j!=9; j++){
1132  if (i==0 && j>2) break;
1133  if (i==1 && j>1) break;
1134  if (i==2 && j>3) break;
1135  if (i==3 && j>2) break;
1136  if (i==4 && j>5) break;
1137  if (i==5 && j>8) break;
1138  title.str("");
1139  title << "pullX_" << i+1 << "-" << j+1 << "_sh-rh";
1140  hPullX_shrh[title.str()]->Write();
1141  title.str("");
1142  title << "pullY_" << i+1 << "-" << j+1 << "_sh-rh";
1143  hPullY_shrh[title.str()]->Write();
1144  title.str("");
1145  title << "pullX_" << i+1 << "-" << j+1 << "_sh-st";
1146  hPullX_shst[title.str()]->Write();
1147  title.str("");
1148  title << "pullY_" << i+1 << "-" << j+1 << "_sh-st";
1149  hPullY_shst[title.str()]->Write();
1150  title.str("");
1151  title << "pullX_" << i+1 << "-" << j+1 << "_st-rh";
1152  hPullX_strh[title.str()]->Write();
1153  title.str("");
1154  title << "pullY_" << i+1 << "-" << j+1 << "_st-rh";
1155  hPullY_strh[title.str()]->Write();
1156  title.str("");
1157  title << "PullGP_X_" << i+1 << "-" << j+1 << "_sh-st";
1158  hPullGP_X_shst[title.str()]->Write();
1159  title.str("");
1160  title << "PullGP_Y_" << i+1 << "-" << j+1 << "_sh-st";
1161  hPullGP_Y_shst[title.str()]->Write();
1162  title.str("");
1163  title << "PullGP_Z_" << i+1 << "-" << j+1 << "_sh-st";
1164  hPullGP_Z_shst[title.str()]->Write();
1165  if ( ((i==2||i==4)&&(j==0||j==1)) || (i==3||i==5) ){
1166  title.str("");
1167  title << "pullM_" << i+1 << "-" << j+1 << "_sh-rh";
1168  hPullM_shrh[title.str()]->Write();
1169  title.str("");
1170  title << "pullS_" << i+1 << "-" << j+1 << "_sh-rh";
1171  hPullS_shrh[title.str()]->Write();
1172  title.str("");
1173  title << "pullM_" << i+1 << "-" << j+1 << "_sh-st";
1174  hPullM_shst[title.str()]->Write();
1175  title.str("");
1176  title << "pullS_" << i+1 << "-" << j+1 << "_sh-st";
1177  hPullS_shst[title.str()]->Write();
1178  title.str("");
1179  title << "pullM_" << i+1 << "-" << j+1 << "_st-rh";
1180  hPullM_strh[title.str()]->Write();
1181  title.str("");
1182  title << "pullS_" << i+1 << "-" << j+1 << "_st-rh";
1183  hPullS_strh[title.str()]->Write();
1184  }
1185  }
1186  hPullGPXvsGPX_shst->Write();
1187  hPullGPXvsGPY_shst->Write();
1188  hPullGPXvsGPZ_shst->Write();
1189  hPullGPXvsGPr_shst->Write();
1190  hPullGPXvsGPeta_shst->Write();
1191  hPullGPXvsGPphi_shst->Write();
1192 
1193  //file->Write();
1194  file->Close();
1195 }
AlgebraicSymMatrix measuredError(const TransientTrackingRecHit &)
GlobalPoint globalPosition() const
Definition: CkfDebugger.h:83
int i
Definition: DBlmapReader.cc:9
std::map< std::string, TH1F * > hPullS_shrh
Definition: CkfDebugger.h:234
float xx() const
Definition: LocalError.h:19
bool hasDelta(const PSimHit *correctHit)
Definition: CkfDebugger.h:138
std::pair< CTTRHp, double > analyseRecHitExistance(const PSimHit &sh, const TSOS &startingState)
Definition: CkfDebugger.cc:667
std::map< std::string, TH1F * > hPullY_shst
Definition: CkfDebugger.h:229
bool correctMeas(const TM &tm, const PSimHit *correctHit) const
Definition: CkfDebugger.cc:621
void printSimHits(const edm::Event &iEvent)
Definition: CkfDebugger.cc:145
std::map< std::pair< int, int >, int > dump6
Definition: CkfDebugger.h:221
virtual float length() const =0
T perp() const
Definition: PV3DBase.h:66
const MeasurementTracker * theMeasurementTracker
Definition: CkfDebugger.h:110
const LocalTrajectoryParameters & localParameters() const
std::pair< double, double > computePulls(CTTRHp recHit, TSOS startingState)
Definition: CkfDebugger.h:178
TH2F * hPullGPXvsGPeta_shst
Definition: CkfDebugger.h:248
void dumpSimHit(const SimHit &hit) const
Definition: CkfDebugger.cc:174
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:47
const MagneticField * theMagField
Definition: CkfDebugger.h:105
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const =0
const TransientTrackingRecHitBuilder * theTTRHBuilder
Definition: CkfDebugger.h:111
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
std::map< std::string, TH1F * > hPullGP_Z_shst
Definition: CkfDebugger.h:242
const GeometricSearchTracker * theGeomSearchTracker
Definition: CkfDebugger.h:106
TransientTrackingRecHit::ConstRecHitContainer RecHitContainer
virtual const GeomDet & geomDet() const
virtual std::vector< const DetLayer * > nextLayers(NavigationDirection direction) const
Definition: DetLayer.cc:35
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
T y() const
Definition: PV3DBase.h:57
std::map< std::string, TH1F * > hPullY_strh
Definition: CkfDebugger.h:231
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
std::map< std::string, TH1F * > hPullM_shrh
Definition: CkfDebugger.h:233
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const BoundSurface & surface() const
std::map< std::string, TH1F * > hPullX_shst
Definition: CkfDebugger.h:228
int partner_det_not_fuond
Definition: CkfDebugger.h:266
std::vector< const PSimHit * > nextCorrectHits(const Trajectory &, unsigned int &)
Definition: CkfDebugger.cc:516
int det_not_found
Definition: CkfDebugger.h:256
unsigned int partnerDetId() const
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit)
int seedWithDelta
Definition: CkfDebugger.h:251
std::map< std::string, TH1F * > hPullM_shst
Definition: CkfDebugger.h:235
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
Definition: CkfDebugger.h:107
int matched_not_found
Definition: CkfDebugger.h:264
unsigned int trackId() const
Definition: CkfDebugger.h:85
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
RecHitPointer project(const TransientTrackingRecHit &hit, const GeomDet &det, const TrajectoryStateOnSurface &ts) const
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &) const =0
DataContainer const & measurements() const
Definition: Trajectory.h:169
AlgebraicVector5 vector() const
CkfDebugger(edm::EventSetup const &es)
Definition: CkfDebugger.cc:35
int analyseRecHitNotFound(const Trajectory &, CTTRHp)
Definition: CkfDebugger.cc:889
int iEvent
Definition: GenABIO.cc:243
unsigned int glued() const
glued
T mag() const
Definition: PV3DBase.h:61
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
std::map< std::string, TH1F * > hPullGP_Y_shst
Definition: CkfDebugger.h:241
int layer(const GeomDetUnit *det)
Definition: CkfDebugger.h:154
float timeOfFlight() const
Definition: PSimHit.h:69
double testSeed(CTTRHp, CTTRHp, TrajectoryStateOnSurface)
Definition: CkfDebugger.cc:974
int particleType() const
Definition: CkfDebugger.h:92
int matched_not_associated
Definition: CkfDebugger.h:265
float yy() const
Definition: LocalError.h:21
Local3DPoint localPosition() const
Definition: PSimHit.h:44
bool associated(CTTRHp rechit, const PSimHit &sh) const
Definition: CkfDebugger.cc:601
const CartesianTrajectoryError & cartesianError() const
int only_one_component
Definition: CkfDebugger.h:263
T sqrt(T t)
Definition: SSEVec.h:28
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:147
T z() const
Definition: PV3DBase.h:58
tuple result
Definition: query.py:137
int assocTrackId(CTTRHp rechit) const
Definition: CkfDebugger.cc:498
TH2F * hPullGPXvsGPr_shst
Definition: CkfDebugger.h:247
int glued_det_not_fuond
Definition: CkfDebugger.h:267
TH1F * hchi2seedAll
Definition: CkfDebugger.h:224
int j
Definition: DBlmapReader.cc:9
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
TrackerHitAssociator * hitAssociator
Definition: CkfDebugger.h:109
TH2F * hPullGPXvsGPY_shst
Definition: CkfDebugger.h:245
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:74
TransientTrackingRecHit::ConstRecHitPointer CTTRHp
Definition: CkfDebugger.h:44
TrajectoryStateOnSurface updatedState() const
const AlgebraicSymMatrix55 & matrix() const
std::map< std::string, TH1F * > hPullX_shrh
Definition: CkfDebugger.h:226
const LocalTrajectoryError & localError() const
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::map< std::string, TH1F * > hPullGP_X_shst
Definition: CkfDebugger.h:240
#define LogTrace(id)
const Surface::PositionType & position() const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
GlobalError position() const
Position error submatrix.
const Propagator * theForwardPropagator
Definition: CkfDebugger.h:108
bool correctTrajectory(const Trajectory &, unsigned int &) const
Definition: CkfDebugger.cc:456
int chi2gt30deltaSeed
Definition: CkfDebugger.h:259
Definition: DetId.h:20
const Bounds & bounds() const
Definition: BoundSurface.h:89
CLHEP::HepVector AlgebraicVector
std::map< std::string, TH1F * > hPullM_strh
Definition: CkfDebugger.h:237
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:160
float pabs() const
Definition: CkfDebugger.h:89
std::map< std::string, TH1F * > hPullS_shst
Definition: CkfDebugger.h:236
ROOT::Math::SVector< double, 5 > AlgebraicVector5
int simple_hit_not_found
Definition: CkfDebugger.h:261
AlgebraicVector measuredParameters(const TransientTrackingRecHit &)
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
std::map< std::pair< int, int >, int > dump2
Definition: CkfDebugger.h:217
const T & get() const
Definition: EventSetup.h:55
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
std::map< std::string, TH1F * > hPullS_strh
Definition: CkfDebugger.h:238
unsigned short processType() const
Definition: PSimHit.h:118
TFile * file
Definition: CkfDebugger.h:223
char state
Definition: procUtils.cc:75
T eta() const
Definition: PV3DBase.h:70
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const TrackerGeometry * theTrackerGeom
Definition: CkfDebugger.h:104
const GeomDetUnit * det(const PSimHit *sh) const
Definition: CkfDebugger.h:152
edm::EventID id() const
Definition: EventBase.h:56
#define begin
Definition: vmac.h:31
bool goodSimHit(const PSimHit &sh) const
Definition: CkfDebugger.cc:594
std::map< std::string, TH1F * > hPullY_shrh
Definition: CkfDebugger.h:227
TH2F * hPullGPXvsGPX_shst
Definition: CkfDebugger.h:244
const Surface & surface() const
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< PSimHit > associateHit(const TrackingRecHit &thit)
unsigned int trackId() const
Definition: PSimHit.h:102
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: Trajectory.h:250
std::map< std::string, TH1F * > hPullX_strh
Definition: CkfDebugger.h:230
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
int layer_not_found
Definition: CkfDebugger.h:255
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
int no_component
Definition: CkfDebugger.h:262
TH2F * hPullGPXvsGPZ_shst
Definition: CkfDebugger.h:246
std::vector< int > dump
Definition: CkfDebugger.h:216
const PSimHit * pSimHit(unsigned int tkId, DetId detId)
Definition: CkfDebugger.cc:877
std::map< std::pair< int, int >, int > dump5
Definition: CkfDebugger.h:220
Global3DPoint position(const PSimHit *sh) const
Definition: CkfDebugger.h:149
std::map< unsigned int, std::vector< PSimHit * > > idHitsMap
Definition: CkfDebugger.h:113
T x() const
Definition: PV3DBase.h:56
virtual float width() const =0
DetId gluedId(const DetId &du)
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
bool analyseCompatibleMeasurements(const Trajectory &, const std::vector< TrajectoryMeasurement > &, const MeasurementTracker *, const Propagator *, const Chi2MeasurementEstimatorBase *, const TransientTrackingRecHitBuilder *)
Definition: CkfDebugger.cc:186
mathSSE::Vec4< T > v
TH1F * hchi2seedProb
Definition: CkfDebugger.h:224
unsigned int detUnitId() const
Definition: PSimHit.h:93
std::map< std::pair< int, int >, int > dump4
Definition: CkfDebugger.h:219
TH2F * hPullGPXvsGPphi_shst
Definition: CkfDebugger.h:249
int chi2gt30delta
Definition: CkfDebugger.h:258
std::map< std::pair< int, int >, int > dump3
Definition: CkfDebugger.h:218