test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PrintoutHelper.h
Go to the documentation of this file.
1 #ifndef RecoTracker_CkfPattern_PrintoutHelper_h
2 #define RecoTracker_CkfPattern_PrintoutHelper_h
3 
8 
10 
11 class TrackerGeometry;
12 
14  public:
15  template< class collection > static std::string dumpCandidates( collection & candidates);
16  template< class Candidate> static std::string dumpCandidate( const Candidate & candidate,bool showErrors=false);
17  static std::string dumpMeasurements(const std::vector<TrajectoryMeasurement> & v) ;
20  static std::string regressionTest(const TrackerGeometry & tracker,std::vector<Trajectory> & unsmoothedResult);
21 };
22 
23 template<class Candidate>
24 std::string PrintoutHelper::dumpCandidate( const Candidate & traj,bool showErrors ){
25 
26  LogDebug("PrintoutHelperError")<<"switching on error printout"<<(showErrors=true);
27 
28  std::stringstream buffer;
29  if (!traj.measurements().empty()){
30  const TrajectoryMeasurement & last = traj.lastMeasurement();
31 
32  buffer<<"with: "<<traj.measurements().size()<<" measurements."<< traj.lostHits() << " lost, " << traj.foundHits()<<" found, chi2="<<traj.chiSquared()<<"\n";
33  if (last.updatedState().isValid()) {
34  const TrajectoryStateOnSurface & tsos = last.updatedState();
35  if (showErrors)
36  buffer <<"Last [Updated] state\n : "<<tsos<<"\n";
37  else
38  buffer <<"Last [Updated] state\n x: "<<tsos.globalPosition()<<"\n p: "<<tsos.globalMomentum()<<"\n";
39  } else if(last.forwardPredictedState().isValid()){
40  const TrajectoryStateOnSurface & tsos = last.forwardPredictedState();
41  if (showErrors)
42  buffer <<"Last [fwdPredicted] state\n : "<<tsos<<"\n";
43  else
44  buffer <<"Last [fwdPredicted] state\n x: "<<tsos.globalPosition()<<"\n p: "<<tsos.globalMomentum()<<"\n";
45  } else if (last.predictedState().isValid()){
46  const TrajectoryStateOnSurface & tsos = last.predictedState();
47  if (showErrors)
48  buffer <<"Last [Predicted] state\n : "<<tsos<<"\n";
49  else
50  buffer <<"Last [Predicted] state\n x: "<<tsos.globalPosition()<<"\n p: "<<tsos.globalMomentum()<<"\n";
51  }
52  buffer <<" hit is: "<<(last.recHit()->isValid()?"valid":"invalid")<<"\n";
53  if (last.recHit()->isValid()) {
54  buffer <<"on detId: "<<last.recHit()->geographicalId().rawId()<<"\n";
55  buffer <<"gp: "<<last.recHit()->globalPosition()<<"\n";
56  }
57  }
58  else{
59  buffer<<" no measurement. \n";}
60  return buffer.str();
61 }
62 
63 
64 template< class collection >
66  std::stringstream buffer;
67  unsigned int ic=0;
68  typename collection::const_iterator traj=candidates.begin();
69  for (;traj!=candidates.end(); traj++) {
70  buffer<<ic++<<"] ";
71  buffer<<PrintoutHelper::dumpCandidate(*traj);
72  }
73  return buffer.str();
74 }
75 
76 
77 #endif
#define LogDebug(id)
static std::string dumpCandidates(collection &candidates)
TrajectoryStateOnSurface const & predictedState() const
ConstRecHitPointer const & recHit() const
GlobalPoint globalPosition() const
static std::string dumpMeasurement(const TrajectoryMeasurement &tm)
static std::string dumpMeasurements(const std::vector< TrajectoryMeasurement > &v)
static std::string regressionTest(const TrackerGeometry &tracker, std::vector< Trajectory > &unsmoothedResult)
static std::string dumpCandidate(const Candidate &candidate, bool showErrors=false)
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
TrajectoryStateOnSurface const & updatedState() const