58 HepMC::GenVertex::particles_in_const_iterator,
59 HepMC::GenVertex::particles_out_const_iterator,
60 HepMC::GenVertex::particles_out_const_iterator)
const;
65 vtxToken_(consumes<edm::
View<
reco::Vertex>>(config.getUntrackedParameter<edm::
InputTag>(
"vertexProducer"))),
66 classifier_(config, consumesCollector()) {}
74 event.getByToken(
vtxToken_, vertexCollection);
80 for (std::size_t
index = 0;
index < vertexCollection->size();
index++) {
81 edm::LogPrint(
"VertexHistoryAnalyzer") << std::endl <<
"History for vertex #" <<
index <<
" : ";
89 for (std::size_t hindex = 0; hindex < simParticles.size(); hindex++) {
91 <<
" simParticles [" << hindex <<
"] : " <<
particleString(simParticles[hindex]->pdgId());
98 if (!simVertexes.empty()) {
99 for (std::size_t hindex = 0; hindex < simVertexes.size(); hindex++) {
101 <<
" simVertex [" << hindex
102 <<
"] : " <<
vertexString(simVertexes[hindex]->sourceTracks(), simVertexes[hindex]->daughterTracks());
105 edm::LogPrint(
"VertexHistoryAnalyzer") <<
" simVertex no found";
111 for (std::size_t hindex = 0; hindex <
genParticles.size(); hindex++) {
120 if (!genVertexes.empty()) {
121 for (std::size_t hindex = 0; hindex < genVertexes.size(); hindex++) {
122 edm::LogPrint(
"VertexHistoryAnalyzer") <<
" genVertex [" << hindex <<
"] : "
123 <<
vertexString(genVertexes[hindex]->particles_in_const_begin(),
124 genVertexes[hindex]->particles_in_const_end(),
125 genVertexes[hindex]->particles_out_const_begin(),
126 genVertexes[hindex]->particles_out_const_end());
129 edm::LogPrint(
"VertexHistoryAnalyzer") <<
" genVertex no found";
145 std::ostringstream vDescription;
149 if (particleType.isValid()) {
150 pid =
pdt_->particle(particleType);
152 vDescription << pid->name();
154 vDescription << pdgId;
156 vDescription << pdgId;
158 return vDescription.str();
165 std::ostringstream vDescription;
167 for (std::size_t
j = 0;
j < in.
size();
j++) {
173 if (particleType.isValid()) {
174 pid =
pdt_->particle(particleType);
176 vDescription << pid->name();
178 vDescription << in[
j]->pdgId();
180 vDescription << in[
j]->pdgId();
182 if (
j == in.
size() - 1)
188 vDescription <<
"->";
190 for (std::size_t
j = 0;
j < out.
size();
j++) {
196 if (particleType.isValid()) {
197 pid =
pdt_->particle(particleType);
199 vDescription << pid->name();
201 vDescription << out[
j]->pdgId();
203 vDescription << out[
j]->pdgId();
205 if (
j == out.
size() - 1)
211 return vDescription.str();
215 HepMC::GenVertex::particles_in_const_iterator in_end,
216 HepMC::GenVertex::particles_out_const_iterator out_begin,
217 HepMC::GenVertex::particles_out_const_iterator out_end)
const {
220 std::ostringstream vDescription;
224 HepMC::GenVertex::particles_in_const_iterator
in, itmp;
226 for (in = in_begin; in != in_end; in++, j++) {
235 vDescription << pid->name();
237 vDescription << (*in)->pdg_id();
239 vDescription << (*in)->pdg_id();
243 if (++itmp == in_end)
249 vDescription <<
"->";
252 HepMC::GenVertex::particles_out_const_iterator
out, otmp;
254 for (out = out_begin; out != out_end; out++, j++) {
263 vDescription << pid->name();
265 vDescription << (*out)->pdg_id();
267 vDescription << (*out)->pdg_id();
271 if (++otmp == out_end)
277 return vDescription.str();
This class traces the simulated and generated history of a given track.
VertexHistory const & history() const
Returns a reference to the vertex history used in the classification.
#define DEFINE_FWK_MODULE(type)
std::string vertexString(const TrackingParticleRefVector &, const TrackingParticleRefVector &) const
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
Get track history and classify it in function of their .
void beginRun(const edm::Run &, const edm::EventSetup &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< const HepMC::GenParticle * > GenParticleTrail
HepMC::GenParticle trail type.
VertexClassifier classifier_
edm::ESHandle< ParticleDataTable > pdt_
std::string particleString(int) const
bool is(Category category) const
Returns track flag for a given category.
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
HepPDT::ParticleData ParticleData
Log< level::Warning, true > LogPrint
void endRun(const edm::Run &, const edm::EventSetup &) override
VertexHistoryAnalyzer(const edm::ParameterSet &)
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
const edm::ESGetToken< ParticleDataTable, PDTRecord > pdtToken_
tuple config
parse the configuration file
VertexClassifier const & evaluate(reco::VertexBaseRef const &)
Classify the RecoVertex in categories.
const edm::EDGetTokenT< edm::View< reco::Vertex > > vtxToken_
size_type size() const
Size of the RefVector.
virtual void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
~VertexHistoryAnalyzer() override=default
std::vector< TrackingVertexRef > SimVertexTrail
SimVertex trail type.
GenParticleTrail const & genParticleTrail() const
Return all generated particle (HepMC::GenParticle) in the history.
std::vector< TrackingParticleRef > SimParticleTrail
SimParticle trail type.