CMS 3D CMS Logo

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()) {
44  const TrajectoryStateOnSurface& tsos = last.forwardPredictedState();
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 ");
76  }
77  buffer << "\n____________________________\n";
78  return buffer.str();
79 }
80 
81 #endif
MessageLogger.h
PrintoutHelper::dumpCandidates
static std::string dumpCandidates(collection &candidates)
Definition: PrintoutHelper.h:69
configurableAnalysis::Candidate
char Candidate[]
Definition: modules.cc:20
PrintoutHelper::regressionTest
static std::string regressionTest(const TrackerGeometry &tracker, std::vector< Trajectory > &unsmoothedResult)
Definition: PrintoutHelper.cc:75
TrajectoryMeasurement.h
PrintoutHelper
Definition: PrintoutHelper.h:12
findQualityFiles.v
v
Definition: findQualityFiles.py:179
PrintoutHelper::dumpMeasurement
static std::string dumpMeasurement(const TrajectoryMeasurement &tm)
Definition: PrintoutHelper.cc:41
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
dqmdumpme.last
last
Definition: dqmdumpme.py:56
PrintoutHelper::dumpMeasurements
static std::string dumpMeasurements(const std::vector< TrajectoryMeasurement > &v)
Definition: PrintoutHelper.cc:21
cmsutils::bqueue< TrajectoryMeasurement >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
PrintoutHelper::dumpCandidate
static std::string dumpCandidate(const Candidate &candidate, bool showErrors=false)
Definition: PrintoutHelper.h:25
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
createfilelist.int
int
Definition: createfilelist.py:10
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
bqueue.h
Trajectory.h
HLT_2018_cff.candidates
candidates
Definition: HLT_2018_cff.py:53513
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
TrackerGeometry
Definition: TrackerGeometry.h:14