Studies of b hadron decays to final states containing charmonia at LHCb