# Newbie

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

[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:** 94

---

## [Argc argv example?](https://root-forum.cern.ch/t/argc-argv-example/37791)

<div class="topic-metadata">

**Author:** [@TimFulcher](https://root-forum.cern.ch/u/TimFulcher)\
**Replies:** 7\
**Last updated:** [July 8, 2020, 3:19pm UTC](https://root-forum.cern.ch/t/argc-argv-example/37791 "2020-07-08T15:19:22Z")

</div>

Hi all, is there a simple example for command line arguments in the tutorials? Regards and thanks. Tim

---

## [Getting x and x values from several different TH2 using loop to fill TH1 histograms](https://root-forum.cern.ch/t/getting-x-and-x-values-from-several-different-th2-using-loop-to-fill-th1-histograms/40308)

<div class="topic-metadata">

**Author:** [@Prya13](https://root-forum.cern.ch/u/Prya13)\
**Replies:** 2\
**Last updated:** [July 8, 2020, 1:53pm UTC](https://root-forum.cern.ch/t/getting-x-and-x-values-from-several-different-th2-using-loop-to-fill-th1-histograms/40308 "2020-07-08T13:53:20Z")

</div>

Hello All, I have several TH2 histograms and I want to get values for x and y axis then use these values to plot new TH1. I have tried: for (int isect=0; isect\<NSECTORS;isect++) { name = "h\_ntrig"; name += isec…

---

## [Fatal error when starting up ROOT for the first time](https://root-forum.cern.ch/t/fatal-error-when-starting-up-root-for-the-first-time/40301)

<div class="topic-metadata">

**Author:** [@AlexK](https://root-forum.cern.ch/u/AlexK)\
**Replies:** 1\
**Last updated:** [July 8, 2020, 6:28am UTC](https://root-forum.cern.ch/t/fatal-error-when-starting-up-root-for-the-first-time/40301 "2020-07-08T06:28:17Z")

</div>

Please read tips for efficient and successful posting and posting code ROOT Version: 6.22.00 and 6.18.04 Platform: Windows 10 Compiler: Command Prompt? Hi, I installed ROOT version 6.22.00 as well as the Cmake, Vi…

---

## [How to execute a python macro](https://root-forum.cern.ch/t/how-to-execute-a-python-macro/40309)

<div class="topic-metadata">

**Author:** [@Edward\_Finkelstein](https://root-forum.cern.ch/u/Edward_Finkelstein)\
**Replies:** 1\
**Last updated:** [July 8, 2020, 5:46am UTC](https://root-forum.cern.ch/t/how-to-execute-a-python-macro/40309 "2020-07-08T05:46:25Z")

</div>

Hello, I am trying to execute a python code in Pyroot, but I don’t know how to do it. I know that to execute a macro at the root prompt, one types .x \<file\_name\> but how do you do that for a python code? ROOT Version: …

---

## [Piece-wise polynomial fitting](https://root-forum.cern.ch/t/piece-wise-polynomial-fitting/40237)

<div class="topic-metadata">

**Author:** [@Abhinab\_Mukhopadhyay](https://root-forum.cern.ch/u/Abhinab_Mukhopadhyay)\
**Replies:** 5\
**Last updated:** [July 7, 2020, 5:12pm UTC](https://root-forum.cern.ch/t/piece-wise-polynomial-fitting/40237 "2020-07-07T17:12:16Z")

</div>

Hi, So I am having some issues regarding fitting a section of data sets. It seems it doesn’t fit the last few data sets. I have tried using code similar to TF1 \*f4= new TF1("f4", "(pol3)\*(x\<500)+(pol3)\*(x\>=500 && x\<=60…

---

## [Draw two TH2 on the same canvas with different Yaxis](https://root-forum.cern.ch/t/draw-two-th2-on-the-same-canvas-with-different-yaxis/40285)

<div class="topic-metadata">

**Author:** [@aciarma](https://root-forum.cern.ch/u/aciarma)\
**Replies:** 1\
**Last updated:** [July 7, 2020, 9:16am UTC](https://root-forum.cern.ch/t/draw-two-th2-on-the-same-canvas-with-different-yaxis/40285 "2020-07-07T09:16:31Z")

</div>

Hi, I am trying to draw on the same canvas two TH2 where the X-axis is in common while the Y-axis is different for the two (and I have no interest on the Z-axis). I do know how to draw a new TGaxis on the top/right side…

---

## [What file type to save TFitResultPtr](https://root-forum.cern.ch/t/what-file-type-to-save-tfitresultptr/40243)

<div class="topic-metadata">

**Author:** [@leon1122](https://root-forum.cern.ch/u/leon1122)\
**Replies:** 3\
**Last updated:** [July 6, 2020, 5:02pm UTC](https://root-forum.cern.ch/t/what-file-type-to-save-tfitresultptr/40243 "2020-07-06T17:02:14Z")

</div>

I’m trying to write the fit parameters of a histogram to a file using TFitResultPtr as described in section 7.7.7 of this article. i.e. TFitResultPtr r = hist-\>Fit(myFunction,"S"); TFile f("example.txt","create") r-\>Wri…

---

## [Setting ROOT for a dummie](https://root-forum.cern.ch/t/setting-root-for-a-dummie/40245)

<div class="topic-metadata">

**Author:** [@Natalia\_Lisowska](https://root-forum.cern.ch/u/Natalia_Lisowska)\
**Replies:** 13\
**Last updated:** [July 6, 2020, 1:28pm UTC](https://root-forum.cern.ch/t/setting-root-for-a-dummie/40245 "2020-07-06T13:28:15Z")

</div>

Hi, I am totally new to linux and I have to start root. I am trying to do that with this build from source instruction and in the quick start point 4 I copy “make --build . --target install \[-- \]” but I do not know wha…

---

## [Extracting Data from a TH1F and a TNtuple (Pyroot)](https://root-forum.cern.ch/t/extracting-data-from-a-th1f-and-a-tntuple-pyroot/40236)

<div class="topic-metadata">

**Author:** [@Daniel\_Ricardo\_Vega](https://root-forum.cern.ch/u/Daniel_Ricardo_Vega)\
**Replies:** 2\
**Last updated:** [July 5, 2020, 3:06am UTC](https://root-forum.cern.ch/t/extracting-data-from-a-th1f-and-a-tntuple-pyroot/40236 "2020-07-05T03:06:53Z")

</div>

ROOT Version: root-6.20.04 Platform: Any/All Compiler: Python 2.7.16 I am trying to extract different data points from a root file. Inside the root file it contains TH1F and a TNtuple with multiple leaves. I have t…

---

## [How do I copy a leaf from many ROOT files into one?](https://root-forum.cern.ch/t/how-do-i-copy-a-leaf-from-many-root-files-into-one/40233)

<div class="topic-metadata">

**Author:** [@KAM](https://root-forum.cern.ch/u/KAM)\
**Replies:** 1\
**Last updated:** [July 4, 2020, 10:02pm UTC](https://root-forum.cern.ch/t/how-do-i-copy-a-leaf-from-many-root-files-into-one/40233 "2020-07-04T22:02:59Z")

</div>

Please read tips for efficient and successful posting and posting code ROOT Version: Not Provided Platform: Not Provided Compiler: Not Provided I have several hundred ROOT files, all with the same Tree structure. T…

---

## [Installing root cmake](https://root-forum.cern.ch/t/installing-root-cmake/39653)

<div class="topic-metadata">

**Author:** [@kz200](https://root-forum.cern.ch/u/kz200)\
**Replies:** 14\
**Last updated:** [July 4, 2020, 5:32pm UTC](https://root-forum.cern.ch/t/installing-root-cmake/39653 "2020-07-04T17:32:45Z")

</div>

\_ Hi ROOT users, I am installing root and when I tried cmake it, it gives me this error message. It’s not clear to me what went wrong. It would be much appreciated if someone could help me out. \[ 45%\] Building CXX obj…

---

## [Entries (GetEntries) vs instances (Scan) - One entry but 566 instances - What is an instance as opposed to an entry?](https://root-forum.cern.ch/t/entries-getentries-vs-instances-scan-one-entry-but-566-instances-what-is-an-instance-as-opposed-to-an-entry/40201)

<div class="topic-metadata">

**Author:** [@alandou](https://root-forum.cern.ch/u/alandou)\
**Replies:** 8\
**Last updated:** [July 3, 2020, 5:07pm UTC](https://root-forum.cern.ch/t/entries-getentries-vs-instances-scan-one-entry-but-566-instances-what-is-an-instance-as-opposed-to-an-entry/40201 "2020-07-03T17:07:23Z")

</div>

Hi, I am looking at a root file that has 566 track objects stored inside. I’m not sure I can say 566 entries as .GetEntries() returns the value 1. When I .Scan() the tree however, it returns 566 so-called instances. I t…

---

## [Can't fit a histogram loaded from file](https://root-forum.cern.ch/t/cant-fit-a-histogram-loaded-from-file/40215)

<div class="topic-metadata">

**Author:** [@leon1122](https://root-forum.cern.ch/u/leon1122)\
**Replies:** 3\
**Last updated:** [July 3, 2020, 12:52pm UTC](https://root-forum.cern.ch/t/cant-fit-a-histogram-loaded-from-file/40215 "2020-07-03T12:52:27Z")

</div>

In the below code, I read a histogram from a file and attach it to the variable c1. I used the exact same format as section 5.11 of this article. Then I attempt to fit and draw the histogram. void rnf(){ TFile hist("Ga…

---

## [Filling objects in pyROOT](https://root-forum.cern.ch/t/filling-objects-in-pyroot/39988)

<div class="topic-metadata">

**Author:** [@vcroft](https://root-forum.cern.ch/u/vcroft)\
**Replies:** 12\
**Last updated:** [July 3, 2020, 12:51pm UTC](https://root-forum.cern.ch/t/filling-objects-in-pyroot/39988 "2020-07-03T12:51:46Z")

</div>

Howdy, I’m wondering if there is an option/solution to the \[fillAnyObject\](https://root.cern/doc/master/df005\_\_fillAnyObject\_8C.html) in pyROOT yet? I’m trying to fill \[RooUnfoldResponse\](https://statisticalmethods.web.c…

---

## [Creating histos trough for loop (PyROOT)](https://root-forum.cern.ch/t/creating-histos-trough-for-loop-pyroot/40217)

<div class="topic-metadata">

**Author:** [@Jailbone](https://root-forum.cern.ch/u/Jailbone)\
**Replies:** 1\
**Last updated:** [July 3, 2020, 8:29am UTC](https://root-forum.cern.ch/t/creating-histos-trough-for-loop-pyroot/40217 "2020-07-03T08:29:02Z")

</div>

I am trying to get a feel for pyRoot and have a basic beginner question: How do I create Histograms trough a loop? I’ve got this code which should create two identical histograms and save them to a root file. I know th…

---

## [What is faster?](https://root-forum.cern.ch/t/what-is-faster/40199)

<div class="topic-metadata">

**Author:** [@Newbie](https://root-forum.cern.ch/u/Newbie)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 12:48pm UTC](https://root-forum.cern.ch/t/what-is-faster/40199 "2020-07-02T12:48:10Z")

</div>

Dear, I was wondering what is faster when using trees: Filling a histogram in a loop Use the Draw option while requiring some specific events Thanks!!

---

## [Plot boxes over histogram](https://root-forum.cern.ch/t/plot-boxes-over-histogram/40187)

<div class="topic-metadata">

**Author:** [@Juan\_Sanchez](https://root-forum.cern.ch/u/Juan_Sanchez)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 6:00am UTC](https://root-forum.cern.ch/t/plot-boxes-over-histogram/40187 "2020-07-02T06:00:42Z")

</div>

Hello, I am trying to plot several boxes over a histogram in a single canvas and pad. When I draw the boxes and histogram and save the canvas, only the boxes that I drew appear but not the histogram. The boxes are set to…

---

## [GetEntries selection string help](https://root-forum.cern.ch/t/getentries-selection-string-help/40191)

<div class="topic-metadata">

**Author:** [@asanch25](https://root-forum.cern.ch/u/asanch25)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 5:08am UTC](https://root-forum.cern.ch/t/getentries-selection-string-help/40191 "2020-07-02T05:08:10Z")

</div>

I need some help using the GetEntries command in root. I have a root file with 3 million entries in a tree named “store” and I know that by using the command store-\>GetEntries(“x\_det\>-100”) Root will return the number …

---

## [Filling data to a histogram using TH1F](https://root-forum.cern.ch/t/filling-data-to-a-histogram-using-th1f/40143)

<div class="topic-metadata">

**Author:** [@Daniel\_Ricardo\_Vega](https://root-forum.cern.ch/u/Daniel_Ricardo_Vega)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 4:55am UTC](https://root-forum.cern.ch/t/filling-data-to-a-histogram-using-th1f/40143 "2020-07-02T04:55:42Z")

</div>

ROOT Version: 6.20.04 Platform: Any/All Compiler: Python 2.7.16 I am new to ROOT and python, I’ve been trying to learn it on my own in order to join a research group on campus. The task is to find the invariant mass …

---

## [Bugs in "TFile" when using C++17?](https://root-forum.cern.ch/t/bugs-in-tfile-when-using-c-17/40168)

<div class="topic-metadata">

**Author:** [@ed20](https://root-forum.cern.ch/u/ed20)\
**Replies:** 2\
**Last updated:** [July 1, 2020, 5:41pm UTC](https://root-forum.cern.ch/t/bugs-in-tfile-when-using-c-17/40168 "2020-07-01T17:41:03Z")

</div>

Sorry if this question is too basic; I am very new to ROOT. I am trying to compile a program using some ROOT header files and the following Makefile options: CXX = g++ CXXFLAGS = -march=native \`root-config --cflags --li…

---

## [Get the number of entries in a branch that are within certain restrictions](https://root-forum.cern.ch/t/get-the-number-of-entries-in-a-branch-that-are-within-certain-restrictions/40183)

<div class="topic-metadata">

**Author:** [@asanch25](https://root-forum.cern.ch/u/asanch25)\
**Replies:** 4\
**Last updated:** [July 1, 2020, 4:27pm UTC](https://root-forum.cern.ch/t/get-the-number-of-entries-in-a-branch-that-are-within-certain-restrictions/40183 "2020-07-01T16:27:00Z")

</div>

I was wondering if there was an easier way to get the number of entries within a tree that fit a certain restriction. For example, the name of my tree is “store” and I know that using the command store-\>Draw(“x\_det”,”x\_…

---

## [How to make a macro with multiple functions](https://root-forum.cern.ch/t/how-to-make-a-macro-with-multiple-functions/40172)

<div class="topic-metadata">

**Author:** [@leon1122](https://root-forum.cern.ch/u/leon1122)\
**Replies:** 2\
**Last updated:** [July 1, 2020, 10:46am UTC](https://root-forum.cern.ch/t/how-to-make-a-macro-with-multiple-functions/40172 "2020-07-01T10:46:38Z")

</div>

Hello, I’m quite new to ROOT and C++. I’m trying to write a macro with multiple functions for the first time, and I’ve run into some trouble. The below macro is saved as Task.c and consists of two functions that sort 20 …

---

## [Spline "fitting"](https://root-forum.cern.ch/t/spline-fitting/40127)

<div class="topic-metadata">

**Author:** [@Abhinab\_Mukhopadhyay](https://root-forum.cern.ch/u/Abhinab_Mukhopadhyay)\
**Replies:** 9\
**Last updated:** [June 30, 2020, 4:45pm UTC](https://root-forum.cern.ch/t/spline-fitting/40127 "2020-06-30T16:45:23Z")

</div>

Hi, So I am having problems with TSpline fitting for some data sets. I wanted to try TSpline over normal fitting on some suggestions. The TSpline fits perfectly for small data sets close together but for this data set, …

---

## [Histogram is empty](https://root-forum.cern.ch/t/histogram-is-empty/40147)

<div class="topic-metadata">

**Author:** [@KatR](https://root-forum.cern.ch/u/KatR)\
**Replies:** 3\
**Last updated:** [June 30, 2020, 2:53pm UTC](https://root-forum.cern.ch/t/histogram-is-empty/40147 "2020-06-30T14:53:09Z")

</div>

Hi all, I’ll be missing something obvious but I really can’t work out why this histogram isn’t drawing. It shows 155 events in the legend but with mean and std deviation zero, but when I put a print statement after ‘Fill…

---

## [How to read a tree with a split-level branch?](https://root-forum.cern.ch/t/how-to-read-a-tree-with-a-split-level-branch/40138)

<div class="topic-metadata">

**Author:** [@Bassam](https://root-forum.cern.ch/u/Bassam)\
**Replies:** 2\
**Last updated:** [June 29, 2020, 9:04pm UTC](https://root-forum.cern.ch/t/how-to-read-a-tree-with-a-split-level-branch/40138 "2020-06-29T21:04:30Z")

</div>

I want to see if I am thinking about this correctly: Let’s consider the following example: We have a tree with a branch named Events that stores events of class MyEvent. In this class, there are member functions RunId(…

---

## [How to set conditions on fit parameters?](https://root-forum.cern.ch/t/how-to-set-conditions-on-fit-parameters/40137)

<div class="topic-metadata">

**Author:** [@Va\_Findesiecle](https://root-forum.cern.ch/u/Va_Findesiecle)\
**Replies:** 3\
**Last updated:** [June 29, 2020, 5:23pm UTC](https://root-forum.cern.ch/t/how-to-set-conditions-on-fit-parameters/40137 "2020-06-29T17:23:38Z")

</div>

I have the function that I use to fit: Double\_t fun(Double\_t \*x, Double\_t \*par) { Double\_t z2 = x\[0\] \* x\[0\] / par\[0\] / par\[0\] + x\[1\] \* x\[1\] / par\[1\] / par\[1\]; z2 \*= par\[2\] \* par\[2\]; return -sqrt(z2) + par\[3…

---

## [Makefile and LInkdef.h](https://root-forum.cern.ch/t/makefile-and-linkdef-h/40129)

<div class="topic-metadata">

**Author:** [@mmk](https://root-forum.cern.ch/u/mmk)\
**Replies:** 2\
**Last updated:** [June 29, 2020, 3:40pm UTC](https://root-forum.cern.ch/t/makefile-and-linkdef-h/40129 "2020-06-29T15:40:00Z")

</div>

I’m following a tutorial for the analysis of ATLAS Dataset, it has a makefile and linkdef.h file, it was working fine when I had only one class(eventloop.cpp and eventloop.h) when I added another class I’m unable to a…

---

## [TLegend with solid line surrounded by dashes](https://root-forum.cern.ch/t/tlegend-with-solid-line-surrounded-by-dashes/40136)

<div class="topic-metadata">

**Author:** [@JackLindon](https://root-forum.cern.ch/u/JackLindon)\
**Replies:** 1\
**Last updated:** [June 29, 2020, 2:40pm UTC](https://root-forum.cern.ch/t/tlegend-with-solid-line-surrounded-by-dashes/40136 "2020-06-29T14:40:00Z")

</div>

Hi, How would I produce a legend entry like the predicted cross-section entry here that has a solid line surrounded by dashes?

---

## [Reconstruction of top quark](https://root-forum.cern.ch/t/reconstruction-of-top-quark/40128)

<div class="topic-metadata">

**Author:** [@mohebtash](https://root-forum.cern.ch/u/mohebtash)\
**Replies:** 2\
**Last updated:** [June 29, 2020, 7:11am UTC](https://root-forum.cern.ch/t/reconstruction-of-top-quark/40128 "2020-06-29T07:11:51Z")

</div>

hello everyone I have a ttree file and I should extract semileptonic events from it but I don’t know what I should do, can you help me?\_\_\_ Please read tips for efficient and successful posting and posting code ROOT Ve…

---

## [Getting higher calls for fitting](https://root-forum.cern.ch/t/getting-higher-calls-for-fitting/40071)

<div class="topic-metadata">

**Author:** [@Abhinab\_Mukhopadhyay](https://root-forum.cern.ch/u/Abhinab_Mukhopadhyay)\
**Replies:** 3\
**Last updated:** [June 25, 2020, 7:54pm UTC](https://root-forum.cern.ch/t/getting-higher-calls-for-fitting/40071 "2020-06-25T19:54:52Z")

</div>

Hi, So I am pretty new to fitting, how would you increase the number of calls do when fitting custom functions, I know a call is a number of times it calls the actual function and I have an intuition that higher the cal…

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

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