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 | |
39 | ClassImp(AliPMDCalibPedestal) |
40 | |
41 | |
42 | AliPMDCalibPedestal::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 | |
58 | fPedHisto[i][j][k][l] = new TH1F("","",300,0.,300.); |
59 | } |
60 | } |
61 | } |
62 | } |
63 | |
64 | |
65 | } |
66 | //_____________________________________________________________________ |
67 | AliPMDCalibPedestal::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 | //_____________________________________________________________________ |
90 | AliPMDCalibPedestal& 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 | //_____________________________________________________________________ |
101 | AliPMDCalibPedestal::~AliPMDCalibPedestal() |
102 | { |
103 | // |
104 | // destructor |
105 | // |
106 | delete fPedHisto; |
107 | } |
108 | //_____________________________________________________________________ |
109 | Bool_t AliPMDCalibPedestal::ProcessEvent(AliRawReader *rawReader) |
110 | { |
111 | // |
112 | // Event processing loop - AliRawReader |
113 | // |
9d7353e3 |
114 | |
115 | const Int_t kDDL = AliDAQ::NumberOfDdls("PMD"); |
116 | |
24e8f6b2 |
117 | AliPMDRawStream rawStream(rawReader); |
118 | |
119 | TObjArray pmdddlcont; |
120 | Bool_t streamout = kTRUE; |
121 | |
9d7353e3 |
122 | for (Int_t iddl = 0; iddl < kDDL; iddl++) |
24e8f6b2 |
123 | { |
124 | |
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++) |
130 | { |
131 | AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient); |
132 | |
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(); |
140 | |
141 | fPedHisto[det][smn][row][col]->Fill((Float_t) sig); |
142 | |
143 | } |
144 | pmdddlcont.Clear(); |
145 | } |
146 | return streamout; |
147 | } |
148 | //_____________________________________________________________________ |
149 | |
9d7353e3 |
150 | void AliPMDCalibPedestal::Analyse(TTree *pedtree) |
24e8f6b2 |
151 | { |
152 | // |
153 | // Calculate pedestal Mean and RMS |
154 | // |
9d7353e3 |
155 | Int_t DET, SM, ROW, COL; |
156 | Float_t MEAN, RMS; |
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"); |
163 | |
164 | for (int idet = 0; idet < 2; idet++) |
24e8f6b2 |
165 | { |
9d7353e3 |
166 | for (int ism = 0; ism < 24; ism++) |
24e8f6b2 |
167 | { |
9d7353e3 |
168 | for (int irow = 0; irow < 48; irow++) |
24e8f6b2 |
169 | { |
9d7353e3 |
170 | for (int icol = 0; icol < 96; icol++) |
24e8f6b2 |
171 | { |
9d7353e3 |
172 | DET = idet; |
173 | SM = ism; |
174 | ROW = irow; |
175 | COL = icol; |
176 | MEAN = fPedHisto[idet][ism][irow][icol]->GetMean(); |
177 | RMS = fPedHisto[idet][ism][irow][icol]->GetRMS(); |
178 | pedtree->Fill(); |
24e8f6b2 |
179 | } |
180 | } |
181 | } |
182 | } |
183 | } |
184 | //_____________________________________________________________________ |