/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/CPPFORT/lciof77apiext.cc File Reference

#include "CPPFORT/lciof77apiext.h"
#include "lcio.h"
#include "IOIMPL/LCFactory.h"
#include "IMPL/LCRunHeaderImpl.h"
#include "IMPL/LCEventImpl.h"
#include "IMPL/LCCollectionVec.h"
#include "IMPL/SimTrackerHitImpl.h"
#include "IMPL/SimCalorimeterHitImpl.h"
#include "IMPL/LCTOOLS.h"
#include "CPPFORT/HEPEVT.h"
#include "EVENT/LCIntVec.h"
#include "EVENT/LCFloatVec.h"
#include "EVENT/LCStrVec.h"
#include <string>
#include <vector>
#include <iostream>

Include dependency graph for lciof77apiext.cc:

Go to the source code of this file.

Functions

int do_set_method (LCParameters &params, const char *method, const char *key, PTRTYPE vector)
int do_get_method (const LCParameters &params, const char *method, const char *key, PTRTYPE vector)
int lcrdropenchain (PTRTYPE reader, void *filenamesv, const int nfiles, const int nchfilename)
int lcwriterunheader (PTRTYPE writer, const int irun, const char *detname, const char *description, void *sdnamevec, const int nsubd, const int nchsd)
PTRTYPE lcreadnextrunheader (PTRTYPE reader, int *irun, void *detname, void *description, void *sdnamevec, int *nsubd, const int nchsubd)
int lcseteventheader (PTRTYPE event, const int irun, const int ievent, const int timestamp, const char *detname)
int lcgeteventheader (PTRTYPE event, int *irun, int *ievent, int *timestamp, void *detname)
int lcdumprunheader (PTRTYPE runheader)
int lcdumpevent (PTRTYPE event)
int lcdumpeventdetailed (PTRTYPE event)
int lcgetmcparticledata (PTRTYPE mcparticle, int *pdg, int *genstatus, int *simstatus, double *prodvtx, float *momentum, float *mass, float *charge, int *ndaughters)
int lcaddsimtrackerhit (PTRTYPE collectionvec, int cellID, double *pos, float dEdx, float time, PTRTYPE mcp)
int lcgetsimtrackerhit (PTRTYPE collection, int i, int *cellID, double *pos, float *dEdx, float *time, PTRTYPE *mcp)
PTRTYPE lcaddsimcalohit (PTRTYPE col, int cellID0, int cellID1, float energy, float *pos)
PTRTYPE lcgetsimcalohit (PTRTYPE collection, int i, int *cellID0, int *cellID1, float *energy, float *pos)
int lcgetsimcalohitmccont (PTRTYPE hit, int i, PTRTYPE *mcp, float *energy, float *time, int *pdg)
int hepevt2lcio (PTRTYPE evtout)
int lcio2hepevt (PTRTYPE event)
PTRTYPE lcobjectvectorcreate (PTRTYPE *objectv, const int nobjv)
PTRTYPE lcintvectorcreate (int *intv, const int nintv)
PTRTYPE lcfloatvectorcreate (float *floatv, const int nfloatv)
PTRTYPE lcstringvectorcreate (void *stringv, const int nstringv, const int nchstringv)
int lcgetintvector (PTRTYPE vector, int *intv, int *nintv)
int lcgetfloatvector (PTRTYPE vector, float *floatv, int *nfloatv)
int lcgetstringvector (PTRTYPE vector, void *stringv, int *nstringv, const int nchstringv)
PTRTYPE intvectorcreate (int *intv, const int nintv)
int intvectordelete (PTRTYPE vector)
PTRTYPE floatvectorcreate (float *floatv, const int nfloatv)
int floatvectordelete (PTRTYPE vector)
PTRTYPE stringvectorcreate (void *stringv, const int nstringv, const int nchstringv)
int stringvectordelete (PTRTYPE vector)
PTRTYPE pointervectorcreate (PTRTYPE *pointerv, const int npointerv)
int pointervectordelete (PTRTYPE vector)
int getintvector (PTRTYPE vector, int *intv, int *nintv)
int getfloatvector (PTRTYPE vector, float *floatv, int *nfloatv)
int getstringvector (PTRTYPE vector, void *stringv, int *nstringv, const int nchstringv)
int getpointervector (PTRTYPE vector, PTRTYPE *pointerv, int *npointerv)
int lcsetparameters (const char *class_name, PTRTYPE classp, const char *method, const char *key, PTRTYPE vecp)
int lcgetparameters (const char *class_name, PTRTYPE classp, const char *method, const char *key, PTRTYPE vecp)

Variables

static std::vector< std::string > filenamelist


Function Documentation

int do_set_method ( LCParameters &  params,
const char *  method,
const char *  key,
PTRTYPE  vector 
)

