CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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=default
 
- 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

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<>
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

Definition at line 19 of file SeedCombiner.h.

Constructor & Destructor Documentation

◆ SeedCombiner()

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

Definition at line 29 of file SeedCombiner.cc.

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

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 }
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:31
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
std::vector< edm::EDGetTokenT< reco::ClusterRemovalInfo > > clusterRemovalTokens_
Definition: SeedCombiner.h:32
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
Definition: SeedCombiner.h:29

◆ ~SeedCombiner()

SeedCombiner::~SeedCombiner ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void SeedCombiner::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 87 of file SeedCombiner.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), and submitPVResolutionJobs::desc.

87  {
89  desc.add<std::vector<edm::InputTag> >("seedCollections", {});
90  desc.addOptional<std::vector<edm::InputTag> >("clusterRemovalInfos", {});
91  descriptions.addWithDefaultLabel(desc);
92 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 46 of file SeedCombiner.cc.

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

46  {
47  // Read inputs, and count total seeds
48  size_t ninputs = inputCollections_.size();
49  size_t nseeds = 0;
50  std::vector<Handle<TrajectorySeedCollection> > seedCollections(ninputs);
51  for (size_t i = 0; i < ninputs; ++i) {
52  ev.getByToken(inputCollections_[i], seedCollections[i]);
53  nseeds += seedCollections[i]->size();
54  }
55 
56  // Prepare output collections, with the correct capacity
57  auto result = std::make_unique<TrajectorySeedCollection>();
58  result->reserve(nseeds);
59 
60  // Write into output collection
61  unsigned int iSC = 0, iSC_max = seedCollections.size();
62  for (; iSC != iSC_max; ++iSC) {
64  if (reKeing_ && !(clusterRemovalInfos_[iSC] == edm::InputTag(""))) {
66 
67  for (TrajectorySeedCollection::const_iterator iS = collection->begin(); iS != collection->end(); ++iS) {
68  TrajectorySeed::RecHitContainer newRecHitContainer;
69  newRecHitContainer.reserve(iS->nHits());
70  //loop seed rechits, copy over and rekey.
71  for (auto const& recHit : iS->recHits()) {
72  newRecHitContainer.push_back(recHit);
73  refSetter.reKey(&newRecHitContainer.back());
74  }
75  result->push_back(TrajectorySeed(iS->startingState(), std::move(newRecHitContainer), iS->direction()));
76  }
77  } else {
78  //just insert the new seeds as they are
79  result->insert(result->end(), collection->begin(), collection->end());
80  }
81  }
82 
83  // Save result into the event
84  ev.put(std::move(result));
85 }
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:31
reference back()
Definition: OwnVector.h:431
void push_back(D *&d)
Definition: OwnVector.h:326
std::vector< edm::EDGetTokenT< reco::ClusterRemovalInfo > > clusterRemovalTokens_
Definition: SeedCombiner.h:32
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
Definition: SeedCombiner.h:29
def move(src, dest)
Definition: eostools.py:511
void reserve(size_t)
Definition: OwnVector.h:320

Member Data Documentation

◆ clusterRemovalInfos_

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

Definition at line 31 of file SeedCombiner.h.

◆ clusterRemovalTokens_

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

Definition at line 32 of file SeedCombiner.h.

◆ inputCollections_

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

Definition at line 29 of file SeedCombiner.h.

◆ reKeing_

bool SeedCombiner::reKeing_
private

Definition at line 30 of file SeedCombiner.h.