Hi everyone,
I’m trying to make my macro script into a standalone program and possibly use it on the grid. The problem here is that I kept on getting a seg fault for the compiled program. Here is how it happened:
The program runs fine with SetBranchAddress function alone and the GetEvent section commented out:
int cppTest2();
#[code]
TFile f("/scruser/3/yjf/group10.perf-jets.data10_7TeV.00155228.physics_L1Calo.recon.ESD.f259_JetEtMissDPDModifier000025.v1.EXT0._00001.qcd.root");
TTree* qcd = (TTree*)f.Get(“qcd”);
Int_t nEntriesNtuple = (Int_t)qcd->GetEntries();
std::cout << "Number of entries in the n-tuple is " << nEntriesNtuple << std::endl;
// Declare variables to plot, remember to check the class of the variables
std::vector<Float_t>* m_phi;
//NOTICE THE COMMENTED OUT SECTION
qcd->SetBranchAddress(“jet_AntiKt4H1TopoNew_phi”, &m_phi);
for(Long64_t k=0; k<nEntriesNtuple; ++k) {
// qcd->GetEvent(k);
}
return 0;
}[/code]
or alternatively if I comment out the SetBranchAddress function and uncomment the GetEvent function.
//NOTICE THE COMMENTED OUT SECTION
//qcd->SetBranchAddress("jet_AntiKt4H1TopoNew_phi", &m_phi);
for(Long64_t k=0; k<nEntriesNtuple; ++k) {
qcd->GetEvent(k);
But not when both codes are present, i.e.
[b]qcd->SetBranchAddress("jet_AntiKt4H1TopoNew_phi", &m_phi);[/b]
for(Long64_t k=0; k<nEntriesNtuple; ++k) {
[b]qcd->GetEvent(k); [/b]
I don’t understand what’s going on…can someone please help me? Thanks!