]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALSuperModule.cxx
Bug in flag returned by Process (A.Colla)
[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
16/* $Id$ */
17
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.
21//
22//*-- Author: Aleksei Pavlinov (WSU, Detroit, USA)
23
24#include "AliEMCALSuperModule.h"
25#include "AliEMCALFolder.h"
26#include "AliEMCALCell.h"
27#include "AliEMCALHistoUtilities.h"
28
29#include <TROOT.h>
30#include <TStyle.h>
31#include <TList.h>
32#include <TH1.h>
33#include <TF1.h>
34#include <TCanvas.h>
35#include <TLegend.h>
36#include <TLegendEntry.h>
37
38typedef AliEMCALHistoUtilities u;
39
40ClassImp(AliEMCALSuperModule)
41
42AliEMCALSuperModule::AliEMCALSuperModule() : TObjectSet(),
43fSMNumber(0)
44{
45}
46
47AliEMCALSuperModule::AliEMCALSuperModule(const Int_t m, const char* title) :
48TObjectSet(Form("SM%2.2i",m)),
49fSMNumber(m)
50{
51 SetTitle(title);
52}
53
54AliEMCALSuperModule::~AliEMCALSuperModule()
55{
56 // dtor
57}
58
59void AliEMCALSuperModule::Init()
60{
61 if(GetHists()==0) this->AddObject(BookHists(), kTRUE);
62}
63
64void AliEMCALSuperModule::AddCellToEtaRow(AliEMCALCell *cell, const Int_t etaRow)
65{
66 static TDataSet *set;
67 set = FindByName(Form("ETA%2.2i",etaRow));
68 if(set==0) {
69 set = new TDataSet(Form("ETA%2.2i",etaRow));
70 Add(set);
71 }
72 set->Add(cell);
73}
74
75void AliEMCALSuperModule::FitForAllCells()
76{
77 Int_t ncells=0;
78 for(int eta=0; eta<48; eta++) { // eta row
79 TDataSet *setEta = FindByName(Form("ETA%2.2i",eta));
80 if(setEta) {
81 printf(" eta %i : %s : cells %i \n", eta, setEta->GetName(), setEta->GetListSize());
82 for(int phi=0; phi<setEta->GetListSize(); phi++) { // cycle on cells (phi directions)
83 AliEMCALCell* cell = (AliEMCALCell*)setEta->At(phi);
84 cell->FitEffMassHist();
85
86 u::FillH1(GetHists(), 1, cell->GetCcIn()*1.e+3);
87 u::FillH1(GetHists(), 2, cell->GetCcOut()*1.e+3);
88
89 TF1 *f = cell->GetFunction();
90 u::FillH1(GetHists(), 3, f->GetParameter(1));
91 u::FillH1(GetHists(), 4, f->GetParameter(2));
92 u::FillH1(GetHists(), 5, f->GetChisquare()/f->GetNDF());
93 u::FillH1(GetHists(), 6, f->GetParameter(0));
94
95 ncells++;
96 }
97 }
98 }
99 printf(" <I> AliEMCALSuperModule::FitForAllCells() : ncells %i with fit \n", ncells);
100}
101
102void AliEMCALSuperModule::FitEffMassHist()
103{
104 TH1* h = (TH1*)GetHists()->At(0);
105 AliEMCALCell::FitHist(h, GetName());
106}
107
108
109void AliEMCALSuperModule::PrintInfo()
110{
111 printf(" Super Module : %s : %i \n", GetName(), fSMNumber);
112 printf(" # of active cells %i \n", GetNumberOfCells());
113 TH1* h = (TH1*)GetHists()->At(0);
114 printf(" # h->Integral() of eff.mass hist %i \n", int(h->Integral()));
115}
116
117void AliEMCALSuperModule::DrawCC(int iopt)
118{
119 TCanvas *c=0;
120 if(iopt==1) c = new TCanvas("ccInOut","ccInOut");
121
122 gStyle->SetOptStat(0);
123
124 TH1 *hCCIn = (TH1*)GetHists()->At(1);
125 TH1 *hCCOut = (TH1*)GetHists()->At(2);
126
127 hCCIn->SetStats(kFALSE);
128 hCCOut->SetStats(kFALSE);
129 hCCOut->SetTitle("CC in and out");
130 hCCOut->SetXTitle("cc in MeV");
131 hCCOut->SetYTitle(" N ");
132
133 u::DrawHist(hCCOut,2);
134 hCCOut->SetAxisRange(10., 24.);
135 u::DrawHist(hCCIn,2, kRed, "same");
136
137 TLegend *leg = new TLegend(0.5,0.36, 0.97,0.80);
138 TLegendEntry *leIn = leg->AddEntry(hCCIn, Form("input cc : %6.2f #pm %6.2f", hCCIn->GetMean(),hCCIn->GetRMS()), "L");
139 leIn->SetTextColor(hCCIn->GetLineColor());
140 leg->AddEntry(hCCOut, Form("output cc : %6.2f #pm %6.2f", hCCOut->GetMean(),hCCOut->GetRMS()), "L");
141 leg->Draw();
142
143 if(c) c->Update();
144}
145
146Int_t AliEMCALSuperModule::GetNumberOfCells()
147{
148 Int_t ncells=0;
149 for(int eta=0; eta<GetListSize(); eta++) { // cycle on eta row
150 TDataSet *set = At(eta);
151 ncells += set->GetListSize();
152 }
153 return ncells;
154}
155
156TList* AliEMCALSuperModule::BookHists()
157{
158 gROOT->cd();
159 TH1::AddDirectory(1);
160
161 AliEMCALFolder* EMCAL = (AliEMCALFolder*)GetParent();
162 Int_t it = EMCAL->GetIterationNumber();
163
164 new TH1F("00_EffMass", "effective mass of #gamma,#gamma(m_{#pi^{0}}=134.98 MeV) ", 250,0.0,0.5);
165 new TH1F("01_CCInput", "input CC dist.(MEV) ", 200, 5., 25.);
166 new TH1F("02_CCOutput", "output CC dist.(MEV) ", 200, 5., 25.);
167 new TH1F("03_MPI0", "mass of #pi_{0} dist. ", 170, 0.05, 0.22);
168 new TH1F("04_RESPI0", "resolution at #pi_{0} dist. ", 50, 0.0, 0.05);
169 new TH1F("05_XI2/NDF", "#chi^{2} / ndf", 50, 0.0, 5.0);
170 new TH1F("06_NPI0", "number of #pi_{0}", 150, 0.0, 1500.);
171
172 TList *l = AliEMCALHistoUtilities::MoveHistsToList(Form("HistsOfSM_%2.2i",fSMNumber), kFALSE);
173 AliEMCALHistoUtilities::AddToNameAndTitleToList(l, Form("_%2.2i_It%i",fSMNumber, it),
174 Form(" SM %2.2i, Iter %i",fSMNumber, it));
175
176 TH1::AddDirectory(0);
177 return l;
178}