1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Top EMCAL folder which will keep all information about EMCAL itself,
20 // super Modules (SM), modules, towers, set of hists and so on.
22 //*-- Author: Aleksei Pavlinov (WSU, Detroit, USA)
24 #include "AliEMCALCell.h"
25 #include "AliEMCALHistoUtilities.h"
26 #include "AliEMCALGeometry.h"
27 #include "AliEMCALFolder.h"
28 #include "AliEMCALSuperModule.h"
29 #include "AliEMCALCalibData.h"
31 #include "AliEMCALCalibCoefs.h"
39 #include <TObjectSet.h>
41 typedef AliEMCALHistoUtilities u;
43 ClassImp(AliEMCALCell)
45 Double_t ADCCHANNELEC = 0.0153; // Update 24 Apr 2007: 250./16/1024 - width of one ADC channel in GeV
46 Double_t MPI0 = 0.13498; // mass of pi0
47 Double_t MPI02 = MPI0*MPI0; // mass**2
49 AliEMCALCell::AliEMCALCell() :
51 fAbsId(0),fSupMod(0),fModule(0),fPhi(0),fEta(0),fPhiCell(0),fEtaCell(0),fCcIn(0),fCcOut(0),
56 AliEMCALCell::AliEMCALCell(const Int_t absId, const char* title) :
57 TObjectSet(Form("Cell%4.4i",absId)),
58 fAbsId(absId),fSupMod(0),fModule(0),fPhi(0),fEta(0),fPhiCell(0),fEtaCell(0),fCcIn(0),fCcOut(0),
63 AliEMCALGeometry *g = AliEMCALGeometry::GetInstance();
64 g->GetCellIndex(fAbsId, fSupMod, fModule, fPhi, fEta);
65 g->GetCellPhiEtaIndexInSModule(fSupMod, fModule, fPhi, fEta, fPhiCell, fEtaCell);
69 AliEMCALCell::~AliEMCALCell()
74 void AliEMCALCell::SetCCfromDB(AliEMCALCalibData *ccDb)
77 // fADCchannelEC = fCalibData->GetADCchannel(iSupMod,ieta,iphi);
78 // fetaCel-column; fPhiCell- row
79 fCcIn = ccDb->GetADCchannel(fSupMod, fEtaCell, fPhiCell); // in GeV
81 TH1* h = (TH1*)GetHists()->At(0);
82 u::AddToNameAndTitle(h, 0, Form(", cc %5.2f MeV", fCcIn*1.e+3));
85 void AliEMCALCell::SetCCfromCCTable(AliEMCALCalibCoefs *t)
88 this->AddObject((TObject*)BookHists(), kTRUE);
90 calibCoef *r = t->GetTable(fAbsId);
91 if(r && r->absId == fAbsId) {
93 } else { // something wrong
94 if(r) printf(" fAbsId %i : r->absId %i \n", fAbsId, r->absId);
98 TH1* h = (TH1*)GetHists()->At(0);
99 u::AddToNameAndTitle(h, 0, Form(", cc %5.2f MeV", fCcIn*1.e+3));
102 void AliEMCALCell::FillEffMass(const Double_t mgg)
104 u::FillH1(GetHists(), 0, mgg);
107 void AliEMCALCell::FillCellNtuple(TNtuple *nt)
110 nt->Fill(fAbsId,fSupMod,fModule,fPhi,fEta,fPhiCell,fEtaCell,fCcIn,fCcOut);
113 void AliEMCALCell::FitHist(TH1* h, const char* name, const char* opt)
115 TString optFit(""), OPT(opt);
118 printf("<I> AliEMCALCell::FitHist : h %p |%s| is started : opt %s\n", h, h->GetName(), opt);
119 TString tit(h->GetTitle());
121 TF1 *GausPol2 = 0, *g=0, *bg=0;
122 if(h->GetListOfFunctions()->GetSize() == 0) {
123 g = u::Gausi(name, 0.0, 0.4, h); // gaus estimation
125 g->SetParLimits(0, h->Integral()/20., h->Integral());
126 g->SetParLimits(1, 0.08, 0.20);
127 g->SetParLimits(2, 0.001, 0.02);
129 g->SetParameter(0, 1200.);
130 g->SetParameter(1, h->GetBinLowEdge(h->GetMaximumBin()));
131 g->SetParameter(2, 0.010);
133 g->SetLineColor(kRed);
137 h->Fit(g, optFit.Data(),"", 0.001, 0.3);
140 h->Fit(g, optFit.Data(),"", 0.001, 0.3);
142 bg = new TF1(Form("bg%s",name), "pol2", 0.0, 0.3);
144 h->Fit(bg, optFit.Data(),"", 0.0, 0.3);
146 GausPol2 = u::GausiPol2(name, 0.00, 0.3, g, bg);
148 h->Fit(GausPol2, optFit.Data(),"", 0.03, 0.28);
152 optFit = "0IME+"; // no drwaing at all
153 if(tit.Contains("SM") || OPT.Contains("DRAW")) optFit = "IME+";
155 GausPol2 = (TF1*)h->GetListOfFunctions()->At(0);
159 h->Fit(GausPol2, optFit.Data(),"", 0.01, 0.28);
161 if(optFit.Contains("0") == 0) {
162 gStyle->SetOptFit(111);
165 printf("<I> AliEMCALCell::FitHist : h %p |%s| is ended \n\n", h, h->GetName());
168 void AliEMCALCell::FitEffMassHist(const char* opt)
170 AliEMCALFolder* EMCAL = (AliEMCALFolder*)(GetParent()->GetParent()->GetParent());
171 Int_t it = EMCAL->GetIterationNumber();
173 TH1* h = (TH1*)GetHists()->At(0);
175 FitHist(h, GetName(), opt);
177 fFun = (TF1*)h->GetListOfFunctions()->At(0);
179 Double_t mpi = fFun->GetParameter(1), mpi2 = mpi*mpi;
180 Double_t ccTmp = fCcIn * MPI02 / mpi2;
184 fCcOut = (ccTmp + fCcIn)/2.;
186 printf(" fFun %s | %s : iet %i\n", fFun->GetName(), fFun->GetTitle(), it);
188 printf(" %s | fCcIn %6.5f -> % 6.5f <- fCcOut \n", GetTitle(), fCcIn , fCcOut);
191 void AliEMCALCell::Print()
193 TH1* h = (TH1*)GetHists()->At(0);
194 TF1 *f = (TF1*)h->GetListOfFunctions()->At(0);
195 printf(" %s %s \n", GetName(), GetTitle());
196 if(fFun) printf(" fFun : %s | %s \n", fFun->GetName(), fFun->GetTitle());
201 TList* AliEMCALCell::BookHists()
204 TH1::AddDirectory(1);
206 AliEMCALFolder* EMCAL = (AliEMCALFolder*)(GetParent()->GetParent()->GetParent());
207 Int_t it = EMCAL->GetIterationNumber();
209 new TH1F("01_EffMass", "effective mass of #gamma,#gamma(m_{#pi^{0}}=134.98 MeV) ", 60,0.0,0.3);
211 TList *l = AliEMCALHistoUtilities::MoveHistsToList(Form("HistsOfCell%4.4i",fAbsId), kFALSE);
212 AliEMCALHistoUtilities::AddToNameAndTitleToList(l, Form("4.4i_It%i",fAbsId,it),
213 Form(" Cell %4.4i, iter. %i",fAbsId, it));
215 TH1::AddDirectory(0);