CMS 3D CMS Logo

Public Member Functions | Private Attributes

SeedCombiner Class Reference

#include <SeedCombiner.h>

Inheritance diagram for SeedCombiner:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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::InputTagclusterRemovalInfos_
std::vector< edm::InputTaginputCollections_
bool reKeing_

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

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

{
}

Member Function Documentation

void SeedCombiner::beginRun ( edm::Run run,
const edm::EventSetup es 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 47 of file SeedCombiner.cc.

{
}
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);
}

Member Data Documentation

Definition at line 24 of file SeedCombiner.h.

Referenced by produce(), and SeedCombiner().

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().