13   void HEPEVT::fromHepEvt(LCEvent * evt, 
const char* mcpColName){
 
   15       float* p = 
new float[3] ;
 
   18       LCCollectionVec* mcVec = 
new LCCollectionVec( LCIO::MCPARTICLE )  ;
 
   25         MCParticleImpl* mcp = 
new MCParticleImpl ;
 
   26         mcp->setPDG( 
FTNhep.idhep[j] ) ;
 
   27         mcp->setGeneratorStatus( 
FTNhep.isthep[j] ) ;
 
   28         mcp->setSimulatorStatus( 0 ) ;
 
   31         for(
int k=0;k<3;k++)  p[k] = (
float)
FTNhep.phep[j][k];
 
   32         mcp->setMomentum( p );
 
   33         mcp->setMass( (
float)
FTNhep.phep[j][4] ) ;
 
   34         mcp->setVertex( 
FTNhep.vhep[j] ) ;
 
   37         mcp->setCharge( 
FTNhep1.mcchargev[j] ) ;
 
   39         mcVec->push_back( mcp ) ;
 
   47     MCParticleImpl* mcp = 
dynamic_cast<MCParticleImpl*
>( mcVec->getElementAt( j ) ) ;
 
   50         int parent1 = 
FTNhep.jmohep[j][0] ;
 
   51         int parent2 = 
FTNhep.jmohep[j][1] ;
 
   54       MCParticle* mom = 
dynamic_cast<MCParticle*
>( mcVec->getElementAt( parent1-1 ) ) ;
 
   55       mcp->addParent( mom ) ;
 
   57         for(
int i = parent1 ; i < parent2 ; i++ ){ 
 
   58           MCParticle* mom2 = 
dynamic_cast<MCParticle*
>( mcVec->getElementAt( i ) ) ;
 
   59           mcp->addParent( mom2 ) ;
 
   66     colName = mcpColName ;
 
   69       evt->addCollection( (LCCollection*) mcVec , colName ) ;
 
   72       LCEventImpl* evtimpl = 
reinterpret_cast<LCEventImpl*
>(evt) ;
 
   73       LCCollection* getmcVec = evtimpl->getCollection( 
"MCParticle" ) ;
 
   74       int nelem = getmcVec->getNumberOfElements() ;
 
   75       for(
int j=0;j < nelem; j++)
 
   77         FTNhep1.mcpointerv[j] = 
reinterpret_cast<PTRTYPE>( getmcVec->getElementAt( j ) ) ;
 
   85   void HEPEVT::toHepEvt(
const LCEvent* evt, 
const char* mcpColName){
 
   88       double* maxxyz = 
new double;
 
   92       FTNhep.nevhep = evt->getEventNumber() ;
 
   96     colName = mcpColName ;
 
   99       LCCollection* mcVec = evt->getCollection( colName )  ;
 
  100       FTNhep.nhep = mcVec->getNumberOfElements() ;
 
  107         const MCParticle* mcp = 
 
  108         dynamic_cast<const MCParticle*
>( mcVec->getElementAt( j ) ) ;
 
  110         FTNhep.idhep[j] = mcp->getPDG() ;
 
  111         FTNhep.isthep[j] = mcp->getGeneratorStatus() ;
 
  116         const MCParticle* mcpp  = 0 ;
 
  117         int nparents = mcp->getParents().size() ;
 
  118     if(  nparents > 0 ) mcpp = mcp->getParents()[0] ;
 
  121           for(
int jjm=0;jjm < *
NMCPART;jjm++)
 
  123           if (mcpp  == dynamic_cast<const MCParticle*>(mcVec->getElementAt( jjm )) ){
 
  124         FTNhep.jmohep[j][0] = jjm + 1 ;
 
  130         if (  
FTNhep.jmohep[j][0] > 0 )
 
  133         const MCParticle* mcpsp  = 0 ;
 
  134         if(  mcp->getParents().size() > 1 ) mcpsp = mcp->getParents()[ nparents-1 ] ;
 
  136             for(
int jjj=0;jjj < *
NMCPART;jjj++)
 
  139               if (mcpsp  == dynamic_cast<const MCParticle*>(mcVec->getElementAt( jjj )) ){
 
  140                 FTNhep.jmohep[j][1] = jjj + 1 ;
 
  154         if ( 
FTNhep.isthep[j] != 3 )
 
  156           int ndaugthers = mcp->getDaughters().size() ;
 
  160              const MCParticle* mcpd = mcp->getDaughters()[0] ;
 
  161              for (
int jjj=0; jjj < *
NMCPART; jjj++)
 
  163                const MCParticle* mcpdtest = 
dynamic_cast<const MCParticle*
>(mcVec->getElementAt( jjj )) ;
 
  164                if ( mcpd == mcpdtest )
 
  166                  FTNhep.jdahep[j][0] = jjj + 1 ;
 
  167                  FTNhep.jdahep[j][1] = 
FTNhep.jdahep[j][0] + ndaugthers -1 ;
 
  175         for(
int k=0;k<3;k++)  
FTNhep.phep[j][k] = (
double)mcp->getMomentum()[k] ;
 
  176         FTNhep.phep[j][3] = (double)mcp->getEnergy() ;
 
  177         FTNhep.phep[j][4] = (double)mcp->getMass() ;
 
  182         for(
int k=0;k<3;k++){
 
  183           FTNhep.vhep[j][k] = mcp->getVertex()[k] ;
 
  189         if ( mcpp != 0 && *maxxyz > 0. )
 
  192                               + (mcp->getVertex()[*kmax] - mcpp->getVertex()[*kmax]) * mcpp->getEnergy()
 
  193                               / mcpp->getMomentum()[*kmax] ;
 
  202         FTNhep1.mcchargev[j] = mcp->getCharge() ;
 
long PTRTYPE
Fortran interface - define the length of pointers this has to made machine independent ...