23 produces<LorentzVectorCollection>(
"LeptonicTauLeptons");
24 produces<LorentzVectorCollection>(
"LeptonicTauElectrons");
25 produces<LorentzVectorCollection>(
"LeptonicTauMuons");
26 produces<LorentzVectorCollection>(
"HadronicTauOneProng");
27 produces<LorentzVectorCollection>(
"HadronicTauThreeProng");
28 produces<LorentzVectorCollection>(
"HadronicTauOneAndThreeProng");
29 produces<LorentzVectorCollection>(
"TauOther");
30 produces<LorentzVectorCollection>(
"Neutrina");
31 produces<LorentzVectorCollection>(
"MET");
32 produces<std::vector<int> >(
"Mothers");
51 unique_ptr<std::vector<int> > product_Mothers(
new std::vector<int>);
56 if(!genParticles.
isValid())
return;
70 product_MET->push_back(MET);
76 for(GenParticleCollection::const_iterator
p = genParticles->begin();
p != genParticles->end(); ++
p) {
79 for(
size_t pi =0;
pi<m_PDG_.size();++
pi)
81 if(
abs((*p).pdgId())== m_PDG_[
pi] && ( (*p).isHardProcess() || (*p).status() == 3 ) ){
91 product_Mothers->push_back((*p).pdgId());
93 TLorentzVector Boson((*p).px(),(*p).py(),(*p).pz(),(*p).energy());
100 for(GenParticleCollection::const_iterator
p = genParticles->begin();
p != genParticles->end(); ++
p, ++
index) {
109 getGenDecayProducts(genRef, daugTaus, 0, 15);
110 if( daugTaus.
size()==0 )
111 allTaus.push_back(genRef);
119 getGenDecayProducts(*
t,decayProducts,1);
122 if( !decayProducts.
empty() ) {
128 int numElectrons = 0;
130 int numChargedPions = 0;
131 int numNeutralPions = 0;
133 int numNeutrinos = 0;
134 int numOtherParticles = 0;
138 if (pdg_id == 11) numElectrons++;
139 else if (pdg_id == 13) numMuons++;
140 else if (pdg_id == 211 || pdg_id == 321 ) numChargedPions++;
141 else if (pdg_id == 111 || pdg_id == 130 || pdg_id == 310) numNeutralPions++;
142 else if (pdg_id == 12 ||
147 Neutrino.SetPxPyPzE((*pit)->px(),(*pit)->py(),(*pit)->pz(),(*pit)->energy());
150 else if (pdg_id == 22) numPhotons++;
158 TauDecayProduct.SetPxPyPzE((*pit)->px(),(*pit)->py(),(*pit)->pz(),(*pit)->energy());
159 Visible_Taus+=TauDecayProduct;
164 int tauDecayMode = kOther;
166 if ( numOtherParticles == 0 ){
167 if ( numElectrons == 1 ){
169 tauDecayMode = kElectron;
170 }
else if ( numMuons == 1 ){
172 tauDecayMode =
kMuon;
175 switch ( numChargedPions ){
177 if( numNeutralPions !=0 ){
178 tauDecayMode = kOther;
181 switch ( numPhotons ){
183 tauDecayMode = kOneProng0pi0;
186 tauDecayMode = kOneProng1pi0;
189 tauDecayMode = kOneProng2pi0;
192 tauDecayMode = kOther;
197 if( numNeutralPions !=0 ){
198 tauDecayMode = kOther;
201 switch ( numPhotons ){
203 tauDecayMode = kThreeProng0pi0;
206 tauDecayMode = kThreeProng1pi0;
209 tauDecayMode = kOther;
218 if(tauDecayMode == kElectron)
220 if((Visible_Taus.eta()>
etaMin&&Visible_Taus.eta()<
etaMax&&Visible_Taus.phi()>
phiMin&&Visible_Taus.phi()<
phiMax)&&(Visible_Taus.pt()>ptMinMCElectron_)){
221 product_Electrons->push_back(Visible_Taus);
222 product_Leptons->push_back(Visible_Taus);
225 else if (tauDecayMode ==
kMuon)
227 if((Visible_Taus.eta()>
etaMin&&Visible_Taus.eta()<
etaMax&&Visible_Taus.phi()>
phiMin&&Visible_Taus.phi()<
phiMax)&&(Visible_Taus.pt()>ptMinMCMuon_)){
228 product_Muons->push_back(Visible_Taus);
229 product_Leptons->push_back(Visible_Taus);
232 else if(tauDecayMode == kOneProng0pi0 ||
233 tauDecayMode == kOneProng1pi0 ||
234 tauDecayMode == kOneProng2pi0 )
236 if ((Visible_Taus.eta()>
etaMin&&Visible_Taus.eta()<
etaMax&&Visible_Taus.phi()>
phiMin&&Visible_Taus.phi()<
phiMax) && (Visible_Taus.pt() > ptMinMCTau_)){
237 product_OneProng->push_back(Visible_Taus);
238 product_OneAndThreeProng->push_back(Visible_Taus);
239 product_Neutrina->push_back(Neutrino);
242 else if (tauDecayMode == kThreeProng0pi0 ||
243 tauDecayMode == kThreeProng1pi0 )
245 if((Visible_Taus.eta()>
etaMin&&Visible_Taus.eta()<
etaMax&&Visible_Taus.phi()>
phiMin&&Visible_Taus.phi()<
phiMax)&&(Visible_Taus.pt()>ptMinMCTau_)) {
246 product_ThreeProng->push_back(Visible_Taus);
247 product_OneAndThreeProng->push_back(Visible_Taus);
248 product_Neutrina->push_back(Neutrino);
251 else if (tauDecayMode == kOther)
253 if((Visible_Taus.eta()>
etaMin&&Visible_Taus.eta()<
etaMax&&Visible_Taus.phi()>
phiMin&&Visible_Taus.phi()<
phiMax)&&(Visible_Taus.pt()>ptMinMCTau_)) {
254 product_Other->push_back(Visible_Taus);
260 iEvent.
put(
std::move(product_Leptons),
"LeptonicTauLeptons");
261 iEvent.
put(
std::move(product_Electrons),
"LeptonicTauElectrons");
262 iEvent.
put(
std::move(product_Muons),
"LeptonicTauMuons");
263 iEvent.
put(
std::move(product_OneProng),
"HadronicTauOneProng");
264 iEvent.
put(
std::move(product_ThreeProng),
"HadronicTauThreeProng");
265 iEvent.
put(
std::move(product_OneAndThreeProng),
"HadronicTauOneAndThreeProng");
282 if( (status==0 || (*d)->status() ==
status) &&
283 (pdgId==0 ||
std::abs((*d)->pdgId()) == pdgId) ) {
288 getGenDecayProducts(*
d, products, status, pdgId);
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.
const_iterator begin() const
Initialize an iterator over the RefVector.
HLTTauMCProducer(const edm::ParameterSet &)
ESProducts< T, S > products(const T &i1, const S &i2)
void getGenDecayProducts(const reco::GenParticleRef &, reco::GenParticleRefVector &, int status=1, int pdgId=0)
virtual int pdgId() const final
PDG identifier.
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.)
virtual void produce(edm::Event &, const edm::EventSetup &)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
size_type size() const
Size of the RefVector.
math::PtEtaPhiELorentzVectorF LorentzVector