| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| root:addclasstoroot [2008/12/01 16:29] – decianm | root:addclasstoroot [2011/03/08 12:42] (current) – [Troubleshooting] decianm |
|---|
| |
| ==== 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. |
| |
| |
| ==== 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. |
| 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). |
| |