]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/QATasks/post/PostProcessQAMultistrange.C
5d2312940bdfc473a30e884b3107b524d45b1574
[u/mrichter/AliRoot.git] / PWGLF / QATasks / post / PostProcessQAMultistrange.C
1 //////////////////////////////////////////////////
2 //
3 //  This macro was written by Domenico Colella (domenico.colella@cern.ch).
4 //  12 November 2013
5 //
6 //   ------------------------
7 //   ------ Arguments -------
8 //   ------------------------
9 //   --  icasType          =  0) Xi- 1) Xi+ 2) Omega- 3) Omega+
10 //   --  collidingsystem   =  0) PbPb  1) pp  2) pPb
11 //   --  isMC              =  kTRUE if running on MC production 
12 //   --  fileDir           =  "Input file directory"
13 //   --  filein            =  "Input file name"
14 //
15 //
16 //   -------------------------------------
17 //   ------ QATask output content --------
18 //   -------------------------------------
19 //   The output produced by the QATask is a CFContainer with 4 steps and 21 variables.
20 //   The meaning of each variable within the container are listed here:
21 //   --  0   = Max DCA Cascade Daughters                 pp: 2.0     PbPb: 0.3     pPb: 2.0
22 //   --  1   = Min DCA Bach To PV                        pp: 0.01    PbPb: 0.03    pPb: 0.03
23 //   --  2   = Min Cascade Cosine Of PA                  pp: 0.98    PbPb: 0.999   pPb: 0.95
24 //   --  3   = Min Cascade Radius Fid. Vol.              pp: 0.2     PbPb: 0.9     pPb: 0.4
25 //   --  4   = Window Invariant Mass Lambda              pp: 0.008   PbPb: 0.0008  pPb: 0.010
26 //   --  5   = Max DCA V0 Daughters                      pp: 1.5     PbPb: 1.0     pPb: 2.0
27 //   --  6   = Min V0 Cosine Of PA To PV                 pp: pT dep. PbPb: 0.98    pPb: 0.95
28 //   --  7   = Min V0 Radius Fid. Vol.                   pp: 0.2     PbPb: 0.9     pPb: 1.0
29 //   --  8   = Min DCA V0 To PV                          pp: 0.01    PbPb: 0.05    pPb: 0.05
30 //   --  9   = Min DCA Pos To PV                         pp: 0.05    PbPb: 0.1     pPb: 0.02
31 //   --  10  = Min DCA Neg To PV                         pp: 0.05    PbPb: 0.1     pPb: 0.02
32 //   --  11  = Invariant Mass distribution for Xi
33 //   --  12  = Invariant Mass distribution for Omega
34 //   --  13  = Transverse Momentum distribution
35 //   --  14  = Rapidity distribution for Xi
36 //   --  15  = Rapidity distribution for Omega
37 //   --  16  = Proper length distribution for the cascade
38 //   --  17  = Proper length distribution for the V0
39 //   --  18  = Min V0 Cosine Of PA To Xi Vertex         pp: pT dep. PbPb: pT dep.
40 //   --  19  = Centrality
41 //   --  20  = ESD track multiplicity
42 //   The last two variables are empty in the case proton-proton collisions.
43 //   In case of MC production one more CFContainer is produced, containing infos on the 
44 //   generated particles. As the previous container, this one is composed by 4 steps, one
45 //   for each cascade and 7 variables:
46 //    -- 0   = Total momentum
47 //    -- 1   = Transverse momentum
48 //    -- 2   = Rapidity
49 //    -- 3   = Pseudo-rapidity
50 //    -- 4   = Theta angle
51 //    -- 5   = Phi angle
52 //    -- 6   = Centrality
53 //    The previous container is still produced with the informations from the reconstructed
54 //    particles.
55 //
56 //
57 //   -----------------------------------
58 //   ------ Present Macro Checks -------
59 //   -----------------------------------
60 //   Using this macro many checks on the cascade topological reconstruction procedure
61 //   can be performed. In particular, the shape and the limit for the topological 
62 //   variable distributions as well as other kinematical variable distributions. The
63 //   reconstruction of the cascades are performed using two classes AliCascadeVertexer.cxx 
64 //   and AliV0vertexer.cxx contained in /STEER/ESD/ folder in Aliroot.
65 //   In the following are listed the contents of each page of the produced pdf:
66 //   
67 //   -- [Page 1] Distributions for the variables: 
68 //                DCA cascade daughters,  Bachelor IP to PV, 
69 //                Cascade cosine of PA,   Cascade radius of fiducial volume, 
70 //                Invariant mass Lambda,  DCA V0 daughters.
71 //   -- [Page 2] Distributions for the variables:
72 //                V0 cosine of PA to PV,  Min V0 Radius fiducial volume, 
73 //                Min DCA V0 To PV,       Min DCA positive To PV, 
74 //                Min DCA negative To PV, V0 cosine of PA to XiV
75 //   -- [Page 3] Distributions for the variables;
76 //                InvMass,                Transverse momentum,
77 //                Rapidity,               Cascade proper length, 
78 //                V0 proper length.
79 //   -- [Page 4] Check on the invariant mass distribution fit.
80 //   -- [Page 5] Only in case of PbPb or pPb collisions, the event centrality
81 //               distribution.
82 //   -- [Page 6] Only in case of MC production, distributions for the MC generated
83 //               particles, of the variables:
84 //                Total momentum,         Transverse momentum,
85 //                Rapidity,               Pseudo-rapidity,
86 //                Theta angle,            Phi angle,
87 //
88 //////////////////////////////////////////////////////
89
90
91
92
93 class AliCFContainer;
94
95 void PostProcessQAMultistrange(Int_t   icasType        = 0,                             // 0) Xi- 1) Xi+ 2) Omega- 3) Omega+
96                                Int_t   collidingsystem = 0,                             // 0) PbPb  1) pp 2) pPb
97                                Bool_t  isMC            = kFALSE,                         // kTRUE-->MC and kFALSE-->Exp.
98                                Char_t *fileDir         = ".",                           // Input file directory
99                                Char_t *filein          = "AnalysisResults.root"         // Input file name
100                               ) {
101
102
103      //___________________
104      //DEFINE DRAW OPTIONS
105      gStyle->SetOptStat(1110);
106      gStyle->SetOptStat(kFALSE);
107      gStyle->SetOptTitle(kFALSE);
108      gStyle->SetFrameLineWidth(2.5);
109      gStyle->SetCanvasColor(0);
110      gStyle->SetPadColor(0);
111      gStyle->SetHistLineWidth(2.5);
112      gStyle->SetLabelSize(0.05, "x");
113      gStyle->SetLabelSize(0.05, "y");
114      gStyle->SetTitleSize(0.05, "x");
115      gStyle->SetTitleSize(0.05, "y");
116      gStyle->SetTitleOffset(1.1, "x");
117      gStyle->SetPadBottomMargin(0.14);
118
119      //_______________________
120      //SOURCE USEFUL LIBRARIES
121      gSystem->Load("libANALYSIS.so");
122      gSystem->Load("libANALYSISalice.so");
123      gSystem->Load("libCORRFW.so");
124
125      //_________________________________
126      //SOURCE THE FILE AND THE CONTAINER
127      TFile *f1 = new TFile(Form("%s/%s",fileDir,filein));
128      AliCFContainer *cf = (AliCFContainer*) (f1->Get("PWGLFStrangeness.outputCheckCascade/fCFContCascadeCuts"));  
129  
130      //____________
131      //DEEFINE TEXT
132      TLatex* t1 = new TLatex(0.6,0.55,"#color[3]{OK!!}");
133      t1->SetTextSize(0.1);
134      t1->SetNDC();
135      TLatex* t2 = new TLatex(0.6,0.55,"#color[2]{NOT OK!!}");
136      t2->SetTextSize(0.1);
137      t2->SetNDC();
138      t2->SetTextColor(2);
139      TLatex* tcasc;
140      if      (icasType == 0) tcasc = new TLatex(0.8,0.7,"#color[1]{#Xi^{-}}");
141      else if (icasType == 1) tcasc = new TLatex(0.8,0.7,"#color[1]{#Xi^{+}}");
142      else if (icasType == 2) tcasc = new TLatex(0.8,0.7,"#color[1]{#Omega^{-}}");
143      else if (icasType == 3) tcasc = new TLatex(0.8,0.7,"#color[1]{#Omega^{+}}");
144      tcasc->SetTextSize(0.2);
145      tcasc->SetNDC();
146      tcasc->SetTextColor(2);
147      TLatex* tpdgmass;
148      if      (icasType == 0) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.321 GeV/c^{2}}");
149      else if (icasType == 1) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.321 GeV/c^{2}}");
150      else if (icasType == 2) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.672 GeV/c^{2}}");
151      else if (icasType == 3) tpdgmass = new TLatex(0.55,0.7,"#color[1]{PDG mass: 1.672 GeV/c^{2}}");
152      tpdgmass->SetTextSize(0.07);
153      tpdgmass->SetNDC();
154      tpdgmass->SetTextColor(2);
155
156      //________________________________ 
157      //DEFINE 1st CANVAS AND DRAW PLOTS
158      TCanvas *c1 = new TCanvas("c1","",1200,800);
159      c1->Divide(2,3); 
160        //Pad 1: DCA cascade daughters
161        c1->cd(1);
162        gPad->SetLogy();
163        TH1D *hvar0 = cf->ShowProjection(0,icasType);
164        hvar0->Draw("histo");
165        Double_t x0;
166        if      (collidingsystem == 0) x0 = 0.3;
167        else if (collidingsystem == 1) x0 = 2.0;
168        else if (collidingsystem == 2) x0 = 2.0;
169        TLine *line0 = new TLine(x0,0.,x0,hvar0->GetBinContent(hvar0->GetMaximumBin()));
170        line0->SetLineColor(kRed);
171        line0->SetLineStyle(9);
172        line0->SetLineWidth(2.0);
173        line0->Draw("same");
174           Bool_t check_0 = checkOverTheLimit(hvar0, x0);
175           if (check_0) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
176           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
177        tcasc->Draw();
178        //Pad 2: Bachelor IP to PV
179        c1->cd(2);
180        gPad->SetLogy();
181        TH1D *hvar1 = cf->ShowProjection(1,icasType);
182        hvar1->GetXaxis()->SetRangeUser(0.,0.24);
183        hvar1->Draw("histo");
184        Double_t x1;
185        if      (collidingsystem == 0) x1 = 0.03;
186        else if (collidingsystem == 1) x1 = 0.01;
187        else if (collidingsystem == 2) x1 = 0.03;
188        TLine *line1 = new TLine(x1,0.,x1,hvar1->GetBinContent(hvar1->GetMaximumBin()));
189        line1->SetLineColor(kRed);
190        line1->SetLineStyle(9);
191        line1->SetLineWidth(2.0);
192        line1->Draw("same");
193           Bool_t check_1 = checkUnderTheLimit(hvar1, x1);
194           if (check_1) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
195           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
196        //Pad 3: Cascade cosine of Pointing Angle
197        c1->cd(3);
198        gPad->SetLogy();
199        TH1D *hvar2 = cf->ShowProjection(2,icasType);
200        Double_t max2 = hvar2->GetBinContent(hvar2->GetMaximumBin());
201        hvar2->GetYaxis()->SetRangeUser(0.01,max2*1.5);
202        hvar2->Draw("histo");
203        Double_t x2;
204        if      (collidingsystem == 0) x2 = 0.999;
205        else if (collidingsystem == 1) x2 = 0.98;
206        else if (collidingsystem == 2) x2 = 0.95;
207        TLine *line2 = new TLine(x2,0.,x2,hvar2->GetBinContent(hvar2->GetMaximumBin()));
208        line2->SetLineColor(kRed);
209        line2->SetLineStyle(9);
210        line2->SetLineWidth(2.0);
211        line2->Draw("same");
212        line1->Draw("same");
213           Bool_t check_2 = checkUnderTheLimit(hvar2, x2);
214           if (check_2) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
215           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
216        //Pad 4: Cascade radius of fiducial volume
217        c1->cd(4);
218        gPad->SetLogy();
219        TH1D *hvar3 = cf->ShowProjection(3,icasType);
220        hvar3->GetXaxis()->SetRangeUser(0.,3.8);
221        hvar3->Draw("histo");
222        Double_t x3;
223        if      (collidingsystem == 0) x3 = 0.9;
224        else if (collidingsystem == 1) x3 = 0.2;
225        else if (collidingsystem == 2) x3 = 0.4;
226        TLine *line3 = new TLine(x3,0.,x3,hvar3->GetBinContent(hvar3->GetMaximumBin()));
227        line3->SetLineColor(kRed);
228        line3->SetLineStyle(9);
229        line3->SetLineWidth(2.0);
230        line3->Draw("same");
231           Bool_t check_3 = checkUnderTheLimit(hvar3, x3);
232           if (check_3) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
233           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
234        //Pad 5: Invariant mass Lambda
235        c1->cd(5);
236        TH1D *hvar4 = cf->ShowProjection(4,icasType);
237        hvar4->Draw("histo");
238        Double_t x41;
239        if      (collidingsystem < 2)  x41 = 1.116 + 0.008;
240        else if (collidingsystem == 2) x41 = 1.116 + 0.010;
241        TLine *line41 = new TLine(x41,0.,x41,hvar4->GetBinContent(hvar4->GetMaximumBin()));
242        line41->SetLineColor(kRed);
243        line41->SetLineStyle(9);
244        line41->SetLineWidth(2.0);
245        line41->Draw("same");
246        Double_t x42;
247        if      (collidingsystem < 2)  x42 = 1.115 - 0.008;
248        else if (collidingsystem == 2) x42 = 1.115 - 0.010;
249        TLine *line42 = new TLine(x42,0.,x42,hvar4->GetBinContent(hvar4->GetMaximumBin()));
250        line42->SetLineColor(kRed);
251        line42->SetLineStyle(9);
252        line42->SetLineWidth(2.0);
253        line42->Draw("same");
254           Bool_t check_4_1 = checkUnderTheLimit(hvar4, x42);
255           Bool_t check_4_2 = checkOverTheLimit(hvar4, x41);
256           if (check_4_1 && check_4_2) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
257           else                        { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
258        //Pad 6: DCA V0 daughters
259        c1->cd(6);
260        gPad->SetLogy();
261        TH1D *hvar5 = cf->ShowProjection(5,icasType);
262        hvar5->Draw("histo");
263        Double_t x5;
264        if      (collidingsystem == 0) x5 = 1.0;
265        else if (collidingsystem == 1) x5 = 1.5;
266        else if (collidingsystem == 2) x5 = 2.0;
267        TLine *line5 = new TLine(x5,0.,x5,hvar5->GetBinContent(hvar5->GetMaximumBin()));
268        line5->SetLineColor(kRed);
269        line5->SetLineStyle(9);
270        line5->SetLineWidth(2.0);
271        line5->Draw("same");
272           Bool_t check_5 = checkOverTheLimit(hvar5, x5);
273           if (check_5) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
274           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
275      c1->SaveAs("fig_lf_Multistrange.pdf(");
276     
277      //________________________________
278      //DEFINE 2nd CANVAS AND DRAW PLOTS
279      TCanvas *c2 = new TCanvas("c2","",1200,800);
280      c2->Divide(2,3);
281        //Pad 1: V0 cosine of Pointing Angle to PV
282        c2->cd(1);
283        gPad->SetLogy();
284        TH1D *hvar6 = cf->ShowProjection(6,icasType);
285        Double_t max6 = hvar6->GetBinContent(hvar6->GetMaximumBin());
286        hvar6->GetYaxis()->SetRangeUser(0.01,max6*1.5);
287        hvar6->Draw("histo");
288        //Pad 2: Min V0 Radius Fid. Vol.  
289        c2->cd(2);
290        gPad->SetLogy();
291        TH1D *hvar7 = cf->ShowProjection(7,icasType);
292        hvar7->GetXaxis()->SetRangeUser(0.,3.0);
293        hvar7->Draw("histo");
294        Double_t x7;
295        if      (collidingsystem == 0) x7 = 0.9;
296        else if (collidingsystem == 1) x7 = 0.2;
297        else if (collidingsystem == 2) x7 = 0.4;
298        TLine *line7 = new TLine(x7,0.,x7,hvar7->GetBinContent(hvar7->GetMaximumBin()));
299        line7->SetLineColor(kRed);
300        line7->SetLineStyle(9);
301        line7->SetLineWidth(2.0);
302        line7->Draw("same");
303           Bool_t check_7 = checkUnderTheLimit(hvar7, x7);
304           if (check_7) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
305           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
306        //Pad3: Min DCA V0 To PV
307        c2->cd(3);
308        gPad->SetLogy();
309        TH1D *hvar8 = cf->ShowProjection(8,icasType);
310        hvar8->GetXaxis()->SetRangeUser(0.,0.3);
311        hvar8->Draw("histo");
312        Double_t x8;
313        if      (collidingsystem == 0) x8 = 0.05;
314        else if (collidingsystem == 1) x8 = 0.01;
315        else if (collidingsystem == 2) x8 = 0.05;
316        TLine *line8 = new TLine(x8,0.,x8,hvar8->GetBinContent(hvar8->GetMaximumBin()));
317        line8->SetLineColor(kRed);
318        line8->SetLineStyle(9);
319        line8->SetLineWidth(2.0);
320        line8->Draw("same");
321           Bool_t check_8 = checkUnderTheLimit(hvar8, x8);
322           if (check_8) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
323           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
324        //Pad 4: Min DCA Pos To PV
325        c2->cd(4);
326        gPad->SetLogy();
327        TH1D *hvar9 = cf->ShowProjection(9,icasType);
328        hvar9->GetXaxis()->SetRangeUser(0.,0.2);
329        hvar9->Draw("histo");
330        Double_t x9;
331        if      (collidingsystem == 0) x9 = 0.1;
332        else if (collidingsystem == 1) x9 = 0.05;
333        else if (collidingsystem == 2) x9 = 0.02;
334        TLine *line9 = new TLine(x9,0.,x9,hvar9->GetBinContent(hvar9->GetMaximumBin()));
335        line9->SetLineColor(kRed);
336        line9->SetLineStyle(9);
337        line9->SetLineWidth(2.0);
338        line9->Draw("same");
339           Bool_t check_9 = checkUnderTheLimit(hvar9, x9);
340           if (check_9) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
341           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
342        //Pad 5: Min DCA Neg To PV
343        c2->cd(5);
344        gPad->SetLogy();
345        TH1D *hvar10 = cf->ShowProjection(10,icasType);
346        hvar10->GetXaxis()->SetRangeUser(0.,0.2);
347        hvar10->Draw("histo");
348        Double_t x10;
349        if      (collidingsystem == 0) x10 = 0.1;
350        else if (collidingsystem == 1) x10 = 0.05;
351        else if (collidingsystem == 2) x10 = 0.02;
352        TLine *line10 = new TLine(x10,0.,x10,hvar10->GetBinContent(hvar10->GetMaximumBin()));
353        line10->SetLineColor(kRed);
354        line10->SetLineStyle(9);
355        line10->SetLineWidth(2.0);
356        line10->Draw("same");
357           Bool_t check_10 = checkUnderTheLimit(hvar10, x10);
358           if (check_10) { cout<<"The cut is OK!!"<<endl; t1->Draw(); }
359           else         { cout<<"The cut is NOT OK!!"<<endl; t2->Draw(); }
360        //Pad 6: V0 cosine of Pointing Angle to Xi vtx
361        c2->cd(6);
362        gPad->SetLogy();
363        TH1D *hvar20 = cf->ShowProjection(18,icasType);
364        Double_t max20 = hvar20->GetBinContent(hvar20->GetMaximumBin());
365        hvar20->GetYaxis()->SetRangeUser(0.01,max20*1.5);
366        hvar20->Draw("histo");
367      c2->SaveAs("fig_lf_Multistrange.pdf");
368
369      //________________________________
370      //DEFINE 3rd CANVAS AND DRAW PLOTS
371      TCanvas *c3 = new TCanvas("c3","",1200,800);
372      c3->Divide(2,3);
373        //Pad 1: InvMass
374        c3->cd(1);
375        TH1D *hvar12 = cf->ShowProjection(11+icasType/2,icasType);
376        hvar12->Draw("histo");
377        tpdgmass->Draw(); 
378        TLine *linemass;
379        if      (icasType == 0) linemass = new TLine(1.32171,0.,1.32171,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
380        else if (icasType == 1) linemass = new TLine(1.32171,0.,1.32171,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
381        else if (icasType == 2) linemass = new TLine(1.67245,0.,1.67245,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
382        else if (icasType == 3) linemass = new TLine(1.67245,0.,1.67245,0.5*hvar12->GetBinContent(hvar12->GetMaximumBin()));
383        linemass->SetLineColor(kRed);
384        linemass->SetLineStyle(1);
385        linemass->SetLineWidth(2.0);
386        linemass->Draw("same");
387        //Pad 2: Transverse momentum
388        c3->cd(2);
389        TH1D *hvar13 = cf->ShowProjection(13,icasType);
390        hvar13->Draw("histo");
391        //Pad 3: Y
392        c3->cd(3);
393        TH1D *hvar14 = cf->ShowProjection(14+icasType/2,icasType);
394        hvar14->Draw("histo");
395        //Pad 4: Cascade proper length
396        c3->cd(4);
397        TH1D *hvar18;
398        hvar18 = cf->ShowProjection(16,icasType);
399        hvar18->GetXaxis()->SetRangeUser(0.,90.);
400        hvar18->Draw("histo");
401        //Pad 5: V0 proper length 
402        c3->cd(5);
403        TH1D *hvar19;
404        hvar19 = cf->ShowProjection(17,icasType);
405        hvar19->GetXaxis()->SetRangeUser(0.,90.);
406        hvar19->Draw("histo");
407        //Pad 6
408        // empty 
409      c3->SaveAs("fig_lf_Multistrange.pdf");
410
411      //________________________________ 
412      //DEFINE 4th CANVAS AND DRAW PLOTS
413      TCanvas *c4 = new TCanvas("c4","",600,400);
414      c4->Divide(2,1);
415        //Pad1: invariant mass fit
416        c4->cd(1);
417        TH1D *hvar18 = cf->ShowProjection(11+icasType/2,icasType);
418        hvar18->Draw("histo");
419         // - SOME PARAMETER VALUE
420         Bool_t kfitgauss = kFALSE;
421         Bool_t kfitleft  = kFALSE;
422         Bool_t kfitright = kFALSE;
423         Int_t  ptbinNarrowY = 0;
424         if (icasType < 2) ptbinNarrowY = 10;   // 6;
425         else              ptbinNarrowY =  3;   // 2;
426         // - SOME DEFINITIONS
427         Float_t lowlimmass;
428         Float_t uplimmass;
429         Float_t lowgausslim;
430         Float_t upgausslim;
431         if (icasType==0||icasType==1) {
432             lowlimmass=1.30;
433             uplimmass=1.34;
434             lowgausslim=1.312;
435             upgausslim=1.332;
436         } else {
437             lowlimmass=1.645;
438             uplimmass=1.70;
439             lowgausslim=1.668;
440             upgausslim=1.678;
441         }
442         TF1*  fitinvmass = new TF1("fitinvmass","gaus(0)+pol2(3)",lowlimmass,uplimmass);
443         fitinvmass->SetParName(0, "cnstntG");
444         fitinvmass->SetParName(1, "meanG");
445         fitinvmass->SetParName(2, "sigmaG");
446         fitinvmass->SetParLimits(0,0.,500000.);
447         if (icasType==0||icasType==1) {
448             fitinvmass->SetParameter(1, 1.32171);
449             fitinvmass->SetParLimits(1, 1.31,1.33);
450             fitinvmass->SetParLimits(2,0.001,0.005);
451         } else {
452             fitinvmass->SetParameter(1, 1.67245);
453             fitinvmass->SetParLimits(1, 1.664,1.68);
454             fitinvmass->SetParLimits(2,0.0008,0.006);
455         }
456         hvar18->Fit("fitinvmass","rimeN");
457         fitinvmass->SetLineColor(kRed);
458         fitinvmass->Draw("same");
459         Float_t meanGauss   = fitinvmass->GetParameter(1);
460         Float_t sigmaGauss  = fitinvmass->GetParameter(2);
461        cout<<"Mean: "<<meanGauss<<endl;
462        cout<<"Sigma: "<<sigmaGauss<<endl;
463        //Pad2: Text
464        c4->cd(2);
465        Float_t refwidth = 0.002;
466        if (icasType > 1) refwidth = 0.0025;
467        TPaveText *pave1 = new TPaveText(0.05,0.3,0.95,0.5);
468        pave1->SetFillColor(0);
469        pave1->SetTextSize(0.04);
470        pave1->SetTextAlign(12);
471        if (icasType < 2) pave1->AddText("PDG mass: 1.32171 GeV/c^{2}");
472        else              pave1->AddText("PDG mass: 1.67245 GeV/c^{2}");
473        pave1->AddText(Form("#color[1]{Mass form Fit: %.5f #pm %.5f GeV/c^{2}}",meanGauss,sigmaGauss));
474        if (sigmaGauss > refwidth - 0.0003 && sigmaGauss < refwidth + 0.0003) pave1->AddText("#color[3]{OK!! The width is compatible with standard.}");
475        else                                                                  pave1->AddText("#color[2]{NOT OK!! Problem.}");
476        pave1->Draw();
477        cout<<"   "<<refwidth - 0.0003<<"<"<<sigmaGauss<<"<"<<refwidth + 0.0003<<endl;
478      c4->SaveAs("fig_lf_Multistrange.pdf");   
479
480      //________________________________ 
481      //DEFINE 5th CANVAS AND DRAW PLOTS
482      if (collidingsystem == 0 || collidingsystem == 2) {
483          TCanvas *c5 = new TCanvas("c5","",600,720);//1200,270);
484          c5->cd(1);
485          TH1D *hvar16 = cf->ShowProjection(19,icasType);
486          hvar16->Draw("histo");
487          if      (!isMC) c5->SaveAs("fig_lf_Multistrange.pdf)");
488          else if (isMC) c5->SaveAs("fig_lf_Multistrange.pdf");
489      }
490     
491
492
493      //_______________________________
494      //CHECK ON MONTE CARLO PRODUCTION
495      if (isMC) { 
496            
497             AliCFContainer *cfMC = (AliCFContainer*) (f1->Get("PWGLFStrangeness.outputCheckCascade/fCFContCascadeMCgen"));
498             //DEFINE 6th CANVAS AND DRAW PLOTS
499             TCanvas *c6 = new TCanvas("c6","",1200,800);
500             c6->Divide(2,3);
501             //Pad 1: Total Momentum
502             c6->cd(1);
503             TH1D *hvar17 = cfMC->ShowProjection(0,icasType);
504             hvar17->Draw("histo");
505             tcasc->Draw();
506             //Pad 2: Transverse Momentum
507             c6->cd(2);
508             TH1D *hvar18 = cfMC->ShowProjection(1,icasType);
509             hvar18->Draw("histo");
510             //Pad 3: Rapidity (y)
511             c6->cd(3);
512             TH1D *hvar19 = cfMC->ShowProjection(2,icasType);
513             hvar19->Draw("histo");
514             //Pad 4: Pseudo-rapidity (eta)
515             c6->cd(4);
516             TH1D *hvar20 = cfMC->ShowProjection(3,icasType);
517             hvar20->Draw("histo");
518             //Pad 5: Theta
519             c6->cd(5);
520             TH1D *hvar21 = cfMC->ShowProjection(4,icasType);
521             hvar21->Draw("histo");
522             //Pad 6: Phi
523             c6->cd(6);
524             TH1D *hvar22 = cfMC->ShowProjection(5,icasType);
525             hvar22->Draw("histo");
526             c6->SaveAs("fig_lf_Multistrange.pdf)");
527      }
528
529
530 }
531
532
533
534 //______________________
535 Bool_t checkUnderTheLimit(TH1D *lHist, Double_t limit) {
536
537       Int_t binlimit = lHist->FindBin(limit);
538       Bool_t checkOk = kTRUE;
539       for (Int_t i = 1; i < binlimit; i++) {
540            Int_t content = 0;
541            content = lHist->GetBinContent(i);
542            if (content != 0) checkOk = kFALSE;
543            //cout<<"Content bin "<<i<<": "<<content<<endl;
544       }
545       return checkOk;
546
547 }
548
549 //______________________
550 Bool_t checkOverTheLimit(TH1D *lHist, Double_t limit) {
551
552       Int_t binlimit = lHist->FindBin(limit);
553       Int_t lastbin  = lHist->GetNbinsX();
554       Bool_t checkOk = kTRUE;
555       for (Int_t i = binlimit; i < lastbin+1; i++) {
556            Int_t content = 0;
557            content = lHist->GetBinContent(i);
558            if (content != 0) checkOk = kFALSE;
559            //cout<<"Content bin "<<i<<": "<<content<<endl;
560       }
561       return checkOk;
562
563 }
564
565
566