Quick Question on ROOT and C++

This is a discussion on Quick Question on ROOT and C++ within the C++ Programming forums, part of the General Programming Boards category; Just a quick question. I was asked to do a set of things with ROOT to create a macro: 1) ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    23

    Quick Question on ROOT and C++

    Just a quick question. I was asked to do a set of things with ROOT to create a macro:

    1) Create histogram using this command TH1F *h = new TH1F("h", "h", 60,0,60);
    2) Open a root file
    3) Then from flasher in this root file use Draw function to draw om number in this histogram under the condition that we have string number 62 and om number 2
    4) Use command GetEntries() to get number of events


    Now I created the histogram with that TH1F command, then I opened the ROOT file with TFile...after that though I don't know how to use the Draw function. I can seperately do mytree->Draw(...) but how do I get that plot into my *h histogram I created? That way when I input h.Draw() I will see the plot of my unique histogram that has the required conditions. Step 4 is simple but step 3 is confusing.

    I can draw the histogram and have it printed out, but how do i have it saved into my TH1F historgram? is it just a simple command? like something that needs to be put into the parentheses?


    Thanks in advance
    Drew

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,717
    What's ROOT?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2012
    Posts
    23
    Quote Originally Posted by laserlight View Post
    What's ROOT?
    ROOT is a data analysis tool. It's not well known outside of scientists


    http://root.cern.ch/drupal/
    Last edited by dciampa; 10-15-2012 at 10:09 PM.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    > It's not well known outside of scientists
    So what makes you think we would know anything about it?

    If you've got a question about C++ (like how does new call constructors), then write your question in standard C++ terms.

    If you've got specific library issues, then the best place would be the documentation and support forums for the library you're using.
    Name:  Screenshot at 2012-10-16 05:26:59.png
Views: 78
Size:  124.2 KB

    There are many 1000's of libraries in the world. The chance that you could pick a random programming forum and find experts in your chosen library is pretty well zero. Especially as you already admit is "not well known".
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Oct 2012
    Posts
    23
    Quote Originally Posted by Salem View Post
    > It's not well known outside of scientists
    So what makes you think we would know anything about it?

    If you've got a question about C++ (like how does new call constructors), then write your question in standard C++ terms.

    If you've got specific library issues, then the best place would be the documentation and support forums for the library you're using.
    Name:  Screenshot at 2012-10-16 05:26:59.png
Views: 78
Size:  124.2 KB

    There are many 1000's of libraries in the world. The chance that you could pick a random programming forum and find experts in your chosen library is pretty well zero. Especially as you already admit is "not well known".
    Well most of the commands in ROOT are written in C++, I have used this site for C++ training. So I wanted to come here to get help. Obviously that was a bad choice though, thanks for informing me.

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,587
    We can help you with specific C++ questions, but considering that most here are not familiar with your specific library/tool, asking questions regarding that will probably net you few responses.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 11-17-2007, 02:47 PM
  2. Quick question...
    By Queatrix in forum C++ Programming
    Replies: 12
    Last Post: 05-30-2007, 05:59 AM
  3. Quick Question
    By Necrofear in forum Tech Board
    Replies: 9
    Last Post: 12-04-2005, 08:14 AM
  4. Quick Question
    By SinAmerica in forum C++ Programming
    Replies: 2
    Last Post: 10-23-2002, 02:28 AM
  5. quick question (please help
    By CBeginner in forum C++ Programming
    Replies: 11
    Last Post: 10-22-2002, 01:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21