19 produces<LorentzVectorCollection>(
"LeptonicTauLeptons");
20 produces<LorentzVectorCollection>(
"LeptonicTauElectrons");
21 produces<LorentzVectorCollection>(
"LeptonicTauMuons");
22 produces<LorentzVectorCollection>(
"HadronicTauOneProng");
23 produces<LorentzVectorCollection>(
"HadronicTauThreeProng");
24 produces<LorentzVectorCollection>(
"HadronicTauOneAndThreeProng");
25 produces<LorentzVectorCollection>(
"TauOther");
26 produces<LorentzVectorCollection>(
"Neutrina");
27 produces<std::vector<int> >(
"Mothers");
45 auto_ptr<std::vector<int> > product_Mothers(
new std::vector<int>);
50 GenParticleCollection::const_iterator
p = genParticles->begin();
52 for (;p != genParticles->end(); ++
p ) {
55 for(
size_t pi =0;
pi<m_PDG_.size();++
pi)
57 if(
abs((*p).pdgId())== m_PDG_[
pi] &&
abs((*p).status()) == 3 ){
66 product_Mothers->push_back((*p).pdgId());
68 std::vector<GenParticle*> decayProducts;
70 TLorentzVector Boson((*p).px(),(*p).py(),(*p).pz(),(*p).energy());
72 for (GenParticle::const_iterator BosonIt=(*p).begin(); BosonIt != (*p).end(); BosonIt++){
75 if (
abs((*BosonIt).pdgId()) == 15 && ((*BosonIt).status()==3))
77 decayProducts.
clear();
79 for (GenParticle::const_iterator TauIt = (*BosonIt).begin(); TauIt != (*BosonIt).end(); TauIt++) {
82 if (
abs((*TauIt).pdgId()) == 15 && ((*TauIt).status()==2))
92 if ( !decayProducts.empty() )
101 int numChargedPions = 0;
102 int numNeutralPions = 0;
103 int numNeutrinos = 0;
104 int numOtherParticles = 0;
107 for (std::vector<GenParticle*>::iterator pit = decayProducts.begin(); pit != decayProducts.end(); pit++)
109 int pdg_id =
abs((*pit)->pdgId());
110 if (pdg_id == 11) numElectrons++;
111 else if (pdg_id == 13) numMuons++;
112 else if (pdg_id == 211) numChargedPions++;
113 else if (pdg_id == 111) numNeutralPions++;
114 else if (pdg_id == 12 ||
119 Neutrino.SetPxPyPzE((*pit)->px(),(*pit)->py(),(*pit)->pz(),(*pit)->energy());
122 else if (pdg_id != 22) {
129 TauDecayProduct.SetPxPyPzE((*pit)->px(),(*pit)->py(),(*pit)->pz(),(*pit)->energy());
130 Visible_Taus+=TauDecayProduct;
135 int tauDecayMode = kOther;
137 if ( numOtherParticles == 0 ){
138 if ( numElectrons == 1 ){
140 tauDecayMode = kElectron;
141 }
else if ( numMuons == 1 ){
143 tauDecayMode =
kMuon;
146 switch ( numChargedPions ){
148 switch ( numNeutralPions ){
150 tauDecayMode = kOneProng0pi0;
153 tauDecayMode = kOneProng1pi0;
156 tauDecayMode = kOneProng2pi0;
161 switch ( numNeutralPions ){
163 tauDecayMode = kThreeProng0pi0;
166 tauDecayMode = kThreeProng1pi0;
177 if(tauDecayMode == kElectron)
179 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCElectron_)){
180 product_Electrons->push_back(Visible_Taus);
181 product_Leptons->push_back(Visible_Taus);
184 else if (tauDecayMode ==
kMuon)
187 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCMuon_)){
188 product_Muons->push_back(Visible_Taus);
189 product_Leptons->push_back(Visible_Taus);
192 else if(tauDecayMode == kOneProng0pi0 ||
193 tauDecayMode == kOneProng1pi0 ||
194 tauDecayMode == kOneProng2pi0 )
196 if ((
abs(Visible_Taus.eta()) <
etaMax) && (Visible_Taus.pt() > ptMinMCTau_)){
197 product_OneProng->push_back(Visible_Taus);
198 product_OneAndThreeProng->push_back(Visible_Taus);
199 product_Neutrina->push_back(Neutrino);
202 else if (tauDecayMode == kThreeProng0pi0 ||
203 tauDecayMode == kThreeProng1pi0 )
205 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCTau_)) {
206 product_ThreeProng->push_back(Visible_Taus);
207 product_OneAndThreeProng->push_back(Visible_Taus);
208 product_Neutrina->push_back(Neutrino);
211 else if (tauDecayMode == kOther)
213 if((
abs(Visible_Taus.eta())<
etaMax)&&(Visible_Taus.pt()>ptMinMCTau_)) {
214 product_Other->push_back(Visible_Taus);
223 iEvent.
put(product_Leptons,
"LeptonicTauLeptons");
224 iEvent.
put(product_Electrons,
"LeptonicTauElectrons");
225 iEvent.
put(product_Muons,
"LeptonicTauMuons");
226 iEvent.
put(product_OneProng,
"HadronicTauOneProng");
227 iEvent.
put(product_ThreeProng,
"HadronicTauThreeProng");
228 iEvent.
put(product_OneAndThreeProng,
"HadronicTauOneAndThreeProng");
229 iEvent.
put(product_Other,
"TauOther");
230 iEvent.
put(product_Neutrina,
"Neutrina");
231 iEvent.
put(product_Mothers,
"Mothers");
239 std::vector<GenParticle*> decayProducts;
240 decayProducts.clear();
243 for ( GenParticle::const_iterator daughter_particle = (*particle).begin();daughter_particle != (*particle).end(); ++daughter_particle ){
245 int pdg_id =
abs((*daughter_particle).pdgId());
248 if ( pdg_id == 11 || pdg_id == 12 || pdg_id == 13 || pdg_id == 14 || pdg_id == 16 || pdg_id == 111 || pdg_id == 211 ){
254 std::vector<GenParticle*> addDecayProducts = getGenStableDecayProducts((
reco::GenParticle*) &(*daughter_particle));
255 for ( std::vector<GenParticle*>::const_iterator adddaughter_particle = addDecayProducts.begin(); adddaughter_particle != addDecayProducts.end(); ++adddaughter_particle ){
256 decayProducts.push_back((*adddaughter_particle));
260 return decayProducts;
T getUntrackedParameter(std::string const &, T const &) const
std::vector< reco::GenParticle * > getGenStableDecayProducts(const reco::GenParticle *particle)
math::XYZTLorentzVector LorentzVector
HLTTauMCProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< LorentzVector > LorentzVectorCollection
virtual void produce(edm::Event &, const edm::EventSetup &)