CMS 3D CMS Logo

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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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< MeasurementTrackerEventmteToken_
 
edm::EDGetTokenT< TrajectoryCollectionproducer_
 
std::unique_ptr< NuclearInteractionFindertheNuclearInteractionFinder
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

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

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

Definition at line 49 of file NuclearSeedsEDProducer.h.

Constructor & Destructor Documentation

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

Definition at line 18 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 {
23  produces<TrajectorySeedCollection>();
24  produces<TrajectoryToSeedsMap>();
25 
26 
27 }
T getParameter(std::string const &) const
edm::EDGetTokenT< TrajectoryCollection > producer_
edm::EDGetTokenT< MeasurementTrackerEvent > mteToken_
NuclearSeedsEDProducer::~NuclearSeedsEDProducer ( )
override

Definition at line 30 of file NuclearSeedsEDProducer.cc.

31 {
32 }

Member Function Documentation

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

Definition at line 92 of file NuclearSeedsEDProducer.cc.

References conf_, and theNuclearInteractionFinder.

93 {
94  theNuclearInteractionFinder = std::make_unique<NuclearInteractionFinder>(es, conf_);
95 
96 }
std::unique_ptr< NuclearInteractionFinder > theNuclearInteractionFinder
void NuclearSeedsEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 41 of file NuclearSeedsEDProducer.cc.

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

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

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().