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