"genP4" is a std::vector<LV>, where LV is the Lorentz Vector type.  std::vector<> is a template container class, which stores many of the same type of object sequentially.  LV::pt() method is what you want, but the code you wrote here is calling std::vector<LV>::pt(), which doesn't exist.  You can do that in TTree::Scan and TTree::Draw, because it takes that syntax to mean "call LV::pt() for each LV in the std::vector<LV>".  However, you have to make the additional loop yourself when you write actual code.  You'll further want to select only one item from the std::vector<LV>, which corresponds to the gluon of interest.  Remember, "genP4" stores the LV for each gen particle, including the incoming protons, the pieces of the protons which go into the matrix element calculation, the top, antitop, __possible__ gluon (there doesn't have to be any), and the top and antitop decay products.