User Tools

Site Tools


root:addclasstoroot

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
root:addclasstoroot [2008/12/01 16:29] decianmroot:addclasstoroot [2011/03/08 12:42] (current) – [Troubleshooting] decianm
Line 62: Line 62:
  
 ==== Some Notes ==== ==== Some Notes ====
-  * You **must** write a constructor yourself. Normally in C++, if you forget your constructor, the compiler will create a standard-constructor for you. However, if you don't provide a constructor here, you'll run into trouble.+  * You **must** write a constructor (and a destructor) yourself. Normally in C++, if you forget your constructor, the compiler will create a standard-constructor for you. However, if you don't provide a constructor here, you'll run into trouble.
   * The **ClassImp(ana)** and the **ClassDef(ana, 1)** are necessary for the full functionality. ana names the class and the number in **ClassDef** is the VersionID; it has to be greater than zero. **ClassDef(...)** always has to be the last statement before the closing bracket. These statements are needed to create the dictionary for ROOT in the compilation process.   * The **ClassImp(ana)** and the **ClassDef(ana, 1)** are necessary for the full functionality. ana names the class and the number in **ClassDef** is the VersionID; it has to be greater than zero. **ClassDef(...)** always has to be the last statement before the closing bracket. These statements are needed to create the dictionary for ROOT in the compilation process.
  
Line 104: Line 104:
  
 ==== Loading the Class in ROOT ==== ==== Loading the Class in ROOT ====
-  * Start ROOT and type '' .L libAnaClasses.so ''. You can write a [[root::rootlogonscript||Logon script for ROOT]] as well that will do this for you.+  * Start ROOT and type '' .L libAnaClasses.so ''. You can write a [[root::rootlogonscript|Logon script for ROOT]] that will do this for you.
   * Create an instance of your object. Type ''ana myanaclass''.   * Create an instance of your object. Type ''ana myanaclass''.
   * Execute the method. Type ''myanaclass.test()''. Now you should have successfully created a ROOT file named bla.root.   * Execute the method. Type ''myanaclass.test()''. Now you should have successfully created a ROOT file named bla.root.
Line 116: Line 116:
 setenv PATH $ROOTSYS/bin:$PATH setenv PATH $ROOTSYS/bin:$PATH
 </code> in your .tcshrc file (if you are working on a tcsh). </code> in your .tcshrc file (if you are working on a tcsh).
-    * Did you think of the constructor? A missing constructor may give similar error messages.+    * Did you think of the constructor / destructor? A missing constructor may give similar error messages.
     * There may be also be something missing in the Makefile, meaning that not everything is linked correctly.     * There may be also be something missing in the Makefile, meaning that not everything is linked correctly.
 +    * Note: For RooFit you need an additional ''-lRooFit'' for the GLIBS
   * The described procedure works for me on lxplus and locally (leopard.physik.uzh.ch).   * The described procedure works for me on lxplus and locally (leopard.physik.uzh.ch).
  
root/addclasstoroot.1228145377.txt.gz · Last modified: 2008/12/01 16:29 by decianm