9 #include "HepPDT/ParticleID.hh" 13 #define update(a, b) \ 20 tracer_(
config, collector),
22 particleDataTableToken_(collector.
esConsumes()) {
117 for (VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin(); ivertex != genVertexTrail.end();
121 HepMC::GenVertex *
vertex =
const_cast<HepMC::GenVertex *
>(*ivertex);
163 for (VertexHistory::SimVertexTrail::const_iterator ivertex = simVertexTrail.begin(); ivertex != simVertexTrail.end();
172 for (its = (*ivertex)->sourceTracks_begin(); its != (*ivertex)->sourceTracks_end(); ++its) {
173 for (itd = (*ivertex)->daughterTracks_begin(); itd != (*ivertex)->daughterTracks_end(); ++itd)
182 if (its != (*ivertex)->sourceTracks_end())
189 unsigned int processG4 = 0;
191 if ((*ivertex)->nG4Vertices() > 0) {
192 processG4 = (*(*ivertex)->g4Vertices_begin()).processType();
220 iparticle != (*ivertex)->daughterTracks_end();
222 if ((*iparticle)->numberOfTrackerLayers()) {
259 typedef std::multimap<double, HepMC::ThreeVector>
Clusters;
260 typedef std::pair<double, HepMC::ThreeVector> ClusterPair;
271 double const mm = 0.1;
274 for (VertexHistory::GenVertexTrail::const_iterator ivertex = genVertexTrail.begin(); ivertex != genVertexTrail.end();
279 HepMC::ThreeVector
p = (*ivertex)->point3d();
281 sqrt(
pow(
p.x() * mm - genpv.
x, 2) +
pow(
p.y() * mm - genpv.
y, 2) +
pow(
p.z() * mm - genpv.
z, 2));
285 clusters.insert(ClusterPair(
distance, HepMC::ThreeVector(
p.x() * mm,
p.y() * mm,
p.z() * mm)));
294 clusters.insert(ClusterPair(
distance, HepMC::ThreeVector(
p.x() * mm,
p.y() * mm,
p.z() * mm)));
298 bool cluster =
false;
303 double difference =
sqrt(
pow(
p.x() * mm - icluster->second.x(), 2) +
pow(
p.y() * mm - icluster->second.y(), 2) +
304 pow(
p.z() * mm - icluster->second.z(), 2));
313 clusters.insert(ClusterPair(
distance, HepMC::ThreeVector(
p.x() * mm,
p.y() * mm,
p.z() * mm)));
320 for (VertexHistory::SimVertexTrail::const_reverse_iterator ivertex = simVertexTrail.rbegin();
321 ivertex != simVertexTrail.rend();
343 bool cluster =
false;
347 double difference =
sqrt(
pow(
p.x() - icluster->second.x(), 2) +
pow(
p.y() - icluster->second.y(), 2) +
348 pow(
p.z() - icluster->second.z(), 2));
369 return !
p->end_vertex() &&
p->status() == 1;
375 return part->charge() != 0;
389 for (HepMC::GenEvent::vertex_const_iterator ivertex =
event->vertices_begin(); ivertex !=
event->vertices_end();
391 bool hasParentVertex =
false;
395 for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(
HepMC::parents);
398 if ((*iparent)->production_vertex()) {
399 hasParentVertex =
true;
408 HepMC::FourVector
pos = (*ivertex)->position();
410 double const mm = 0.1;
414 std::vector<GeneratedPrimaryVertex>::iterator ientry =
genpvs_.begin();
417 for (; ientry !=
genpvs_.end(); ++ientry) {
428 ientry->genVertex.push_back((*ivertex)->barcode());
431 for (HepMC::GenVertex::particle_iterator idecendants = (*ivertex)->particles_begin(HepMC::descendants);
432 idecendants != (*ivertex)->particles_end(HepMC::descendants);
435 if (
find(ientry->finalstateParticles.begin(), ientry->finalstateParticles.end(), (*idecendants)->barcode()) ==
436 ientry->finalstateParticles.end()) {
437 ientry->finalstateParticles.push_back((*idecendants)->barcode());
438 HepMC::FourVector
m = (*idecendants)->momentum();
440 ientry->ptot.setPx(ientry->ptot.px() +
m.px());
441 ientry->ptot.setPy(ientry->ptot.py() +
m.py());
442 ientry->ptot.setPz(ientry->ptot.pz() +
m.pz());
443 ientry->ptot.setE(ientry->ptot.e() +
m.e());
444 ientry->ptsq +=
m.perp() *
m.perp();
edm::Handle< edm::HepMCProduct > mcInformation_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< ParticleDataTable, edm::DefaultRecord > particleDataTableToken_
const reco::VertexBaseRef & recoVertex() const
Return a reference to the reconstructed track.
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_
int event() const
get the contents of the subdetector field (should be protected?)
bool isNonnull() const
Checks for non-null.
const edm::InputTag hepMCLabel_
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
bool isCharged(const HepMC::GenParticle *)
Get track history and classify it in function of their .
void reset()
Reset the categories flags.
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
bool isFinalstateParticle(const HepMC::GenParticle *)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
VertexClassifier(edm::ParameterSet const &pset, edm::ConsumesCollector)
Constructor by ParameterSet.
void genPrimaryVertices()
math::XYZTLorentzVectorD LorentzVector
bool evaluate(TrackingVertexRef tvr)
Evaluate track history using a TrackingParticleRef.
const unsigned int processId(unsigned int g4ProcessId) const
Flags flags_
Flag containers.
VertexClassifier const & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
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_
HepPDT::ParticleData ParticleData
const HepMC::GenEvent * GetEvent() const
const TrackingVertexRef & simVertex() const
Return the initial tracking vertex from the history.
void processesAtGenerator()
Get all the information related to decay process.
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.
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.