CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
NuclearSeedsEDProducer Class Reference

#include <RecoTracker/NuclearSeedGenerator/interface/NuclearSeedsEDProducer.h>

Inheritance diagram for NuclearSeedsEDProducer:
edm::stream::EDProducer<>

Public Member Functions

 NuclearSeedsEDProducer (const edm::ParameterSet &)
 
 ~NuclearSeedsEDProducer () override
 
- 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 beginRun (edm::Run const &run, const edm::EventSetup &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ParameterSet conf_
 
bool improveSeeds
 
edm::EDGetTokenT
< MeasurementTrackerEvent
mteToken_
 
edm::EDGetTokenT
< TrajectoryCollection
producer_
 
std::unique_ptr
< NuclearInteractionFinder
theNuclearInteractionFinder
 

Additional Inherited Members

- 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
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 50 of file NuclearSeedsEDProducer.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file NuclearSeedsEDProducer.cc.

18  : conf_(iConfig),
19  improveSeeds(iConfig.getParameter<bool>("improveSeeds")),
20  producer_(consumes<TrajectoryCollection>(iConfig.getParameter<std::string>("producer"))),
21  mteToken_(consumes<MeasurementTrackerEvent>(edm::InputTag("MeasurementTrackerEvents"))) {
22  produces<TrajectorySeedCollection>();
23  produces<TrajectoryToSeedsMap>();
24 }
edm::EDGetTokenT< TrajectoryCollection > producer_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< MeasurementTrackerEvent > mteToken_
NuclearSeedsEDProducer::~NuclearSeedsEDProducer ( )
override

Definition at line 26 of file NuclearSeedsEDProducer.cc.

26 {}

Member Function Documentation

void NuclearSeedsEDProducer::beginRun ( edm::Run const &  run,
const edm::EventSetup es 
)
overrideprivate

Definition at line 82 of file NuclearSeedsEDProducer.cc.

References conf_, and theNuclearInteractionFinder.

82  {
83  theNuclearInteractionFinder = std::make_unique<NuclearInteractionFinder>(es, conf_);
84 }
std::unique_ptr< NuclearInteractionFinder > theNuclearInteractionFinder
void NuclearSeedsEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 33 of file NuclearSeedsEDProducer.cc.

References data, edm::Event::getByToken(), mps_fire::i, improveSeeds, dqmiolumiharvest::j, LogDebug, eostools::move(), mteToken_, convertSQLitetoXML_cfg::output, producer_, edm::Event::put(), theNuclearInteractionFinder, and trackerHitRTTI::vector.

33  {
34  typedef TrajectoryMeasurement TM;
35 
36  edm::Handle<TrajectoryCollection> m_TrajectoryCollection;
37  iEvent.getByToken(producer_, m_TrajectoryCollection);
38 
39  LogDebug("NuclearSeedGenerator") << "Number of trajectory in event :" << m_TrajectoryCollection->size() << "\n";
40 
41  auto output = std::make_unique<TrajectorySeedCollection>();
42  auto outAssoc = std::make_unique<TrajectoryToSeedsMap>();
43 
45  iEvent.getByToken(mteToken_, data);
46 
47  // NavigationSetter setter( *(theNuclearInteractionFinder->nav()) ); why???
48 
49  std::vector<std::pair<int, int> > assocPair;
50  int i = 0;
51 
52  for (std::vector<Trajectory>::const_iterator iTraj = m_TrajectoryCollection->begin();
53  iTraj != m_TrajectoryCollection->end();
54  iTraj++, i++) {
55  // run the finder
56  theNuclearInteractionFinder->run(*iTraj, *data);
57 
58  // improve seeds
59  if (improveSeeds == true)
60  theNuclearInteractionFinder->improveSeeds(*data);
61 
62  // push back the new persistent seeds in output
63  std::unique_ptr<TrajectorySeedCollection> newSeeds(theNuclearInteractionFinder->getPersistentSeeds());
64  output->insert(output->end(), newSeeds->begin(), newSeeds->end());
65 
66  // fill the id of the Trajectory and the if of the seed in assocPair
67  for (unsigned int j = 0; j < newSeeds->size(); j++) {
68  assocPair.push_back(std::make_pair(i, output->size() - newSeeds->size() + j));
69  }
70  }
71 
72  const edm::OrphanHandle<TrajectorySeedCollection> refprodTrajSeedColl = iEvent.put(std::move(output));
73 
74  for (std::vector<std::pair<int, int> >::const_iterator iVecP = assocPair.begin(); iVecP != assocPair.end(); iVecP++) {
75  outAssoc->insert(edm::Ref<TrajectoryCollection>(m_TrajectoryCollection, iVecP->first),
76  edm::Ref<TrajectorySeedCollection>(refprodTrajSeedColl, iVecP->second));
77  }
78  iEvent.put(std::move(outAssoc));
79 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::unique_ptr< NuclearInteractionFinder > theNuclearInteractionFinder
edm::EDGetTokenT< TrajectoryCollection > producer_
def move
Definition: eostools.py:511
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
edm::EDGetTokenT< MeasurementTrackerEvent > mteToken_
#define LogDebug(id)

Member Data Documentation

edm::ParameterSet NuclearSeedsEDProducer::conf_
private

Definition at line 60 of file NuclearSeedsEDProducer.h.

Referenced by beginRun().

bool NuclearSeedsEDProducer::improveSeeds
private

Definition at line 63 of file NuclearSeedsEDProducer.h.

Referenced by produce().

edm::EDGetTokenT<MeasurementTrackerEvent> NuclearSeedsEDProducer::mteToken_
private

Definition at line 65 of file NuclearSeedsEDProducer.h.

Referenced by produce().

edm::EDGetTokenT<TrajectoryCollection> NuclearSeedsEDProducer::producer_
private

Definition at line 64 of file NuclearSeedsEDProducer.h.

Referenced by produce().

std::unique_ptr<NuclearInteractionFinder> NuclearSeedsEDProducer::theNuclearInteractionFinder
private

Definition at line 61 of file NuclearSeedsEDProducer.h.

Referenced by beginRun(), and produce().