We present a systematic study of transverse momentum ($p_T$) spectra of hadrons
produced in $p+p$ and in heavy ion collisions at RHIC and LHC energies.
The hadron spectra in $p+p$ collisions can be explained by Tsallis distribution
with two parameters ($T$ and $q$). To explain the hadron spectra in heavy ion
collisions in a wider $p_T$ range we use a modified Tsallis function by
introducing an additional parameter ($\beta$) which accounts for collective
transverse flow. The new analytical function gives a very good description of both mesons
and baryons spectra at all centralities of $Au+Au$ collisions at $\sqrt{s_{NN}}$ = 200 GeV
and $Pb+Pb$ collisions at $\sqrt{s_{NN}}$ = 2.76 TeV.
The parameter representing transverse collective flow increases with system size and is
found to be more for baryons than that for mesons in more central $Au+Au$ collisions.
The non-thermalization parameter ($q$) decreases with centrality in heavy ion collisions
which gives an indication of thermalization in heavy ion collisions at both RHIC and LHC.