]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/corrs/DrawCorrELoss.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / corrs / DrawCorrELoss.C
1 /**
2  * @file 
3  * 
4  * Scripts to draw energy loss fits from correction object file 
5  *
6  * @ingroup pwglf_forward_scripts_corr
7  */
8 void Setup(Bool_t compile)
9 {
10   const char* post = (compile ? "++g" : "");
11   const char* fwd  = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
12   if (!gROOT->GetClass("AliFMDCorrELossFit"))
13     gROOT->Macro(Form("%s/scripts/LoadLibs.C", fwd));
14   gSystem->AddIncludePath(Form("-I%s/scripts -I%s/corrs -I%s "
15                                "-I$ALICE_ROOT/include", fwd, fwd, fwd));
16   gROOT->LoadMacro(Form("%s/scripts/SummaryDrawer.C%s", fwd, post));
17   gROOT->LoadMacro(Form("%s/corrs/CorrDrawer.C%s", fwd, post));
18
19 }
20 /** 
21  * Draw energy loss fits to a multi-page PDF. 
22  *
23  * @par Input: 
24  * The input file is expected to contain a AliFMDCorrELossFit object
25  * named @c elossfits in the top level directory.
26  * 
27  * @par Output: 
28  * A multi-page PDF.  Note, that the PDF generated by ROOT in this way
29  * is broken (cannot be read by Acrobat Reader on Windows and MacOSX)
30  * and one should pass it through a filter to correct these problems.
31  * 
32  * @param runNo   Run number
33  * @param sys     Collision system 
34  * @param sNN     Collision energy in GeV
35  * @param field   L3 field strength
36  * @param mc      For simulation input 
37  * @param sat     For satellite interactions 
38  * @param fname   File name 
39  * @param details Drawing options 
40  *
41  * @ingroup pwglf_forward_scripts_corr
42  */
43 void
44 DrawCorrELoss(ULong_t runNo, UShort_t sys, UShort_t sNN, Short_t field,
45               Bool_t mc=false, Bool_t sat=false, 
46               const char* fname=0, Bool_t details=true)
47 {
48   // Load libraries and object 
49   // const char* fwd = "$ALICE_ROOT/PWGLF/FORWARD/analysis2";
50   Setup(false);
51
52   CorrDrawer d;
53   d.Summarize(AliForwardCorrectionManager::kELossFits, runNo, sys, sNN, field, 
54               mc, sat, "", fname);
55 }
56 /** 
57  * Draw the energy loss correction
58  * 
59  * @param mc    For MC 
60  * @param file  Input file with the full fits 
61  * @param local Local correction database 
62  */
63 void
64 DrawCorrELoss(Bool_t      mc, 
65               const char* file="forward_eloss.root", 
66               const char* local="fmd_corrections.root")
67 {
68   Setup(true);
69
70   CorrDrawer::Summarize(AliForwardCorrectionManager::kELossFits, 
71                         mc, file, local, "LANDSCAPE FEW");
72 }
73 /** 
74  * Draw the energy loss correction
75  * 
76  * @param mc    For MC 
77  * @param dummy Not used
78  * @param file  Input file with the full fits 
79  */
80 void 
81 DrawCorrELoss(Bool_t mc, Bool_t dummy, 
82               const char* file="forward_eloss_rerun.root")
83 {
84   Setup(true);
85
86   Printf("Drawing fit results from %s", file);
87   TFile* hist = TFile::Open(file, "READ");
88   if (!hist) { 
89     Error("DrawCorrELoss", "Failed to open %s", file);
90     return;
91   }
92   TList* res = static_cast<TList*>(hist->Get("ForwardELossResults"));
93   if (!res) { 
94     Error("DrawCorrEloss", "Failed to get ForwardELossResults from %s", file);
95     return;
96   }
97   TList* ef = static_cast<TList*>(res->FindObject("fmdEnergyFitter"));
98   if (!ef) { 
99     Error("DrawCorrEloss", "Failed to get fmdEnergyFitter from %s:/%s", 
100           file, res->GetName());
101     return;
102   }
103
104   AliFMDCorrELossFit* fits = 
105     static_cast<AliFMDCorrELossFit*>(ef->FindObject("AliFMDCorrELossFit"));
106   if (!fits) {
107     Error("DrawCorrEloss", "Failed to get AliFMDCorrELossFit from %s:/%s/%s", 
108           file, res->GetName(), ef->GetName());
109     return;
110   }
111   
112   CorrDrawer* cd = new CorrDrawer;
113   cd->fELossExtra = file;
114   cd->fMinQuality = 8;
115   // cd->fLandscape = true;
116   cd->Summarize(const_cast<const AliFMDCorrELossFit*>(fits), true);
117 }
118
119 //
120 // EOF
121 //