TH1D histogram Fill function


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


okay, I am trying to make a histogram with two double_t arrays. but when i try to fill the histogram I get an error. here is my code:

//both events and signalsTotal are populated Double_T arrays.
auto c1 = new TCanvas("Mean Signal,"Mean Values");
TH1D* graph1 = new TH1D("Mean_Signals","Mean Signal",8256,0,10000);
graph1->Fill(events,signalsTotal);```

The error message is:
channelTrial.cc:142:33: error: no matching function for call to β€˜TH1D::Fill(Double_t [8256], Double_t [8256])’
 graph1->Fill(events,signalsTotal);

You are passing arrays instead of single numbers. To do what you want to do, use this:

graph1->FillN(8256, events, signalsTotal);
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.