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 Types | Private Attributes
GsfTrackRefitter Class Reference

#include <GsfTrackRefitter.h>

Inheritance diagram for GsfTrackRefitter:
GsfTrackProducerBase edm::EDProducer TrackProducerBase< reco::GsfTrack > edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 GsfTrackRefitter (const edm::ParameterSet &iConfig)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 Implementation of produce method. More...
 
- Public Member Functions inherited from GsfTrackProducerBase
 GsfTrackProducerBase (bool trajectoryInEvent, bool split)
 Constructor. More...
 
virtual void putInEvt (edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::auto_ptr< TrackingRecHitCollection > &, std::auto_ptr< reco::GsfTrackCollection > &, std::auto_ptr< reco::TrackExtraCollection > &, std::auto_ptr< reco::GsfTrackExtraCollection > &, std::auto_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, const reco::BeamSpot &)
 Put produced collections in the event. More...
 
- Public Member Functions inherited from TrackProducerBase< reco::GsfTrack >
const edm::ParameterSetgetConf () const
 
virtual void getFromES (const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
 Get needed services from the Event Setup. More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
 Get TrackCandidateCollection from the Event (needed by TrackProducer) More...
 
virtual void getFromEvt (edm::Event &, edm::Handle< TrackCollection > &, reco::BeamSpot &)
 Get TrackCollection from the Event (needed by TrackRefitter) More...
 
void setAlias (std::string alias)
 set the aliases of produced collections More...
 
void setClusterRemovalInfo (const edm::InputTag &clusterRemovalInfo)
 Sets the information on cluster removal, and turns it on. More...
 
void setConf (edm::ParameterSet conf)
 Set parameter set. More...
 
void setSecondHitPattern (Trajectory *traj, reco::GsfTrack &track, const Propagator *prop, const MeasurementTracker *measTk)
 
void setSrc (edm::InputTag src, edm::InputTag bsSrc)
 set label of source collection More...
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

enum  Constraint { none, vertex }
 

Private Attributes

Constraint constraint_
 
TrackProducerAlgorithm
< reco::GsfTrack
theAlgo
 

Additional Inherited Members

- Public Types inherited from TrackProducerBase< reco::GsfTrack >
typedef std::pair< Trajectory
*, std::pair< reco::GsfTrack
*, PropagationDirection > > 
AlgoProduct
 
typedef std::vector< AlgoProductAlgoProductCollection
 
typedef std::vector
< reco::GsfTrack
TrackCollection
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from GsfTrackProducerBase
void fillMode (reco::GsfTrack &track, const TrajectoryStateOnSurface innertsos, const Propagator &gsfProp, const TransverseImpactPointExtrapolator &tipExtrapolator, TrajectoryStateClosestToBeamLineBuilder &tscblBuilder, const reco::BeamSpot &bs) const
 
void fillStates (TrajectoryStateOnSurface tsos, std::vector< reco::GsfComponent5D > &states) const
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from TrackProducerBase< reco::GsfTrack >
std::string alias_
 
edm::InputTag bsSrc_
 
edm::InputTag clusterRemovalInfo_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle
< TrackCollection
rTracks_
 
edm::ESHandle< NavigationSchooltheSchool
 
bool trajectoryInEvent_
 

Detailed Description

Refit GSF Tracks. Based on the TrackRefitter.

Definition at line 11 of file GsfTrackRefitter.h.

Member Enumeration Documentation

Enumerator
none 
vertex 

Definition at line 22 of file GsfTrackRefitter.h.

Constructor & Destructor Documentation

GsfTrackRefitter::GsfTrackRefitter ( const edm::ParameterSet iConfig)
explicit

Constructor.

Definition at line 15 of file GsfTrackRefitter.cc.

References TrackProducerBase< reco::GsfTrack >::alias_, constraint_, edm::hlt::Exception, edm::ParameterSet::getParameter(), none, TrackProducerBase< reco::GsfTrack >::setAlias(), TrackProducerBase< reco::GsfTrack >::setConf(), TrackProducerBase< reco::GsfTrack >::setSrc(), and vertex.

15  :
16  GsfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"),
17  iConfig.getParameter<bool>("useHitsSplitting")),
18  theAlgo(iConfig)
19 {
20  setConf(iConfig);
21  setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" ));
22  setAlias( iConfig.getParameter<std::string>( "@module_label" ) );
23  std::string constraint_str = iConfig.getParameter<std::string>( "constraint" );
24 
25  if (constraint_str == "") constraint_ = none;
26 // else if (constraint_str == "momentum") constraint_ = momentum;
27  else if (constraint_str == "vertex") constraint_ = vertex;
28  else {
29  edm::LogError("GsfTrackRefitter")<<"constraint: "<<constraint_str<<" not understood. Set it to 'momentum', 'vertex' or leave it empty";
30  throw cms::Exception("GsfTrackRefitter") << "unknown type of contraint! Set it to 'momentum', 'vertex' or leave it empty";
31  }
32 
33  //register your products
34  produces<reco::GsfTrackCollection>().setBranchAlias( alias_ + "GsfTracks" );
35  produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" );
36  produces<reco::GsfTrackExtraCollection>().setBranchAlias( alias_ + "GsfTrackExtras" );
37  produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" );
38  produces<std::vector<Trajectory> >() ;
39  produces<TrajGsfTrackAssociationCollection>();
40 
41 }
T getParameter(std::string const &) const
Constraint constraint_
void setAlias(std::string alias)
set the aliases of produced collections
GsfTrackProducerBase(bool trajectoryInEvent, bool split)
Constructor.
void setConf(edm::ParameterSet conf)
Set parameter set.
void setSrc(edm::InputTag src, edm::InputTag bsSrc)
set label of source collection
TrackProducerAlgorithm< reco::GsfTrack > theAlgo

