CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoTracker/CkfPattern/src/PrintoutHelper.cc

Go to the documentation of this file.
00001 #include "RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h"
00002 
00003 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
00004 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00005 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
00006 #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h"
00007 
00008   
00009 #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h"
00010 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00011 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00012 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
00013 #include "TrackingTools/TrajectoryState/interface/BasicSingleTrajectoryState.h"
00014 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorBase.h"
00015 
00016 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
00017 #include "TrackingTools/PatternTools/interface/TempTrajectory.h"
00018 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00019 
00020 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00021 
00022 std::string PrintoutHelper::dumpMeasurements(const std::vector<TrajectoryMeasurement> & v) 
00023 {
00024   std::stringstream buffer;
00025   buffer<<v.size()<<" total measurements\n";
00026   std::vector<TrajectoryMeasurement>::const_iterator it=v.begin();
00027   for (; it!=v.end();++it){
00028     buffer<<dumpMeasurement(*it);
00029     buffer<<"\n";}
00030   return buffer.str();
00031 }
00032 std::string PrintoutHelper::dumpMeasurements(const cmsutils::bqueue<TrajectoryMeasurement> & v) 
00033 {
00034   std::stringstream buffer;
00035   buffer<<v.size()<<" total measurements\n";
00036   cmsutils::bqueue<TrajectoryMeasurement>::const_iterator it=v.rbegin();
00037   for (; it!=v.rend();--it){
00038     buffer<<dumpMeasurement(*it);
00039     buffer<<"\n";}
00040   return buffer.str();
00041 }
00042 std::string PrintoutHelper::dumpMeasurement(const TrajectoryMeasurement & tm)
00043 {
00044   std::stringstream buffer;
00045   buffer
00046     <<"layer pointer: "<<tm.layer()<<"\n"
00047     <<"estimate: "<<tm.estimate()<<"\n";
00048   if (tm.updatedState().isValid())
00049     buffer<<"updated state: \n"
00050           <<"x: "<<tm.updatedState().globalPosition()<<"\n"
00051           <<"p: "<<tm.updatedState().globalMomentum()<<"\n";
00052   else if (tm.forwardPredictedState().isValid())
00053     buffer<<"forward predicted state: \n"
00054           <<"x: "<<tm.forwardPredictedState().globalPosition()<<"\n"
00055           <<"p: "<<tm.forwardPredictedState().globalMomentum()<<"\n";
00056   else if(tm.predictedState().isValid())
00057     buffer<<"predicted state: \n"
00058           <<"x: "<<tm.predictedState().globalPosition()<<"\n"
00059           <<"p: "<<tm.predictedState().globalMomentum()<<"\n";
00060   else buffer<<"no valid state\n";
00061   buffer
00062     //        <<"geomdet pointer from rechit: "<<tm.recHit()->det()<<"\n"
00063     <<"detId: "<<tm.recHit()->geographicalId().rawId();
00064   if (tm.recHit()->isValid()){
00065     buffer<<"\n hit global x: "<<tm.recHit()->globalPosition()
00066           <<"\n hit global error: "<<tm.recHit()->globalPositionError().matrix()
00067           <<"\n hit local x:"<<tm.recHit()->localPosition()
00068           <<"\n hit local error"<<tm.recHit()->localPositionError();
00069   }else buffer<<"\n (-,-,-)";
00070   buffer<<"\n fwdPred " << tm.forwardPredictedState().isValid()
00071         <<"\n bwdPred " << tm.backwardPredictedState().isValid()
00072         <<"\n upPred " << tm.updatedState().isValid();
00073   //SimIdPrinter()(tm.recHit());
00074   return buffer.str();
00075 }
00076 
00077 
00078 std::string PrintoutHelper::regressionTest(const TrackerGeometry & tracker,
00079                                            std::vector<Trajectory> & unsmoothedResult 
00080                                            ){
00081   std::stringstream buffer;
00082   
00083   /*
00084     for(iseed=theSeedColl.begin();iseed!=theSeedColl.end();iseed++){
00085     DetId tmpId = DetId( iseed->startingState().detId());
00086     const GeomDet* tmpDet  = tracker->idToDet( tmpId );
00087     GlobalVector gv = tmpDet->surface().toGlobal( iseed->startingState().parameters().momentum() );
00088     
00089     LogTrace("TrackingRegressionTest") << "seed perp,phi,eta : " 
00090     << gv.perp() << " , " 
00091     << gv.phi() << " , " 
00092     << gv.eta() ;
00093     }
00094   */
00095   
00096   buffer<< "number of finalTrajectories: " << unsmoothedResult.size()<<std::endl;
00097   for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin();
00098        it != unsmoothedResult.end(); it++) {
00099     if (it->lastMeasurement().updatedState().isValid()) {
00100       buffer<< "candidate's n valid and invalid hit, chi2, pt : " 
00101          << it->foundHits() << " , " 
00102          << it->lostHits() <<" , " 
00103          << it->chiSquared() << " , "
00104          << it->lastMeasurement().updatedState().globalMomentum().perp()<<std::endl;
00105     } else if (it->lastMeasurement().predictedState().isValid()) {
00106       buffer<< "candidate's n valid and invalid hit, chi2, pt : " 
00107          << it->foundHits() << " , " 
00108          << it->lostHits() <<" , " 
00109          << it->chiSquared() << " , "
00110          << it->lastMeasurement().predictedState().globalMomentum().perp()<<std::endl;
00111     } else buffer<< "candidate with invalid last measurement state!"<<std::endl;
00112   }
00113   buffer<<"=================================================";
00114   return buffer.str();
00115 }