CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
NuclearSeedsEDProducer.cc
Go to the documentation of this file.
3 
6 
9 
10 using namespace edm;
11 using namespace std;
12 using namespace reco;
13 
14 
15 //
16 // constructors and destructor
17 //
19 improveSeeds(iConfig.getParameter<bool>("improveSeeds")),
20 producer_(iConfig.getParameter<std::string>("producer"))
21 {
22  produces<TrajectorySeedCollection>();
23  produces<TrajectoryToSeedsMap>();
24 
25 
26 }
27 
28 
30 {
31 }
32 
33 
34 //
35 // member functions
36 //
37 
38 // ------------ method called to produce the data ------------
39 void
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 
54  iEvent.getByLabel(edm::InputTag("MeasurementTrackerEvent"), data);
55 
56 // NavigationSetter setter( *(theNuclearInteractionFinder->nav()) ); why???
57 
58  std::vector<std::pair<int, int> > assocPair;
59  int i=0;
60 
61  for(std::vector<Trajectory>::const_iterator iTraj = m_TrajectoryCollection->begin(); iTraj != m_TrajectoryCollection->end(); iTraj++,i++) {
62 
63  // run the finder
64  theNuclearInteractionFinder->run( *iTraj, *data );
65 
66  // improve seeds
67  if( improveSeeds == true ) theNuclearInteractionFinder->improveSeeds( *data );
68 
69  // push back the new persistent seeds in output
70  std::auto_ptr<TrajectorySeedCollection> newSeeds(theNuclearInteractionFinder->getPersistentSeeds());
71  output->insert(output->end(), newSeeds->begin(), newSeeds->end());
72 
73  // fill the id of the Trajectory and the if of the seed in assocPair
74  for(unsigned int j=0; j<newSeeds->size(); j++) {
75  assocPair.push_back( std::make_pair( i, output->size()-newSeeds->size()+j ) );
76  }
77 
78  }
79 
80  const edm::OrphanHandle<TrajectorySeedCollection> refprodTrajSeedColl = iEvent.put(output);
81 
82  for(std::vector<std::pair<int, int> >::const_iterator iVecP = assocPair.begin(); iVecP != assocPair.end(); iVecP++) {
83  outAssoc->insert(edm::Ref<TrajectoryCollection>(m_TrajectoryCollection,iVecP->first), edm::Ref<TrajectorySeedCollection>(refprodTrajSeedColl, iVecP->second));
84  }
85  iEvent.put(outAssoc);
86 
87 }
88 
89 // ------------ method called once each job just before starting event loop ------------
90 void
92 {
93  theNuclearInteractionFinder = std::auto_ptr<NuclearInteractionFinder>(new NuclearInteractionFinder(es, conf_));
94 
95 }
96 
98 
99 
#define LogDebug(id)
NuclearSeedsEDProducer(const edm::ParameterSet &)
int i
Definition: DBlmapReader.cc:9
virtual void beginRun(edm::Run const &run, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
Class used to obtain vector of all compatible TMs associated to a trajectory to be used by the Nuclea...
std::auto_ptr< NuclearInteractionFinder > theNuclearInteractionFinder
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition: Run.h:41