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::EDProducer 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::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< edm::InputTagclusterRemovalInfos_
 
std::vector< edm::InputTaginputCollections_
 
bool reKeing_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 11 of file SeedCombiner.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file SeedCombiner.cc.

References clusterRemovalInfos_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), inputCollections_, and reKeing_.

30  :
31  inputCollections_(cfg.getParameter<std::vector<edm::InputTag> >("seedCollections"))
32 {
33  produces<TrajectorySeedCollection>();
34  reKeing_=false;
35  if (cfg.exists("clusterRemovalInfos")){
36  clusterRemovalInfos_=cfg.getParameter<std::vector<edm::InputTag> >("clusterRemovalInfos");
37  if (clusterRemovalInfos_.size()!=0 && clusterRemovalInfos_.size()==inputCollections_.size()) reKeing_=true;
38  }
39 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:22
std::vector< edm::InputTag > inputCollections_
Definition: SeedCombiner.h:20
bool exists(std::string const &parameterName) const
checks if a parameter exists
SeedCombiner::~SeedCombiner ( )

Definition at line 42 of file SeedCombiner.cc.

43 {
44 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 47 of file SeedCombiner.cc.

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

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.getByLabel(inputCollections_[i], seedCollections[i]);
55  nseeds += seedCollections[i]->size();
56  }
57 
58  // Prepare output collections, with the correct capacity
59  std::auto_ptr<TrajectorySeedCollection> result(new 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){
65  Handle<TrajectorySeedCollection> & collection=seedCollections[iSC];
66  if (reKeing_ && !(clusterRemovalInfos_[iSC]==edm::InputTag(""))){
68 
69  for (TrajectorySeedCollection::const_iterator iS=collection->begin();
70  iS!=collection->end();++iS){
71  TrajectorySeed::recHitContainer newRecHitContainer;
72  newRecHitContainer.reserve(iS->nHits());
73  TrajectorySeed::const_iterator iH=iS->recHits().first;
74  TrajectorySeed::const_iterator iH_end=iS->recHits().second;
75  //loop seed rechits, copy over and rekey.
76  for (;iH!=iH_end;++iH){
77  newRecHitContainer.push_back(*iH);
78  refSetter.reKey(&newRecHitContainer.back());
79  }
80  result->push_back(TrajectorySeed(iS->startingState(),
81  std::move(newRecHitContainer),
82  iS->direction()));
83  }
84  }else{
85  //just insert the new seeds as they are
86  result->insert(result->end(), collection->begin(), collection->end());
87  }
88  }
89 
90  // Save result into the event
91  ev.put(result);
92 }
std::vector< edm::InputTag > clusterRemovalInfos_
Definition: SeedCombiner.h:22
int i
Definition: DBlmapReader.cc:9
reference back()
Definition: OwnVector.h:320
std::vector< edm::InputTag > inputCollections_
Definition: SeedCombiner.h:20
void push_back(D *&d)
Definition: OwnVector.h:273
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
recHitContainer::const_iterator const_iterator
tuple result
Definition: query.py:137
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void reserve(size_t)
Definition: OwnVector.h:267

Member Data Documentation

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

Definition at line 22 of file SeedCombiner.h.

Referenced by produce(), and SeedCombiner().

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

Definition at line 20 of file SeedCombiner.h.

Referenced by produce(), and SeedCombiner().

bool SeedCombiner::reKeing_
private

Definition at line 21 of file SeedCombiner.h.

Referenced by produce(), and SeedCombiner().