CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
edm::ESHandle< PropagatorthePropagator
 
std::string thePropagatorName
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 
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.

Date:
2008/11/11 08:01:23
Revision:
1.4
Author
D. Trocino - University and INFN Torino

Definition at line 31 of file SeedTransformer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 50 of file SeedTransformer.cc.

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

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

References LogTrace.

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

Member Function Documentation

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(), TrajectoryStateOnSurface::rescaleError(), and TrajectoryStateOnSurface::surface().

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

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

139  {
140 
141  PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState();
142  DetId tmpDetId(tmpTSOD.detId());
143  const GeomDet* tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId);
144 
145 
146  TrajectoryStateOnSurface tmpTSOS = trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMagneticField));
147 
148  return tmpTSOS;
149 
150 }
edm::ESHandle< MagneticField > theMagneticField
unsigned int detId() const
Definition: DetId.h:20
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
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().

69  {
70 
76 
77 }
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 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.

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

Definition at line 52 of file SeedTransformer.h.

std::string SeedTransformer::theFitterName
private

Definition at line 56 of file SeedTransformer.h.

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

Definition at line 51 of file SeedTransformer.h.

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

Definition at line 53 of file SeedTransformer.h.

std::string SeedTransformer::theMuonRecHitBuilderName
private

Definition at line 57 of file SeedTransformer.h.

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

Definition at line 54 of file SeedTransformer.h.

std::string SeedTransformer::thePropagatorName
private

Definition at line 58 of file SeedTransformer.h.

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

Definition at line 50 of file SeedTransformer.h.

bool SeedTransformer::useSubRecHits
private

Definition at line 66 of file SeedTransformer.h.