Dear all,
I am struggling with what I think to be some sort of scoping issue. It is similar to a problem I have seen posted in other messages but I can’t find an exact cure:
I am running over a root file with two trees in it called TotScanTree. They contain the same branches (TotScanRaw, TotScanResults for example) and I want to compare results from values in the two trees.
In the header file I define:
TotScanRaw *totScanRaw[2];
TotScanResults *totScanRes[2];
Then I do the following:
static std::vector<PP0> PP0Data;
PP0 * pp0 = 0;
pp0_nt = new TChain("PP0Tree");
pp0_nt->Add(fileName->c_str());
for (int i=0; i<2; i++) {
chain[i]->SetBranchAddress("totScanResults",&totScanRes[i]);
chain[i]->SetBranchAddress("totScanRaw",&totScanRaw[i]);
chain[i]->SetBranchAddress("totScanConfig",&ScanConfig[i]);
chain[i]->SetBranchAddress("totScanTime",&ScanTime[i]);
chain[i]->SetBranchAddress("totScanPP0",&ScanPP0[i]);
}
totMean1 = new TH1F("hMean1", "Mean of ALL Pixels", 1000, 0, 5000);
for (int px = 0; px < MAX_PIXEL; px++){
totMean1->Fill(totScanRaw[0]->TOT_mean[mod][1][px], 1);
}
When I try to run my executable it crashes just before this line where I try to set totMean1.
There are other parts to the code, but this is where the failure happens and I’m not sure why.
Any help or feedback would be greatly appreciated.
Regards,
Paul