61 HepMC::GenVertex::particles_in_const_iterator,
62 HepMC::GenVertex::particles_out_const_iterator,
63 HepMC::GenVertex::particles_out_const_iterator)
const;
68 trkToken_(consumes<edm::
View<
reco::Track>>(config.getUntrackedParameter<edm::
InputTag>(
"trackProducer"))),
69 classifier_(config, consumesCollector()) {}
74 event.getByToken(
trkToken_, trackCollection);
84 edm::LogPrint(
"TrackHistoryAnalyzer") << std::endl <<
"History for track #" <<
index <<
" : ";
92 for (std::size_t hindex = 0; hindex < simParticles.size(); hindex++) {
94 <<
" simParticles [" << hindex <<
"] : " <<
particleString(simParticles[hindex]->pdgId());
101 if (!simVertexes.empty()) {
102 for (std::size_t hindex = 0; hindex < simVertexes.size(); hindex++) {
104 <<
" simVertex [" << hindex
105 <<
"] : " <<
vertexString(simVertexes[hindex]->sourceTracks(), simVertexes[hindex]->daughterTracks());
108 edm::LogPrint(
"TrackHistoryAnalyzer") <<
" simVertex no found";
114 for (std::size_t hindex = 0; hindex <
genParticles.size(); hindex++) {
123 if (!genVertexes.empty()) {
124 for (std::size_t hindex = 0; hindex < genVertexes.size(); hindex++) {
125 edm::LogPrint(
"TrackHistoryAnalyzer") <<
" genVertex [" << hindex <<
"] : "
126 <<
vertexString(genVertexes[hindex]->particles_in_const_begin(),
127 genVertexes[hindex]->particles_in_const_end(),
128 genVertexes[hindex]->particles_out_const_begin(),
129 genVertexes[hindex]->particles_out_const_end());
132 edm::LogPrint(
"TrackHistoryAnalyzer") <<
" genVertex no found";
150 std::ostringstream vDescription;
154 if (particleType.isValid()) {
155 pid =
pdt_->particle(particleType);
157 vDescription << pid->name();
159 vDescription << pdgId;
161 vDescription << pdgId;
163 return vDescription.str();
170 std::ostringstream vDescription;
172 for (std::size_t
j = 0;
j < in.
size();
j++) {
178 if (particleType.isValid()) {
179 pid =
pdt_->particle(particleType);
181 vDescription << pid->name();
183 vDescription << in[
j]->pdgId();
185 vDescription << in[
j]->pdgId();
187 if (
j == in.
size() - 1)
193 vDescription <<
"->";
195 for (std::size_t
j = 0;
j < out.
size();
j++) {
201 if (particleType.isValid()) {
202 pid =
pdt_->particle(particleType);
204 vDescription << pid->name();
206 vDescription << out[
j]->pdgId();
208 vDescription << out[
j]->pdgId();
210 if (
j == out.
size() - 1)
216 return vDescription.str();
220 HepMC::GenVertex::particles_in_const_iterator in_end,
221 HepMC::GenVertex::particles_out_const_iterator out_begin,
222 HepMC::GenVertex::particles_out_const_iterator out_end)
const {
225 std::ostringstream vDescription;
229 HepMC::GenVertex::particles_in_const_iterator
in, itmp;
231 for (in = in_begin; in != in_end; in++, j++) {
240 vDescription << pid->name();
242 vDescription << (*in)->pdg_id();
244 vDescription << (*in)->pdg_id();
248 if (++itmp == in_end)
254 vDescription <<
"->";
257 HepMC::GenVertex::particles_out_const_iterator
out, otmp;
259 for (out = out_begin; out != out_end; out++, j++) {
268 vDescription << pid->name();
270 vDescription << (*out)->pdg_id();
272 vDescription << (*out)->pdg_id();
276 if (++otmp == out_end)
282 return vDescription.str();
const edm::ESGetToken< ParticleDataTable, PDTRecord > pdtToken_
std::string vertexString(const TrackingParticleRefVector &, const TrackingParticleRefVector &) const
void endRun(const edm::Run &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
SimVertexTrail const & simVertexTrail() const
Return all the simulated vertices in the history.
void analyze(const edm::Event &, const edm::EventSetup &) override
std::string particleString(int) const
TrackHistory const & history() const
Returns a reference to the track history used in the classification.
void beginRun(const edm::Run &, const edm::EventSetup &) override
std::vector< const HepMC::GenParticle * > GenParticleTrail
HepMC::GenParticle trail type.
TrackClassifier const & evaluate(reco::TrackBaseRef const &)
Classify the RecoTrack in categories.
~TrackHistoryAnalyzer() override=default
TrackHistoryAnalyzer(const edm::ParameterSet &)
This class traces the simulated and generated history of a given track.
std::vector< const HepMC::GenVertex * > GenVertexTrail
GenVertex trail type.
void newEvent(edm::Event const &, edm::EventSetup const &)
Pre-process event information (for accessing reconstraction information)
const edm::EDGetTokenT< edm::View< reco::Track > > trkToken_
HepPDT::ParticleData ParticleData
Log< level::Warning, true > LogPrint
bool is(Category category) const
Returns track flag for a given category.
TrackClassifier classifier_
Get track history and classify it in function of their .
SimParticleTrail const & simParticleTrail() const
Return all the simulated particle in the history.
tuple config
parse the configuration file
edm::ESHandle< ParticleDataTable > pdt_
size_type size() const
Size of the RefVector.
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
GenVertexTrail const & genVertexTrail() const
Return all generated vertex in the history.
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.