Definition at line 561 of file lciof77apiext.cc.

Referenced by lcsetparameters().

00561                                                                                                  {
00562   const std::string & method = my_method ;
00563   if      (method == string("setIntValues")) {
00564     IntVec* intVec =  reinterpret_cast<IntVec*>(vector) ;
00565     params.setValues(key, *intVec) ;
00566     return LCIO::SUCCESS ;
00567   }
00568   else if (method == string("setFloatValues")) {
00569     FloatVec* floatVec =  reinterpret_cast<FloatVec*>(vector) ;
00570     params.setValues(key, *floatVec) ;
00571     return LCIO::SUCCESS ;
00572   }
00573   else if (method == string("setStringValues")) {
00574     StringVec* stringVec = reinterpret_cast<StringVec*>(vector) ;
00575     params.setValues(key, *stringVec) ;
00576     return LCIO::SUCCESS ;
00577   }
00578   else {
00579     std::cerr << "Warning in lcsetparameters: unknown method name " << method << std::endl ;
00580     return LCIO::ERROR ;
00581   }
00582 }

int do_get_method ( const LCParameters &  params,
const char *  method,
const char *  key,
PTRTYPE  vector 
)

Definition at line 584 of file lciof77apiext.cc.

Referenced by lcgetparameters().

00584                                                                                                        {
00585   const std::string & method = my_method ;
00586   if      (method == string("getIntValues")) {
00587     IntVec* intVec =  f2c_pointer<IntVec,LCObject>(vector) ;
00588     params.getIntVals(key, *intVec) ;
00589     return LCIO::SUCCESS ;
00590   }
00591   else if (method == string("getFloatValues")) {
00592     FloatVec* floatVec =  f2c_pointer<FloatVec,LCObject>(vector) ;
00593     params.getFloatVals(key, *floatVec) ;
00594     return LCIO::SUCCESS ;
00595   }
00596   else if (method == string("getStringValues")) {
00597     StringVec* stringVec = f2c_pointer<StringVec,LCObject>(vector) ;
00598     params.getStringVals(key, *stringVec) ;
00599     return LCIO::SUCCESS ;
00600   }
00601   else if (method == string("getIntKeys")) {
00602     StringVec* stringVec = f2c_pointer<StringVec,LCObject>(vector) ;
00603     params.getIntKeys(*stringVec) ;
00604     return LCIO::SUCCESS ;
00605   }
00606   else if (method == string("getFloatKeys")) {
00607     StringVec* stringVec = f2c_pointer<StringVec,LCObject>(vector) ;
00608     params.getFloatKeys(*stringVec) ;
00609     return LCIO::SUCCESS ;
00610   }
00611   else if (method == string("getStringtKeys")) {
00612     StringVec* stringVec = f2c_pointer<StringVec,LCObject>(vector) ;
00613     params.getStringKeys(*stringVec) ;
00614     return LCIO::SUCCESS ;
00615   }
00616   else {
00617     std::cerr << "Warning in lcgetparameters: unknown method name " << method << std::endl ;
00618     return LCIO::ERROR ;
00619   }
00620 }

int lcrdropenchain ( PTRTYPE  reader,
void *  filenamesv,
const int  nfiles,
const int  nchfilename 
)

Definition at line 37 of file lciof77apiext.cc.

00037                                                                                                  {
00038 
00039 
00040   try {
00041 //  if an old filenamelist exist clear it
00042 
00043     if ( filenamelist.size() > 0 ) filenamelist.clear() ;
00044     int elemlen = nchfilename +1 ;
00045     PTRTYPE stringpos = reinterpret_cast<PTRTYPE>( filenamesv ) ;
00046     for (int j=0;j < nfiles;j++)
00047     {
00048       char* filename = reinterpret_cast<char*>( stringpos ) ;
00049       filenamelist.push_back( filename ) ;
00050       stringpos = stringpos + elemlen ;
00051     }
00052     LCReader* lcReader = reinterpret_cast<LCReader*>( (reader) ) ;
00053     lcReader->open( filenamelist ) ;
00054     return LCIO::SUCCESS ;
00055   }catch( Exception& e1) {
00056     std::cerr << "Exception in LCRdrOpenChain: " << e1.what() << std::endl ;
00057     return LCIO::ERROR ;
00058   }
00059 }

int lcwriterunheader ( PTRTYPE  writer,
const int  irun,
const char *  detname,
const char *  description,
void *  sdnamevec,
const int  nsubd,
const int  nchsd 
)

Definition at line 61 of file lciof77apiext.cc.

