# Newbie

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

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

---

## [How can i plot a graph beteen mean values which i will take from histograms and values inserted manually](https://root-forum.cern.ch/t/how-can-i-plot-a-graph-beteen-mean-values-which-i-will-take-from-histograms-and-values-inserted-manually/47484)

<div class="topic-metadata">

**Author:** [@Towseef\_Rehman](https://root-forum.cern.ch/u/Towseef_Rehman)\
**Replies:** 4\
**Last updated:** [November 2, 2021, 8:18am UTC](https://root-forum.cern.ch/t/how-can-i-plot-a-graph-beteen-mean-values-which-i-will-take-from-histograms-and-values-inserted-manually/47484 "2021-11-02T08:18:28Z")

</div>

I have many root fils each with a number of histograms. from these histograms, I want to take mean values and plot them against some constant values. can I use the GetMean() function inside the graph? if possible please …

---

## [Error when trying to specify TGraph Fit range](https://root-forum.cern.ch/t/error-when-trying-to-specify-tgraph-fit-range/47495)

<div class="topic-metadata">

**Author:** [@scippsean](https://root-forum.cern.ch/u/scippsean)\
**Replies:** 4\
**Last updated:** [November 2, 2021, 1:09am UTC](https://root-forum.cern.ch/t/error-when-trying-to-specify-tgraph-fit-range/47495 "2021-11-02T01:09:38Z")

</div>

Hello, I have three data sets that I am plotting in a multigraph and I need to fit each one. When I do the fit, the fit line seems to use the entire x range of the window instead of just the range occupied by the data po…

---

## [Root for loops, how to use?](https://root-forum.cern.ch/t/root-for-loops-how-to-use/47481)

<div class="topic-metadata">

**Author:** [@kernelcornfarmer](https://root-forum.cern.ch/u/kernelcornfarmer)\
**Replies:** 2\
**Last updated:** [November 1, 2021, 4:30pm UTC](https://root-forum.cern.ch/t/root-for-loops-how-to-use/47481 "2021-11-01T16:30:46Z")

</div>

hello, all I am new to root. I am trying to develop a code to calculate magnetic Jhonson noise, but I can’t seem to get my for loops to work. I am trying to convert my python code into a root code, so it’s entirely possi…

---

## [Fit with "gaus" converges but doesn't work](https://root-forum.cern.ch/t/fit-with-gaus-converges-but-doesnt-work/47467)

<div class="topic-metadata">

**Author:** [@Fatess](https://root-forum.cern.ch/u/Fatess)\
**Replies:** 18\
**Last updated:** [October 31, 2021, 3:35am UTC](https://root-forum.cern.ch/t/fit-with-gaus-converges-but-doesnt-work/47467 "2021-10-31T03:35:56Z")

</div>

Hi, I’m trying to fit an histogram using Fit(“gaus”, “”, “”, xmin, xmax), but even if it converges, it doesn’t work properly, as you ca see in the images (up-left histogram in the image). The code is the following: TH1…

---

## [Import ROOT fails in python](https://root-forum.cern.ch/t/import-root-fails-in-python/47461)

<div class="topic-metadata">

**Author:** [@gruenew](https://root-forum.cern.ch/u/gruenew)\
**Replies:** 5\
**Last updated:** [October 29, 2021, 11:42am UTC](https://root-forum.cern.ch/t/import-root-fails-in-python/47461 "2021-10-29T11:42:13Z")

</div>

Hi, I have a Linux Cebtos-8 PC where where I installed python3 and root like this: dnf install python3 python3-devel dnf install root However, then I get an error trying to use root from within python: Python 3.6.8 …

---

## [How can I find Magnitude of Lorentz vector v(Px, Py, Pz, E )](https://root-forum.cern.ch/t/how-can-i-find-magnitude-of-lorentz-vector-v-px-py-pz-e/47440)

<div class="topic-metadata">

**Author:** [@MihirPatel](https://root-forum.cern.ch/u/MihirPatel)\
**Replies:** 3\
**Last updated:** [October 28, 2021, 6:22am UTC](https://root-forum.cern.ch/t/how-can-i-find-magnitude-of-lorentz-vector-v-px-py-pz-e/47440 "2021-10-28T06:22:50Z")

</div>

I want to find the magnitude of Lorentz vector v(Px, Py, Pz, E). TLorentzVector lorentzvectors\_K(K\_px\[i\], K\_py\[i\], K\_pz\[i\], K\_energy\[i\]); What is the command to find that? ROOT Version: 6.24/00 Platform: Ubuntu 18.04…

---

## [Add branch to one tree to another one, strange peak](https://root-forum.cern.ch/t/add-branch-to-one-tree-to-another-one-strange-peak/47424)

<div class="topic-metadata">

**Author:** [@ffedericaa](https://root-forum.cern.ch/u/ffedericaa)\
**Replies:** 3\
**Last updated:** [October 27, 2021, 10:58am UTC](https://root-forum.cern.ch/t/add-branch-to-one-tree-to-another-one-strange-peak/47424 "2021-10-27T10:58:45Z")

</div>

Hi all, I have two trees and I have to add a branch of one tree to the other one. I succeeded to do this adding the branch and looping over all the events of the tree to fill it… but I have a strange peak in the distrib…

---

## [Root Crashes When Using Ofstream](https://root-forum.cern.ch/t/root-crashes-when-using-ofstream/47356)

<div class="topic-metadata">

**Author:** [@spencer-ercanbrack](https://root-forum.cern.ch/u/spencer-ercanbrack)\
**Replies:** 4\
**Last updated:** [October 27, 2021, 10:18am UTC](https://root-forum.cern.ch/t/root-crashes-when-using-ofstream/47356 "2021-10-27T10:18:11Z")

</div>

ROOT Version: 6.24.02 Platform: Windows OS (Windows 10) Compiler: MSVC 19.23.28107.0 I am trying to get my code to output some data to a spreadsheet (e.g. I want all of the “time” data points in one one column or row …

---

## [Unix-like commands not working anymore on ROOT on windows](https://root-forum.cern.ch/t/unix-like-commands-not-working-anymore-on-root-on-windows/47415)

<div class="topic-metadata">

**Author:** [@Ema\_G](https://root-forum.cern.ch/u/Ema_G)\
**Replies:** 1\
**Last updated:** [October 27, 2021, 6:43am UTC](https://root-forum.cern.ch/t/unix-like-commands-not-working-anymore-on-root-on-windows/47415 "2021-10-27T06:43:21Z")

</div>

Hello, I’m using Windows and I’m now installing ROOT on a second Windows PC and I can’t get it to work properly this time around. I installed Visual Studio 2019, CMake and Python and followed the steps described in the …

---

## [Error related to .csh file](https://root-forum.cern.ch/t/error-related-to-csh-file/47401)

<div class="topic-metadata">

**Author:** [@priyankaboora](https://root-forum.cern.ch/u/priyankaboora)\
**Replies:** 6\
**Last updated:** [October 25, 2021, 1:25pm UTC](https://root-forum.cern.ch/t/error-related-to-csh-file/47401 "2021-10-25T13:25:47Z")

</div>

Hello Everyone, I am trying to run a .csh file(attached) in Linux. I don’t know why I am facing the error of set: Variable name must begin with a letter. Please suggest to me how I resolve this error. Thank you! \[z…

---

## [Access particle charge using PDG-ID scikit-hep particle package in RDataFrame](https://root-forum.cern.ch/t/access-particle-charge-using-pdg-id-scikit-hep-particle-package-in-rdataframe/47383)

<div class="topic-metadata">

**Author:** [@tancredi](https://root-forum.cern.ch/u/tancredi)\
**Replies:** 1\
**Last updated:** [October 24, 2021, 2:12pm UTC](https://root-forum.cern.ch/t/access-particle-charge-using-pdg-id-scikit-hep-particle-package-in-rdataframe/47383 "2021-10-24T14:12:21Z")

</div>

Hello, I have a Monte Carlo simulation with all truth particles and their PDG-ID. I would like to know the charge of the particle for the PDG-ID. In do this there is a handy packages called particle that allows to get…

---

## [FFT Plugin not found?](https://root-forum.cern.ch/t/fft-plugin-not-found/47340)

<div class="topic-metadata">

**Author:** [@KAM](https://root-forum.cern.ch/u/KAM)\
**Replies:** 6\
**Last updated:** [October 22, 2021, 6:16pm UTC](https://root-forum.cern.ch/t/fft-plugin-not-found/47340 "2021-10-22T18:16:14Z")

</div>

I have a recent, fresh installation of ROOT (in /usr/bin/src/root/root\_install/bin/root/. I’m running a fresh install of the latest Debian, and I installed all required and optional dependencies listed here: Dependencies…

---

## [Root merging problem](https://root-forum.cern.ch/t/root-merging-problem/47150)

<div class="topic-metadata">

**Author:** [@nmmalikroot](https://root-forum.cern.ch/u/nmmalikroot)\
**Replies:** 9\
**Last updated:** [October 22, 2021, 4:06pm UTC](https://root-forum.cern.ch/t/root-merging-problem/47150 "2021-10-22T16:06:51Z")

</div>

while merging the root file I got the following error. getting the same error from hadd method and also with TFileMerger Error in \<TBufferFile::CheckByteCount\>: object of class TList read too many bytes: 1263111989 ins…

---

## [ROOT build type of installation](https://root-forum.cern.ch/t/root-build-type-of-installation/47349)

<div class="topic-metadata">

**Author:** [@renyhp](https://root-forum.cern.ch/u/renyhp)\
**Replies:** 2\
**Last updated:** [October 21, 2021, 2:46pm UTC](https://root-forum.cern.ch/t/root-build-type-of-installation/47349 "2021-10-21T14:46:41Z")

</div>

Hello, Is it possible to get the CMAKE\_BUILD\_TYPE of an existing installation? Also, are there any Debug / RelWithDebInfo builds on CVMFS? Thank you in advance!

---

## [Root Libraries on Visual studio](https://root-forum.cern.ch/t/root-libraries-on-visual-studio/37690)

<div class="topic-metadata">

**Author:** [@imLivai](https://root-forum.cern.ch/u/imLivai)\
**Replies:** 17\
**Last updated:** [October 21, 2021, 6:16am UTC](https://root-forum.cern.ch/t/root-libraries-on-visual-studio/37690 "2021-10-21T06:16:41Z")

</div>

Dear Rooters, I am currently studying physics at UniTO and i was asked to use root libraries in order to perform some data analysis. I have alredy read Every single post about this topic on this forum yet coudd not ma…

---

## [TLegend problem](https://root-forum.cern.ch/t/tlegend-problem/47337)

<div class="topic-metadata">

**Author:** [@talgat](https://root-forum.cern.ch/u/talgat)\
**Replies:** 2\
**Last updated:** [October 21, 2021, 5:23am UTC](https://root-forum.cern.ch/t/tlegend-problem/47337 "2021-10-21T05:23:43Z")

</div>

Good evening, dear rooters. I have some problem with TLegend. How I can plot TLegend color same as data points color? Sorry, for my english.9B\_40MeV.pdf (18.5 KB) mass2.C (2.0 KB) 9Be\_elas\_40Mev.txt (1.1 KB) 9B\_gs\_40…

---

## [Plotting the contour lines](https://root-forum.cern.ch/t/plotting-the-contour-lines/47325)

<div class="topic-metadata">

**Author:** [@fabstr](https://root-forum.cern.ch/u/fabstr)\
**Replies:** 2\
**Last updated:** [October 20, 2021, 12:07pm UTC](https://root-forum.cern.ch/t/plotting-the-contour-lines/47325 "2021-10-20T12:07:39Z")

</div>

Please read tips for efficient and successful posting and posting code ROOT Version: 6.22/00 Platform: Ubuntu 20.04.1 LTS (WSL2) Compiler: GNU or GCC I have created a contour plot of the magnetic flux density of a…

---

## [Pyroot script crashes when adding second axis](https://root-forum.cern.ch/t/pyroot-script-crashes-when-adding-second-axis/47316)

<div class="topic-metadata">

**Author:** [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Replies:** 3\
**Last updated:** [October 20, 2021, 10:40am UTC](https://root-forum.cern.ch/t/pyroot-script-crashes-when-adding-second-axis/47316 "2021-10-20T10:40:18Z")

</div>

Hello! I have this simple Python script, however it crashes when I try to add a secondary x axis. The canvas gets somehow deleted after the TGaxis::Draw command. TypeError: void TPad::SaveAs(const char\* filename = "", …

---

## [Legend for THStack](https://root-forum.cern.ch/t/legend-for-thstack/47322)

<div class="topic-metadata">

**Author:** [@zenith378](https://root-forum.cern.ch/u/zenith378)\
**Replies:** 4\
**Last updated:** [October 20, 2021, 10:13am UTC](https://root-forum.cern.ch/t/legend-for-thstack/47322 "2021-10-20T10:13:46Z")

</div>

Hi everyone, I’d like to make a legend for the plot of my stacked histograms using TLegend but i am having trouble placing it. I tried to search the documentation but I couldn’t find what the arguments of the TLegend ar…

---

## [Plotting the data points from Tefficiency in customized bins](https://root-forum.cern.ch/t/plotting-the-data-points-from-tefficiency-in-customized-bins/47320)

<div class="topic-metadata">

**Author:** [@sanjeeda](https://root-forum.cern.ch/u/sanjeeda)\
**Replies:** 3\
**Last updated:** [October 20, 2021, 7:08am UTC](https://root-forum.cern.ch/t/plotting-the-data-points-from-tefficiency-in-customized-bins/47320 "2021-10-20T07:08:42Z")

</div>

Dear Experts, In this macro:efficiency.C (2.4 KB) and the root file: for\_tefficiency\_0.1.root (4.7 KB), I have plotted a simple graph, then plotted a graph with TEfficiency (with x-error bars removed). I am also able to…

---

## [Assigning the same magnetic field strength to a colorbar at a contour plot](https://root-forum.cern.ch/t/assigning-the-same-magnetic-field-strength-to-a-colorbar-at-a-contour-plot/47310)

<div class="topic-metadata">

**Author:** [@fabstr](https://root-forum.cern.ch/u/fabstr)\
**Replies:** 2\
**Last updated:** [October 19, 2021, 3:22pm UTC](https://root-forum.cern.ch/t/assigning-the-same-magnetic-field-strength-to-a-colorbar-at-a-contour-plot/47310 "2021-10-19T15:22:17Z")

</div>

Please read tips for efficient and successful posting and posting code ROOT Version: 6.22/00 Platform: Ubuntu 20.04.1 LTS (WSL2) Compiler: GNU or GCC I have created a contour plot of the magnetic flux density of an…

---

## [Make a Lorentz vector and extract mass using arrays in the root file](https://root-forum.cern.ch/t/make-a-lorentz-vector-and-extract-mass-using-arrays-in-the-root-file/47069)

<div class="topic-metadata">

**Author:** [@sanjeeda](https://root-forum.cern.ch/u/sanjeeda)\
**Replies:** 6\
**Last updated:** [October 19, 2021, 2:15pm UTC](https://root-forum.cern.ch/t/make-a-lorentz-vector-and-extract-mass-using-arrays-in-the-root-file/47069 "2021-10-19T14:15:24Z")

</div>

Dear Experts, I am trying to make two separate TLorentz Vectors for -kaon(pdgcode=-321) and pion(pdgcode=211) so that I can add them and extract the mass to D0. But I am not able to do so because the arrays are involve…

---

## [TEfficiency using histograms from a separate root file](https://root-forum.cern.ch/t/tefficiency-using-histograms-from-a-separate-root-file/47309)

<div class="topic-metadata">

**Author:** [@sanjeeda](https://root-forum.cern.ch/u/sanjeeda)\
**Replies:** 2\
**Last updated:** [October 19, 2021, 1:46pm UTC](https://root-forum.cern.ch/t/tefficiency-using-histograms-from-a-separate-root-file/47309 "2021-10-19T13:46:59Z")

</div>

Dear Experts, I would like to calculate efficiency in bins of momenta. For this, I have two histograms in this root file: for\_tefficiency.root (5.8 KB), namely Num\_p (Numerator) and Den\_p (Denominator). I am trying to u…

---

## [Getting the last entry of a TTree](https://root-forum.cern.ch/t/getting-the-last-entry-of-a-ttree/47198)

<div class="topic-metadata">

**Author:** [@atha.stam](https://root-forum.cern.ch/u/atha.stam)\
**Replies:** 9\
**Last updated:** [October 18, 2021, 4:23pm UTC](https://root-forum.cern.ch/t/getting-the-last-entry-of-a-ttree/47198 "2021-10-18T16:23:45Z")

</div>

ROOT Version: 6.18/04 Platform: 18.04 Compiler: cc 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) Dear co-rooters, I’m trying to read the last entry (row?) of a TTree. What I do is getting the total number or entries using T…

---

## [Root2yoda error](https://root-forum.cern.ch/t/root2yoda-error/47283)

<div class="topic-metadata">

**Author:** [@Sumankkundu](https://root-forum.cern.ch/u/Sumankkundu)\
**Replies:** 5\
**Last updated:** [October 18, 2021, 1:15pm UTC](https://root-forum.cern.ch/t/root2yoda-error/47283 "2021-10-18T13:15:13Z")

</div>

Dear expert, I am trying to convert few root histograms in a root file to yoda scatter 2D hist format using root2yoda script. But I get the following error : Traceback (most recent call last): \*\*\* File “./root2yod…

---

## [ROOT::Math:: Factory::CreateMinimizer does not work](https://root-forum.cern.ch/t/root-factory-createminimizer-does-not-work/47271)

<div class="topic-metadata">

**Author:** [@Lorenzo](https://root-forum.cern.ch/u/Lorenzo)\
**Replies:** 3\
**Last updated:** [October 18, 2021, 8:41am UTC](https://root-forum.cern.ch/t/root-factory-createminimizer-does-not-work/47271 "2021-10-18T08:41:03Z")

</div>

I need to use the function minimizer, so I basically copied the code from Example on how to use the new Minimizer class in ROOT : ... #include "Math/Minimizer.h" #include "Math/Factory.h" #include "Math/Functor.h" #incl…

---

## [Removing the area outside a circle](https://root-forum.cern.ch/t/removing-the-area-outside-a-circle/47253)

<div class="topic-metadata">

**Author:** [@fabstr](https://root-forum.cern.ch/u/fabstr)\
**Replies:** 9\
**Last updated:** [October 17, 2021, 12:25pm UTC](https://root-forum.cern.ch/t/removing-the-area-outside-a-circle/47253 "2021-10-17T12:25:28Z")

</div>

Please read tips for efficient and successful posting and posting code \_ROOT Version:\_6.22/00 Platform: Ubuntu 20.04.1 LTS (WSL2) Compiler: GNU or GCC Hello, I have created a contour plot of the magnetic flux den…

---

## [ROOT on my smartphone](https://root-forum.cern.ch/t/root-on-my-smartphone/47155)

<div class="topic-metadata">

**Author:** [@xtovo](https://root-forum.cern.ch/u/xtovo)\
**Replies:** 12\
**Last updated:** [October 17, 2021, 6:15am UTC](https://root-forum.cern.ch/t/root-on-my-smartphone/47155 "2021-10-17T06:15:16Z")

</div>

Hi. How to build ROOT from the git head on Android device? aarch64, clang version 12.0.1 or gcc-10, python 3.10 Thanks. Regards. Valeriy

---

## [Compilation fails including .hpp files](https://root-forum.cern.ch/t/compilation-fails-including-hpp-files/47250)

<div class="topic-metadata">

**Author:** [@zenith378](https://root-forum.cern.ch/u/zenith378)\
**Replies:** 10\
**Last updated:** [October 15, 2021, 10:44am UTC](https://root-forum.cern.ch/t/compilation-fails-including-hpp-files/47250 "2021-10-15T10:44:08Z")

</div>

Hello everyone, so I’d like to draw some bayesian blocks histograms and the only algorithm that was already implemented in C++ I could find is this one on GitHub. It really seems to suit what i need, so I downloaded th…

---

## [Composed function - segmetnation violation](https://root-forum.cern.ch/t/composed-function-segmetnation-violation/47235)

<div class="topic-metadata">

**Author:** [@Lorenzo](https://root-forum.cern.ch/u/Lorenzo)\
**Replies:** 2\
**Last updated:** [October 14, 2021, 10:21am UTC](https://root-forum.cern.ch/t/composed-function-segmetnation-violation/47235 "2021-10-14T10:21:28Z")

</div>

I am trying to build and draw a composed function with a very simple code, but when I run the macro i obtain a segmentation violation error which I cannot understand. I don’t know if I am doing something wrong but I can…

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

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