18 iConfig.getParameter<bool>(
"useHitsSplitting")),
27 if (constraint_str.empty())
29 else if (constraint_str ==
"momentum") {
31 trkconstrcoll_ = consumes<TrackMomConstraintAssociationCollection>(trkconstrcoll);
32 }
else if (constraint_str ==
"vertex") {
34 trkconstrcoll_ = consumes<TrackVtxConstraintAssociationCollection>(trkconstrcoll);
35 }
else if (constraint_str ==
"trackParameters") {
37 trkconstrcoll_ = consumes<TrackParamConstraintAssociationCollection>(trkconstrcoll);
40 <<
"constraint: " << constraint_str
41 <<
" not understood. Set it to 'momentum', 'vertex', 'trackParameters' or leave it empty";
43 <<
"unknown type of contraint! Set it to 'momentum', 'vertex', 'trackParameters' or leave it empty";
47 produces<reco::TrackCollection>().setBranchAlias(
alias_ +
"Tracks");
48 produces<reco::TrackExtraCollection>().setBranchAlias(
alias_ +
"TrackExtras");
49 produces<TrackingRecHitCollection>().setBranchAlias(
alias_ +
"RecHits");
50 produces<std::vector<Trajectory>>();
51 produces<std::vector<int>>();
52 produces<TrajTrackAssociationCollection>();
56 LogDebug(
"TrackRefitter") <<
"Analyzing event number: " << theEvent.
id() <<
"\n";
63 std::unique_ptr<std::vector<Trajectory>> outputTrajectoryColl(
new std::vector<Trajectory>);
64 std::unique_ptr<std::vector<int>> outputIndecesInputColl(
new std::vector<int>);
75 getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
89 LogDebug(
"TrackRefitter") <<
"TrackRefitter::produce(none):Number of Trajectories:" << (*theTCollection).size();
92 edm::LogError(
"TrackRefitter") <<
" BeamSpot is (0,0,0), it is probably because is not valid in the event";
98 labelsForToken(
src_, labels);
99 edm::LogError(
"TrackRefitter") <<
"could not get the reco::TrackCollection." << labels.
module;
102 LogDebug(
"TrackRefitter") <<
"run the algorithm"
115 edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithTrack."
128 if (!recoBeamSpotHandle.
isValid())
130 bs = *recoBeamSpotHandle;
135 LogDebug(
"TrackRefitter") <<
"run the algorithm"
140 *theTCollectionWithConstraint,
147 edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithMomentum."
159 if (!recoBeamSpotHandle.
isValid())
161 bs = *recoBeamSpotHandle;
163 edm::LogError(
"TrackRefitter") <<
"could not get TrackVtxConstraintAssociationCollection product.";
166 LogDebug(
"TrackRefitter") <<
"run the algorithm"
171 *theTCollectionWithConstraint,
178 edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithVertex."
190 if (!recoBeamSpotHandle.
isValid())
192 bs = *recoBeamSpotHandle;
197 LogDebug(
"TrackRefitter") <<
"run the algorithm"
202 *theTCollectionWithConstraint,
209 edm::LogError(
"TrackProducer") <<
"cms::Exception caught during theAlgo.runWithTrackParameters."
225 outputTrajectoryColl,
226 outputIndecesInputColl,
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
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.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< Track > TrackCollection
collection of Tracks
edm::EDGetToken trkconstrcoll_
void initTrackProducerBase(const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
Call this method in inheriting class' constructor.
Log< level::Error, false > LogError
void setAlias(std::string alias)
set the aliases of produced collections
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
TrackProducerAlgorithm< reco::Track > theAlgo
bool getData(T &iHolder) const
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 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.
std::vector< AlgoProduct > AlgoProductCollection
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
T getParameter(std::string const &) const
void runWithTrackParameters(const TrackingGeometry *, const MagneticField *, const TrackParamConstraintAssociationCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
const Point & position() const
position
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.