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>(
81 edm::InputTag(conversionTrackCandidateProducer_, trackCSuperClusterAssociationCollection_));
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++) {
177 state, &(theG.product()->idToDet(detId)->surface()), theMF.
product());
187 for (
auto const& recHit : theTC->
recHits()) {
188 hits.push_back(theBuilder.
product()->build(&recHit));
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) {
295 ttks.emplace_back(*prod.track, thePropagator.
product()->magneticField());
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;
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];
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),
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_
ConstRecHitPointer const & recHit() const
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
tuple cont
load Luminosity info ##
edm::OrphanHandle< reco::TrackCollection > rTracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< reco::TransientTrack > getTransient(edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
const CurvilinearTrajectoryError & curvilinearError() const
TrajectorySeed const & seed() const
void insert(const H &h, I begin, I end)
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
std::string trackSuperClusterAssociationCollection_
edm::EDGetTokenT< reco::TrackCandidateCaloClusterPtrAssociation > assoc_token
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
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_
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_
PropagationDirection const & direction() const
bool getData(T &iHolder) const
PTrajectoryStateOnDet const & trajectoryStateOnDet() const
TrajectoryMeasurement const & lastMeasurement() const
GlobalVector momentum() const
edm::Range< RecHitContainer::const_iterator > recHits() const
unsigned int detId() const
edm::RefToBase< TrajectorySeed > seedRef(void) const
RefProd< PROD > getRefBeforePut()
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken_
GlobalPoint position() const
TrackProducerAlgorithm< reco::Track > theAlgo
Log< level::Info, false > LogInfo
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
void setExtra(const TrackExtraRef &ref)
set reference to "extra" object
TrajectoryMeasurement const & firstMeasurement() const
T const * product() const
const GlobalTrajectoryParameters & globalParameters() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::vector< AlgoProduct > AlgoProductCollection
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
T getParameter(std::string const &) const
bool appendHitPattern(const TrackingRecHit &hit, const TrackerTopology &ttopo)
append a single hit to the HitPattern
TrackProducerWithSCAssociation(const edm::ParameterSet &iConfig)
std::string conversionTrackCandidateProducer_
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.
TrajectoryStateOnSurface const & updatedState() const
bool myTrajectoryInEvent_
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)
edm::RefToBase< TrajectorySeed > seedRef() const
void produce(edm::Event &, const edm::EventSetup &) override
Method where the procduction take place. To be implemented in concrete classes.
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.