CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/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   if(isTauFinalStateParticle(pdgid)){
00040     if(!isTauParticleCounter(pdgid)) std::cout << "TauDecay_CMSSW::Analyze WARNING: Unknow Final State Particle in Tau Decay... " << pdgid << std::endl;
00041     TauDecayProducts.push_back(Particle);
00042     MotherIdx.push_back(midx);
00043     return;
00044   }
00045   HepMC::GenVertex::particle_iterator des;
00046   for(des = Particle->end_vertex()->particles_begin(HepMC::children);
00047       des!= Particle->end_vertex()->particles_end(HepMC::children) && Particle->end_vertex()-> particles_out_size()>0;++des ) {
00048     Analyze((*des),midx,dores,dopi0);
00049   }
00050 }
00051 
00052 
00053 void TauDecay_CMSSW::AddPi0Info(HepMC::GenParticle *Particle,unsigned int midx){
00054   if(Particle->status()==1){
00055     TauDecayProducts.push_back(Particle);
00056     MotherIdx.push_back(midx);
00057     return;
00058   }
00059   HepMC::GenVertex::particle_iterator des;
00060   for(des = Particle->end_vertex()->particles_begin(HepMC::children);
00061       des!= Particle->end_vertex()->particles_end(HepMC::children);++des ) {
00062     AddPi0Info((*des),midx);
00063   }
00064 }