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  }
56  else{
57  buffer<<" no measurement. \n";}
58  return buffer.str();
59 }
60 
61 
62 template< class collection >
64  std::stringstream buffer;
65  unsigned int ic=0;
66  typename collection::const_iterator traj=candidates.begin();
67  for (;traj!=candidates.end(); traj++) {
68  buffer<<ic++<<"] ";
69  buffer<<PrintoutHelper::dumpCandidate(*traj);
70  }
71  return buffer.str();
72 }
73 
74 
75 #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