6 #include "HepPDT/ParticleID.hh" 10 #define update(a, b) \ 20 quality_(
config, collector),
22 particleDataTableToken_(collector.
esConsumes()),
161 const SimTrack *assocTrack = &(*tpr->g4Track_begin());
164 GlobalPoint(tpr->vertex().x(), tpr->vertex().y(), tpr->vertex().z()),
179 double dxySim = -
v.x() *
sin(
p.phi()) +
v.y() *
cos(
p.phi());
182 double dzSim =
v.z() - (
v.x() *
p.x() +
v.y() *
p.y()) *
p.z() /
p.perp2();
224 for (
unsigned int j = 0;
j <
layer.hits.size();
j++) {
245 flags_[
Light] = !pid.hasCharm() && !pid.hasBottom();
259 for (TrackHistory::RecoGenParticleTrail::const_iterator iparticle = recoGenParticleTrail.begin();
260 iparticle != recoGenParticleTrail.end();
279 std::set<int> daughterIds;
280 size_t ndau = (*iparticle)->numberOfDaughters();
281 for (
size_t i = 0;
i < ndau; ++
i) {
282 daughterIds.insert((*iparticle)->daughter(
i)->pdgId());
309 for (TrackHistory::SimParticleTrail::const_iterator iparticle = simParticleTrail.begin();
310 iparticle != simParticleTrail.end();
324 for (its = parentVertex->sourceTracks_begin(); its != parentVertex->sourceTracks_end(); ++its) {
325 for (itd = parentVertex->daughterTracks_begin(); itd != parentVertex->daughterTracks_end(); ++itd)
335 if (its != parentVertex->sourceTracks_end())
341 unsigned int processG4 = 0;
344 if (parentVertex->nG4Vertices() > 0) {
345 processG4 = (*(parentVertex->g4Vertices_begin())).processType();
391 int daughtId =
abs((*iparticle)->pdgId());
426 double const mm = 0.1;
428 double oldX = genpv.
x;
429 double oldY = genpv.
y;
430 double oldZ = genpv.
z;
433 for (TrackHistory::GenParticleTrail::const_reverse_iterator iparticle = genParticleTrail.rbegin();
434 iparticle != genParticleTrail.rend();
437 HepMC::GenVertex *
parent = (*iparticle)->production_vertex();
439 HepMC::ThreeVector
p =
parent->point3d();
441 double distance2 =
pow(
p.x() * mm - genpv.
x, 2) +
pow(
p.y() * mm - genpv.
y, 2) +
pow(
p.z() * mm - genpv.
z, 2);
442 double difference2 =
pow(
p.x() * mm - oldX, 2) +
pow(
p.y() * mm - oldY, 2) +
pow(
p.z() * mm - oldZ, 2);
461 for (TrackHistory::SimParticleTrail::const_reverse_iterator iparticle = simParticleTrail.rbegin();
462 iparticle != simParticleTrail.rend();
467 double distance2 =
pow(
p.x() - genpv.
x, 2) +
pow(
p.y() - genpv.
y, 2) +
pow(
p.z() - genpv.
z, 2);
468 double difference2 =
pow(
p.x() - oldX, 2) +
pow(
p.y() - oldY, 2) +
pow(
p.z() - oldZ, 2);
496 return part->charge() != 0;
510 for (HepMC::GenEvent::vertex_const_iterator ivertex =
event->vertices_begin(); ivertex !=
event->vertices_end();
512 bool hasParentVertex =
false;
516 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
519 if ((*iparent)->production_vertex()) {
520 hasParentVertex =
true;
529 HepMC::FourVector
pos = (*ivertex)->position();
531 double const mm = 0.1;
535 std::vector<GeneratedPrimaryVertex>::iterator ientry =
genpvs_.begin();
538 for (; ientry !=
genpvs_.end(); ++ientry) {
539 double distance2 =
pow(
pv.x - ientry->x, 2) +
pow(
pv.y - ientry->y, 2) +
pow(
pv.z - ientry->z, 2);
549 ientry->genVertex.push_back((*ivertex)->barcode());
552 for (HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
553 idecendants != (*ivertex)->particles_end(HepMC::descendants);
556 if (
find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) ==
557 ientry->finalstateParticles.end()) {
558 ientry->finalstateParticles.push_back((*idecendants)->barcode());
559 HepMC::FourVector
m = (*idecendants)->momentum();
561 ientry->ptot.setPx(ientry->ptot.px() +
m.px());
562 ientry->ptot.setPy(ientry->ptot.py() +
m.py());
563 ientry->ptot.setPz(ientry->ptot.pz() +
m.pz());
564 ientry->ptot.setE(ientry->ptot.e() +
m.e());
565 ientry->ptsq +=
m.perp() *
m.perp();
const edm::InputTag beamSpotLabel_
const edm::InputTag hepMCLabel_
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
int event() const
get the contents of the subdetector field (should be protected?)
bool isNonnull() const
Checks for non-null.
const G4toCMSLegacyProcTypeMap g4toCMSProcMap_
constexpr uint32_t maxLayers
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
edm::Handle< edm::HepMCProduct > mcInformation_
const TrackerTopology * tTopo_
bool isNonnull() const
Checks for non-null.
unsigned int numberOfInnerLayers_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
unsigned int minTrackerSimHits_
std::vector< GeneratedPrimaryVertex > genpvs_
const math::XYZTLorentzVectorD & momentum() const
void processesAtSimulation()
Get information about conversion and other interactions.
std::vector< const HepMC::GenParticle * > GenParticleTrail
HepMC::GenParticle trail type.
int pdgId() const final
PDG identifier.
GlobalPoint position() const
math::XYZPointD Point
point in the space
void simulationInformation()
Get all the information related to the simulation details.
double x0() const
x coordinate
edm::ESGetToken< ParticleDataTable, PDTRecord > particleDataTableToken_
std::vector< const reco::GenParticle * > RecoGenParticleTrail
reco::GenParticle trail type.
void qualityInformation(reco::TrackBaseRef const &)
Classify all the tracks by their reconstruction quality.
void reconstructionInformation(reco::TrackBaseRef const &)
const unsigned int processId(unsigned int g4ProcessId) const
T const * product() const
TrackClassifier(edm::ParameterSet const &, edm::ConsumesCollector &&)
Constructor by ParameterSet.
bool isCharged(const HepMC::GenParticle *)
edm::ESHandle< TransientTrackBuilder > transientTrackBuilder_
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackBuilderToken_
void evaluate(SimParticleTrail const &, reco::TrackBaseRef const &, const TrackerTopology *tTopo)
Compute information about the track reconstruction quality.
Auxiliary class holding simulated primary vertices.
int bunchCrossing() const
get the detector field from this detid
Cos< T >::type cos(const T &t)
GlobalVector momentum() const
Abs< T >::type abs(const T &t)
double y0() const
y coordinate
math::XYZPoint Point
point in the space
void hadronFlavor()
Get hadron flavor of the initial hadron.
unsigned int numberOfLayers() const
Return the number of layers with simulated and/or reconstructed hits.
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
edm::Handle< reco::BeamSpot > beamSpot_
HepPDT::ParticleData ParticleData
const HepMC::GenEvent * GetEvent() const
Get track history and classify it in function of their .
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
GenParticleTrail const & genParticleTrail() const
Return all generated particle (HepMC::GenParticle) in the history.
bool isFinalstateParticle(const HepMC::GenParticle *)
const FreeTrajectoryState & theState() const
const Layer & layer(unsigned int index) const
Return information about the given layer by index.
void vertexInformation()
Get geometrical information about the vertices.
double z0() const
z coordinate
void processesAtGenerator()
Get all the information related to decay process.
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoHandToken_
void depth(int d)
Set the depth of the history.
edm::ESHandle< MagneticField > magneticField_
Flags flags_
Flag containers.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
RecoGenParticleTrail const & recoGenParticleTrail() const
Return all reco::GenParticle in the history.
const TrackingParticleRef & simParticle() const
Return the initial tracking particle from the history.
double longLivedDecayLength_
void reset()
Reset the categories flags.
double vertexClusteringSqDistance_
const reco::TrackBaseRef & recoTrack() const
Return a reference to the reconstructed track.
edm::ESHandle< ParticleDataTable > particleDataTable_
const reco::GenParticle * recoGenParticle() const
Power< A, B >::type pow(const A &a, const B &b)
void genPrimaryVertices()
Global3DVector GlobalVector
std::vector< TrackingParticleRef > SimParticleTrail
SimParticle trail type.