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 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
 
 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 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 17 of file SeedCombiner.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file SeedCombiner.cc.

References edm::ParameterSet::getParameter(), GlobalPosition_Frontier_DevDB_cff::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:27
bool exists(std::string const &parameterName) const
checks if a parameter exists
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:28
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
Definition: SeedCombiner.h:25
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SeedCombiner::~SeedCombiner ( )
override

Definition at line 46 of file SeedCombiner.cc.

46 {}

Member Function Documentation

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

Definition at line 48 of file SeedCombiner.cc.

References edm::OwnVector< T, P >::back(), clusterRemovalInfos_, clusterRemovalTokens_, universalConfigTemplate::collection, edm::Event::getByToken(), mps_fire::i, inputCollections_, eostools::move(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), reKeing_, ClusterRemovalRefSetter::reKey(), edm::OwnVector< T, P >::reserve(), mps_fire::result, and HLT_FULL_cff::seedCollections.

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) {
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  //loop seed rechits, copy over and rekey.
73  for (auto const& recHit : iS->recHits()) {
74  newRecHitContainer.push_back(recHit);
75  refSetter.reKey(&newRecHitContainer.back());
76  }
77  result->push_back(TrajectorySeed(iS->startingState(), std::move(newRecHitContainer), iS->direction()));
78  }
79  } else {
80  //just insert the new seeds as they are
81  result->insert(result->end(), collection->begin(), collection->end());
82  }
83  }
84 
85  // Save result into the event
86  ev.put(std::move(result));
87 }
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:27
reference back()
Definition: OwnVector.h:431
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
tuple result
Definition: mps_fire.py:311
void push_back(D *&d)
Definition: OwnVector.h:326
def move
Definition: eostools.py:511
std::vector< edm::EDGetTokenT< reco::ClusterRemovalInfo > > clusterRemovalTokens_
Definition: SeedCombiner.h:28
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
Definition: SeedCombiner.h:25
tuple seedCollections
void reserve(size_t)
Definition: OwnVector.h:320

Member Data Documentation

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

Definition at line 27 of file SeedCombiner.h.

Referenced by produce().

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

Definition at line 28 of file SeedCombiner.h.

Referenced by produce().

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

Definition at line 25 of file SeedCombiner.h.

Referenced by produce().

bool SeedCombiner::reKeing_
private

Definition at line 26 of file SeedCombiner.h.

Referenced by produce().