Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:20

0001 #include "RecoTracker/CkfPattern/interface/BaseCkfTrajectoryBuilder.h"
0002 
0003 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
0004 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
0005 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0006 #include "TrackingTools/TrajectoryFiltering/interface/TrajectoryFilter.h"
0007 
0008 #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h"
0009 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
0010 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0011 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
0012 #include "TrackingTools/TrajectoryState/interface/BasicSingleTrajectoryState.h"
0013 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorBase.h"
0014 
0015 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
0016 #include "TrackingTools/PatternTools/interface/TempTrajectory.h"
0017 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0018 
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 
0021 std::string PrintoutHelper::dumpMeasurements(const std::vector<TrajectoryMeasurement>& v) {
0022   std::stringstream buffer;
0023   buffer << v.size() << " total measurements\n";
0024   std::vector<TrajectoryMeasurement>::const_iterator it = v.begin();
0025   for (; it != v.end(); ++it) {
0026     buffer << dumpMeasurement(*it);
0027     buffer << "\n";
0028   }
0029   return buffer.str();
0030 }
0031 std::string PrintoutHelper::dumpMeasurements(const cmsutils::bqueue<TrajectoryMeasurement>& v) {
0032   std::stringstream buffer;
0033   buffer << v.size() << " total measurements\n";
0034   cmsutils::bqueue<TrajectoryMeasurement>::const_iterator it = v.rbegin();
0035   for (; it != v.rend(); --it) {
0036     buffer << dumpMeasurement(*it);
0037     buffer << "\n";
0038   }
0039   return buffer.str();
0040 }
0041 std::string PrintoutHelper::dumpMeasurement(const TrajectoryMeasurement& tm) {
0042   std::stringstream buffer;
0043   buffer << "layer pointer: " << tm.layer() << "\n"
0044          << "estimate: " << tm.estimate() << "\n";
0045   if (tm.updatedState().isValid())
0046     buffer << "updated state: \n"
0047            << "x: " << tm.updatedState().globalPosition() << "\n"
0048            << "p: " << tm.updatedState().globalMomentum() << "\n";
0049   else if (tm.forwardPredictedState().isValid())
0050     buffer << "forward predicted state: \n"
0051            << "x: " << tm.forwardPredictedState().globalPosition() << "\n"
0052            << "p: " << tm.forwardPredictedState().globalMomentum() << "\n";
0053   else if (tm.predictedState().isValid())
0054     buffer << "predicted state: \n"
0055            << "x: " << tm.predictedState().globalPosition() << "\n"
0056            << "p: " << tm.predictedState().globalMomentum() << "\n";
0057   else
0058     buffer << "no valid state\n";
0059   buffer << "detId: " << tm.recHit()->geographicalId().rawId();
0060   if (tm.recHit()->isValid()) {
0061     buffer << "\n hit global x: " << tm.recHit()->globalPosition()
0062            << "\n hit global error: " << tm.recHit()->globalPositionError().matrix()
0063            << "\n hit local x:" << tm.recHit()->localPosition() << "\n hit local error"
0064            << tm.recHit()->localPositionError();
0065   } else
0066     buffer << "\n (-,-,-)";
0067   buffer << "\n fwdPred " << tm.forwardPredictedState().isValid() << "\n bwdPred "
0068          << tm.backwardPredictedState().isValid() << "\n upPred " << tm.updatedState().isValid();
0069   //SimIdPrinter()(tm.recHit());
0070   return buffer.str();
0071 }
0072 
0073 std::string PrintoutHelper::regressionTest(const TrackerGeometry& tracker, std::vector<Trajectory>& unsmoothedResult) {
0074   std::stringstream buffer;
0075 
0076   buffer << "number of finalTrajectories: " << unsmoothedResult.size() << std::endl;
0077   for (std::vector<Trajectory>::const_iterator it = unsmoothedResult.begin(); it != unsmoothedResult.end(); it++) {
0078     if (it->lastMeasurement().updatedState().isValid()) {
0079       buffer << "candidate's n valid and invalid hit, chi2, pt, eta : " << it->foundHits() << " , " << it->lostHits()
0080              << " , " << it->chiSquared() << " , " << it->lastMeasurement().updatedState().globalMomentum().perp()
0081              << " , " << it->lastMeasurement().updatedState().globalMomentum().eta() << std::endl;
0082     } else if (it->lastMeasurement().predictedState().isValid()) {
0083       buffer << "candidate's n valid and invalid hit, chi2, pt, eta : " << it->foundHits() << " , " << it->lostHits()
0084              << " , " << it->chiSquared() << " , " << it->lastMeasurement().predictedState().globalMomentum().perp()
0085              << " , " << it->lastMeasurement().predictedState().globalMomentum().eta() << std::endl;
0086     } else
0087       buffer << "candidate with invalid last measurement state!" << std::endl;
0088   }
0089   buffer << "=================================================";
0090   buffer << "=========== Traj in details =====================\n";
0091   for (const auto& it : unsmoothedResult) {
0092     for (const auto& hit : it.measurements()) {
0093       buffer << "measurement : " << hit.recHit()->geographicalId().rawId() << std::endl;
0094     }
0095     buffer << "================\n";
0096   }
0097   return buffer.str();
0098 }