  In this work, we calculate energy loss of heavy quark (charm and bottom) due to elastic collisions and gluon radiation in hot/dense medium. The collisional energy loss has been obtained using QCD calculations. The radiative energy loss is calculated using reaction operator formalism and generalized dead cone approach. We rederive the energy loss expression using same assumptions as generalized dead cone approach but obtain slightly different results. We also improve the model employed to calculate path length and the system evolution. The nuclear modification factors $R_{AA}$ including shadowing and energy loss are evaluated for $B$ and $D$ mesons and are compared with the measurements in PbPb collision at $\sqrt{s_{NN}}$ = 2.76 TeV and with the D meson and Heavy flavour (HF) electrons measurements in AuAu collision at $\sqrt{s_{NN}}$ = 200 GeV. The radiative energy loss calculated by reaction operator formalism added with collisional energy loss describes the RHIC HF electron suppression in high $p_{T}$ range. It also describes the LHC measurement of $B$ meson suppression but overestimates the suppression of $D$ meson. The radiative energy loss from generalized dead cone approach describes the charm suppression at both RHIC as well as LHC energies and requires energy loss due to collisions to be added in order to describe the bottom suppression at LHC. 
Constraining heavy quark energy loss using $B$ and $D$ meson   measurements in heavy ion collision at RHIC and LHC energies