Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-20 09:34:02

0001 // Load the exact requested production library before interpreting the payload.
0002 // ROOT can otherwise print an interpreter error but still exit successfully.
0003 #include <TError.h>
0004 #include <TROOT.h>
0005 #include <TString.h>
0006 #include <TSystem.h>
0007 #include <iostream>
0008 
0009 namespace {
0010 bool smoke_root_error = false;
0011 ErrorHandlerFunc_t smoke_previous_handler = nullptr;
0012 void smoke_error_handler(Int_t level, Bool_t abort, const char* location, const char* message) {
0013   if (level >= kError) smoke_root_error = true;
0014   if (smoke_previous_handler) smoke_previous_handler(level, abort, location, message);
0015 }
0016 }
0017 
0018 void driver() {
0019   const char* library = gSystem->Getenv("LFHCAL_SMOKE_LIBRARY");
0020   const char* payload = gSystem->Getenv("LFHCAL_SMOKE_PAYLOAD");
0021   smoke_previous_handler = SetErrorHandler(smoke_error_handler);
0022   if (library) {
0023     // The dictionary may request the library again by basename. Point ROOT at
0024     // the selected artifact directory, not at whichever checkout is the cwd.
0025     const TString directory = gSystem->DirName(library);
0026     gSystem->SetDynamicPath(directory + ":" + gSystem->GetDynamicPath());
0027   }
0028   if (!library || !payload || gSystem->Load(library) < 0) {
0029     std::cerr << "FAIL: cannot load requested LFHCal library/payload\n";
0030     gSystem->Exit(1);
0031     return;
0032   }
0033   if (gROOT->LoadMacro(payload) < 0) {
0034     std::cerr << "FAIL: cannot interpret smoke payload\n";
0035     gSystem->Exit(1);
0036     return;
0037   }
0038   Int_t error = 0;
0039   const Longptr_t result = gROOT->ProcessLine("lfhcal_smoke_payload()", &error);
0040   gSystem->Exit(error == 0 && result == 0 && !smoke_root_error ? 0 : 1);
0041 }