title: Histogram with ntuple using CERN ROOT
body: <p>Can't obtain/fill histogram starting from ntuple using ROOT. </p>
  
  <p>I have been looking for previous answers and they all use ttree, including root documentation. I dont have one. Not new to root, but i struggle A LOT using it. None of the methods found work with my code (or i dont know how to implement them).</p>
  
  <p>This is more or less what i have found everywhere:</p>
  
  <p><a href="https://root.cern.ch/root/roottalk/roottalk03/2620.html" rel="nofollow noreferrer">https://root.cern.ch/root/roottalk/roottalk03/2620.html</a></p>
  
  <p>but no, i am doing TH1F and i have no ttree (see code below) </p>
  
  <pre><code>{    
     gROOT-&gt;Reset();
  
  #include "Riostream.h"
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
    in.open( "somefile.dat");
  
  TNtuple *ntuple = new TNtuple("ntuple","some data from ascii file","index1:index2:index3");
  
  //declare variables, create histograms   
     Double_t x,y,Price[215000],Diff[215000],Ret[215000],trend, Data[215000];
     TFile *f = new TFile("TrendsCountBove.root","RECREATE");
     TH1F *h1 = new TH1F("h1","Retornos",100,-0.3,0.3);
     TH1F *histo = new TH1F ("hist_from_ntuple", "some title", nbins, min,max);
  
  //do some stuff (didn't paste all calculations i do, but that works fine)
  
  for (Int_t i = 0; i+1 &lt; nlines-1; i++) {
       Diff[i] = Price[i+1]-Price[i];
       Ret[i] = TMath::Log(Price[i+1])-TMath::Log(Price[i]);
       h1-&gt;Fill(Ret[i]);
       ntuple-&gt;Fill(i*1.0,Ret[i],Price[i+1]);
    }
  </code></pre>
  
  <p>So, it all works fine, no problem at all. But then again if please somebody could explain me as detailed as possible how can i fill histo with, say, index1, or 2 or 3. I suck at c++ and i dont really like it nor understand it.</p>
  
  <p>I expect a beautiful histogram where i can set all things like title, max and minimum, stat box, etc. By default root does it via ntuple but it's not what i need.</p>
  
  <p>Thank so much in advance.</p>