rats' (and anyone else's) great C++/ROOT learning adventure

Discussion in 'General Chatter' started by rats, Feb 24, 2017.

Tags:
  1. rats

    rats 21 Bright Forge Shatters The Void

    what it says on the tin! i need to learn ROOT. i've only ever coded in java and a liiiiittle bit of python.
    Lets Do This.png

    i'll probably use this thread to troubleshoot or ask for help if i cant find it online and i dont wanna bother my senior advisor :PP so if anyone has experience with this and doesn't mind being ping'd once in a while with a question, please let me know!

    SO! the installation process went pretty smoothly, i want to use ROOT 6 but they only have up to ROOT 5 for windows right now so i did some finagling, downloaded oracle vm, got a linux vm running, and got ROOT 6 booted on there B) really kinda small fry but definitely made me feel like a wizard

    once it was booted i did some really small things - mainly, did a "hello world" printout in the interface itself and then did and imported a macro that did the same thing. (speaking of macros: FIRST TROUBLESHOOT! for some reason i can't get it to recognize that the macro exists unless i specify the exact path that it exists in, so like. . . instead of .x FileName.C, i have to write .x /rats/Documents/root/macros/FileName.C, which i mean. . . isn't THAT big of a deal but i'd like to know why its happening :P if i try to do it the first way it tells me im not in the right directory which im not sure how to fix)

    but yes! my physics class needs a graph for the last lab we did but instead of doing it in the plotting tool provided by the school i think im gonna try to get it going in ROOT just for practice? i definitely tend to learn syntax and stuff better by like, actually diving in and programming things and looking up unknown bits as i go along

    so that's the plan for tonight. i need to get somewhat-competent in this by like, march 1st, so Thats Good

    if anyone has any tips or anything feel free to chime in! also feel free to document ur own code learning experiences here as well, that's definitely what i'll be using this thread for :P cheers!
     
    • Like x 2
  2. rats

    rats 21 Bright Forge Shatters The Void

    Something Is Wrong Here and I Dont Know What (Please Help):

    #include "TF1.h"
    #include "TMath.h"

    int CapLabTwo()
    {
    TCanvas *c1 = new TCanvas("c1", "V0/V versus C2", 200,10,700,500);
    const Int_t n = 5;
    Double_t x[n] = {theres a set of 5 numbers in here};
    Double_t y[n] = {theres a set of 5 numbers in here};
    Double_t ex[n] = {theres a set of 5 numbers in here};
    Double_t ey[n] = {theres a set of 5 numbers in here};
    gr = new TGraphErrors(n,x,y,ex,ey);
    gr->SetTitle("V0/V Versus C2");
    gr->SetMarkerColor(4);
    gr->SetMarkerStyle(21);
    gr->Draw("ALP");
    return c1;
    }

    ;___; i keep getting wild error messages that i cant even parse
     
  3. rats

    rats 21 Bright Forge Shatters The Void

    i've been using learncpp.com and its pretty good so far, if anyone needs any resources for learning C++!

    if anyone else has any recommendations im always open to take those too :D
     
  4. devian

    devian Well-Known Member

    Personally I really like cplusplus.com, if you haven't been there!
     
    • Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice