test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 13 of file PrintoutHelper.h.

Member Function Documentation

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

Definition at line 24 of file PrintoutHelper.h.

References TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), plotBeamSpotDB::last, LogDebug, TrajectoryMeasurement::predictedState(), TrajectoryMeasurement::recHit(), and TrajectoryMeasurement::updatedState().

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

24  {
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  buffer <<"gp: "<<last.recHit()->globalPosition()<<"\n";
56  }
57  }
58  else{
59  buffer<<" no measurement. \n";}
60  return buffer.str();
61 }
#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 65 of file PrintoutHelper.h.

References dumpCandidate().

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

65  {
66  std::stringstream buffer;
67  unsigned int ic=0;
68  typename collection::const_iterator traj=candidates.begin();
69  for (;traj!=candidates.end(); traj++) {
70  buffer<<ic++<<"] ";
71  buffer<<PrintoutHelper::dumpCandidate(*traj);
72  }
73  return buffer.str();
74 }
static std::string dumpCandidate(const Candidate &candidate, bool showErrors=false)
std::string PrintoutHelper::dumpMeasurement ( const TrajectoryMeasurement tm)
static

Definition at line 42 of file PrintoutHelper.cc.

References TrajectoryMeasurement::backwardPredictedState(), 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().

43 {
44  std::stringstream buffer;
45  buffer
46  <<"layer pointer: "<<tm.layer()<<"\n"
47  <<"estimate: "<<tm.estimate()<<"\n";
48  if (tm.updatedState().isValid())
49  buffer<<"updated state: \n"
50  <<"x: "<<tm.updatedState().globalPosition()<<"\n"
51  <<"p: "<<tm.updatedState().globalMomentum()<<"\n";
52  else if (tm.forwardPredictedState().isValid())
53  buffer<<"forward predicted state: \n"
54  <<"x: "<<tm.forwardPredictedState().globalPosition()<<"\n"
55  <<"p: "<<tm.forwardPredictedState().globalMomentum()<<"\n";
56  else if(tm.predictedState().isValid())
57  buffer<<"predicted state: \n"
58  <<"x: "<<tm.predictedState().globalPosition()<<"\n"
59  <<"p: "<<tm.predictedState().globalMomentum()<<"\n";
60  else buffer<<"no valid state\n";
61  buffer
62  // <<"geomdet pointer from rechit: "<<tm.recHit()->det()<<"\n"
63  <<"detId: "<<tm.recHit()->geographicalId().rawId();
64  if (tm.recHit()->isValid()){
65  buffer<<"\n hit global x: "<<tm.recHit()->globalPosition()
66  <<"\n hit global error: "<<tm.recHit()->globalPositionError().matrix()
67  <<"\n hit local x:"<<tm.recHit()->localPosition()
68  <<"\n hit local error"<<tm.recHit()->localPositionError();
69  }else buffer<<"\n (-,-,-)";
70  buffer<<"\n fwdPred " << tm.forwardPredictedState().isValid()
71  <<"\n bwdPred " << tm.backwardPredictedState().isValid()
72  <<"\n upPred " << tm.updatedState().isValid();
73  //SimIdPrinter()(tm.recHit());
74  return buffer.str();
75 }
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 22 of file PrintoutHelper.cc.

References dumpMeasurement().

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

23 {
24  std::stringstream buffer;
25  buffer<<v.size()<<" total measurements\n";
26  std::vector<TrajectoryMeasurement>::const_iterator it=v.begin();
27  for (; it!=v.end();++it){
28  buffer<<dumpMeasurement(*it);
29  buffer<<"\n";}
30  return buffer.str();
31 }
static std::string dumpMeasurement(const TrajectoryMeasurement &tm)
std::string PrintoutHelper::dumpMeasurements ( const cmsutils::bqueue< TrajectoryMeasurement > &  v)
static

Definition at line 32 of file PrintoutHelper.cc.

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

33 {
34  std::stringstream buffer;
35  buffer<<v.size()<<" total measurements\n";
37  for (; it!=v.rend();--it){
38  buffer<<dumpMeasurement(*it);
39  buffer<<"\n";}
40  return buffer.str();
41 }
const_iterator rend() const
Definition: bqueue.h:164
static std::string dumpMeasurement(const TrajectoryMeasurement &tm)
const_iterator rbegin() const
Definition: bqueue.h:163
size_type size() const
Definition: bqueue.h:167
std::string PrintoutHelper::regressionTest ( const TrackerGeometry tracker,
std::vector< Trajectory > &  unsmoothedResult 
)
static

Definition at line 78 of file PrintoutHelper.cc.

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

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