# Newbie

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

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

---

## [Saving output as .txt file](https://root-forum.cern.ch/t/saving-output-as-txt-file/41928)

<div class="topic-metadata">

**Author:** [@sanjeeda](https://root-forum.cern.ch/u/sanjeeda)\
**Replies:** 2\
**Last updated:** [October 21, 2020, 1:10pm UTC](https://root-forum.cern.ch/t/saving-output-as-txt-file/41928 "2020-10-21T13:10:40Z")

</div>

Dear Experts, When I do treename-\>Scan(branch:branch:branch), I get the print out on the terminal screen but it does not give the complete output at once and I cannot refer to the results again and again. So is there …

---

## [Memory issues with reading and writing histograms to file](https://root-forum.cern.ch/t/memory-issues-with-reading-and-writing-histograms-to-file/41925)

<div class="topic-metadata">

**Author:** [@Vangi](https://root-forum.cern.ch/u/Vangi)\
**Replies:** 5\
**Last updated:** [October 20, 2020, 1:07pm UTC](https://root-forum.cern.ch/t/memory-issues-with-reading-and-writing-histograms-to-file/41925 "2020-10-20T13:07:50Z")

</div>

Dear ROOTers, For my analysis, I have a piece of code that works fine using nominal systematics. The structure of the code looks something like this std::map \< std::string, TH1\*\> histogram\_map {}; //declare and fill hi…

---

## [Fit function is not right?](https://root-forum.cern.ch/t/fit-function-is-not-right/41921)

<div class="topic-metadata">

**Author:** [@hammiu](https://root-forum.cern.ch/u/hammiu)\
**Replies:** 5\
**Last updated:** [October 20, 2020, 7:47am UTC](https://root-forum.cern.ch/t/fit-function-is-not-right/41921 "2020-10-20T07:47:32Z")

</div>

I have a data set. I tried to fit with Root, but it was not successful. However, when I process this data with Excel, there is not any problems. Could you help me, please? Here is my code #include \<TF1.h\> #include \<TGr…

---

## [TApplication::Run() stucks the terminal](https://root-forum.cern.ch/t/tapplication-run-stucks-the-terminal/41892)

<div class="topic-metadata">

**Author:** [@dsubhro](https://root-forum.cern.ch/u/dsubhro)\
**Replies:** 7\
**Last updated:** [October 20, 2020, 7:16am UTC](https://root-forum.cern.ch/t/tapplication-run-stucks-the-terminal/41892 "2020-10-20T07:16:47Z")

</div>

ROOT Version: 6.22 \_Platform: ubuntu \_Compiler: g++ Hi, I have a code in c++ where I use TApplication to stop terminating the program before the graph Shows. the code: #include \<iostream\> #include "TF1.h" #include …

---

## [Error while merging root files using hadd](https://root-forum.cern.ch/t/error-while-merging-root-files-using-hadd/41919)

<div class="topic-metadata">

**Author:** [@diwakar](https://root-forum.cern.ch/u/diwakar)\
**Replies:** 4\
**Last updated:** [October 20, 2020, 12:16am UTC](https://root-forum.cern.ch/t/error-while-merging-root-files-using-hadd/41919 "2020-10-20T00:16:06Z")

</div>

Hi all, I have about 600 root files. I want to merge them into one using hadd. So i do: ‘’’’’’’’’’’ hadd a.root tree\* ‘’’’’’’’’’’ I do tree\* because all the 600 root files begin with the word ‘tree’. However i get a…

---

## [Curve-fitting in PYROOT showing very high chi-2 values](https://root-forum.cern.ch/t/curve-fitting-in-pyroot-showing-very-high-chi-2-values/41893)

<div class="topic-metadata">

**Author:** [@Urooj\_Murtaza](https://root-forum.cern.ch/u/Urooj_Murtaza)\
**Replies:** 1\
**Last updated:** [October 19, 2020, 12:09pm UTC](https://root-forum.cern.ch/t/curve-fitting-in-pyroot-showing-very-high-chi-2-values/41893 "2020-10-19T12:09:17Z")

</div>

ROOT Version: root\_v6.20.04. I am using pyroot for curve-fitting and I am getting very high chi-2 values. The fit looks ok visually but the fitting results are very odd. Kindly let me know what might be the error. Regar…

---

## [Plotting data from txt file](https://root-forum.cern.ch/t/plotting-data-from-txt-file/41900)

<div class="topic-metadata">

**Author:** [@Shoaib\_Noor](https://root-forum.cern.ch/u/Shoaib_Noor)\
**Replies:** 3\
**Last updated:** [October 19, 2020, 9:58am UTC](https://root-forum.cern.ch/t/plotting-data-from-txt-file/41900 "2020-10-19T09:58:36Z")

</div>

Hi, I am trying to plot the following .txt data: ER.txt (191 Bytes) with the following code: ERes.cpp (484 Bytes) On compiling I get only one graph in place of 4: Please resolve, Thanks. ROOT Version: 6.20 Plat…

---

## [Group similar entries by a common variable in tree](https://root-forum.cern.ch/t/group-similar-entries-by-a-common-variable-in-tree/41894)

<div class="topic-metadata">

**Author:** [@Jyotirmoi](https://root-forum.cern.ch/u/Jyotirmoi)\
**Replies:** 4\
**Last updated:** [October 18, 2020, 4:04pm UTC](https://root-forum.cern.ch/t/group-similar-entries-by-a-common-variable-in-tree/41894 "2020-10-18T16:04:01Z")

</div>

Hi everyone. I am stuck in a problem. The problem is as follows: I have a root file which have a single tree and a single branch. The branch contains the information on the event no’s generated from a MC sample. As ther…

---

## [Getting a 1D histogram by looping over a pair of histograms under multiple categories](https://root-forum.cern.ch/t/getting-a-1d-histogram-by-looping-over-a-pair-of-histograms-under-multiple-categories/41367)

<div class="topic-metadata">

**Author:** [@hep\_1](https://root-forum.cern.ch/u/hep_1)\
**Replies:** 2\
**Last updated:** [October 18, 2020, 7:57pm UTC](https://root-forum.cern.ch/t/getting-a-1d-histogram-by-looping-over-a-pair-of-histograms-under-multiple-categories/41367 "2020-10-18T19:57:54Z")

</div>

So I have a three categories “A”,“B”,“C”. They are stored in a vector called vec\_hist. Within each categories, there are six 2D histograms each of same bin sizes (5 by 6 to be specific) that are named as follows: A ha…

---

## [Error to fit a sin curve](https://root-forum.cern.ch/t/error-to-fit-a-sin-curve/41890)

<div class="topic-metadata">

**Author:** [@dsubhro](https://root-forum.cern.ch/u/dsubhro)\
**Replies:** 2\
**Last updated:** [October 17, 2020, 9:44pm UTC](https://root-forum.cern.ch/t/error-to-fit-a-sin-curve/41890 "2020-10-17T21:44:45Z")

</div>

ROOT Version:6.22 \_Platform:Ubuntu I tried to fit a data which follows sine wave to a sin function(between -10 to 10). The fitted curve is a straight line. Here is the code and the output curve is on c1.pdf { doubl…

---

## [1D-Histrogram with defined bins number and bin width](https://root-forum.cern.ch/t/1d-histrogram-with-defined-bins-number-and-bin-width/41882)

<div class="topic-metadata">

**Author:** [@PeppeSpa](https://root-forum.cern.ch/u/PeppeSpa)\
**Replies:** 2\
**Last updated:** [October 16, 2020, 10:51am UTC](https://root-forum.cern.ch/t/1d-histrogram-with-defined-bins-number-and-bin-width/41882 "2020-10-16T10:51:08Z")

</div>

Hello, I am new to Root. I want to plot a 1d histogram from a text file and I want the number of bins to be independent from the x-range. I have 3 conditions: I do not want to set an x range I want to use 1000 bins I…

---

## [Export data ( .root -\> .txt)](https://root-forum.cern.ch/t/export-data-root-txt/41869)

<div class="topic-metadata">

**Author:** [@Anatoly1](https://root-forum.cern.ch/u/Anatoly1)\
**Replies:** 7\
**Last updated:** [October 16, 2020, 7:04am UTC](https://root-forum.cern.ch/t/export-data-root-txt/41869 "2020-10-16T07:04:35Z")

</div>

Hi, I get a .root file in the example Geant4 how can export data from .root to .txt ? What am I doing wrong? I try this way and get the error (see figure 2): TFile \*f =TFile::Open("yz\_t1.root"); .ls Th1D \*yz; file-\>…

---

## [Segmentation violation in plotting part](https://root-forum.cern.ch/t/segmentation-violation-in-plotting-part/41866)

<div class="topic-metadata">

**Author:** [@StephanMs](https://root-forum.cern.ch/u/StephanMs)\
**Replies:** 3\
**Last updated:** [October 15, 2020, 2:19pm UTC](https://root-forum.cern.ch/t/segmentation-violation-in-plotting-part/41866 "2020-10-15T14:19:23Z")

</div>

Hello! I am using a virtual machine and standard framework for data analysis at 13 TeV. Can’t draw histograms. I carefully followed the readme file, the analysis (for example ZBoson) seems to complete correctly (dataA.r…

---

## [Histogram draw (draw a simple line connecting all histogram bin points)](https://root-forum.cern.ch/t/histogram-draw-draw-a-simple-line-connecting-all-histogram-bin-points/41744)

<div class="topic-metadata">

**Author:** [@NewRootUser](https://root-forum.cern.ch/u/NewRootUser)\
**Replies:** 24\
**Last updated:** [October 14, 2020, 6:02pm UTC](https://root-forum.cern.ch/t/histogram-draw-draw-a-simple-line-connecting-all-histogram-bin-points/41744 "2020-10-14T18:02:26Z")

</div>

I have 3 histogram and 1 graph file. I want to draw the line between the histogram bins directly as it is drawn in case of graph. How can I modify the following code. I’m attaching the file and result file as well rootf…

---

## [Retrieving variables from Tree](https://root-forum.cern.ch/t/retrieving-variables-from-tree/41825)

<div class="topic-metadata">

**Author:** [@sala](https://root-forum.cern.ch/u/sala)\
**Replies:** 6\
**Last updated:** [October 14, 2020, 8:01am UTC](https://root-forum.cern.ch/t/retrieving-variables-from-tree/41825 "2020-10-14T08:01:01Z")

</div>

Hi everyone, I have a beginner’s question. I am trying too manipulate a RooRealVar, and I read somewhere in the forum that the only way to do that is to manipulate variables directly from the tree. So I’m trying to ad…

---

## [Calling FORTRAN executable from ROOT to minimize a function using TMinuit](https://root-forum.cern.ch/t/calling-fortran-executable-from-root-to-minimize-a-function-using-tminuit/41794)

<div class="topic-metadata">

**Author:** [@bagchi](https://root-forum.cern.ch/u/bagchi)\
**Replies:** 3\
**Last updated:** [October 14, 2020, 5:41am UTC](https://root-forum.cern.ch/t/calling-fortran-executable-from-root-to-minimize-a-function-using-tminuit/41794 "2020-10-14T05:41:01Z")

</div>

Sorry for my lame question as I am not so familiar with Minuit and FORTRAN. I have a FORTRAN code that calculates elastic scattering angular distribution. The input is through a .txt file in a particular format. The calc…

---

## [Get the whole weight of a histgram](https://root-forum.cern.ch/t/get-the-whole-weight-of-a-histgram/41833)

<div class="topic-metadata">

**Author:** [@11111](https://root-forum.cern.ch/u/11111)\
**Replies:** 1\
**Last updated:** [October 13, 2020, 7:15am UTC](https://root-forum.cern.ch/t/get-the-whole-weight-of-a-histgram/41833 "2020-10-13T07:15:50Z")

</div>

Using GetEntries(), we can get the whole entries of a hist. Is there a function with which we can get the whole weight of a hist, the sum of each bin’s content? Or we much add them all ?

---

## [How to fit two Gaussians on two seperate peaks in a spectrum?](https://root-forum.cern.ch/t/how-to-fit-two-gaussians-on-two-seperate-peaks-in-a-spectrum/41812)

<div class="topic-metadata">

**Author:** [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Replies:** 2\
**Last updated:** [October 12, 2020, 9:25pm UTC](https://root-forum.cern.ch/t/how-to-fit-two-gaussians-on-two-seperate-peaks-in-a-spectrum/41812 "2020-10-12T21:25:12Z")

</div>

I have a spectrum of data (Sodium\_22.txt) and I would like to fit the two peaks in the data to Gaussians. However, whenever I use the gaus option, my fit fails spectacularly, forming just a straight line at the bottom. H…

---

## [Adding two histograms from two different root directories](https://root-forum.cern.ch/t/adding-two-histograms-from-two-different-root-directories/41807)

<div class="topic-metadata">

**Author:** [@Sbecka](https://root-forum.cern.ch/u/Sbecka)\
**Replies:** 4\
**Last updated:** [October 12, 2020, 8:04pm UTC](https://root-forum.cern.ch/t/adding-two-histograms-from-two-different-root-directories/41807 "2020-10-12T20:04:30Z")

</div>

Hi, I have a root file with two directories, say, dir1 and dir2. The two directories contain two different histograms, hist1 and hist2. I need to add these two histograms. Can anybody please tell me how can I do it from…

---

## [Delete multiple branches from atootfile at once](https://root-forum.cern.ch/t/delete-multiple-branches-from-atootfile-at-once/41809)

<div class="topic-metadata">

**Author:** [@sanjeeda](https://root-forum.cern.ch/u/sanjeeda)\
**Replies:** 7\
**Last updated:** [October 12, 2020, 5:51pm UTC](https://root-forum.cern.ch/t/delete-multiple-branches-from-atootfile-at-once/41809 "2020-10-12T17:51:49Z")

</div>

\_\_ Dear Experts, I want to remove some (about 200) branches from a root file. I tried removing branchs in the following way and it works. TFile f("myfile.root","update"); TTree \*T = (TTree\*)f.Get("treename"); T…

---

## [Covariance matrix calculation after multiplication of two fitting function](https://root-forum.cern.ch/t/covariance-matrix-calculation-after-multiplication-of-two-fitting-function/41816)

<div class="topic-metadata">

**Author:** [@Prabhu](https://root-forum.cern.ch/u/Prabhu)\
**Replies:** 2\
**Last updated:** [October 12, 2020, 4:04pm UTC](https://root-forum.cern.ch/t/covariance-matrix-calculation-after-multiplication-of-two-fitting-function/41816 "2020-10-12T16:04:47Z")

</div>

I have two TF1 functions f1 and f2. f1 is used to fit some data set and f2 is used to fit some other data set. Now I have a 3rd function f3 which is the multiplication of f1 and f2. The parameters and errors in parameter…

---

## [Bins with equal number of entries](https://root-forum.cern.ch/t/bins-with-equal-number-of-entries/41806)

<div class="topic-metadata">

**Author:** [@Newbie](https://root-forum.cern.ch/u/Newbie)\
**Replies:** 3\
**Last updated:** [October 12, 2020, 2:35pm UTC](https://root-forum.cern.ch/t/bins-with-equal-number-of-entries/41806 "2020-10-12T14:35:33Z")

</div>

Dear, I want to have a TH1 binning with every bin having the same number of entries, however, I’m also plotting another histogram on the same canvas, and I want this second TH1 to have the same binning as the first one.…

---

## [ModuleCmd\_Load.c(208):ERROR:105: Unable to locate a modulefile for 'AliPhysics/'](https://root-forum.cern.ch/t/modulecmd-load-c-208-105-unable-to-locate-a-modulefile-for-aliphysics/41799)

<div class="topic-metadata">

**Author:** [@chengtt0406](https://root-forum.cern.ch/u/chengtt0406)\
**Replies:** 1\
**Last updated:** [October 12, 2020, 8:20am UTC](https://root-forum.cern.ch/t/modulecmd-load-c-208-105-unable-to-locate-a-modulefile-for-aliphysics/41799 "2020-10-12T08:20:46Z")

</div>

Hi all， I meet one error when I am trying to enter AliPhysic environment while I am using lxplus. Do you have any idea about this error? I am using this command: /cvmfs/alice.cern.ch/bin/alienv enter VO\_ALICE@AliPhysi…

---

## [How to do b (Jet.BTag) cut form .root file](https://root-forum.cern.ch/t/how-to-do-b-jet-btag-cut-form-root-file/41785)

<div class="topic-metadata">

**Author:** [@masterluke](https://root-forum.cern.ch/u/masterluke)\
**Replies:** 3\
**Last updated:** [October 12, 2020, 2:28am UTC](https://root-forum.cern.ch/t/how-to-do-b-jet-btag-cut-form-root-file/41785 "2020-10-12T02:28:04Z")

</div>

Please read tips for efficient and successful posting and posting code \_ROOT Version:\_6.18.04 Platform: ubuntu 20 Compiler: g++ Hi, I am working with MadGraph5\_aMC@NLO for a SM process simulation. After launch I …

---

## [Include ROOT 6.22 in Visual Studio 2019](https://root-forum.cern.ch/t/include-root-6-22-in-visual-studio-2019/41734)

<div class="topic-metadata">

**Author:** [@Mana](https://root-forum.cern.ch/u/Mana)\
**Replies:** 23\
**Last updated:** [October 9, 2020, 9:19am UTC](https://root-forum.cern.ch/t/include-root-6-22-in-visual-studio-2019/41734 "2020-10-09T09:19:13Z")

</div>

Dear ROOTers, (brief, skippable introduction) I’m currently trying to combine Visual Studio (C++ CLR Empty Project (.NET Framework)) and ROOT: I need to create an analysis tool with some customizable GUI and I would l…

---

## [Error to include root header files in C++](https://root-forum.cern.ch/t/error-to-include-root-header-files-in-c/41777)

<div class="topic-metadata">

**Author:** [@dsubhro](https://root-forum.cern.ch/u/dsubhro)\
**Replies:** 9\
**Last updated:** [October 9, 2020, 8:57am UTC](https://root-forum.cern.ch/t/error-to-include-root-header-files-in-c/41777 "2020-10-09T08:57:57Z")

</div>

Please read tips for efficient and successful posting and posting code ROOT Version: 6.22 Platform: ubuntu 20 Compiler: g++ When I run this code in C++: #include #include “/home/subhrod/root/include/TF1.h” using…

---

## [Is there a way to grab the title of a TH1F histogram and print it to screen?](https://root-forum.cern.ch/t/is-there-a-way-to-grab-the-title-of-a-th1f-histogram-and-print-it-to-screen/41779)

<div class="topic-metadata">

**Author:** [@Cepheides](https://root-forum.cern.ch/u/Cepheides)\
**Replies:** 1\
**Last updated:** [October 9, 2020, 7:13am UTC](https://root-forum.cern.ch/t/is-there-a-way-to-grab-the-title-of-a-th1f-histogram-and-print-it-to-screen/41779 "2020-10-09T07:13:32Z")

</div>

HEP\_practiceV8.C (50.1 KB) I am attempting to debug my code that graphs TH1F histograms and I would like to know if there is any functions that gets the title, so that I may print it to the screen. If not, is there a wa…

---

## [\*\*\* Break \*\*\* segmentation violation closing root](https://root-forum.cern.ch/t/break-segmentation-violation-closing-root/39873)

<div class="topic-metadata">

**Author:** [@coburn](https://root-forum.cern.ch/u/coburn)\
**Replies:** 5\
**Last updated:** [October 8, 2020, 5:06pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-closing-root/39873 "2020-10-08T17:06:45Z")

</div>

Hi everyone, first of all I use this version: ROOT Version: 6.20/04 Built for linuxx8664gcc on Apr 01 2020, 08:28:48 From tags/v6-20-04@v6-20-04 I’m trying to do a program using 3D libraries. I decided to try to com…

---

## [Fit a histogram using User defined funtion](https://root-forum.cern.ch/t/fit-a-histogram-using-user-defined-funtion/41757)

<div class="topic-metadata">

**Author:** [@Brown\_Dog](https://root-forum.cern.ch/u/Brown_Dog)\
**Replies:** 1\
**Last updated:** [October 8, 2020, 6:37am UTC](https://root-forum.cern.ch/t/fit-a-histogram-using-user-defined-funtion/41757 "2020-10-08T06:37:05Z")

</div>

Hi all, I’m just new to ROOT and I have a small question related to fitting a histogram using User defined function: the context is, I want to fit a histogram (gaussian for the sake of simplicity), so I set up code like…

---

## [Setting parameters and limits for p5+gaus function](https://root-forum.cern.ch/t/setting-parameters-and-limits-for-p5-gaus-function/41267)

<div class="topic-metadata">

**Author:** [@Edward\_Finkelstein](https://root-forum.cern.ch/u/Edward_Finkelstein)\
**Replies:** 30\
**Last updated:** [October 7, 2020, 2:15pm UTC](https://root-forum.cern.ch/t/setting-parameters-and-limits-for-p5-gaus-function/41267 "2020-10-07T14:15:57Z")

</div>

Hello, I need to fit some data to a function defined below, a five parameter function + gaussian I need to the fit the graph of data below to the above function. I have been trying to set parameters and parameter lim…

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

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