]>
Commit | Line | Data |
---|---|---|
5253c153 | 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 | // $Id$ | |
17 | ||
18 | #include "AliMUONPedestal.h" | |
19 | #include "AliMUONErrorCounter.h" | |
20 | #include "AliMUONVStore.h" | |
21 | #include "AliMUON2DMap.h" | |
22 | #include "AliMUONCalibParamND.h" | |
f3cfa63e | 23 | #include "AliMpConstants.h" |
5253c153 | 24 | #include <TString.h> |
5253c153 | 25 | #include <TTimeStamp.h> |
26 | #include <TMath.h> | |
27 | #include <TTree.h> | |
28 | #include <TFile.h> | |
29 | #include <TH1F.h> | |
ff496840 | 30 | #include <THashList.h> |
5253c153 | 31 | #include <Riostream.h> |
32 | ||
33 | #include <sstream> | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | /// \class AliMUONPedestal | |
37 | /// | |
38 | /// Implementation of the pedestal computing | |
39 | /// | |
40 | /// add | |
41 | /// | |
42 | /// | |
43 | /// \author Alberto Baldisseri, JL Charvet (05/05/2009) | |
44 | //----------------------------------------------------------------------------- | |
45 | ||
46 | /// \cond CLASSIMP | |
47 | ClassImp(AliMUONPedestal) | |
48 | /// \endcond | |
49 | ||
50 | //______________________________________________________________________________ | |
51 | AliMUONPedestal::AliMUONPedestal() | |
52 | : TObject(), | |
f3cfa63e | 53 | //fN(0), |
f9e83f1d | 54 | fNCurrentEvents(0), |
55 | fNEvthreshold(0), | |
ff496840 | 56 | fSorting(0), |
5253c153 | 57 | fNEvents(0), |
58 | fRunNumber(0), | |
59 | fNChannel(0), | |
60 | fNManu(0), | |
f3cfa63e | 61 | fNManuConfig(0), |
d9e6dc5e | 62 | fConfig(1), |
a54854fc | 63 | fErrorBuspatchTable(new AliMUON2DMap(kFALSE)), |
64 | fManuBuspatchTable(new AliMUON2DMap(kFALSE)), | |
1b15b395 | 65 | fManuBPoutofconfigTable(new AliMUON2DMap(kFALSE)), |
5253c153 | 66 | fDate(new TTimeStamp()), |
67 | fFilcout(0), | |
f3cfa63e | 68 | fHistoFileName(), |
a54854fc | 69 | fPedestalStore(new AliMUON2DMap(kTRUE)), |
f3cfa63e | 70 | fIndex(-1), |
71 | fPrefixDA() | |
5253c153 | 72 | { |
73 | /// Default constructor | |
5253c153 | 74 | } |
5253c153 | 75 | |
76 | //______________________________________________________________________________ | |
77 | AliMUONPedestal::~AliMUONPedestal() | |
78 | { | |
79 | /// Destructor | |
a54854fc | 80 | delete fErrorBuspatchTable; |
81 | delete fManuBuspatchTable; | |
dbbb2c64 | 82 | delete fPedestalStore; |
1b15b395 | 83 | delete fManuBPoutofconfigTable; |
5253c153 | 84 | } |
85 | ||
1b15b395 | 86 | //______________________________________________________________________________ |
f3cfa63e | 87 | const char* |
88 | AliMUONPedestal::GetHistoFileName() const | |
89 | { | |
90 | /// Return the name of file we use to store histograms | |
91 | return fHistoFileName.Data(); | |
92 | } | |
93 | ||
94 | //______________________________________________________________________________ | |
95 | void AliMUONPedestal::LoadConfig(const char* dbfile) | |
1b15b395 | 96 | { |
97 | /// Load MUONTRK configuration from ascii file "dbfile" (in DetDB) | |
98 | ||
99 | Int_t manuId; | |
100 | Int_t busPatchId; | |
101 | ||
f3cfa63e | 102 | ifstream filein(dbfile,ios::in); |
f3cfa63e | 103 | |
104 | while (!filein.eof()) | |
1b15b395 | 105 | { |
f3cfa63e | 106 | filein >> busPatchId >> manuId; |
1b15b395 | 107 | |
108 | AliMUONErrorCounter* manuCounter; | |
109 | AliMUONVCalibParam* ped = | |
110 | static_cast<AliMUONVCalibParam*>(fPedestalStore ->FindObject(busPatchId, manuId)); | |
111 | ||
112 | if (!ped) { | |
f3cfa63e | 113 | fNManuConfig++; |
1b15b395 | 114 | fNChannel+=64; |
f3cfa63e | 115 | ped = new AliMUONCalibParamND(2, AliMpConstants::ManuNofChannels(),busPatchId, manuId, -1.); // put default wise -1, not connected channel |
1b15b395 | 116 | fPedestalStore ->Add(ped); |
117 | ||
118 | if (!(manuCounter = static_cast<AliMUONErrorCounter*>(fManuBuspatchTable->FindObject(busPatchId,manuId)))) | |
119 | { | |
120 | // New (buspatch,manu) | |
121 | manuCounter = new AliMUONErrorCounter(busPatchId,manuId); | |
122 | fManuBuspatchTable->Add(manuCounter); | |
123 | } | |
124 | } | |
125 | } | |
126 | } | |
5253c153 | 127 | //______________________________________________________________________________ |
128 | void AliMUONPedestal::MakePed(Int_t busPatchId, Int_t manuId, Int_t channelId, Int_t charge) | |
129 | { | |
b9c33bca | 130 | static Int_t warn=0; |
5253c153 | 131 | /// Compute pedestals values |
132 | AliMUONVCalibParam* ped = | |
133 | static_cast<AliMUONVCalibParam*>(fPedestalStore ->FindObject(busPatchId, manuId)); | |
134 | ||
1b15b395 | 135 | if (!ped) |
136 | { | |
137 | if(fConfig) | |
138 | { // Fill out_of_config (buspatch,manu) table | |
139 | if (!(static_cast<AliMUONErrorCounter*>(fManuBPoutofconfigTable->FindObject(busPatchId,manuId)))) | |
140 | fManuBPoutofconfigTable->Add(new AliMUONErrorCounter(busPatchId,manuId)); | |
b9c33bca | 141 | if(warn<10) cout << " !!! WARNING : busPatchId = " << busPatchId << " manuId = " << manuId << " not in the Detector configuration " << endl; |
142 | else if(warn==10) cout << " !!! see .log file for an exhaustive list of (busPatchId, manuId) out of Detector configuration \n" << endl; | |
143 | warn++; | |
144 | (*fFilcout) << " !!! WARNING : busPatchId = " << busPatchId << " manuId = " << manuId << " not in the Detector configuration " << endl; | |
1b15b395 | 145 | } |
146 | else {fNManu++;} | |
147 | fNChannel+=64; | |
148 | // put default wise -1, not connected channel | |
f3cfa63e | 149 | ped = new AliMUONCalibParamND(2, AliMpConstants::ManuNofChannels(),busPatchId, manuId, -1.); |
1b15b395 | 150 | fPedestalStore ->Add(ped); |
151 | } | |
5253c153 | 152 | |
153 | // Initialization for the first value | |
1b15b395 | 154 | if (ped->ValueAsDouble(channelId, 0) == -1) |
155 | { | |
156 | if(fConfig && channelId == 0){fNManu++;} | |
157 | ped->SetValueAsDouble(channelId, 0, 0.); | |
158 | } | |
5253c153 | 159 | if (ped->ValueAsDouble(channelId, 1) == -1) ped->SetValueAsDouble(channelId, 1, 0.); |
160 | ||
161 | Double_t pedMean = ped->ValueAsDouble(channelId, 0) + (Double_t) charge; | |
162 | Double_t pedSigma = ped->ValueAsDouble(channelId, 1) + (Double_t) charge*charge; | |
163 | ||
164 | ped->SetValueAsDouble(channelId, 0, pedMean); | |
165 | ped->SetValueAsDouble(channelId, 1, pedSigma); | |
5431405e | 166 | |
5431405e | 167 | AliMUONErrorCounter* manuCounter; |
a54854fc | 168 | if (!(manuCounter = static_cast<AliMUONErrorCounter*>(fManuBuspatchTable->FindObject(busPatchId,manuId)))) |
5431405e | 169 | { |
170 | // New (buspatch,manu) | |
171 | manuCounter = new AliMUONErrorCounter(busPatchId,manuId); | |
a54854fc | 172 | fManuBuspatchTable->Add(manuCounter); |
5431405e | 173 | } |
174 | else | |
175 | { | |
176 | // Existing buspatch | |
177 | manuCounter->Increment(); | |
178 | } | |
5253c153 | 179 | } |
5253c153 | 180 | //______________________________________________________________________________ |
dbbb2c64 | 181 | void AliMUONPedestal::Finalize() |
5253c153 | 182 | { |
f3cfa63e | 183 | /// final polishing of the store |
184 | ||
5253c153 | 185 | Double_t pedMean; |
186 | Double_t pedSigma; | |
f9e83f1d | 187 | Double_t pedSigmalimit=0.5; |
5253c153 | 188 | Int_t busPatchId; |
189 | Int_t manuId; | |
190 | Int_t channelId; | |
191 | ||
5253c153 | 192 | // print in logfile |
193 | if (fErrorBuspatchTable->GetSize()) | |
5253c153 | 194 | { |
f9e83f1d | 195 | cout<<"\nWarning: Buspatches with less statistics (due to parity errors)"<<endl; |
196 | (*fFilcout)<<"\nWarning: Buspatches with less statistics (due to parity errors)"<<endl; | |
1b15b395 | 197 | TIter nextParityError(fErrorBuspatchTable->CreateIterator()); |
198 | AliMUONErrorCounter* parityerror; | |
199 | while((parityerror = static_cast<AliMUONErrorCounter*>(nextParityError()))) | |
200 | { | |
201 | cout<<" bp "<<parityerror->BusPatch()<<": events used = "<<fNEvents-parityerror->Events()<<endl; | |
202 | (*fFilcout)<<" bp "<<parityerror->BusPatch()<<": events used = "<<fNEvents-parityerror->Events()<<endl; | |
203 | } | |
5253c153 | 204 | } |
5253c153 | 205 | |
f9e83f1d | 206 | Int_t nADC4090=0; |
207 | Int_t nADCmax=0; | |
1b15b395 | 208 | // iterator over pedestal |
5253c153 | 209 | TIter next(fPedestalStore ->CreateIterator()); |
210 | AliMUONVCalibParam* ped; | |
211 | ||
212 | while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) ) | |
dbbb2c64 | 213 | { |
1b15b395 | 214 | busPatchId = ped->ID0(); |
215 | manuId = ped->ID1(); | |
216 | if(manuId==0) | |
217 | { | |
f9e83f1d | 218 | cout << "Warning: ManuId = " << manuId << " !!! in BP = " << busPatchId << endl; |
219 | (*fFilcout) << "Warning: ManuId = " << manuId << " !!! in BP = " << busPatchId << endl; | |
1b15b395 | 220 | } |
221 | Int_t eventCounter; | |
222 | // Correct the number of events for buspatch with errors | |
223 | AliMUONErrorCounter* errorCounter; | |
224 | if ((errorCounter = (AliMUONErrorCounter*)fErrorBuspatchTable->FindObject(busPatchId))) | |
225 | { | |
226 | eventCounter = fNEvents - errorCounter->Events(); | |
227 | } | |
228 | else | |
229 | { | |
230 | eventCounter = fNEvents; | |
231 | } | |
1b15b395 | 232 | Int_t occupancy=0; // channel missing in raw data or read but rejected (case of parity error) |
233 | // value of (buspatch, manu) occupancy | |
234 | AliMUONErrorCounter* manuCounter; | |
235 | manuCounter = static_cast<AliMUONErrorCounter*>(fManuBuspatchTable->FindObject(busPatchId,manuId)); | |
236 | if(eventCounter>0)occupancy = manuCounter->Events()/64/eventCounter; | |
237 | if(occupancy>1) | |
238 | { | |
f9e83f1d | 239 | cout << "Warning: ManuId = " << manuId << " !!! in BP = " << busPatchId << " occupancy (>1) = " << occupancy << endl; |
240 | (*fFilcout) << "Warning: ManuId = " << manuId << " !!! in BP = " << busPatchId << " occupancy (>1) = " << occupancy <<endl; | |
1b15b395 | 241 | } |
5253c153 | 242 | |
1b15b395 | 243 | for (channelId = 0; channelId < ped->Size() ; ++channelId) |
244 | { | |
f9e83f1d | 245 | pedMean = ped->ValueAsDouble(channelId, 0); |
1b15b395 | 246 | |
f9e83f1d | 247 | if (pedMean >= 0) // connected channels |
1b15b395 | 248 | { |
249 | ped->SetValueAsDouble(channelId, 0, pedMean/(Double_t)eventCounter); | |
250 | pedMean = ped->ValueAsDouble(channelId, 0); | |
251 | pedSigma = ped->ValueAsDouble(channelId, 1); | |
f9e83f1d | 252 | ped->SetValueAsDouble(channelId, 1, TMath::Sqrt(TMath::Abs(pedSigma/(Double_t)eventCounter - pedMean*pedMean))); |
253 | ||
254 | if(eventCounter < fNEvthreshold ) | |
255 | { nADCmax++; ped->SetValueAsDouble(channelId, 0, ADCMax()); | |
256 | ped->SetValueAsDouble(channelId, 1, ADCMax());} | |
257 | if( ped->ValueAsDouble(channelId, 1) < pedSigmalimit ) | |
258 | { nADC4090++; ped->SetValueAsDouble(channelId, 0, ADCMax()-5); | |
259 | ped->SetValueAsDouble(channelId, 1, ADCMax()-5);} | |
260 | if(manuId == 0 || occupancy>1) | |
261 | { nADCmax++; ped->SetValueAsDouble(channelId, 0, ADCMax()); | |
f3cfa63e | 262 | ped->SetValueAsDouble(channelId, 1, ADCMax()); |
f9e83f1d | 263 | if(occupancy>1 && channelId==0)ped->SetValueAsDouble(channelId, 0, ADCMax()+occupancy);} |
1b15b395 | 264 | } |
265 | else | |
f9e83f1d | 266 | { nADCmax++; ped->SetValueAsDouble(channelId, 0, ADCMax()); |
267 | ped->SetValueAsDouble(channelId, 1, ADCMax());} | |
1b15b395 | 268 | } |
dbbb2c64 | 269 | } |
f9e83f1d | 270 | if(nADCmax>0) |
271 | { char* detail=Form("Warning: Nb of Channels with bad Pedestal (Ped=4095) = %d over %d",nADCmax,fNChannel); | |
272 | printf("%s\n",detail); | |
273 | (*fFilcout) << detail << endl; } | |
274 | if(nADC4090>0) | |
275 | { char* detail=Form("Warning: Nb of Channels with PedSigma<0.5 (Ped=4090) = %d over %d",nADC4090,fNChannel); | |
276 | printf("%s\n",detail); | |
277 | (*fFilcout) << detail << endl; } | |
dbbb2c64 | 278 | } |
dbbb2c64 | 279 | //______________________________________________________________________________ |
280 | void AliMUONPedestal::MakeASCIIoutput(ostream& out) const | |
281 | { | |
1b15b395 | 282 | /// put pedestal store in the output stream |
dbbb2c64 | 283 | |
284 | out<<"//===========================================================================" << endl; | |
f3cfa63e | 285 | out<<"// Pedestal file calculated by "<< fPrefixDA.Data() << endl; |
dbbb2c64 | 286 | out<<"//===========================================================================" << endl; |
f9e83f1d | 287 | out<<"// * Run : " << fRunNumber << endl; |
288 | out<<"// * Date : " << fDate->AsString("l") <<endl; | |
289 | out<<"// * Statictics : " << fNEvents << endl; | |
1b15b395 | 290 | if(fConfig) |
f9e83f1d | 291 | out<<"// * Nb of MANUS : " << fNManuConfig << " read in the Det. config. " << endl; |
292 | out<<"// * Nb of MANUS : " << fNManu << " read in raw data " << endl; | |
293 | out<<"// * Nb of MANUS : " << fNChannel/64 << " written in pedestal file " << endl; | |
294 | out<<"// * Nb of channels: " << fNChannel << endl; | |
295 | out<<"//"<<endl; | |
296 | out<<"// * Below " << fNEvthreshold << " events=> Ped.&sig.=4095" << endl; | |
297 | out<<"// * PedSigma < 0.5 => Ped.&sig.=4090" << endl; | |
298 | ||
dbbb2c64 | 299 | if (fErrorBuspatchTable->GetSize()) |
dbbb2c64 | 300 | { |
1b15b395 | 301 | out<<"//"<<endl; |
302 | out<<"// * Buspatches with less statistics (due to parity errors)"<<endl; | |
303 | TIter next(fErrorBuspatchTable->CreateIterator()); | |
304 | AliMUONErrorCounter* parityerror; | |
305 | while((parityerror = static_cast<AliMUONErrorCounter*>(next()))) | |
306 | { | |
f9e83f1d | 307 | if(fNEvents-parityerror->Events()>fNEvthreshold) |
308 | { out<<"// BusPatch = "<<parityerror->BusPatch()<<"\t Nevents used = "<<fNEvents-parityerror->Events()<<endl; } | |
309 | else | |
310 | { out<<"// BusPatch = "<<parityerror->BusPatch()<<"\t Nevents used = "<<fNEvents-parityerror->Events()<< " (Ped.&sig.=4095)" << endl; } | |
1b15b395 | 311 | } |
312 | } | |
f3cfa63e | 313 | Int_t writitle=0; |
314 | Int_t occupancy=1; | |
315 | if(occupancy) | |
1b15b395 | 316 | { |
f3cfa63e | 317 | TIter next(fPedestalStore ->CreateIterator()); |
318 | AliMUONVCalibParam* ped; | |
319 | while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) ) | |
1b15b395 | 320 | { |
f3cfa63e | 321 | Int_t busPatchId = ped->ID0(); |
322 | Int_t manuId = ped->ID1(); | |
323 | Double_t pedMean = ped->ValueAsDouble(0, 0); // check pedestal value for channelId=0 | |
1b15b395 | 324 | |
f3cfa63e | 325 | if(pedMean>ADCMax()) |
326 | { | |
327 | writitle++; | |
328 | if(writitle==1){ | |
329 | out<<"//"<<endl; | |
f9e83f1d | 330 | out<<"// * Puzzling (Buspatch,Manu) read in raw data ? (Ped.&sig.=4095)"<<endl;} |
1ccd531d | 331 | occupancy=TMath::Nint(pedMean-ADCMax()); |
f3cfa63e | 332 | ped->SetValueAsDouble(0, 0, ADCMax()); |
f9e83f1d | 333 | out<<"// BusPatch = "<< busPatchId <<"\t ManuId = "<< manuId << "\t occupancy = " << occupancy << endl; |
f3cfa63e | 334 | } |
335 | ||
336 | if (manuId==0 || (fConfig && static_cast<AliMUONErrorCounter*>(fManuBPoutofconfigTable->FindObject(busPatchId,manuId)))) | |
337 | { | |
338 | writitle++; | |
339 | if(writitle==1){ | |
340 | out<<"//"<<endl; | |
f9e83f1d | 341 | out<<"// * Puzzling (Buspatch,Manu) read in raw data ? (Ped.&sig.=4095)"<<endl;} |
f3cfa63e | 342 | out<<"// BusPatch = "<< busPatchId <<"\t ManuId = "<< manuId << "\t missing in the mapping" << endl; |
343 | } | |
1b15b395 | 344 | } |
dbbb2c64 | 345 | } |
dbbb2c64 | 346 | out<<"//"<<endl; |
347 | out<<"//---------------------------------------------------------------------------" << endl; | |
348 | out<<"//---------------------------------------------------------------------------" << endl; | |
349 | out<<"// BP MANU CH. MEAN SIGMA"<<endl; | |
350 | out<<"//---------------------------------------------------------------------------" << endl; | |
5253c153 | 351 | |
ff496840 | 352 | TIter next(fPedestalStore->CreateIterator()); |
353 | AliMUONVCalibParam* ped; | |
1b15b395 | 354 | |
ff496840 | 355 | // Sorting |
356 | if (fSorting) | |
357 | { | |
358 | cout << " ..... sorting pedestal values ....." << endl; | |
359 | THashList pedtable(100,2); | |
360 | while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) ) | |
361 | { | |
362 | pedtable.Add(ped); | |
363 | } | |
364 | pedtable.Sort(); | |
365 | // iterator over sorted pedestal | |
366 | TIter nextSorted(&pedtable); | |
367 | while ( (ped = (AliMUONVCalibParam*)(nextSorted()) ) ) | |
368 | { | |
369 | Int_t busPatchId = ped->ID0(); | |
370 | Int_t manuId = ped->ID1(); | |
371 | for ( Int_t channelId = 0; channelId < ped->Size(); ++channelId ) | |
372 | { | |
373 | Double_t pedMean = ped->ValueAsDouble(channelId, 0); | |
374 | Double_t pedSigma = ped->ValueAsDouble(channelId, 1); | |
375 | out << "\t" << busPatchId << "\t" << manuId <<"\t"<< channelId << "\t" << pedMean <<"\t"<< pedSigma << endl; | |
376 | } | |
377 | } | |
378 | } | |
379 | else | |
380 | { | |
381 | while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) ) | |
1b15b395 | 382 | { |
ff496840 | 383 | Int_t busPatchId = ped->ID0(); |
384 | Int_t manuId = ped->ID1(); | |
385 | for ( Int_t channelId = 0; channelId < ped->Size(); ++channelId ) | |
386 | { | |
387 | Double_t pedMean = ped->ValueAsDouble(channelId, 0); | |
388 | Double_t pedSigma = ped->ValueAsDouble(channelId, 1); | |
389 | out << "\t" << busPatchId << "\t" << manuId <<"\t"<< channelId << "\t" << pedMean <<"\t"<< pedSigma << endl; | |
390 | } | |
1b15b395 | 391 | } |
5253c153 | 392 | } |
dbbb2c64 | 393 | } |
394 | ||
395 | //______________________________________________________________________________ | |
396 | void AliMUONPedestal::MakeControlHistos() | |
397 | { | |
f3cfa63e | 398 | /// Create control histograms |
dbbb2c64 | 399 | if (fIndex>=0) return; // Pedestal run (fIndex=-1) |
400 | ||
401 | Double_t pedMean; | |
402 | Double_t pedSigma; | |
f9e83f1d | 403 | Double_t evt; |
dbbb2c64 | 404 | Int_t busPatchId; |
405 | Int_t manuId; | |
406 | Int_t channelId; | |
407 | ||
408 | // histo | |
409 | TFile* histoFile = 0; | |
410 | TTree* tree = 0; | |
411 | TH1F* pedMeanHisto = 0; | |
412 | TH1F* pedSigmaHisto = 0; | |
413 | ||
f3cfa63e | 414 | fHistoFileName=Form("%s.root",fPrefixDA.Data()); |
dbbb2c64 | 415 | histoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals"); |
416 | ||
417 | Char_t name[255]; | |
418 | Char_t title[255]; | |
419 | sprintf(name,"pedmean_allch"); | |
420 | sprintf(title,"Pedestal mean all channels"); | |
f3cfa63e | 421 | Int_t nx = ADCMax()+1; |
dbbb2c64 | 422 | Int_t xmin = 0; |
f3cfa63e | 423 | Int_t xmax = ADCMax(); |
dbbb2c64 | 424 | pedMeanHisto = new TH1F(name,title,nx,xmin,xmax); |
425 | pedMeanHisto->SetDirectory(histoFile); | |
426 | ||
427 | sprintf(name,"pedsigma_allch"); | |
428 | sprintf(title,"Pedestal sigma all channels"); | |
429 | nx = 201; | |
430 | xmin = 0; | |
431 | xmax = 200; | |
432 | pedSigmaHisto = new TH1F(name,title,nx,xmin,xmax); | |
433 | pedSigmaHisto->SetDirectory(histoFile); | |
434 | ||
435 | tree = new TTree("t","Pedestal tree"); | |
436 | tree->Branch("bp",&busPatchId,"bp/I"); | |
437 | tree->Branch("manu",&manuId,",manu/I"); | |
438 | tree->Branch("channel",&channelId,",channel/I"); | |
439 | tree->Branch("pedMean",&pedMean,",pedMean/D"); | |
440 | tree->Branch("pedSigma",&pedSigma,",pedSigma/D"); | |
f9e83f1d | 441 | tree->Branch("nevt",&evt,",evt/D"); |
dbbb2c64 | 442 | |
443 | // iterator over pedestal | |
444 | TIter next(fPedestalStore ->CreateIterator()); | |
445 | AliMUONVCalibParam* ped; | |
f9e83f1d | 446 | AliMUONErrorCounter* manuCounter; |
dbbb2c64 | 447 | |
448 | while ( ( ped = dynamic_cast<AliMUONVCalibParam*>(next() ) ) ) | |
449 | { | |
450 | busPatchId = ped->ID0(); | |
451 | manuId = ped->ID1(); | |
452 | ||
453 | for ( channelId = 0; channelId < ped->Size(); ++channelId ) | |
454 | { | |
455 | pedMean = ped->ValueAsDouble(channelId, 0); | |
456 | pedSigma = ped->ValueAsDouble(channelId, 1); | |
f9e83f1d | 457 | manuCounter = static_cast<AliMUONErrorCounter*>(fManuBuspatchTable->FindObject(busPatchId,manuId)); |
458 | evt = manuCounter->Events()/64; | |
dbbb2c64 | 459 | |
460 | pedMeanHisto->Fill(pedMean); | |
461 | pedSigmaHisto->Fill(pedSigma); | |
462 | tree->Fill(); | |
463 | } | |
5253c153 | 464 | } |
dbbb2c64 | 465 | |
466 | histoFile->Write(); | |
467 | histoFile->Close(); | |
468 | ||
4af2c34a | 469 | } |