Pedestal subtraction

Hello, I have some data with pedestal is there an efficient way to subtract the pedestal? Do I fit gaussian and subtract the sigma? Do I do average and subtract the mean? I have a root file with a tree and the branches are the channels with their adc values through the events.

Thank you very much in advance.

Dear Elena,

Welcome to the ROOT community!
The answer depends very much on the kind of data you are dealing with and ROOT is not really involved in that.
I am assuming you want to fit a Gaussian distribution on top of some background. A good way to fit a signal on some background is to use as functional form a polynomial (2nd degree to start) plus a Gaussian.
I hope this help.