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 48 of file SeedTransformer.cc.

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

48  {
49 
50  LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer constructor called." << endl << endl;
51 
52  theFitterName = iConfig.getParameter<string>("Fitter");
53  theMuonRecHitBuilderName = iConfig.getParameter<string>("MuonRecHitBuilder");
54  thePropagatorName = iConfig.getParameter<string>("Propagator");
55 
56  nMinRecHits = iConfig.getParameter<unsigned int>("NMinRecHits");
57  errorRescale = iConfig.getParameter<double>("RescaleError");
58  useSubRecHits = iConfig.getParameter<bool>("UseSubRecHits");
59 }
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 61 of file SeedTransformer.cc.

References LogTrace.

61  {
62 
63  LogTrace("Reco|TrackingTools|SeedTransformer") << "SeedTransformer destructor called." << endl << endl;
64 
65 }
#define LogTrace(id)

Member Function Documentation

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

Performs the fit.

Definition at line 77 of file SeedTransformer.cc.

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

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

77  {
78 
79  const string metname = "Reco|TrackingTools|SeedTransformer";
80 
81  LogTrace(metname) << " Number of valid RecHits: " << aSeed.nHits() << endl;
82 
83  if( aSeed.nHits() < nMinRecHits ) {
84  LogTrace(metname) << " --- Too few RecHits, no refit performed! ---" << endl;
85  return vector<Trajectory>();
86  }
87 
89 
90  // Rescale errors before refit, not to bias the result
91  aTSOS.rescaleError(errorRescale);
92 
93  vector<TransientTrackingRecHit::ConstRecHitPointer> recHits;
94  unsigned int countRH = 0;
95 
96  for(TrajectorySeed::recHitContainer::const_iterator itRecHits=aSeed.recHits().first; itRecHits!=aSeed.recHits().second; ++itRecHits, ++countRH) {
97  if((*itRecHits).isValid()) {
99 
100  if(useSubRecHits){
103  copy(subHits.begin(),subHits.end(),back_inserter(recHits));
104  }
105  else{
106  recHits.push_back(ttrh);
107  }
108  }
109  } // end for(TrajectorySeed::recHitContainer::const_iterator itRecHits=aSeed.recHits().first; itRecHits!=aSeed.recHits().second; ++itRecHits, ++countRH)
110 
111  TrajectoryStateOnSurface aInitTSOS = thePropagator->propagate(aTSOS, recHits.front()->det()->surface());
112 
113  if(!aInitTSOS.isValid()) {
114  LogTrace(metname) << " --- Initial state for refit not valid! ---" << endl;
115  return vector<Trajectory>();
116  }
117 
118  vector<Trajectory> refittedSeed = theFitter->fit(aSeed, recHits, aInitTSOS);
119 
120  if(refittedSeed.empty()) {
121  LogTrace(metname) << " --- Seed fit failed! ---" << endl;
122  return vector<Trajectory>();
123  }
124 
125  else if(!refittedSeed.front().isValid()) {
126  LogTrace(metname) << " --- Seed fitted, but trajectory not valid! ---" << endl;
127  return vector<Trajectory>();
128  }
129 
130  else
131  LogTrace(metname) << " +++ Seed fit succeded! +++" << endl;
132 
133  return refittedSeed;
134 
135 }
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:53
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 137 of file SeedTransformer.cc.

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

Referenced by StandAloneMuonTrajectoryBuilder::trajectories().

137  {
138 
139  PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState();
140  DetId tmpDetId(tmpTSOD.detId());
141  const GeomDet* tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId);
142 
143 
144  TrajectoryStateOnSurface tmpTSOS = trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMagneticField));
145 
146  return tmpTSOS;
147 
148 }
edm::ESHandle< MagneticField > theMagneticField
unsigned int detId() const
Definition: DetId.h:18
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 67 of file SeedTransformer.cc.

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

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

67  {
68 
74 
75 }
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
edm::ESHandle< MagneticField > theMagneticField
std::string thePropagatorName
std::string theMuonRecHitBuilderName
std::string theFitterName
const T & get() const
Definition: EventSetup.h:55
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 62 of file SeedTransformer.h.

unsigned int SeedTransformer::nMinRecHits
private

Minimum number of RecHits required to perform the fit.

Definition at line 59 of file SeedTransformer.h.

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

Definition at line 50 of file SeedTransformer.h.

std::string SeedTransformer::theFitterName
private

Definition at line 54 of file SeedTransformer.h.

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

Definition at line 49 of file SeedTransformer.h.

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

Definition at line 51 of file SeedTransformer.h.

std::string SeedTransformer::theMuonRecHitBuilderName
private

Definition at line 55 of file SeedTransformer.h.

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

Definition at line 52 of file SeedTransformer.h.

std::string SeedTransformer::thePropagatorName
private

Definition at line 56 of file SeedTransformer.h.

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

Definition at line 48 of file SeedTransformer.h.

bool SeedTransformer::useSubRecHits
private

Definition at line 64 of file SeedTransformer.h.