CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

NuclearSeedsEDProducer Class Reference

#include <RecoTracker/NuclearSeedGenerator/interface/NuclearSeedsEDProducer.h>

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

List of all members.

Public Member Functions

 NuclearSeedsEDProducer (const edm::ParameterSet &)
 ~NuclearSeedsEDProducer ()

Private Member Functions

virtual void beginRun (edm::Run &run, const edm::EventSetup &)
virtual void endJob ()
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

edm::ParameterSet conf_
bool improveSeeds
std::string producer_
std::auto_ptr
< NuclearInteractionFinder
theNuclearInteractionFinder

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 50 of file NuclearSeedsEDProducer.h.


Constructor & Destructor Documentation

NuclearSeedsEDProducer::NuclearSeedsEDProducer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 18 of file NuclearSeedsEDProducer.cc.

                                                                             : conf_(iConfig),
improveSeeds(iConfig.getParameter<bool>("improveSeeds")),
producer_(iConfig.getParameter<std::string>("producer"))
{
   produces<TrajectorySeedCollection>();
   produces<TrajectoryToSeedsMap>();


}
NuclearSeedsEDProducer::~NuclearSeedsEDProducer ( )

Definition at line 29 of file NuclearSeedsEDProducer.cc.

{
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 89 of file NuclearSeedsEDProducer.cc.

References conf_, and theNuclearInteractionFinder.

{
   theNuclearInteractionFinder = std::auto_ptr<NuclearInteractionFinder>(new NuclearInteractionFinder(es, conf_));

}
void NuclearSeedsEDProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 95 of file NuclearSeedsEDProducer.cc.

{}
void NuclearSeedsEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 40 of file NuclearSeedsEDProducer.cc.

References edm::Event::getByLabel(), i, improveSeeds, j, LogDebug, convertSQLitetoXML_cfg::output, producer_, edm::Event::put(), and theNuclearInteractionFinder.

{
   typedef TrajectoryMeasurement TM;

   edm::Handle< TrajectoryCollection > m_TrajectoryCollection;
   iEvent.getByLabel( producer_, m_TrajectoryCollection );

   LogDebug("NuclearSeedGenerator") << "Number of trajectory in event :" << m_TrajectoryCollection->size() << "\n";

   std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection);
   std::auto_ptr<TrajectoryToSeedsMap> outAssoc(new TrajectoryToSeedsMap);

   // Update the measurement
   theNuclearInteractionFinder->setEvent(iEvent);
   NavigationSetter setter( *(theNuclearInteractionFinder->nav()) );

   std::vector<std::pair<int, int> > assocPair;
   int i=0;

   for(std::vector<Trajectory>::const_iterator iTraj = m_TrajectoryCollection->begin(); iTraj != m_TrajectoryCollection->end(); iTraj++,i++) {

         // run the finder
         theNuclearInteractionFinder->run( *iTraj );

         // improve seeds
         if( improveSeeds == true ) theNuclearInteractionFinder->improveSeeds();

         // push back the new persistent seeds in output
         std::auto_ptr<TrajectorySeedCollection> newSeeds(theNuclearInteractionFinder->getPersistentSeeds());
         output->insert(output->end(), newSeeds->begin(), newSeeds->end());

         // fill the id of the Trajectory and the if of the seed in assocPair
         for(unsigned int j=0; j<newSeeds->size(); j++) {
                  assocPair.push_back( std::make_pair( i, output->size()-newSeeds->size()+j ) );
         }

   }

   const edm::OrphanHandle<TrajectorySeedCollection> refprodTrajSeedColl = iEvent.put(output);

   for(std::vector<std::pair<int, int> >::const_iterator iVecP = assocPair.begin(); iVecP != assocPair.end(); iVecP++) {
        outAssoc->insert(edm::Ref<TrajectoryCollection>(m_TrajectoryCollection,iVecP->first), edm::Ref<TrajectorySeedCollection>(refprodTrajSeedColl, iVecP->second));
   }
   iEvent.put(outAssoc);

}

Member Data Documentation

Definition at line 62 of file NuclearSeedsEDProducer.h.

Referenced by beginRun().

Definition at line 65 of file NuclearSeedsEDProducer.h.

Referenced by produce().

std::string NuclearSeedsEDProducer::producer_ [private]

Definition at line 66 of file NuclearSeedsEDProducer.h.

Referenced by produce().

Definition at line 63 of file NuclearSeedsEDProducer.h.

Referenced by beginRun(), and produce().