#include <SeedCombiner.h>
Public Member Functions | |
virtual void | beginRun (edm::Run &run, const edm::EventSetup &es) |
virtual void | produce (edm::Event &ev, const edm::EventSetup &es) |
SeedCombiner (const edm::ParameterSet &cfg) | |
~SeedCombiner () | |
Private Attributes | |
std::vector< edm::InputTag > | clusterRemovalInfos_ |
std::vector< edm::InputTag > | inputCollections_ |
bool | reKeing_ |
Definition at line 11 of file SeedCombiner.h.
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_.
: inputCollections_(cfg.getParameter<std::vector<edm::InputTag> >("seedCollections")) { produces<TrajectorySeedCollection>(); reKeing_=false; if (cfg.exists("clusterRemovalInfos")){ clusterRemovalInfos_=cfg.getParameter<std::vector<edm::InputTag> >("clusterRemovalInfos"); if (clusterRemovalInfos_.size()!=0 && clusterRemovalInfos_.size()==inputCollections_.size()) reKeing_=true; } }
SeedCombiner::~SeedCombiner | ( | ) |
Definition at line 42 of file SeedCombiner.cc.
{ }
void SeedCombiner::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | es | ||
) | [virtual] |
void SeedCombiner::produce | ( | edm::Event & | ev, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 51 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.
{ // Read inputs, and count total seeds size_t ninputs = inputCollections_.size(); size_t nseeds = 0; std::vector<Handle<TrajectorySeedCollection > > seedCollections(ninputs); for (size_t i = 0; i < ninputs; ++i) { ev.getByLabel(inputCollections_[i], seedCollections[i]); nseeds += seedCollections[i]->size(); } // Prepare output collections, with the correct capacity std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection()); result->reserve( nseeds ); // Write into output collection unsigned int iSC=0,iSC_max=seedCollections.size(); for (;iSC!=iSC_max;++iSC){ Handle<TrajectorySeedCollection> & collection=seedCollections[iSC]; if (reKeing_ && !(clusterRemovalInfos_[iSC]==edm::InputTag(""))){ ClusterRemovalRefSetter refSetter(ev, clusterRemovalInfos_[iSC]); for (TrajectorySeedCollection::const_iterator iS=collection->begin(); iS!=collection->end();++iS){ TrajectorySeed::recHitContainer newRecHitContainer; newRecHitContainer.reserve(iS->nHits()); TrajectorySeed::const_iterator iH=iS->recHits().first; TrajectorySeed::const_iterator iH_end=iS->recHits().second; //loop seed rechits, copy over and rekey. for (;iH!=iH_end;++iH){ newRecHitContainer.push_back(*iH); refSetter.reKey(&newRecHitContainer.back()); } result->push_back(TrajectorySeed(iS->startingState(), std::move(newRecHitContainer), iS->direction())); } }else{ //just insert the new seeds as they are result->insert(result->end(), collection->begin(), collection->end()); } } // Save result into the event ev.put(result); }
std::vector<edm::InputTag> SeedCombiner::clusterRemovalInfos_ [private] |
Definition at line 24 of file SeedCombiner.h.
Referenced by produce(), and SeedCombiner().
std::vector<edm::InputTag> SeedCombiner::inputCollections_ [private] |
Definition at line 22 of file SeedCombiner.h.
Referenced by produce(), and SeedCombiner().
bool SeedCombiner::reKeing_ [private] |
Definition at line 23 of file SeedCombiner.h.
Referenced by produce(), and SeedCombiner().