CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SeedTransformer Class Reference

#include <SeedTransformer.h>

Public Member Functions

std::vector< TrajectoryseedTransform (const TrajectorySeed &) const
 Performs the fit. More...
 
 SeedTransformer (const edm::ParameterSet &)
 Constructor. More...
 
TrajectoryStateOnSurface seedTransientState (const TrajectorySeed &) const
 
void setServices (const edm::EventSetup &)
 Set the services needed by the SeedTransformer. More...
 
virtual ~SeedTransformer ()
 Destructor. More...
 

Private Attributes

double errorRescale
 Error rescale factor. More...
 
unsigned int nMinRecHits
 Minimum number of RecHits required to perform the fit. More...
 
edm::ESHandle< TrajectoryFittertheFitter
 
std::string theFitterName
 
edm::ESHandle< MagneticFieldtheMagneticField
 
edm::ESHandle< TransientTrackingRecHitBuildertheMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
edm::ESHandle< PropagatorthePropagator
 
std::string thePropagatorName
 
edm::ESHandle< GlobalTrackingGeometrytheTrackingGeometry
 
bool useSubRecHits
 

Detailed Description

Description: this class takes a TrajectorySeed, fits its RecHits and returns a vector of Trajectories. If the fit fails, the returned vector is empty.

Author
D. Trocino - University and INFN Torino

Definition at line 29 of file SeedTransformer.h.

Constructor & Destructor Documentation

SeedTransformer::SeedTransformer ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 46 of file SeedTransformer.cc.

References edm::ParameterSet::getParameter(), LogTrace, and HLT_FULL_cff::thePropagatorName.

46  {
47  LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer constructor called." << endl << endl;
48 
49  theFitterName = iConfig.getParameter<string>("Fitter");
50  theMuonRecHitBuilderName = iConfig.getParameter<string>("MuonRecHitBuilder");
51  thePropagatorName = iConfig.getParameter<string>("Propagator");
52 
53  nMinRecHits = iConfig.getParameter<unsigned int>("NMinRecHits");
54  errorRescale = iConfig.getParameter<double>("RescaleError");
55  useSubRecHits = iConfig.getParameter<bool>("UseSubRecHits");
56 }
T getParameter(std::string const &) const
double errorRescale
Error rescale factor.
std::string thePropagatorName
std::string theMuonRecHitBuilderName
#define LogTrace(id)
std::string theFitterName
unsigned int nMinRecHits
Minimum number of RecHits required to perform the fit.
SeedTransformer::~SeedTransformer ( )
virtual

Destructor.

Definition at line 58 of file SeedTransformer.cc.

References LogTrace.

58  {
59  LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer destructor called." << endl << endl;
60 }
#define LogTrace(id)

Member Function Documentation

vector< Trajectory > SeedTransformer::seedTransform ( const TrajectorySeed aSeed) const

Performs the fit.

Definition at line 70 of file SeedTransformer.cc.

References MuonTransientTrackingRecHitBreaker::breakInSubRecHits(), filterCSVwithJSON::copy, TrajectoryStateOnSurface::isValid(), LogTrace, metname, TrajectorySeed::nHits(), FastTrackerRecHitMaskProducer_cfi::recHits, and TrajectorySeed::recHits().

Referenced by DirectMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().

