Definition at line 173 of file PFSimParticleProducer.cc.
180 LogDebug(
"PFSimParticleProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run()
187 std::vector<unsigned> recTrackSimID;
193 typedef std::pair<double, unsigned> hitSimID;
194 std::vector<std::list<hitSimID> > caloHitsEBID(62000);
195 std::vector<double> caloHitsEBTotE(62000, 0.0);
203 err <<
"could not find pcaloHit "
204 <<
"fastSimProducer:EcalHitsEB";
205 LogError(
"PFSimParticleProducer") <<
err.str() << endl;
209 assert(pcalohits.isValid());
211 edm::PCaloHitContainer::const_iterator it = pcalohits.product()->begin();
212 edm::PCaloHitContainer::const_iterator itend = pcalohits.product()->end();
215 for (; it != itend; ++it) {
218 if (it->energy() > 0.0) {
219 std::pair<double, unsigned> phitsimid = make_pair(it->energy(), it->geantTrackId());
220 caloHitsEBID[detid.hashedIndex()].push_back(phitsimid);
221 caloHitsEBTotE[detid.hashedIndex()] += it->energy();
231 LogDebug(
"PFSimParticleProducer") <<
"getting PFRecTracks" << endl;
235 LogError(
"PFSimParticleProducer") <<
err <<
" cannot get collection "
236 <<
"particleFlowBlock"
249 auto pOutputPFSimParticleCollection = std::make_unique<reco::PFSimParticleCollection>();
256 LogError(
"PFSimParticleProducer") <<
err.str() << endl;
284 unsigned recTrackID = 99999;
285 vector<unsigned> recHitContrib;
286 vector<double> recHitContribFrac;
290 for (
unsigned lo = 0; lo < recTrackSimID.size(); lo++) {
291 if (
i == recTrackSimID[lo]) {
302 LogError(
"PFSimParticleProducer") <<
err.str() << endl;
311 for (; it_rh != itend_rh; ++it_rh) {
315 auto it_phit = caloHitsEBID[rhit_hi].begin();
316 auto itend_phit = caloHitsEBID[rhit_hi].end();
317 for (; it_phit != itend_phit; ++it_phit) {
318 if (
i == it_phit->second) {
321 bool alreadyin =
false;
322 for (
unsigned ihit = 0; ihit < recHitContrib.size(); ++ihit)
323 if (detid.rawId() == recHitContrib[ihit])
327 double pcalofraction = 0.0;
328 if (caloHitsEBTotE[rhit_hi] != 0.0)
329 pcalofraction = (it_phit->first / caloHitsEBTotE[rhit_hi]) * 100.0;
332 recHitContrib.push_back(it_rh->id());
333 recHitContribFrac.push_back(pcalofraction);
349 math::XYZPoint posOrig(originVtx.position().x(), originVtx.position().y(), originVtx.position().z());
356 particle.addPoint(pointOrig);
367 particle.addPoint(pointEnd);
370 particle.addPoint(
dummy);
380 particle.addPoint(layer1Pt);
385 particle.addPoint(
dummy);
395 particle.addPoint(layer2Pt);
400 particle.addPoint(
dummy);
410 particle.addPoint(ecalPt);
415 particle.addPoint(
dummy);
420 particle.addPoint(
dummy);
429 particle.addPoint(hcalPtin);
437 particle.addPoint(hcalPtout);
445 particle.addPoint(hoPtin);
449 particle.addPoint(
dummy);
452 pOutputPFSimParticleCollection->push_back(particle);
458 LogDebug(
"PFSimParticleProducer") <<
"STOP event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run() << endl;
References cms::cuda::assert(), reco::PFTrajectoryPoint::BeamPipeOrEndVertex, edm::SortedCollection< T, SORT >::begin(), FSimTrack::charge(), reco::PFTrajectoryPoint::ClosestApproach, FSimTrack::daughters(), RawParticle::e(), reco::PFTrajectoryPoint::ECALEntrance, FSimTrack::ecalEntrance(), edm::SortedCollection< T, SORT >::end(), FSimTrack::endVertex(), submitPVResolutionJobs::err, Exception, newFWLiteAna::found, edm::EventSetup::getData(), ecalpyutils::hashedIndex(), reco::PFTrajectoryPoint::HCALEntrance, FSimTrack::hcalEntrance(), reco::PFTrajectoryPoint::HCALExit, FSimTrack::hcalExit(), FSimTrack::hoEntrance(), reco::PFTrajectoryPoint::HOLayer, mps_fire::i, FSimTrack::id(), iEvent, edm::HandleBase::isValid(), FSimTrack::layer1Entrance(), FSimTrack::layer2Entrance(), LogDebug, FSimTrack::momentum(), FSimTrack::mother(), objects.autophobj::motherId, eostools::move(), FSimTrack::noEndVertex(), FSimTrack::noMother(), FSimTrack::onEcal(), FSimTrack::onHcal(), FSimTrack::onLayer1(), FSimTrack::onLayer2(), FSimVertex::position(), edm::Handle< T >::product(), reco::PFTrajectoryPoint::PS1, reco::PFTrajectoryPoint::PS2, RawParticle::px(), RawParticle::py(), RawParticle::pz(), hiRegitInitialStep_cff::recTracks, TrackCandidateProducer_cfi::simTracks, HGCalValidator_cfi::simVertices, CoreSimTrack::type(), FSimTrack::vertex(), RawParticle::x(), RawParticle::y(), and RawParticle::z().