CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SeedCombiner Class Reference

#include <SeedCombiner.h>

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

Public Member Functions

void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 SeedCombiner (const edm::ParameterSet &cfg)
 
 ~SeedCombiner () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

std::vector< edm::InputTagclusterRemovalInfos_
 
std::vector< edm::EDGetTokenT< reco::ClusterRemovalInfo > > clusterRemovalTokens_
 
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
 
bool reKeing_
 

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

Definition at line 17 of file SeedCombiner.h.

Constructor & Destructor Documentation

◆ SeedCombiner()

SeedCombiner::SeedCombiner ( const edm::ParameterSet cfg)

Definition at line 29 of file SeedCombiner.cc.

29  {
31  edm::vector_transform(cfg.getParameter<std::vector<edm::InputTag> >("seedCollections"),
32  [this](edm::InputTag const& tag) { return consumes<TrajectorySeedCollection>(tag); });
33  produces<TrajectorySeedCollection>();
34  reKeing_ = false;
35  if (cfg.exists("clusterRemovalInfos")) {
36  clusterRemovalInfos_ = cfg.getParameter<std::vector<edm::InputTag> >("clusterRemovalInfos");
38  for (unsigned int i = 0; i < clusterRemovalInfos_.size(); ++i)
39  if (!(clusterRemovalInfos_[i] == edm::InputTag("")))
40  clusterRemovalTokens_[i] = consumes<reco::ClusterRemovalInfo>(clusterRemovalInfos_[i]);
41  if (!clusterRemovalInfos_.empty() && clusterRemovalInfos_.size() == inputCollections_.size())
42  reKeing_ = true;
43  }
44 }

References looper::cfg, mps_fire::i, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

◆ ~SeedCombiner()

SeedCombiner::~SeedCombiner ( )
override

Definition at line 46 of file SeedCombiner.cc.

46 {}

Member Function Documentation

◆ produce()

void SeedCombiner::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

Definition at line 48 of file SeedCombiner.cc.

48  {
49  // Read inputs, and count total seeds
50  size_t ninputs = inputCollections_.size();
51  size_t nseeds = 0;
52  std::vector<Handle<TrajectorySeedCollection> > seedCollections(ninputs);
53  for (size_t i = 0; i < ninputs; ++i) {
54  ev.getByToken(inputCollections_[i], seedCollections[i]);
55  nseeds += seedCollections[i]->size();
56  }
57 
58  // Prepare output collections, with the correct capacity
59  auto result = std::make_unique<TrajectorySeedCollection>();
60  result->reserve(nseeds);
61 
62  // Write into output collection
63  unsigned int iSC = 0, iSC_max = seedCollections.size();
64  for (; iSC != iSC_max; ++iSC) {
66  if (reKeing_ && !(clusterRemovalInfos_[iSC] == edm::InputTag(""))) {
68 
69  for (TrajectorySeedCollection::const_iterator iS = collection->begin(); iS != collection->end(); ++iS) {
70  TrajectorySeed::recHitContainer newRecHitContainer;
71  newRecHitContainer.reserve(iS->nHits());
72  TrajectorySeed::const_iterator iH = iS->recHits().first;
73  TrajectorySeed::const_iterator iH_end = iS->recHits().second;
74  //loop seed rechits, copy over and rekey.
75  for (; iH != iH_end; ++iH) {
76  newRecHitContainer.push_back(*iH);
77  refSetter.reKey(&newRecHitContainer.back());
78  }
79  result->push_back(TrajectorySeed(iS->startingState(), std::move(newRecHitContainer), iS->direction()));
80  }
81  } else {
82  //just insert the new seeds as they are
83  result->insert(result->end(), collection->begin(), collection->end());
84  }
85  }
86 
87  // Save result into the event
88  ev.put(std::move(result));
89 }

References edm::OwnVector< T, P >::back(), universalConfigTemplate::collection, ev, mps_fire::i, eostools::move(), edm::OwnVector< T, P >::push_back(), ClusterRemovalRefSetter::reKey(), edm::OwnVector< T, P >::reserve(), mps_fire::result, and seedmultiplicitymonitor_cfi::seedCollections.

Member Data Documentation

◆ clusterRemovalInfos_

std::vector<edm::InputTag> SeedCombiner::clusterRemovalInfos_
private

Definition at line 27 of file SeedCombiner.h.

◆ clusterRemovalTokens_

std::vector<edm::EDGetTokenT<reco::ClusterRemovalInfo> > SeedCombiner::clusterRemovalTokens_
private

Definition at line 28 of file SeedCombiner.h.

◆ inputCollections_

std::vector<edm::EDGetTokenT<TrajectorySeedCollection> > SeedCombiner::inputCollections_
private

Definition at line 25 of file SeedCombiner.h.

◆ reKeing_

bool SeedCombiner::reKeing_
private

Definition at line 26 of file SeedCombiner.h.

mps_fire.i
i
Definition: mps_fire.py:355
SeedCombiner::inputCollections_
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
Definition: SeedCombiner.h:25
SeedCombiner::reKeing_
bool reKeing_
Definition: SeedCombiner.h:26
TrajectorySeed::const_iterator
recHitContainer::const_iterator const_iterator
Definition: TrajectorySeed.h:20
edm::Handle
Definition: AssociativeIterator.h:50
ClusterRemovalRefSetter
Definition: ClusterRemovalRefSetter.h:21
seedmultiplicitymonitor_cfi.seedCollections
seedCollections
Definition: seedmultiplicitymonitor_cfi.py:5
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
edm::OwnVector::back
reference back()
Definition: OwnVector.h:431
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::OwnVector::reserve
void reserve(size_t)
Definition: OwnVector.h:320
SeedCombiner::clusterRemovalInfos_
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:27
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
SeedCombiner::clusterRemovalTokens_
std::vector< edm::EDGetTokenT< reco::ClusterRemovalInfo > > clusterRemovalTokens_
Definition: SeedCombiner.h:28
TrajectorySeed
Definition: TrajectorySeed.h:17
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
mps_fire.result
result
Definition: mps_fire.py:303
edm::InputTag
Definition: InputTag.h:15
edm::OwnVector< TrackingRecHit >