70  {
71  const string metname = "Reco|TrackingTools|SeedTransformer";
72 
73  LogTrace(metname) << " Number of valid RecHits: " << aSeed.nHits() << endl;
74 
75  if (aSeed.nHits() < nMinRecHits) {
76  LogTrace(metname) << " --- Too few RecHits, no refit performed! ---" << endl;
77  return vector<Trajectory>();
78  }
79 
81 
82  // Rescale errors before refit, not to bias the result
83  aTSOS.rescaleError(errorRescale);
84 
85  vector<TransientTrackingRecHit::ConstRecHitPointer> recHits;
86  unsigned int countRH = 0;
87 
88  for (TrajectorySeed::recHitContainer::const_iterator itRecHits = aSeed.recHits().first;
89  itRecHits != aSeed.recHits().second;
90  ++itRecHits, ++countRH) {
91  if ((*itRecHits).isValid()) {
93 
94  if (useSubRecHits) {
97  copy(subHits.begin(), subHits.end(), back_inserter(recHits));
98  } else {
99  recHits.push_back(ttrh);
100  }
101  }
102  } // end for(TrajectorySeed::recHitContainer::const_iterator itRecHits=aSeed.recHits().first; itRecHits!=aSeed.recHits().second; ++itRecHits, ++countRH)
103 
104  TrajectoryStateOnSurface aInitTSOS = thePropagator->propagate(aTSOS, recHits.front()->det()->surface());
105 
106  if (!aInitTSOS.isValid()) {
107  LogTrace(metname) << " --- Initial state for refit not valid! ---" << endl;
108  return vector<Trajectory>();
109  }
110 
111  vector<Trajectory> refittedSeed = theFitter->fit(aSeed, recHits, aInitTSOS);
112 
113  if (refittedSeed.empty()) {
114  LogTrace(metname) << " --- Seed fit failed! ---" << endl;
115  return vector<Trajectory>();
116  }
117 
118  else if (!refittedSeed.front().isValid()) {
119  LogTrace(metname) << " --- Seed fitted, but trajectory not valid! ---" << endl;
120  return vector<Trajectory>();
121  }
122 
123  else
124  LogTrace(metname) << " +++ Seed fit succeded! +++" << endl;
125 
126  return refittedSeed;
127 }
const std::string metname
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
double errorRescale
Error rescale factor.
static TransientTrackingRecHit::ConstRecHitContainer breakInSubRecHits(TransientTrackingRecHit::ConstRecHitPointer, int granularity)
takes a muon rechit and returns its sub-rechits given a certain granularity
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
#define LogTrace(id)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
std::vector< ConstRecHitPointer > ConstRecHitContainer
unsigned int nMinRecHits
Minimum number of RecHits required to perform the fit.
range recHits() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
TrajectoryStateOnSurface seedTransientState(const TrajectorySeed &) const
unsigned int nHits() const
edm::ESHandle< Propagator > thePropagator
edm::ESHandle< TrajectoryFitter > theFitter
std::vector< Trajectory > fit(const Trajectory &traj, fitType type=standard) const
TrajectoryStateOnSurface SeedTransformer::seedTransientState ( const TrajectorySeed tmpSeed) const

Definition at line 129 of file SeedTransformer.cc.

References PTrajectoryStateOnDet::detId(), TrajectorySeed::startingState(), and trajectoryStateTransform::transientState().

Referenced by StandAloneMuonTrajectoryBuilder::trajectories().

129  {
130  PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState();
131  DetId tmpDetId(tmpTSOD.detId());
132  const GeomDet* tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId);
133 
134  TrajectoryStateOnSurface tmpTSOS =
135  trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMagneticField));
136 
137  return tmpTSOS;
138 }
edm::ESHandle< MagneticField > theMagneticField
unsigned int detId() const
Definition: DetId.h:17
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
const GeomDet * idToDet(DetId) const override
void SeedTransformer::setServices ( const edm::EventSetup iSetup)

Set the services needed by the SeedTransformer.

Definition at line 62 of file SeedTransformer.cc.

References edm::EventSetup::get(), and HLT_FULL_cff::thePropagatorName.

Referenced by DirectMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().

62  {
68 }
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
edm::ESHandle< MagneticField > theMagneticField
std::string thePropagatorName
std::string theMuonRecHitBuilderName
std::string theFitterName
T get() const
Definition: EventSetup.h:73
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
edm::ESHandle< Propagator > thePropagator
edm::ESHandle< TrajectoryFitter > theFitter

Member Data Documentation

double SeedTransformer::errorRescale
private

Error rescale factor.

Definition at line 61 of file SeedTransformer.h.

unsigned int SeedTransformer::nMinRecHits
private

Minimum number of RecHits required to perform the fit.

Definition at line 58 of file SeedTransformer.h.

edm::ESHandle<TrajectoryFitter> SeedTransformer::theFitter
private

Definition at line 49 of file SeedTransformer.h.

std::string SeedTransformer::theFitterName
private

Definition at line 53 of file SeedTransformer.h.

edm::ESHandle<MagneticField> SeedTransformer::theMagneticField
private

Definition at line 48 of file SeedTransformer.h.

edm::ESHandle<TransientTrackingRecHitBuilder> SeedTransformer::theMuonRecHitBuilder
private

Definition at line 50 of file SeedTransformer.h.

std::string SeedTransformer::theMuonRecHitBuilderName
private

Definition at line 54 of file SeedTransformer.h.

edm::ESHandle<Propagator> SeedTransformer::thePropagator
private

Definition at line 51 of file SeedTransformer.h.

std::string SeedTransformer::thePropagatorName
private

Definition at line 55 of file SeedTransformer.h.

edm::ESHandle<GlobalTrackingGeometry> SeedTransformer::theTrackingGeometry
private

Definition at line 47 of file SeedTransformer.h.

bool SeedTransformer::useSubRecHits
private

Definition at line 63 of file SeedTransformer.h.