Error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >::Scalar,

Hi Everyone,
Sorry if this question I am asking is trivial, but I can’t see where the error comes from.
In fact I am trying to get a reduiced tree from a big one, and have these errors:

ElectronLooper.cc:81:77: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >::Scalar, float&)'
     diElectMass->Fill((els_p4().at(0)+els_p4().at(1)).mass(), evt_scale1fb()); 
                                                                             ^
ElectronLooper.cc:81:77: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:82:68: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >, float&)'
     diElectPt->Fill((els_p4().at(0)+els_p4().at(1)), evt_scale1fb());
                                                                    ^
ElectronLooper.cc:82:68: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:83:73: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >::Scalar, float&)'
     diElectEn->Fill(els_p4().at(0).e()+els_p4().at(1).e(),evt_scale1fb());
                                                                         ^
ElectronLooper.cc:83:73: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:86:70: error: no matching function for call to 'TBranch::Fill(Float_t&, Float_t&, float&)'
     ElectronEta->Fill(electron_eta[0],electron_eta[1], evt_scale1fb())
                                                                      ^
ElectronLooper.cc:86:70: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 3 provided
ElectronLooper.cc:98:82: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >::Scalar, float&)'
       oneclusterMass->Fill((els_p4().at(0)+els_p4().at(1)).mass(), evt_scale1fb()); 
                                                                                  ^
ElectronLooper.cc:98:82: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:99:73: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >, float&)'
       oneclusterPt->Fill((els_p4().at(0)+els_p4().at(1)), evt_scale1fb());
                                                                         ^
ElectronLooper.cc:99:73: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:102:96: error: no matching function for call to 'TBranch::Fill(Float_t&, Float_t&, float&)'
       oneclusterEta->Fill(electron_eta_onecluster[0],electron_eta_onecluster[1], evt_scale1fb());
                                                                                                ^
ElectronLooper.cc:102:96: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 3 provided
ElectronLooper.cc:103:78: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >::Scalar, float&)'
       oneclusterEn->Fill(els_p4().at(0).e()+els_p4().at(1).e(),evt_scale1fb())
                                                                              ^
ElectronLooper.cc:103:78: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:108:78: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >::Scalar, float&)'
       goldenMass->Fill((els_p4().at(0)+els_p4().at(1)).mass(), evt_scale1fb()); 
                                                                              ^
ElectronLooper.cc:108:78: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:109:69: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >, float&)'
       goldenPt->Fill((els_p4().at(0)+els_p4().at(1)), evt_scale1fb());
                                                                     ^
ElectronLooper.cc:109:69: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 2 provided
ElectronLooper.cc:112:84: error: no matching function for call to 'TBranch::Fill(Float_t&, Float_t&, float&)'
       goldenEta->Fill(electron_eta_golden[0],electron_eta_golden[1], evt_scale1fb());
                                                                                    ^
ElectronLooper.cc:112:84: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();
                      ^
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note:   candidate expects 0 arguments, 3 provided
ElectronLooper.cc:113:74: error: no matching function for call to 'TBranch::Fill(ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<float> >::Scalar, float&)'
       goldenEn->Fill(els_p4().at(0).e()+els_p4().at(1).e(),evt_scale1fb())
                                                                          ^
ElectronLooper.cc:113:74: note: candidate is:
In file included from ./CORE/CMS2.h:7:0,
                 from ElectronLooper.cc:4:
/cvmfs/cms.cern.ch/slc6_amd64_gcc493/cms/cmssw/CMSSW_7_6_3/external/slc6_amd64_gcc493/bin/../../../../../../lcg/root/6.02.12-kpegke4/include/TBranch.h:140:22: note: virtual Int_t TBranch::Fill()
    virtual Int_t     Fill();

I attached the files. There is a subdirectory in the directory where are these files, named CORE it’s very big but if you need it I can try to attach it
Thanks for helping.
cheers
ElectronLooper.cc (7.59 KB)
CMS2.h (1.28 MB)
CMS2.cc (94.5 KB)
mc_small.txt (374 Bytes)

Search for “Fill()” in the ROOT Primer -> File I/O and Parallel Analysis -> N-tuples in ROOT -> Storing Arbitrary N-tuples chapter, in the ROOT User’s Guide -> Trees chapter and in ${ROOTSYS}/tutorials/tree tutorials.

Hi Pepe,
thanks for your recommendation it helps me a lot, now it works :slight_smile: .
cheers