Home | News | Documentation | Download

ExRootAnalysis: Error in declaring branchElectron variables


#1

Hi I have the following issue -

Trying to make an executable file

 g++ -I. `root-config --libs --cflags` -lRooFitCore -lRooFit -lRooStats -lTMVA -lXMLIO -lTreePlayer -lm -o maini root_root_converter_new.C

g++ -I. `root-config --libs --cflags` -lRooFitCore -lRooFit -lRooStats -lTMVA -lXMLIO -lTreePlayer -lm -o maini root_root_converter_new.C

root_root_converter_new.C: In function ‘int root_root_converter(int, char**)’:
root_root_converter_new.C:127:7: error: ‘Electron’ was not declared in this scope
       Electron *reconele;

The programme I can send to you if needed.
The prog contains this

TClonesArray *branchElectron    = treeReader1->UseBranch("Electron");

Electron *reconele;

      Int_t nnele=Int_t(chain1->GetLeaf("Electron_size")->GetValue());
      double maxelpt=0;
  
      for(int j=0; j<nnele; j++)
        {
          reconele=(Electron*) branchElectron->At(j);
          if(!reconele)continue;
//          if(reconele->Charge==-1 || reconele->Charge==1)
          if(reconele->Charge==1)
           {
            ele_pos_charge=reconele->Charge;
            TLorentzVector tmpreconele;
            tmpreconele.SetPtEtaPhiM(reconele->PT,reconele->Eta,reconele->Phi,0.00051);
	    if(tmpreconele.Pt()>maxelpt)
             {
              maxelpt=tmpreconele.Pt();
              //cout<<maxelpt<<endl;
              ele_pos_pt.push_back(tmpreconele.Pt());
              ele_pos_eta.push_back(tmpreconele.Eta());
              ele_pos_phi.push_back(tmpreconele.Phi());
              ele_pos_e.push_back(tmpreconele.E());
             }
           }
        }

Thanks,
Subhasish


#2

Without seeing the full file, I would guess that you’re missing the definition for Electron. Maybe you forgot to include a header or library when you compiled?


#3

Dear Svpaulauskas,

Thanks for the reply. I have uploaded my file with this reply. Please check the code. Now I am having something different issue as the following while trying to make an executable out of the code -

g++ -I. root-config --libs --cflags -lRooFitCore -lRooFit -lRooStats -lTMVA -lXMLIO -lTreePlayer -lm -o maini root_root_converter_new.C

The output in the terminal is -

/tmp/ccDFVOEr.o: In function main': root_root_converter_new.C:(.text+0x1e5): undefined reference toExRootTreeReader::ExRootTreeReader(TTree*)’
root_root_converter_new.C:(.text+0x217): undefined reference to ExRootTreeReader::UseBranch(char const*)' root_root_converter_new.C:(.text+0x22c): undefined reference toExRootTreeReader::UseBranch(char const*)’
root_root_converter_new.C:(.text+0x241): undefined reference to ExRootTreeReader::UseBranch(char const*)' root_root_converter_new.C:(.text+0x256): undefined reference toExRootTreeReader::UseBranch(char const*)’
root_root_converter_new.C:(.text+0x26b): undefined reference to ExRootTreeReader::UseBranch(char const*)' /tmp/ccDFVOEr.o:root_root_converter_new.C:(.text+0x280): more undefined references toExRootTreeReader::UseBranch(char const*)’ follow
collect2: error: ld returned 1 exit status

Thanks,
Subhasishroot_root_converter_new.C (7.0 KB)


#4

Hi,

this is expected. There is no library specified for “ExRootTreeReader” in the compilation command. That is not a ROOT class so I cannot really suggest a name, it is more an issue of your setup.

Cheers,
D


#5

if memory serves, ExRootTreeReader is coming with Delphes.
you probably need to link against libDelphes.


#6

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.