CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Validation/EventGenerator/src/TauDecay_CMSSW.cc

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){ // check that it is a tau
00022     unsigned int Tauidx=TauDecayProducts.size();
00023     HepMC::GenVertex::particle_iterator des;
00024     for(des = Tau->end_vertex()->particles_begin(HepMC::children);
00025         des!= Tau->end_vertex()->particles_end(HepMC::children);++des ) {
00026       Analyze((*des),Tauidx,dores,dopi0);
00027     }
00028     ClassifyDecayMode(JAK_ID,TauBitMask);
00029     return true;
00030   }
00031   return false;
00032 }
00033 
00034 
00035 
00036   
00037 void TauDecay_CMSSW::Analyze(HepMC::GenParticle *Particle,unsigned int midx, bool dores, bool dopi0){
00038   unsigned int pdgid=abs(Particle->pdg_id());
00039   isTauResonanceCounter(pdgid);
00040   if(isTauFinalStateParticle(pdgid)){
00041     if(!isTauParticleCounter(pdgid)) std::cout << "TauDecay_CMSSW::Analyze WARNING: Unknow Final State Particle in Tau Decay... " << pdgid << std::endl;
00042     TauDecayProducts.push_back(Particle);
00043     MotherIdx.push_back(midx);
00044     return;
00045   }
00046   HepMC::GenVertex::particle_iterator des;
00047   for(des = Particle->end_vertex()->particles_begin(HepMC::children);
00048       des!= Particle->end_vertex()->particles_end(HepMC::children) && Particle->end_vertex()-> particles_out_size()>0;++des ) {
00049     Analyze((*des),midx,dores,dopi0);
00050   }
00051 }
00052 
00053 
00054 void TauDecay_CMSSW::AddPi0Info(HepMC::GenParticle *Particle,unsigned int midx){
00055   if(Particle->status()==1){
00056     TauDecayProducts.push_back(Particle);
00057     MotherIdx.push_back(midx);
00058     return;
00059   }
00060   HepMC::GenVertex::particle_iterator des;
00061   for(des = Particle->end_vertex()->particles_begin(HepMC::children);
00062       des!= Particle->end_vertex()->particles_end(HepMC::children);++des ) {
00063     AddPi0Info((*des),midx);
00064   }
00065 }