--- PamelaLevel2/doc/examples/README.txt 2006/06/16 16:43:55 1.1 +++ PamelaLevel2/doc/examples/README.txt 2007/01/03 13:28:50 1.4 @@ -1,9 +1,12 @@ This directory contains some very simple macros, just to show how to use the PamLevel2 class. -The macros need as input the name of a Level2 .root file produced by DarthVader. +The macros need as input the name of a Level2 .root file produced by DarthVader +(example1 and example2) or a list of files (see example3). -Class implementation is under development and some problems still need to be fixed. -However this simple examples should allow to start working with Pamela data and to test the -general environment. +example1 - Example to integrate all detector info and solve the y-view tracks ambiguity +example2 - Example to get pamela tracks and integrate the trajectory in the apparatus +example3 - Example to loop over events, reading more than one file +Loop - Example to loop over events, apply some selection cuts (My-Selection.cpp) and filling an + output file with histograms (My-Histos.cpp) and/or trees. In order to run the scripts: @@ -17,7 +20,7 @@ [] .x load.C [] .L example1.C -[] example1("level2-data-path/level2-file.root") +[] example1("level2-data-path/level2-file, execute the command.root") Tracker : set branch address TrkLevel2 Calorimeter : set branch address CaloLevel2 ToF : set branch address ToFLevel2 @@ -30,16 +33,32 @@ Done -4) The macro creates some histograms, which you can list and plot as follows: +4) Macros example1 and example2 produce some histograms. Example3 just loop over events and tracks and +counts time. It is usefull to check processing time. -[].ls -TROOT* Rint The ROOT of EVERYTHING - OBJ: TH1F qtot Total energy in the calorimeter : 0 at: 0xb3f7400 - OBJ: TH1F npaddle Total number of hit ToF paddles : 0 at: 0xb3f8768 - OBJ: TH1F ntr Number of fitted tracks : 0 at: 0xb3f8b60 - OBJ: TH1F rig Particle rigidity : 0 at: 0xb3f8f30 - OBJ: TH1F resxs Spatial residual (X) on the 1^ calo plane (sorted tracks) : 0 at: 0xb3f94a0 - OBJ: TH1F resys Spatial residual (Y) on the 1^ calo plane (sorted tracks) : 0 at: 0xb3f9a00 - OBJ: TH1F resxi Spatial residual (X) on the 1^ calo plane (image tracks) : 0 at: 0xb3f9f70 - OBJ: TH1F resyi Spatial residual (Y) on the 1^ calo plane (image tracks) : 0 at: 0xb3fa4e0 -[]rig->Draw() + +5) To create Loop.exe execute the command (you need the PAMELA environment variables): + +> make Loop.exe + +The executable is create by compiling and linking the files: + +Loop.cpp +My-Selection.cpp +My-Histos.cpp + +You can use My-Selection.cpp and My-Histos.cpp as a template to inplement your own +selection cuts and analysis. +More generally, you can compile and link Loop.cpp with your own source files (you need +to edit also the Makefile), where you should implement at least the following functions: + +bool Select(PamLevel2*); +void CreateHistos(TFile*); +void FillHistos(PamLevel2*); +void SaveHistos(TFile*); + +To know how to use Loop.exe, issue: +./Loop.exe --help + +(If you execute "make Loop-0.exe" the old example code, previously posted on the cvs, +is compiled and linked. This is not a very general example, better use the new one)