CMS 3D CMS Logo

PrintoutHelper.cc
Go to the documentation of this file.
2 
7 
14 
18 
20 
21 std::string PrintoutHelper::dumpMeasurements(const std::vector<TrajectoryMeasurement>& v) {
22  std::stringstream buffer;
23  buffer << v.size() << " total measurements\n";
24  std::vector<TrajectoryMeasurement>::const_iterator it = v.begin();
25  for (; it != v.end(); ++it) {
26  buffer << dumpMeasurement(*it);
27  buffer << "\n";
28  }
29  return buffer.str();
30 }
32  std::stringstream buffer;
33  buffer << v.size() << " total measurements\n";
35  for (; it != v.rend(); --it) {
36  buffer << dumpMeasurement(*it);
37  buffer << "\n";
38  }
39  return buffer.str();
40 }
42  std::stringstream buffer;
43  buffer << "layer pointer: " << tm.layer() << "\n"
44  << "estimate: " << tm.estimate() << "\n";
45  if (tm.updatedState().isValid())
46  buffer << "updated state: \n"
47  << "x: " << tm.updatedState().globalPosition() << "\n"
48  << "p: " << tm.updatedState().globalMomentum() << "\n";
49  else if (tm.forwardPredictedState().isValid())
50  buffer << "forward predicted state: \n"
51  << "x: " << tm.forwardPredictedState().globalPosition() << "\n"
52  << "p: " << tm.forwardPredictedState().globalMomentum() << "\n";
53  else if (tm.predictedState().isValid())
54  buffer << "predicted state: \n"
55  << "x: " << tm.predictedState().globalPosition() << "\n"
56  << "p: " << tm.predictedState().globalMomentum() << "\n";
57  else
58  buffer << "no valid state\n";
59  buffer << "detId: " << tm.recHit()->geographicalId().rawId();
60  if (tm.recHit()->isValid()) {
61  buffer << "\n hit global x: " << tm.recHit()->globalPosition()
62  << "\n hit global error: " << tm.recHit()->globalPositionError().matrix()
63  << "\n hit local x:" << tm.recHit()->localPosition() << "\n hit local error"
64  << tm.recHit()->localPositionError();
65  } else
66  buffer << "\n (-,-,-)";
67  buffer << "\n fwdPred " << tm.forwardPredictedState().isValid() << "\n bwdPred "
68  << tm.backwardPredictedState().isValid() << "\n upPred " << tm.updatedState().isValid();
69  //SimIdPrinter()(tm.recHit());
70  return buffer.str();
71 }
72 
73 std::string PrintoutHelper::regressionTest(const TrackerGeometry& tracker, std::vector<Trajectory>& unsmoothedResult) {
74  std::stringstream buffer;
75 
76  buffer << "number of finalTrajectories: " << unsmoothedResult.size() << std::endl;
77  for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
78  if (it->lastMeasurement().updatedState().isValid()) {
79  buffer << "candidate's n valid and invalid hit, chi2, pt, eta : " << it->foundHits() << " , " << it->lostHits()
80  << " , " << it->chiSquared() << " , " << it->lastMeasurement().updatedState().globalMomentum().perp()
81  << " , " << it->lastMeasurement().updatedState().globalMomentum().eta() << std::endl;
82  } else if (it->lastMeasurement().predictedState().isValid()) {
83  buffer << "candidate's n valid and invalid hit, chi2, pt, eta : " << it->foundHits() << " , " << it->lostHits()
84  << " , " << it->chiSquared() << " , " << it->lastMeasurement().predictedState().globalMomentum().perp()
85  << " , " << it->lastMeasurement().predictedState().globalMomentum().eta() << std::endl;
86  } else
87  buffer << "candidate with invalid last measurement state!" << std::endl;
88  }
89  buffer << "=================================================";
90  buffer << "=========== Traj in details =====================\n";
91  for (const auto& it : unsmoothedResult) {
92  for (const auto& hit : it.measurements()) {
93  buffer << "measurement : " << hit.recHit()->geographicalId().rawId() << std::endl;
94  }
95  buffer << "================\n";
96  }
97  return buffer.str();
98 }
TrajectoryStateOnSurface const & predictedState() const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
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)
GlobalPoint globalPosition() const
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
GlobalVector globalMomentum() const
TrajectoryStateOnSurface const & updatedState() const
const DetLayer * layer() const
ConstRecHitPointer const & recHit() const