CMS 3D CMS Logo

Public Member Functions | Private Attributes

SeedGeneratorFromRegionHitsEDProducer Class Reference

#include <SeedGeneratorFromRegionHitsEDProducer.h>

Inheritance diagram for SeedGeneratorFromRegionHitsEDProducer:
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 endRun (edm::Run &run, const edm::EventSetup &es)
virtual void produce (edm::Event &ev, const edm::EventSetup &es)
 SeedGeneratorFromRegionHitsEDProducer (const edm::ParameterSet &cfg)
 ~SeedGeneratorFromRegionHitsEDProducer ()

Private Attributes

ClusterChecker theClusterCheck
edm::ParameterSet theConfig
SeedGeneratorFromRegionHitstheGenerator
TrackingRegionProducertheRegionProducer
bool theSilentOnClusterCheck

Detailed Description

Definition at line 13 of file SeedGeneratorFromRegionHitsEDProducer.h.


Constructor & Destructor Documentation

SeedGeneratorFromRegionHitsEDProducer::SeedGeneratorFromRegionHitsEDProducer ( const edm::ParameterSet cfg)

Definition at line 24 of file SeedGeneratorFromRegionHitsEDProducer.cc.

References edm::ParameterSet::getParameter(), and theSilentOnClusterCheck.

  : theConfig(cfg), theGenerator(0), theRegionProducer(0), theClusterCheck(cfg.getParameter<edm::ParameterSet>("ClusterCheckPSet"))
{
  theSilentOnClusterCheck = cfg.getParameter<edm::ParameterSet>("ClusterCheckPSet").getUntrackedParameter<bool>("silentClusterCheck",false);
  produces<TrajectorySeedCollection>();
}
SeedGeneratorFromRegionHitsEDProducer::~SeedGeneratorFromRegionHitsEDProducer ( )

Definition at line 32 of file SeedGeneratorFromRegionHitsEDProducer.cc.

{
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 41 of file SeedGeneratorFromRegionHitsEDProducer.cc.

References reco::get(), edm::ParameterSet::getParameter(), theConfig, theGenerator, and theRegionProducer.

{
  edm::ParameterSet regfactoryPSet = 
      theConfig.getParameter<edm::ParameterSet>("RegionFactoryPSet");
  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
  theRegionProducer = TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet);

  edm::ParameterSet hitsfactoryPSet = 
      theConfig.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
  std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");
  OrderedHitsGenerator*  hitsGenerator = 
      OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet);

  edm::ParameterSet comparitorPSet =
      theConfig.getParameter<edm::ParameterSet>("SeedComparitorPSet");
  std::string comparitorName = comparitorPSet.getParameter<std::string>("ComponentName");
  SeedComparitor * aComparitor = (comparitorName == "none") ? 
      0 :  SeedComparitorFactory::get()->create( comparitorName, comparitorPSet);   

  edm::ParameterSet creatorPSet =
      theConfig.getParameter<edm::ParameterSet>("SeedCreatorPSet");
  std::string creatorName = creatorPSet.getParameter<std::string>("ComponentName");
  SeedCreator * aCreator = SeedCreatorFactory::get()->create( creatorName, creatorPSet);

  theGenerator = new SeedGeneratorFromRegionHits(hitsGenerator, aComparitor, aCreator); 
  
  
}
void SeedGeneratorFromRegionHitsEDProducer::endRun ( edm::Run run,
const edm::EventSetup es 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 36 of file SeedGeneratorFromRegionHitsEDProducer.cc.

References theGenerator, and theRegionProducer.

                                                                                       {
  delete theRegionProducer;
  delete theGenerator;
}
void SeedGeneratorFromRegionHitsEDProducer::produce ( edm::Event ev,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 70 of file SeedGeneratorFromRegionHitsEDProducer.cc.

References edm::Event::put(), TrackingRegionProducer::regions(), query::result, SeedGeneratorFromRegionHits::run(), theClusterCheck, theGenerator, theRegionProducer, theSilentOnClusterCheck, and ClusterChecker::tooManyClusters().

{
  std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection());

  //protection for big ass events...
  size_t clustsOrZero = theClusterCheck.tooManyClusters(ev);
  if (clustsOrZero){
    if (!theSilentOnClusterCheck)
        edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
    ev.put(result);
    return ;
  }

  typedef std::vector<TrackingRegion* > Regions;
  typedef Regions::const_iterator IR;
  Regions regions = theRegionProducer->regions(ev,es);

  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) {
    const TrackingRegion & region = **ir;

    // make job
    theGenerator->run(*result, region, ev,es);
  }

  // clear memory
  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) delete (*ir);

  // put to event
  ev.put(result);
}

Member Data Documentation

Definition at line 28 of file SeedGeneratorFromRegionHitsEDProducer.h.

Referenced by produce().

Definition at line 25 of file SeedGeneratorFromRegionHitsEDProducer.h.

Referenced by beginRun().

Definition at line 26 of file SeedGeneratorFromRegionHitsEDProducer.h.

Referenced by beginRun(), endRun(), and produce().

Definition at line 27 of file SeedGeneratorFromRegionHitsEDProducer.h.

Referenced by beginRun(), endRun(), and produce().