MODULE LCIOapi ! adopted for f95 from lciof77api.inc and lciof77apiext.inc ! ! K.Sachs ! 24/4/2004 !*************************************************** ! Include file for the low level Fortran interface ! of LCIO. There is on function for each method of ! al the relevenat classes in LCIO. Please include ! this file in your Fortran program and use the ! C++ API documentation and the naming convention ! described in the users manual to find the ! fortran function you need. ! ! F.Gaede ! 10/30/2003 !************************************************** #define PTRTYPE integer ! constants as defined in EVENT::LCIO integer,parameter,public :: LCIO_CHBIT_LONG=31,LCIO_CHBIT_BARREL=30, & LCIO_CHBIT_POSZ=29,LCIO_CHBIT_PDG=28 integer,parameter,public :: LCIO_TPCBIT_RAW=31,LCIO_THBIT_BARREL=31 integer,parameter,public :: LCIO_READ_ONLY=0,LCIO_UPDATE=1 integer,parameter,public :: LCIO_WRITE_NEW=0,LCIO_WRITE_APPEND =1 integer,parameter,public :: LCIO_ERROR=0,LCIO_SUCCESS=1 ! collection types: character(len=*),parameter,public :: & LCIO_LCEVENT = "LCEvent", & LCIO_LCRUNHEADER = "LCRunHeader", & LCIO_MCPARTICLE = "MCParticle", & LCIO_SIMCALORIMETERHIT = "SimCalorimeterHit", & LCIO_CALORIMETERHIT = "CalorimeterHit", & LCIO_SIMTRACKERHIT = "SimTrackerHit", & LCIO_TPCHIT = "TPCHit", & LCIO_LCFLOATVEC = "LCFloatVec", & LCIO_LCINTVEC = "LCIntVec" ! the LCReader interface PUBLIC :: lcrdrcreate,lcrdrdelete,lcrdropen,lcrdrclose PUBLIC :: lcrdrreadnextrunheader,lcrdrreadnextevent,lcrdrreadevent interface function lcrdrcreate() result(reader) PTRTYPE :: reader end function lcrdrcreate function lcrdrdelete( reader ) result(status) PTRTYPE,intent(in) :: reader integer :: status end function lcrdrdelete function lcrdropen( reader,file ) result(status) PTRTYPE,intent(in) :: reader character(len=*),intent(in) :: file integer :: status end function lcrdropen function lcrdrclose( reader ) result(status) PTRTYPE,intent(in) :: reader integer :: status end function lcrdrclose function lcrdrreadnextrunheader( reader,accessMode ) result(runhdr) PTRTYPE,intent(in) :: reader integer,intent(in) :: accessMode PTRTYPE :: runhdr end function lcrdrreadnextrunheader function lcrdrreadnextevent( reader,accessMode ) result(event) PTRTYPE,intent(in) :: reader integer,intent(in) :: accessMode PTRTYPE :: event end function lcrdrreadnextevent function lcrdrreadevent( reader,runNumber,evtNumber ) result(event) PTRTYPE,intent(in) :: reader integer,intent(in) :: runNumber,evtNumber PTRTYPE :: event end function lcrdrreadevent end interface ! the LCWriter interface PUBLIC :: lcwrtcreate,lcwrtdelete,lcwrtopen,lcwrtclose PUBLIC :: lcwrtwriterunheader,lcwrtwriteevent interface function lcwrtcreate() result(writer) PTRTYPE :: writer end function lcwrtcreate function lcwrtdelete(writer) result(status) PTRTYPE,intent(in) :: writer integer :: status end function lcwrtdelete function lcwrtopen( writer,file,writeMode ) result(status) PTRTYPE,intent(in) :: writer character(len=*),intent(in) :: file integer,intent(in) :: writeMode integer :: status end function lcwrtopen function lcwrtclose( writer ) result(status) PTRTYPE,intent(in) :: writer integer :: status end function lcwrtclose function lcwrtwriterunheader( writer,runHdr ) result(status) PTRTYPE,intent(in) :: writer PTRTYPE,intent(in) :: runHdr integer :: status end function lcwrtwriterunheader function lcwrtwriteevent( writer,event ) result(status) PTRTYPE,intent(in) :: writer PTRTYPE,intent(in) :: event integer :: status end function lcwrtwriteevent end interface ! the LCRunHeader interface PUBLIC :: lcrhdcreate,lcrhddelete,lcrhdgetrunnumber PUBLIC :: lcrhdgetdetectorname,lcrhdgetdescription PUBLIC :: lcrhdgetactivesubdetectors PUBLIC :: lcrhdsetrunnumber,lcrhdsetdetectorname,lcrhdsetdescription,lcrhdaddactivesubdetector interface function lcrhdcreate() result(runHdr) PTRTYPE :: runHdr end function lcrhdcreate function lcrhddelete(runHdr) result(status) PTRTYPE,intent(in) :: runHdr integer :: status end function lcrhddelete function lcrhdgetrunnumber(runHdr) result(runNumber) PTRTYPE,intent(in) :: runHdr integer :: runNumber end function lcrhdgetrunnumber function lcrhdgetdetectorname(runHdr) result(name) PTRTYPE,intent(in) :: runHdr character(len=80) :: name end function lcrhdgetdetectorname function lcrhdgetdescription(runHdr) result(name) PTRTYPE,intent(in) :: runHdr character(len=1024) :: name end function lcrhdgetdescription function lcrhdgetactivesubdetectors(runHdr) result(sdvec) PTRTYPE,intent(in) :: runHdr PTRTYPE :: sdvec end function lcrhdgetactivesubdetectors function lcrhdsetrunnumber(runHdr,runNumber) result(status) PTRTYPE,intent(in) :: runHdr integer,intent(in) :: runNumber integer :: status end function lcrhdsetrunnumber function lcrhdsetdetectorname(runHdr,name) result(status) PTRTYPE,intent(in) :: runHdr character(len=*),intent(in) :: name integer :: status end function lcrhdsetdetectorname function lcrhdsetdescription(runHdr,name) result(status) PTRTYPE,intent(in) :: runHdr character(len=*),intent(in) :: name integer :: status end function lcrhdsetdescription function lcrhdaddactivesubdetector(runHdr,name) result(status) PTRTYPE,intent(in) :: runHdr character(len=*),intent(in) :: name integer :: status end function lcrhdaddactivesubdetector end interface ! the LCEvent interface PUBLIC :: lcevtcreate,lcevtdelete PUBLIC :: lcevtgetcollection,lcevtaddcollection,lcevtremovecollection PUBLIC :: lcevtgetrunnumber,lcevtgeteventnumber,lcevtgettimestamp,lcevtgetdetectorname PUBLIC :: lcevtsetrunnumber,lcevtseteventnumber,lcevtsettimestamp,lcevtsetdetectorname interface function lcevtcreate() result(event) PTRTYPE :: event end function lcevtcreate function lcevtdelete(event) result(status) PTRTYPE,intent(in) :: event integer :: status end function lcevtdelete function lcevtgetcollection(event,colname) result(pcol) PTRTYPE,intent(in) :: event character(len=*),intent(in) :: colname PTRTYPE :: pcol end function lcevtgetcollection function lcevtaddcollection(event,pcol,colname) result(status) PTRTYPE,intent(in) :: event,pcol character(len=*),intent(in) :: colname integer :: status end function lcevtaddcollection function lcevtremovecollection(event,colname) result(status) PTRTYPE,intent(in) :: event character(len=*),intent(in) :: colname integer :: status end function lcevtremovecollection function lcevtgetrunnumber(event) result(irun) PTRTYPE,intent(in) :: event integer :: irun end function lcevtgetrunnumber function lcevtgeteventnumber(event) result(ievt) PTRTYPE,intent(in) :: event integer :: ievt end function lcevtgeteventnumber function lcevtgettimestamp(event) result(itim) USE f90_kind PTRTYPE,intent(in) :: event integer(kind=int64) :: itim end function lcevtgettimestamp function lcevtgetdetectorname(event) result(name) PTRTYPE,intent(in) :: event character(len=80) :: name end function lcevtgetdetectorname function lcevtsetrunnumber(event,irun) result(status) PTRTYPE,intent(in) :: event integer,intent(in) :: irun integer :: status end function lcevtsetrunnumber function lcevtseteventnumber(event,ievt) result(status) PTRTYPE,intent(in) :: event integer,intent(in) :: ievt integer :: status end function lcevtseteventnumber function lcevtsetdetectorname(event,name) result(status) PTRTYPE,intent(in) :: event character(len=*),intent(in) :: name integer :: status end function lcevtsetdetectorname function lcevtsettimestamp(event,itim) result(status) USE f90_kind PTRTYPE,intent(in) :: event integer(kind=int64),intent(in) :: itim integer :: status end function lcevtsettimestamp end interface ! the LCCollection interface PUBLIC :: lccolcreate,lccoldelete,lccolsetflag,lccoladdelement,lccolremoveelementat PUBLIC :: lccolgettypename,lccolgetnumberofelements,lccolgetelementat,lccolgetflag interface function lccolcreate(coltype) result(pcol) character(len=*),intent(in) :: coltype PTRTYPE :: pcol end function lccolcreate function lccoldelete(pcol) result(status) PTRTYPE,intent(in) :: pcol integer :: status end function lccoldelete function lccolsetflag(pcol,iflag) result(status) PTRTYPE,intent(in) :: pcol integer,intent(in) :: iflag integer :: status end function lccolsetflag function lccoladdelement(pcol,pobject) result(status) PTRTYPE,intent(in) :: pcol,pobject integer :: status end function lccoladdelement function lccolremoveelementat(pcol,i) result(status) PTRTYPE,intent(in) :: pcol integer,intent(in) :: i integer :: status end function lccolremoveelementat function lccolgettypename(pcol) result(coltype) PTRTYPE,intent(in) :: pcol character(len=80) :: coltype end function lccolgettypename function lccolgetnumberofelements(pcol) result(number) PTRTYPE,intent(in) :: pcol integer :: number end function lccolgetnumberofelements function lccolgetelementat(pcol,index) result(pobject) PTRTYPE,intent(in) :: pcol integer,intent(in) :: index PTRTYPE :: pobject end function lccolgetelementat function lccolgetflag(pcol) result(iflag) PTRTYPE,intent(in) :: pcol integer :: iflag end function lccolgetflag end interface ! the MCParticle interface ! PTRTYPE lcmcpcreate ! integer lcmcpgetnumberofparents, lcmcpgetnumberofdaughters ! PTRTYPE lcmcpgetparent, lcmcpgetdaughter ! integer lcmcpdelete, lcmcpgetendpoint ! integer lcmcpgetpdg, lcmcpgetgeneratorstatus ! integer lcmcpgetsimulatorstatus ! integer lcmcpgetvertex, lcmcpgetmomentum ! real lcmcpgetmass, lcmcpgetcharge, lcmcpgetenergy ! integer lcmcpaddparent, lcmcpadddaughter ! integer lcmcpsetpdg, lcmcpsetgeneratorstatus ! integer lcmcpsetsimulatorstatus, lcmcpsetvertex ! integer lcmcpsetendpoint, lcmcpsetmomentum, lcmcpsetmass ! integer lcmcpsetcharge ! the SimTrackerHit interface ! PTRTYPE lcsthcreate, lcsthgetmcparticle ! integer lcsthdelete, lcsthgetcellid ! double precision lcsthgetposition ! real lcsthgetdedx, lcsthgettime ! integer lcsthsetcellid, lcsthsetposition, lcsthsetdedx ! integer lcsthsettime, lcsthsetmcparticle ! the SimCalorimeterHit interface ! PTRTYPE lcschcreate, lcschgetparticlecont ! integer lcschdelete, lcschgetcellid0, lcschgetcellid1 ! real lcschgetenergy, lcschgetenergycont, lcschgettimecont ! integer lcschgetposition, lcschgetnmcparticles ! integer lcschgetpdgcont ! integer lcschsetcellid0, lcschsetcellid1, lcschsetenergy ! integer lcschsetposition, lcschaddmcparticlecontribution ! the CalorimeterHit interface ! PTRTYPE lccahcreate ! integer lccahdelete, lccahgetcellid0, lccahgetcellid1 ! real lccahgetenergy ! integer lccahgetposition ! integer lccahsetcellid0, lccahsetcellid1, lccahsetenergy ! integer lccahsetposition ! the TPCHit interface PUBLIC :: lctphcreate,lctphdelete,lctphsetrawdata PUBLIC :: lctphsetcellid,lctphsettime,lctphsetcharge,lctphsetquality PUBLIC :: lctphgetcellid,lctphgettime,lctphgcharge,lctphgetquality PUBLIC :: lctphgetnrawdatawords,lctphgetrawdataword interface function lctphcreate() result(pthit) PTRTYPE :: pthit end function lctphcreate function lctphdelete(pthit) result(status) PTRTYPE,intent(in) :: pthit integer :: status end function lctphdelete function lctphsetcellid(pthit,icellid) result(status) PTRTYPE,intent(in) :: pthit integer,intent(in) :: icellid integer :: status end function lctphsetcellid function lctphsettime(pthit,time) result(status) PTRTYPE,intent(in) :: pthit real,intent(in) :: time integer :: status end function lctphsettime function lctphsetcharge(pthit,charge) result(status) PTRTYPE,intent(in) :: pthit real,intent(in) :: charge integer :: status end function lctphsetcharge function lctphsetquality(pthit,quality) result(status) PTRTYPE,intent(in) :: pthit integer,intent(in) :: quality integer :: status end function lctphsetquality function lctphsetrawdata(pthit,rawData,size) result(status) PTRTYPE,intent(in) :: pthit integer,intent(in) :: size integer,dimension(size),intent(in) :: rawData integer :: status end function lctphsetrawdata function lctphgetcellid(pthit) result(icellid) PTRTYPE,intent(in) :: pthit integer :: icellid end function lctphgetcellid function lctphgettime(pthit) result(time) PTRTYPE,intent(in) :: pthit real :: time end function lctphgettime function lctphgcharge(pthit) result(charge) PTRTYPE,intent(in) :: pthit real :: charge end function lctphgcharge function lctphgetquality(pthit) result(quality) PTRTYPE,intent(in) :: pthit integer :: quality end function lctphgetquality function lctphgetnrawdatawords(pthit) result(nraw) PTRTYPE,intent(in) :: pthit integer :: nraw end function lctphgetnrawdatawords function lctphgetrawdataword(pthit,i) result(iraw) PTRTYPE,intent(in) :: pthit integer,intent(in) :: i integer :: iraw end function lctphgetrawdataword end interface ! the LCStrVec,LCIntVec,LCFloatVec interface PUBLIC :: lcsvcgetlength,lcsvcgetstringat PUBLIC :: lcivcgetlength,lcivcgetintat PUBLIC :: lcfvcgetlength,lcsvcgetfloatat interface function lcsvcgetlength(stringvec) result(length) PTRTYPE,intent(in) :: stringvec integer :: length end function lcsvcgetlength function lcsvcgetstringat(stringvec,index) result(string) PTRTYPE,intent(in) :: stringvec integer,intent(in) :: index character(len=80) :: string end function lcsvcgetstringat function lcivcgetlength(intvec) result(length) PTRTYPE,intent(in) :: intvec integer :: length end function lcivcgetlength function lcivcgetintat(intvec,index) result(i) PTRTYPE,intent(in) :: intvec integer,intent(in) :: index integer :: i end function lcivcgetintat function lcfvcgetlength(floatvec) result(length) PTRTYPE,intent(in) :: floatvec integer :: length end function lcfvcgetlength function lcsvcgetfloatat(floatvec,index) result(f) PTRTYPE,intent(in) :: floatvec integer,intent(in) :: index real :: f end function lcsvcgetfloatat end interface !************************************************************ ! Include file for the convenient functions of the ! Fortran interface to LCIO. ! For documentation purpose the C style function declarations ! are provided. ! ! F.Gaede ! 10/30/2003 !************************************************************ ! --------------- convenient methods to read/write the run header PUBLIC :: lcwriterunheader,lcreadnextrunheader interface ! Write a run header to the specified writer with the given data. function lcwriterunheader(writer,irun,detname,descr,sdnamevec,nsubd,nchsubd) result(status) PTRTYPE,intent(in) :: writer,sdnamevec integer,intent(in) :: irun,nsubd,nchsubd character(len=*),intent(in) :: detname,descr integer :: status end function lcwriterunheader ! Read the next run header and fills the return arguments with the data. function lcreadnextrunheader(reader,irun,detname,descr,sdnamevec,nsubd,nchsubd) result(pheader) PTRTYPE,intent(in) :: reader,sdnamevec integer,intent(in) :: irun,nsubd,nchsubd character(len=*),intent(in) :: detname,descr PTRTYPE :: pheader end function lcreadnextrunheader end interface ! --------------- convenient methods for the event interface PUBLIC :: lcseteventheader,lcgeteventheader,lcdumpevent,lcdumpeventdetailed interface ! Set the complete event header data in the event. function lcseteventheader(event,irun,ievent,timestamp,detname) result(status) PTRTYPE,intent(in) :: event integer,intent(in) :: irun,ievent,timestamp character(len=*),intent(in) :: detname integer :: status end function lcseteventheader ! Read the complete event header data from the event. function lcgeteventheader(event,irun,ievent,timestamp,detname) result(status) PTRTYPE,intent(in) :: event integer,intent(in) :: irun,ievent,timestamp character(len=*),intent(in) :: detname integer :: status end function lcgeteventheader ! Dump the event to the stdout - one line per collection. function lcdumpevent(event) result(status) PTRTYPE,intent(in) :: event integer :: status end function lcdumpevent ! Detailed dump of all the data in the event to stdout. function lcdumpeventdetailed(event) result(status) PTRTYPE,intent(in) :: event integer :: status end function lcdumpeventdetailed end interface ! --------------- convenient methods for the mcparticle interface ! Return all the data of the specified MCParticle in the arguments. ! ! int lcgetmcparticledata( PTRTYPE mcparticle, int* pdg, int* hepevtstatus, double* prodvtx, ! float* momentum, float* mass, float* charge, int* ndaughters ) ; ! integer,public :: lcgetmcparticledata ! Fill the hepevt common block with the MCParicle data in the LCIO event. ! ! int lcio2hepevt( PTRTYPE event ) ; ! integer,public :: lcio2hepevt ! Create an MCParticle collection from the hepevt common block and add it to the event. ! ! int hepevt2lcio( PTRTYPE event ) ; ! integer,public :: hepevt2lcio ! --------------- convenient methods for SimTrackerHits ! Add a new SimTrackerHit with the given data to the collection. ! ! int lcaddsimtrackerhit( PTRTYPE col, int cellID, double* pos, float dEdx, float time, PTRTYPE mcp ) ; ! integer,public :: lcaddsimtrackerhit ! Return all the data from the specified SimTrackerHit in the arguments. ! ! int lcgetsimtrackerhit( PTRTYPE col, int i, int* cellID, double* pos, float* dEdx, float* time, PTRTYPE* mcp ) ; ! integer,public :: lcgetsimtrackerhit ! --------------- convenient methods for SimCalorimeterHits ! Add a new SimCalorimeterHit with the given data to the collection. ! Returns a pointer the new hit. ! ! PTRTYPE lcaddsimcalohit( PTRTYPE col, int cellID0, int cellID1, float energy, float* pos ) ; ! PTRTYPE,public :: lcaddsimcalohit ! Return the data of the specified SimCalorimeterHit in the arguments. ! ! int lcgetsimcalohit( PTRTYPE col, int i, int* cellID0, int* cellID1, float* energy, float* pos ) ; ! PTRTYPE,public :: lcgetsimcalohit ! Return the specified contribution of a MCParticle to the hit in the arguments. ! ! int lcgetsimcalohitmccont( PTRTYPE hit, int i, PTRTYPE* mcp, float* energy, float* time, int* pdg ) ; ! integer,public :: lcgetsimcalohitmccont !---- need to define the HEPEVT common block ! #include "hepevt.inc" ! #include "hepevt1.inc" END MODULE LCIOapi