00063                                           {
00064 
00065   try {
00066     LCWriter* lcWriter = reinterpret_cast<LCWriter*>( (writer) ) ;
00067     LCRunHeaderImpl* runHdr =  new LCRunHeaderImpl ;
00068     runHdr->setRunNumber( irun ) ;
00069     runHdr->setDetectorName( detname ) ;
00070     runHdr->setDescription( description ) ;
00071 
00072     int elemlen = nchsd + 1 ;
00073     PTRTYPE stringpos = reinterpret_cast<PTRTYPE>( sdnamevec ) ;
00074     for (int j=0;j < nsubd;j++)
00075     {
00076         char* subdetectorname = reinterpret_cast<char*>( stringpos ) ;
00077         runHdr->addActiveSubdetector( subdetectorname ) ;
00078         stringpos = stringpos + elemlen ;
00079     }
00080     lcWriter->writeRunHeader( runHdr ) ;
00081     delete runHdr ;
00082     return LCIO::SUCCESS ;
00083   }catch( Exception& e1) {
00084     std::cerr << "Exception in LCWriteRunHeader: " << e1.what() << std::endl ;
00085     return LCIO::ERROR ;
00086   }
00087 }

PTRTYPE lcreadnextrunheader ( PTRTYPE  reader,
int *  irun,
void *  detname,
void *  description,
void *  sdnamevec,
int *  nsubd,
const int  nchsubd 
)

Definition at line 89 of file lciof77apiext.cc.

00090                                                                              {
00091 
00092   LCReader* lcReader = reinterpret_cast<LCReader*>( (reader) ) ;
00093   try {
00094     LCRunHeader* runHdr = lcReader->readNextRunHeader() ;
00095     *irun = runHdr->getRunNumber() ;
00096 
00097     PTRTYPE stringpos ;
00098     stringpos = reinterpret_cast<PTRTYPE>( detname ) ;
00099     char* detname = reinterpret_cast<char*>( stringpos ) ;
00100     const char* detectorname = runHdr->getDetectorName().c_str() ;
00101     strcpy(detname,detectorname) ;
00102     stringpos = reinterpret_cast<PTRTYPE>( description ) ;
00103     char* descr = reinterpret_cast<char*>( stringpos ) ;
00104     const char* rundescription = runHdr->getDescription().c_str() ;
00105     strcpy(descr,rundescription) ;
00106 
00107     const std::vector<std::string>* strVec = runHdr->getActiveSubdetectors() ;
00108 
00109     int elemlen = nchsubd + 1;
00110     *nsubd  = strVec->size() ;
00111     stringpos = reinterpret_cast<PTRTYPE>( sdnamevec ) ;
00112     for( std::vector<std::string>::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
00113       std::string out = *name ;
00114       char* tmpname = reinterpret_cast<char*>( stringpos ) ;
00115       const char* subdname = const_cast<char*>( out.c_str() ) ;
00116       strcpy(tmpname,subdname) ;
00117       stringpos = stringpos + elemlen ;
00118     }
00119 
00120     return reinterpret_cast<PTRTYPE>(runHdr) ;
00121   }catch( Exception& e1) {
00122     std::cerr << "Exception in LCReadNextRunHeader: " << e1.what() << std::endl ;
00123     return LCIO::ERROR ;
00124   }
00125 }

int lcseteventheader ( PTRTYPE  event,
const int  irun,
const int  ievent,
const int  timestamp,
const char *  detname 
)

Definition at line 129 of file lciof77apiext.cc.

00129                                                                                                                  {
00130   LCEventImpl* lcEventImpl = reinterpret_cast<LCEventImpl*>( (event) ) ;
00131   lcEventImpl->setRunNumber( irun ) ;
00132   lcEventImpl->setEventNumber( ievent ) ;
00133   lcEventImpl->setTimeStamp( timestamp ) ;
00134   lcEventImpl->setDetectorName( detname ) ;
00135   return LCIO::SUCCESS ;
00136 }

int lcgeteventheader ( PTRTYPE  event,
int *  irun,
int *  ievent,
int *  timestamp,
void *  detname 
)

Definition at line 138 of file lciof77apiext.cc.

00138                                                                                             {
00139   LCEventImpl* lcEvent = reinterpret_cast<LCEventImpl*>( (event) ) ;
00140   *irun = lcEvent->getRunNumber() ;
00141   *ievent = lcEvent->getEventNumber() ;
00142   *timestamp = lcEvent->getTimeStamp() ;
00143   PTRTYPE stringpos = reinterpret_cast<PTRTYPE>( detname ) ;
00144   char* detnam = reinterpret_cast<char*>( stringpos ) ;
00145   const char* detectorname = lcEvent->getDetectorName().c_str() ;
00146   strcpy(detnam,detectorname) ;
00147   return LCIO::SUCCESS ;
00148 }

int lcdumprunheader ( PTRTYPE  runheader  ) 

Definition at line 149 of file lciof77apiext.cc.

