]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muondep/RunMuonResolution.C
Transition PWG3 --> PWGHF
[u/mrichter/AliRoot.git] / PWG / muondep / RunMuonResolution.C
1 //--------------------------------------------------------------------------
2 // Base macro for submitting muon Resolution analysis.
3 //
4 // In case it is not run with full aliroot, it needs the following libraries:
5 //  - libSTEERBase.so
6 //  - libESD.so
7 //  - libAOD.so
8 //  - libANALYSIS.so
9 //  - libANALYSISalice.so
10 //  - libGui.so
11 //  - libMinuit.so
12 //  - libProofPlayer.so
13 //  - libXMLParser.so
14 //  - libRAWDatabase.so
15 //  - libCDB.so
16 //  - libSTEER.so
17 //  - libMUONcore.so
18 //  - libMUONmapping.so
19 //  - libMUONcalib.so
20 //  - libMUONgeometry.so
21 //  - libMUONtrigger.so
22 //  - libMUONraw.so
23 //  - libMUONbase.so
24 //  - libMUONrec.so
25 //  - libCORRFW.so
26 //  - libPWG3base.so
27 //  - libPWG3muondep.so
28 //
29 // It also needs to load magnetic field, mapping, geometry (+alignment), and reconstruction parameters from the OCDB
30 //
31 // The task reads ESDs
32 // Intermediate results are stored in a file chamberResolution_step<#step>.root
33 // Final results are stored in the file results.root
34 //
35 // Author: Philippe Pillot - SUBATECH Nantes
36 //--------------------------------------------------------------------------
37
38 void LoadAlirootLocally(TString& extraLibs);
39
40 //______________________________________________________________________________
41 void RunMuonResolution(TString smode = "local", TString inputFileName = "AliESDs.root",
42                        TString alirootVersion = "VO_ALICE@AliRoot::v4-20-12-AN", Int_t nSteps = 5,
43                        Bool_t selectPhysics = kFALSE, Bool_t selectTrigger = kFALSE, Bool_t matchTrig = kTRUE,
44                        Bool_t applyAccCut = kTRUE, Double_t minMomentum = 0., Bool_t correctForSystematics = kTRUE,
45                        Int_t extrapMode = 1, Int_t nevents = 1234567890)
46 {
47   /// Compute the cluster resolution by studying cluster-track residual, deconvoluting from track resolution
48   /// - smode = "local" or "proof"
49   /// - inputFileName = an ESD root file or a list of ESDs or a collection of ESDs or a dataset in proof mode
50   /// - alirootVersion = version of aliroot package to enable on AAF (only used in proof mode)
51   /// - nSteps = number of times to task is run (at each step it starts with the chamber resolution obtained in the previous one)
52   /// - selectPhysics : apply or not the physics selection
53   /// - selectTrigger : select only muon trigger events or not (the type of trigger can eventually be changed)
54   /// - matchTrigger : select only the tracks matching the trigger or not
55   /// - applyAccCut : select only the tracks passing the Rabs and the eta cut or not
56   /// - minMomentum : select only the tracks with a total momentum above this value
57   /// - if correctForSystematics == kTRUE: the systematic shifts of the residuals is included in the resolution
58   /// - if extrapMode == 0: extrapolate from the closest cluster
59   /// - if extrapMode == 1: extrapolate from the previous cluster except between stations 2-3-4
60   /// - nevents = maximum number of processed events
61   
62   // Load libraries locally
63   TString extraLibs = "RAWDatabase:CDB:STEER:MUONcore:MUONmapping:MUONcalib:MUONgeometry:MUONtrigger:MUONraw:MUONbase:MUONrec:CORRFW:PWG3base:PWG3muondep";
64   LoadAlirootLocally(extraLibs);
65   
66   // compile analysis macro locally
67   gROOT->LoadMacro("$ALICE_ROOT/PWG3/muondep/MuonResolution.C++g");
68   MuonResolution(smode, inputFileName, alirootVersion, nSteps, selectPhysics, selectTrigger, matchTrig,
69                  applyAccCut, minMomentum, correctForSystematics, extrapMode, nevents, extraLibs);
70   
71 }
72
73 //______________________________________________________________________________
74 void LoadAlirootLocally(TString& extraLibs)
75 {
76   /// Load libraries locally
77   
78   // Load common libraries
79   gSystem->Load("libVMC");
80   gSystem->Load("libTree.so");
81   gSystem->Load("libPhysics.so");
82   gSystem->Load("libMinuit.so");
83   gSystem->Load("libXMLParser.so");
84   gSystem->Load("libGui.so");
85   gSystem->Load("libSTEERBase");
86   gSystem->Load("libESD");
87   gSystem->Load("libAOD");
88   gSystem->Load("libANALYSIS");
89   gSystem->Load("libANALYSISalice");
90   
91   // Load additional libraries
92   gSystem->Load("libProofPlayer");
93   TObjArray* libs = extraLibs.Tokenize(":");
94   for (Int_t i = 0; i < libs->GetEntriesFast(); i++)
95     gSystem->Load(Form("lib%s",static_cast<TObjString*>(libs->UncheckedAt(i))->GetName()));
96   delete libs;
97   
98   // Load lib for final mchview display
99   gSystem->Load("libMUONgraphics");
100   
101   // Add AliRoot includes to compile the macro
102   gROOT->ProcessLine(".include $ALICE_ROOT/include");
103   gROOT->ProcessLine(".include $ALICE_ROOT/MUON");
104   gROOT->ProcessLine(".include $ALICE_ROOT/MUON/mapping");
105   gROOT->ProcessLine(".include $ALICE_ROOT/ANALYSIS/macros");
106   
107 }
108