Member Function Documentation

void GsfTrackRefitter::produce ( edm::Event theEvent,
const edm::EventSetup setup 
)
virtual

Implementation of produce method.

Implements edm::EDProducer.

Definition at line 43 of file GsfTrackRefitter.cc.

References TrackProducerBase< reco::GsfTrack >::bsSrc_, constraint_, alignCSCRings::e, edm::HandleBase::failedToGet(), edm::Event::getByLabel(), edm::Event::getByType(), TrackProducerBase< reco::GsfTrack >::getFromES(), TrackProducerBase< reco::GsfTrack >::getFromEvt(), edm::EventBase::id(), LogDebug, none, edm::ESHandle< class >::product(), GsfTrackProducerBase::putInEvt(), TrackProducerAlgorithm< T >::runWithTrack(), TrackProducerAlgorithm< T >::runWithVertex(), theAlgo, and vertex.

44 {
45  edm::LogInfo("GsfTrackRefitter") << "Analyzing event number: " << theEvent.id() << "\n";
46  //
47  // create empty output collections
48  //
49  std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection);
50  std::auto_ptr<reco::GsfTrackCollection> outputTColl(new reco::GsfTrackCollection);
51  std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection);
52  std::auto_ptr<reco::GsfTrackExtraCollection> outputGsfTEColl(new reco::GsfTrackExtraCollection);
53  std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>);
54 
55  //
56  //declare and get stuff to be retrieved from ES
57  //
61  edm::ESHandle<Propagator> thePropagator;
63  // getFromES(setup,theG,theMF,theFitter,thePropagator);
65  getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
66 
67  //
68  //declare and get TrackCollection to be retrieved from the event
69  //
70  AlgoProductCollection algoResults;
71  reco::BeamSpot bs;
72  switch(constraint_){
73  case none :
74  {
76  getFromEvt(theEvent,theTCollection,bs);
77  if (theTCollection.failedToGet()){
78  edm::LogError("GsfTrackRefitter")<<"could not get the reco::GsfTrackCollection."; return;}
79  LogDebug("GsfTrackRefitter") << "run the algorithm" << "\n";
80  try {
81  theAlgo.runWithTrack(theG.product(), theMF.product(), *theTCollection,
82  theFitter.product(), thePropagator.product(),
83  theBuilder.product(), bs, algoResults);
84  }catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithTrack." << "\n" << e << "\n"; throw; }
85  break;
86  }
87  case vertex :
88  {
90  theEvent.getByType(theTCollectionWithConstraint);
91  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
92  theEvent.getByLabel(bsSrc_,recoBeamSpotHandle);
93  bs = *recoBeamSpotHandle;
94  if (theTCollectionWithConstraint.failedToGet()){
95  edm::LogError("TrackRefitter")<<"could not get TrackVtxConstraintAssociationCollection product."; break;}
96  LogDebug("TrackRefitter") << "run the algorithm" << "\n";
97  try {
98  theAlgo.runWithVertex(theG.product(), theMF.product(), *theTCollectionWithConstraint,
99  theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults);
100  }catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithTrack." << "\n" << e << "\n"; throw; }
101  }
102  //default... there cannot be any other possibility due to the check in the ctor
103  }
104 
105  //put everything in th event
106  putInEvt(theEvent, thePropagator.product(), theMeasTk.product(),
107  outputRHColl, outputTColl, outputTEColl, outputGsfTEColl, outputTrajectoryColl, algoResults, bs);
108  LogDebug("GsfTrackRefitter") << "end" << "\n";
109 }
#define LogDebug(id)
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
Constraint constraint_
std::vector< GsfTrackExtra > GsfTrackExtraCollection
collection of GsfTrackExtra objects
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
virtual void putInEvt(edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::auto_ptr< TrackingRecHitCollection > &, std::auto_ptr< reco::GsfTrackCollection > &, std::auto_ptr< reco::TrackExtraCollection > &, std::auto_ptr< reco::GsfTrackExtraCollection > &, std::auto_ptr< std::vector< Trajectory > > &, AlgoProductCollection &, const reco::BeamSpot &)
Put produced collections in the event.
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
Definition: GsfTrackFwd.h:9
std::vector< AlgoProduct > AlgoProductCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void runWithVertex(const TrackingGeometry *, const MagneticField *, const VtxConstraintAssociationCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
bool failedToGet() const
Definition: HandleBase.h:80
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
T const * product() const
Definition: ESHandle.h:62
edm::EventID id() const
Definition: EventBase.h:56
TrackProducerAlgorithm< reco::GsfTrack > theAlgo
virtual void getFromES(const edm::EventSetup &, edm::ESHandle< TrackerGeometry > &, edm::ESHandle< MagneticField > &, edm::ESHandle< TrajectoryFitter > &, edm::ESHandle< Propagator > &, edm::ESHandle< MeasurementTracker > &, edm::ESHandle< TransientTrackingRecHitBuilder > &)
Get needed services from the Event Setup.
void runWithTrack(const TrackingGeometry *, const MagneticField *, const TrackCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking Tracks as input (for Refitter)

Member Data Documentation

Constraint GsfTrackRefitter::constraint_
private

Definition at line 25 of file GsfTrackRefitter.h.

Referenced by GsfTrackRefitter(), and produce().

TrackProducerAlgorithm<reco::GsfTrack> GsfTrackRefitter::theAlgo
private

Definition at line 21 of file GsfTrackRefitter.h.

Referenced by produce().