dsahoo
October 10, 2017, 3:05pm
#1
Dear Experts,
Bslxysig is variable in a root file(tree). I want to draw Bslxysig/1367.144. How to draw, could you please tell me? I have pasted the snippet of my code here.
TChain *ch = new TChain("tree");
ch>Add("/home/deepak/BsToPhiMuMu/MC/mumuphisel/cut1mcnogen/sel_BsToPhiMuMu_mumuphi_cut1_mc_nogen_mc.nogen_cut1_*.root");
TTree *tr1 = ch;
TH1F *h1 = new TH1F("h1", "K^{+} Transverse momentum",100,7.0,100.0);
tr1->Draw("(Blxysig/1367.144)>>h1");
Thanks,
Deepak
couet
October 10, 2017, 3:22pm
#2
tr1->Draw("(Blxysig/1367.144)>>h1");
This is correct. The range along the X axis will be the one of Blxysig/1367.144
couet
October 10, 2017, 3:26pm
#3
If you want to divide the distribution by 1000 you can fille the histogram h1 as you did and then divide h1 by 1000.
You can also try to put a weight of 0.001 … but that might not be what you want.
tr1->Draw("(Blxysig/1367.144)", "0.001", "hist");
dsahoo
October 10, 2017, 3:54pm
#4
tr1->Draw("(Blxysig/1367.144)>>h1");
is not working. It is giving empty canvas.
Thanks,
Deepak
Try (see the x-axis range of the drawn histogram and compare to your “h1”):
ch->Draw("Blxysig/1367.144"); // note: "ch", not "tr1"
dsahoo
October 10, 2017, 4:08pm
#6
I tried this and it is giving same thing as before(empty canvas with no.of entries). there is no distribution. For comparing the x-axis range, I am fixing h1 as (7,100) and the plot shows x-axis range as (7,100).
Thanks,
Deepak
Try:
ch->Print();
std::cout << ch->GetEntries() << std::endl;
dsahoo
October 10, 2017, 4:57pm
#8
It’s giving details(size,variablename) of all variables in that tree.
Thanks,
Deepak
Post the output here for inspection.
dsahoo
October 10, 2017, 5:05pm
#10
Here is the output.
Processing Bslxysig.cc...
******************************************************************************
*Chain :tree : /home/deepak/BsToPhiMuMu/MC/mumuphisel/cut1mcnogen/sel_BsToPhiMuMu_mumuphi_cut1_mc_nogen_mc.nogen_cut1_s0.root *
******************************************************************************
******************************************************************************
*Tree :tree : tree *
*Entries : 1000000 : Total = 181002935 bytes File Size = 2790382 *
* : : Tree compression factor = 1.00 *
******************************************************************************
*Br 0 :Mumumass : Mumumass/D *
*Entries : 1000000 : Total Size= 8044980 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 1 :Mumumasserr : Mumumasserr/D *
*Entries : 1000000 : Total Size= 8046498 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 2 :Phimass : Phimass/D *
*Entries : 1000000 : Total Size= 8044474 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 3 :Kmpt : Kmpt/D *
*Entries : 1000000 : Total Size= 8042956 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 4 :Kppt : Kppt/D *
*Entries : 1000000 : Total Size= 8042956 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 5 :Kmtrkdcasigbs : Kmtrkdcasigbs/D *
*Entries : 1000000 : Total Size= 8047510 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 6 :Kptrkdcasigbs : Kptrkdcasigbs/D *
*Entries : 1000000 : Total Size= 8047510 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 7 :Bmass : Bmass/D *
*Entries : 1000000 : Total Size= 8043462 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 8 :Bpt : Bpt/D *
*Entries : 1000000 : Total Size= 8042450 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 9 :Beta : Beta/D *
*Entries : 1000000 : Total Size= 8042956 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 10 :Bphi : Bphi/D *
*Entries : 1000000 : Total Size= 8042956 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 11 :Bvtxcl : Bvtxcl/D *
*Entries : 1000000 : Total Size= 8043968 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 12 :Blxysig : Blxysig/D *
*Entries : 1000000 : Total Size= 8044474 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 13 :Bcosalphabs : Bcosalphabs/D *
*Entries : 1000000 : Total Size= 8046498 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 14 :Bcosalphabs2d : Bcosalphabs2d/D *
*Entries : 1000000 : Total Size= 8047510 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 15 :Bctau : Bctau/D *
*Entries : 1000000 : Total Size= 8043462 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 16 :Q2 : Q2/D *
*Entries : 1000000 : Total Size= 8041944 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 17 :dimupt : dimupt/D *
*Entries : 1000000 : Total Size= 8043968 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 18 :dimueta : dimueta/D *
*Entries : 1000000 : Total Size= 8044474 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 19 :CosThetaL : CosThetaL/D *
*Entries : 1000000 : Total Size= 8045486 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 20 :CosThetaK : CosThetaK/D *
*Entries : 1000000 : Total Size= 8045486 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 21 :PhiAng : PhiAng/D *
*Entries : 1000000 : Total Size= 8043968 bytes All baskets in memory *
*Baskets : 250 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 22 :Triggers : Triggers/I *
*Entries : 1000000 : Total Size= 4022722 bytes All baskets in memory *
*Baskets : 125 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
******************************************************************************
Thanks,
Deepak
So, you should get histograms with 1000000 entries.
Try to print the first 10 entries (see what values you get):
ch->Scan("Blxysig", "", "", 10, 0);
dsahoo
October 10, 2017, 5:16pm
#12
I am pasting the output.
Processing Bslxysig.cc...
************************
* Row * Blxysig *
************************
* 0 * 0 *
* 1 * 0 *
* 2 * 0 *
* 3 * 0 *
* 4 * 0 *
* 5 * 0 *
* 6 * 0 *
* 7 * 0 *
* 8 * 0 *
* 9 * 0 *
************************
Info in <TCanvas::Print>: file bslxysig.png has been created
Well, try:
ch->Scan("Blxysig", "Blxysig != 0");
dsahoo
October 10, 2017, 5:25pm
#14
It’s giving nonzero values as below.
Processing Bslxysig.cc...
************************
* Row * Blxysig *
************************
* 297 * 91.087971 *
* 333 * 69.225149 *
* 480 * 72.621874 *
* 600 * 22.015388 *
* 793 * 166.70694 *
* 853 * 27.881502 *
* 919 * 21.451616 *
* 1088 * 29.436973 *
* 1144 * 22.077651 *
* 1507 * 24.498037 *
* 1597 * 12.849612 *
* 1780 * 30.894640 *
* 1783 * 12.644404 *
* 1791 * 42.579906 *
* 1901 * 33.359760 *
* 1947 * 17.262691 *
* 1962 * 79.138282 *
* 2008 * 14.660279 *
* 2072 * 37.603640 *
* 2186 * 42.417438 *
* 2222 * 41.521340 *
* 2386 * 93.572485 *
* 2804 * 27.309963 *
* 3026 * 131.57564 *
* 3545 * 15.305382 *
Thanks,
Deepak
Try:
ch->Draw("Blxysig/1367.144", "Blxysig != 0");
BTW. When you post “output” or “source code” here, do remember to enclose them into two lines which contain just three characters ``` (see how your posts have been edited above).
dsahoo
October 10, 2017, 5:32pm
#16
It’s giving the distribution as below.
Thanks,
Deepak
So, you should also get a correct plot with 1000000 entries when you try (just the first bin at x = 0 will be higher):
ch->Draw("Blxysig/1367.144");
gPad->SetLogy(1);
system
closed
October 24, 2017, 5:35pm
#18
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.