Dear ROOTers,
I am filling a class to a ROOT Tree that is circular. It is written into a TMapFile, under linux using root 5.24.00b self compiled libraries with 64 bit architecture.
The class, that contains a std::map
class MachineDataEvent
{
public:
MachineDataEvent() {}
~MachineDataEvent(){}
public:
typedef std::map<std::string,double> EpicsDataMap;
const EpicsDataMap& EpicsData()const {return _epicsdata;}
EpicsDataMap& EpicsData() {return _epicsdata;}
private:
EpicsDataMap _epicsdata;//a map
ClassDefNV(MachineDataEvent,1) //A Container
};
is stored in a branch without splitting.
T->Branch("MachineEventBranch","MachineDataEvent",&machinedata,32000,00);
To compile the code I am using the following LinkDef.h
#include <map>
#include <string>
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class map<std::string,double>;
#pragma link C++ defined_in "machine_event.h";
#pragma link C++ class MachineDataEvent;
#endif
The dictionary is created using the following line
I am now trying to read the map values from a root session (rootn.exe) using the following code in a interpreted macro
EpicsDataMap::iterator ito;
entries=(Int_t)T->GetEntries();
for(Int_t entry=0;entry<entries;entry++)
{
T->GetEntry(entry);
printf("mach %i\n",MachineEventBranch->EpicsData().size());
for( ito=MachineEventBranch->EpicsData().begin();
ito!=MachineEventBranch->EpicsData().end();ito++)
{
std::cout << (*ito).first << " is " << (*ito).second << std::endl;
}
}
root does not give any kind of error. The standard out shows only reasonable value for “first” but the value of “second” is always zero where it was non zero in the original map.
Also all the other member functions like begin(), end(), size() are returning what is expected.
Do you have any idea of what the problem could be?
Thank you!
Best Regards,
Lutz