00149                                         {
00150   LCRunHeader* runhdr = reinterpret_cast<LCRunHeader*>( (runheader) ) ;
00151   LCTOOLS::dumpRunHeader( runhdr ) ;
00152   return LCIO::SUCCESS ;
00153 }

int lcdumpevent ( PTRTYPE  event  ) 

Definition at line 155 of file lciof77apiext.cc.

00155                                 {
00156   LCEventImpl* lcEvent = reinterpret_cast<LCEventImpl*>( (event) ) ;
00157   LCTOOLS::dumpEvent(  lcEvent ) ;
00158   return LCIO::SUCCESS ;
00159 }

int lcdumpeventdetailed ( PTRTYPE  event  ) 

Definition at line 161 of file lciof77apiext.cc.

00161                                          {
00162   LCEventImpl* lcEvent = reinterpret_cast<LCEventImpl*>( (event) ) ;
00163   LCTOOLS::dumpEventDetailed(  lcEvent ) ;
00164   return LCIO::SUCCESS ;
00165 }

int lcgetmcparticledata ( PTRTYPE  mcparticle,
int *  pdg,
int *  genstatus,
int *  simstatus,
double *  prodvtx,
float *  momentum,
float *  mass,
float *  charge,
int *  ndaughters 
)

Definition at line 168 of file lciof77apiext.cc.

00170                                           {
00171 
00172   MCParticle* lcMCParticle = f2c_pointer<MCParticle,LCObject>( mcparticle ) ;
00173 
00174   *pdg               = lcMCParticle->getPDG() ;
00175   *genstatus         = lcMCParticle->getGeneratorStatus() ;
00176   *simstatus         = lcMCParticle->getSimulatorStatus() ;
00177   const double* dtmp = lcMCParticle->getVertex() ;
00178   for(int k=0;k<3;k++)  *prodvtx++  = dtmp[k] ;
00179 
00180 
00181   const double*  tmp  = lcMCParticle->getMomentum() ;
00182 
00183   for(int k=0;k<3;k++)  *momentum++ = (float) tmp[k] ;
00184   *mass              = lcMCParticle->getMass() ;
00185   *charge            = lcMCParticle->getCharge() ;
00186   *ndaughters        = lcMCParticle->getNumberOfDaughters() ;
00187   return LCIO::SUCCESS ;
00188 }

int lcaddsimtrackerhit ( PTRTYPE  collectionvec,
int  cellID,
double *  pos,
float  dEdx,
float  time,
PTRTYPE  mcp 
)

Definition at line 191 of file lciof77apiext.cc.

00192                                                      {
00193 
00194   LCCollectionVec* lcCollectionVec = reinterpret_cast<LCCollectionVec*>( (collectionvec) ) ;
00195   SimTrackerHitImpl* hit = new SimTrackerHitImpl ;
00196   MCParticle* mmcp = f2c_pointer<MCParticle,LCObject>( mcp ) ;
00197 
00198   hit->setCellID( cellID ) ;
00199   hit->setPosition( pos ) ;
00200   hit->setdEdx( dEdx ) ;
00201   hit->setTime( time ) ;
00202   hit->setMCParticle( mmcp ) ;
00203 
00204   lcCollectionVec->push_back( hit ) ;
00205   return LCIO::SUCCESS ;
00206 }

int lcgetsimtrackerhit ( PTRTYPE  collection,
int  i,
int *  cellID,
double *  pos,
float *  dEdx,
float *  time,
PTRTYPE *  mcp 
)

Definition at line 208 of file lciof77apiext.cc.

00208                                                                                                                      {
00209   LCCollectionVec* lcCollection = reinterpret_cast<LCCollectionVec*>( (collection) ) ;
00210   SimTrackerHit* hit =  dynamic_cast<SimTrackerHit*>( lcCollection->getElementAt( i-1 ) ) ;
00211 
00212   *cellID = hit->getCellID() ;
00213   const double* tmp = hit->getPosition() ;
00214   for(int k=0;k<3;k++)  *pos++ = tmp[k] ;
00215   *dEdx   = hit->getdEdx() ;
00216   *time   = hit->getTime() ;
00217   *mcp    = reinterpret_cast<PTRTYPE>( hit->getMCParticle() ) ;
00218   return LCIO::SUCCESS ;
00219 }

PTRTYPE lcaddsimcalohit ( PTRTYPE  col,
int  cellID0,
int  cellID1,
float  energy,
float *  pos 
)

Definition at line 222 of file lciof77apiext.cc.

