CMS 3D CMS Logo

Static Public Member Functions

PrintoutHelper Class Reference

#include <PrintoutHelper.h>

List of all members.

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 cmsutils::bqueue< TrajectoryMeasurement > &v)
static std::string dumpMeasurements (const std::vector< 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(), prof2calltree::last, LogDebug, TrajectoryMeasurement::predictedState(), TrajectoryMeasurement::recHit(), and TrajectoryMeasurement::updatedState().

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

                                                                               {

  LogDebug("PrintoutHelperError")<<"switching on error printout"<<(showErrors=true);

  std::stringstream buffer;
  if (!traj.measurements().empty()){
    const TrajectoryMeasurement & last = traj.lastMeasurement();
    
    buffer<<"with: "<<traj.measurements().size()<<" measurements."<< traj.lostHits() << " lost, " << traj.foundHits()<<" found, chi2="<<traj.chiSquared()<<"\n";
    if (last.updatedState().isValid()) {
      const TrajectoryStateOnSurface & tsos = last.updatedState();
      if (showErrors)
        buffer <<"Last [Updated] state\n : "<<tsos<<"\n";
      else
        buffer <<"Last [Updated] state\n x: "<<tsos.globalPosition()<<"\n p: "<<tsos.globalMomentum()<<"\n";
    } else if(last.forwardPredictedState().isValid()){
      const TrajectoryStateOnSurface & tsos = last.forwardPredictedState();
      if (showErrors)
        buffer <<"Last [fwdPredicted] state\n : "<<tsos<<"\n";
      else
        buffer <<"Last [fwdPredicted] state\n x: "<<tsos.globalPosition()<<"\n p: "<<tsos.globalMomentum()<<"\n";
    } else if (last.predictedState().isValid()){
      const TrajectoryStateOnSurface & tsos = last.predictedState();
      if (showErrors)
        buffer <<"Last [Predicted] state\n : "<<tsos<<"\n";
      else
        buffer <<"Last [Predicted] state\n x: "<<tsos.globalPosition()<<"\n p: "<<tsos.globalMomentum()<<"\n";
    }
    buffer <<" hit is: "<<(last.recHit()->isValid()?"valid":"invalid")<<"\n";
    if (last.recHit()->isValid())
      buffer <<"on detId: "<<last.recHit()->geographicalId().rawId()<<"\n";  
  }
  else{
      buffer<<" no measurement. \n";}
  return buffer.str();
}
template<class collection >
std::string PrintoutHelper::dumpCandidates ( collection &  candidates) [static]

Definition at line 63 of file PrintoutHelper.h.

References dumpCandidate().

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

                                                                 {
  std::stringstream buffer;
  unsigned int ic=0;
  typename collection::const_iterator traj=candidates.begin();
  for (;traj!=candidates.end(); traj++) {  
    buffer<<ic++<<"] ";
    buffer<<PrintoutHelper::dumpCandidate(*traj);
  }
  return buffer.str();
}
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().

{
  std::stringstream buffer;
  buffer
    <<"layer pointer: "<<tm.layer()<<"\n"
    <<"estimate: "<<tm.estimate()<<"\n";
  if (tm.updatedState().isValid())
    buffer<<"updated state: \n"
          <<"x: "<<tm.updatedState().globalPosition()<<"\n"
          <<"p: "<<tm.updatedState().globalMomentum()<<"\n";
  else if (tm.forwardPredictedState().isValid())
    buffer<<"forward predicted state: \n"
          <<"x: "<<tm.forwardPredictedState().globalPosition()<<"\n"
          <<"p: "<<tm.forwardPredictedState().globalMomentum()<<"\n";
  else if(tm.predictedState().isValid())
    buffer<<"predicted state: \n"
          <<"x: "<<tm.predictedState().globalPosition()<<"\n"
          <<"p: "<<tm.predictedState().globalMomentum()<<"\n";
  else buffer<<"no valid state\n";
  buffer
    //        <<"geomdet pointer from rechit: "<<tm.recHit()->det()<<"\n"
    <<"detId: "<<tm.recHit()->geographicalId().rawId();
  if (tm.recHit()->isValid()){
    buffer<<"\n hit global x: "<<tm.recHit()->globalPosition()
          <<"\n hit global error: "<<tm.recHit()->globalPositionError().matrix()
          <<"\n hit local x:"<<tm.recHit()->localPosition()
          <<"\n hit local error"<<tm.recHit()->localPositionError();
  }else buffer<<"\n (-,-,-)";
  buffer<<"\n fwdPred " << tm.forwardPredictedState().isValid()
        <<"\n bwdPred " << tm.backwardPredictedState().isValid()
        <<"\n upPred " << tm.updatedState().isValid();
  //SimIdPrinter()(tm.recHit());
  return buffer.str();
}
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().

{
  std::stringstream buffer;
  buffer<<v.size()<<" total measurements\n";
  cmsutils::bqueue<TrajectoryMeasurement>::const_iterator it=v.rbegin();
  for (; it!=v.rend();--it){
    buffer<<dumpMeasurement(*it);
    buffer<<"\n";}
  return buffer.str();
}
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().

{
  std::stringstream buffer;
  buffer<<v.size()<<" total measurements\n";
  std::vector<TrajectoryMeasurement>::const_iterator it=v.begin();
  for (; it!=v.end();++it){
    buffer<<dumpMeasurement(*it);
    buffer<<"\n";}
  return buffer.str();
}
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().

                                            {
  std::stringstream buffer;
  
  /*
    for(iseed=theSeedColl.begin();iseed!=theSeedColl.end();iseed++){
    DetId tmpId = DetId( iseed->startingState().detId());
    const GeomDet* tmpDet  = tracker->idToDet( tmpId );
    GlobalVector gv = tmpDet->surface().toGlobal( iseed->startingState().parameters().momentum() );
    
    LogTrace("TrackingRegressionTest") << "seed perp,phi,eta : " 
    << gv.perp() << " , " 
    << gv.phi() << " , " 
    << gv.eta() ;
    }
  */
  
  buffer<< "number of finalTrajectories: " << unsmoothedResult.size()<<std::endl;
  for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin();
       it != unsmoothedResult.end(); it++) {
    if (it->lastMeasurement().updatedState().isValid()) {
      buffer<< "candidate's n valid and invalid hit, chi2, pt : " 
         << it->foundHits() << " , " 
         << it->lostHits() <<" , " 
         << it->chiSquared() << " , "
         << it->lastMeasurement().updatedState().globalMomentum().perp()<<std::endl;
    } else if (it->lastMeasurement().predictedState().isValid()) {
      buffer<< "candidate's n valid and invalid hit, chi2, pt : " 
         << it->foundHits() << " , " 
         << it->lostHits() <<" , " 
         << it->chiSquared() << " , "
         << it->lastMeasurement().predictedState().globalMomentum().perp()<<std::endl;
    } else buffer<< "candidate with invalid last measurement state!"<<std::endl;
  }
  buffer<<"=================================================";
  return buffer.str();
}