9 #include "HepPDT/ParticleID.hh" 13 #define update(a, b) \ 20 tracer_(config,
std::
move(collector)),
21 hepMCLabel_(config.getUntrackedParameter<
edm::
InputTag>(
"hepMC")) {
116 for (VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin(); ivertex != genVertexTrail.end();
120 HepMC::GenVertex *
vertex =
const_cast<HepMC::GenVertex *
>(*ivertex);
123 for (HepMC::GenVertex::particle_iterator iparent = vertex->particles_begin(
HepMC::parents);
132 if (particleID.isValid()) {
162 for (VertexHistory::SimVertexTrail::const_iterator ivertex = simVertexTrail.begin(); ivertex != simVertexTrail.end();
171 for (its = (*ivertex)->sourceTracks_begin(); its != (*ivertex)->sourceTracks_end(); ++its) {
172 for (itd = (*ivertex)->daughterTracks_begin(); itd != (*ivertex)->daughterTracks_end(); ++itd)
181 if (its != (*ivertex)->sourceTracks_end())
188 unsigned int processG4 = 0;
190 if ((*ivertex)->nG4Vertices() > 0) {
191 processG4 = (*(*ivertex)->g4Vertices_begin()).processType();
219 iparticle != (*ivertex)->daughterTracks_end();
221 if ((*iparticle)->numberOfTrackerLayers()) {
227 if (particleID.isValid()) {
258 typedef std::multimap<double, HepMC::ThreeVector>
Clusters;
259 typedef std::pair<double, HepMC::ThreeVector> ClusterPair;
270 double const mm = 0.1;
273 for (VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin(); ivertex != genVertexTrail.end();
278 HepMC::ThreeVector
p = (*ivertex)->point3d();
280 sqrt(
pow(p.x() * mm - genpv.
x, 2) +
pow(p.y() * mm - genpv.
y, 2) +
pow(p.z() * mm - genpv.
z, 2));
283 if (clusters.empty()) {
284 clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)));
293 clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)));
297 bool cluster =
false;
302 double difference =
sqrt(
pow(p.x() * mm - icluster->second.x(), 2) +
pow(p.y() * mm - icluster->second.y(), 2) +
303 pow(p.z() * mm - icluster->second.z(), 2));
312 clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x() * mm, p.y() * mm, p.z() * mm)));
319 for (VertexHistory::SimVertexTrail::const_reverse_iterator ivertex = simVertexTrail.rbegin();
320 ivertex != simVertexTrail.rend();
328 if (clusters.empty()) {
329 clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())));
338 clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())));
342 bool cluster =
false;
346 double difference =
sqrt(
pow(p.x() - icluster->second.x(), 2) +
pow(p.y() - icluster->second.y(), 2) +
347 pow(p.z() - icluster->second.z(), 2));
356 clusters.insert(ClusterPair(distance, HepMC::ThreeVector(p.x(), p.y(), p.z())));
359 if (clusters.size() == 1)
361 else if (clusters.size() == 2)
368 return !p->end_vertex() && p->status() == 1;
374 return part->charge() != 0;
390 for (HepMC::GenEvent::vertex_const_iterator ivertex =
event->vertices_begin(); ivertex !=
event->vertices_end();
392 bool hasParentVertex =
false;
396 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
399 if ((*iparent)->production_vertex()) {
400 hasParentVertex =
true;
409 HepMC::FourVector
pos = (*ivertex)->position();
411 double const mm = 0.1;
415 std::vector<GeneratedPrimaryVertex>::iterator ientry =
genpvs_.begin();
418 for (; ientry !=
genpvs_.end(); ++ientry) {
429 ientry->genVertex.push_back((*ivertex)->barcode());
432 for (HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
433 idecendants != (*ivertex)->particles_end(HepMC::descendants);
436 if (
find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) ==
437 ientry->finalstateParticles.end()) {
438 ientry->finalstateParticles.push_back((*idecendants)->barcode());
439 HepMC::FourVector
m = (*idecendants)->momentum();
441 ientry->ptot.setPx(ientry->ptot.px() + m.px());
442 ientry->ptot.setPy(ientry->ptot.py() + m.py());
443 ientry->ptot.setPz(ientry->ptot.pz() + m.pz());
444 ientry->ptot.setE(ientry->ptot.e() + m.e());
445 ientry->ptsq += m.perp() * m.perp();
447 if (m.perp() > 0.8 &&
std::abs(m.pseudoRapidity()) < 2.5 &&
isCharged(*idecendants))
edm::Handle< edm::HepMCProduct > mcInformation_
T getUntrackedParameter(std::string const &, T const &) const
int event() const
get the contents of the subdetector field (should be protected?)
void newEvent(const edm::Event &, const edm::EventSetup &)
Pre-process event information (for accessing reconstruction information)
void vertexInformation()
Get geometrical information about the vertices.
std::vector< GeneratedPrimaryVertex > genpvs_
const edm::InputTag hepMCLabel_
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
bool isCharged(const HepMC::GenParticle *)
Get track history and classify it in function of their .
void reset()
Reset the categories flags.
bool isNonnull() const
Checks for non-null.
const reco::VertexBaseRef & recoVertex() const
Return a reference to the reconstructed track.
bool isFinalstateParticle(const HepMC::GenParticle *)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void genPrimaryVertices()
bool getData(T &iHolder) const
math::XYZTLorentzVectorD LorentzVector
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
Flags flags_
Flag containers.
int bunchCrossing() const
get the detector field from this detid
double longLivedDecayLength_
Abs< T >::type abs(const T &t)
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
edm::ESHandle< ParticleDataTable > particleDataTable_
const G4toCMSLegacyProcTypeMap g4toCMSProcMap_
const unsigned int processId(unsigned int g4ProcessId) const
HepPDT::ParticleData ParticleData
const TrackingVertexRef & simVertex() const
Return the initial tracking vertex from the history.
const HepMC::GenEvent * GetEvent() const
VertexClassifier(edm::ParameterSet const &pset, edm::ConsumesCollector &&)
Constructor by ParameterSet.
void processesAtGenerator()
Get all the information related to decay process.
VertexClassifier const & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
void depth(int d)
Set the depth of the history.
double vertexClusteringDistance_
virtual void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
void processesAtSimulation()
Get information about conversion and other interactions.
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
Auxiliary class holding simulated primary vertices.
Power< A, B >::type pow(const A &a, const B &b)
void simulationInformation()
Get all the information related to the simulation details.