]>
Commit | Line | Data |
---|---|---|
16d3c94d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
0fc11500 | 16 | /* |
17 | $Log$ | |
b3bba5dc | 18 | Revision 1.2 2007/09/11 19:38:15 pavlinov |
19 | added pi0 calibration, linearity, shower profile | |
20 | ||
0fc11500 | 21 | */ |
16d3c94d | 22 | |
23 | //_________________________________________________________________________ | |
0fc11500 | 24 | // Cell folder which will keep all information about cell(tower) itself |
25 | // Initial version was created with TDataSet staf | |
26 | // TObjectSet -> TFolder; Sep 6, 2007 | |
16d3c94d | 27 | // |
28 | //*-- Author: Aleksei Pavlinov (WSU, Detroit, USA) | |
29 | ||
30 | #include "AliEMCALCell.h" | |
31 | #include "AliEMCALHistoUtilities.h" | |
32 | #include "AliEMCALGeometry.h" | |
33 | #include "AliEMCALFolder.h" | |
34 | #include "AliEMCALSuperModule.h" | |
35 | #include "AliEMCALCalibData.h" | |
0fc11500 | 36 | #include "AliEMCALRecPointsQaESDSelector.h" |
16d3c94d | 37 | #include "AliEMCALCalibCoefs.h" |
38 | ||
b3bba5dc | 39 | #include <assert.h> |
40 | ||
16d3c94d | 41 | #include <TROOT.h> |
42 | #include <TStyle.h> | |
43 | #include <TList.h> | |
44 | #include <TH1.h> | |
45 | #include <TF1.h> | |
46 | #include <TNtuple.h> | |
16d3c94d | 47 | |
48 | typedef AliEMCALHistoUtilities u; | |
49 | ||
50 | ClassImp(AliEMCALCell) | |
51 | ||
52 | Double_t ADCCHANNELEC = 0.0153; // Update 24 Apr 2007: 250./16/1024 - width of one ADC channel in GeV | |
53 | Double_t MPI0 = 0.13498; // mass of pi0 | |
54 | Double_t MPI02 = MPI0*MPI0; // mass**2 | |
55 | ||
56 | AliEMCALCell::AliEMCALCell() : | |
0fc11500 | 57 | TFolder(), |
58 | fParent(0),fLh(0), | |
16d3c94d | 59 | fAbsId(0),fSupMod(0),fModule(0),fPhi(0),fEta(0),fPhiCell(0),fEtaCell(0),fCcIn(0),fCcOut(0), |
60 | fFun(0) | |
61 | { | |
62 | } | |
63 | ||
64 | AliEMCALCell::AliEMCALCell(const Int_t absId, const char* title) : | |
0fc11500 | 65 | TFolder(Form("Cell%4.4i",absId),title), |
66 | fParent(0),fLh(0), | |
16d3c94d | 67 | fAbsId(absId),fSupMod(0),fModule(0),fPhi(0),fEta(0),fPhiCell(0),fEtaCell(0),fCcIn(0),fCcOut(0), |
68 | fFun(0) | |
69 | { | |
16d3c94d | 70 | |
71 | AliEMCALGeometry *g = AliEMCALGeometry::GetInstance(); | |
72 | g->GetCellIndex(fAbsId, fSupMod, fModule, fPhi, fEta); | |
73 | g->GetCellPhiEtaIndexInSModule(fSupMod, fModule, fPhi, fEta, fPhiCell, fEtaCell); | |
74 | ||
75 | } | |
76 | ||
77 | AliEMCALCell::~AliEMCALCell() | |
78 | { | |
79 | // dtor | |
80 | } | |
0fc11500 | 81 | //------------------------------------------------------------------------------------- |
16d3c94d | 82 | |
83 | void AliEMCALCell::SetCCfromDB(AliEMCALCalibData *ccDb) | |
84 | { | |
85 | if(ccDb == 0) return; | |
86 | // fADCchannelEC = fCalibData->GetADCchannel(iSupMod,ieta,iphi); | |
87 | // fetaCel-column; fPhiCell- row | |
88 | fCcIn = ccDb->GetADCchannel(fSupMod, fEtaCell, fPhiCell); // in GeV | |
89 | ||
90 | TH1* h = (TH1*)GetHists()->At(0); | |
91 | u::AddToNameAndTitle(h, 0, Form(", cc %5.2f MeV", fCcIn*1.e+3)); | |
92 | } | |
93 | ||
94 | void AliEMCALCell::SetCCfromCCTable(AliEMCALCalibCoefs *t) | |
95 | { | |
0fc11500 | 96 | if(t == 0) { |
97 | // Dump(); | |
98 | return; | |
99 | } | |
100 | if(fLh == 0) { | |
101 | fLh = BookHists(); | |
102 | Add(fLh); | |
103 | } | |
16d3c94d | 104 | |
105 | calibCoef *r = t->GetTable(fAbsId); | |
106 | if(r && r->absId == fAbsId) { | |
107 | fCcIn = r->cc; | |
108 | } else { // something wrong | |
109 | if(r) printf(" fAbsId %i : r->absId %i \n", fAbsId, r->absId); | |
110 | assert(0); | |
111 | } | |
112 | ||
113 | TH1* h = (TH1*)GetHists()->At(0); | |
114 | u::AddToNameAndTitle(h, 0, Form(", cc %5.2f MeV", fCcIn*1.e+3)); | |
115 | } | |
116 | ||
117 | void AliEMCALCell::FillEffMass(const Double_t mgg) | |
118 | { | |
119 | u::FillH1(GetHists(), 0, mgg); | |
120 | } | |
121 | ||
122 | void AliEMCALCell::FillCellNtuple(TNtuple *nt) | |
123 | { | |
124 | if(nt==0) return; | |
125 | nt->Fill(fAbsId,fSupMod,fModule,fPhi,fEta,fPhiCell,fEtaCell,fCcIn,fCcOut); | |
126 | } | |
127 | ||
128 | void AliEMCALCell::FitHist(TH1* h, const char* name, const char* opt) | |
129 | { | |
130 | TString optFit(""), OPT(opt); | |
131 | OPT.ToUpper(); | |
132 | if(h==0) return; | |
0fc11500 | 133 | printf("<I> AliEMCALCell::FitHist : |%s| is started : opt %s\n", h->GetName(), opt); |
16d3c94d | 134 | TString tit(h->GetTitle()); |
135 | ||
136 | TF1 *GausPol2 = 0, *g=0, *bg=0; | |
0fc11500 | 137 | if(h->GetListOfFunctions()->GetSize() == 0 || 1) { |
16d3c94d | 138 | g = u::Gausi(name, 0.0, 0.4, h); // gaus estimation |
139 | ||
140 | g->SetParLimits(0, h->Integral()/20., h->Integral()); | |
141 | g->SetParLimits(1, 0.08, 0.20); | |
142 | g->SetParLimits(2, 0.001, 0.02); | |
143 | ||
144 | g->SetParameter(0, 1200.); | |
145 | g->SetParameter(1, h->GetBinLowEdge(h->GetMaximumBin())); | |
146 | g->SetParameter(2, 0.010); | |
147 | ||
148 | g->SetLineColor(kRed); | |
149 | g->SetLineWidth(2); | |
150 | ||
151 | optFit = "0NQ"; | |
152 | h->Fit(g, optFit.Data(),"", 0.001, 0.3); | |
153 | ||
154 | optFit = "0NQIME"; | |
155 | h->Fit(g, optFit.Data(),"", 0.001, 0.3); | |
156 | ||
157 | bg = new TF1(Form("bg%s",name), "pol2", 0.0, 0.3); | |
158 | optFit = "0NQ"; | |
159 | h->Fit(bg, optFit.Data(),"", 0.0, 0.3); | |
160 | ||
161 | GausPol2 = u::GausiPol2(name, 0.00, 0.3, g, bg); | |
162 | optFit = "0Q"; | |
163 | h->Fit(GausPol2, optFit.Data(),"", 0.03, 0.28); | |
164 | // Clean up | |
165 | delete g; | |
166 | delete bg; | |
167 | optFit = "0IME+"; // no drwaing at all | |
168 | if(tit.Contains("SM") || OPT.Contains("DRAW")) optFit = "IME+"; | |
169 | } else { | |
170 | GausPol2 = (TF1*)h->GetListOfFunctions()->At(0); | |
171 | optFit = "IME+"; | |
0fc11500 | 172 | printf("<I> Function is defined alredy : %s optFit %s \n", GausPol2->GetTitle(), optFit.Data()); |
16d3c94d | 173 | } |
174 | // optFit = "IME+"; | |
175 | h->Fit(GausPol2, optFit.Data(),"", 0.01, 0.28); | |
176 | ||
177 | if(optFit.Contains("0") == 0) { | |
178 | gStyle->SetOptFit(111); | |
179 | u::DrawHist(h,2); | |
180 | } | |
0fc11500 | 181 | printf("<I> AliEMCALCell::FitHist : |%s| is ended \n\n", h->GetName()); |
16d3c94d | 182 | } |
183 | ||
184 | void AliEMCALCell::FitEffMassHist(const char* opt) | |
185 | { | |
0fc11500 | 186 | AliEMCALFolder* EMCAL = AliEMCALRecPointsQaESDSelector::GetEmcalFolder(); |
16d3c94d | 187 | Int_t it = EMCAL->GetIterationNumber(); |
188 | ||
189 | TH1* h = (TH1*)GetHists()->At(0); | |
190 | ||
191 | FitHist(h, GetName(), opt); | |
192 | ||
193 | fFun = (TF1*)h->GetListOfFunctions()->At(0); | |
194 | if(fFun) { | |
195 | Double_t mpi = fFun->GetParameter(1), mpi2 = mpi*mpi; | |
196 | Double_t ccTmp = fCcIn * MPI02 / mpi2; | |
0fc11500 | 197 | if(it<=1) { // Jul 16, 2007 |
16d3c94d | 198 | fCcOut = ccTmp; |
199 | } else { | |
200 | fCcOut = (ccTmp + fCcIn)/2.; | |
201 | } | |
202 | printf(" fFun %s | %s : iet %i\n", fFun->GetName(), fFun->GetTitle(), it); | |
203 | } | |
204 | printf(" %s | fCcIn %6.5f -> % 6.5f <- fCcOut \n", GetTitle(), fCcIn , fCcOut); | |
205 | } | |
206 | ||
0fc11500 | 207 | void AliEMCALCell::PrintInfo() |
16d3c94d | 208 | { |
0fc11500 | 209 | printf(" %s %s \n", GetName(), GetTitle()); |
210 | if(fLh == 0 ) return; | |
16d3c94d | 211 | TH1* h = (TH1*)GetHists()->At(0); |
212 | TF1 *f = (TF1*)h->GetListOfFunctions()->At(0); | |
16d3c94d | 213 | if(fFun) printf(" fFun : %s | %s \n", fFun->GetName(), fFun->GetTitle()); |
214 | else fFun = f; | |
0fc11500 | 215 | // if(f) f->Dump(); |
16d3c94d | 216 | } |
217 | ||
218 | TList* AliEMCALCell::BookHists() | |
219 | { | |
220 | gROOT->cd(); | |
221 | TH1::AddDirectory(1); | |
222 | ||
0fc11500 | 223 | AliEMCALFolder* EMCAL = AliEMCALRecPointsQaESDSelector::GetEmcalFolder(); |
16d3c94d | 224 | Int_t it = EMCAL->GetIterationNumber(); |
225 | ||
226 | new TH1F("01_EffMass", "effective mass of #gamma,#gamma(m_{#pi^{0}}=134.98 MeV) ", 60,0.0,0.3); | |
227 | ||
228 | TList *l = AliEMCALHistoUtilities::MoveHistsToList(Form("HistsOfCell%4.4i",fAbsId), kFALSE); | |
229 | AliEMCALHistoUtilities::AddToNameAndTitleToList(l, Form("4.4i_It%i",fAbsId,it), | |
230 | Form(" Cell %4.4i, iter. %i",fAbsId, it)); | |
231 | ||
232 | TH1::AddDirectory(0); | |
233 | return l; | |
234 | } |