RNO-G / mattak

RNO-G dataformats
1 stars 1 forks source link

pip install mattak tries to use pyroot when root is installed on system when reading data with NuRadioMC #56

Closed CamphynR closed 3 months ago

CamphynR commented 4 months ago

Short description When mattak is installed using pip install git+https://github.com/RNO-G/mattak.git to use specifically for reading data files with the NuRadioReco.modules.io.RNO_G.readRNOGDataMattak.readRNOGData class it crashes when calling readRNOGData.begin() The output states the crash occurs in the pyroot backend, while only the uproot backend is supported in the pip install mattak version. The system does contain a root installation a guess is that mattak assumes the pyroot backend to be installed when finding a root installation.

Minimal code for recreating issue:

import logging
from NuRadioReco.modules.io.RNO_G.readRNOGDataMattak import readRNOGData

rnog_reader = readRNOGData(log_level = logging.INFO) 
root_dirs = ["/path/to/run/directory/stationX/runX/"]
#mattak_kw = dict(backend = "uproot")
rnog_reader.begin(root_dirs,
#              mattak_kwargs = mattak_kw)

including the comments solves the crash, but the assumption was that mattak automatically finds the correct backend

system on which crash occurs: HTCondor cluster Python version: 3.9.12 ROOT version: 6.26/04 NuRadioMC: current develop branch version (05/06/2024)

Full error output


INFO:NuRadioReco.readRNOGData:Set 0 selector(s)
INFO:NuRadioReco.readRNOGData:Parse through / read-in 2 directory(ies) / file(s).
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/TriggerInfo.h
   requested to autoload type mattak::RadiantTriggerInfo
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/TriggerInfo.h
   requested to autoload type mattak::LTTriggerInfo
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/TriggerInfo.h
   requested to autoload type mattak::TriggerInfo
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Header.h
   requested to autoload type mattak::Header
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/DAQStatus.h
   requested to autoload type mattak::LTScalerGroup
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/DAQStatus.h
   requested to autoload type mattak::RadiantVoltages
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/DAQStatus.h
   requested to autoload type mattak::CalpulserInfo
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/DAQStatus.h
   requested to autoload type mattak::DAQStatus
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Sensors.h
   requested to autoload type mattak::Sensors
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Sensors.h
   requested to autoload type mattak::LTEStats
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/GNSS.h
   requested to autoload type mattak::GNSS
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/VoltageCalibration.h
   requested to autoload type mattak::VoltageCalibration
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Waveforms.h
   requested to autoload type mattak::WaveformPlotOptions
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Waveforms.h
   requested to autoload type mattak::IWaveforms
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Waveforms.h
   requested to autoload type mattak::Waveforms
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Waveforms.h
   requested to autoload type mattak::CalibratedWaveforms
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Pedestals.h
   requested to autoload type mattak::Pedestals
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/RunInfo.h
   requested to autoload type mattak::FirmwareVersion
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/RunInfo.h
   requested to autoload type mattak::FlowerGainCode
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/RunInfo.h
   requested to autoload type mattak::RunInfo
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Dataset.h
   requested to autoload type mattak::DatasetOptions
Error in cling::AutoLoadingVisitor::InsertIntoAutoLoadingState:
   Missing FileEntry for mattak/Dataset.h
   requested to autoload type mattak::Dataset
Successsfully found libmattak.so in /ada_mnt/ada/user/rcamphyn/envs/NuRadioMC_env/lib/python3.9/site-packages/mattak/build/lib/
Using pyroot backend
Error in <TInterpreter::AutoParse>: Error parsing payload code for class mattak::DatasetOptions with content:

#line 1 "libmattak dictionary payload"

#define _BACKWARD_BACKWARD_WARNING_H
// Inline headers
#include "mattak/Header.h"
#include "mattak/Constants.h"
#include "mattak/DAQStatus.h"
#include "mattak/Sensors.h"
#include "mattak/TriggerInfo.h"
#include "mattak/GNSS.h"
#include "mattak/Waveforms.h"
#include "mattak/Pedestals.h"
#include "mattak/Converter.h"
#include "mattak/RunInfo.h"
#include "mattak/Version.h"
#include "mattak/VoltageCalibration.h"
#include "mattak/Dataset.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

Error in <TClass::LoadClassInfo>: no interpreter information for class mattak::DatasetOptions is available even though it has a TClass initialization routine.
Error in <TClass::LoadClassInfo>: no interpreter information for class mattak::DatasetOptions is available even though it has a TClass initialization routine.
Error in <TClass::LoadClassInfo>: no interpreter information for class mattak::DatasetOptions is available even though it has a TClass initialization routine.
Error in <TClass::LoadClassInfo>: no interpreter information for class mattak::DatasetOptions is available even though it has a TClass initialization routine.
Error in <TInterpreter::AutoParse>: Error parsing payload code for class mattak::VoltageCalibration with content:

#line 1 "libmattak dictionary payload"

#define _BACKWARD_BACKWARD_WARNING_H
// Inline headers
#include "mattak/Header.h"
#include "mattak/Constants.h"
#include "mattak/DAQStatus.h"
#include "mattak/Sensors.h"
#include "mattak/TriggerInfo.h"
#include "mattak/GNSS.h"
#include "mattak/Waveforms.h"
#include "mattak/Pedestals.h"
#include "mattak/Converter.h"
#include "mattak/RunInfo.h"
#include "mattak/Version.h"
#include "mattak/VoltageCalibration.h"
#include "mattak/Dataset.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

Traceback (most recent call last):
  File "/ada_mnt/ada/user/rcamphyn/noise_study/main.py", line 23, in <module>
    rnog_reader.begin(root_dirs),
  File "/ada_mnt/ada/user/rcamphyn/envs/NuRadioMC/NuRadioReco/modules/io/RNO_G/readRNOGDataMattak.py", line 395, in begin
    dataset = mattak.Dataset.Dataset(station=0, run=0, data_path=dir_file, verbose=verbose, **mattak_kwargs)
  File "/ada_mnt/ada/user/rcamphyn/envs/NuRadioMC_env/lib/python3.9/site-packages/mattak/Dataset.py", line 260, in Dataset
    return mattak.backends.pyroot.dataset.Dataset(
  File "/ada_mnt/ada/user/rcamphyn/envs/NuRadioMC_env/lib/python3.9/site-packages/mattak/backends/pyroot/dataset.py", line 45, in __init__
    opt = ROOT.mattak.DatasetOptions()
TypeError: cannot instantiate incomplete class 'mattak::DatasetOptions'
cozzyd commented 3 months ago

The pip installation does indeed compile the the ROOT-ful version of mattak ROOT is available, I believe, though that doesn't explain why this is failing. I will see if I can reproduce...

cozzyd commented 3 months ago

Ok, I can reproduce pretty easily. I can fix it by setting CPATH (or ROOT_INCLUDE_PATH) to include $VIRTUAL_ENV/lib{64?}/python3.9/site-packages/mattak/build/include in it.

Probably the right thing is to set ROOT_INCLUDE_PATH at the same time as figuring out the .so to load.

cozzyd commented 3 months ago

ok, I may have fixed it, though it's a bit hacky and there's probably a better solution.

cozzyd commented 3 months ago

(you'll have to update mattak with pip)

CamphynR commented 3 months ago

Hi Cosmin, thanks for the quick fix, I tested it and everything works fine now. For posterity's sake (mostly for myself) I'll leave this link here which leads to the PyRoot docs with what I understand to be the issue PyROOT doc