Re: [ROOT] using directly fortran routine

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 05 2000 - 15:51:59 MEST


Hi Maria,

The function lu1ent does not exist in Pythia6. It has been renamed py1ent.

Also note taht Pythia6 is working in double precision, so you must modify
the types of teh arguments in teh calls.

I have made some changes in your code. See below.

Rene Brun



#include "TPythia6.h"

#include "TClonesArray.h"
#include "TMCParticle.h"
#include "TParticle.h"


//extern "C" void type_of_call lu1ent(Int_t&, Int_t&, Float_t&,
Float_t&,Float_t&);
extern "C" void py1ent_(Int_t&, Int_t&, Double_t&, Double_t&,Double_t&);

void DecayParticle(TPythia6 *pythia, Int_t idpart, Double_t mom,
Double_t theta,Double_t phi)
{
  Int_t temp = 0;
  py1ent_(temp, idpart, mom, theta, phi);

  pythia->GetPrimaries();
}


int maria()
{
  TPythia6 *pitia = new TPythia6() ;
  Int_t Pion = 111 ;
  TClonesArray * ParticleList = new TClonesArray() ;
  TMCParticle *pion = new TMCParticle() ;
  TMCParticle *photon1 = new TMCParticle() ;
  TMCParticle *photon2 = new TMCParticle() ;


  DecayParticle(pitia, Pion, 5., 90., 0.) ;
  ParticleList = (TClonesArray *)pitia->ImportParticles() ;

  pion = (TMCParticle *) ParticleList->At(0) ;
  photon1 = (TMCParticle *) ParticleList->At(1) ;
  photon2 = (TMCParticle *) ParticleList->At(2) ;

  ParticleList->Print() ;
  photon1->Print() ;

  return 1;
}

Maria Jesus MORA wrote:
> 
> Hi,
>     I'm working with TPythia6 and I need use a routine from JetSet
> (lu1ent) which is not include in this root class. Inspired by the
> AliRoot work (AliPythia) I tryed to call this routine directly from my
> program. I write a function who call it and first I define the routine
> like extern with the line:
> 
> extern "C" void type_of_call lu1ent(Int_t&, Int_t&, Float_t&, Float_t&,
> Float_t&);
> 
> To compile my program I link three Pythia libraries
> 
> libPythia6.so
> $(ROOTSYS)/lib/libEG.so
> $(ROOTSYS)/lib/libEGPythia6.so
> 
> But the compilation give me the error that it dot not know this routine.
> 
> What I am doing wrong?, I need other library? It is not the way to call
> a fortran routine...
> 
> Thank you for any help in advance
> 
> Maria MORA
> 
> I send you my program
> //////////////////////////////////////////////////////////////////////////////////////////////
> 
> #include "TPythia6.h"
> 
> #include "TClonesArray.h"
> #include "TMCParticle.h"
> #include "TParticle.h"
> 
> #ifndef WIN32
> # define lu1ent lu1ent_
> # define type_of_call
> #else
> # define lu1ent LU1ENT
> # define type_of_call _stdcall
> #endif
> 
> extern "C" void type_of_call lu1ent(Int_t&, Int_t&, Float_t&, Float_t&,
> Float_t&);
> 
> void DecayParticle(TPythia6 *pythia, Int_t &idpart, Float_t &mom,
> Float_t &theta,Float_t &phi)
> {
>   lu1ent(0, idpart, mom, theta, phi);
> 
>   pythia->GetPrimaries();
> }
> 
> int main()
> {
>   TPythia6 *pitia = new TPythia6() ;
>   Int_t Pion = 111 ;
>   TClonesArray * ParticleList = new TClonesArray() ;
>   TMCParticle *pion = new TMCParticle() ;
>   TMCParticle *photon1 = new TMCParticle() ;
>   TMCParticle *photon2 = new TMCParticle() ;
> 
>   DecayParticle(pitia, Pion, 5., 90., 0.) ;
>   ParticleList = (TClonesArray *)pitia->ImportParticles() ;
> 
>   pion = (TMCParticle *) ParticleList->At(0) ;
>   photon1 = (TMCParticle *) ParticleList->At(1) ;
>   photon2 = (TMCParticle *) ParticleList->At(2) ;
> 
>   ParticleList->Print() ;
>   photon1->Print() ;
> 
>   return 1;
> }
> //////////////////////////////////////////////////////////////////////////////////////////////////////////
> 
> working in Linus with ROOT Version   2.23/12



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET