CMS 3D CMS Logo

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 // constructors and destructor
16 //
18  : conf_(iConfig),
19  improveSeeds(iConfig.getParameter<bool>("improveSeeds")),
20  producer_(consumes<TrajectoryCollection>(iConfig.getParameter<std::string>("producer"))),
21  mteToken_(consumes<MeasurementTrackerEvent>(edm::InputTag("MeasurementTrackerEvents"))) {
22  produces<TrajectorySeedCollection>();
23  produces<TrajectoryToSeedsMap>();
24 }
25 
27 
28 //
29 // member functions
30 //
31 
32 // ------------ method called to produce the data ------------
34  typedef TrajectoryMeasurement TM;
35 
36  edm::Handle<TrajectoryCollection> m_TrajectoryCollection;
37  iEvent.getByToken(producer_, m_TrajectoryCollection);
38 
39  LogDebug("NuclearSeedGenerator") << "Number of trajectory in event :" << m_TrajectoryCollection->size() << "\n";
40 
41  auto output = std::make_unique<TrajectorySeedCollection>();
42  auto outAssoc = std::make_unique<TrajectoryToSeedsMap>();
43 
45  iEvent.getByToken(mteToken_, data);
46 
47  // NavigationSetter setter( *(theNuclearInteractionFinder->nav()) ); why???
48 
49  std::vector<std::pair<int, int> > assocPair;
50  int i = 0;
51 
52  for (std::vector<Trajectory>::const_iterator iTraj = m_TrajectoryCollection->begin();
53  iTraj != m_TrajectoryCollection->end();
54  iTraj++, i++) {
55  // run the finder
56  theNuclearInteractionFinder->run(*iTraj, *data);
57 
58  // improve seeds
59  if (improveSeeds == true)
60  theNuclearInteractionFinder->improveSeeds(*data);
61 
62  // push back the new persistent seeds in output
63  std::unique_ptr<TrajectorySeedCollection> newSeeds(theNuclearInteractionFinder->getPersistentSeeds());
64  output->insert(output->end(), newSeeds->begin(), newSeeds->end());
65 
66  // fill the id of the Trajectory and the if of the seed in assocPair
67  for (unsigned int j = 0; j < newSeeds->size(); j++) {
68  assocPair.push_back(std::make_pair(i, output->size() - newSeeds->size() + j));
69  }
70  }
71 
72  const edm::OrphanHandle<TrajectorySeedCollection> refprodTrajSeedColl = iEvent.put(std::move(output));
73 
74  for (std::vector<std::pair<int, int> >::const_iterator iVecP = assocPair.begin(); iVecP != assocPair.end(); iVecP++) {
75  outAssoc->insert(edm::Ref<TrajectoryCollection>(m_TrajectoryCollection, iVecP->first),
76  edm::Ref<TrajectorySeedCollection>(refprodTrajSeedColl, iVecP->second));
77  }
78  iEvent.put(std::move(outAssoc));
79 }
80 
81 // ------------ method called once each job just before starting event loop ------------
83  theNuclearInteractionFinder = std::make_unique<NuclearInteractionFinder>(es, conf_);
84 }
85 
NuclearSeedsEDProducer::producer_
edm::EDGetTokenT< TrajectoryCollection > producer_
Definition: NuclearSeedsEDProducer.h:64
electrons_cff.bool
bool
Definition: electrons_cff.py:393
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
NuclearSeedsEDProducer
Definition: NuclearSeedsEDProducer.h:50
NuclearInteractionFinder.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::Run
Definition: Run.h:45
TrackBase.h
edm
HLT enums.
Definition: AlignableModifier.h:19
NuclearSeedsEDProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: NuclearSeedsEDProducer.cc:33
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
NuclearSeedsEDProducer::conf_
edm::ParameterSet conf_
Definition: NuclearSeedsEDProducer.h:60
edm::Handle
Definition: AssociativeIterator.h:50
NuclearSeedsEDProducer::mteToken_
edm::EDGetTokenT< MeasurementTrackerEvent > mteToken_
Definition: NuclearSeedsEDProducer.h:65
edm::Ref
Definition: AssociativeIterator.h:58
NuclearSeedsEDProducer::improveSeeds
bool improveSeeds
Definition: NuclearSeedsEDProducer.h:63
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
NuclearSeedsEDProducer::NuclearSeedsEDProducer
NuclearSeedsEDProducer(const edm::ParameterSet &)
Definition: NuclearSeedsEDProducer.cc:17
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
NuclearSeedsEDProducer::theNuclearInteractionFinder
std::unique_ptr< NuclearInteractionFinder > theNuclearInteractionFinder
Definition: NuclearSeedsEDProducer.h:61
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
NuclearSeed_cfi.improveSeeds
improveSeeds
Definition: NuclearSeed_cfi.py:25
iEvent
int iEvent
Definition: GenABIO.cc:224
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:57
InputTag.h
NuclearSeedsEDProducer::beginRun
void beginRun(edm::Run const &run, const edm::EventSetup &) override
Definition: NuclearSeedsEDProducer.cc:82
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::OrphanHandle
Definition: EDProductfwd.h:39
NuclearSeedsEDProducer.h
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
TrajectoryCollection
std::vector< Trajectory > TrajectoryCollection
Definition: TrajectoryToSeedMap.h:17
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
NuclearSeedsEDProducer::~NuclearSeedsEDProducer
~NuclearSeedsEDProducer() override
Definition: NuclearSeedsEDProducer.cc:26
edm::InputTag
Definition: InputTag.h:15
HLTSiStripMonitoring_cff.MeasurementTrackerEvent
MeasurementTrackerEvent
Definition: HLTSiStripMonitoring_cff.py:224