# Newbie

**URL:** https://root-forum.cern.ch/c/newbie/26.md?page=32

[Latest](https://root-forum.cern.ch/latest.md) · [Categories](https://root-forum.cern.ch/categories.md) · [Tags](https://root-forum.cern.ch/tags.md)

**Page:** 33

---

## [Create a variable binning TH1D knowing only bin centers and contents](https://root-forum.cern.ch/t/create-a-variable-binning-th1d-knowing-only-bin-centers-and-contents/54932)

<div class="topic-metadata">

**Author:** [@atha.stam](https://root-forum.cern.ch/u/atha.stam)\
**Replies:** 3\
**Last updated:** [May 18, 2023, 9:27pm UTC](https://root-forum.cern.ch/t/create-a-variable-binning-th1d-knowing-only-bin-centers-and-contents/54932 "2023-05-18T21:27:38Z")

</div>

Hello rooters, I have a set of (x,y) points that are part of a distribution, so I want to make a histogram. The binning is variable but I don’t know how it got created. What I have is the bin center and the bin content…

---

## [The histogram cannot read rootfile to fillup. It is just empty](https://root-forum.cern.ch/t/the-histogram-cannot-read-rootfile-to-fillup-it-is-just-empty/54892)

<div class="topic-metadata">

**Author:** [@sagar](https://root-forum.cern.ch/u/sagar)\
**Replies:** 2\
**Last updated:** [May 18, 2023, 5:52pm UTC](https://root-forum.cern.ch/t/the-histogram-cannot-read-rootfile-to-fillup-it-is-just-empty/54892 "2023-05-18T17:52:02Z")

</div>

ROOT Version: latest Platform: M1 Compiler: VSCode I am having a hard time making a histogram from the root file, every time it displays an empty canvas. But using direct commands like DataTree-\>Draw(“SampleStream.ch0…

---

## [Error when accessing the root file](https://root-forum.cern.ch/t/error-when-accessing-the-root-file/54910)

<div class="topic-metadata">

**Author:** [@azinbeigi](https://root-forum.cern.ch/u/azinbeigi)\
**Replies:** 1\
**Last updated:** [May 17, 2023, 8:40pm UTC](https://root-forum.cern.ch/t/error-when-accessing-the-root-file/54910 "2023-05-17T20:40:44Z")

</div>

Please read tips for efficient and successful posting and posting code ROOT Version: 6.26.06 Platform: Cedar compute Canada cluster Compiler: gcc Hi Everyone, I get an error while trying to access a phase space in…

---

## [No window popping up with Draw()](https://root-forum.cern.ch/t/no-window-popping-up-with-draw/54913)

<div class="topic-metadata">

**Author:** [@samfred](https://root-forum.cern.ch/u/samfred)\
**Replies:** 1\
**Last updated:** [May 17, 2023, 7:52pm UTC](https://root-forum.cern.ch/t/no-window-popping-up-with-draw/54913 "2023-05-17T19:52:00Z")

</div>

I am having the same problem as the person here. I have root running on a Ubuntu terminal on my Windows machine and am working through the primer, and when attempting to plot graphs, nothing shows. I am able to save the …

---

## [Redefinition error](https://root-forum.cern.ch/t/redefinition-error/54881)

<div class="topic-metadata">

**Author:** [@samfred](https://root-forum.cern.ch/u/samfred)\
**Replies:** 4\
**Last updated:** [May 17, 2023, 7:31pm UTC](https://root-forum.cern.ch/t/redefinition-error/54881 "2023-05-17T19:31:41Z")

</div>

I am trying to run the slits.C file from the tutorial found on the main site but I keep getting “error: redefinition of ”. I saw someone else solved their problem by updating their ROOT version, but I have v6.28 and stil…

---

## [ROOT and Jupyter notebook on mac](https://root-forum.cern.ch/t/root-and-jupyter-notebook-on-mac/54884)

<div class="topic-metadata">

**Author:** [@Arakjiomar](https://root-forum.cern.ch/u/Arakjiomar)\
**Replies:** 2\
**Last updated:** [May 17, 2023, 8:09am UTC](https://root-forum.cern.ch/t/root-and-jupyter-notebook-on-mac/54884 "2023-05-17T08:09:51Z")

</div>

ROOT Version: 6.26/06 Platform: Pyroot Compiler: Not Provided

---

## [Add legend in roofit](https://root-forum.cern.ch/t/add-legend-in-roofit/54789)

<div class="topic-metadata">

**Author:** [@sanjeeda](https://root-forum.cern.ch/u/sanjeeda)\
**Replies:** 11\
**Last updated:** [May 16, 2023, 12:55pm UTC](https://root-forum.cern.ch/t/add-legend-in-roofit/54789 "2023-05-16T12:55:22Z")

</div>

Dear experts, I am trying to to add a legend in a roofit code,but I am not sure why this doesn’t work. I am using the lines: \> TLegend \*leg = new TLegend(0.57,0.73,0.78,0.93); \> leg-\>SetBorderSize(0); // no border \>…

---

## [Add No of histories in histogram](https://root-forum.cern.ch/t/add-no-of-histories-in-histogram/54871)

<div class="topic-metadata">

**Author:** [@Saradindu](https://root-forum.cern.ch/u/Saradindu)\
**Replies:** 9\
**Last updated:** [May 16, 2023, 12:10pm UTC](https://root-forum.cern.ch/t/add-no-of-histories-in-histogram/54871 "2023-05-16T12:10:31Z")

</div>

Dear All, I created one histogram where no of entries are 705. These are events with counts greater than zero. Now there are more 191 events whose counts are zero. I want to add these 191 events into the histogram. How…

---

## [TTree::Draw() loop over elements in std::vector\<double\>](https://root-forum.cern.ch/t/ttree-draw-loop-over-elements-in-std-vector-double/54822)

<div class="topic-metadata">

**Author:** [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Replies:** 7\
**Last updated:** [May 16, 2023, 8:38am UTC](https://root-forum.cern.ch/t/ttree-draw-loop-over-elements-in-std-vector-double/54822 "2023-05-16T08:38:54Z")

</div>

Dear experts I want to draw some waveform in a ROOT file root -l somefile.root which needs loops over a std::vector stored in 1 entry. I tried t-\>Draw("vector:Iteration$","Entry$==1", "APL"), just the same method as ar…

---

## [Can not SetBranchAddress for std::vector](https://root-forum.cern.ch/t/can-not-setbranchaddress-for-std-vector/54772)

<div class="topic-metadata">

**Author:** [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Replies:** 3\
**Last updated:** [May 16, 2023, 7:59am UTC](https://root-forum.cern.ch/t/can-not-setbranchaddress-for-std-vector/54772 "2023-05-16T07:59:48Z")

</div>

Dear Experts I want to SetBranchAddress for a std::vector value: SetBranchAddress("someVector", &someVector); but error occurred: Error in \<TTree::SetBranchAddress\>: The pointer type given "Double\_t" (8) does not co…

---

## [Impossible to root -l my .C codes](https://root-forum.cern.ch/t/impossible-to-root-l-my-c-codes/54841)

<div class="topic-metadata">

**Author:** [@Alo](https://root-forum.cern.ch/u/Alo)\
**Replies:** 5\
**Last updated:** [May 15, 2023, 3:01pm UTC](https://root-forum.cern.ch/t/impossible-to-root-l-my-c-codes/54841 "2023-05-15T15:01:58Z")

</div>

Hi everyone, I have a problem with all my .C codes with int main() when I try to execute them with the root -l command. Indeed, when I do this, I obtain : alo@MacBook-Pro TMVA\_TEST\_Run1 % root -l MergeNTuplesForTrainin…

---

## [Multithreading safety when building custom object in RDF Define()](https://root-forum.cern.ch/t/multithreading-safety-when-building-custom-object-in-rdf-define/54827)

<div class="topic-metadata">

**Author:** [@loopset](https://root-forum.cern.ch/u/loopset)\
**Replies:** 3\
**Last updated:** [May 15, 2023, 12:42pm UTC](https://root-forum.cern.ch/t/multithreading-safety-when-building-custom-object-in-rdf-define/54827 "2023-05-15T12:42:28Z")

</div>

Hi! I was build a custom class to store the results of an analysis done with RDataFrame, but I’m encountering a lot of issues when working on ImplicitMT mode, and I suspect I’m missing some kind of MT adaptations in my …

---

## [How can I include a previously created variable in the definition of a TF1 function?](https://root-forum.cern.ch/t/how-can-i-include-a-previously-created-variable-in-the-definition-of-a-tf1-function/54839)

<div class="topic-metadata">

**Author:** [@antares01](https://root-forum.cern.ch/u/antares01)\
**Replies:** 2\
**Last updated:** [May 13, 2023, 9:54am UTC](https://root-forum.cern.ch/t/how-can-i-include-a-previously-created-variable-in-the-definition-of-a-tf1-function/54839 "2023-05-13T09:54:00Z")

</div>

Hi all! I want to make a fit on a TH1F histogram and the fitting function must be a linear combination of 3 normalized gaussians multiplied by a double variable (N in the example below) I’ve previously defined and calcu…

---

## [Fitting of Gaussian on linear background](https://root-forum.cern.ch/t/fitting-of-gaussian-on-linear-background/54836)

<div class="topic-metadata">

**Author:** [@Sabiha\_Tasneem\_JC](https://root-forum.cern.ch/u/Sabiha_Tasneem_JC)\
**Replies:** 1\
**Last updated:** [May 13, 2023, 7:24am UTC](https://root-forum.cern.ch/t/fitting-of-gaussian-on-linear-background/54836 "2023-05-13T07:24:36Z")

</div>

I have an spectrum of 133Ba which has 4 peaks (two are overlapped) on a linear background. I need to fit and find the integral. How can I do the fitting? \_ROOT Version: ROOT 6.26/10 Platform: Not Provided Compiler: No…

---

## [Why do constructors work when TString is passed instead of const char \*?](https://root-forum.cern.ch/t/why-do-constructors-work-when-tstring-is-passed-instead-of-const-char/54830)

<div class="topic-metadata">

**Author:** [@Ako\_b](https://root-forum.cern.ch/u/Ako_b)\
**Replies:** 1\
**Last updated:** [May 12, 2023, 8:25pm UTC](https://root-forum.cern.ch/t/why-do-constructors-work-when-tstring-is-passed-instead-of-const-char/54830 "2023-05-12T20:25:08Z")

</div>

Hello! Actually I never thought why this works: TCut cut(TString("x \> 0")); TString hTitle("title"); TH1D("h", hTitle, 10u, 0.0, 1.0); According to Reference Guide, none of the constructors use TString, they need con…

---

## [Root histo](https://root-forum.cern.ch/t/root-histo/54824)

<div class="topic-metadata">

**Author:** [@Saradindu](https://root-forum.cern.ch/u/Saradindu)\
**Replies:** 8\
**Last updated:** [May 12, 2023, 4:19pm UTC](https://root-forum.cern.ch/t/root-histo/54824 "2023-05-12T16:19:52Z")

</div>

Please read tips for efficient and successful posting and posting code ROOT Version: Not Provided Platform: Not Provided Compiler: Not Provided isto\_energy\_ntracknew.pdf (24.1 KB) Dear All, I want to make these p…

---

## [Set Range of a TTree-\>Draw("histogram2:histogram1")](https://root-forum.cern.ch/t/set-range-of-a-ttree-draw-histogram2-histogram1/54798)

<div class="topic-metadata">

**Author:** [@marlGon1](https://root-forum.cern.ch/u/marlGon1)\
**Replies:** 5\
**Last updated:** [May 10, 2023, 2:03pm UTC](https://root-forum.cern.ch/t/set-range-of-a-ttree-draw-histogram2-histogram1/54798 "2023-05-10T14:03:36Z")

</div>

Hi, I’m working on a detector simulation and I want to study the influence of the detectors positions. I can draw it pretty easily from the simulation’s output root files like that: SimuTree-\>Draw("DetectorEvents.Posi…

---

## [Writing linked TH2F and TVector3 into root file and reading them afterwards](https://root-forum.cern.ch/t/writing-linked-th2f-and-tvector3-into-root-file-and-reading-them-afterwards/54780)

<div class="topic-metadata">

**Author:** [@drsh2306](https://root-forum.cern.ch/u/drsh2306)\
**Replies:** 12\
**Last updated:** [May 10, 2023, 10:19am UTC](https://root-forum.cern.ch/t/writing-linked-th2f-and-tvector3-into-root-file-and-reading-them-afterwards/54780 "2023-05-10T10:19:20Z")

</div>

I am a bit lost in the documentation about read/write into root files. I have: TObjArray of TH2F … histList TObjArray of TVector3 … vecList Each TVector3 belongs to one TH2F. Now suppose I somehow wrote them into …

---

## [Using TCuts in if conditions](https://root-forum.cern.ch/t/using-tcuts-in-if-conditions/54773)

<div class="topic-metadata">

**Author:** [@Natilus](https://root-forum.cern.ch/u/Natilus)\
**Replies:** 6\
**Last updated:** [May 8, 2023, 10:31am UTC](https://root-forum.cern.ch/t/using-tcuts-in-if-conditions/54773 "2023-05-08T10:31:38Z")

</div>

Dear Root experts, I was wondering if I can use a TCut in an “if” condition. For example, let’s say I am reading a branch called “InF\_Lepton1\_isMuon” which contains vectors of int (only 0s or 1s) and fill a histogram. …

---

## [Issues in the conversion of RDataFrame column into a numpy array](https://root-forum.cern.ch/t/issues-in-the-conversion-of-rdataframe-column-into-a-numpy-array/54737)

<div class="topic-metadata">

**Author:** [@soureek](https://root-forum.cern.ch/u/soureek)\
**Replies:** 10\
**Last updated:** [May 7, 2023, 7:13pm UTC](https://root-forum.cern.ch/t/issues-in-the-conversion-of-rdataframe-column-into-a-numpy-array/54737 "2023-05-07T19:13:10Z")

</div>

Dear experts, I am trying to convert a column of a RDataFrame object into a numpy array. The dataFrame is defined on a memory-resident tree created via TTree.MergeTrees(TList). However, the AsNumpy function as shown i…

---

## [How to change the scaling of a TGraph?](https://root-forum.cern.ch/t/how-to-change-the-scaling-of-a-tgraph/54766)

<div class="topic-metadata">

**Author:** [@grattoni](https://root-forum.cern.ch/u/grattoni)\
**Replies:** 1\
**Last updated:** [May 7, 2023, 11:06am UTC](https://root-forum.cern.ch/t/how-to-change-the-scaling-of-a-tgraph/54766 "2023-05-07T11:06:00Z")

</div>

Is there a way to change the scaling of a particular axis without modifying the dataset? I am working with values with magnitude of 10^18 in x axis and 10^-15 on the y axis. ROOT keeps scaling the x axis for x10^15, whi…

---

## [Something quite strange with the linear fit](https://root-forum.cern.ch/t/something-quite-strange-with-the-linear-fit/54758)

<div class="topic-metadata">

**Author:** [@rrapo](https://root-forum.cern.ch/u/rrapo)\
**Replies:** 1\
**Last updated:** [May 6, 2023, 8:44am UTC](https://root-forum.cern.ch/t/something-quite-strange-with-the-linear-fit/54758 "2023-05-06T08:44:14Z")

</div>

Hi! I don’t know exactly what kind of problem I have. let me explain: I wrote this code to fit the data written in the .c file down attached and the fit works (because the error bars are big, but this is not a problem …

---

## [Is ROOT suitable for brownian motion simulation? How to find existing ROOT code except on github?](https://root-forum.cern.ch/t/is-root-suitable-for-brownian-motion-simulation-how-to-find-existing-root-code-except-on-github/54755)

<div class="topic-metadata">

**Author:** [@HOH](https://root-forum.cern.ch/u/HOH)\
**Replies:** 3\
**Last updated:** [May 5, 2023, 1:08pm UTC](https://root-forum.cern.ch/t/is-root-suitable-for-brownian-motion-simulation-how-to-find-existing-root-code-except-on-github/54755 "2023-05-05T13:08:05Z")

</div>

I’m exploring tools for simulating Brownian motion. I have come across ROOT, Matlab, and Python as potential options. It has been suggested that ROOT may be better suited for statistical tasks like this. Is that true? F…

---

## [Can't compile the same C++ code on other computers including ROOT?](https://root-forum.cern.ch/t/cant-compile-the-same-c-code-on-other-computers-including-root/54751)

<div class="topic-metadata">

**Author:** [@grattoni](https://root-forum.cern.ch/u/grattoni)\
**Replies:** 1\
**Last updated:** [May 5, 2023, 11:24am UTC](https://root-forum.cern.ch/t/cant-compile-the-same-c-code-on-other-computers-including-root/54751 "2023-05-05T11:24:27Z")

</div>

\_ROOT Version:\_ROOT 6.26/06 \_Platform:\_macOS Monterey Compiler: clang This is my makefile, $(CXX) $(FLAGS) $(LIBS) -arch $(ARCH) -o $@ $^ where CXX = $(shell root-config --cxx) FLAGS = $(shell root-config --cfla…

---

## [Plotting TGraphs on the same graph](https://root-forum.cern.ch/t/plotting-tgraphs-on-the-same-graph/54727)

<div class="topic-metadata">

**Author:** [@Harriet\_Kumi](https://root-forum.cern.ch/u/Harriet_Kumi)\
**Replies:** 11\
**Last updated:** [May 5, 2023, 8:20am UTC](https://root-forum.cern.ch/t/plotting-tgraphs-on-the-same-graph/54727 "2023-05-05T08:20:33Z")

</div>

Dear all, I want to plot two graphs on the same plot. I have used this but its not plotting. TGraph \*gr1 = new TGraph(n,x1,y1); TGraph \*gr2 = new TGraph(…

---

## [How to use RooDataSet.read when file is in scientific notation?](https://root-forum.cern.ch/t/how-to-use-roodataset-read-when-file-is-in-scientific-notation/54715)

<div class="topic-metadata">

**Author:** [@troppapolvere](https://root-forum.cern.ch/u/troppapolvere)\
**Replies:** 5\
**Last updated:** [May 4, 2023, 7:21am UTC](https://root-forum.cern.ch/t/how-to-use-roodataset-read-when-file-is-in-scientific-notation/54715 "2023-05-04T07:21:44Z")

</div>

Hi there, I haven’t been using ROOT for a long time, and can’t find how to read a dataset from file when it contains numbers like 0.1234e-05. Reproducing the file take a longish time, and convert it is a drag. I am s…

---

## [The current directory (root) is not associated with a file error when looping over input files](https://root-forum.cern.ch/t/the-current-directory-root-is-not-associated-with-a-file-error-when-looping-over-input-files/54716)

<div class="topic-metadata">

**Author:** [@arazquin](https://root-forum.cern.ch/u/arazquin)\
**Replies:** 4\
**Last updated:** [May 3, 2023, 5:06pm UTC](https://root-forum.cern.ch/t/the-current-directory-root-is-not-associated-with-a-file-error-when-looping-over-input-files/54716 "2023-05-03T17:06:37Z")

</div>

ROOT Version: 6.18/00 Platform: Red Hat 8.5.0-16 Compiler: gcc version 8.5.0 Hello everyone, I am trying to loop over several root files to get some information and then dump all of it in one single tree in a separa…

---

## [Save histogram with specific range on x axis](https://root-forum.cern.ch/t/save-histogram-with-specific-range-on-x-axis/54699)

<div class="topic-metadata">

**Author:** [@gurmukh\_dhindsa](https://root-forum.cern.ch/u/gurmukh_dhindsa)\
**Replies:** 3\
**Last updated:** [May 3, 2023, 8:35am UTC](https://root-forum.cern.ch/t/save-histogram-with-specific-range-on-x-axis/54699 "2023-05-03T08:35:56Z")

</div>

Hi I have a histogram(h1) inside data2.root, i want to save some part of this histogram with specific range (-14 to -7) with the same binning, how to do that? I am attaching root file which contains this histogram. Tha…

---

## [How to show the coordinates of a 3D graph](https://root-forum.cern.ch/t/how-to-show-the-coordinates-of-a-3d-graph/54688)

<div class="topic-metadata">

**Author:** [@rrapo](https://root-forum.cern.ch/u/rrapo)\
**Replies:** 3\
**Last updated:** [May 3, 2023, 8:08am UTC](https://root-forum.cern.ch/t/how-to-show-the-coordinates-of-a-3d-graph/54688 "2023-05-03T08:08:45Z")

</div>

ROOT Version: 6.26/06 Compiler: macOS Hi! i have been working on a 3D plot. I have no issue with the plot (I’m attaching the c file and its txt file). But I’d like to show the coordinates of the points on the graph. …

---

## [TEfficiency error bars too big](https://root-forum.cern.ch/t/tefficiency-error-bars-too-big/54588)

<div class="topic-metadata">

**Author:** [@arazquin](https://root-forum.cern.ch/u/arazquin)\
**Replies:** 2\
**Last updated:** [May 2, 2023, 4:07am UTC](https://root-forum.cern.ch/t/tefficiency-error-bars-too-big/54588 "2023-05-02T04:07:01Z")

</div>

ROOT Version: 6.18/00 Platform: Red Hat 8.5.0-16 Compiler: gcc version 8.5.0 Hello experts, I have a question regarding the TEfficiency plots. I am creating the plots as TEfficiency\* pEff = new TEfficiency("eff","S…

[Previous page](https://root-forum.cern.ch/c/newbie/26.md?page=31)

[Next page](https://root-forum.cern.ch/c/newbie/26.md?page=33)
