]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDCalibPedestal.cxx
added HLTOUT treatment for HLTReconstruction
[u/mrichter/AliRoot.git] / PMD / AliPMDCalibPedestal.cxx
CommitLineData
24e8f6b2 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
17//Root includes
18#include <TObjArray.h>
19#include <TH1F.h>
20#include <TString.h>
21#include <TMath.h>
22#include <TF1.h>
23#include <TRandom.h>
24#include <TDirectory.h>
25#include <TFile.h>
26#include "TTreeStream.h"
27
28//AliRoot includes
9d7353e3 29#include "AliDAQ.h"
30#include "AliLog.h"
24e8f6b2 31#include "AliRawReader.h"
32#include "AliPMDRawStream.h"
33#include "AliPMDddldata.h"
34
35//header file
36#include "AliPMDCalibPedestal.h"
37
38
39ClassImp(AliPMDCalibPedestal)
40
41
42AliPMDCalibPedestal::AliPMDCalibPedestal() :
43 TObject()
44{
45 //
46 // default constructor
47 //
48
49 for (int i = 0; i < 2; i++)
50 {
51 for (int j = 0; j < 24; j++)
52 {
53 for (int k = 0; k < 96; k++)
54 {
55 for (int l = 0; l < 96; l++)
56 {
57
f3646355 58 fPedHisto[i][j][k][l] = new TH1F(Form("PedHisto_%d_%d_%d_%d",i,j,k,l),"",300,0.,300.);
24e8f6b2 59 }
60 }
61 }
62 }
63
64
65}
66//_____________________________________________________________________
67AliPMDCalibPedestal::AliPMDCalibPedestal(const AliPMDCalibPedestal &ped) :
68 TObject(ped)
69{
70 //
71 // copy constructor
72 //
73 for (int i = 0; i < 2; i++)
74 {
75 for (int j = 0; j < 24; j++)
76 {
9d7353e3 77 for (int k = 0; k < 48; k++)
24e8f6b2 78 {
79 for (int l = 0; l < 96; l++)
80 {
81
82 fPedHisto[i][j][k][l] = ped.fPedHisto[i][j][k][l];
83 }
84 }
85 }
86 }
87
88}
89//_____________________________________________________________________
90AliPMDCalibPedestal& AliPMDCalibPedestal::operator = (const AliPMDCalibPedestal &source)
91{
92 //
93 // assignment operator
94 //
95 if (&source == this) return *this;
96 new (this) AliPMDCalibPedestal(source);
97
98 return *this;
99}
100//_____________________________________________________________________
101AliPMDCalibPedestal::~AliPMDCalibPedestal()
102{
103 //
104 // destructor
105 //
f3646355 106 for (int i = 0; i < 2; i++)
107 {
108 for (int j = 0; j < 24; j++)
109 {
110 for (int k = 0; k < 96; k++)
111 {
112 for (int l = 0; l < 96; l++)
113 {
114
115 delete fPedHisto[i][j][k][l];
116 }
117 }
118 }
119 }
24e8f6b2 120}
121//_____________________________________________________________________
122Bool_t AliPMDCalibPedestal::ProcessEvent(AliRawReader *rawReader)
123{
124 //
125 // Event processing loop - AliRawReader
126 //
9d7353e3 127
128 const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
129
24e8f6b2 130 AliPMDRawStream rawStream(rawReader);
131
132 TObjArray pmdddlcont;
133 Bool_t streamout = kTRUE;
134
9d7353e3 135 for (Int_t iddl = 0; iddl < kDDL; iddl++)
24e8f6b2 136 {
137
138 rawReader->Select("PMD", iddl, iddl);
139 //cout << reader.GetDataSize() << endl;
140 streamout = rawStream.DdlData(iddl, &pmdddlcont);
141 Int_t ientries = pmdddlcont.GetEntries();
142 for (Int_t ient = 0; ient < ientries; ient++)
143 {
144 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
145
146 Int_t det = pmdddl->GetDetector();
147 Int_t smn = pmdddl->GetSMN();
148 //Int_t mcm = pmdddl->GetMCM();
149 //Int_t chno = pmdddl->GetChannel();
150 Int_t row = pmdddl->GetRow();
151 Int_t col = pmdddl->GetColumn();
152 Int_t sig = pmdddl->GetSignal();
153
154 fPedHisto[det][smn][row][col]->Fill((Float_t) sig);
155
156 }
157 pmdddlcont.Clear();
158 }
159 return streamout;
160}
161//_____________________________________________________________________
162
9d7353e3 163void AliPMDCalibPedestal::Analyse(TTree *pedtree)
24e8f6b2 164{
165 //
166 // Calculate pedestal Mean and RMS
167 //
9d7353e3 168 Int_t DET, SM, ROW, COL;
169 Float_t MEAN, RMS;
170 pedtree->Branch("DET",&DET,"DET/I");
171 pedtree->Branch("SM",&SM,"SM/I");
172 pedtree->Branch("ROW",&ROW,"ROW/I");
173 pedtree->Branch("COL",&COL,"COL/I");
174 pedtree->Branch("MEAN",&MEAN,"MEAN/F");
175 pedtree->Branch("RMS",&RMS,"RMS/F");
176
177 for (int idet = 0; idet < 2; idet++)
24e8f6b2 178 {
9d7353e3 179 for (int ism = 0; ism < 24; ism++)
24e8f6b2 180 {
9d7353e3 181 for (int irow = 0; irow < 48; irow++)
24e8f6b2 182 {
9d7353e3 183 for (int icol = 0; icol < 96; icol++)
24e8f6b2 184 {
9d7353e3 185 DET = idet;
186 SM = ism;
187 ROW = irow;
188 COL = icol;
189 MEAN = fPedHisto[idet][ism][irow][icol]->GetMean();
190 RMS = fPedHisto[idet][ism][irow][icol]->GetRMS();
191 pedtree->Fill();
24e8f6b2 192 }
193 }
194 }
195 }
196}
197//_____________________________________________________________________