Executing a macro from my external hard drive


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.30/04
Platform: Ubuntu 22.04.3
Compiler: Not Provided


I am trying to execute macro from that data I stored in an external hard drive due to size. I can execute the macro from my pc with no trouble but when I copy the same file to my external drive I cannot execute it. Instead I get error message:
Error in TApplication::ExecuteFile: macro dataReaderPAUL.C not found in path .:/snap/root-framework/931/usr/local/macros
Please help.

Hi,

It is a bit hard to guess all the context, however I think what ROOT is telling you is that the file dataReaderPAUL.C cannot be found.

Can you perhaps continue to run the macro from the same path and change the location of the input files in the code?

In any case, this does not seem an issue of ROOT.

Best,
Danilo

Hi, have you checked that the drive is mounted with execution rights?

Cheers
Joa

Well I could change the location of the input files. But that creates memory problems. So I still need to keep my input files in the external hard drive.

Here is part of the macro:

void dataReaderPAUL() {
ifstream in;
TString dir; // Use TString consistently

int detectorIDX = 4;
unsigned minPlan, maxPlan;
unsigned long tStart, runDurationInDays;
char nameDet[10];

switch (detectorIDX)
{
case 1: /* Noir Desir = 32 - 33 - 34 */
    sprintf(nameDet, "ND");
    dir = "/home/marteau/vulcano/DETECTORS/NoirDesir/"; // Assign value to TString
    minPlan = 32, maxPlan = 34;
    tStart = 1622394286; /* Noir Desir CALIB start at IP2I atrium 4 = Event 0 time in sec for calib */
    runDurationInDays = 12;
    break;

case 2: /* L16bis = 0 - 1 - 2 */
    sprintf(nameDet, "L16b");
    dir = "/home/marteau/vulcano/DETECTORS/L16bis/"; // Assign value to TString
    minPlan = 0, maxPlan = 2;
    tStart = 1662038793; /* L16bis CALIB start at IP2I = Event 0 time in sec for calib */
    runDurationInDays = 12;
    break;

case 3: /* SacreBleu = 29 - 30 - 31 */
    sprintf(nameDet, "SB");
    dir = "/home/marteau/vulcano/DETECTORS/SacreBleu/"; // Assign value to TString
    minPlan = 29, maxPlan = 31;
    tStart = 1695562869; /* SacreBleu CALIB start at IP2I = Event 0 time in sec for calib */
    runDurationInDays = 12;
    break;

case 4: /* PAUL = 0 - 1 - 2 */
    sprintf(nameDet, "PAUL");
    dir = "/media/lumkile/Expansion/PAUL_DATA/PAUL_UWC_CALIB/"; // Assign value to TString
    minPlan = 0, maxPlan = 2;
    tStart = 1703140987; /* PAUL CALIB start at SUN = Event 0 time in sec for calib */
    runDurationInDays = 30;
    break;

default:
    printf("Choose a damn detector !");
}

unsigned nbrPlan = (maxPlan - minPlan) + 1;

// Loop through each file based on the pattern
for (int i = 0; i < 2; ++i) {
    TString fileName = Form("%sPAUL_UWC_CALIB3_17APR2024-%d.dat", dir.Data(), i);
    //in.open(fileName.Data());
    
         // Open the file
    std::ifstream in(fileName.Data());
    
    // Check if the file exists

if (!in.is_open()) {
// File doesn’t exist, move on to the next one
//std::cerr << "Error opening file: " << fileName << std::endl;
//perror(“Error”);

 std::cout << "File not found: " << fileName << std::endl;
   
continue;

}

in.close();
}

Hi Joa

Yes I do have execution rights /dev/sda1 on /media/lumkile/Expansion type exfat (rw,nosuid …

Hi Joa

Yes I do have execution rights /dev/sda1 on /media/lumkile/Expansion type exfat (rw,nosuid …

Your problem looks similar to this one:

Which is not a ROOT problem, but apparently a general issue (feature?) with snaps, see for example

Since you are on Ubuntu, try instead using a precompiled version of ROOT (make sure it’s the one for Ubuntu 22.04!) instead of installing a snap package.

Thanks Dastudillo I installed the precompiled version of ROOT and it works perfectly. Thank so much!!