|
|
Producer for PFRecTracks and PFSimParticles.
More...
#include <PFSimParticleProducer.h>
Producer for PFRecTracks and PFSimParticles.
- Author
- Colin Bernet
- Date
- April 2007
Definition at line 40 of file PFSimParticleProducer.h.
◆ TrackHandle
◆ PFSimParticleProducer()
◆ ~PFSimParticleProducer()
PFSimParticleProducer::~PFSimParticleProducer |
( |
| ) |
|
|
override |
◆ getSimIDs()
void PFSimParticleProducer::getSimIDs |
( |
const TrackHandle & |
trackh, |
|
|
std::vector< unsigned > & |
recTrackSimID |
|
) |
| |
Definition at line 395 of file PFSimParticleProducer.cc.
396 if (trackh.isValid()) {
397 for (
unsigned i = 0;
i < trackh->size();
i++) {
400 for (
auto const&
hit : ref->trackRef()->recHits()) {
401 if (
hit->isValid()) {
402 auto rechit = dynamic_cast<const FastTrackerRecHit*>(
hit);
404 for (
unsigned int st_index = 0; st_index < rechit->nSimTrackIds(); ++st_index) {
405 recTrackSimID.push_back(rechit->simTrackId(st_index));
References mps_fire::i, and edm::HandleBase::isValid().
◆ produce()
Definition at line 100 of file PFSimParticleProducer.cc.
107 LogDebug(
"PFSimParticleProducer") <<
"START event: " <<
iEvent.id().event() <<
" in run " <<
iEvent.id().run()
114 std::vector<unsigned> recTrackSimID;
120 typedef std::pair<double, unsigned> hitSimID;
121 typedef std::list<std::pair<double, unsigned> >::iterator ITM;
122 std::vector<std::list<hitSimID> > caloHitsEBID(62000);
123 std::vector<double> caloHitsEBTotE(62000, 0.0);
137 err <<
"could not find pcaloHit "
138 <<
"fastSimProducer:EcalHitsEB";
139 LogError(
"PFSimParticleProducer") <<
err.str() << endl;
145 edm::PCaloHitContainer::const_iterator it = pcalohits.
product()->begin();
146 edm::PCaloHitContainer::const_iterator itend = pcalohits.
product()->end();
149 for (; it != itend; ++it) {
152 if (it->energy() > 0.0) {
153 std::pair<double, unsigned> phitsimid = make_pair(it->energy(), it->geantTrackId());
154 caloHitsEBID[detid.hashedIndex()].push_back(phitsimid);
155 caloHitsEBTotE[detid.hashedIndex()] += it->energy();
165 LogDebug(
"PFSimParticleProducer") <<
"getting PFRecTracks" << endl;
169 LogError(
"PFSimParticleProducer") <<
err <<
" cannot get collection "
170 <<
"particleFlowBlock"
183 auto pOutputPFSimParticleCollection = std::make_unique<reco::PFSimParticleCollection>();
190 LogError(
"PFSimParticleProducer") <<
err.str() << endl;
218 unsigned recTrackID = 99999;
219 vector<unsigned> recHitContrib;
220 vector<double> recHitContribFrac;
224 for (
unsigned lo = 0; lo < recTrackSimID.size(); lo++) {
225 if (
i == recTrackSimID[lo]) {
236 LogError(
"PFSimParticleProducer") <<
err.str() << endl;
245 for (; it_rh != itend_rh; ++it_rh) {
249 ITM it_phit = caloHitsEBID[rhit_hi].begin();
250 ITM itend_phit = caloHitsEBID[rhit_hi].end();
251 for (; it_phit != itend_phit; ++it_phit) {
252 if (
i == it_phit->second) {
255 bool alreadyin =
false;
256 for (
unsigned ihit = 0; ihit < recHitContrib.size(); ++ihit)
257 if (detid.rawId() == recHitContrib[ihit])
261 double pcalofraction = 0.0;
262 if (caloHitsEBTotE[rhit_hi] != 0.0)
263 pcalofraction = (it_phit->first / caloHitsEBTotE[rhit_hi]) * 100.0;
266 recHitContrib.push_back(it_rh->id());
267 recHitContribFrac.push_back(pcalofraction);
283 math::XYZPoint posOrig(originVtx.position().x(), originVtx.position().y(), originVtx.position().z());
290 particle.addPoint(pointOrig);
301 particle.addPoint(pointEnd);
304 particle.addPoint(
dummy);
314 particle.addPoint(layer1Pt);
319 particle.addPoint(
dummy);
329 particle.addPoint(layer2Pt);
334 particle.addPoint(
dummy);
344 particle.addPoint(ecalPt);
349 particle.addPoint(
dummy);
354 particle.addPoint(
dummy);
363 particle.addPoint(hcalPtin);
371 particle.addPoint(hcalPtout);
379 particle.addPoint(hoPtin);
383 particle.addPoint(
dummy);
386 pOutputPFSimParticleCollection->push_back(particle);
392 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(), runTheMatrix::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().
◆ inputTagEcalRecHitsEB_
◆ inputTagEcalRecHitsEE_
◆ inputTagFastSimProducer_
◆ inputTagRecTracks_
◆ inputTagSim_
◆ mctruthMatchingInfo_
bool PFSimParticleProducer::mctruthMatchingInfo_ |
|
private |
◆ mySimEvent
◆ particleFilter_
◆ processParticles_
bool PFSimParticleProducer::processParticles_ |
|
private |
◆ tokenEcalRecHitsEB_
◆ tokenEcalRecHitsEE_
◆ tokenFastSimProducer_
◆ tokenRecTracks_
◆ tokenSim_
◆ tokenSimVertices_
◆ verbose_
bool PFSimParticleProducer::verbose_ |
|
private |
double x() const
x of vertex
float charge() const
charge
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< std::vector< SimTrack > > tokenSim_
T const * product() const
void print() const
print the FBaseSimEvent in an intelligible way
const FSimTrack & mother() const
mother
edm::InputTag inputTagEcalRecHitsEB_
void initializePdt(const HepPDT::ParticleDataTable *aPdt)
Initialize the particle data table.
const RawParticle & hoEntrance() const
The particle at HCAL exir.
const RawParticle & layer1Entrance() const
The particle at Preshower Layer 1.
bool mctruthMatchingInfo_
const FSimVertex & endVertex() const
end vertex
const std::vector< int > & daughters() const
Vector of daughter indices.
T getUntrackedParameter(std::string const &, T const &) const
const RawParticle & layer2Entrance() const
The particle at Preshower Layer 2.
unsigned int nTracks() const
Number of tracks.
edm::EDGetTokenT< EcalRecHitCollection > tokenEcalRecHitsEB_
edm::EDGetTokenT< edm::PCaloHitContainer > tokenFastSimProducer_
edm::EDGetTokenT< std::vector< SimVertex > > tokenSimVertices_
FSimTrack & track(int id) const
Return track with given Id.
double px() const
x of the momentum
double py() const
y of the momentum
edm::InputTag inputTagFastSimProducer_
const_iterator begin() const
const RawParticle & hcalEntrance() const
The particle at HCAL entrance.
true particle for particle flow
const RawParticle & ecalEntrance() const
The particle at ECAL entrance.
double z() const
z of vertex
int id() const
the index in FBaseSimEvent and other vectors
XYZPointD XYZPoint
point in space with cartesian internal representation
const FSimVertex vertex() const
Origin vertex.
double pz() const
z of the momentum
const_iterator end() const
const math::XYZTLorentzVector & position() const
Temporary (until CMSSW moves to Mathcore) - No ! Actually very useful.
edm::InputTag inputTagEcalRecHitsEE_
edm::ParameterSet particleFilter_
void fill(const HepMC::GenEvent &hev, edm::EventID &Id)
fill the FBaseSimEvent from the current HepMC::GenEvent
edm::EDGetTokenT< EcalRecHitCollection > tokenEcalRecHitsEE_
int type() const
particle type (HEP PDT convension)
const XYZTLorentzVector & momentum() const
Temporary (until move of SimTrack to Mathcore) - No! Actually very useful.
edm::InputTag inputTagSim_
module label for retrieving input simtrack and simvertex
const RawParticle & hcalExit() const
The particle at HCAL exir.
bool getData(T &iHolder) const
double y() const
y of vertex
T getParameter(std::string const &) const
bool noEndVertex() const
no end vertex
edm::EDGetTokenT< reco::PFRecTrackCollection > tokenRecTracks_
bool processParticles_
process particles on/off
double e() const
energy of the momentum
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
edm::InputTag inputTagRecTracks_
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
bool noMother() const
no mother particle
void getSimIDs(const TrackHandle &trackh, std::vector< unsigned > &recTrackSimID)
Point of closest approach from beam axis (initial point in the case of PFSimParticle)
int hashedIndex(int ieta, int iphi)