00222                                                                                             {
00223   LCCollectionVec* lcCollection = reinterpret_cast<LCCollectionVec*>( col ) ;
00224   SimCalorimeterHitImpl* lcHit = new SimCalorimeterHitImpl ;
00225   lcHit->setCellID0( cellID0 ) ;
00226   lcHit->setCellID1( cellID1 ) ;
00227   lcHit->setEnergy( energy ) ;
00228   lcHit->setPosition( pos ) ;
00229   lcCollection->addElement( lcHit ) ;
00230   return C2F_POINTER( LCObject*, lcHit ) ;
00231 }

PTRTYPE lcgetsimcalohit ( PTRTYPE  collection,
int  i,
int *  cellID0,
int *  cellID1,
float *  energy,
float *  pos 
)

Definition at line 234 of file lciof77apiext.cc.

00235                                                      {
00236 
00237   LCCollectionVec* lcCollection = reinterpret_cast<LCCollectionVec*>( collection ) ;
00238   
00239   // checking on i !
00240   const int Nelements = lcCollection->getNumberOfElements() ;
00241   if (i < 0 && i > Nelements-1) {
00242     std::cerr << "Exception in LCGetSimCaloHit: index " << i << " out of range" << std::endl ;
00243     return LCIO::ERROR ;
00244   }
00245   
00246   SimCalorimeterHit* lcHit = dynamic_cast<SimCalorimeterHit*>( lcCollection->getElementAt( i-1 ) ) ;
00247   *cellID0 = lcHit->getCellID0() ;
00248   *cellID1 = lcHit->getCellID1() ;
00249   *energy  = lcHit->getEnergy() ;
00250   const float* tmp = lcHit->getPosition() ;
00251   for(int k=0;k<3;k++)  *pos++ = tmp[k] ;
00252 
00253   return C2F_POINTER( LCObject*, lcHit ) ;
00254 }

int lcgetsimcalohitmccont ( PTRTYPE  hit,
int  i,
PTRTYPE *  mcp,
float *  energy,
float *  time,
int *  pdg 
)

Definition at line 256 of file lciof77apiext.cc.

00256                                                                                                     {
00257 
00258   SimCalorimeterHitImpl* lcHit = f2c_pointer<SimCalorimeterHitImpl,LCObject>( hit ) ;
00259 // checking on i !
00260   const int Nelements = lcHit->getNMCContributions() ;
00261   if (i < 0 && i > Nelements-1) {
00262     std::cerr << "Exception in lcgetsimcalohitmccont: index " << i << " out of range" << std::endl ;
00263     return LCIO::ERROR ;
00264   }
00265 
00266   *mcp    = C2F_POINTER( LCObject*, lcHit->getParticleCont(i-1)  )  ;
00267   *energy = lcHit->getEnergyCont( i-1 ) ;
00268   *time   = lcHit->getTimeCont( i-1 ) ;
00269   *pdg    = lcHit->getPDGCont( i-1 ) ;
00270   return LCIO::SUCCESS ;
00271 }

int hepevt2lcio ( PTRTYPE  evtout  ) 

Definition at line 273 of file lciof77apiext.cc.

00273                                  {
00274   LCEventImpl* lcEvent = reinterpret_cast<LCEventImpl*>( evtout ) ;
00275   try { 
00276     HEPEVT::fromHepEvt(  lcEvent ) ;
00277     return LCIO::SUCCESS ;
00278   }catch( Exception& e1) {
00279     std::cerr << "Exception in lcio2hepevt: " << e1.what() << std::endl ;
00280     return LCIO::ERROR ;
00281   }
00282 }

int lcio2hepevt ( PTRTYPE  event  ) 

Definition at line 285 of file lciof77apiext.cc.

00285                                 {
00286   LCEvent* lcEvent = reinterpret_cast<LCEventImpl*>( event ) ;
00287   try { 
00288     HEPEVT::toHepEvt(  lcEvent ) ;
00289     return LCIO::SUCCESS ;
00290   }catch( Exception& e1) {
00291     std::cerr << "Exception in hepevt2lcio: " << e1.what() << std::endl ;
00292     return LCIO::ERROR ;
00293   }
00294 }

PTRTYPE lcobjectvectorcreate ( PTRTYPE *  objectv,
const int  nobjv 
)

Definition at line 297 of file lciof77apiext.cc.

00297                                                                  {
00298   LCObjectVec* objVec = new LCObjectVec ;
00299   for(int j=0;j<nobjv;j++) {
00300     LCObject* obj = f2c_pointer<LCObject,LCObject>( objectv[j] ) ;
00301     objVec->push_back( obj ) ;
00302   }
00303   return reinterpret_cast<PTRTYPE>( objVec ) ;
00304 }

PTRTYPE lcintvectorcreate ( int *  intv,
const int  nintv 
)

Definition at line 306 of file lciof77apiext.cc.

