CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackProducerWithSCAssociation Class Reference
Inheritance diagram for TrackProducerWithSCAssociation:
TrackProducerBase< reco::Track > edm::stream::EDProducer<> AlgoProductTraits< reco::Track >

Public Member Functions

std::vector< reco::TransientTrackgetTransient (edm::Event &, const edm::EventSetup &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 Method where the procduction take place. To be implemented in concrete classes. More...
 
 TrackProducerWithSCAssociation (const edm::ParameterSet &iConfig)
 
- Public Member Functions inherited from TrackProducerBase< reco::Track >
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< TrackView > &, 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 (const edm::ParameterSet &conf)
 Set parameter set. More...
 
void setSecondHitPattern (Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
 
void setSrc (const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
 set label of source collection More...
 
 TrackProducerBase (bool trajectoryInEvent=false)
 Constructor. More...
 
virtual ~TrackProducerBase () noexcept(false)
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

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)
 

Private Attributes

edm::EDGetTokenT< reco::TrackCandidateCaloClusterPtrAssociationassoc_token
 
std::string conversionTrackCandidateProducer_
 
edm::EDGetTokenT< MeasurementTrackerEventmeasurementTrkToken_
 
std::string myname_
 
bool myTrajectoryInEvent_
 
edm::OrphanHandle< reco::TrackCollectionrTracks_
 
TrackProducerAlgorithm< reco::TracktheAlgo
 
std::string trackCSuperClusterAssociationCollection_
 
std::string trackSuperClusterAssociationCollection_
 
bool validTrackCandidateSCAssociationInput_
 

Additional Inherited Members

- Public Types inherited from TrackProducerBase< reco::Track >
using AlgoProductCollection = typename Base::AlgoProductCollection
 
using Base = AlgoProductTraits< reco::Track >
 
using TrackCollection = typename Base::TrackCollection
 
using TrackView = typename Base::TrackView
 
- Public Types inherited from AlgoProductTraits< reco::Track >
using AlgoProductCollection = std::vector< AlgoProduct >
 
using TrackCollection = std::vector< reco::Track >
 
using TrackView = edm::View< reco::Track >
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Attributes inherited from TrackProducerBase< reco::Track >
std::string alias_
 
edm::EDGetTokenT< reco::BeamSpotbsSrc_
 
edm::InputTag clusterRemovalInfo_
 
edm::ParameterSet conf_
 
edm::EDGetTokenT< MeasurementTrackerEventmteSrc_
 
bool rekeyClusterRefs_
 
edm::OrphanHandle< TrackCollectionrTracks_
 
edm::EDGetToken src_
 
edm::ESHandle< NavigationSchooltheSchool
 
bool trajectoryInEvent_
 

Detailed Description

Author
Nancy Marinelli, U. of Notre Dame, US Modified version of TrackProducer by Giuseppe Cerati to have super cluster - conversion track association

Definition at line 28 of file TrackProducerWithSCAssociation.cc.

Constructor & Destructor Documentation

◆ TrackProducerWithSCAssociation()

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

Definition at line 65 of file TrackProducerWithSCAssociation.cc.

66  : TrackProducerBase<reco::Track>(iConfig.getParameter<bool>("TrajectoryInEvent")), theAlgo(iConfig) {
67  setConf(iConfig);
68  setSrc(consumes<TrackCandidateCollection>(iConfig.getParameter<edm::InputTag>("src")),
69  consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot")),
70  consumes<MeasurementTrackerEvent>(iConfig.getParameter<edm::InputTag>("MeasurementTrackerEvent")));
71  setAlias(iConfig.getParameter<std::string>("@module_label"));
72 
73  if (iConfig.exists("clusterRemovalInfo")) {
74  edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo");
75  if (!(tag == edm::InputTag())) {
77  }
78  }
79 
80  myname_ = iConfig.getParameter<std::string>("ComponentName");
82  trackCSuperClusterAssociationCollection_ = iConfig.getParameter<std::string>("trackCandidateSCAssociationCollection");
83  trackSuperClusterAssociationCollection_ = iConfig.getParameter<std::string>("recoTrackSCAssociationCollection");
84  myTrajectoryInEvent_ = iConfig.getParameter<bool>("TrajectoryInEvent");
85 
86  assoc_token = consumes<reco::TrackCandidateCaloClusterPtrAssociation>(
88  measurementTrkToken_ = consumes<MeasurementTrackerEvent>(
89  edm::InputTag("MeasurementTrackerEvent")); //hardcoded because the original was and no time to fix (sigh)
90 
91  //register your products
92  produces<reco::TrackCollection>().setBranchAlias(alias_ + "Tracks");
93  produces<reco::TrackExtraCollection>().setBranchAlias(alias_ + "TrackExtras");
94  produces<TrackingRecHitCollection>().setBranchAlias(alias_ + "RecHits");
95  produces<std::vector<Trajectory>>();
96  produces<TrajTrackAssociationCollection>();
97  // produces< reco::TrackSuperClusterAssociationCollection > (trackSuperClusterAssociationCollection_ );
98  produces<reco::TrackCaloClusterPtrAssociation>(trackSuperClusterAssociationCollection_);
99 }

References TrackProducerBase< reco::Track >::alias_, assoc_token, conversionTrackCandidateProducer_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), measurementTrkToken_, myname_, myTrajectoryInEvent_, TrackProducerBase< reco::Track >::setAlias(), TrackProducerBase< reco::Track >::setClusterRemovalInfo(), TrackProducerBase< reco::Track >::setConf(), TrackProducerBase< reco::Track >::setSrc(), AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, trackCSuperClusterAssociationCollection_, and trackSuperClusterAssociationCollection_.

Member Function Documentation

◆ getTransient()

std::vector< reco::TransientTrack > TrackProducerWithSCAssociation::getTransient ( edm::Event theEvent,
const edm::EventSetup setup 
)

Definition at line 254 of file TrackProducerWithSCAssociation.cc.

255  {
256  edm::LogInfo("TrackProducerWithSCAssociation") << "Analyzing event number: " << theEvent.id() << "\n";
257  //
258  // create empty output collections
259  //
260  std::vector<reco::TransientTrack> ttks;
261 
262  //
263  //declare and get stuff to be retrieved from ES
264  //
268  edm::ESHandle<Propagator> thePropagator;
271  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
272 
273  //
274  //declare and get TrackColection to be retrieved from the event
275  //
276  AlgoProductCollection algoResults;
278 
279  try {
281  getFromEvt(theEvent, theTCCollection, bs);
282 
283  //
284  //run the algorithm
285  //
286  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation run the algorithm" << "\n";
288  theMF.product(),
289  *theTCCollection,
290  theFitter.product(),
291  thePropagator.product(),
292  theBuilder.product(),
293  bs,
294  algoResults);
295 
296  } catch (cms::Exception& e) {
297  edm::LogInfo("TrackProducerWithSCAssociation") << "cms::Exception caught!!!"
298  << "\n"
299  << e << "\n";
300  }
301 
302  for (auto& prod : algoResults) {
303  ttks.emplace_back(*prod.track, thePropagator.product()->magneticField());
304  }
305 
306  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation end" << "\n";
307 
308  return ttks;
309 }

References cms::cuda::bs, MillePedeFileConverter_cfg::e, TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::EventBase::id(), Propagator::magneticField(), dumpMFGeometry_cfg::prod, edm::ESHandle< T >::product(), TrackProducerAlgorithm< T >::runWithCandidate(), singleTopDQM_cfi::setup, and theAlgo.

◆ produce()

void TrackProducerWithSCAssociation::produce ( edm::Event ,
const edm::EventSetup  
)
overridevirtual

Method where the procduction take place. To be implemented in concrete classes.

Implements TrackProducerBase< reco::Track >.

Definition at line 101 of file TrackProducerWithSCAssociation.cc.

101  {
102  //edm::LogInfo("TrackProducerWithSCAssociation") << "Analyzing event number: " << theEvent.id() << "\n";
103 
104  //LogDebug("TrackProducerWithSCAssociation") << "Analyzing event number: " << theEvent.id() << "\n";
105  // std::cout << " TrackProducerWithSCAssociation Analyzing event number: " << theEvent.id() << "\n";
106 
107  //
108  // create empty output collections
109  //
110  auto outputRHColl = std::make_unique<TrackingRecHitCollection>();
111  auto outputTColl = std::make_unique<reco::TrackCollection>();
112  auto outputTEColl = std::make_unique<reco::TrackExtraCollection>();
113  auto outputTrajectoryColl = std::make_unique<std::vector<Trajectory>>();
114  // Reco Track - Super Cluster Association
115  auto scTrkAssoc_p = std::make_unique<reco::TrackCaloClusterPtrAssociation>();
116 
117  //
118  //declare and get stuff to be retrieved from ES
119  //
123  edm::ESHandle<Propagator> thePropagator;
126  getFromES(setup, theG, theMF, theFitter, thePropagator, theMeasTk, theBuilder);
127 
129  setup.get<TrackerTopologyRcd>().get(httopo);
130  const TrackerTopology* ttopo = httopo.product();
131 
132  //
133  //declare and get TrackColection to be retrieved from the event
138  theEvent.getByToken(assoc_token, trkCandidateSCAssocHandle);
139  if (!trkCandidateSCAssocHandle.isValid()) {
140  // std::cout << "Error! Can't get the product "<<trackCSuperClusterAssociationCollection_.c_str() << " but keep running. Empty collection will be produced " << "\n";
141  edm::LogError("TrackProducerWithSCAssociation")
142  << "Error! Can't get the product " << trackCSuperClusterAssociationCollection_.c_str()
143  << " but keep running. Empty collection will be produced "
144  << "\n";
146  }
147  reco::TrackCandidateCaloClusterPtrAssociation scTrkCandAssCollection = *(trkCandidateSCAssocHandle.product());
148  if (scTrkCandAssCollection.empty())
150 
151  std::vector<int> tccLocations;
152  AlgoProductCollection algoResults;
154 
155  getFromEvt(theEvent, theTCCollection, bs);
156 
157  if (theTCCollection.failedToGet()) {
158  edm::LogError("TrackProducerWithSCAssociation")
159  << "TrackProducerWithSCAssociation could not get the TrackCandidateCollection.";
160  } else {
161  //
162  //run the algorithm
163  //
164  // LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation run the algorithm" << "\n";
165  // theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection,
166  // theFitter.product(), thePropagator.product(), theBuilder.product(), algoResults);
167  // we have to copy this method from the algo in order to get the association track-seed
168  // this is ugly temporary code that should be replaced!!!!!
169  // start of copied code ======================================================
170 
171  // std::cout << "TrackProducerWithSCAssociation Number of TrackCandidates: " << theTCCollection->size() << "\n";
172  try {
173  int cont = 0;
174  int tcc = 0;
175 
176  for (TrackCandidateCollection::const_iterator i = theTCCollection->begin(); i != theTCCollection->end(); i++) {
177  const TrackCandidate* theTC = &(*i);
179  const TrajectorySeed& seed = theTC->seed();
180 
181  //convert PTrajectoryStateOnDet to TrajectoryStateOnSurface
182 
183  DetId detId(state.detId());
185  state, &(theG.product()->idToDet(detId)->surface()), theMF.product());
186 
187  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation Initial TSOS\n" << theTSOS << "\n";
188 
189  //convert the TrackingRecHit vector to a TransientTrackingRecHit vector
190  //meanwhile computes the number of degrees of freedom
192 
193  float ndof = 0;
194 
195  for (auto const& recHit : theTC->recHits()) {
196  hits.push_back(theBuilder.product()->build(&recHit));
197  }
198 
199  //build Track
200  // LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation going to buildTrack"<< "\n";
201  FitterCloner fc(theFitter.product(), theBuilder.product());
202  bool ok = theAlgo.buildTrack(
203  fc.fitter.get(), thePropagator.product(), algoResults, hits, theTSOS, seed, ndof, bs, theTC->seedRef());
204  // LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation buildTrack result: " << ok << "\n";
205  if (ok) {
206  cont++;
207  tccLocations.push_back(tcc);
208  }
209  tcc++;
210  }
211  edm::LogInfo("TrackProducerWithSCAssociation") << "Number of Tracks found: " << cont << "\n";
212  //LogDebug("TrackProducerWithSCAssociation") << "TrackProducerWithSCAssociation Number of Tracks found: " << cont << "\n";
213  // end of copied code ======================================================
214 
215  } catch (cms::Exception& e) {
216  edm::LogInfo("TrackProducerWithSCAssociation") << "cms::Exception caught!!!"
217  << "\n"
218  << e << "\n";
219  }
220  //
221  //put everything in the event
222  // we copy putInEvt to get OrphanHandle filled...
223  putInEvt(theEvent,
224  thePropagator.product(),
225  theMeasTk.product(),
226  std::move(outputRHColl),
227  std::move(outputTColl),
228  std::move(outputTEColl),
229  std::move(outputTrajectoryColl),
230  algoResults,
231  theBuilder.product(),
232  ttopo);
233 
234  // now construct associationmap and put it in the event
236  int itrack = 0;
237  std::vector<edm::Ptr<reco::CaloCluster>> caloPtrVec;
238  for (AlgoProductCollection::iterator i = algoResults.begin(); i != algoResults.end(); i++) {
239  edm::Ref<TrackCandidateCollection> trackCRef(theTCCollection, tccLocations[itrack]);
240  const edm::Ptr<reco::CaloCluster>& aClus = (*trkCandidateSCAssocHandle)[trackCRef];
241  caloPtrVec.push_back(aClus);
242  itrack++;
243  }
244 
246  filler.insert(rTracks_, caloPtrVec.begin(), caloPtrVec.end());
247  filler.fill();
248  }
249 
250  theEvent.put(std::move(scTrkAssoc_p), trackSuperClusterAssociationCollection_);
251  }
252 }

