Duh… sorry. It was late and after a lot of screwing around! I had just tried FindObject before that and had the casts left over from that.
I realized I had a more fundamental problem: the map is apparently not getting written to the file in the first place (gee, shouldn’t I check pointers before I use them?).
The map is filled properly (I print out the values), then I do:
The ls() shows nothing and when using GetObject to fetch runLiveTimeMap, I get a zero pointer.
To set the context for what I’m doing -
We are launching our (GLAST) 2nd DataChallenge with 55 days of simulated orbit data, done in some 32000 batch jobs. For observations, we need to know when the telescope is live and we compute this in the simulations. I need to grab the summed livetime from the last event from each run and postprocess the tuples adding the sum in to all the events by run. This map should allow me to postprocess in parallel, rather than a serial 1.2M secs I estimate this will take.
The problem is that the dictionary for map<float,double> is not generated by default (in the cintdlls). You have to generate it yourself (using #pragma link C++ class map<float,double>;)
More importanly, I strongly advise against using a map<float,double>. Using a floating point value as the index of an std::map is known to be instable. (The fundamental problem is that the comparaison of 2 floating pointing numbers that are close is dependent on which cpu instruction is actually used). By using map<float,double> you have a high risk of corrupting your data (aka what you put in might not be what comes out). Note that this is recommendation is NOT related to I/O but to C++ coding and compilation.
Thanks! The float is in fact an ‘integer’, but we can switch to int. I’ve had to pass this work along for now (I’m in San Diego for the US LHC review).
Is there any analogous thing needed for retrieving the map from the file? My successor is having problems now that the map is in the file. Does he put the pragma somewhere in the reading class??