00306                                                        {
00307   LCIntVec* intVec = new LCIntVec ;
00308   for(int j=0;j<nintv;j++) intVec->push_back( intv[j] ) ;
00309   return reinterpret_cast<PTRTYPE>( intVec ) ;
00310 }

PTRTYPE lcfloatvectorcreate ( float *  floatv,
const int  nfloatv 
)

Definition at line 312 of file lciof77apiext.cc.

00312                                                                {
00313   LCFloatVec* floatVec = new LCFloatVec ;
00314   for(int j=0;j<nfloatv;j++) floatVec->push_back( floatv[j] ) ;
00315   return reinterpret_cast<PTRTYPE>( floatVec ) ;
00316 }

PTRTYPE lcstringvectorcreate ( void *  stringv,
const int  nstringv,
const int  nchstringv 
)

Definition at line 318 of file lciof77apiext.cc.

00318                                                                                       {
00319   LCStrVec* stringVec = new LCStrVec ;
00320   int elemlen = nchstringv + 1;
00321   PTRTYPE stringpos = 0 ;
00322   stringpos = reinterpret_cast<PTRTYPE>( stringv ) ;
00323   for(int j=0;j<nstringv;j++){
00324     const std::string& mystring = reinterpret_cast<char*>( stringpos ) ;
00325     stringVec->push_back( mystring ) ;
00326     stringpos = stringpos + elemlen ;
00327   }
00328   return reinterpret_cast<PTRTYPE>( stringVec ) ;
00329 }

int lcgetintvector ( PTRTYPE  vector,
int *  intv,
int *  nintv 
)

Definition at line 331 of file lciof77apiext.cc.

00331                                                            {
00332   LCIntVec* intVec =  f2c_pointer<LCIntVec,LCObject>(vector) ;
00333   int intVecLength = 0;
00334   intVecLength = intVec->size() ;
00335   if (intVecLength > *nintv) {
00336     std::cerr << "Warning in lcgetintvector: vector size " << intVecLength
00337               << " larger then target array size " << *nintv << std::endl ;
00338     intVecLength = *nintv ;
00339   }
00340   else {
00341     *nintv = intVecLength ;
00342   }
00343   for (int j=0;j < intVecLength;j++)  *intv++ = (*intVec)[j] ;
00344   return LCIO::SUCCESS ;
00345 }

int lcgetfloatvector ( PTRTYPE  vector,
float *  floatv,
int *  nfloatv 
)

Definition at line 347 of file lciof77apiext.cc.

00347                                                                    {
00348   LCFloatVec* floatVec =  f2c_pointer<LCFloatVec,LCObject>(vector) ;
00349   int floatVecLength = 0 ;
00350   floatVecLength = floatVec->size() ;
00351   if (floatVecLength > *nfloatv) {
00352     std::cerr << "Warning in lcgetfloatvector: vector size " << floatVecLength
00353               << " larger then target array size " << *nfloatv << std::endl ;
00354     floatVecLength = *nfloatv ;
00355   }
00356   else {
00357     *nfloatv = floatVecLength ;
00358   }
00359   for (int j=0;j < floatVecLength;j++)  *floatv++ = (*floatVec)[j] ;
00360   return LCIO::SUCCESS ;
00361 }

int lcgetstringvector ( PTRTYPE  vector,
void *  stringv,
int *  nstringv,
const int  nchstringv 
)

Definition at line 364 of file lciof77apiext.cc.

00364                                                                                           {
00365   LCStrVec* stringVec = reinterpret_cast<LCStrVec*>(vector) ;
00366   int stringVecLength = 0 ;
00367   stringVecLength = stringVec->size() ;
00368   if (stringVecLength > *nstringv) {
00369     std::cerr << "Warning in lcgetstringvector: vector size " << stringVecLength
00370               << " larger then target array size " << *nstringv << std::endl ;
00371     stringVecLength =  *nstringv ;
00372   }
00373   else {
00374     *nstringv = stringVecLength ;
00375   }
00376   int elemlen = nchstringv + 1;
00377   PTRTYPE stringpos = 0 ;
00378   stringpos = reinterpret_cast<PTRTYPE>( stringv ) ;
00379   for (int j=0;j < stringVecLength;j++) {
00380     char* outstring = const_cast<char*>( (*stringVec)[j].c_str() );
00381     char* tmpstring = reinterpret_cast<char*>( stringpos ) ;
00382     strcpy(tmpstring,outstring) ;
00383     stringpos = stringpos + elemlen ;
00384   }
00385   return LCIO::SUCCESS ;
00386 }

PTRTYPE intvectorcreate ( int *  intv,
const int  nintv 
)

Definition at line 389 of file lciof77apiext.cc.

00389                                                      {
00390   IntVec* intVec = new IntVec ;
00391   for(int j=0;j<nintv;j++) intVec->push_back( intv[j] ) ;
00392   return reinterpret_cast<PTRTYPE>( intVec ) ;
00393 }

