Go to the documentation of this file.00001 #include "Validation/EventGenerator/interface/TauDecay_CMSSW.h"
00002 #include "Validation/EventGenerator/interface/PdtPdgMini.h"
00003
00004 #include <iomanip>
00005 #include <cstdlib>
00006
00007 TauDecay_CMSSW::TauDecay_CMSSW():
00008 TauDecay()
00009 {
00010
00011 }
00012
00013 TauDecay_CMSSW::~TauDecay_CMSSW(){
00014
00015 }
00016
00017 bool TauDecay_CMSSW::AnalyzeTau(HepMC::GenParticle *Tau,unsigned int &JAK_ID,unsigned int &TauBitMask,bool dores, bool dopi0){
00018 Reset();
00019 MotherIdx.clear();
00020 TauDecayProducts.clear();
00021 if(abs(Tau->pdg_id())==PdtPdgMini::tau_minus){
00022 unsigned int Tauidx=TauDecayProducts.size();
00023 HepMC::GenVertex::particle_iterator des;
00024 if( Tau->end_vertex()){
00025 for(des = Tau->end_vertex()->particles_begin(HepMC::children);
00026 des!= Tau->end_vertex()->particles_end(HepMC::children);++des ) {
00027 Analyze((*des),Tauidx,dores,dopi0);
00028 }
00029 ClassifyDecayMode(JAK_ID,TauBitMask);
00030 return true;
00031 }
00032 }
00033 return false;
00034 }
00035
00036
00037
00038
00039 void TauDecay_CMSSW::Analyze(HepMC::GenParticle *Particle,unsigned int midx, bool dores, bool dopi0){
00040 unsigned int pdgid=abs(Particle->pdg_id());
00041 isTauResonanceCounter(pdgid);
00042 if(isTauFinalStateParticle(pdgid)){
00043 if(!isTauParticleCounter(pdgid)) std::cout << "TauDecay_CMSSW::Analyze WARNING: Unknow Final State Particle in Tau Decay... " << pdgid << std::endl;
00044 TauDecayProducts.push_back(Particle);
00045 MotherIdx.push_back(midx);
00046 return;
00047 }
00048 HepMC::GenVertex::particle_iterator des;
00049 if(Particle->end_vertex()){
00050 for(des = Particle->end_vertex()->particles_begin(HepMC::children); des!= Particle->end_vertex()->particles_end(HepMC::children) && Particle->end_vertex()-> particles_out_size()>0;++des ) {
00051 Analyze((*des),midx,dores,dopi0);
00052 }
00053 }
00054 else {
00055 std::cout << "Unstable particle that is undecayed in Tau decay tree. PDG ID: " << pdgid << std::endl;
00056 }
00057 }
00058
00059
00060
00061 void TauDecay_CMSSW::AddPi0Info(HepMC::GenParticle *Particle,unsigned int midx){
00062 if(Particle->status()==1){
00063 TauDecayProducts.push_back(Particle);
00064 MotherIdx.push_back(midx);
00065 return;
00066 }
00067 HepMC::GenVertex::particle_iterator des;
00068 for(des = Particle->end_vertex()->particles_begin(HepMC::children);
00069 des!= Particle->end_vertex()->particles_end(HepMC::children);++des ) {
00070 AddPi0Info((*des),midx);
00071 }
00072 }