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