CMS 3D CMS Logo

List of all members | Static Public Member Functions
PrintoutHelper Class Reference

#include <PrintoutHelper.h>

Static Public Member Functions

template<class Candidate >
static std::string dumpCandidate (const Candidate &candidate, bool showErrors=false)
 
template<class collection >
static std::string dumpCandidates (collection &candidates)
 
static std::string dumpMeasurement (const TrajectoryMeasurement &tm)
 
static std::string dumpMeasurements (const std::vector< TrajectoryMeasurement > &v)
 
static std::string dumpMeasurements (const cmsutils::bqueue< TrajectoryMeasurement > &v)
 
static std::string regressionTest (const TrackerGeometry &tracker, std::vector< Trajectory > &unsmoothedResult)
 

Detailed Description

Definition at line 12 of file PrintoutHelper.h.

Member Function Documentation

template<class Candidate >
std::string PrintoutHelper::dumpCandidate ( const Candidate &  candidate,
bool  showErrors = false 
)
static

Definition at line 25 of file PrintoutHelper.h.

References edmScanValgrind::buffer, TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::globalPosition(), createfilelist::int, TrajectoryStateOnSurface::isValid(), dqmdumpme::last, LogDebug, TrajectoryMeasurement::predictedState(), TrajectoryMeasurement::recHit(), and TrajectoryMeasurement::updatedState().

Referenced by BaseCkfTrajectoryBuilder::createStartingTrajectory(), and dumpCandidates().

25  {
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 }
#define LogDebug(id)
TrajectoryStateOnSurface const & predictedState() const
ConstRecHitPointer const & recHit() const
GlobalPoint globalPosition() const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
TrajectoryStateOnSurface const & updatedState() const
template<class collection >
std::string PrintoutHelper::dumpCandidates ( collection &  candidates)
static

Definition at line 69 of file PrintoutHelper.h.

References edmScanValgrind::buffer, and dumpCandidate().

Referenced by GroupedCkfTrajectoryBuilder::groupedLimitedCandidates(), CkfTrajectoryBuilder::limitedCandidates(), cms::CkfTrackCandidateMakerBase::produceBase(), and GroupedCkfTrajectoryBuilder::rebuildSeedingRegion().

69  {
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 }
static std::string dumpCandidate(const Candidate &candidate, bool showErrors=false)
std::string PrintoutHelper::dumpMeasurement ( const TrajectoryMeasurement tm)
static

Definition at line 41 of file PrintoutHelper.cc.

References TrajectoryMeasurement::backwardPredictedState(), edmScanValgrind::buffer, TrajectoryMeasurement::estimate(), TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), TrajectoryMeasurement::layer(), TrajectoryMeasurement::predictedState(), TrajectoryMeasurement::recHit(), and TrajectoryMeasurement::updatedState().

Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), and dumpMeasurements().

41  {
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
60  // <<"geomdet pointer from rechit: "<<tm.recHit()->det()<<"\n"
61  << "detId: " << tm.recHit()->geographicalId().rawId();
62  if (tm.recHit()->isValid()) {
63  buffer << "\n hit global x: " << tm.recHit()->globalPosition()
64  << "\n hit global error: " << tm.recHit()->globalPositionError().matrix()
65  << "\n hit local x:" << tm.recHit()->localPosition() << "\n hit local error"
66  << tm.recHit()->localPositionError();
67  } else
68  buffer << "\n (-,-,-)";
69  buffer << "\n fwdPred " << tm.forwardPredictedState().isValid() << "\n bwdPred "
70  << tm.backwardPredictedState().isValid() << "\n upPred " << tm.updatedState().isValid();
71  //SimIdPrinter()(tm.recHit());
72  return buffer.str();
73 }
TrajectoryStateOnSurface const & predictedState() const
ConstRecHitPointer const & recHit() const
GlobalPoint globalPosition() const
const DetLayer * layer() const
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
GlobalVector globalMomentum() const
TrajectoryStateOnSurface const & updatedState() const
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
std::string PrintoutHelper::dumpMeasurements ( const std::vector< TrajectoryMeasurement > &  v)
static

Definition at line 21 of file PrintoutHelper.cc.

References edmScanValgrind::buffer, and dumpMeasurement().

Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), MuonCkfTrajectoryBuilder::collectMeasurement(), CkfTrajectoryBuilder::findCompatibleMeasurements(), and GroupedCkfTrajectoryBuilder::rebuildSeedingRegion().

21  {
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 }
static std::string dumpMeasurement(const TrajectoryMeasurement &tm)
std::string PrintoutHelper::dumpMeasurements ( const cmsutils::bqueue< TrajectoryMeasurement > &  v)
static

Definition at line 31 of file PrintoutHelper.cc.

References edmScanValgrind::buffer, dumpMeasurement(), cmsutils::bqueue< T >::rbegin(), cmsutils::bqueue< T >::rend(), and cmsutils::bqueue< T >::size().

31  {
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 }
const_iterator rend() const
Definition: bqueue.h:198
static std::string dumpMeasurement(const TrajectoryMeasurement &tm)
const_iterator rbegin() const
Definition: bqueue.h:197
size_type size() const
Definition: bqueue.h:201
std::string PrintoutHelper::regressionTest ( const TrackerGeometry tracker,
std::vector< Trajectory > &  unsmoothedResult 
)
static

Definition at line 75 of file PrintoutHelper.cc.

References edmScanValgrind::buffer.

Referenced by cms::CkfTrackCandidateMakerBase::produceBase().

75  {
76  std::stringstream buffer;
77 
78  /*
79  for(iseed=theSeedColl.begin();iseed!=theSeedColl.end();iseed++){
80  DetId tmpId = DetId( iseed->startingState().detId());
81  const GeomDet* tmpDet = tracker->idToDet( tmpId );
82  GlobalVector gv = tmpDet->surface().toGlobal( iseed->startingState().parameters().momentum() );
83 
84  LogTrace("TrackingRegressionTest") << "seed perp,phi,eta : "
85  << gv.perp() << " , "
86  << gv.phi() << " , "
87  << gv.eta() ;
88  }
89  */
90 
91  buffer << "number of finalTrajectories: " << unsmoothedResult.size() << std::endl;
92  for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
93  if (it->lastMeasurement().updatedState().isValid()) {
94  buffer << "candidate's n valid and invalid hit, chi2, pt, eta : " << it->foundHits() << " , " << it->lostHits()
95  << " , " << it->chiSquared() << " , " << it->lastMeasurement().updatedState().globalMomentum().perp()
96  << " , " << it->lastMeasurement().updatedState().globalMomentum().eta() << std::endl;
97  } else if (it->lastMeasurement().predictedState().isValid()) {
98  buffer << "candidate's n valid and invalid hit, chi2, pt, eta : " << it->foundHits() << " , " << it->lostHits()
99  << " , " << it->chiSquared() << " , " << it->lastMeasurement().predictedState().globalMomentum().perp()
100  << " , " << it->lastMeasurement().predictedState().globalMomentum().eta() << std::endl;
101  } else
102  buffer << "candidate with invalid last measurement state!" << std::endl;
103  }
104  buffer << "=================================================";
105  return buffer.str();
106 }