CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PrintoutHelper.h
Go to the documentation of this file.
1 #ifndef RecoTracker_CkfPattern_PrintoutHelper_h
2 #define RecoTracker_CkfPattern_PrintoutHelper_h
3 
5 
9 
10 class TrackerGeometry;
11 
13 public:
14  template <class collection>
16  template <class Candidate>
17  static std::string dumpCandidate(const Candidate& candidate, bool showErrors = false);
18  static std::string dumpMeasurements(const std::vector<TrajectoryMeasurement>& v);
21  static std::string regressionTest(const TrackerGeometry& tracker, std::vector<Trajectory>& unsmoothedResult);
22 };
23 
24 template <class Candidate>
25 std::string PrintoutHelper::dumpCandidate(const Candidate& traj, bool showErrors) {
26  // does not work....
27  LogDebug("PrintoutHelperError") << "switching on error printout" << (showErrors = true);
28 
29  std::stringstream buffer;
30  if (!traj.measurements().empty()) {
31  const TrajectoryMeasurement& last = traj.lastMeasurement();
32 
33  buffer << "with: " << traj.measurements().size() << " measurements." << traj.lostHits() << " lost, "
34  << traj.foundHits() << " found, " << traj.trailingFoundHits() << " trailing, " << traj.cccBadHits()
35  << " badCC, "
36  << "chi2=" << traj.chiSquared() << ' ' << int(traj.nLoops()) << " loops\n";
37  if (last.updatedState().isValid()) {
38  const TrajectoryStateOnSurface& tsos = last.updatedState();
39  if (showErrors)
40  buffer << "Last [Updated] state\n : " << tsos << "\n";
41  else
42  buffer << "Last [Updated] state\n x: " << tsos.globalPosition() << "\n p: " << tsos.globalMomentum() << "\n";
43  } else if (last.forwardPredictedState().isValid()) {
45  if (showErrors)
46  buffer << "Last [fwdPredicted] state\n : " << tsos << "\n";
47  else
48  buffer << "Last [fwdPredicted] state\n x: " << tsos.globalPosition() << "\n p: " << tsos.globalMomentum()
49  << "\n";
50  } else if (last.predictedState().isValid()) {
51  const TrajectoryStateOnSurface& tsos = last.predictedState();
52  if (showErrors)
53  buffer << "Last [Predicted] state\n : " << tsos << "\n";
54  else
55  buffer << "Last [Predicted] state\n x: " << tsos.globalPosition() << "\n p: " << tsos.globalMomentum() << "\n";
56  }
57  buffer << " hit is: " << (last.recHit()->isValid() ? "valid" : "invalid") << "\n";
58  if (last.recHit()->isValid()) {
59  buffer << "on detId: " << last.recHit()->geographicalId().rawId() << "\n";
60  buffer << "gp: " << last.recHit()->globalPosition() << "\n";
61  }
62  } else {
63  buffer << " no measurement. \n";
64  }
65  return buffer.str();
66 }
67 
68 template <class collection>
70  std::stringstream buffer;
71  buffer << "\n____________________________\n";
72  unsigned int ic = 0;
73  for (auto const& traj : candidates) {
74  buffer << ic++ << "] " << (traj.isValid() ? "valid " : "invalid ");
75  buffer << PrintoutHelper::dumpCandidate(traj);
76  }
77  buffer << "\n____________________________\n";
78  return buffer.str();
79 }
80 
81 #endif
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
tuple last
Definition: dqmdumpme.py:56
#define LogDebug(id)