int intvectordelete ( PTRTYPE  vector  ) 

Definition at line 395 of file lciof77apiext.cc.

00395                                      {
00396   IntVec* intVec =  reinterpret_cast<IntVec*>(vector) ;
00397   delete intVec ;
00398   return LCIO::SUCCESS ;
00399 }

PTRTYPE floatvectorcreate ( float *  floatv,
const int  nfloatv 
)

Definition at line 401 of file lciof77apiext.cc.

00401                                                              {
00402   FloatVec* floatVec = new FloatVec ;
00403   for(int j=0;j<nfloatv;j++) floatVec->push_back( floatv[j] ) ;
00404   return reinterpret_cast<PTRTYPE>( floatVec ) ;
00405 }

int floatvectordelete ( PTRTYPE  vector  ) 

Definition at line 407 of file lciof77apiext.cc.

00407                                        {
00408   FloatVec* floatVec = reinterpret_cast<FloatVec*>(vector) ;
00409   delete floatVec ;
00410   return LCIO::SUCCESS ;
00411 }

PTRTYPE stringvectorcreate ( void *  stringv,
const int  nstringv,
const int  nchstringv 
)

Definition at line 413 of file lciof77apiext.cc.

00413                                                                                     {
00414   StringVec* stringVec = new StringVec ;
00415   int elemlen = nchstringv + 1;
00416   PTRTYPE stringpos = 0 ;
00417   stringpos = reinterpret_cast<PTRTYPE>( stringv ) ;
00418   for(int j=0;j<nstringv;j++){
00419     const std::string& mystring = reinterpret_cast<char*>( stringpos ) ;
00420     stringVec->push_back( mystring ) ;
00421     stringpos = stringpos + elemlen ;
00422   }
00423   return reinterpret_cast<PTRTYPE>( stringVec ) ;
00424 }

int stringvectordelete ( PTRTYPE  vector  ) 

Definition at line 426 of file lciof77apiext.cc.

00426                                         {
00427   StringVec* stringVec = reinterpret_cast<StringVec*>(vector) ;
00428   delete stringVec ;
00429   return LCIO::SUCCESS ;
00430 }

PTRTYPE pointervectorcreate ( PTRTYPE *  pointerv,
const int  npointerv 
)

Definition at line 432 of file lciof77apiext.cc.

00432                                                                      {
00433   PointerVec* pointerVec = new PointerVec ;
00434   for(int j=0;j<npointerv;j++) pointerVec->push_back( pointerv[j] ) ;
00435   return reinterpret_cast<PTRTYPE>( pointerVec ) ;
00436 }

int pointervectordelete ( PTRTYPE  vector  ) 

Definition at line 438 of file lciof77apiext.cc.

00438                                          {
00439   PointerVec* pointerVec = reinterpret_cast<PointerVec*>(vector) ;
00440   delete pointerVec ;
00441   return LCIO::SUCCESS ;
00442 }

int getintvector ( PTRTYPE  vector,
int *  intv,
int *  nintv 
)

Definition at line 445 of file lciof77apiext.cc.

00445                                                          {
00446   IntVec* intVec =  reinterpret_cast<IntVec*>(vector) ;
00447   int intVecLength = 0;
00448   intVecLength = intVec->size() ;
00449   if (intVecLength > *nintv) {
00450     std::cerr << "Warning in getintvector: vector size " << intVecLength
00451               << " larger then target array size " << *nintv << std::endl ;
00452     intVecLength = *nintv ;
00453   }
00454   else {
00455     *nintv = intVecLength ;
00456   }
00457   for (int j=0;j < intVecLength;j++)  *intv++ = (*intVec)[j] ;
00458   return LCIO::SUCCESS ;
00459 }

int getfloatvector ( PTRTYPE  vector,
float *  floatv,
int *  nfloatv 
)

Definition at line 461 of file lciof77apiext.cc.

00461                                                                  {
00462   FloatVec* floatVec =  reinterpret_cast<FloatVec*>(vector) ;
00463   int floatVecLength = 0 ;
00464   floatVecLength = floatVec->size() ;
00465   if (floatVecLength > *nfloatv) {
00466     std::cerr << "Warning in getfloatvector: vector size " << floatVecLength
00467               << " larger then target array size " << *nfloatv << std::endl ;
00468     floatVecLength = *nfloatv ;
00469   }
00470   else {
00471     *nfloatv = floatVecLength ;
00472   }
00473   for (int j=0;j < floatVecLength;j++)  *floatv++ = (*floatVec)[j] ;
00474   return LCIO::SUCCESS ;
00475 }

int getstringvector ( PTRTYPE  vector,
void *  stringv,
int *  nstringv,
const int  nchstringv 
)

