# Newbie

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

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

---

## [TTree DrawScript fails to compile / find shared library](https://root-forum.cern.ch/t/ttree-drawscript-fails-to-compile-find-shared-library/50846)

<div class="topic-metadata">

**Author:** [@GiacomoBoldrini](https://root-forum.cern.ch/u/GiacomoBoldrini)\
**Replies:** 5\
**Last updated:** [July 27, 2022, 10:27pm UTC](https://root-forum.cern.ch/t/ttree-drawscript-fails-to-compile-find-shared-library/50846 "2022-07-27T22:27:04Z")

</div>

Dear ROOT experts, I’ve been trying to use user defined macro in order to use TTree::Draw method to fill histograms. I have a very simple macro and .h which just imports #include "TLorentzVector.h" TH1D\* h = new TH1D(…

---

## [Loop over TList of TTrees](https://root-forum.cern.ch/t/loop-over-tlist-of-ttrees/50978)

<div class="topic-metadata">

**Author:** [@Cas](https://root-forum.cern.ch/u/Cas)\
**Replies:** 2\
**Last updated:** [July 27, 2022, 8:26am UTC](https://root-forum.cern.ch/t/loop-over-tlist-of-ttrees/50978 "2022-07-27T08:26:33Z")

</div>

Dear all, I cannot seem to figure out how to loop over a TList that contains TTrees. On https://root.cern.ch/doc/master/classTList.html there are five ways provided to loop over a TList, but none seem to help me. Th…

---

## [.root file is empty](https://root-forum.cern.ch/t/root-file-is-empty/50971)

<div class="topic-metadata">

**Author:** [@Dil](https://root-forum.cern.ch/u/Dil)\
**Replies:** 2\
**Last updated:** [July 26, 2022, 3:24pm UTC](https://root-forum.cern.ch/t/root-file-is-empty/50971 "2022-07-26T15:24:09Z")

</div>

Hello rooters, This maybe a simple question.But I cannot resolve it. I tried to read a existing .root file and read a histogram. Okay.It’s working Then I wanna create a new .root file which should have a new histogr…

---

## [JSON to ROOT File](https://root-forum.cern.ch/t/json-to-root-file/50966)

<div class="topic-metadata">

**Author:** [@TheScientist](https://root-forum.cern.ch/u/TheScientist)\
**Replies:** 4\
**Last updated:** [July 26, 2022, 9:48am UTC](https://root-forum.cern.ch/t/json-to-root-file/50966 "2022-07-26T09:48:57Z")

</div>

I have a python script (decoder) that gives out readable data in json format. I am trying to have that data in ROOT file format. I changed the filename.json to filename.root, but it did not work. Please help out on how t…

---

## [How to fit a skew gaussian?](https://root-forum.cern.ch/t/how-to-fit-a-skew-gaussian/50922)

<div class="topic-metadata">

**Author:** [@Divyang](https://root-forum.cern.ch/u/Divyang)\
**Replies:** 4\
**Last updated:** [July 26, 2022, 8:53am UTC](https://root-forum.cern.ch/t/how-to-fit-a-skew-gaussian/50922 "2022-07-26T08:53:04Z")

</div>

Hello everyone, How can I fit the skew-gaussian on the histogram plot. As one can notice in the attached plot, I tried to fit the gaussian curve but lots of counts are not covered by the gaussian. I referred to the wi…

---

## [Plotting \`\`\`mvaeffs\`\`\` in PyROOT (without calling TMVAGui)](https://root-forum.cern.ch/t/plotting-mvaeffs-in-pyroot-without-calling-tmvagui/50935)

<div class="topic-metadata">

**Author:** [@NgJunKai](https://root-forum.cern.ch/u/NgJunKai)\
**Replies:** 1\
**Last updated:** [July 25, 2022, 10:48am UTC](https://root-forum.cern.ch/t/plotting-mvaeffs-in-pyroot-without-calling-tmvagui/50935 "2022-07-25T10:48:58Z")

</div>

As stated in the topic, is there any possible way to this ? I just want to pull out the optimal cut value for the classifier… I have tried something like this (without luck, the ipynb kernel just restarted automatically…

---

## [TFile creating un-loadable .root files](https://root-forum.cern.ch/t/tfile-creating-un-loadable-root-files/50932)

<div class="topic-metadata">

**Author:** [@apiccone15](https://root-forum.cern.ch/u/apiccone15)\
**Replies:** 2\
**Last updated:** [July 25, 2022, 10:20am UTC](https://root-forum.cern.ch/t/tfile-creating-un-loadable-root-files/50932 "2022-07-25T10:20:49Z")

</div>

ROOT Version: 6.20/06 Platform: Linux Server (ROOT through views LCG\_97a:x86\_64-centos7-gcc8-opt) Compiler: Not Provided Hi, I’ve been running into an issue with writing objects to a new root file. For context, I ha…

---

## [TCanvas::Print wont take a variable as an argument](https://root-forum.cern.ch/t/tcanvas-print-wont-take-a-variable-as-an-argument/50943)

<div class="topic-metadata">

**Author:** [@hawexrutile](https://root-forum.cern.ch/u/hawexrutile)\
**Replies:** 1\
**Last updated:** [July 25, 2022, 8:55am UTC](https://root-forum.cern.ch/t/tcanvas-print-wont-take-a-variable-as-an-argument/50943 "2022-07-25T08:55:21Z")

</div>

I wanted to loop over a block of code that calls a function (Loop())to create a histogram and then save it as a .png. TCanvas::Print is giving me an argument error as it only accepts a string as an argument. Is there any…

---

## [Histograms as function parameter and returning their ratio plots](https://root-forum.cern.ch/t/histograms-as-function-parameter-and-returning-their-ratio-plots/50924)

<div class="topic-metadata">

**Author:** [@Radwan\_Parvez](https://root-forum.cern.ch/u/Radwan_Parvez)\
**Replies:** 2\
**Last updated:** [July 23, 2022, 8:45pm UTC](https://root-forum.cern.ch/t/histograms-as-function-parameter-and-returning-their-ratio-plots/50924 "2022-07-23T20:45:27Z")

</div>

Hi I need to write a function such that it will take 2 histogram as its parameter and return their plots alongside with their ratio plot. Is this possible? Please read tips for efficient and successful posting and po…

---

## [How to fit landau functions to histograms using parameters](https://root-forum.cern.ch/t/how-to-fit-landau-functions-to-histograms-using-parameters/50918)

<div class="topic-metadata">

**Author:** [@ploranger](https://root-forum.cern.ch/u/ploranger)\
**Replies:** 1\
**Last updated:** [July 22, 2022, 4:01pm UTC](https://root-forum.cern.ch/t/how-to-fit-landau-functions-to-histograms-using-parameters/50918 "2022-07-22T16:01:31Z")

</div>

Hello. I just started working with Root, and I’m writing a script to take a histogram and fit it to a landau function using Pyroot. To my knowledge, the first parameter of the landau function is the location of its peak,…

---

## [Integrate TF2 function over each bin](https://root-forum.cern.ch/t/integrate-tf2-function-over-each-bin/50882)

<div class="topic-metadata">

**Author:** [@Dil](https://root-forum.cern.ch/u/Dil)\
**Replies:** 10\
**Last updated:** [July 21, 2022, 6:29pm UTC](https://root-forum.cern.ch/t/integrate-tf2-function-over-each-bin/50882 "2022-07-21T18:29:40Z")

</div>

Hello All, I have a TF2 function.I need to integrate it over each bin.I tried to use TH2F-\>Fit option “I” but that didn’t work.I mean the histogram is not pop-up. Is there a way to do it manually? Here is my few line…

---

## [Random forest in TMVA](https://root-forum.cern.ch/t/random-forest-in-tmva/50754)

<div class="topic-metadata">

**Author:** [@NgJunKai](https://root-forum.cern.ch/u/NgJunKai)\
**Replies:** 4\
**Last updated:** [July 21, 2022, 2:06pm UTC](https://root-forum.cern.ch/t/random-forest-in-tmva/50754 "2022-07-21T14:06:53Z")

</div>

In the tmva user manual (TMVA version 4.3.0 for ROOT \>= 6.12/00, dated May 26, 2020), section 8.13.3, it is stated that Randomised Trees (like the Random Forests) is available through the option UseRandomizedTree. Howev…

---

## [Flip axes of TH2](https://root-forum.cern.ch/t/flip-axes-of-th2/50820)

<div class="topic-metadata">

**Author:** [@xaratustra](https://root-forum.cern.ch/u/xaratustra)\
**Replies:** 3\
**Last updated:** [July 21, 2022, 1:50pm UTC](https://root-forum.cern.ch/t/flip-axes-of-th2/50820 "2022-07-21T13:50:57Z")

</div>

Is it possible to flip the axes of a TH2 histogram? So x axis will be y and y will be x, and also the plot inside flips accordingly? \_ROOT Version: 6.26/04 Platform: osx Compiler: PyROOT

---

## [How to extract data from histogram](https://root-forum.cern.ch/t/how-to-extract-data-from-histogram/50894)

<div class="topic-metadata">

**Author:** [@Eyvaz](https://root-forum.cern.ch/u/Eyvaz)\
**Replies:** 1\
**Last updated:** [July 21, 2022, 9:49am UTC](https://root-forum.cern.ch/t/how-to-extract-data-from-histogram/50894 "2022-07-21T09:49:39Z")

</div>

Hi experts, I am looking for extracting data from histogram I created histogram by using random numbers… Best regards CDF\_77\_33cpp (1.5 KB)

---

## [Running Pythia8 under Root](https://root-forum.cern.ch/t/running-pythia8-under-root/50874)

<div class="topic-metadata">

**Author:** [@Elhussein\_Ahmed\_Osam](https://root-forum.cern.ch/u/Elhussein_Ahmed_Osam)\
**Replies:** 11\
**Last updated:** [July 20, 2022, 10:49pm UTC](https://root-forum.cern.ch/t/running-pythia8-under-root/50874 "2022-07-20T22:49:27Z")

</div>

Please read tips for efficient and successful posting and posting code \_ROOT Version: 6.26.04 \_Platform: ubuntu 22.04 Pythia version: 8.307 Hello, I’m new to both Root and Pythia and I have some trouble with linkin…

---

## [Best practice: Using \`new\` in .Add methods](https://root-forum.cern.ch/t/best-practice-using-new-in-add-methods/50848)

<div class="topic-metadata">

**Author:** [@orionyeung001](https://root-forum.cern.ch/u/orionyeung001)\
**Replies:** 4\
**Last updated:** [July 20, 2022, 3:38pm UTC](https://root-forum.cern.ch/t/best-practice-using-new-in-add-methods/50848 "2022-07-20T15:38:41Z")

</div>

\_ROOT Version:v6.24.06 Platform: MacOS “Big Sur” 11.6.5 Compiler: Apple clang version 13.0.0 (clang-1300.0.29.30) I regularly fight segmentation faults and I’d like to lessen the amount of those bugs I have to fight …

---

## [TPolyLine outside of 2DHistogram](https://root-forum.cern.ch/t/tpolyline-outside-of-2dhistogram/50844)

<div class="topic-metadata">

**Author:** [@Gec](https://root-forum.cern.ch/u/Gec)\
**Replies:** 5\
**Last updated:** [July 20, 2022, 3:25pm UTC](https://root-forum.cern.ch/t/tpolyline-outside-of-2dhistogram/50844 "2022-07-20T15:25:50Z")

</div>

How to prevent TPolyLine appearing outside of the Histogram? Some dots which define TPolyLine are outside of the 2DHistograms dimensions so it is shown on all available Canvas area , but I only want that part of the co…

---

## [TGraph2D - palette underestimates values given on z axis](https://root-forum.cern.ch/t/tgraph2d-palette-underestimates-values-given-on-z-axis/50818)

<div class="topic-metadata">

**Author:** [@Richard\_B](https://root-forum.cern.ch/u/Richard_B)\
**Replies:** 4\
**Last updated:** [July 20, 2022, 2:54pm UTC](https://root-forum.cern.ch/t/tgraph2d-palette-underestimates-values-given-on-z-axis/50818 "2022-07-20T14:54:35Z")

</div>

Hello, The palette displays a shifted scale on the values on the z axis on a TGraph2D. It shows as if the ploted values were smaller than what I entered. I tried using a TH2 object, and the values are matching the palet…

---

## [X- axis label Orientation](https://root-forum.cern.ch/t/x-axis-label-orientation/50784)

<div class="topic-metadata">

**Author:** [@Roy](https://root-forum.cern.ch/u/Roy)\
**Replies:** 2\
**Last updated:** [July 20, 2022, 2:13pm UTC](https://root-forum.cern.ch/t/x-axis-label-orientation/50784 "2022-07-20T14:13:31Z")

</div>

I have been looking to change the label orientation on X-axis. Is there any way to do so? If not, the data label of X-axis is too large and unclear. Is there any way to fix that?

---

## [ROOT::Math::Functor in PyROOT (Multivariate minimization)](https://root-forum.cern.ch/t/root-functor-in-pyroot-multivariate-minimization/48260)

<div class="topic-metadata">

**Author:** [@Cesar1](https://root-forum.cern.ch/u/Cesar1)\
**Replies:** 13\
**Last updated:** [July 20, 2022, 1:53pm UTC](https://root-forum.cern.ch/t/root-functor-in-pyroot-multivariate-minimization/48260 "2022-07-20T13:53:06Z")

</div>

HI, I want to minimize the following function: def myFcn(x,p1,p2): #for the first missing particle n3 = T3vector() n3.SetZ(x\[0\]) n3.SetTheta(x\[2\]) n3.SetPhi(x\[4\]) p3 = TLorentzVector() p3.…

---

## [RDataFrame String Filter Question](https://root-forum.cern.ch/t/rdataframe-string-filter-question/50872)

<div class="topic-metadata">

**Author:** [@Yeung](https://root-forum.cern.ch/u/Yeung)\
**Replies:** 5\
**Last updated:** [July 20, 2022, 11:23am UTC](https://root-forum.cern.ch/t/rdataframe-string-filter-question/50872 "2022-07-20T11:23:51Z")

</div>

Dear Expert: There is an error when I process the following macro. Could you please take a look? Thanks. using namespace ROOT; void test() { auto file = TFile::Open("ot/test.root", "READ"); auto dtr = file-\>Get\<TT…

---

## [Get bin label from bin number](https://root-forum.cern.ch/t/get-bin-label-from-bin-number/50862)

<div class="topic-metadata">

**Author:** [@Kshire](https://root-forum.cern.ch/u/Kshire)\
**Replies:** 1\
**Last updated:** [July 20, 2022, 5:40am UTC](https://root-forum.cern.ch/t/get-bin-label-from-bin-number/50862 "2022-07-20T05:40:18Z")

</div>

ROOT Version: 6.26/04 Platform: macOS Monterey 12.4 Compiler: Not Provided I have a set of TH1 histograms with TStrings for bin labels, and I’m trying to get the labels from the bins after they’ve been sorted and fil…

---

## [Bash Coding](https://root-forum.cern.ch/t/bash-coding/50867)

<div class="topic-metadata">

**Author:** [@Chris\_White](https://root-forum.cern.ch/u/Chris_White)\
**Replies:** 1\
**Last updated:** [July 20, 2022, 5:16am UTC](https://root-forum.cern.ch/t/bash-coding/50867 "2022-07-20T05:16:24Z")

</div>

I am new to the forum. I am a little lost trying to code this bash script to do the following: find all words in a string that satisfy the following conditions: Contains characters a - z, A - Z, digits 0 - 9, or unde…

---

## [How to add libaries such as #include \<th1f.h\>](https://root-forum.cern.ch/t/how-to-add-libaries-such-as-include-th1f-h/48913)

<div class="topic-metadata">

**Author:** [@Samer\_hisham](https://root-forum.cern.ch/u/Samer_hisham)\
**Replies:** 5\
**Last updated:** [July 19, 2022, 8:37pm UTC](https://root-forum.cern.ch/t/how-to-add-libaries-such-as-include-th1f-h/48913 "2022-07-19T20:37:32Z")

</div>

Hello guys, i am new to root and pythia and i am confused. i have downloaded root software and installed it through brew since i am using mac os and i have downloaded pythia8.3 i have made some run test to check if i h…

---

## [How to superimpose two leafs from two root files](https://root-forum.cern.ch/t/how-to-superimpose-two-leafs-from-two-root-files/50856)

<div class="topic-metadata">

**Author:** [@gurmukh\_dhindsa](https://root-forum.cern.ch/u/gurmukh_dhindsa)\
**Replies:** 1\
**Last updated:** [July 19, 2022, 8:07pm UTC](https://root-forum.cern.ch/t/how-to-superimpose-two-leafs-from-two-root-files/50856 "2022-07-19T20:07:17Z")

</div>

I have two root files that have leaf -\>Qdet. Now I want to superimpose these two leaf’s data and look them into a new canvas. How I can do that? ROOT Version: Not Provided Platform: Not Provided Compiler: g++

---

## [Access method of lorentz 4-vector for elements of a RVec \<ROOT::Math::PtEtaPhiEVector\> from RDataFrame](https://root-forum.cern.ch/t/access-method-of-lorentz-4-vector-for-elements-of-a-rvec-root-ptetaphievector-from-rdataframe/50845)

<div class="topic-metadata">

**Author:** [@tancredi](https://root-forum.cern.ch/u/tancredi)\
**Replies:** 1\
**Last updated:** [July 19, 2022, 8:55am UTC](https://root-forum.cern.ch/t/access-method-of-lorentz-4-vector-for-elements-of-a-rvec-root-ptetaphievector-from-rdataframe/50845 "2022-07-19T08:55:11Z")

</div>

Hello, I would like to use a method of a Lorentz 4-vector on a RVec ROOT::Math::PtEtaPhiEVector I can easily do this on the leading RVec elements, but how can I do this on all elements I can not figure out how to do t…

---

## [How to use TMath::Mean?](https://root-forum.cern.ch/t/how-to-use-tmath-mean/50824)

<div class="topic-metadata">

**Author:** [@Jackhammer0102](https://root-forum.cern.ch/u/Jackhammer0102)\
**Replies:** 4\
**Last updated:** [July 18, 2022, 7:21am UTC](https://root-forum.cern.ch/t/how-to-use-tmath-mean/50824 "2022-07-18T07:21:42Z")

</div>

Hi, ROOT experts, I want to divide a whole array into parts and find the average value for each part by using TMath::Mean, and then save them as the elements of a vector. I am referring to this part of the code: vecto…

---

## [If TSpectrum Class is Legacy Code? Another Code For TSpectrum?](https://root-forum.cern.ch/t/if-tspectrum-class-is-legacy-code-another-code-for-tspectrum/50833)

<div class="topic-metadata">

**Author:** [@PalytoxinRK](https://root-forum.cern.ch/u/PalytoxinRK)\
**Replies:** 2\
**Last updated:** [July 17, 2022, 7:43am UTC](https://root-forum.cern.ch/t/if-tspectrum-class-is-legacy-code-another-code-for-tspectrum/50833 "2022-07-17T07:43:53Z")

</div>

Using TSpectrum Class to search peaks But ROOT shows it is Legacy Code So if another code for tespectrum? Thanks :grinning: :grinning: :grinning: :grinning: :grinning:

---

## [Y axis range of a displayed histogram](https://root-forum.cern.ch/t/y-axis-range-of-a-displayed-histogram/50821)

<div class="topic-metadata">

**Author:** [@xaratustra](https://root-forum.cern.ch/u/xaratustra)\
**Replies:** 7\
**Last updated:** [July 16, 2022, 10:02am UTC](https://root-forum.cern.ch/t/y-axis-range-of-a-displayed-histogram/50821 "2022-07-16T10:02:53Z")

</div>

For getting the range of a histogram on the X axis, I wonder why h.GetXaxis().GetXmin() works, but the same for Y: h.GetYaxis().GetXmin() does not. The class TAxis has only GetX... because I guess, a TAxis is always …

---

## [TCanvas putting histogram row wise](https://root-forum.cern.ch/t/tcanvas-putting-histogram-row-wise/50242)

<div class="topic-metadata">

**Author:** [@nmmalikroot](https://root-forum.cern.ch/u/nmmalikroot)\
**Replies:** 5\
**Last updated:** [July 15, 2022, 7:13am UTC](https://root-forum.cern.ch/t/tcanvas-putting-histogram-row-wise/50242 "2022-07-15T07:13:51Z")

</div>

Hello expert/root user Is there a way to put histogram column wise in TCanvas. Please read tips for efficient and successful posting and posting code ROOT Version: Not Provided Platform: Not Provided Compiler: Not …

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

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