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