1+ // Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+ // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+ // All rights not expressly granted are reserved.
4+ //
5+ // This software is distributed under the terms of the GNU General Public
6+ // License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+ //
8+ // In applying this license CERN does not waive the privileges and immunities
9+ // granted to it by virtue of its status as an Intergovernmental Organization
10+ // or submit itself to any jurisdiction.
11+
12+ const int nHists = 7 ;
13+ TH1F * mee [nHists ];
14+ TH1F * mee_orig [nHists ];
15+ TString histNames [nHists ] = {"" , "_Pi0" , "_Eta" , "_EtaP" ,
16+ "_Rho" , "_Omega" , "_Phi" };
17+ TString histLegends [nHists ] = {
18+ "Cocktail sum" ,
19+ "#pi^{0}#rightarrow#gammae^{+}e^{-}" ,
20+ "#eta#rightarrow#gammae^{+}e^{-}" ,
21+ "#eta'#rightarrow#gammae^{+}e^{-}, #eta'#rightarrow#omegae^{+}e^{-}" ,
22+ "#rho#rightarrowe^{+}e^{-}" ,
23+ "#omega#rightarrow#pi^{0}e^{+}e^{-}, #omega#rightarrowe^{+}e^{-}" ,
24+ "#phi#rightarrow#etae^{+}e^{-}, #phi#rightarrow#pi^{0}e^{+}e^{-}, "
25+ "#phi#rightarrowe^{+}e^{-}" };
26+
27+ void loadHistos (TFile * file , TH1F * hists [], TString name_extra , int rebin ,
28+ int nEvents )
29+ {
30+ for (int i = 0 ; i < nHists ; i ++ ) {
31+ hists [i ] = (TH1F * )file -> GetDirectory ("em-lmee-lf-cocktail" )
32+ -> Get (TString ("mee" ) + name_extra + histNames [i ]);
33+ hists [i ]-> Rebin (rebin );
34+ hists [i ]-> Scale (1. / nEvents );
35+ hists [i ]-> SetTitle (histLegends [i ]);
36+ }
37+ }
38+
39+ void plotLFCocktail (TString filename = "AnalysisResults.root" , int rebin = 1 )
40+ {
41+
42+ TFile * file = TFile ::Open (filename .Data ());
43+
44+ TH1I * hNEvents =
45+ (TH1I * )file -> GetDirectory ("em-lmee-lf-cocktail" )-> Get ("NEvents" );
46+ int nEvents = hNEvents -> GetBinContent (1 );
47+
48+ loadHistos (file , mee , "" , rebin , nEvents );
49+ loadHistos (file , mee_orig , "_orig" , rebin , nEvents );
50+
51+ auto canvas = new TCanvas ("LF Cocktail" , "LF Cocktail" , 1500 , 500 );
52+ canvas -> Divide (2 , 1 );
53+
54+ mee [0 ]-> SetStats (0 );
55+ mee [0 ]-> GetXaxis ()-> SetRangeUser (0.0 , 1.1 );
56+ mee_orig [0 ]-> SetStats (0 );
57+ mee_orig [0 ]-> GetXaxis ()-> SetRangeUser (0.0 , 1.1 );
58+
59+ canvas -> cd (1 );
60+ gPad -> SetLogy ();
61+ for (int i = 0 ; i < nHists ; i ++ ) {
62+ mee_orig [i ]-> SetLineColor (i + 1 );
63+ mee_orig [i ]-> Draw ("same" );
64+ }
65+ gPad -> BuildLegend (0.62 , 0.9 , 0.9 , 0.6 );
66+ mee_orig [0 ]-> SetTitle ("before resolution and acceptance" );
67+ canvas -> cd (2 );
68+ gPad -> SetLogy ();
69+ for (int i = 0 ; i < nHists ; i ++ ) {
70+ mee [i ]-> SetLineColor (i + 1 );
71+ mee [i ]-> Draw ("same" );
72+ }
73+ gPad -> BuildLegend (0.62 , 0.9 , 0.9 , 0.6 );
74+ mee [0 ]-> SetTitle ("after resolution and acceptance" );
75+ }
0 commit comments