Compiling macro

Hi,

I need to know the difference between the below two ways of compiling macros with root. becasue sometimes it works with both ways and sometimes i got no output with the first way.

(1)

root -l Data_Histograms.C

and

(2)
root -l
root [ ].L Data_Histograms.C+
root [ ]Data_Histograms m
root [ ]m.Loop()

thanks,

Mai

Hi Mai,

in (1) you are letting ROOT “interpret” (more precisely just in time compile) your code and invoke the function called Data_Histograms inside your macro.
In (2) you are telling ROOT to:

  • create dictionaries for all classes inside the code
  • compile macro and dictionaries as a library using the compiler used to build root
  • load the library
  • instantiate an object m of type Data_Histograms (Data_Histograms m)
  • invoke the method Loop of object m

Cheers,
D

Thanks. Do you have any idea how to write the below lines in bash script to work with LSF batch on lxplus? because root -b -q Data_Histograms.C+ didnt work and when i wrote the below lines as they are , syntax errors appears.

thanks,

Mai

Hi,

root -b -q myMacro.C+

or

root -b -q myMacro.C

will work only if you have a function in your code which is called myMacro. ROOT looks for it and runs it. This rule is valid independently of the usage of a batch system.

Cheers,
D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.