54 std::unique_ptr<TrackingRecHitCollection> selHits,
55 std::unique_ptr<reco::TrackCollection> selTracks,
56 std::unique_ptr<reco::TrackExtraCollection> selTrackExtras,
80 assoc_token = consumes<reco::TrackCandidateCaloClusterPtrAssociation>(
86 produces<reco::TrackCollection>().setBranchAlias(
alias_ +
"Tracks");
87 produces<reco::TrackExtraCollection>().setBranchAlias(
alias_ +
"TrackExtras");
88 produces<TrackingRecHitCollection>().setBranchAlias(
alias_ +
"RecHits");
89 produces<std::vector<Trajectory>>();
90 produces<TrajTrackAssociationCollection>();
104 auto outputRHColl = std::make_unique<TrackingRecHitCollection>();
105 auto outputTColl = std::make_unique<reco::TrackCollection>();
106 auto outputTEColl = std::make_unique<reco::TrackExtraCollection>();
107 auto outputTrajectoryColl = std::make_unique<std::vector<Trajectory>>();
109 auto scTrkAssoc_p = std::make_unique<reco::TrackCaloClusterPtrAssociation>();
120 getFromES(
setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
131 if (!trkCandidateSCAssocHandle.
isValid()) {
135 <<
" but keep running. Empty collection will be produced " 140 if (scTrkCandAssCollection.
empty())
143 std::vector<int> tccLocations;
151 <<
"TrackProducerWithSCAssociation could not get the TrackCandidateCollection.";
168 for (TrackCandidateCollection::const_iterator
i = theTCCollection->begin();
i != theTCCollection->end();
i++) {
199 tccLocations.push_back(tcc);
203 edm::LogInfo(
"TrackProducerWithSCAssociation") <<
"Number of Tracks found: " <<
cont <<
"\n";
208 edm::LogInfo(
"TrackProducerWithSCAssociation") <<
"cms::Exception caught!!!" 229 std::vector<edm::Ptr<reco::CaloCluster>> caloPtrVec;
230 for (AlgoProductCollection::iterator
i = algoResults.begin();
i != algoResults.end();
i++) {
233 caloPtrVec.push_back(aClus);
248 edm::LogInfo(
"TrackProducerWithSCAssociation") <<
"Analyzing event number: " << theEvent.
id() <<
"\n";
252 std::vector<reco::TransientTrack> ttks;
263 getFromES(
setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
289 edm::LogInfo(
"TrackProducerWithSCAssociation") <<
"cms::Exception caught!!!" 294 for (
auto&
prod : algoResults) {
308 std::unique_ptr<TrackingRecHitCollection> selHits,
309 std::unique_ptr<reco::TrackCollection> selTracks,
310 std::unique_ptr<reco::TrackExtraCollection> selTrackExtras,
321 std::map<unsigned int, unsigned int> tjTkMap;
323 for (
auto&
i : algoResults) {
326 selTrajectories->push_back(*theTraj);
336 selTracks->push_back(
t);
341 tjTkMap[iTjRef - 1] = iTkRef - 1;
347 unsigned int innerId, outerId;
375 track.setExtra(teref);
404 auto ih = selHits->size();
405 t2t(*theTraj, *selHits, trajParams, chi2s);
406 auto ie = selHits->size();
407 tx.
setHits(rHits, ih, ie - ih);
409 for (; ih < ie; ++ih) {
410 auto const&
hit = (*selHits)[ih];
411 track.appendHitPattern(
hit, *ttopo);
439 auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>(rTrajs,
rTracks_);
440 for (std::map<unsigned int, unsigned int>::iterator
i = tjTkMap.begin();
i != tjTkMap.end();
i++) {
443 trajTrackMap->insert(
edm::Ref<std::vector<Trajectory>>(rTrajs, (*i).first),
T getParameter(std::string const &) const
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrkToken_
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
edm::OrphanHandle< reco::TrackCollection > rTracks_
GlobalPoint position() const
std::vector< reco::TransientTrack > getTransient(edm::Event &, const edm::EventSetup &)
T const * product() const
const GlobalTrajectoryParameters & globalParameters() const
void setSecondHitPattern(Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
void initTrackProducerBase(const edm::ParameterSet &conf, edm::ConsumesCollector cc, const edm::EDGetToken &src)
Call this method in inheriting class' constructor.
std::vector< ConstRecHitPointer > RecHitContainer
edm::RefToBase< TrajectorySeed > seedRef(void) const
std::string trackSuperClusterAssociationCollection_
edm::EDGetTokenT< reco::TrackCandidateCaloClusterPtrAssociation > assoc_token
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Log< level::Error, false > LogError
void setAlias(std::string alias)
set the aliases of produced collections
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
bool validTrackCandidateSCAssociationInput_
TrajectoryMeasurement const & lastMeasurement() const
bool buildTrack(const TrajectoryFitter *, const Propagator *, AlgoProductCollection &, TransientTrackingRecHit::RecHitContainer &, TrajectoryStateOnSurface &, const TrajectorySeed &, float, const reco::BeamSpot &, SeedRef seedRef=SeedRef(), int qualityMask=0, signed char nLoops=0)
Construct Tracks to be put in the event.
std::string trackCSuperClusterAssociationCollection_
GlobalVector momentum() const
T const * product() const
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
PropagationDirection const & direction() const
PTrajectoryStateOnDet const & trajectoryStateOnDet() const
#define DEFINE_FWK_MODULE(type)
RefProd< PROD > getRefBeforePut()
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
TrackProducerAlgorithm< reco::Track > theAlgo
Log< level::Info, false > LogInfo
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
const CurvilinearTrajectoryError & curvilinearError() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::vector< AlgoProduct > AlgoProductCollection
XYZPointD XYZPoint
point in space with cartesian internal representation
TrajectoryStateOnSurface const & updatedState() const
TrackProducerWithSCAssociation(const edm::ParameterSet &iConfig)
virtual const MagneticField * magneticField() const =0
TrajectoryMeasurement const & firstMeasurement() const
std::string conversionTrackCandidateProducer_
edm::RefToBase< TrajectorySeed > seedRef() const
TrajectorySeed const & seed() const
edm::ESHandle< NavigationSchool > theSchool
void runWithCandidate(const TrackingGeometry *, const MagneticField *, const TrackCandidateCollection &, const TrajectoryFitter *, const Propagator *, const TransientTrackingRecHitBuilder *, const reco::BeamSpot &, AlgoProductCollection &)
Run the Final Fit taking TrackCandidates as input.
bool myTrajectoryInEvent_
edm::Range< RecHitContainer::const_iterator > recHits() const
void putInEvt(edm::Event &evt, const Propagator *thePropagator, const MeasurementTracker *theMeasTk, std::unique_ptr< TrackingRecHitCollection > selHits, std::unique_ptr< reco::TrackCollection > selTracks, std::unique_ptr< reco::TrackExtraCollection > selTrackExtras, std::unique_ptr< std::vector< Trajectory >> selTrajectories, AlgoProductCollection &algoResults, TransientTrackingRecHitBuilder const *hitBuilder, const TrackerTopology *ttopo)
cont
load Luminosity info ##
void produce(edm::Event &, const edm::EventSetup &) override
Method where the procduction take place. To be implemented in concrete classes.
ConstRecHitPointer const & recHit() 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.