Symbol ... unresolved while linking

Hi,

I try to run this small macro in ROOT 6.10/04 on lxplus:

void analysis()
{
        const char* myFileName = (char*)"/eos/atlas/atlascerngroupdisk/det-trt-tb/testbeam2017/TimePix/Analysis/run18/Analysis/Run18_analysis_18.root";

        TH2F *h_TrPhotonEnergyVsAngle = new TH2F("h_TrPhotonEnergyVsAngle", "TR photons energy vs. angle;#theta [mrad];Energy [keV];Number of photons", 200, 0., 4., 200, 0., 40.);
        TH1F *h_TrPhotonAngle_allEnergies = new TH1F("h_TrPhotonAngle_allEnergies", "TR photons angle;#theta [mrad];Number of TR photons", 200, 0., 4.);


        const char runNumber_1stDigit = myFileName[strlen(myFileName)-7];
        const char runNumber_2ndDigit = myFileName[strlen(myFileName)-6];
        const int runNumber = (runNumber_1stDigit - '0')*10 + (runNumber_2ndDigit - '0');

        bool isElectronRun, isMuonRun, isCalibrationRun;
        isElectronRun = isMuonRun = isCalibrationRun = false;

        if ((18 <= runNumber && runNumber <= 36) || (50 <= runNumber && runNumber <= 53) || runNumber == 76 || runNumber == 77 || runNumber == 81)
        {
                isElectronRun = true;
        }
        else if ((54 <= runNumber && runNumber <= 74) || (78 <= runNumber && runNumber <= 80))
                isMuonRun = true;
        else if (runNumber == 49)
                isCalibrationRun = true;
        else
        {
                printf("Unable to associate this run #%i with any series, exiting now...\n", runNumber);
                return;
        }

        TFile *input = TFile::Open(myFileName, "READ");

        if (!input)
        {
                printf("FAILED\n");
                return;
        }
        else
                printf("OK\n");

        std::vector<double> photonsEnergies;

        TTreeReader myReader((char*)"goodEventData", input);

        TTreeReaderValue<Int_t> NTrPhotonsInEvent(myReader, "eventGammaN");
        TTreeReaderArray<Double_t> photonEnergy(myReader, "gammaE");

        while (myReader.Next())
        {
                for (Int_t gammaIt = 0; gammaIt < photonEnergy.GetSize(); gammaIt++)//iterates over all photons in this event
                        photonsEnergies.push_back(photonEnergy[gammaIt]);
        }

        input->Close();
        return;
}

simply typing

root -l -q analysis.c

, but it fails with the following:

Processing analysis.c...
IncrementalExecutor::executeFunction: symbol '_ZN4ROOT8Internal20TTreeReaderValueBase18GetElementTypeNameB5cxx11ERKSt9type_info' unresolved while linking [cling interface function]!
You are probably missing the definition of ROOT::Internal::TTreeReaderValueBase::GetElementTypeName[abi:cxx11](std::type_info const&)
Maybe you need to load the corresponding shared library?

Any ideas why?

The weird thing is that if I replace

        std::vector<double> photonsEnergies;

with

        std::vector<int> photonsEnergies;

, it works fine (but I really want the vector to be the vector of doubles). Or, if I keep the vector of doubles and I comment out the initialization of the first histogram, the h_TrPhotonEnergyVsAngle, it also works fine. Finally, if I comment out the

        else
        {
                printf("Unable to associate this run #%i with any series, exiting now...\n", runNumber);
                return;
        }

block, it also starts to run. So I’m a bit puzzled here… Are these things even connected?

Maybe @Axel could help on this…

Hi,

Please add
R__LOAD_LIBRARY(libTreePlayer)
at the beginning of your script, before or after the #includes.

(This is fixed in the current master, soon-to-be 6.14.)

Axel.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.