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