I am trying to create a histogram that contains the mean pulse of various pulses. I am easily able to create the total pulses and add them all in a histogram. When I come to divide the histogram, that contains the total pulses, with the number of pulses using

```
TH1F hmean = 8*htotal;
hmean->Draw();
```

I get an error

Then I tried using

```
TH1F hmean = 8*(*htotal);
hmean->Draw();
```

and I got

and an empty canvas so, I tried

```
TH1F hmean = 8*htotal;
hmean.Draw();
```

and I got

and an empty canvas.

Note that I am running root on lxplus. Is there a way around it?

1 Like

The TH1F class does not have the “operator*” method defined at all.

There exist various Add, Divide, Multiply and Scale methods: see the TH1 class description.

I tried to use Divide but I don’t know how. I first, created a function that has only the value 1 and then I will try to divide it like this

```
TF1 *constant = new TF1("constant","1",0,channels);
TH1F hmean = htotal->Divide("constant",1.);
hmean->Draw();
```

but i get an error that something must be wrong with TF1 or TH1F, with the arguments of Divide() that is. Any idea on that?

And which one of the three available TH1::Divide methods returns a histogram?

(A small hint: as far as I can see they all return a Bool_t.)

That is true!

But how am I going to create the histogram?

Thank you very much for your help!

It really worked!

Kind regards!

Cheers!!!

I have also tried in macro…but it showing error