Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:55

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // C/C++ include files
0015 #include <string>
0016 #include <cerrno>
0017 
0018 // ROOT include files
0019 #include "TError.h"
0020 #include "TSystem.h"
0021 #include "TInterpreter.h"
0022 
0023 void DDEve(const char* xmlConfig=0, const char* evtData=0)  {
0024   Long_t result;
0025   char text[1024];
0026   const char* dd4hep = gSystem->Getenv("DD4hepINSTALL");
0027   if ( 0 == dd4hep )   {
0028     Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0029     Error("DDEve","+++ Your dd4hep installation seems incomplete. The environment DD4hepINSTALL is not defined!   +++");
0030     Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0031     gSystem->Exit(EINVAL);
0032   }
0033   ::snprintf(text,sizeof(text)," -I%s/include -D__DD4HEP_DDEVE_EXCLUSIVE__ -Wno-shadow -g -O0",dd4hep);
0034   gSystem->AddIncludePath(text);
0035   TString fname = "libDDG4IO";
0036   const char* io_lib = gSystem->FindDynamicLibrary(fname,kTRUE);
0037   if ( io_lib )  {
0038     result = gSystem->Load("libDDG4IO");
0039     if ( 0 != result )  {
0040       Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0041       Error("DDEve","+++ FAILED to load the DDG4 IO library 'libDDG4IO'!                                            +++");
0042       Error("DDEve","+++ %s",io_lib);
0043       Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0044       gSystem->Exit(EINVAL);
0045     }
0046     Info("DDEve","+++ Loaded DDG4IO library .....");
0047   }
0048   else  {
0049     Error("DDEve","+++ No DDG4 IO library 'libDDG4IO'  present!");
0050   }
0051   result = gSystem->Load("libDDEvePlugins");
0052   if ( 0 != result )  {
0053     Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0054     Error("DDEve","+++ Your dd4hep installation seems incomplete. FAILED to load the library 'libdd4hepEve'!      +++");
0055     Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0056     gSystem->Exit(EINVAL);
0057   }
0058   Info("DDEve","+++ Loaded DDEve library .....");
0059 #if 0
0060   Info("DDEve","Has to be run in compiled mode to support DDG4 input ... doing this for you now....");
0061   ::snprintf(text,sizeof(text),".L %s/examples/DDEve/DDG4IO.C+",dd4hep);
0062   gSystem->ResetErrno();
0063   result = gInterpreter->ProcessLine(text);
0064   result = gSystem->Load("DDG4Support_C");
0065   if ( result != 1 )   {
0066     Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0067     Error("DDEve","+++ Result:%ld %s",result,text);
0068     Error("DDEve","+++ errno=%d %s",gSystem->GetErrno(),gSystem->GetError());
0069     Error("DDEve","++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
0070     gSystem->Exit(gSystem->GetErrno());
0071   }
0072 #endif
0073   if ( xmlConfig && evtData )
0074     ::snprintf(text,sizeof(text),"dd4hep::DDEve::run(\"%s\",\"%s\")", xmlConfig, evtData);
0075   else if ( xmlConfig )
0076     ::snprintf(text,sizeof(text),"dd4hep::DDEve::run(\"%s\")", xmlConfig);
0077   else 
0078     ::snprintf(text,sizeof(text),"dd4hep::DDEve::run(0)");
0079   gInterpreter->ProcessLine(text);
0080 }