# Histogram is not being generated

**URL:** <https://root-forum.cern.ch/t/histogram-is-not-being-generated/49684>\
**Category:** Newbie\
**Created:** [April 21, 2022, 8:48pm UTC](https://root-forum.cern.ch/t/histogram-is-not-being-generated/49684 "2022-04-21T20:48:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/roy/32/30362_2.png) [@Roy](https://root-forum.cern.ch/u/Roy)\
**Post date:** [April 21, 2022, 8:48pm UTC](https://root-forum.cern.ch/t/histogram-is-not-being-generated/49684/1 "2022-04-21T20:48:44Z")

</div>

My code doesn’t generate the histogram as expected,

```auto
    Float_t Threshold1;
    TFile* file_input1 = new TFile("current_dec.root", "read");
    TTree* current = (TTree*)file_input1->Get("current_ntuple"); 
    Float_t Curr1;
    current->SetBranchAddress("Current", &Curr1); 
    //current->SetBranchAddress("Voltage", &Volt1);
    ULong64_t mEntries = current->GetEntries(); 
    cout << "This tree contains " << mEntries << " events!" << endl;
    cout << "Loop over " << mEntries << " events!" << endl;
    TH1D* curr_vals1= new TH1D("curr_vals1", "Current Distribution on December", NumBins, 0, 
    NumBins);
    curr_vals1 -> GetXaxis()-> SetTitle("Current [#muA] "); 
    curr_vals1 -> GetYaxis()-> SetTitle("Frequency"); //y label
    Double_t p1 = 0.0;
    Int_t Tot1 = 0;
    for(Int_t f = 0; f < mEntries; f++) 
    {
        currentAna->GetEntry(f);
        curr_vals1->Fill(abs(Curr1));

    }
    TCanvas* c3= new TCanvas("c3"); 
    curr_vals1->Draw(); 
    c3->SetLogy(); 
    c3->Update(); 

```

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 21, 2022, 8:56pm UTC](https://root-forum.cern.ch/t/histogram-is-not-being-generated/49684/2 "2022-04-21T20:56:22Z")

</div>

In the “`for`” loop, try to add a “debug output”:  
`if (f < 100) std::cout << Curr1 << std::endl; // the first 100 entries`