References assoc_token, cms::cuda::bs, TransientTrackingRecHitBuilder::build(), TrackProducerAlgorithm< T >::buildTrack(), generateEDF::cont, MillePedeFileConverter_cfg::e, edm::ValueMap< T >::empty(), edm::HandleBase::failedToGet(), trigObjTnPSource_cfi::filler, get, edm::Event::getByToken(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), hfClusterShapes_cfi::hits, mps_fire::i, TrackerGeometry::idToDet(), edm::HandleBase::isValid(), eostools::move(), ndof, convertSQLiteXML::ok, edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::Event::put(), putInEvt(), rpcPointValidation_cfi::recHit, TrackCandidate::recHits(), rTracks_, TrackCandidate::seed(), fileCollector::seed, TrackCandidate::seedRef(), singleTopDQM_cfi::setup, GeomDet::surface(), theAlgo, trackCSuperClusterAssociationCollection_, trackSuperClusterAssociationCollection_, TrackCandidate::trajectoryStateOnDet(), trajectoryStateTransform::transientState(), and validTrackCandidateSCAssociationInput_.

◆ putInEvt()

void TrackProducerWithSCAssociation::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 
)
private

Definition at line 313 of file TrackProducerWithSCAssociation.cc.

322  {
325 
328  edm::Ref<std::vector<Trajectory>>::key_type iTjRef = 0;
329  std::map<unsigned int, unsigned int> tjTkMap;
330 
331  for (auto& i : algoResults) {
332  Trajectory* theTraj = i.trajectory;
333  if (myTrajectoryInEvent_) {
334  selTrajectories->push_back(*theTraj);
335  iTjRef++;
336  }
337 
338  reco::Track* theTrack = i.track;
339  PropagationDirection seedDir = i.pDir;
340 
341  //LogDebug("TrackProducer") << "In KfTrackProducerBase::putInEvt - seedDir=" << seedDir;
342 
343  reco::Track t = *theTrack;
344  selTracks->push_back(t);
345  iTkRef++;
346 
347  // Store indices in local map (starts at 0)
348  if (trajectoryInEvent_)
349  tjTkMap[iTjRef - 1] = iTkRef - 1;
350 
351  //sets the outermost and innermost TSOSs
352 
353  TrajectoryStateOnSurface outertsos;
354  TrajectoryStateOnSurface innertsos;
355  unsigned int innerId, outerId;
356 
357  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
358  // This is consistent with innermost and outermost labels only for tracks from LHC collision
359  if (theTraj->direction() == alongMomentum) {
360  outertsos = theTraj->lastMeasurement().updatedState();
361  innertsos = theTraj->firstMeasurement().updatedState();
362  outerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
363  innerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
364  } else {
365  outertsos = theTraj->firstMeasurement().updatedState();
366  innertsos = theTraj->lastMeasurement().updatedState();
367  outerId = theTraj->firstMeasurement().recHit()->geographicalId().rawId();
368  innerId = theTraj->lastMeasurement().recHit()->geographicalId().rawId();
369  }
370  // ---
371  //build the TrackExtra
372  GlobalPoint v = outertsos.globalParameters().position();
373  GlobalVector p = outertsos.globalParameters().momentum();
374  math::XYZVector outmom(p.x(), p.y(), p.z());
375  math::XYZPoint outpos(v.x(), v.y(), v.z());
376  v = innertsos.globalParameters().position();
377  p = innertsos.globalParameters().momentum();
378  math::XYZVector inmom(p.x(), p.y(), p.z());
379  math::XYZPoint inpos(v.x(), v.y(), v.z());
380 
381  reco::TrackExtraRef teref = reco::TrackExtraRef(rTrackExtras, idx++);
382  reco::Track& track = selTracks->back();
383  track.setExtra(teref);
384 
385  //======= I want to set the second hitPattern here =============
386  if (theSchool.isValid()) {
389  setSecondHitPattern(theTraj, track, thePropagator, &*mte, ttopo);
390  }
391  //==============================================================
392 
393  selTrackExtras->push_back(reco::TrackExtra(outpos,
394  outmom,
395  true,
396  inpos,
397  inmom,
398  true,
399  outertsos.curvilinearError(),
400  outerId,
401  innertsos.curvilinearError(),
402  innerId,
403  seedDir,
404  theTraj->seedRef()));
405 
406  reco::TrackExtra& tx = selTrackExtras->back();
407  // --- NOTA BENE: the convention is to sort hits and measurements "along the momentum".
408  // This is consistent with innermost and outermost labels only for tracks from LHC collisions
409  reco::TrackExtra::TrajParams trajParams;
411  Traj2TrackHits t2t;
412  auto ih = selHits->size();
413  t2t(*theTraj, *selHits, trajParams, chi2s);
414  auto ie = selHits->size();
415  tx.setHits(rHits, ih, ie - ih);
416  tx.setTrajParams(std::move(trajParams), std::move(chi2s));
417  for (; ih < ie; ++ih) {
418  auto const& hit = (*selHits)[ih];
419  track.appendHitPattern(hit, *ttopo);
420  }
421  // ----
422 
423  delete theTrack;
424  delete theTraj;
425  }
426 
427  //LogTrace("TrackingRegressionTest") << "========== TrackProducer Info ===================";
428  //LogDebug("TrackProducerWithSCAssociation") << "number of finalTracks: " << selTracks->size() << std::endl;
429  //for (reco::TrackCollection::const_iterator it = selTracks->begin(); it != selTracks->end(); it++) {
430  //LogDebug("TrackProducerWithSCAssociation") << "track's n valid and invalid hit, chi2, pt : "
431  // << it->found() << " , "
432  // << it->lost() <<" , "
433  // << it->normalizedChi2() << " , "
434  // << it->pt() << std::endl;
435  // }
436  //LogTrace("TrackingRegressionTest") << "=================================================";
437 
438  rTracks_ = evt.put(std::move(selTracks));
439 
440  evt.put(std::move(selTrackExtras));
441  evt.put(std::move(selHits));
442 
443  if (myTrajectoryInEvent_) {
444  edm::OrphanHandle<std::vector<Trajectory>> rTrajs = evt.put(std::move(selTrajectories));
445 
446  // Now Create traj<->tracks association map
447  auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>(rTrajs, rTracks_);
448  for (std::map<unsigned int, unsigned int>::iterator i = tjTkMap.begin(); i != tjTkMap.end(); i++) {
449  edm::Ref<std::vector<Trajectory>> trajRef(rTrajs, (*i).first);
450  edm::Ref<reco::TrackCollection> tkRef(rTracks_, (*i).second);
451  trajTrackMap->insert(edm::Ref<std::vector<Trajectory>>(rTrajs, (*i).first),
453  }
454  evt.put(std::move(trajTrackMap));
455  }
456 }

References alongMomentum, TrajectoryStateOnSurface::curvilinearError(), Trajectory::direction(), Trajectory::firstMeasurement(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalParameters(), mps_fire::i, heavyIonCSV_trainingSettings::idx, edm::ESHandleBase::isValid(), Trajectory::lastMeasurement(), measurementTrkToken_, GlobalTrajectoryParameters::momentum(), eostools::move(), myTrajectoryInEvent_, AlCaHLTBitMon_ParallelJobs::p, GlobalTrajectoryParameters::position(), edm::Event::put(), TrajectoryMeasurement::recHit(), rTracks_, Trajectory::seedRef(), reco::TrackExtraBase::setHits(), TrackProducerBase< reco::Track >::setSecondHitPattern(), reco::TrackExtraBase::setTrajParams(), submitPVValidationJobs::t, TrackProducerBase< reco::Track >::theSchool, HLT_FULL_cff::track, TrackProducerBase< reco::Track >::trajectoryInEvent_, TrajectoryMeasurement::updatedState(), and findQualityFiles::v.

Referenced by produce().

Member Data Documentation

◆ assoc_token

edm::EDGetTokenT<reco::TrackCandidateCaloClusterPtrAssociation> TrackProducerWithSCAssociation::assoc_token
private

Definition at line 42 of file TrackProducerWithSCAssociation.cc.

Referenced by produce(), and TrackProducerWithSCAssociation().

◆ conversionTrackCandidateProducer_

std::string TrackProducerWithSCAssociation::conversionTrackCandidateProducer_
private

Definition at line 39 of file TrackProducerWithSCAssociation.cc.

Referenced by TrackProducerWithSCAssociation().

◆ measurementTrkToken_

edm::EDGetTokenT<MeasurementTrackerEvent> TrackProducerWithSCAssociation::measurementTrkToken_
private

Definition at line 44 of file TrackProducerWithSCAssociation.cc.

Referenced by putInEvt(), and TrackProducerWithSCAssociation().

◆ myname_

std::string TrackProducerWithSCAssociation::myname_
private

Definition at line 37 of file TrackProducerWithSCAssociation.cc.

Referenced by TrackProducerWithSCAssociation().

◆ myTrajectoryInEvent_

bool TrackProducerWithSCAssociation::myTrajectoryInEvent_
private

Definition at line 45 of file TrackProducerWithSCAssociation.cc.

Referenced by putInEvt(), and TrackProducerWithSCAssociation().

◆ rTracks_

edm::OrphanHandle<reco::TrackCollection> TrackProducerWithSCAssociation::rTracks_
private

Definition at line 43 of file TrackProducerWithSCAssociation.cc.

Referenced by produce(), and putInEvt().

◆ theAlgo

TrackProducerAlgorithm<reco::Track> TrackProducerWithSCAssociation::theAlgo
private

Definition at line 38 of file TrackProducerWithSCAssociation.cc.

Referenced by getTransient(), and produce().

◆ trackCSuperClusterAssociationCollection_

std::string TrackProducerWithSCAssociation::trackCSuperClusterAssociationCollection_
private

Definition at line 40 of file TrackProducerWithSCAssociation.cc.

Referenced by produce(), and TrackProducerWithSCAssociation().

◆ trackSuperClusterAssociationCollection_

std::string TrackProducerWithSCAssociation::trackSuperClusterAssociationCollection_
private

Definition at line 41 of file TrackProducerWithSCAssociation.cc.

Referenced by produce(), and TrackProducerWithSCAssociation().

◆ validTrackCandidateSCAssociationInput_

bool TrackProducerWithSCAssociation::validTrackCandidateSCAssociationInput_
private

Definition at line 46 of file TrackProducerWithSCAssociation.cc.

Referenced by produce().

Vector3DBase
Definition: Vector3DBase.h:8
TrackCandidate::trajectoryStateOnDet
PTrajectoryStateOnDet const & trajectoryStateOnDet() const
Definition: TrackCandidate.h:55
edm::RefProd< TrackingRecHitCollection >
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::Event::getRefBeforePut
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
TrackProducerWithSCAssociation::trackSuperClusterAssociationCollection_
std::string trackSuperClusterAssociationCollection_
Definition: TrackProducerWithSCAssociation.cc:41
TrackProducerBase< reco::Track >::getFromES
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.
TrackProducerBase< reco::Track >::getFromEvt
virtual void getFromEvt(edm::Event &, edm::Handle< TrackCandidateCollection > &, reco::BeamSpot &)
Get TrackCandidateCollection from the Event (needed by TrackProducer)
mps_fire.i
i
Definition: mps_fire.py:428
TrackProducerWithSCAssociation::theAlgo
TrackProducerAlgorithm< reco::Track > theAlgo
Definition: TrackProducerWithSCAssociation.cc:38
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
edm::Handle::product
T const * product() const
Definition: Handle.h:70
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
Trajectory::seedRef
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:303
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
Trajectory::direction
PropagationDirection const & direction() const
Definition: Trajectory.cc:133
TrackerTopology
Definition: TrackerTopology.h:16
TrackProducerBase< reco::Track >::setConf
void setConf(const edm::ParameterSet &conf)
Set parameter set.
Definition: TrackProducerBase.h:71
TrackCandidate::recHits
edm::Range< RecHitContainer::const_iterator > recHits() const
Definition: TrackCandidate.h:57
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:628
TrackProducerBase< reco::Track >::AlgoProductCollection
typename Base::AlgoProductCollection AlgoProductCollection
Definition: TrackProducerBase.h:44
TrajectoryMeasurement::updatedState
TrajectoryStateOnSurface const & updatedState() const
Definition: TrajectoryMeasurement.h:184
TrackProducerWithSCAssociation::measurementTrkToken_
edm::EDGetTokenT< MeasurementTrackerEvent > measurementTrkToken_
Definition: TrackProducerWithSCAssociation.cc:44
Propagator::magneticField
virtual const MagneticField * magneticField() const =0
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
findQualityFiles.v
v
Definition: findQualityFiles.py:179
TransientTrackingRecHitBuilder::build
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
TrackProducerBase< reco::Track >::setSecondHitPattern
void setSecondHitPattern(Trajectory *traj, reco::Track &track, const Propagator *prop, const MeasurementTrackerEvent *measTk, const TrackerTopology *ttopo)
edm::Handle< TrackCandidateCollection >
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::Ref
Definition: AssociativeIterator.h:58
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
ndof
Definition: HIMultiTrackSelector.h:49
fileCollector.seed
seed
Definition: fileCollector.py:127
DetId
Definition: DetId.h:17
reco::TrackExtra
Definition: TrackExtra.h:26
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
cms::cuda::bs
bs
Definition: HistoContainer.h:76
edm::ValueMap::empty
bool empty() const
Definition: ValueMap.h:158
TrackProducerBase< reco::Track >::setClusterRemovalInfo
void setClusterRemovalInfo(const edm::InputTag &clusterRemovalInfo)
Sets the information on cluster removal, and turns it on.
Definition: TrackProducerBase.h:89
TrackingRecHit::RecHitContainer
std::vector< ConstRecHitPointer > RecHitContainer
Definition: TrackingRecHit.h:31
TrackProducerAlgorithm::runWithCandidate
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.
TrackCandidate::seedRef
edm::RefToBase< TrajectorySeed > seedRef() const
Definition: TrackCandidate.h:74
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
reco::BeamSpot
Definition: BeamSpot.h:21
reco::Track
Definition: Track.h:27
edm::ESHandle< TrackerGeometry >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
TrackProducerBase< reco::Track >::setAlias
void setAlias(std::string alias)
set the aliases of produced collections
Definition: TrackProducerBase.h:83
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
TrackProducerWithSCAssociation::putInEvt
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)
Definition: TrackProducerWithSCAssociation.cc:313
Point3DBase< float, GlobalTag >
TrackProducerWithSCAssociation::myTrajectoryInEvent_
bool myTrajectoryInEvent_
Definition: TrackProducerWithSCAssociation.cc:45
GlobalTrajectoryParameters::momentum
GlobalVector momentum() const
Definition: GlobalTrajectoryParameters.h:65
reco::TrackExtraBase::setTrajParams
void setTrajParams(TrajParams tmps, Chi2sFive chi2s)
Definition: TrackExtraBase.h:36
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TrackCandidate
Definition: TrackCandidate.h:24
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
Trajectory::lastMeasurement
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:150
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
Traj2TrackHits
Definition: Traj2TrackHits.h:16
TrackProducerBase< reco::Track >::alias_
std::string alias_
Definition: TrackProducerBase.h:107
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
reco::TrackExtraRef
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:16
TrackCandidate::seed
TrajectorySeed const & seed() const
Definition: TrackCandidate.h:60
TrackProducerWithSCAssociation::rTracks_
edm::OrphanHandle< reco::TrackCollection > rTracks_
Definition: TrackProducerWithSCAssociation.cc:43
trajectoryStateTransform::transientState
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Definition: TrajectoryStateTransform.cc:35
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
TrackProducerBase< reco::Track >::trajectoryInEvent_
bool trajectoryInEvent_
Definition: TrackProducerBase.h:108
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ref::key_type
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
TrackProducerBase< reco::Track >::setSrc
void setSrc(const edm::EDGetToken &src, const edm::EDGetTokenT< reco::BeamSpot > &bsSrc, const edm::EDGetTokenT< MeasurementTrackerEvent > &mteSrc)
set label of source collection
Definition: TrackProducerBase.h:74
reco::TrackExtraBase::setHits
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
Definition: TrackExtraBase.h:30
edm::Ptr
Definition: AssociationVector.h:31
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
TrackProducerWithSCAssociation::validTrackCandidateSCAssociationInput_
bool validTrackCandidateSCAssociationInput_
Definition: TrackProducerWithSCAssociation.cc:46
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
Trajectory::firstMeasurement
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:166
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
FitterCloner
Definition: TrackProducerAlgorithm.h:30
reco::TrackExtraBase::Chi2sFive
std::vector< unsigned char > Chi2sFive
Definition: TrackExtraBase.h:25
Trajectory
Definition: Trajectory.h:38
TrackProducerWithSCAssociation::assoc_token
edm::EDGetTokenT< reco::TrackCandidateCaloClusterPtrAssociation > assoc_token
Definition: TrackProducerWithSCAssociation.cc:42
edm::ValueMap
Definition: ValueMap.h:107
TrajectoryStateOnSurface::curvilinearError
const CurvilinearTrajectoryError & curvilinearError() const
Definition: TrajectoryStateOnSurface.h:72
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
edm::EventBase::id
edm::EventID id() const
Definition: EventBase.h:59
TrackProducerWithSCAssociation::trackCSuperClusterAssociationCollection_
std::string trackCSuperClusterAssociationCollection_
Definition: TrackProducerWithSCAssociation.cc:40
TrajectorySeed
Definition: TrajectorySeed.h:18
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackProducerWithSCAssociation::myname_
std::string myname_
Definition: TrackProducerWithSCAssociation.cc:37
TrackProducerAlgorithm::buildTrack
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.
cms::Exception
Definition: Exception.h:70
edm::helper::Filler
Definition: ValueMap.h:22
TrajectoryStateOnSurface::globalParameters
const GlobalTrajectoryParameters & globalParameters() const
Definition: TrajectoryStateOnSurface.h:64
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
TrackProducerBase< reco::Track >
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
reco::TrackExtraBase::TrajParams
std::vector< LocalTrajectoryParameters > TrajParams
Definition: TrackExtraBase.h:24
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
hit
Definition: SiStripHitEffFromCalibTree.cc:88
TrackProducerWithSCAssociation::conversionTrackCandidateProducer_
std::string conversionTrackCandidateProducer_
Definition: TrackProducerWithSCAssociation.cc:39
edm::OwnVector< TrackingRecHit >
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackProducerBase< reco::Track >::theSchool
edm::ESHandle< NavigationSchool > theSchool
Definition: TrackProducerBase.h:116