CMS 3D CMS Logo

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

#include <SeedCombiner.h>

Inheritance diagram for SeedCombiner:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 SeedCombiner (const edm::ParameterSet &cfg)
 
 ~SeedCombiner ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 13 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().

30 {
32  cfg.getParameter<std::vector<edm::InputTag> >("seedCollections"),
33  [this](edm::InputTag const & tag) { return consumes<TrajectorySeedCollection>(tag); } );
34  produces<TrajectorySeedCollection>();
35  reKeing_=false;
36  if (cfg.exists("clusterRemovalInfos")){
37  clusterRemovalInfos_=cfg.getParameter<std::vector<edm::InputTag> >("clusterRemovalInfos");
39  for (unsigned int i=0;i<clusterRemovalInfos_.size();++i)
41  clusterRemovalTokens_[i] = consumes<reco::ClusterRemovalInfo>(clusterRemovalInfos_[i]);
42  if (clusterRemovalInfos_.size()!=0 && clusterRemovalInfos_.size()==inputCollections_.size()) reKeing_=true;
43  }
44 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:24
int i
Definition: DBlmapReader.cc:9
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:25
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
Definition: SeedCombiner.h:22
SeedCombiner::~SeedCombiner ( )

Definition at line 47 of file SeedCombiner.cc.

48 {
49 }

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 52 of file SeedCombiner.cc.

References edm::OwnVector< T, P >::back(), clusterRemovalInfos_, clusterRemovalTokens_, runEdmFileComparison::collection, edm::Event::getByToken(), i, inputCollections_, edm::OwnVector< T, P >::push_back(), edm::Event::put(), reKeing_, ClusterRemovalRefSetter::reKey(), edm::OwnVector< T, P >::reserve(), and query::result.

53 {
54  // Read inputs, and count total seeds
55  size_t ninputs = inputCollections_.size();
56  size_t nseeds = 0;
57  std::vector<Handle<TrajectorySeedCollection > > seedCollections(ninputs);
58  for (size_t i = 0; i < ninputs; ++i) {
59  ev.getByToken(inputCollections_[i], seedCollections[i]);
60  nseeds += seedCollections[i]->size();
61  }
62 
63  // Prepare output collections, with the correct capacity
64  std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection());
65  result->reserve( nseeds );
66 
67  // Write into output collection
68  unsigned int iSC=0,iSC_max=seedCollections.size();
69  for (;iSC!=iSC_max;++iSC){
70  Handle<TrajectorySeedCollection> & collection=seedCollections[iSC];
71  if (reKeing_ && !(clusterRemovalInfos_[iSC]==edm::InputTag(""))){
73 
74  for (TrajectorySeedCollection::const_iterator iS=collection->begin();
75  iS!=collection->end();++iS){
76  TrajectorySeed::recHitContainer newRecHitContainer;
77  newRecHitContainer.reserve(iS->nHits());
78  TrajectorySeed::const_iterator iH=iS->recHits().first;
79  TrajectorySeed::const_iterator iH_end=iS->recHits().second;
80  //loop seed rechits, copy over and rekey.
81  for (;iH!=iH_end;++iH){
82  newRecHitContainer.push_back(*iH);
83  refSetter.reKey(&newRecHitContainer.back());
84  }
85  result->push_back(TrajectorySeed(iS->startingState(),
86  std::move(newRecHitContainer),
87  iS->direction()));
88  }
89  }else{
90  //just insert the new seeds as they are
91  result->insert(result->end(), collection->begin(), collection->end());
92  }
93  }
94 
95  // Save result into the event
96  ev.put(result);
97 }
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:24
int i
Definition: DBlmapReader.cc:9
reference back()
Definition: OwnVector.h:327
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void push_back(D *&d)
Definition: OwnVector.h:280
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
recHitContainer::const_iterator const_iterator
tuple result
Definition: query.py:137
std::vector< edm::EDGetTokenT< reco::ClusterRemovalInfo > > clusterRemovalTokens_
Definition: SeedCombiner.h:25
std::vector< edm::EDGetTokenT< TrajectorySeedCollection > > inputCollections_
Definition: SeedCombiner.h:22
void reserve(size_t)
Definition: OwnVector.h:274

Member Data Documentation

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

Definition at line 24 of file SeedCombiner.h.

Referenced by produce().

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

Definition at line 25 of file SeedCombiner.h.

Referenced by produce().

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

Definition at line 22 of file SeedCombiner.h.

Referenced by produce().

bool SeedCombiner::reKeing_
private

Definition at line 23 of file SeedCombiner.h.

Referenced by produce().