21 produces<LorentzVectorCollection>(
"LeptonicTauLeptons");
22 produces<LorentzVectorCollection>(
"LeptonicTauElectrons");
23 produces<LorentzVectorCollection>(
"LeptonicTauMuons");
24 produces<LorentzVectorCollection>(
"HadronicTauOneProng");
25 produces<LorentzVectorCollection>(
"HadronicTauThreeProng");
26 produces<LorentzVectorCollection>(
"HadronicTauOneAndThreeProng");
27 produces<LorentzVectorCollection>(
"TauOther");
28 produces<LorentzVectorCollection>(
"Neutrina");
29 produces<LorentzVectorCollection>(
"MET");
30 produces<std::vector<int>>(
"Mothers");
47 unique_ptr<std::vector<int>> product_Mothers(
new std::vector<int>);
60 MET =
LorentzVector(genMet->front().px(), genMet->front().py(), 0, genMet->front().pt());
62 product_MET->push_back(MET);
68 for (GenParticleCollection::const_iterator
p = genParticles->begin();
p != genParticles->end(); ++
p) {
71 for (
size_t pi = 0;
pi < m_PDG_.size(); ++
pi) {
72 if (
abs((*p).pdgId()) == m_PDG_[
pi] && ((*p).isHardProcess() || (*p).status() == 3)) {
82 product_Mothers->push_back((*p).pdgId());
84 TLorentzVector Boson((*p).px(), (*p).py(), (*p).pz(), (*p).energy());
91 for (GenParticleCollection::const_iterator
p = genParticles->begin();
p != genParticles->end(); ++
p, ++
index) {
101 getGenDecayProducts(genRef, daugTaus, 0, 15);
102 if (daugTaus.
empty())
103 allTaus.push_back(genRef);
111 getGenDecayProducts(*
t, decayProducts, 1);
114 if (!decayProducts.
empty()) {
119 int numElectrons = 0;
121 int numChargedPions = 0;
122 int numNeutralPions = 0;
124 int numNeutrinos = 0;
125 int numOtherParticles = 0;
131 else if (pdg_id == 13)
133 else if (pdg_id == 211 || pdg_id == 321)
135 else if (pdg_id == 111 || pdg_id == 130 || pdg_id == 310)
137 else if (pdg_id == 12 || pdg_id == 14 || pdg_id == 16) {
140 Neutrino.SetPxPyPzE((*pit)->px(), (*pit)->py(), (*pit)->pz(), (*pit)->energy());
142 }
else if (pdg_id == 22)
148 if (pdg_id != 12 && pdg_id != 14 && pdg_id != 16) {
149 TauDecayProduct.SetPxPyPzE((*pit)->px(), (*pit)->py(), (*pit)->pz(), (*pit)->energy());
150 Visible_Taus += TauDecayProduct;
157 int tauDecayMode = kOther;
159 if (numOtherParticles == 0) {
160 if (numElectrons == 1) {
162 tauDecayMode = kElectron;
163 }
else if (numMuons == 1) {
165 tauDecayMode =
kMuon;
168 switch (numChargedPions) {
170 if (numNeutralPions != 0) {
171 tauDecayMode = kOther;
174 switch (numPhotons) {
176 tauDecayMode = kOneProng0pi0;
179 tauDecayMode = kOneProng1pi0;
182 tauDecayMode = kOneProng2pi0;
185 tauDecayMode = kOther;
190 if (numNeutralPions != 0) {
191 tauDecayMode = kOther;
194 switch (numPhotons) {
196 tauDecayMode = kThreeProng0pi0;
199 tauDecayMode = kThreeProng1pi0;
202 tauDecayMode = kOther;
211 if (tauDecayMode == kElectron) {
212 if ((Visible_Taus.eta() >
etaMin && Visible_Taus.eta() <
etaMax && Visible_Taus.phi() >
phiMin &&
213 Visible_Taus.phi() <
phiMax) &&
214 (Visible_Taus.pt() > ptMinMCElectron_)) {
215 product_Electrons->push_back(Visible_Taus);
216 product_Leptons->push_back(Visible_Taus);
218 }
else if (tauDecayMode ==
kMuon) {
219 if ((Visible_Taus.eta() >
etaMin && Visible_Taus.eta() <
etaMax && Visible_Taus.phi() >
phiMin &&
220 Visible_Taus.phi() <
phiMax) &&
221 (Visible_Taus.pt() > ptMinMCMuon_)) {
222 product_Muons->push_back(Visible_Taus);
223 product_Leptons->push_back(Visible_Taus);
225 }
else if (tauDecayMode == kOneProng0pi0 || tauDecayMode == kOneProng1pi0 || tauDecayMode == kOneProng2pi0) {
226 if ((Visible_Taus.eta() >
etaMin && Visible_Taus.eta() <
etaMax && Visible_Taus.phi() >
phiMin &&
227 Visible_Taus.phi() <
phiMax) &&
228 (Visible_Taus.pt() > ptMinMCTau_)) {
229 product_OneProng->push_back(Visible_Taus);
230 product_OneAndThreeProng->push_back(Visible_Taus);
231 product_Neutrina->push_back(Neutrino);
233 }
else if (tauDecayMode == kThreeProng0pi0 || tauDecayMode == kThreeProng1pi0) {
234 if ((Visible_Taus.eta() >
etaMin && Visible_Taus.eta() <
etaMax && Visible_Taus.phi() >
phiMin &&
235 Visible_Taus.phi() <
phiMax) &&
236 (Visible_Taus.pt() > ptMinMCTau_)) {
237 product_ThreeProng->push_back(Visible_Taus);
238 product_OneAndThreeProng->push_back(Visible_Taus);
239 product_Neutrina->push_back(Neutrino);
241 }
else if (tauDecayMode == kOther) {
242 if ((Visible_Taus.eta() >
etaMin && Visible_Taus.eta() <
etaMax && Visible_Taus.phi() >
phiMin &&
243 Visible_Taus.phi() <
phiMax) &&
244 (Visible_Taus.pt() > ptMinMCTau_)) {
245 product_Other->push_back(Visible_Taus);
251 iEvent.
put(
std::move(product_Leptons),
"LeptonicTauLeptons");
252 iEvent.
put(
std::move(product_Electrons),
"LeptonicTauElectrons");
253 iEvent.
put(
std::move(product_Muons),
"LeptonicTauMuons");
254 iEvent.
put(
std::move(product_OneProng),
"HadronicTauOneProng");
255 iEvent.
put(
std::move(product_ThreeProng),
"HadronicTauThreeProng");
256 iEvent.
put(
std::move(product_OneAndThreeProng),
"HadronicTauOneAndThreeProng");
272 if ((status == 0 || (*d)->status() ==
status) && (pdgId == 0 ||
std::abs((*d)->pdgId()) == pdgId)) {
275 getGenDecayProducts(*
d, products, status, pdgId);
int pdgId() const final
PDG identifier.
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const_iterator end() const
Termination of iteration.
bool empty() const
Is the RefVector empty.
~HLTTauMCProducer() override
const_iterator begin() const
Initialize an iterator over the RefVector.
ESProducts< std::remove_reference_t< TArgs >... > products(TArgs &&...args)
HLTTauMCProducer(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
void getGenDecayProducts(const reco::GenParticleRef &, reco::GenParticleRefVector &, int status=1, int pdgId=0)
Abs< T >::type abs(const T &t)
math::XYZTLorentzVector LorentzVector
std::vector< LorentzVector > LorentzVectorCollection
bool isPromptDecayed() const
TLorentzVector genMet(const HepMC::GenEvent *all, double etamin=-9999., double etamax=9999.)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
math::PtEtaPhiELorentzVectorF LorentzVector