1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 #include <TObjArray.h>
24 #include <TDirectory.h>
26 #include "TTreeStream.h"
31 #include "AliRawReader.h"
32 #include "AliPMDRawStream.h"
33 #include "AliPMDddldata.h"
36 #include "AliPMDCalibPedestal.h"
39 ClassImp(AliPMDCalibPedestal)
42 AliPMDCalibPedestal::AliPMDCalibPedestal() :
46 // default constructor
49 for (int i = 0; i < 2; i++)
51 for (int j = 0; j < 24; j++)
53 for (int k = 0; k < 96; k++)
55 for (int l = 0; l < 96; l++)
58 fPedHisto[i][j][k][l] = new TH1F(Form("PedHisto_%d_%d_%d_%d",i,j,k,l),"",300,0.,300.);
66 //_____________________________________________________________________
67 AliPMDCalibPedestal::AliPMDCalibPedestal(const AliPMDCalibPedestal &ped) :
73 for (int i = 0; i < 2; i++)
75 for (int j = 0; j < 24; j++)
77 for (int k = 0; k < 48; k++)
79 for (int l = 0; l < 96; l++)
82 fPedHisto[i][j][k][l] = ped.fPedHisto[i][j][k][l];
89 //_____________________________________________________________________
90 AliPMDCalibPedestal& AliPMDCalibPedestal::operator = (const AliPMDCalibPedestal &source)
93 // assignment operator
95 if (&source == this) return *this;
96 new (this) AliPMDCalibPedestal(source);
100 //_____________________________________________________________________
101 AliPMDCalibPedestal::~AliPMDCalibPedestal()
106 for (int i = 0; i < 2; i++)
108 for (int j = 0; j < 24; j++)
110 for (int k = 0; k < 96; k++)
112 for (int l = 0; l < 96; l++)
115 delete fPedHisto[i][j][k][l];
121 //_____________________________________________________________________
122 Bool_t AliPMDCalibPedestal::ProcessEvent(AliRawReader *rawReader)
125 // Event processing loop - AliRawReader
128 const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
130 AliPMDRawStream rawStream(rawReader);
132 TObjArray pmdddlcont;
133 Bool_t streamout = kTRUE;
135 for (Int_t iddl = 0; iddl < kDDL; iddl++)
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++)
144 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
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();
154 fPedHisto[det][smn][row][col]->Fill((Float_t) sig);
161 //_____________________________________________________________________
163 void AliPMDCalibPedestal::Analyse(TTree *pedtree)
166 // Calculate pedestal Mean and RMS
168 Int_t DET, SM, ROW, COL;
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");
177 for (int idet = 0; idet < 2; idet++)
179 for (int ism = 0; ism < 24; ism++)
181 for (int irow = 0; irow < 48; irow++)
183 for (int icol = 0; icol < 96; icol++)
189 MEAN = fPedHisto[idet][ism][irow][icol]->GetMean();
190 RMS = fPedHisto[idet][ism][irow][icol]->GetRMS();
197 //_____________________________________________________________________