CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/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     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   for(des = Particle->end_vertex()->particles_begin(HepMC::children);
00050       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 
00055 
00056 void TauDecay_CMSSW::AddPi0Info(HepMC::GenParticle *Particle,unsigned int midx){
00057   if(Particle->status()==1){
00058     TauDecayProducts.push_back(Particle);
00059     MotherIdx.push_back(midx);
00060     return;
00061   }
00062   HepMC::GenVertex::particle_iterator des;
00063   for(des = Particle->end_vertex()->particles_begin(HepMC::children);
00064       des!= Particle->end_vertex()->particles_end(HepMC::children);++des ) {
00065     AddPi0Info((*des),midx);
00066   }
00067 }