Back to home page

sPhenix code displayed by LXR

 
 

    


Warning, /tutorials/AnaTutorial/README.md is written in an unsupported language. File is not indexed.

0001 # Analysis Tutorial
0002 
0003 This package is intended to demonstrate some basic features of analysis tutorials and walk a new user through building a package, extracting physics information from the NodeTree, and then using that package to produce a root file that can be used for further analysis. The package demonstrates some basic features and contains some useful code for extracting physics information like reconstructed tracks, reconstructed EMCal clusters, and truth particle information (amongst some other things).
0004 
0005 To get started, first clone the repository to get the code with
0006 ```bash
0007 $ git clone git@github.com:sPHENIX-Collaboration/tutorials.git
0008 ```
0009 
0010 
0011 ## Building The Package
0012 
0013 The first step to running the tutorial is to build the analysis package from src. Follow these instructions:
0014 
0015 ```bash
0016 $ cd src
0017 $ mkdir build
0018 $ cd build
0019 $ ../autogen.sh --prefix=$MYINSTALL
0020 $ make
0021 $ make install
0022 ```
0023 
0024 Here, this assumes that you have set an environment variable `$MYINSTALL` that points to your install directory. For example, `$ echo $MYINSTALL` returns `/home/vagrant/install` for me, where the install directory is set on my virtual machine when running the Singularity container. The install directory can be wherever you like, but it is generally good practice to have one where all of your installation libraries will live.
0025 
0026 You should also make sure that your `$LD_LIBRARY_PATH` and `$ROOT_INCLUDE_PATH` point to the correct place for your install directory. See [here](https://wiki.bnl.gov/sPHENIX/index.php/Example_of_using_DST_nodes) and [here](https://wiki.bnl.gov/sPHENIX/index.php/Sphenix_root6) for more details. You can use the following script to do this for you:
0027 
0028 
0029 ```bash
0030 # for bash
0031 source $OPT_SPHENIX/bin/setup_local.sh $MYINSTALL  
0032 
0033 # for csh/tcsh
0034 source $OPT_SPHENIX/bin/setup_local.csh $MYINSTALL  
0035 ```
0036 
0037 
0038 ## Running the example macro
0039 
0040 The example macro, found in `macro/Fun4All_AnaTutorial_sPHENIX.C`, is just the default `Fun4All_G4_sPHENIX.C` macro with the AnaTutorial package added to it. If you would like to see how the default macro and this macro are different, you can just open `Fun4All_AnaTutorial.C` in your favorite text editor and search for `anatutorial`, or run a `diff` command on the two files. 
0041 
0042 
0043 The macro can be run out of the box with `root Fun4All_AnaTutorial.C`, and the type of event can be changed within the macro itself (e.g. between running single particle and pythia simulations).
0044 
0045 In the event that the macro does not work, you should look at the default macro (which should always work) available [here](https://github.com/sPHENIX-Collaboration/macros/blob/master/detectors/sPHENIX/Fun4All_G4_sPHENIX.C). You can always run the AnaTutorial package by adding to the default macro `Fun4All_G4_sPHENIX.C` the relevant code that calls AnaTutorial in `Fun4All_AnaTutorial.C`. Just search for `anatutorial` in your favorite text editor in `Fun4All_AnaTutorial.C` to see the lines of code that should be added to `Fun4All_G4_sPHENIX.C`.
0046 
0047 
0048 ## Troubleshooting
0049 
0050 In the event that the macros do not work, that is because they have become out of sync with the main macros repository. Depending on which macro you are trying to run (sPHENIX or EIC) go to the main macros repository for the respective detector. In the Fun4All macro that you want to run, add the following to the header files:
0051 
0052 ```
0053 #include <anatutorial/AnaTutorial.h>
0054 R__LOAD_LIBRARY(libanatutorial.so)
0055 ```
0056 
0057 and add the following after the line `if (Enable::USER) UserAnalysisInit();`
0058 
0059 ```
0060 AnaTutorial *anaTutorial = new AnaTutorial("anaTutorial", outputroot + "_anaTutorial.root");
0061 anaTutorial->setMinJetPt(3.);
0062 anaTutorial->Verbosity(0);
0063 anaTutorial->analyzeTracks(true);
0064 anaTutorial->analyzeClusters(true);
0065 anaTutorial->analyzeJets(true);
0066 anaTutorial->analyzeTruth(false);
0067 se->registerSubsystem(anaTutorial);
0068 ```
0069 
0070 If you developed your own analysis package, you would use a similar workflow to add your analysis package to the macro that you want to run.
0071 
0072 ## Example Condor Scripts
0073 There is a dummy example of a csh and condor job submission script that you could look at as well. These can run out of the box with a few modifications (e.g. you need to change some things to your working directory), but are not meant to be representative of a real production case. They simply show the basics for a very simple implementation of an example job script. For more details see the condor wiki page at [this link](https://wiki.sphenix.bnl.gov/index.php/Condor). 
0074