]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/MUON/dep/RunMuonResolution.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGPP / MUON / dep / 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
6 //  - libESD
7 //  - libAOD
8 //  - libANALYSIS
9 //  - libANALYSISalice
10 //  - libGui
11 //  - libMinuit
12 //  - libProofPlayer
13 //  - libXMLParser
14 //  - libRAWDatabase
15 //  - libCDB
16 //  - libSTEER
17 //  - libMUONcore
18 //  - libMUONmapping
19 //  - libMUONcalib
20 //  - libMUONgeometry
21 //  - libMUONtrigger
22 //  - libMUONraw
23 //  - libMUONbase
24 //  - libMUONrec
25 //  - libCORRFW
26 //  - libPWGHFbase
27 //  - libPWGmuondep
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 rootVersion = "v5-34-01-1", TString alirootVersion = "v5-03-57-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, Bool_t shiftHalfCh = kFALSE, Bool_t shiftDE = kFALSE, 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   /// - rootVersion = version of root package to enable on AAF (only used in proof mode)
51   /// - alirootVersion = version of aliroot package to enable on AAF (only used in proof mode)
52   /// - nSteps = number of times to task is run (at each step it starts with the chamber resolution obtained in the previous one)
53   /// - selectPhysics : apply or not the physics selection
54   /// - selectTrigger : select only muon trigger events or not (the type of trigger can eventually be changed)
55   /// - matchTrigger : select only the tracks matching the trigger or not
56   /// - applyAccCut : select only the tracks passing the Rabs and the eta cut or not
57   /// - minMomentum : select only the tracks with a total momentum above this value
58   /// - if correctForSystematics == kTRUE: the systematic shifts of the residuals is included in the resolution
59   /// - if extrapMode == 0: extrapolate from the closest cluster
60   /// - if extrapMode == 1: extrapolate from the previous cluster except between stations 2-3-4
61   /// - nevents = maximum number of processed events
62   
63   // Load libraries locally
64   TString extraLibs = "RAWDatabase:CDB:STEER:MUONcore:MUONmapping:MUONcalib:MUONgeometry:MUONtrigger:MUONraw:MUONbase:MUONrec:CORRFW:PWGmuon:PWGPPMUONdep";
65   LoadAlirootLocally(extraLibs);
66   
67   // compile analysis macro locally
68   gROOT->LoadMacro("$ALICE_ROOT/PWGPP/MUON/dep/MuonResolution.C++g");
69   MuonResolution(smode, inputFileName, rootVersion, alirootVersion, nSteps, selectPhysics, selectTrigger, matchTrig,
70                  applyAccCut, minMomentum, correctForSystematics, extrapMode, shiftHalfCh, shiftDE, nevents, extraLibs);
71   
72 }
73
74 //______________________________________________________________________________
75 void LoadAlirootLocally(TString& extraLibs)
76 {
77   /// Load libraries locally
78   
79   // Load common libraries
80   gSystem->Load("libVMC");
81   gSystem->Load("libTree");
82   gSystem->Load("libPhysics");
83   gSystem->Load("libMinuit");
84   gSystem->Load("libXMLParser");
85   gSystem->Load("libGui");
86   gSystem->Load("libSTEERBase");
87   gSystem->Load("libESD");
88   gSystem->Load("libAOD");
89   gSystem->Load("libANALYSIS");
90   gSystem->Load("libANALYSISalice");
91   
92   // Load additional libraries
93   gSystem->Load("libProofPlayer");
94   TObjArray* libs = extraLibs.Tokenize(":");
95   for (Int_t i = 0; i < libs->GetEntriesFast(); i++)
96     gSystem->Load(Form("lib%s",static_cast<TObjString*>(libs->UncheckedAt(i))->GetName()));
97   delete libs;
98   
99   // Load lib for final mchview display
100   gSystem->Load("libMUONgraphics");
101   
102   // Add AliRoot includes to compile the macro
103   gROOT->ProcessLine(".include $ALICE_ROOT/include");
104   gROOT->ProcessLine(".include $ALICE_ROOT/MUON");
105   gROOT->ProcessLine(".include $ALICE_ROOT/MUON/mapping");
106   gROOT->ProcessLine(".include $ALICE_ROOT/PWG/muon");
107   gROOT->ProcessLine(".include $ALICE_ROOT/ANALYSIS/macros");
108   
109 }
110