46 const std::vector<int>&)
const;
57 produces<std::vector<SimTauCPLink>>();
65 edm::Handle<std::vector<CaloParticle>> calo_particle_h,
66 const std::vector<int>& gen_particle_barcodes)
const {
67 const auto& caloPartVec = *calo_particle_h;
72 LogDebug(
"SimTauProducer").format(
" TO BE SAVED {} ", resonance_idx);
73 auto const& gen_particle_barcode = gen_particle_barcodes[gen_particle_key];
74 auto const& found_in_caloparticles = std::find_if(caloPartVec.begin(), caloPartVec.end(), [&](
const auto&
p) {
75 return p.g4Tracks()[0].genpartIndex() == gen_particle_barcode;
77 if (found_in_caloparticles != caloPartVec.end()) {
78 auto calo_particle_idx = (found_in_caloparticles - caloPartVec.begin());
79 t.calo_particle_leaves.push_back(
CaloParticleRef(calo_particle_h, calo_particle_idx));
81 {gen_particle.
pdgId(), resonance_idx, (
int)
t.calo_particle_leaves.size() - 1, gen_particle_key});
82 LogDebug(
"SimTauProducer").format(
" CP {} {}", calo_particle_idx, caloPartVec[calo_particle_idx].
pdgId());
84 t.leaves.push_back({gen_particle.
pdgId(), resonance_idx, -1, gen_particle_key});
87 }
else if (generation != 0) {
88 t.resonances.push_back({gen_particle.
pdgId(), resonance_idx});
89 resonance_idx =
t.resonances.size() - 1;
90 LogDebug(
"SimTauProducer").format(
" RESONANCE/INTERMEDIATE {} ", resonance_idx);
95 int gen_particle_key = (*daughter).key();
96 LogDebug(
"SimTauProducer").format(
" gen {} {} {} ", generation, gen_particle_key, (*daughter)->pdgId());
97 buildSimTau(
t, generation, resonance_idx, *(*daughter), gen_particle_key, calo_particle_h, gen_particle_barcodes);
108 auto tauDecayVec = std::make_unique<std::vector<SimTauCPLink>>();
110 auto const&
flags =
g.statusFlags();
114 t.decayMode =
t.buildDecayModes();
119 (*tauDecayVec).push_back(
t);
130 descriptions.
add(
"SimTauProducer",
desc);
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
void buildSimTau(SimTauCPLink &, uint8_t, int, const reco::GenParticle &, int, edm::Handle< std::vector< CaloParticle >>, const std::vector< int > &) const
~SimTauProducer() override=default
const daughters & daughterRefVector() const
references to daughtes
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
int pdgId() const final
PDG identifier.
edm::Ref< CaloParticleCollection > CaloParticleRef
const edm::EDGetTokenT< std::vector< int > > genBarcodes_token_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
SimTauProducer(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticles_token_
const edm::EDGetTokenT< std::vector< CaloParticle > > caloParticles_token_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)