]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALSuperModule.cxx
Updated macros
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALSuperModule.cxx
CommitLineData
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/*
37890aaf 17$Log$
18Revision 1.2 2007/09/11 19:38:15 pavlinov
19added pi0 calibration, linearity, shower profile
20
0fc11500 21*/
16d3c94d 22
23//_________________________________________________________________________
24// Top EMCAL folder which will keep all information about EMCAL itself,
25// super Modules (SM), modules, towers, set of hists and so on.
0fc11500 26// TObjectSet -> TFolder; Sep 6, 2007
16d3c94d 27//
37890aaf 28//
29//
16d3c94d 30//*-- Author: Aleksei Pavlinov (WSU, Detroit, USA)
31
32#include "AliEMCALSuperModule.h"
33#include "AliEMCALFolder.h"
34#include "AliEMCALCell.h"
35#include "AliEMCALHistoUtilities.h"
36
37#include <TROOT.h>
38#include <TStyle.h>
39#include <TList.h>
40#include <TH1.h>
41#include <TF1.h>
42#include <TCanvas.h>
43#include <TLegend.h>
44#include <TLegendEntry.h>
45
46typedef AliEMCALHistoUtilities u;
47
48ClassImp(AliEMCALSuperModule)
49
0fc11500 50AliEMCALSuperModule::AliEMCALSuperModule() : TFolder()
51, fParent(0),fLh(0),fSMNumber(0)
16d3c94d 52{
37890aaf 53 //default ctor
16d3c94d 54}
55
56AliEMCALSuperModule::AliEMCALSuperModule(const Int_t m, const char* title) :
0fc11500 57TFolder(Form("SM%2.2i",m), title)
58, fParent(0),fLh(0),fSMNumber(m)
59{
37890aaf 60 //ctor
61}
62
63AliEMCALSuperModule::AliEMCALSuperModule(const AliEMCALSuperModule &sm) :
64TFolder(), fParent(sm.fParent),fLh(sm.fLh),fSMNumber(sm.fSMNumber)
65{
66 //copy ctor
67}
68
69AliEMCALSuperModule & AliEMCALSuperModule::operator =(const AliEMCALSuperModule &sm)
70{
71 // assignment operator
72// if(this == &sm)return *this;
73// ((TObject *)this)->operator=(sm);
74
75 fParent = sm.fParent;
76 fLh = sm.fLh;
77 fSMNumber = sm.fSMNumber;
78
16d3c94d 79}
80
81AliEMCALSuperModule::~AliEMCALSuperModule()
82{
83 // dtor
84}
85
86void AliEMCALSuperModule::Init()
87{
37890aaf 88 //Initialization method
89
0fc11500 90 if(GetHists()==0) {
91 fLh = BookHists();
92 Add(fLh);
93 }
16d3c94d 94}
95
96void AliEMCALSuperModule::AddCellToEtaRow(AliEMCALCell *cell, const Int_t etaRow)
97{
37890aaf 98 //Adds cells to corresponding Super module Eta Row
0fc11500 99 static TFolder *set;
100 set = dynamic_cast<TFolder*>(FindObject(Form("ETA%2.2i",etaRow)));
16d3c94d 101 if(set==0) {
0fc11500 102 set = new TFolder(Form("ETA%2.2i",etaRow),"eta row");
16d3c94d 103 Add(set);
104 }
105 set->Add(cell);
106}
107
108void AliEMCALSuperModule::FitForAllCells()
109{
37890aaf 110 //Fit histograms of each cell
111
16d3c94d 112 Int_t ncells=0;
113 for(int eta=0; eta<48; eta++) { // eta row
0fc11500 114 TFolder *setEta = dynamic_cast<TFolder*>(FindObject(Form("ETA%2.2i",eta)));
16d3c94d 115 if(setEta) {
0fc11500 116 TList* l = (TList*)setEta->GetListOfFolders();
117 printf(" eta %i : %s : cells %i \n", eta, setEta->GetName(), l->GetSize());
118 for(int phi=0; phi<l->GetSize(); phi++) { // cycle on cells (phi directions)
119 AliEMCALCell* cell = dynamic_cast<AliEMCALCell*>(l->At(phi));
120 if(cell == 0) continue;
121
16d3c94d 122 cell->FitEffMassHist();
123
124 u::FillH1(GetHists(), 1, cell->GetCcIn()*1.e+3);
125 u::FillH1(GetHists(), 2, cell->GetCcOut()*1.e+3);
126
127 TF1 *f = cell->GetFunction();
128 u::FillH1(GetHists(), 3, f->GetParameter(1));
129 u::FillH1(GetHists(), 4, f->GetParameter(2));
130 u::FillH1(GetHists(), 5, f->GetChisquare()/f->GetNDF());
131 u::FillH1(GetHists(), 6, f->GetParameter(0));
132
133 ncells++;
134 }
135 }
136 }
137 printf(" <I> AliEMCALSuperModule::FitForAllCells() : ncells %i with fit \n", ncells);
138}
139
140void AliEMCALSuperModule::FitEffMassHist()
141{
37890aaf 142 //Fit effective mass histogram
16d3c94d 143 TH1* h = (TH1*)GetHists()->At(0);
144 AliEMCALCell::FitHist(h, GetName());
145}
146
147
148void AliEMCALSuperModule::PrintInfo()
149{
37890aaf 150 //Print
16d3c94d 151 printf(" Super Module : %s : %i \n", GetName(), fSMNumber);
152 printf(" # of active cells %i \n", GetNumberOfCells());
153 TH1* h = (TH1*)GetHists()->At(0);
154 printf(" # h->Integral() of eff.mass hist %i \n", int(h->Integral()));
155}
156
157void AliEMCALSuperModule::DrawCC(int iopt)
158{
37890aaf 159 //Draw different cell histograms
16d3c94d 160 TCanvas *c=0;
161 if(iopt==1) c = new TCanvas("ccInOut","ccInOut");
162
163 gStyle->SetOptStat(0);
164
165 TH1 *hCCIn = (TH1*)GetHists()->At(1);
166 TH1 *hCCOut = (TH1*)GetHists()->At(2);
167
0fc11500 168 if(hCCIn == 0) return;
169 if(hCCIn->GetEntries()<10.) return;
170
16d3c94d 171 hCCIn->SetStats(kFALSE);
172 hCCOut->SetStats(kFALSE);
0fc11500 173 hCCOut->SetTitle("CC in and out; Iter 1; Jul 26; All Statistics");
16d3c94d 174 hCCOut->SetXTitle("cc in MeV");
175 hCCOut->SetYTitle(" N ");
176
177 u::DrawHist(hCCOut,2);
178 hCCOut->SetAxisRange(10., 24.);
179 u::DrawHist(hCCIn,2, kRed, "same");
180
181 TLegend *leg = new TLegend(0.5,0.36, 0.97,0.80);
182 TLegendEntry *leIn = leg->AddEntry(hCCIn, Form("input cc : %6.2f #pm %6.2f", hCCIn->GetMean(),hCCIn->GetRMS()), "L");
183 leIn->SetTextColor(hCCIn->GetLineColor());
0fc11500 184
185 if(hCCOut->GetEntries()>10.)
16d3c94d 186 leg->AddEntry(hCCOut, Form("output cc : %6.2f #pm %6.2f", hCCOut->GetMean(),hCCOut->GetRMS()), "L");
0fc11500 187
16d3c94d 188 leg->Draw();
189
190 if(c) c->Update();
191}
192
193Int_t AliEMCALSuperModule::GetNumberOfCells()
194{
37890aaf 195 //Returns number of cells in SM
16d3c94d 196 Int_t ncells=0;
0fc11500 197 TList* l = (TList*)GetListOfFolders();
198 for(int eta=0; eta<l->GetSize(); eta++) { // cycle on eta row
199 TFolder *setEta = dynamic_cast<TFolder*>(l->At(eta));
200 if(setEta==0) continue;
201
202 TList* le = (TList*)setEta->GetListOfFolders();
203 ncells += le->GetSize();
16d3c94d 204 }
205 return ncells;
206}
207
208TList* AliEMCALSuperModule::BookHists()
209{
37890aaf 210 //Initializes histograms
211
16d3c94d 212 gROOT->cd();
213 TH1::AddDirectory(1);
214
37890aaf 215 AliEMCALFolder* emcal = (AliEMCALFolder*)GetParent();
216 Int_t it = emcal->GetIterationNumber();
16d3c94d 217
218 new TH1F("00_EffMass", "effective mass of #gamma,#gamma(m_{#pi^{0}}=134.98 MeV) ", 250,0.0,0.5);
219 new TH1F("01_CCInput", "input CC dist.(MEV) ", 200, 5., 25.);
220 new TH1F("02_CCOutput", "output CC dist.(MEV) ", 200, 5., 25.);
221 new TH1F("03_MPI0", "mass of #pi_{0} dist. ", 170, 0.05, 0.22);
222 new TH1F("04_RESPI0", "resolution at #pi_{0} dist. ", 50, 0.0, 0.05);
223 new TH1F("05_XI2/NDF", "#chi^{2} / ndf", 50, 0.0, 5.0);
224 new TH1F("06_NPI0", "number of #pi_{0}", 150, 0.0, 1500.);
225
226 TList *l = AliEMCALHistoUtilities::MoveHistsToList(Form("HistsOfSM_%2.2i",fSMNumber), kFALSE);
227 AliEMCALHistoUtilities::AddToNameAndTitleToList(l, Form("_%2.2i_It%i",fSMNumber, it),
228 Form(" SM %2.2i, Iter %i",fSMNumber, it));
229
230 TH1::AddDirectory(0);
231 return l;
232}