Definition at line 478 of file lciof77apiext.cc.

00478                                                                                         {
00479   StringVec* stringVec = reinterpret_cast<StringVec*>(vector) ;
00480   int stringVecLength = 0 ;
00481   stringVecLength = stringVec->size() ;
00482   if (stringVecLength > *nstringv) {
00483     std::cerr << "Warning in getstringvector: vector size " << stringVecLength
00484               << " larger then target array size " << *nstringv << std::endl ;
00485     stringVecLength =  *nstringv ;
00486   }
00487   else {
00488     *nstringv = stringVecLength ;
00489   }
00490   int elemlen = nchstringv + 1;
00491   PTRTYPE stringpos = 0 ;
00492   stringpos = reinterpret_cast<PTRTYPE>( stringv ) ;
00493   for (int j=0;j < stringVecLength;j++) {
00494     char* outstring = const_cast<char*>( (*stringVec)[j].c_str() );
00495     char* tmpstring = reinterpret_cast<char*>( stringpos ) ;
00496     strcpy(tmpstring,outstring) ;
00497     stringpos = stringpos + elemlen ;
00498   }
00499   return LCIO::SUCCESS ;
00500 }

int getpointervector ( PTRTYPE  vector,
PTRTYPE *  pointerv,
int *  npointerv 
)

Definition at line 502 of file lciof77apiext.cc.

00502                                                                          {
00503   PointerVec* pointerVec =  reinterpret_cast<PointerVec*>(vector) ;
00504   int pointerVecLength = 0;
00505   pointerVecLength = pointerVec->size() ;
00506   if (pointerVecLength > *npointerv) {
00507     std::cerr << "Warning in getpointervector: vector size " << pointerVecLength
00508               << " larger then target array size " << *npointerv << std::endl ;
00509     pointerVecLength = *npointerv ;
00510   }
00511   else {
00512     *npointerv = pointerVecLength ;
00513   }
00514   for (int j=0;j < pointerVecLength;j++)  *pointerv++ = (*pointerVec)[j] ;
00515   return LCIO::SUCCESS ;
00516 }

int lcsetparameters ( const char *  class_name,
PTRTYPE  classp,
const char *  method,
const char *  key,
PTRTYPE  vecp 
)

Definition at line 520 of file lciof77apiext.cc.

00520                                                                                                                {
00521   const std::string & classname = class_name ;
00522   if      (classname == LCIO::LCRUNHEADER) {
00523     LCRunHeaderImpl* rhd =  reinterpret_cast<LCRunHeaderImpl*>(classp) ;
00524     return do_set_method (rhd->parameters(), method, key, vecp) ;
00525   }
00526   else if (classname == LCIO::LCEVENT) {
00527     LCEventImpl* evt = reinterpret_cast<LCEventImpl*>(classp) ;
00528     return do_set_method (evt->parameters(), method, key, vecp) ;
00529   }
00530   else if (classname == LCIO::LCCOLLECTION) {
00531     LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(classp) ;
00532     return do_set_method (col->parameters(), method, key, vecp) ;
00533   }
00534   else {
00535     std::cerr << "Warning in lcsetparameters: unknown class name " << classname << std::endl ;
00536     return LCIO::ERROR ;
00537   }
00538 }

int lcgetparameters ( const char *  class_name,
PTRTYPE  classp,
const char *  method,
const char *  key,
PTRTYPE  vecp 
)

Definition at line 540 of file lciof77apiext.cc.

00540                                                                                                                {
00541   const std::string & classname = class_name ;
00542   if      (classname == LCIO::LCRUNHEADER) {
00543     LCRunHeaderImpl* rhd =  reinterpret_cast<LCRunHeaderImpl*>(classp) ;
00544     return do_get_method (rhd->getParameters(), method, key, vecp) ;
00545   }
00546   else if (classname == LCIO::LCEVENT) {
00547     LCEventImpl* evt = reinterpret_cast<LCEventImpl*>(classp) ;
00548     return do_get_method (evt->getParameters(), method, key, vecp) ;
00549   }
00550   else if (classname == LCIO::LCCOLLECTION) {
00551     LCCollectionVec* col = reinterpret_cast<LCCollectionVec*>(classp) ;
00552     return do_get_method (col->getParameters(), method, key, vecp) ;
00553   }
00554   else {
00555     std::cerr << "Warning in lcgetparameters: unknown class name " << classname << std::endl ;
00556     return LCIO::ERROR ;
00557   }
00558 
00559 }


Variable Documentation

std::vector<std::string> filenamelist [static]

Definition at line 31 of file lciof77apiext.cc.

Referenced by lcrdropenchain().


Generated on Mon Jan 7 13:16:37 2013 for MicromegasFramework by  doxygen 1.4.7