]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/STRANGENESS/LambdaK0PbPb/FitSpectrum.C
An effective FD corretion
[u/mrichter/AliRoot.git] / PWGLF / STRANGENESS / LambdaK0PbPb / FitSpectrum.C
1 void FitSpectrum(const char* filename, const char * listName = "clambdak0Histo_00", const char* suffix = "test",Int_t ihist = 0, Int_t iparticle) {
2   
3   // load basic libs, needed to 
4   //gROOT->LoadMacro("run.C");
5   gROOT->LoadMacro("runQA.C");
6   InitAndLoadLibs();
7
8   // Load Lee's Macro
9   gROOT->LoadMacro("AliMassFitControl.h+g");
10   gROOT->LoadMacro("PtMassAna2.C");
11   gROOT->LoadMacro("MultYields2QA.C");
12
13   char* histName = 0;
14   switch (iparticle) {
15   case 0:
16     switch (ihist){
17           case 0:
18                 histName = "h2PtVsMassK0";
19                 break;
20           case 1:
21                 histName = "h2DcaPosToPrimVertexK0vsMassK0";
22                 break;
23           case 2:
24                 histName = "h2DcaNegToPrimVertexK0vsMassK0";
25                 break;
26           case 3:
27                 histName = "h2RadiusV0K0vsMassK0";
28                 break;
29           case 4:
30                 histName = "h2DecayLengthV0K0vsMassK0";   
31                 break;
32           case 5:
33                 histName = "h2DcaV0DaughtersK0vsMassK0";
34                 break;
35           case 6:
36                 histName = "h2CosPointAngleK0vsMassK0";
37                 break;
38           default:
39                 cout << "FitSpectrum - unrecognised histogram, default is standard pt" << endl;
40                 histName = "h2PtVsMassK0";
41           }
42     break;
43   case 1:
44     switch (ihist){
45           case 0:
46                 histName = "h2PtVsMassLambda";   
47                 break;
48           case 1:
49                 histName = "h2DcaPosToPrimVertexLvsMassL";   
50                 break;
51           case 2:
52                 histName = "h2DcaNegToPrimVertexLvsMassL";   
53                 break;
54           case 3:
55                 histName = "h2RadiusV0LvsMassL";   
56                 break;
57           case 4:
58                 histName = "h2DecayLengthV0LvsMassL";   
59                 break;
60           case 5:
61                 histName = "h2DcaV0DaughtersLvsMassL";
62                 break;
63           case 6:
64                 histName = "h2CosPointAngleLvsMassL";
65                 break;
66           default:
67                 cout << "FitSpectrum - unrecognised histogram, default is standard pt" << endl;
68                 histName = "h2PtVsMassLambda";   
69           }
70     break;
71     case 2:
72       histName = "h2PtVsMassAntiLambda";
73       break;
74     case 3:
75       // This is special case because we have to find two histograms and add them.
76       // It is dealt with separately below but we still set histname because it is appended
77       // to file names for control plots
78       histName = "h2PtVsMassLLbarSummed";
79       break;
80     default:
81       cout << "Particle "<< iparticle << " yet to be implemented" << endl;
82       return;
83   }
84   cout << "FitSpectrum - histogram " << histName << " used" << endl;
85
86   
87   TFile *file = new TFile(filename);
88   TList *list = file->Get(listName); 
89   TH2F* h2;
90   if (iparticle == 3) { // Special case of combined Lambda + anti-Lambda
91     TH2F* hLam = (TH2F*)list->FindObject("h2PtVsMassLambda");
92     h2= (TH2F*)list->FindObject("h2PtVsMassAntiLambda");
93     h2->Add(hLam);
94   } else {
95     h2 = (TH2F*) list->FindObject(histName);
96   }
97
98   h2->Draw();
99   
100   ///// iNorm is used by MultYields2QA to normalize the distributions
101   TH1F * h1 = (TH1F*) list->FindObject("h1PrimaryVertexZ");
102   Int_t iNorm = h1->GetEntries();
103   cout << "number of entries with Zvertex < |10cm|: " << iNorm;
104
105   TString suffixFull = histName;
106   if(strlen(suffix)) suffixFull = suffixFull + "_" + suffix;
107   //MultYields3((TH3F*)h2,iparticle,0,suffixFull); // FIXME: modify MultYields2 to handle 1D histos
108   MultYields2QA(h2,iparticle,ihist,iNorm,0,suffixFull); // FIXME: modify MultYields2 to handle 1D histos
109
110   
111 }