lezhang
December 20, 2011, 11:09pm
1
Hello rooters,
I will use an example to show my question:
my root script (DrawDiLepPlots.C) is like following:
void DrawDiLepPlots(int period=-1 ) {
cout<<" period: "<<period<<endl;
}
If you run command-“root DrawDiLepPlots.C”, the output is:
period: -1
May I ask how could I change the period by this command line mode?
I remember it is something like “root DrawDiLepPlots.C ( 3 )”. But it doesn’t work.
Can anybody tell me how to do it?
Thank you in advance!
Best regards
Lei
No spaces allowed in the call, try:
root DrawDiLepPlots.C(3)
Actually, you have three possibilities:
root -l -b -q DrawDiLepPlots.C(3)
root -l -b -q DrawDiLepPlots.C\ (\ 3\ )
root -l -b -q "DrawDiLepPlots.C(3)"
root -l -b -q “DrawDiLepPlots.C ( 3 )”
root -l -b -q 'DrawDiLepPlots.C(3)'
root -l -b -q ‘DrawDiLepPlots.C ( 3 )’
Added: See, for example, ROOT User’s Guide -> Getting Started -> Start and Quit a ROOT Session
lezhang
December 21, 2011, 12:18pm
5
Hi Pepe,
Thanks for your detailed explanation.
May I ask whether there is a official document that mention these methods?
Because I have searched many place, e.g. user guide, tutorial. But maybe because of my careless, I didn’t find these methods.
Cheers
Lei
pcanal
February 3, 2012, 3:57pm
6
Hi Lei,
Those methods are described in the shell’s (bash, tcsh) manual and guides as they are the way that those tools provide to escape their own special characters ( parenthesis, quotes, etc.)
Cheers,
Philippe.
yus
May 14, 2015, 12:53pm
7
Hi,
and what if the parameter is not an integer, but a char* or a string? E.g., users’ guide has this example:
, and I want to pass the “text” into myMacro.C from another process. I.e., to create a variable, let’s say
, and pass it to myMacro.C, how do I do that with all these quotation marks?
Thanks!
Try:
root -l -b -q ‘myMacro.C("’${dateAndTime}’")’