I have 2 arrays, the first one contain 8000 entries, the other one contain 69 entries that are the edge of all the bins. Now I want to make an Histogram with on the x the bins of the second array Filled with the data contained in the first one, How can I do???
Hi Stefano,
I’m afraid I don’t understand exactly what you’re trying to do. What’s the problem - defining the histogram bin edges by array2, and filling the histogram by array1? You can do that like this:
Int_t numDataPoints=6000;
Double_t *array1=GetWoldsBestData(numDataPoints); // you have your array 1
Int_t numEdges=69;
Double_t* array2=GetMagicEdges(69); // and your array 2
// create a new histo
// we pass it the bin edges as an array
// as 69 edges contain only 68 bins, we have to specify numEdges-1
TH1F* hMyData=new TH1F("hMyData","my data", numEdges-1, array2);
// fill with a whole array at once
hMyData->FillN(numDataPoints, array1, 0);
hMyData->Draw();
Axel.
Warning in TH1::Build: Replacing existing histogram: h1 (Potential memory leak). TCanvas::MakeDefCanvas: created default TCanvas with name c1
Warning in TCanvas::ResizePad: c1 width changed from 64000 to 10
root [7] Warning in TCanvas::ResizePad: c1 width changed from 64000 to 10