20 produces<LorentzVectorCollection>(
"LeptonicTauLeptons");
21 produces<LorentzVectorCollection>(
"LeptonicTauElectrons");
22 produces<LorentzVectorCollection>(
"LeptonicTauMuons");
23 produces<LorentzVectorCollection>(
"HadronicTauOneProng");
24 produces<LorentzVectorCollection>(
"HadronicTauThreeProng");
25 produces<LorentzVectorCollection>(
"HadronicTauOneAndThreeProng");
26 produces<LorentzVectorCollection>(
"TauOther");
27 produces<LorentzVectorCollection>(
"Neutrina");
28 produces<LorentzVectorCollection>(
"MET");
29 produces<std::vector<int> >(
"Mothers");
48 unique_ptr<std::vector<int> > product_Mothers(
new std::vector<int>);
53 if(!genParticles.
isValid())
return;
67 product_MET->push_back(MET);
73 for(GenParticleCollection::const_iterator
p = genParticles->begin();
p != genParticles->end(); ++
p) {
76 for(
size_t pi =0;
pi<m_PDG_.size();++
pi)
78 if(
abs((*p).pdgId())== m_PDG_[
pi] && ( (*p).isHardProcess() || (*p).status() == 3 ) ){
88 product_Mothers->push_back((*p).pdgId());
90 TLorentzVector Boson((*p).px(),(*p).py(),(*p).pz(),(*p).energy());
97 for(GenParticleCollection::const_iterator
p = genParticles->begin();
p != genParticles->end(); ++
p, ++
index) {
106 getGenDecayProducts(genRef, daugTaus, 0, 15);
107 if( daugTaus.
size()==0 )
116 getGenDecayProducts(*
t,decayProducts,1);
119 if( !decayProducts.
empty() ) {
125 int numElectrons = 0;
127 int numChargedPions = 0;
128 int numNeutralPions = 0;
130 int numNeutrinos = 0;
131 int numOtherParticles = 0;
134 int pdg_id =
abs((*pit)->pdgId());
135 if (pdg_id == 11) numElectrons++;
136 else if (pdg_id == 13) numMuons++;
137 else if (pdg_id == 211 || pdg_id == 321 ) numChargedPions++;
138 else if (pdg_id == 111 || pdg_id == 130 || pdg_id == 310) numNeutralPions++;
139 else if (pdg_id == 12 ||
144 Neutrino.SetPxPyPzE((*pit)->px(),(*pit)->py(),(*pit)->pz(),(*pit)->energy());
147 else if (pdg_id == 22) numPhotons++;
155 TauDecayProduct.SetPxPyPzE((*pit)->px(),(*pit)->py(),(*pit)->pz(),(*pit)->energy());
156 Visible_Taus+=TauDecayProduct;
161 int tauDecayMode = kOther;
163 if ( numOtherParticles == 0 ){
164 if ( numElectrons == 1 ){
166 tauDecayMode = kElectron;
167 }
else if ( numMuons == 1 ){
169 tauDecayMode =
kMuon;
172 switch ( numChargedPions ){
174 if( numNeutralPions !=0 ){
175 tauDecayMode = kOther;
178 switch ( numPhotons ){
180 tauDecayMode = kOneProng0pi0;
183 tauDecayMode = kOneProng1pi0;
186 tauDecayMode = kOneProng2pi0;
189 tauDecayMode = kOther;
194 if( numNeutralPions !=0 ){
195 tauDecayMode = kOther;
198 switch ( numPhotons ){
200 tauDecayMode = kThreeProng0pi0;
203 tauDecayMode = kThreeProng1pi0;
206 tauDecayMode = kOther;
215 if(tauDecayMode == kElectron)
217 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCElectron_)){
218 product_Electrons->push_back(Visible_Taus);
219 product_Leptons->push_back(Visible_Taus);
222 else if (tauDecayMode ==
kMuon)
224 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCMuon_)){
225 product_Muons->push_back(Visible_Taus);
226 product_Leptons->push_back(Visible_Taus);
229 else if(tauDecayMode == kOneProng0pi0 ||
230 tauDecayMode == kOneProng1pi0 ||
231 tauDecayMode == kOneProng2pi0 )
233 if ((
abs(Visible_Taus.eta()) <
etaMax) && (Visible_Taus.pt() > ptMinMCTau_)){
234 product_OneProng->push_back(Visible_Taus);
235 product_OneAndThreeProng->push_back(Visible_Taus);
236 product_Neutrina->push_back(Neutrino);
239 else if (tauDecayMode == kThreeProng0pi0 ||
240 tauDecayMode == kThreeProng1pi0 )
242 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCTau_)) {
243 product_ThreeProng->push_back(Visible_Taus);
244 product_OneAndThreeProng->push_back(Visible_Taus);
245 product_Neutrina->push_back(Neutrino);
248 else if (tauDecayMode == kOther)
250 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCTau_)) {
251 product_Other->push_back(Visible_Taus);
257 iEvent.
put(
std::move(product_Leptons),
"LeptonicTauLeptons");
258 iEvent.
put(
std::move(product_Electrons),
"LeptonicTauElectrons");
259 iEvent.
put(
std::move(product_Muons),
"LeptonicTauMuons");
260 iEvent.
put(
std::move(product_OneProng),
"HadronicTauOneProng");
261 iEvent.
put(
std::move(product_ThreeProng),
"HadronicTauThreeProng");
262 iEvent.
put(
std::move(product_OneAndThreeProng),
"HadronicTauOneAndThreeProng");
279 if( (status==0 || (*d)->status() ==
status) &&
280 (pdgId==0 ||
std::abs((*d)->pdgId()) == pdgId) ) {
285 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
math::XYZTLorentzVector LorentzVector
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)
Abs< T >::type abs(const T &t)
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 &)
virtual int pdgId() const final
PDG identifier.
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