#include <SeedTransformer.h>
Public Member Functions | |
std::vector< Trajectory > | seedTransform (const TrajectorySeed &) const |
Performs the fit. | |
SeedTransformer (const edm::ParameterSet &) | |
Constructor. | |
TrajectoryStateOnSurface | seedTransientState (const TrajectorySeed &) const |
void | setServices (const edm::EventSetup &) |
Set the services needed by the SeedTransformer. | |
virtual | ~SeedTransformer () |
Destructor. | |
Private Attributes | |
double | errorRescale |
Error rescale factor. | |
unsigned int | nMinRecHits |
Minimum number of RecHits required to perform the fit. | |
edm::ESHandle< TrajectoryFitter > | theFitter |
std::string | theFitterName |
edm::ESHandle< MagneticField > | theMagneticField |
edm::ESHandle < TransientTrackingRecHitBuilder > | theMuonRecHitBuilder |
std::string | theMuonRecHitBuilderName |
edm::ESHandle< Propagator > | thePropagator |
std::string | thePropagatorName |
edm::ESHandle < GlobalTrackingGeometry > | theTrackingGeometry |
bool | useSubRecHits |
Description: this class takes a TrajectorySeed, fits its RecHits and returns a vector of Trajectories. If the fit fails, the returned vector is empty.
Definition at line 31 of file SeedTransformer.h.
SeedTransformer::SeedTransformer | ( | const edm::ParameterSet & | iConfig | ) |
Constructor.
Definition at line 50 of file SeedTransformer.cc.
References edm::ParameterSet::getParameter(), and LogTrace.
{ LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer constructor called." << endl << endl; theFitterName = iConfig.getParameter<string>("Fitter"); theMuonRecHitBuilderName = iConfig.getParameter<string>("MuonRecHitBuilder"); thePropagatorName = iConfig.getParameter<string>("Propagator"); nMinRecHits = iConfig.getParameter<unsigned int>("NMinRecHits"); errorRescale = iConfig.getParameter<double>("RescaleError"); useSubRecHits = iConfig.getParameter<bool>("UseSubRecHits"); }
SeedTransformer::~SeedTransformer | ( | ) | [virtual] |
Destructor.
Definition at line 63 of file SeedTransformer.cc.
References LogTrace.
{ LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer destructor called." << endl << endl; }
vector< Trajectory > SeedTransformer::seedTransform | ( | const TrajectorySeed & | aSeed | ) | const |
Performs the fit.
Definition at line 79 of file SeedTransformer.cc.
References MuonTransientTrackingRecHitBreaker::breakInSubRecHits(), filterCSVwithJSON::copy, TrajectoryStateOnSurface::isValid(), LogTrace, metname, TrajectorySeed::nHits(), TrajectorySeed::recHits(), and TrajectoryStateOnSurface::rescaleError().
Referenced by DirectMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().
{ const string metname = "Reco|TrackingTools|SeedTransformer"; LogTrace(metname) << " Number of valid RecHits: " << aSeed.nHits() << endl; if( aSeed.nHits() < nMinRecHits ) { LogTrace(metname) << " --- Too few RecHits, no refit performed! ---" << endl; return vector<Trajectory>(); } TrajectoryStateOnSurface aTSOS(seedTransientState(aSeed)); // Rescale errors before refit, not to bias the result aTSOS.rescaleError(errorRescale); vector<TransientTrackingRecHit::ConstRecHitPointer> recHits; unsigned int countRH = 0; for(TrajectorySeed::recHitContainer::const_iterator itRecHits=aSeed.recHits().first; itRecHits!=aSeed.recHits().second; ++itRecHits, ++countRH) { if((*itRecHits).isValid()) { TransientTrackingRecHit::ConstRecHitPointer ttrh(theMuonRecHitBuilder->build(&(*itRecHits))); if(useSubRecHits){ TransientTrackingRecHit::ConstRecHitContainer subHits = MuonTransientTrackingRecHitBreaker::breakInSubRecHits(ttrh,2); copy(subHits.begin(),subHits.end(),back_inserter(recHits)); } else{ recHits.push_back(ttrh); } } } // end for(TrajectorySeed::recHitContainer::const_iterator itRecHits=aSeed.recHits().first; itRecHits!=aSeed.recHits().second; ++itRecHits, ++countRH) TrajectoryStateOnSurface aInitTSOS = thePropagator->propagate(aTSOS, recHits.front()->det()->surface()); if(!aInitTSOS.isValid()) { LogTrace(metname) << " --- Initial state for refit not valid! ---" << endl; return vector<Trajectory>(); } vector<Trajectory> refittedSeed = theFitter->fit(aSeed, recHits, aInitTSOS); if(refittedSeed.empty()) { LogTrace(metname) << " --- Seed fit failed! ---" << endl; return vector<Trajectory>(); } else if(!refittedSeed.front().isValid()) { LogTrace(metname) << " --- Seed fitted, but trajectory not valid! ---" << endl; return vector<Trajectory>(); } else LogTrace(metname) << " +++ Seed fit succeded! +++" << endl; return refittedSeed; }
TrajectoryStateOnSurface SeedTransformer::seedTransientState | ( | const TrajectorySeed & | tmpSeed | ) | const |
Definition at line 139 of file SeedTransformer.cc.
References PTrajectoryStateOnDet::detId(), TrajectorySeed::startingState(), and trajectoryStateTransform::transientState().
Referenced by StandAloneMuonTrajectoryBuilder::trajectories().
{ PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState(); DetId tmpDetId(tmpTSOD.detId()); const GeomDet* tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId); TrajectoryStateOnSurface tmpTSOS = trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMagneticField)); return tmpTSOS; }
void SeedTransformer::setServices | ( | const edm::EventSetup & | iSetup | ) |
Set the services needed by the SeedTransformer.
Definition at line 69 of file SeedTransformer.cc.
References edm::EventSetup::get().
Referenced by DirectMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().
{ iSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry); iSetup.get<IdealMagneticFieldRecord>().get(theMagneticField); iSetup.get<TrajectoryFitter::Record>().get(theFitterName,theFitter); iSetup.get<TransientRecHitRecord>().get(theMuonRecHitBuilderName,theMuonRecHitBuilder); iSetup.get<TrackingComponentsRecord>().get(thePropagatorName,thePropagator); }
double SeedTransformer::errorRescale [private] |
Error rescale factor.
Definition at line 64 of file SeedTransformer.h.
unsigned int SeedTransformer::nMinRecHits [private] |
Minimum number of RecHits required to perform the fit.
Definition at line 61 of file SeedTransformer.h.
Definition at line 52 of file SeedTransformer.h.
std::string SeedTransformer::theFitterName [private] |
Definition at line 56 of file SeedTransformer.h.
Definition at line 51 of file SeedTransformer.h.
Definition at line 53 of file SeedTransformer.h.
std::string SeedTransformer::theMuonRecHitBuilderName [private] |
Definition at line 57 of file SeedTransformer.h.
Definition at line 54 of file SeedTransformer.h.
std::string SeedTransformer::thePropagatorName [private] |
Definition at line 58 of file SeedTransformer.h.
Definition at line 50 of file SeedTransformer.h.
bool SeedTransformer::useSubRecHits [private] |
Definition at line 66 of file SeedTransformer.h.