Hey experts,
I am posting this in Newbie because I am pretty sure it isn’t appropriate for ROOT Forum, but I really hope someone can chime in with past experience looking at a similar issue. This is a big problem for me, and really I am just hoping to get some next steps out of this post.
I am working with ROOT in art
(FNAL). When I retrieve values from a TBranch storing an int[3]
, they come out mangled (all entries are {268374015,268374015,268374015}
. (My retrieval is as follows)
Int_t pctag[3];
TBranch* tr_PCTag ;
priv_LightFile = TFile::Open(light_file_name.c_str(), "READ");
if(! priv_LightFile->IsOpen()){return;}
tr = (TTree*)priv_LightFile->Get("midas_data");
priv_nlightentries = tr->GetEntries();
tr->SetBranchAddress("PCTimeTag", pctag , &tr_PCTag );
tr->GetEntry(0);
std::cout<<std::fixed<<"priv_LightTimeFirst: "<<pctag[0]<<", "<<pctag[1]<<", "<<pctag[2]<<"\n";
//output
priv_LightTimeFirst: 268374015, 268374015, 268374015
The result of a scan from inside this module is as follows:
415 tr->Scan("PCTimeTag","","",10);
>>> n
***********************************
* Row * Instance * PCTimeTag *
***********************************
* 0 * 0 * 1.504e+09 *
* 0 * 1 * 1.504e+09 *
* 0 * 2 * 778 *
* 1 * 0 * 1.504e+09 *
* 1 * 1 * 1.504e+09 *
* 1 * 2 * 962 *
As you can see, the result of scan is different than the result of what I get from standard retrieval with getEntry(i)
.
My question isn’t really a typical question (Not here is exactly my code, why doesn’t it work), because this is a very large piece of software. Rather, I am trying to find out where to look for debugging this symptom (since I am clearly not down to the broken code yet). Of course, it complicates things that this works fine for me without our framework (just quickly parsing the file in ROOT6 standalone).
Edit: Please disregard the below. I have managed to correct the issue with a segfault in ROOT by updating part of our interface. I do not know exactly which change fixed it (major version increment), but it is fixed.
I am retrieving a value from a ROOT file inside of the art framework (FNAL) and seeing VERY strange behaviour. If I load the file in root and scan the tree I am trying to load, the values in it make sense, but when I open the file in my compiled code, it fails in a really strange way.
Int_t type times I extract from the TTree in my file come out the same value. (268374015), when I am supposed to get an epoch time (150XXXXXXX).
tr->SetBranchAddress("TimeStamp", &time_stamp, &tr_TimeStamp );
tr->GetEntry(i);
I tried adding a scan to my compiled art code, tr->Scan("MyBranch","","",10);
, but the result is a segfault in TEnv.cxx:455. Somehow I end up inside the if statement without a defined gROOT (er and gSystem can both be inspected with gdb print statements, gdb tells me gROOT is undeclared) (er=0
, gSystem=$1 = (TSystem *) 0x645540
, No symbol "gROOT" in current context.
)
I am really confused here, and not really sure what to do in debugging this. My actual root code in this art module is pretty simple, but it doesn’t respond the same way as when run in ROOT itself. Can anyone offer some insight into what kind of failure I might be looking at (So I can try to figure out what part of our code is interfering and fix it). I would start with out stuff, but the only errors I am getting are from ROOT code, and I am looking at a 400K+ line project. I need to narrow in a lot more.