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("","",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()
108 //_____________________________________________________________________
109 Bool_t AliPMDCalibPedestal::ProcessEvent(AliRawReader *rawReader)
112 // Event processing loop - AliRawReader
115 const Int_t kDDL = AliDAQ::NumberOfDdls("PMD");
117 AliPMDRawStream rawStream(rawReader);
119 TObjArray pmdddlcont;
120 Bool_t streamout = kTRUE;
122 for (Int_t iddl = 0; iddl < kDDL; iddl++)
125 rawReader->Select("PMD", iddl, iddl);
126 //cout << reader.GetDataSize() << endl;
127 streamout = rawStream.DdlData(iddl, &pmdddlcont);
128 Int_t ientries = pmdddlcont.GetEntries();
129 for (Int_t ient = 0; ient < ientries; ient++)
131 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
133 Int_t det = pmdddl->GetDetector();
134 Int_t smn = pmdddl->GetSMN();
135 //Int_t mcm = pmdddl->GetMCM();
136 //Int_t chno = pmdddl->GetChannel();
137 Int_t row = pmdddl->GetRow();
138 Int_t col = pmdddl->GetColumn();
139 Int_t sig = pmdddl->GetSignal();
141 fPedHisto[det][smn][row][col]->Fill((Float_t) sig);
148 //_____________________________________________________________________
150 void AliPMDCalibPedestal::Analyse(TTree *pedtree)
153 // Calculate pedestal Mean and RMS
155 Int_t DET, SM, ROW, COL;
157 pedtree->Branch("DET",&DET,"DET/I");
158 pedtree->Branch("SM",&SM,"SM/I");
159 pedtree->Branch("ROW",&ROW,"ROW/I");
160 pedtree->Branch("COL",&COL,"COL/I");
161 pedtree->Branch("MEAN",&MEAN,"MEAN/F");
162 pedtree->Branch("RMS",&RMS,"RMS/F");
164 for (int idet = 0; idet < 2; idet++)
166 for (int ism = 0; ism < 24; ism++)
168 for (int irow = 0; irow < 48; irow++)
170 for (int icol = 0; icol < 96; icol++)
176 MEAN = fPedHisto[idet][ism][irow][icol]->GetMean();
177 RMS = fPedHisto[idet][ism][irow][icol]->GetRMS();
184 //_____________________________________________________________________