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
QuadrupletSeedMergertheMerger_
TrackingRegionProducertheRegionProducer
bool theSilentOnClusterCheck

Detailed Description

Definition at line 14 of file SeedGeneratorFromRegionHitsEDProducer.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file SeedGeneratorFromRegionHitsEDProducer.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, theConfig, theMerger_, and theSilentOnClusterCheck.

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

  // seed merger & its settings
  if ( cfg.exists("SeedMergerPSet")) {
    edm::ParameterSet mergerPSet = theConfig.getParameter<edm::ParameterSet>( "SeedMergerPSet" );
    theMerger_=new QuadrupletSeedMerger();
    theMerger_->setTTRHBuilderLabel( mergerPSet.getParameter<std::string>( "ttrhBuilderLabel" ) );
    theMerger_->setMergeTriplets( mergerPSet.getParameter<bool>( "mergeTriplets" ) );
    theMerger_->setAddRemainingTriplets( mergerPSet.getParameter<bool>( "addRemainingTriplets" ) );
    theMerger_->setLayerListName( mergerPSet.getParameter<std::string>( "layerListName" ) );
  }

  produces<TrajectorySeedCollection>();
}
SeedGeneratorFromRegionHitsEDProducer::~SeedGeneratorFromRegionHitsEDProducer ( )

Definition at line 45 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 54 of file SeedGeneratorFromRegionHitsEDProducer.cc.

References reco::get(), edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, 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 49 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 82 of file SeedGeneratorFromRegionHitsEDProducer.cc.

References QuadrupletSeedMerger::mergeTriplets(), edm::Event::put(), TrackingRegionProducer::regions(), SeedGeneratorFromRegionHits::run(), theClusterCheck, theConfig, theGenerator, theMerger_, theRegionProducer, theSilentOnClusterCheck, ClusterChecker::tooManyClusters(), and QuadrupletSeedMerger::update().

{
  std::auto_ptr<TrajectorySeedCollection> triplets(new TrajectorySeedCollection());
  std::auto_ptr<TrajectorySeedCollection> quadruplets( 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(triplets);
    return ;
  }

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

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

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

    // make quadruplets
    // (TODO: can partly be propagated to the merger)
    if ( theMerger_ !=0 ) {
      TrajectorySeedCollection const& tempQuads = theMerger_->mergeTriplets( *triplets, region, es, theConfig ); //@@
      for( TrajectorySeedCollection::const_iterator qIt = tempQuads.begin(); qIt < tempQuads.end(); ++qIt ) {
        quadruplets->push_back( *qIt );
      }
    }
  }
 
  // clear memory
  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) delete (*ir);

  // put to event
  if ( theMerger_!=0)
    ev.put(quadruplets);
  else
    ev.put(triplets);
}

Member Data Documentation

Definition at line 29 of file SeedGeneratorFromRegionHitsEDProducer.h.

Referenced by produce().

Definition at line 27 of file SeedGeneratorFromRegionHitsEDProducer.h.

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

Definition at line 28 of file SeedGeneratorFromRegionHitsEDProducer.h.

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