18 iConfig.getParameter<
bool>(
"useHitsSplitting")),
35 edm::LogError(
"TrackRefitter")<<
"constraint: "<<constraint_str<<
" not understood. Set it to 'momentum', 'vertex', 'trackParameters' or leave it empty";
36 throw cms::Exception(
"TrackRefitter") <<
"unknown type of contraint! Set it to 'momentum', 'vertex', 'trackParameters' or leave it empty";
40 produces<reco::TrackCollection>().setBranchAlias(
alias_ +
"Tracks" );
41 produces<reco::TrackExtraCollection>().setBranchAlias(
alias_ +
"TrackExtras" );
42 produces<TrackingRecHitCollection>().setBranchAlias(
alias_ +
"RecHits" );
43 produces<std::vector<Trajectory> >() ;
44 produces<std::vector<int> >() ;
45 produces<TrajTrackAssociationCollection>();
51 LogDebug(
"TrackRefitter") <<
"Analyzing event number: " << theEvent.
id() <<
"\n";
58 std::unique_ptr<std::vector<Trajectory> > outputTrajectoryColl(
new std::vector<Trajectory>);
59 std::unique_ptr<std::vector<int> > outputIndecesInputColl(
new std::vector<int>);
70 getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder);
86 LogDebug(
"TrackRefitter") <<
"TrackRefitter::produce(none):Number of Trajectories:" << (*theTCollection).size();
89 edm::LogError(
"TrackRefitter") <<
" BeamSpot is (0,0,0), it is probably because is not valid in the event";
break; }
93 labelsForToken(
src_, labels);
94 edm::LogError(
"TrackRefitter")<<
"could not get the reco::TrackCollection." << labels.
module;
break;}
95 LogDebug(
"TrackRefitter") <<
"run the algorithm" <<
"\n";
100 theBuilder.
product(), bs, algoResults);
101 }
catch (
cms::Exception &
e){
edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithTrack." <<
"\n" << e <<
"\n";
throw; }
112 if (!recoBeamSpotHandle.
isValid())
break;
113 bs = *recoBeamSpotHandle;
117 LogDebug(
"TrackRefitter") <<
"run the algorithm" <<
"\n";
121 }
catch (
cms::Exception &
e){
edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithMomentum." <<
"\n" << e <<
"\n";
throw; }
130 if (!recoBeamSpotHandle.
isValid())
break;
131 bs = *recoBeamSpotHandle;
133 edm::LogError(
"TrackRefitter")<<
"could not get TrackVtxConstraintAssociationCollection product.";
break;}
134 LogDebug(
"TrackRefitter") <<
"run the algorithm" <<
"\n";
138 }
catch (
cms::Exception &
e){
edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithVertex." <<
"\n" << e <<
"\n";
throw; }
147 if (!recoBeamSpotHandle.
isValid())
break;
148 bs = *recoBeamSpotHandle;
152 LogDebug(
"TrackRefitter") <<
"run the algorithm" <<
"\n";
156 }
catch (
cms::Exception &
e){
edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithTrackParameters." <<
"\n" << e <<
"\n";
throw; }
163 putInEvt(theEvent, thePropagator.
product(), theMeasTk.
product(), outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, outputIndecesInputColl, algoResults,theBuilder.
product(), httopo.
product());
164 LogDebug(
"TrackRefitter") <<
"end" <<
"\n";
T getParameter(std::string const &) const
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< Track > TrackCollection
collection of Tracks
virtual void putInEvt(edm::Event &, const Propagator *prop, const MeasurementTracker *measTk, std::unique_ptr< TrackingRecHitCollection > &, std::unique_ptr< reco::TrackCollection > &, std::unique_ptr< reco::TrackExtraCollection > &, std::unique_ptr< std::vector< Trajectory > > &, std::unique_ptr< std::vector< int > > &, AlgoProductCollection &, TransientTrackingRecHitBuilder const *, const TrackerTopology *ttopo, int BeforeOrAfter=0)
Put produced collections in the event.
edm::EDGetToken trkconstrcoll_
def setup(process, global_tag, zero_tesla=False)
void setAlias(std::string alias)
set the aliases of produced collections
void setConf(const edm::ParameterSet &conf)
Set parameter set.
TrackProducerAlgorithm< reco::Track > theAlgo
void runWithMomentum(const TrackingGeometry *, const MagneticField *, const TrackMomConstraintAssociationCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking TrackMomConstraintAssociation as input (Refitter with momentum constraint) ...
void runWithTrack(const TrackingGeometry *, const MagneticField *, const TrackView &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking Tracks as input (for Refitter)
void setSrc(const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
set label of source collection
void runWithVertex(const TrackingGeometry *, const MagneticField *, const VtxConstraintAssociationCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
void produce(edm::Event &, const edm::EventSetup &) override
Implementation of produce method.
XYZPointD XYZPoint
point in space with cartesian internal representation
void runWithTrackParameters(const TrackingGeometry *, const MagneticField *, const TrackParamConstraintAssociationCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
std::vector< AlgoProduct > AlgoProductCollection
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
const Point & position() const
position
T const * product() const
BeamType type() const
return beam type
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.
TrackRefitter(const edm::ParameterSet &iConfig)
Constructor.