CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

 NuclearSeedsEDProducer (const edm::ParameterSet &)
 
 ~NuclearSeedsEDProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.

18  : conf_(iConfig),
19 improveSeeds(iConfig.getParameter<bool>("improveSeeds")),
20 producer_(iConfig.getParameter<std::string>("producer"))
21 {
22  produces<TrajectorySeedCollection>();
23  produces<TrajectoryToSeedsMap>();
24 
25 
26 }
T getParameter(std::string const &) const
NuclearSeedsEDProducer::~NuclearSeedsEDProducer ( )

Definition at line 29 of file NuclearSeedsEDProducer.cc.

30 {
31 }

Member Function Documentation

void NuclearSeedsEDProducer::beginRun ( edm::Run run,
const edm::EventSetup es 
)
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 89 of file NuclearSeedsEDProducer.cc.

References conf_, and theNuclearInteractionFinder.

90 {
91  theNuclearInteractionFinder = std::auto_ptr<NuclearInteractionFinder>(new NuclearInteractionFinder(es, conf_));
92 
93 }
Class used to obtain vector of all compatible TMs associated to a trajectory to be used by the Nuclea...
std::auto_ptr< NuclearInteractionFinder > theNuclearInteractionFinder
void NuclearSeedsEDProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 95 of file NuclearSeedsEDProducer.cc.

95 {}
void NuclearSeedsEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

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.

41 {
42  typedef TrajectoryMeasurement TM;
43 
44  edm::Handle< TrajectoryCollection > m_TrajectoryCollection;
45  iEvent.getByLabel( producer_, m_TrajectoryCollection );
46 
47  LogDebug("NuclearSeedGenerator") << "Number of trajectory in event :" << m_TrajectoryCollection->size() << "\n";
48 
49  std::auto_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection);
50  std::auto_ptr<TrajectoryToSeedsMap> outAssoc(new TrajectoryToSeedsMap);
51 
52  // Update the measurement
53  theNuclearInteractionFinder->setEvent(iEvent);
55 
56  std::vector<std::pair<int, int> > assocPair;
57  int i=0;
58 
59  for(std::vector<Trajectory>::const_iterator iTraj = m_TrajectoryCollection->begin(); iTraj != m_TrajectoryCollection->end(); iTraj++,i++) {
60 
61  // run the finder
62  theNuclearInteractionFinder->run( *iTraj );
63 
64  // improve seeds
65  if( improveSeeds == true ) theNuclearInteractionFinder->improveSeeds();
66 
67  // push back the new persistent seeds in output
68  std::auto_ptr<TrajectorySeedCollection> newSeeds(theNuclearInteractionFinder->getPersistentSeeds());
69  output->insert(output->end(), newSeeds->begin(), newSeeds->end());
70 
71  // fill the id of the Trajectory and the if of the seed in assocPair
72  for(unsigned int j=0; j<newSeeds->size(); j++) {
73  assocPair.push_back( std::make_pair( i, output->size()-newSeeds->size()+j ) );
74  }
75 
76  }
77 
78  const edm::OrphanHandle<TrajectorySeedCollection> refprodTrajSeedColl = iEvent.put(output);
79 
80  for(std::vector<std::pair<int, int> >::const_iterator iVecP = assocPair.begin(); iVecP != assocPair.end(); iVecP++) {
81  outAssoc->insert(edm::Ref<TrajectoryCollection>(m_TrajectoryCollection,iVecP->first), edm::Ref<TrajectorySeedCollection>(refprodTrajSeedColl, iVecP->second));
82  }
83  iEvent.put(outAssoc);
84 
85 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::auto_ptr< NuclearInteractionFinder > theNuclearInteractionFinder

Member Data Documentation

edm::ParameterSet NuclearSeedsEDProducer::conf_
private

Definition at line 62 of file NuclearSeedsEDProducer.h.

Referenced by beginRun().

bool NuclearSeedsEDProducer::improveSeeds
private

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

std::auto_ptr<NuclearInteractionFinder> NuclearSeedsEDProducer::theNuclearInteractionFinder
private

Definition at line 63 of file NuclearSeedsEDProducer.h.

Referenced by beginRun(), and produce().