]>
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$ | |
b217491f | 18 | Revision 1.3 2007/09/12 17:44:22 pavlinov |
19 | fixed compilation problem under SuSe Linux | |
20 | ||
b3bba5dc | 21 | Revision 1.2 2007/09/11 19:38:15 pavlinov |
22 | added pi0 calibration, linearity, shower profile | |
23 | ||
0fc11500 | 24 | */ |
16d3c94d | 25 | |
26 | //_________________________________________________________________________ | |
b217491f | 27 | // Cell folder which will keep all information |
28 | // about cell(tower) itself | |
29 | // Initial version was created with TDataSet staf | |
30 | // TObjectSet -> TFolder; Sep 6, 2007 | |
16d3c94d | 31 | // |
32 | //*-- Author: Aleksei Pavlinov (WSU, Detroit, USA) | |
33 | ||
34 | #include "AliEMCALCell.h" | |
35 | #include "AliEMCALHistoUtilities.h" | |
36 | #include "AliEMCALGeometry.h" | |
37 | #include "AliEMCALFolder.h" | |
38 | #include "AliEMCALSuperModule.h" | |
39 | #include "AliEMCALCalibData.h" | |
0fc11500 | 40 | #include "AliEMCALRecPointsQaESDSelector.h" |
16d3c94d | 41 | #include "AliEMCALCalibCoefs.h" |
42 | ||
b217491f | 43 | #include <cassert> |
b3bba5dc | 44 | |
16d3c94d | 45 | #include <TROOT.h> |
46 | #include <TStyle.h> | |
47 | #include <TList.h> | |
48 | #include <TH1.h> | |
49 | #include <TF1.h> | |
50 | #include <TNtuple.h> | |
16d3c94d | 51 | |
52 | typedef AliEMCALHistoUtilities u; | |
53 | ||
54 | ClassImp(AliEMCALCell) | |
55 | ||
6f377f0c | 56 | //______________________________________________________________ |
16d3c94d | 57 | AliEMCALCell::AliEMCALCell() : |
0fc11500 | 58 | TFolder(), |
59 | fParent(0),fLh(0), | |
16d3c94d | 60 | fAbsId(0),fSupMod(0),fModule(0),fPhi(0),fEta(0),fPhiCell(0),fEtaCell(0),fCcIn(0),fCcOut(0), |
61 | fFun(0) | |
62 | { | |
6f377f0c | 63 | //default ctor |
16d3c94d | 64 | } |
65 | ||
6f377f0c | 66 | //______________________________________________________________ |
67 | AliEMCALCell::AliEMCALCell(const AliEMCALCell& cell) : | |
68 | TFolder(cell.GetName(),cell.GetTitle()), | |
69 | fParent(cell.fParent),fLh(cell.fLh), | |
70 | fAbsId(cell.fAbsId),fSupMod(cell.fSupMod), | |
71 | fModule(cell.fModule),fPhi(cell.fPhi), | |
72 | fEta(cell.fEta),fPhiCell(cell.fPhiCell), | |
73 | fEtaCell(cell.fEtaCell),fCcIn(cell.fCcIn), | |
74 | fCcOut(cell.fCcOut),fFun(cell.fFun) | |
75 | { | |
76 | //copy ctor | |
77 | } | |
78 | ||
79 | //______________________________________________________________ | |
16d3c94d | 80 | AliEMCALCell::AliEMCALCell(const Int_t absId, const char* title) : |
0fc11500 | 81 | TFolder(Form("Cell%4.4i",absId),title), |
82 | fParent(0),fLh(0), | |
16d3c94d | 83 | fAbsId(absId),fSupMod(0),fModule(0),fPhi(0),fEta(0),fPhiCell(0),fEtaCell(0),fCcIn(0),fCcOut(0), |
84 | fFun(0) | |
85 | { | |
b217491f | 86 | // Oct 15, 2007 |
16d3c94d | 87 | AliEMCALGeometry *g = AliEMCALGeometry::GetInstance(); |
88 | g->GetCellIndex(fAbsId, fSupMod, fModule, fPhi, fEta); | |
89 | g->GetCellPhiEtaIndexInSModule(fSupMod, fModule, fPhi, fEta, fPhiCell, fEtaCell); | |
90 | ||
91 | } | |
92 | ||
6f377f0c | 93 | //______________________________________________________________ |
16d3c94d | 94 | AliEMCALCell::~AliEMCALCell() |
95 | { | |
96 | // dtor | |
97 | } | |
98 | ||
6f377f0c | 99 | //------------------------------------------------------------------------------------- |
16d3c94d | 100 | void AliEMCALCell::SetCCfromDB(AliEMCALCalibData *ccDb) |
101 | { | |
b217491f | 102 | // Oct 15, 2007 |
16d3c94d | 103 | if(ccDb == 0) return; |
104 | // fADCchannelEC = fCalibData->GetADCchannel(iSupMod,ieta,iphi); | |
105 | // fetaCel-column; fPhiCell- row | |
106 | fCcIn = ccDb->GetADCchannel(fSupMod, fEtaCell, fPhiCell); // in GeV | |
107 | ||
108 | TH1* h = (TH1*)GetHists()->At(0); | |
109 | u::AddToNameAndTitle(h, 0, Form(", cc %5.2f MeV", fCcIn*1.e+3)); | |
110 | } | |
111 | ||
6f377f0c | 112 | //______________________________________________________________ |
16d3c94d | 113 | void AliEMCALCell::SetCCfromCCTable(AliEMCALCalibCoefs *t) |
114 | { | |
b217491f | 115 | // Oct 15, 2007 |
116 | if(t == 0) return; | |
117 | ||
0fc11500 | 118 | if(fLh == 0) { |
119 | fLh = BookHists(); | |
120 | Add(fLh); | |
121 | } | |
16d3c94d | 122 | |
b217491f | 123 | AliEMCALCalibCoef *r = t->GetTable(fAbsId); |
124 | if(r && r->fAbsId == fAbsId) { | |
125 | fCcIn = r->fCc; | |
16d3c94d | 126 | } else { // something wrong |
b217491f | 127 | if(r) printf(" fAbsId %i : r->absId %i \n", fAbsId, r->fAbsId); |
16d3c94d | 128 | assert(0); |
129 | } | |
130 | ||
131 | TH1* h = (TH1*)GetHists()->At(0); | |
132 | u::AddToNameAndTitle(h, 0, Form(", cc %5.2f MeV", fCcIn*1.e+3)); | |
133 | } | |
134 | ||
6f377f0c | 135 | //______________________________________________________________ |
16d3c94d | 136 | void AliEMCALCell::FillEffMass(const Double_t mgg) |
137 | { | |
138 | u::FillH1(GetHists(), 0, mgg); | |
139 | } | |
140 | ||
6f377f0c | 141 | //______________________________________________________________ |
16d3c94d | 142 | void AliEMCALCell::FillCellNtuple(TNtuple *nt) |
143 | { | |
144 | if(nt==0) return; | |
145 | nt->Fill(fAbsId,fSupMod,fModule,fPhi,fEta,fPhiCell,fEtaCell,fCcIn,fCcOut); | |
146 | } | |
147 | ||
6f377f0c | 148 | //______________________________________________________________ |
16d3c94d | 149 | void AliEMCALCell::FitHist(TH1* h, const char* name, const char* opt) |
150 | { | |
b217491f | 151 | // Oct 15, 2007 |
152 | TString optFit(""), sopt(opt); | |
153 | sopt.ToUpper(); | |
16d3c94d | 154 | if(h==0) return; |
0fc11500 | 155 | printf("<I> AliEMCALCell::FitHist : |%s| is started : opt %s\n", h->GetName(), opt); |
16d3c94d | 156 | TString tit(h->GetTitle()); |
157 | ||
b217491f | 158 | TF1 *gausPol2 = 0, *g=0, *bg=0; |
0fc11500 | 159 | if(h->GetListOfFunctions()->GetSize() == 0 || 1) { |
16d3c94d | 160 | g = u::Gausi(name, 0.0, 0.4, h); // gaus estimation |
161 | ||
162 | g->SetParLimits(0, h->Integral()/20., h->Integral()); | |
163 | g->SetParLimits(1, 0.08, 0.20); | |
164 | g->SetParLimits(2, 0.001, 0.02); | |
165 | ||
166 | g->SetParameter(0, 1200.); | |
167 | g->SetParameter(1, h->GetBinLowEdge(h->GetMaximumBin())); | |
168 | g->SetParameter(2, 0.010); | |
169 | ||
170 | g->SetLineColor(kRed); | |
171 | g->SetLineWidth(2); | |
172 | ||
173 | optFit = "0NQ"; | |
174 | h->Fit(g, optFit.Data(),"", 0.001, 0.3); | |
175 | ||
176 | optFit = "0NQIME"; | |
177 | h->Fit(g, optFit.Data(),"", 0.001, 0.3); | |
178 | ||
179 | bg = new TF1(Form("bg%s",name), "pol2", 0.0, 0.3); | |
180 | optFit = "0NQ"; | |
181 | h->Fit(bg, optFit.Data(),"", 0.0, 0.3); | |
182 | ||
b217491f | 183 | gausPol2 = u::GausiPol2(name, 0.00, 0.3, g, bg); |
16d3c94d | 184 | optFit = "0Q"; |
b217491f | 185 | h->Fit(gausPol2, optFit.Data(),"", 0.03, 0.28); |
16d3c94d | 186 | // Clean up |
187 | delete g; | |
188 | delete bg; | |
189 | optFit = "0IME+"; // no drwaing at all | |
b217491f | 190 | if(tit.Contains("SM") || sopt.Contains("DRAW")) optFit = "IME+"; |
16d3c94d | 191 | } else { |
b217491f | 192 | gausPol2 = (TF1*)h->GetListOfFunctions()->At(0); |
16d3c94d | 193 | optFit = "IME+"; |
b217491f | 194 | printf("<I> Function is defined alredy : %s optFit %s \n", gausPol2->GetTitle(), optFit.Data()); |
16d3c94d | 195 | } |
196 | // optFit = "IME+"; | |
b217491f | 197 | h->Fit(gausPol2, optFit.Data(),"", 0.01, 0.28); |
16d3c94d | 198 | |
199 | if(optFit.Contains("0") == 0) { | |
200 | gStyle->SetOptFit(111); | |
201 | u::DrawHist(h,2); | |
202 | } | |
0fc11500 | 203 | printf("<I> AliEMCALCell::FitHist : |%s| is ended \n\n", h->GetName()); |
16d3c94d | 204 | } |
205 | ||
6f377f0c | 206 | //______________________________________________________________ |
16d3c94d | 207 | void AliEMCALCell::FitEffMassHist(const char* opt) |
208 | { | |
b217491f | 209 | // Oct 15, 2007 |
210 | static Double_t mPI0 = 0.13498; // mass of pi0 | |
211 | static Double_t mPI02 = mPI0*mPI0; // mass**2 | |
212 | ||
213 | AliEMCALFolder* emcal = AliEMCALRecPointsQaESDSelector::GetEmcalFolder(); | |
214 | Int_t it = emcal->GetIterationNumber(); | |
16d3c94d | 215 | |
216 | TH1* h = (TH1*)GetHists()->At(0); | |
217 | ||
218 | FitHist(h, GetName(), opt); | |
219 | ||
220 | fFun = (TF1*)h->GetListOfFunctions()->At(0); | |
221 | if(fFun) { | |
222 | Double_t mpi = fFun->GetParameter(1), mpi2 = mpi*mpi; | |
b217491f | 223 | Double_t ccTmp = fCcIn * mPI02 / mpi2; |
0fc11500 | 224 | if(it<=1) { // Jul 16, 2007 |
16d3c94d | 225 | fCcOut = ccTmp; |
226 | } else { | |
227 | fCcOut = (ccTmp + fCcIn)/2.; | |
228 | } | |
229 | printf(" fFun %s | %s : iet %i\n", fFun->GetName(), fFun->GetTitle(), it); | |
230 | } | |
231 | printf(" %s | fCcIn %6.5f -> % 6.5f <- fCcOut \n", GetTitle(), fCcIn , fCcOut); | |
232 | } | |
233 | ||
6f377f0c | 234 | //______________________________________________________________ |
0fc11500 | 235 | void AliEMCALCell::PrintInfo() |
16d3c94d | 236 | { |
b217491f | 237 | // Oct 15, 2007 |
0fc11500 | 238 | printf(" %s %s \n", GetName(), GetTitle()); |
239 | if(fLh == 0 ) return; | |
16d3c94d | 240 | TH1* h = (TH1*)GetHists()->At(0); |
241 | TF1 *f = (TF1*)h->GetListOfFunctions()->At(0); | |
16d3c94d | 242 | if(fFun) printf(" fFun : %s | %s \n", fFun->GetName(), fFun->GetTitle()); |
243 | else fFun = f; | |
0fc11500 | 244 | // if(f) f->Dump(); |
16d3c94d | 245 | } |
246 | ||
6f377f0c | 247 | //______________________________________________________________ |
16d3c94d | 248 | TList* AliEMCALCell::BookHists() |
249 | { | |
b217491f | 250 | // Oct 15, 2007 |
16d3c94d | 251 | gROOT->cd(); |
252 | TH1::AddDirectory(1); | |
253 | ||
b217491f | 254 | AliEMCALFolder* emcal = AliEMCALRecPointsQaESDSelector::GetEmcalFolder(); |
255 | Int_t it = emcal->GetIterationNumber(); | |
16d3c94d | 256 | |
257 | new TH1F("01_EffMass", "effective mass of #gamma,#gamma(m_{#pi^{0}}=134.98 MeV) ", 60,0.0,0.3); | |
258 | ||
259 | TList *l = AliEMCALHistoUtilities::MoveHistsToList(Form("HistsOfCell%4.4i",fAbsId), kFALSE); | |
260 | AliEMCALHistoUtilities::AddToNameAndTitleToList(l, Form("4.4i_It%i",fAbsId,it), | |
261 | Form(" Cell %4.4i, iter. %i",fAbsId, it)); | |
262 | ||
263 | TH1::AddDirectory(0); | |
264 | return l; | |
265 | } |