LCOV - code coverage report
Current view: top level - TEvtGen/Tauola - TauolaHEPEVTEvent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 35 0.0 %
Date: 2016-06-14 17:26:59 Functions: 0 12 0.0 %

          Line data    Source code
       1             : #include "TauolaHEPEVTEvent.h"
       2             : 
       3             : #include "TauolaLog.h"
       4             : 
       5             : namespace Tauolapp
       6             : {
       7             : 
       8             : TauolaHEPEVTEvent::~TauolaHEPEVTEvent()
       9           0 : {
      10           0 :   for(unsigned int i=0;i<particle_list.size();i++) delete particle_list[i];
      11           0 : }
      12             : 
      13           0 : TauolaHEPEVTEvent::TauolaHEPEVTEvent() {}
      14             : 
      15             : void TauolaHEPEVTEvent::addParticle(TauolaHEPEVTParticle *p)
      16             : {
      17           0 :   p->setEvent(this);
      18             : 
      19           0 :   p->setBarcode(particle_list.size());
      20           0 :   particle_list.push_back(p);
      21           0 : }
      22             : 
      23             : TauolaHEPEVTParticle *TauolaHEPEVTEvent::getParticle(int i)
      24             : {
      25           0 :   if( i<0 || i>=(int)particle_list.size() ) return NULL;
      26           0 :   return particle_list[i];
      27           0 : }
      28             : 
      29             : int TauolaHEPEVTEvent::getParticleCount()
      30             : {
      31           0 :   return particle_list.size();
      32             : }
      33             : 
      34             : // we have conflict in names, looks for -pdg_id also...
      35             : std::vector<TauolaParticle*> TauolaHEPEVTEvent::findParticles(int pdg_id){
      36             : 
      37           0 :   std::vector<TauolaParticle*> list;
      38             : 
      39             :   // Loop over all particles in the event looking
      40             :   // for tau (or other) particle with specified pdg_id and -pdg_id
      41           0 :   for(unsigned int i=0; i<particle_list.size(); i++)
      42             :   {
      43           0 :     if( abs(particle_list[i]->getPdgID() ) == pdg_id)
      44           0 :       list.push_back(particle_list[i]);
      45             :   }
      46             : 
      47             :   return list;
      48           0 : }
      49             : 
      50             : // we have conflict in names, should be findStableTaus or have another argument. 
      51             : std::vector<TauolaParticle*> TauolaHEPEVTEvent::findStableParticles(int pdg_id){
      52             : 
      53           0 :   std::vector<TauolaParticle*> tau_list = findParticles(pdg_id);
      54           0 :   std::vector<TauolaParticle*> stable_tau_list;
      55             : 
      56           0 :   for(int i=0; i<(int) tau_list.size(); i++){
      57             : 
      58           0 :     if(!tau_list.at(i)->hasDaughters())
      59           0 :       stable_tau_list.push_back(tau_list[i]);
      60             :     else
      61             :     {
      62           0 :       std::vector<TauolaParticle*> t = tau_list[i]->getDaughters();
      63             :       //Ignore taus that we won't be decaying anyway
      64           0 :       if(t.size()==1) continue;
      65           0 :       if(t.size()==2 && (abs(t[0]->getPdgID())==15 || abs(t[1]->getPdgID())==15) ) continue;
      66           0 :       Log::Warning()<<"Particle with pdg code "<<tau_list.at(i)->getPdgID()
      67           0 :                     <<" already has daughters" <<endl;
      68           0 :     }
      69             :   }
      70             : 
      71             :   return stable_tau_list;
      72             : 
      73           0 : }
      74             : 
      75             : void TauolaHEPEVTEvent::print()
      76             : {
      77           0 :   printf("TauolaHEPEVTEvent\n-----------------\n");
      78           0 :   for(unsigned int i=0;i<particle_list.size();i++) particle_list[i]->print();
      79           0 : }
      80             : 
      81             : void TauolaHEPEVTEvent::clear()
      82             : {
      83           0 :   for(unsigned int i=0;i<particle_list.size();i++) delete particle_list[i];
      84           0 :   particle_list.clear();
      85           0 : }
      86             : 
      87             : #ifdef USE_HEPEVT_INTERFACE
      88             : 
      89             : void TauolaHEPEVTEvent::read_event_from_HEPEVT(TauolaHEPEVTEvent *evt)
      90             : {
      91             :   if(evt==NULL) return;
      92             :   
      93             :   for(int i=0; i<hepevt_.nhep; i++)
      94             :   {
      95             :     TauolaHEPEVTParticle *p = new TauolaHEPEVTParticle
      96             :     (
      97             :       hepevt_.idhep [i],
      98             :       hepevt_.isthep[i],
      99             :       hepevt_.phep  [i][0],
     100             :       hepevt_.phep  [i][1],
     101             :       hepevt_.phep  [i][2],
     102             :       hepevt_.phep  [i][3],
     103             :       hepevt_.phep  [i][4],
     104             :       hepevt_.jmohep[i][0]-1,
     105             :       hepevt_.jmohep[i][1]-1,
     106             :       hepevt_.jdahep[i][0]-1,
     107             :       hepevt_.jdahep[i][1]-1
     108             :     );
     109             :     evt->addParticle(p);
     110             :   }
     111             : }
     112             : 
     113             : void TauolaHEPEVTEvent::write_event_to_HEPEVT(TauolaHEPEVTEvent *evt)
     114             : {
     115             :   if(evt==NULL) return;
     116             :   
     117             :   hepevt_.nhep = evt->getParticleCount();
     118             :   
     119             :   for(int i=0; i<hepevt_.nhep; i++)
     120             :   {
     121             :     TauolaHEPEVTParticle *p = evt->getParticle(i);
     122             :     
     123             :     hepevt_.idhep [i]   =p->getPdgID();
     124             :     hepevt_.isthep[i]   =p->getStatus();
     125             :     hepevt_.phep  [i][0]=p->getPx();
     126             :     hepevt_.phep  [i][1]=p->getPy();
     127             :     hepevt_.phep  [i][2]=p->getPz();
     128             :     hepevt_.phep  [i][3]=p->getE();
     129             :     hepevt_.phep  [i][4]=p->getMass();
     130             :     hepevt_.jmohep[i][0]=p->getFirstMotherIndex()  +1;
     131             :     hepevt_.jmohep[i][1]=p->getSecondMotherIndex() +1;
     132             :     hepevt_.jdahep[i][0]=p->getDaughterRangeStart()+1;
     133             :     hepevt_.jdahep[i][1]=p->getDaughterRangeEnd()  +1;
     134             :     hepevt_.vhep  [i][0]=0.0;
     135             :     hepevt_.vhep  [i][1]=0.0;
     136             :     hepevt_.vhep  [i][2]=0.0;
     137             :     hepevt_.vhep  [i][3]=0.0;
     138             :   }
     139             : }
     140             : 
     141             : #endif
     142             : 
     143             : } // namespace Tauolapp

Generated by: LCOV version 1.11