]>
Commit | Line | Data |
---|---|---|
de01cdf0 | 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 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
de01cdf0 | 19 | /// \class AliMUONCDB |
20 | /// | |
21 | /// Helper class to experience the OCDB | |
22 | /// It allows to generate dummy (but complete) containers for all the | |
23 | /// calibration data types we have for tracker and trigger, and to write | |
24 | /// them into OCDB. | |
25 | /// | |
26 | /// For more information, please see READMECDB | |
27 | /// | |
28 | // \author Laurent Aphecetche | |
3d1463c8 | 29 | //----------------------------------------------------------------------------- |
de01cdf0 | 30 | |
31 | #include "AliMUONCDB.h" | |
32 | ||
de01cdf0 | 33 | #include "AliMUON1DArray.h" |
34 | #include "AliMUON1DMap.h" | |
35 | #include "AliMUON2DMap.h" | |
36 | #include "AliMUON2DStoreValidator.h" | |
37 | #include "AliMUONCalibParamNF.h" | |
38 | #include "AliMUONCalibParamNI.h" | |
39 | #include "AliMUONConstants.h" | |
49419555 | 40 | #include "AliMUONTrackerIO.h" |
de01cdf0 | 41 | #include "AliMUONTriggerEfficiencyCells.h" |
42 | #include "AliMUONTriggerLut.h" | |
a0eca509 | 43 | #include "AliMUONVStore.h" |
de01cdf0 | 44 | #include "AliMUONVCalibParam.h" |
45 | #include "AliMUONVCalibParam.h" | |
92c23b09 | 46 | #include "AliMUONGlobalCrateConfig.h" |
47 | #include "AliMUONRegionalTriggerConfig.h" | |
92e36663 | 48 | |
25e1df3e | 49 | #include "AliMpCDB.h" |
a0eca509 | 50 | #include "AliMpConstants.h" |
de01cdf0 | 51 | #include "AliMpDDLStore.h" |
ab167304 | 52 | #include "AliMpManuStore.h" |
de01cdf0 | 53 | #include "AliMpDEManager.h" |
54 | #include "AliMpDetElement.h" | |
92c23b09 | 55 | #include "AliMpFiles.h" |
49e110ec | 56 | #include "AliMpDCSNamer.h" |
409de10f | 57 | #include "AliMpManuIterator.h" |
de01cdf0 | 58 | #include "AliMpSegmentation.h" |
59 | #include "AliMpStationType.h" | |
60 | #include "AliMpVSegmentation.h" | |
92e36663 | 61 | |
62 | #include "AliCodeTimer.h" | |
63 | #include "AliCDBEntry.h" | |
64 | #include "AliCDBManager.h" | |
65 | #include "AliDCSValue.h" | |
66 | #include "AliLog.h" | |
67 | ||
de01cdf0 | 68 | #include <Riostream.h> |
69 | #include <TArrayI.h> | |
70 | #include <TClass.h> | |
71 | #include <TH1F.h> | |
72 | #include <TList.h> | |
73 | #include <TMap.h> | |
74 | #include <TObjString.h> | |
75 | #include <TROOT.h> | |
76 | #include <TRandom.h> | |
77 | #include <TStopwatch.h> | |
78 | #include <TSystem.h> | |
cf27231a | 79 | #include <TMath.h> |
de01cdf0 | 80 | |
c05673c9 | 81 | |
de01cdf0 | 82 | /// \cond CLASSIMP |
83 | ClassImp(AliMUONCDB) | |
84 | /// \endcond | |
85 | ||
de01cdf0 | 86 | namespace |
87 | { | |
409de10f | 88 | //_____________________________________________________________________________ |
89 | AliMUONVStore* Create2DMap() | |
90 | { | |
91 | return new AliMUON2DMap(true); | |
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
046e5fd4 | 95 | void getBoundaries(const AliMUONVStore& store, Int_t dim, |
96 | Float_t* xmin, Float_t* xmax) | |
de01cdf0 | 97 | { |
046e5fd4 | 98 | /// Assuming the store contains AliMUONVCalibParam objects, compute the |
99 | /// limits of the value contained in the VCalibParam, for each of its dimensions | |
100 | /// xmin and xmax must be of dimension dim | |
101 | ||
102 | for ( Int_t i = 0; i < dim; ++i ) | |
103 | { | |
104 | xmin[i]=1E30; | |
105 | xmax[i]=-1E30; | |
106 | } | |
de01cdf0 | 107 | |
a0eca509 | 108 | TIter next(store.CreateIterator()); |
109 | AliMUONVCalibParam* value; | |
de01cdf0 | 110 | |
a0eca509 | 111 | while ( ( value = dynamic_cast<AliMUONVCalibParam*>(next() ) ) ) |
de01cdf0 | 112 | { |
a0eca509 | 113 | Int_t detElemId = value->ID0(); |
114 | Int_t manuId = value->ID1(); | |
de01cdf0 | 115 | |
116 | const AliMpVSegmentation* seg = | |
117 | AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); | |
118 | ||
119 | for ( Int_t manuChannel = 0; manuChannel < value->Size(); ++manuChannel ) | |
120 | { | |
168e9c4d | 121 | AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); |
de01cdf0 | 122 | if (!pad.IsValid()) continue; |
123 | ||
046e5fd4 | 124 | for ( Int_t i = 0; i < dim; ++i ) |
de01cdf0 | 125 | { |
046e5fd4 | 126 | Float_t x0 = value->ValueAsFloat(manuChannel,i); |
127 | ||
128 | xmin[i] = TMath::Min(xmin[i],x0); | |
129 | xmax[i] = TMath::Max(xmax[i],x0); | |
de01cdf0 | 130 | } |
131 | } | |
046e5fd4 | 132 | } |
133 | ||
134 | for ( Int_t i = 0; i < dim; ++i ) | |
135 | { | |
136 | if ( TMath::Abs(xmin[i]-xmax[i]) < 1E-3 ) | |
137 | { | |
138 | xmin[i] -= 1; | |
139 | xmax[i] += 1; | |
140 | } | |
141 | } | |
de01cdf0 | 142 | } |
143 | ||
cf27231a | 144 | //_____________________________________________________________________________ |
145 | Double_t GetRandom(Double_t mean, Double_t sigma, Bool_t mustBePositive) | |
146 | { | |
147 | Double_t x(-1); | |
148 | if ( mustBePositive ) | |
149 | { | |
150 | while ( x < 0 ) | |
151 | { | |
152 | x = gRandom->Gaus(mean,sigma); | |
153 | } | |
154 | } | |
155 | else | |
156 | { | |
157 | x = gRandom->Gaus(mean,sigma); | |
158 | } | |
159 | return x; | |
160 | } | |
161 | ||
de01cdf0 | 162 | } |
163 | ||
164 | //_____________________________________________________________________________ | |
165 | AliMUONCDB::AliMUONCDB(const char* cdbpath) | |
166 | : TObject(), | |
167 | fCDBPath(cdbpath), | |
046e5fd4 | 168 | fMaxNofChannelsToGenerate(-1) |
de01cdf0 | 169 | { |
409de10f | 170 | /// ctor |
92e36663 | 171 | // Load mapping |
0145e89a | 172 | if ( ! AliMpCDB::LoadDDLStore() ) { |
92e36663 | 173 | AliFatal("Could not access mapping from OCDB !"); |
174 | } | |
ab167304 | 175 | |
176 | if ( ! AliMpCDB::LoadManuStore() ) { | |
177 | AliFatal("Could not access run-dependent mapping from OCDB !"); | |
178 | } | |
de01cdf0 | 179 | } |
180 | ||
181 | //_____________________________________________________________________________ | |
182 | AliMUONCDB::~AliMUONCDB() | |
183 | { | |
184 | /// dtor | |
a0eca509 | 185 | } |
186 | ||
187 | //_____________________________________________________________________________ | |
188 | AliMUONVStore* | |
189 | AliMUONCDB::Diff(AliMUONVStore& store1, AliMUONVStore& store2, | |
de01cdf0 | 190 | const char* opt) |
191 | { | |
192 | /// creates a store which contains store1-store2 | |
193 | /// if opt="abs" the difference is absolute one, | |
194 | /// if opt="rel" then what is stored is (store1-store2)/store1 | |
046e5fd4 | 195 | /// if opt="percent" then what is stored is rel*100 |
196 | /// | |
de01cdf0 | 197 | /// WARNING Works only for stores which holds AliMUONVCalibParam objects |
198 | ||
199 | TString sopt(opt); | |
200 | sopt.ToUpper(); | |
201 | ||
046e5fd4 | 202 | if ( !sopt.Contains("ABS") && !sopt.Contains("REL") && !sopt.Contains("PERCENT") ) |
de01cdf0 | 203 | { |
046e5fd4 | 204 | AliErrorClass(Form("opt %s not supported. Only ABS, REL, PERCENT are",opt)); |
de01cdf0 | 205 | return 0x0; |
206 | } | |
207 | ||
a0eca509 | 208 | AliMUONVStore* d = static_cast<AliMUONVStore*>(store1.Clone()); |
de01cdf0 | 209 | |
a0eca509 | 210 | TIter next(d->CreateIterator()); |
de01cdf0 | 211 | |
a0eca509 | 212 | AliMUONVCalibParam* param; |
de01cdf0 | 213 | |
a0eca509 | 214 | while ( ( param = dynamic_cast<AliMUONVCalibParam*>(next() ) ) ) |
de01cdf0 | 215 | { |
a0eca509 | 216 | Int_t detElemId = param->ID0(); |
217 | Int_t manuId = param->ID1(); | |
de01cdf0 | 218 | |
a0eca509 | 219 | AliMUONVCalibParam* param2 = dynamic_cast<AliMUONVCalibParam*>(store2.FindObject(detElemId,manuId)); |
de01cdf0 | 220 | //FIXME: this might happen. Handle it. |
221 | if (!param2) | |
222 | { | |
223 | cerr << "param2 is null : FIXME : this might happen !" << endl; | |
224 | delete d; | |
225 | return 0; | |
226 | } | |
227 | ||
228 | for ( Int_t i = 0; i < param->Size(); ++i ) | |
229 | { | |
230 | for ( Int_t j = 0; j < param->Dimension(); ++j ) | |
231 | { | |
232 | Float_t value(0); | |
233 | if ( sopt.Contains("ABS") ) | |
234 | { | |
235 | value = param->ValueAsFloat(i,j) - param2->ValueAsFloat(i,j); | |
236 | } | |
046e5fd4 | 237 | else if ( sopt.Contains("REL") || sopt.Contains("PERCENT") ) |
de01cdf0 | 238 | { |
239 | if ( param->ValueAsFloat(i,j) ) | |
240 | { | |
241 | value = (param->ValueAsFloat(i,j) - param2->ValueAsFloat(i,j))/param->ValueAsFloat(i,j); | |
242 | } | |
243 | else | |
244 | { | |
245 | continue; | |
246 | } | |
046e5fd4 | 247 | if ( sopt.Contains("PERCENT") ) value *= 100.0; |
de01cdf0 | 248 | } |
249 | param->SetValueAsFloat(i,j,value); | |
250 | } | |
251 | } | |
de01cdf0 | 252 | } |
253 | return d; | |
254 | } | |
255 | ||
256 | //_____________________________________________________________________________ | |
257 | void | |
a0eca509 | 258 | AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins) |
de01cdf0 | 259 | { |
046e5fd4 | 260 | /// Make histograms of each dimension of the AliMUONVCalibParam |
de01cdf0 | 261 | /// contained inside store. |
262 | /// It produces histograms named name_0, name_1, etc... | |
263 | ||
046e5fd4 | 264 | TIter next(store.CreateIterator()); |
265 | AliMUONVCalibParam* param; | |
de01cdf0 | 266 | Int_t n(0); |
046e5fd4 | 267 | const Int_t kNStations = AliMpConstants::NofTrackingChambers()/2; |
268 | Int_t* nPerStation = new Int_t[kNStations]; | |
269 | TH1** h(0x0); | |
de01cdf0 | 270 | |
046e5fd4 | 271 | for ( Int_t i = 0; i < kNStations; ++i ) nPerStation[i]=0; |
de01cdf0 | 272 | |
046e5fd4 | 273 | while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) ) |
de01cdf0 | 274 | { |
046e5fd4 | 275 | if (!h) |
276 | { | |
277 | Int_t dim = param->Dimension(); | |
278 | h = new TH1*[dim]; | |
279 | Float_t* xmin = new Float_t[dim]; | |
280 | Float_t* xmax = new Float_t[dim]; | |
281 | getBoundaries(store,dim,xmin,xmax); | |
282 | ||
283 | for ( Int_t i = 0; i < dim; ++i ) | |
284 | { | |
285 | h[i] = new TH1F(Form("%s_%d",name,i),Form("%s_%d",name,i), | |
286 | nbins,xmin[i],xmax[i]); | |
287 | AliInfo(Form("Created histogram %s",h[i]->GetName())); | |
288 | } | |
289 | } | |
290 | ||
291 | Int_t detElemId = param->ID0(); | |
292 | Int_t manuId = param->ID1(); | |
293 | Int_t station = AliMpDEManager::GetChamberId(detElemId)/2; | |
de01cdf0 | 294 | |
295 | const AliMpVSegmentation* seg = | |
296 | AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); | |
297 | ||
046e5fd4 | 298 | for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel ) |
de01cdf0 | 299 | { |
168e9c4d | 300 | AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); |
046e5fd4 | 301 | if (!pad.IsValid()) continue; |
de01cdf0 | 302 | |
046e5fd4 | 303 | ++n; |
304 | ++nPerStation[station]; | |
305 | ||
306 | for ( Int_t dim = 0; dim < param->Dimension(); ++dim ) | |
307 | { | |
308 | h[dim]->Fill(param->ValueAsFloat(manuChannel,dim)); | |
de01cdf0 | 309 | } |
310 | } | |
046e5fd4 | 311 | } |
de01cdf0 | 312 | |
046e5fd4 | 313 | for ( Int_t i = 0; i < kNStations; ++i ) |
de01cdf0 | 314 | { |
315 | AliInfo(Form("Station %d %d ",(i+1),nPerStation[i])); | |
316 | } | |
046e5fd4 | 317 | |
318 | AliInfo(Form("Number of channels = %d",n)); | |
319 | ||
320 | delete[] nPerStation; | |
de01cdf0 | 321 | } |
322 | ||
323 | //_____________________________________________________________________________ | |
324 | Int_t | |
325 | AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues) | |
326 | { | |
327 | /// Create a HV store | |
328 | ||
49e110ec | 329 | AliMpDCSNamer hvNamer("TRACKER"); |
de01cdf0 | 330 | |
331 | TObjArray* aliases = hvNamer.GenerateAliases(); | |
332 | ||
333 | Int_t nSwitch(0); | |
334 | Int_t nChannels(0); | |
335 | ||
336 | for ( Int_t i = 0; i < aliases->GetEntries(); ++i ) | |
337 | { | |
338 | TObjString* alias = static_cast<TObjString*>(aliases->At(i)); | |
339 | TString& aliasName = alias->String(); | |
340 | if ( aliasName.Contains("sw") ) | |
341 | { | |
342 | // HV Switch (St345 only) | |
343 | TObjArray* valueSet = new TObjArray; | |
344 | valueSet->SetOwner(kTRUE); | |
345 | ||
346 | Bool_t value = kTRUE; | |
347 | ||
348 | if (!defaultValues) | |
349 | { | |
a0eca509 | 350 | Float_t r = gRandom->Uniform(); |
de01cdf0 | 351 | if ( r < 0.007 ) value = kFALSE; |
352 | } | |
353 | ||
354 | for ( UInt_t timeStamp = 0; timeStamp < 60*3; timeStamp += 60 ) | |
355 | { | |
356 | AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp); | |
357 | valueSet->Add(dcsValue); | |
358 | } | |
359 | aliasMap.Add(new TObjString(*alias),valueSet); | |
360 | ++nSwitch; | |
361 | } | |
362 | else | |
363 | { | |
364 | TObjArray* valueSet = new TObjArray; | |
365 | valueSet->SetOwner(kTRUE); | |
366 | for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 ) | |
367 | { | |
368 | Float_t value = 1500; | |
cf27231a | 369 | if (!defaultValues) value = GetRandom(1750,62.5,true); |
de01cdf0 | 370 | AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp); |
371 | valueSet->Add(dcsValue); | |
372 | } | |
373 | aliasMap.Add(new TObjString(*alias),valueSet); | |
374 | ++nChannels; | |
375 | } | |
376 | } | |
377 | ||
378 | delete aliases; | |
379 | ||
380 | AliInfo(Form("%d HV channels and %d switches",nChannels,nSwitch)); | |
381 | ||
382 | return nChannels+nSwitch; | |
383 | } | |
384 | ||
49e110ec | 385 | //_____________________________________________________________________________ |
386 | Int_t | |
387 | AliMUONCDB::MakeTriggerDCSStore(TMap& aliasMap, Bool_t defaultValues) | |
388 | { | |
389 | /// Create a Trigger HV and Currents store | |
390 | ||
391 | AliMpDCSNamer triggerDCSNamer("TRIGGER"); | |
392 | ||
393 | TObjArray* aliases = triggerDCSNamer.GenerateAliases(); | |
394 | ||
395 | Int_t nChannels[2] = {0, 0}; | |
396 | ||
397 | for ( Int_t i = 0; i < aliases->GetEntries(); ++i ) | |
398 | { | |
399 | TObjString* alias = static_cast<TObjString*>(aliases->At(i)); | |
400 | TString& aliasName = alias->String(); | |
401 | ||
402 | TObjArray* valueSet = new TObjArray; | |
403 | valueSet->SetOwner(kTRUE); | |
404 | Int_t measureType = triggerDCSNamer.DCSvariableFromDCSAlias(aliasName.Data()); | |
405 | for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 ) | |
406 | { | |
407 | Float_t value = | |
9b1e069f | 408 | (measureType == AliMpDCSNamer::kDCSI) ? 2. : 8000.; |
49e110ec | 409 | if (!defaultValues) { |
410 | switch (measureType){ | |
411 | case AliMpDCSNamer::kDCSI: | |
9b1e069f | 412 | value = GetRandom(2.,0.4,true); |
49e110ec | 413 | break; |
414 | case AliMpDCSNamer::kDCSHV: | |
9b1e069f | 415 | value = GetRandom(8000.,16.,true); |
49e110ec | 416 | break; |
417 | } | |
418 | } | |
419 | AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp); | |
420 | valueSet->Add(dcsValue); | |
421 | } | |
422 | aliasMap.Add(new TObjString(*alias),valueSet); | |
423 | ++nChannels[measureType]; | |
424 | } | |
425 | ||
426 | delete aliases; | |
427 | ||
428 | AliInfo(Form("Trigger channels I -> %i HV -> %i",nChannels[0], nChannels[1])); | |
429 | ||
430 | return nChannels[0] + nChannels[1]; | |
431 | } | |
432 | ||
de01cdf0 | 433 | //_____________________________________________________________________________ |
434 | Int_t | |
a0eca509 | 435 | AliMUONCDB::MakePedestalStore(AliMUONVStore& pedestalStore, Bool_t defaultValues) |
de01cdf0 | 436 | { |
437 | /// Create a pedestal store. if defaultValues=true, ped.mean=ped.sigma=1, | |
438 | /// otherwise mean and sigma are from a gaussian (with parameters | |
439 | /// defined below by the kPedestal* constants) | |
409de10f | 440 | |
441 | AliCodeTimerAuto(""); | |
de01cdf0 | 442 | |
443 | Int_t nchannels(0); | |
444 | Int_t nmanus(0); | |
445 | ||
a0eca509 | 446 | const Int_t kChannels(AliMpConstants::ManuNofChannels()); |
e7ee8d13 | 447 | |
448 | // bending | |
449 | const Float_t kPedestalMeanMeanB(200.); | |
450 | const Float_t kPedestalMeanSigmaB(10.); | |
451 | const Float_t kPedestalSigmaMeanB(1.); | |
452 | const Float_t kPedestalSigmaSigmaB(0.2); | |
453 | ||
454 | // non bending | |
455 | const Float_t kPedestalMeanMeanNB(200.); | |
456 | const Float_t kPedestalMeanSigmaNB(10.); | |
457 | const Float_t kPedestalSigmaMeanNB(1.); | |
458 | const Float_t kPedestalSigmaSigmaNB(0.2); | |
459 | ||
460 | const Float_t kFractionOfDeadManu(0.); // within [0.,1.] | |
409de10f | 461 | |
462 | Int_t detElemId; | |
463 | Int_t manuId; | |
464 | ||
465 | AliMpManuIterator it; | |
de01cdf0 | 466 | |
409de10f | 467 | while ( it.Next(detElemId,manuId) ) |
de01cdf0 | 468 | { |
e7ee8d13 | 469 | // skip a given fraction of manus |
470 | if (kFractionOfDeadManu > 0. && gRandom->Uniform() < kFractionOfDeadManu) continue; | |
471 | ||
de01cdf0 | 472 | ++nmanus; |
a0eca509 | 473 | |
046e5fd4 | 474 | AliMUONVCalibParam* ped = |
475 | new AliMUONCalibParamNF(2,kChannels,detElemId,manuId,AliMUONVCalibParam::InvalidFloatValue()); | |
409de10f | 476 | |
477 | AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); | |
de01cdf0 | 478 | |
479 | for ( Int_t manuChannel = 0; manuChannel < kChannels; ++manuChannel ) | |
480 | { | |
409de10f | 481 | if ( ! de->IsConnectedChannel(manuId,manuChannel) ) continue; |
de01cdf0 | 482 | |
483 | ++nchannels; | |
484 | ||
485 | Float_t meanPedestal; | |
486 | Float_t sigmaPedestal; | |
487 | ||
488 | if ( defaultValues ) | |
489 | { | |
490 | meanPedestal = 0.0; | |
491 | sigmaPedestal = 1.0; | |
492 | } | |
493 | else | |
494 | { | |
cf27231a | 495 | Bool_t positive(kTRUE); |
046e5fd4 | 496 | meanPedestal = 0.0; |
e7ee8d13 | 497 | |
498 | if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) ) { // manu in non bending plane | |
499 | ||
500 | while ( meanPedestal == 0.0 ) // avoid strict zero | |
501 | { | |
502 | meanPedestal = GetRandom(kPedestalMeanMeanNB,kPedestalMeanSigmaNB,positive); | |
503 | } | |
504 | sigmaPedestal = GetRandom(kPedestalSigmaMeanNB,kPedestalSigmaSigmaNB,positive); | |
505 | ||
506 | } else { // manu in bending plane | |
507 | ||
508 | while ( meanPedestal == 0.0 ) // avoid strict zero | |
509 | { | |
510 | meanPedestal = GetRandom(kPedestalMeanMeanB,kPedestalMeanSigmaB,positive); | |
511 | } | |
512 | sigmaPedestal = GetRandom(kPedestalSigmaMeanB,kPedestalSigmaSigmaB,positive); | |
513 | ||
514 | } | |
515 | ||
de01cdf0 | 516 | } |
e7ee8d13 | 517 | |
de01cdf0 | 518 | ped->SetValueAsFloat(manuChannel,0,meanPedestal); |
519 | ped->SetValueAsFloat(manuChannel,1,sigmaPedestal); | |
520 | ||
521 | } | |
a0eca509 | 522 | Bool_t ok = pedestalStore.Add(ped); |
de01cdf0 | 523 | if (!ok) |
524 | { | |
525 | AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); | |
526 | } | |
046e5fd4 | 527 | if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break; |
de01cdf0 | 528 | } |
529 | ||
530 | AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels)); | |
531 | return nchannels; | |
de01cdf0 | 532 | } |
533 | ||
2b8a1212 | 534 | //_____________________________________________________________________________ |
535 | Int_t | |
536 | AliMUONCDB::MakeKillMapStore(AliMUONVStore& killMapStore) | |
537 | { | |
538 | /// Create a kill map. | |
539 | ||
540 | AliCodeTimerAuto(""); | |
541 | ||
542 | Int_t nchannels(0); | |
543 | Int_t nmanus(0); | |
544 | ||
545 | const Int_t kChannels(AliMpConstants::ManuNofChannels()); | |
546 | ||
547 | const Float_t kFractionOfDeadManu(0.1); // within [0.,1.] | |
548 | ||
549 | if ( kFractionOfDeadManu == 0.0 ) return 0.0; | |
550 | ||
551 | Int_t detElemId; | |
552 | Int_t manuId; | |
553 | ||
554 | AliMpManuIterator it; | |
555 | ||
556 | while ( it.Next(detElemId,manuId) ) | |
557 | { | |
558 | // skip a given fraction of manus | |
559 | if ( gRandom->Uniform() > kFractionOfDeadManu) continue; | |
560 | ||
561 | ++nmanus; | |
562 | ||
563 | AliMUONVCalibParam* kill = new AliMUONCalibParamNI(1,kChannels,detElemId,manuId,0); | |
564 | ||
565 | AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); | |
566 | ||
567 | for ( Int_t manuChannel = 0; manuChannel < kChannels; ++manuChannel ) | |
568 | { | |
569 | if ( ! de->IsConnectedChannel(manuId,manuChannel) ) continue; | |
570 | ||
571 | ++nchannels; | |
572 | ||
573 | kill->SetValueAsInt(manuChannel,0,1); | |
574 | ||
575 | } | |
576 | Bool_t ok = killMapStore.Add(kill); | |
577 | if (!ok) | |
578 | { | |
579 | AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); | |
580 | } | |
581 | if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break; | |
582 | } | |
583 | ||
584 | AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels)); | |
585 | return nchannels; | |
586 | } | |
587 | ||
25e1df3e | 588 | //_____________________________________________________________________________ |
589 | Int_t | |
590 | AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, const char* file) | |
591 | { | |
6687de6d | 592 | /// Read the capacitance values from file and append them to the capaStore |
593 | ||
49419555 | 594 | return AliMUONTrackerIO::ReadCapacitances(file,capaStore); |
25e1df3e | 595 | } |
596 | ||
de01cdf0 | 597 | //_____________________________________________________________________________ |
598 | Int_t | |
a0eca509 | 599 | AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, Bool_t defaultValues) |
de01cdf0 | 600 | { |
601 | /// Create a capacitance store. if defaultValues=true, all capa are 1.0, | |
602 | /// otherwise they are from a gaussian with parameters defined in the | |
603 | /// kCapa* constants below. | |
409de10f | 604 | |
605 | AliCodeTimerAuto(""); | |
de01cdf0 | 606 | |
607 | Int_t nchannels(0); | |
608 | Int_t nmanus(0); | |
609 | Int_t nmanusOK(0); // manus for which we got the serial number | |
a0eca509 | 610 | |
25e1df3e | 611 | const Float_t kCapaMean(0.3); |
612 | const Float_t kCapaSigma(0.1); | |
613 | const Float_t kInjectionGainMean(3); | |
614 | const Float_t kInjectionGainSigma(1); | |
409de10f | 615 | |
616 | Int_t detElemId; | |
617 | Int_t manuId; | |
618 | ||
619 | AliMpManuIterator it; | |
de01cdf0 | 620 | |
409de10f | 621 | while ( it.Next(detElemId,manuId) ) |
de01cdf0 | 622 | { |
623 | ++nmanus; | |
624 | ||
de01cdf0 | 625 | AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); |
ab167304 | 626 | Int_t serialNumber = AliMpManuStore::Instance()->GetManuSerial(detElemId, manuId); |
de01cdf0 | 627 | |
a0eca509 | 628 | if ( serialNumber <= 0 ) continue; |
629 | ||
630 | ++nmanusOK; | |
de01cdf0 | 631 | |
a0eca509 | 632 | AliMUONVCalibParam* capa = static_cast<AliMUONVCalibParam*>(capaStore.FindObject(serialNumber)); |
de01cdf0 | 633 | |
634 | if (!capa) | |
635 | { | |
25e1df3e | 636 | capa = new AliMUONCalibParamNF(2,AliMpConstants::ManuNofChannels(),serialNumber,0,1.0); |
a0eca509 | 637 | Bool_t ok = capaStore.Add(capa); |
de01cdf0 | 638 | if (!ok) |
639 | { | |
640 | AliError(Form("Could not set serialNumber=%d manuId=%d",serialNumber,manuId)); | |
641 | } | |
642 | } | |
643 | ||
644 | for ( Int_t manuChannel = 0; manuChannel < capa->Size(); ++manuChannel ) | |
645 | { | |
409de10f | 646 | if ( ! de->IsConnectedChannel(manuId,manuChannel) ) continue; |
de01cdf0 | 647 | |
648 | ++nchannels; | |
649 | ||
650 | Float_t capaValue; | |
25e1df3e | 651 | Float_t injectionGain; |
de01cdf0 | 652 | |
653 | if ( defaultValues ) | |
654 | { | |
655 | capaValue = 1.0; | |
25e1df3e | 656 | injectionGain = 1.0; |
de01cdf0 | 657 | } |
658 | else | |
659 | { | |
cf27231a | 660 | capaValue = GetRandom(kCapaMean,kCapaSigma,kTRUE); |
25e1df3e | 661 | injectionGain = GetRandom(kInjectionGainMean,kInjectionGainSigma,kTRUE); |
de01cdf0 | 662 | } |
663 | capa->SetValueAsFloat(manuChannel,0,capaValue); | |
25e1df3e | 664 | capa->SetValueAsFloat(manuChannel,1,injectionGain); |
de01cdf0 | 665 | } |
666 | } | |
667 | ||
668 | Float_t percent = 0; | |
669 | if ( nmanus ) percent = 100*nmanusOK/nmanus; | |
670 | AliInfo(Form("%5d manus with serial number (out of %5d manus = %3.0f%%)", | |
671 | nmanusOK,nmanus,percent)); | |
672 | AliInfo(Form("%5d channels",nchannels)); | |
673 | if ( percent < 100 ) | |
674 | { | |
675 | AliWarning("Did not get all serial numbers. capaStore is incomplete !!!!"); | |
676 | } | |
677 | return nchannels; | |
678 | ||
679 | } | |
680 | ||
681 | //_____________________________________________________________________________ | |
682 | Int_t | |
a0eca509 | 683 | AliMUONCDB::MakeGainStore(AliMUONVStore& gainStore, Bool_t defaultValues) |
de01cdf0 | 684 | { |
cf27231a | 685 | /// Create a gain store. if defaultValues=true, all gains set so that |
686 | /// charge = (adc-ped) | |
687 | /// | |
688 | /// otherwise parameters are taken from gaussians with parameters | |
689 | /// defined in the k* constants below. | |
de01cdf0 | 690 | |
409de10f | 691 | AliCodeTimerAuto(""); |
de01cdf0 | 692 | |
693 | Int_t nchannels(0); | |
694 | Int_t nmanus(0); | |
a0eca509 | 695 | |
cf27231a | 696 | const Int_t kSaturation(3000); |
697 | const Double_t kA0Mean(1.2); | |
409de10f | 698 | const Double_t kA0Sigma(0.1); |
699 | const Double_t kA1Mean(1E-5); | |
700 | const Double_t kA1Sigma(1E-6); | |
cf27231a | 701 | const Double_t kQualMean(0xFF); |
702 | const Double_t kQualSigma(0x10); | |
703 | const Int_t kThresMean(1600); | |
409de10f | 704 | const Int_t kThresSigma(100); |
705 | ||
706 | Int_t detElemId; | |
707 | Int_t manuId; | |
de01cdf0 | 708 | |
409de10f | 709 | AliMpManuIterator it; |
710 | ||
711 | while ( it.Next(detElemId,manuId) ) | |
de01cdf0 | 712 | { |
713 | ++nmanus; | |
de01cdf0 | 714 | |
a0eca509 | 715 | AliMUONVCalibParam* gain = |
cf27231a | 716 | new AliMUONCalibParamNF(5,AliMpConstants::ManuNofChannels(), |
a0eca509 | 717 | detElemId, |
718 | manuId, | |
719 | AliMUONVCalibParam::InvalidFloatValue()); | |
720 | ||
409de10f | 721 | AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); |
de01cdf0 | 722 | |
723 | for ( Int_t manuChannel = 0; manuChannel < gain->Size(); ++manuChannel ) | |
724 | { | |
409de10f | 725 | if ( ! de->IsConnectedChannel(manuId,manuChannel) ) continue; |
de01cdf0 | 726 | |
727 | ++nchannels; | |
728 | ||
de01cdf0 | 729 | if ( defaultValues ) |
730 | { | |
cf27231a | 731 | gain->SetValueAsFloat(manuChannel,0,1.0); |
732 | gain->SetValueAsFloat(manuChannel,1,0.0); | |
733 | gain->SetValueAsInt(manuChannel,2,4095); | |
734 | gain->SetValueAsInt(manuChannel,3,1); | |
735 | gain->SetValueAsInt(manuChannel,4,kSaturation); | |
de01cdf0 | 736 | } |
737 | else | |
738 | { | |
cf27231a | 739 | Bool_t positive(kTRUE); |
740 | gain->SetValueAsFloat(manuChannel,0,GetRandom(kA0Mean,kA0Sigma,positive)); | |
741 | gain->SetValueAsFloat(manuChannel,1,GetRandom(kA1Mean,kA1Sigma,!positive)); | |
742 | gain->SetValueAsInt(manuChannel,2,(Int_t)TMath::Nint(GetRandom(kThresMean,kThresSigma,positive))); | |
743 | gain->SetValueAsInt(manuChannel,3,(Int_t)TMath::Nint(GetRandom(kQualMean,kQualSigma,positive))); | |
744 | gain->SetValueAsInt(manuChannel,4,kSaturation); | |
de01cdf0 | 745 | } |
de01cdf0 | 746 | |
747 | } | |
a0eca509 | 748 | Bool_t ok = gainStore.Add(gain); |
de01cdf0 | 749 | if (!ok) |
750 | { | |
751 | AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); | |
752 | } | |
046e5fd4 | 753 | if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break; |
de01cdf0 | 754 | } |
755 | ||
756 | AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels)); | |
757 | return nchannels; | |
758 | } | |
759 | ||
760 | //_____________________________________________________________________________ | |
761 | Int_t | |
a0eca509 | 762 | AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks) const |
de01cdf0 | 763 | { |
764 | /// Generate local trigger masks store. All masks are set to FFFF | |
765 | ||
409de10f | 766 | AliCodeTimerAuto(""); |
767 | ||
de01cdf0 | 768 | Int_t ngenerated(0); |
630711ed | 769 | // Generate fake mask values for all localboards and put that into |
de01cdf0 | 770 | // one single container (localBoardMasks) |
0145e89a | 771 | for ( Int_t i = 1; i <= AliMpConstants::TotalNofLocalBoards(); ++i ) |
de01cdf0 | 772 | { |
a0eca509 | 773 | AliMUONVCalibParam* localBoard = new AliMUONCalibParamNI(1,8,i,0,0); |
de01cdf0 | 774 | for ( Int_t x = 0; x < 2; ++x ) |
775 | { | |
776 | for ( Int_t y = 0; y < 4; ++y ) | |
777 | { | |
778 | Int_t index = x*4+y; | |
779 | localBoard->SetValueAsInt(index,0,0xFFFF); | |
780 | ++ngenerated; | |
781 | } | |
782 | } | |
a0eca509 | 783 | localBoardMasks.Add(localBoard); |
de01cdf0 | 784 | } |
785 | return ngenerated; | |
786 | } | |
787 | ||
788 | //_____________________________________________________________________________ | |
789 | Int_t | |
92c23b09 | 790 | AliMUONCDB::MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm) const |
de01cdf0 | 791 | { |
92c23b09 | 792 | /// Make a regional trigger config store. Mask is set to FFFF for each local board (Ch.F.) |
de01cdf0 | 793 | |
409de10f | 794 | AliCodeTimerAuto(""); |
795 | ||
5cc125b2 | 796 | if ( ! rtm.ReadData(AliMpFiles::LocalTriggerBoardMapping()) ) { |
797 | AliErrorStream() << "Error when reading from mapping file" << endl; | |
798 | return 0; | |
799 | } | |
800 | ||
801 | return rtm.GetNofTriggerCrates(); | |
de01cdf0 | 802 | } |
803 | ||
92c23b09 | 804 | |
de01cdf0 | 805 | //_____________________________________________________________________________ |
806 | Int_t | |
92c23b09 | 807 | AliMUONCDB::MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm) const |
de01cdf0 | 808 | { |
92c23b09 | 809 | /// Make a global trigger config store. All masks (disable) set to 0x00 for each Darc board (Ch.F.) |
de01cdf0 | 810 | |
409de10f | 811 | AliCodeTimerAuto(""); |
913f1b43 | 812 | |
813 | return gtm.ReadData(AliMpFiles::GlobalTriggerBoardMapping()); | |
de01cdf0 | 814 | } |
815 | ||
92c23b09 | 816 | |
de01cdf0 | 817 | //_____________________________________________________________________________ |
818 | AliMUONTriggerLut* | |
819 | AliMUONCDB::MakeTriggerLUT(const char* file) const | |
820 | { | |
821 | /// Make a triggerlut object, from a file. | |
822 | ||
409de10f | 823 | AliCodeTimerAuto(""); |
824 | ||
de01cdf0 | 825 | AliMUONTriggerLut* lut = new AliMUONTriggerLut; |
826 | lut->ReadFromFile(file); | |
827 | return lut; | |
828 | } | |
829 | ||
830 | //_____________________________________________________________________________ | |
831 | AliMUONTriggerEfficiencyCells* | |
832 | AliMUONCDB::MakeTriggerEfficiency(const char* file) const | |
833 | { | |
834 | /// Make a trigger efficiency object from a file. | |
835 | ||
409de10f | 836 | AliCodeTimerAuto(""); |
837 | ||
de01cdf0 | 838 | return new AliMUONTriggerEfficiencyCells(file); |
839 | } | |
840 | ||
25e1df3e | 841 | //_____________________________________________________________________________ |
842 | void | |
843 | AliMUONCDB::WriteToCDB(const char* calibpath, TObject* object, | |
844 | Int_t startRun, Int_t endRun, | |
845 | const char* filename) | |
846 | { | |
847 | /// Write a given object to OCDB | |
848 | ||
913f1b43 | 849 | TString comment(gSystem->ExpandPathName(filename)); |
850 | ||
851 | WriteToCDB(object, calibpath, startRun, endRun, comment.Data()); | |
25e1df3e | 852 | } |
853 | ||
de01cdf0 | 854 | //_____________________________________________________________________________ |
855 | void | |
856 | AliMUONCDB::WriteToCDB(const char* calibpath, TObject* object, | |
857 | Int_t startRun, Int_t endRun, Bool_t defaultValues) | |
858 | { | |
859 | /// Write a given object to OCDB | |
860 | ||
913f1b43 | 861 | TString comment; |
862 | if ( defaultValues ) comment += "Test with default values"; | |
863 | else comment += "Test with random values"; | |
864 | ||
865 | WriteToCDB(object, calibpath, startRun, endRun, comment.Data()); | |
866 | } | |
867 | ||
868 | //_____________________________________________________________________________ | |
869 | void | |
870 | AliMUONCDB::WriteToCDB(TObject* object, const char* calibpath, Int_t startRun, Int_t endRun, | |
871 | const char* comment, const char* responsible) | |
872 | { | |
873 | /// Write a given object to OCDB | |
874 | ||
de01cdf0 | 875 | AliCDBId id(calibpath,startRun,endRun); |
876 | AliCDBMetaData md; | |
877 | md.SetAliRootVersion(gROOT->GetVersion()); | |
913f1b43 | 878 | md.SetComment(comment); |
879 | md.SetResponsible(responsible); | |
de01cdf0 | 880 | AliCDBManager* man = AliCDBManager::Instance(); |
913f1b43 | 881 | if (!man->IsDefaultStorageSet()) man->SetDefaultStorage(fCDBPath); |
de01cdf0 | 882 | man->Put(object,id,&md); |
883 | } | |
884 | ||
885 | //_____________________________________________________________________________ | |
886 | Int_t | |
a0eca509 | 887 | AliMUONCDB::MakeNeighbourStore(AliMUONVStore& neighbourStore) |
de01cdf0 | 888 | { |
889 | /// Fill the neighbours store with, for each channel, a TObjArray of its | |
890 | /// neighbouring pads (including itself) | |
891 | ||
409de10f | 892 | AliCodeTimerAuto(""); |
de01cdf0 | 893 | |
409de10f | 894 | AliInfo("Generating NeighbourStore. This will take a while. Please be patient."); |
de01cdf0 | 895 | |
896 | Int_t nchannels(0); | |
897 | ||
898 | TObjArray tmp; | |
409de10f | 899 | |
900 | Int_t detElemId; | |
901 | Int_t manuId; | |
de01cdf0 | 902 | |
409de10f | 903 | AliMpManuIterator it; |
904 | ||
905 | while ( it.Next(detElemId,manuId) ) | |
de01cdf0 | 906 | { |
de01cdf0 | 907 | const AliMpVSegmentation* seg = |
908 | AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); | |
909 | ||
a0eca509 | 910 | AliMUONVCalibParam* calibParam = static_cast<AliMUONVCalibParam*>(neighbourStore.FindObject(detElemId,manuId)); |
de01cdf0 | 911 | if (!calibParam) |
912 | { | |
913 | Int_t dimension(11); | |
a0eca509 | 914 | Int_t size(AliMpConstants::ManuNofChannels()); |
de01cdf0 | 915 | Int_t defaultValue(-1); |
a0eca509 | 916 | Int_t packingFactor(size); |
de01cdf0 | 917 | |
a0eca509 | 918 | calibParam = new AliMUONCalibParamNI(dimension,size,detElemId,manuId,defaultValue,packingFactor); |
919 | Bool_t ok = neighbourStore.Add(calibParam); | |
de01cdf0 | 920 | if (!ok) |
921 | { | |
922 | AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); | |
923 | return -1; | |
924 | } | |
925 | } | |
926 | ||
a0eca509 | 927 | for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) |
de01cdf0 | 928 | { |
168e9c4d | 929 | AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); |
de01cdf0 | 930 | |
931 | if (pad.IsValid()) | |
932 | { | |
933 | ++nchannels; | |
934 | ||
935 | seg->GetNeighbours(pad,tmp,true,true); | |
936 | Int_t nofPadNeighbours = tmp.GetEntriesFast(); | |
937 | ||
938 | for ( Int_t i = 0; i < nofPadNeighbours; ++i ) | |
939 | { | |
bf0d3528 | 940 | AliMpPad* p = static_cast<AliMpPad*>(tmp.UncheckedAt(i)); |
de01cdf0 | 941 | Int_t x; |
409de10f | 942 | // Bool_t ok = |
6e97fbb8 | 943 | calibParam->PackValues(p->GetManuId(),p->GetManuChannel(),x); |
409de10f | 944 | // if (!ok) |
945 | // { | |
946 | // AliError("Could not pack value. Something is seriously wrong. Please check"); | |
947 | // StdoutToAliError(pad->Print();); | |
948 | // return -1; | |
949 | // } | |
de01cdf0 | 950 | calibParam->SetValueAsInt(manuChannel,i,x); |
951 | } | |
952 | } | |
953 | } | |
954 | } | |
955 | ||
de01cdf0 | 956 | return nchannels; |
957 | } | |
958 | ||
046e5fd4 | 959 | //_____________________________________________________________________________ |
960 | void | |
961 | AliMUONCDB::SetMaxNofChannelsToGenerate(Int_t n) | |
962 | { | |
963 | /// Set the maximum number of channels to generate (used for testing only) | |
964 | /// n < 0 means no limit | |
965 | fMaxNofChannelsToGenerate = n; | |
966 | } | |
967 | ||
de01cdf0 | 968 | //_____________________________________________________________________________ |
969 | void | |
970 | AliMUONCDB::WriteLocalTriggerMasks(Int_t startRun, Int_t endRun) | |
971 | { | |
972 | /// Write local trigger masks to OCDB | |
973 | ||
630711ed | 974 | AliMUONVStore* ltm = new AliMUON1DArray(AliMpConstants::TotalNofLocalBoards()+1); |
de01cdf0 | 975 | Int_t ngenerated = MakeLocalTriggerMaskStore(*ltm); |
976 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
977 | if (ngenerated>0) | |
978 | { | |
979 | WriteToCDB("MUON/Calib/LocalTriggerBoardMasks",ltm,startRun,endRun,true); | |
980 | } | |
981 | delete ltm; | |
982 | } | |
983 | ||
984 | //_____________________________________________________________________________ | |
985 | void | |
92c23b09 | 986 | AliMUONCDB::WriteRegionalTriggerConfig(Int_t startRun, Int_t endRun) |
de01cdf0 | 987 | { |
988 | /// Write regional trigger masks to OCDB | |
989 | ||
92c23b09 | 990 | AliMUONRegionalTriggerConfig* rtm = new AliMUONRegionalTriggerConfig(); |
991 | Int_t ngenerated = MakeRegionalTriggerConfigStore(*rtm); | |
de01cdf0 | 992 | AliInfo(Form("Ngenerated = %d",ngenerated)); |
993 | if (ngenerated>0) | |
994 | { | |
92c23b09 | 995 | WriteToCDB("MUON/Calib/RegionalTriggerConfig",rtm,startRun,endRun,true); |
de01cdf0 | 996 | } |
997 | delete rtm; | |
998 | } | |
999 | ||
92c23b09 | 1000 | |
de01cdf0 | 1001 | //_____________________________________________________________________________ |
1002 | void | |
92c23b09 | 1003 | AliMUONCDB::WriteGlobalTriggerConfig(Int_t startRun, Int_t endRun) |
de01cdf0 | 1004 | { |
1005 | /// Write global trigger masks to OCDB | |
1006 | ||
92c23b09 | 1007 | AliMUONGlobalCrateConfig* gtm = new AliMUONGlobalCrateConfig(); |
de01cdf0 | 1008 | |
92c23b09 | 1009 | Int_t ngenerated = MakeGlobalTriggerConfigStore(*gtm); |
de01cdf0 | 1010 | AliInfo(Form("Ngenerated = %d",ngenerated)); |
1011 | if (ngenerated>0) | |
1012 | { | |
92c23b09 | 1013 | WriteToCDB("MUON/Calib/GlobalTriggerCrateConfig",gtm,startRun,endRun,true); |
de01cdf0 | 1014 | } |
1015 | delete gtm; | |
1016 | } | |
1017 | ||
92c23b09 | 1018 | |
de01cdf0 | 1019 | //_____________________________________________________________________________ |
1020 | void | |
1021 | AliMUONCDB::WriteTriggerLut(Int_t startRun, Int_t endRun) | |
1022 | { | |
1023 | /// Write trigger LUT to OCDB | |
1024 | ||
1025 | AliMUONTriggerLut* lut = MakeTriggerLUT(); | |
1026 | if (lut) | |
1027 | { | |
1028 | WriteToCDB("MUON/Calib/TriggerLut",lut,startRun,endRun,true); | |
1029 | } | |
1030 | delete lut; | |
1031 | } | |
1032 | ||
1033 | //_____________________________________________________________________________ | |
1034 | void | |
1035 | AliMUONCDB::WriteTriggerEfficiency(Int_t startRun, Int_t endRun) | |
1036 | { | |
1037 | /// Write trigger efficiency to OCDB | |
1038 | ||
1039 | AliMUONTriggerEfficiencyCells* eff = MakeTriggerEfficiency(); | |
1040 | if (eff) | |
1041 | { | |
1042 | WriteToCDB("MUON/Calib/TriggerEfficiency",eff,startRun,endRun,true); | |
1043 | } | |
1044 | delete eff; | |
1045 | } | |
1046 | ||
1047 | //_____________________________________________________________________________ | |
1048 | void | |
1049 | AliMUONCDB::WriteNeighbours(Int_t startRun, Int_t endRun) | |
1050 | { | |
1051 | /// Write neighbours to OCDB | |
1052 | ||
409de10f | 1053 | AliMUONVStore* neighbours = Create2DMap(); |
de01cdf0 | 1054 | Int_t ngenerated = MakeNeighbourStore(*neighbours); |
1055 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1056 | if (ngenerated>0) | |
1057 | { | |
1058 | WriteToCDB("MUON/Calib/Neighbours",neighbours,startRun,endRun,true); | |
1059 | } | |
1060 | delete neighbours; | |
1061 | } | |
1062 | ||
1063 | //_____________________________________________________________________________ | |
1064 | void | |
1065 | AliMUONCDB::WriteHV(Bool_t defaultValues, | |
1066 | Int_t startRun, Int_t endRun) | |
1067 | { | |
1068 | /// generate HV values (either cste = 1500 V) if defaultValues=true or random | |
1069 | /// if defaultValues=false, see makeHVStore) and | |
1070 | /// store them into CDB located at cdbpath, with a validity period | |
1071 | /// ranging from startRun to endRun | |
1072 | ||
1073 | TMap* hvStore = new TMap; | |
1074 | Int_t ngenerated = MakeHVStore(*hvStore,defaultValues); | |
1075 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1076 | if (ngenerated>0) | |
1077 | { | |
1078 | WriteToCDB("MUON/Calib/HV",hvStore,startRun,endRun,defaultValues); | |
1079 | } | |
1080 | delete hvStore; | |
1081 | } | |
1082 | ||
49e110ec | 1083 | //_____________________________________________________________________________ |
1084 | void | |
1085 | AliMUONCDB::WriteTriggerDCS(Bool_t defaultValues, | |
1086 | Int_t startRun, Int_t endRun) | |
1087 | { | |
1088 | /// generate Trigger HV and current values (either const if defaultValues=true or random | |
1089 | /// if defaultValues=false, see makeTriggerDCSStore) and | |
1090 | /// store them into CDB located at cdbpath, with a validity period | |
1091 | /// ranging from startRun to endRun | |
1092 | ||
1093 | TMap* triggerDCSStore = new TMap; | |
1094 | Int_t ngenerated = MakeTriggerDCSStore(*triggerDCSStore,defaultValues); | |
1095 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1096 | if (ngenerated>0) | |
1097 | { | |
1098 | WriteToCDB("MUON/Calib/TriggerDCS",triggerDCSStore,startRun,endRun,defaultValues); | |
1099 | } | |
1100 | delete triggerDCSStore; | |
1101 | } | |
1102 | ||
de01cdf0 | 1103 | //_____________________________________________________________________________ |
1104 | void | |
1105 | AliMUONCDB::WritePedestals(Bool_t defaultValues, | |
1106 | Int_t startRun, Int_t endRun) | |
1107 | { | |
1108 | /// generate pedestal values (either 0 if defaultValues=true or random | |
1109 | /// if defaultValues=false, see makePedestalStore) and | |
1110 | /// store them into CDB located at cdbpath, with a validity period | |
1111 | /// ranging from startRun to endRun | |
1112 | ||
409de10f | 1113 | AliMUONVStore* pedestalStore = Create2DMap(); |
de01cdf0 | 1114 | Int_t ngenerated = MakePedestalStore(*pedestalStore,defaultValues); |
1115 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1116 | WriteToCDB("MUON/Calib/Pedestals",pedestalStore,startRun,endRun,defaultValues); | |
1117 | delete pedestalStore; | |
1118 | } | |
1119 | ||
2b8a1212 | 1120 | //_____________________________________________________________________________ |
1121 | void | |
1122 | AliMUONCDB::WriteKillMap(Bool_t defaultValues, | |
1123 | Int_t startRun, Int_t endRun) | |
1124 | { | |
1125 | /// generate kill map values (either empty one if defaultValues=true, or | |
1126 | /// random one, see MakeKillMapStore) and | |
1127 | /// store them into CDB located at cdbpath, with a validity period | |
1128 | /// ranging from startRun to endRun | |
1129 | ||
1130 | AliMUONVStore* killMapStore = Create2DMap(); | |
1131 | if ( !defaultValues ) | |
1132 | { | |
1133 | Int_t ngenerated = MakeKillMapStore(*killMapStore); | |
1134 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1135 | } | |
1136 | WriteToCDB("MUON/Calib/KillMap",killMapStore,startRun,endRun,defaultValues); | |
1137 | delete killMapStore; | |
1138 | } | |
1139 | ||
de01cdf0 | 1140 | |
1141 | //_____________________________________________________________________________ | |
1142 | void | |
1143 | AliMUONCDB::WriteGains(Bool_t defaultValues, | |
1144 | Int_t startRun, Int_t endRun) | |
1145 | { | |
1146 | /// generate gain values (either 1 if defaultValues=true or random | |
1147 | /// if defaultValues=false, see makeGainStore) and | |
1148 | /// store them into CDB located at cdbpath, with a validity period | |
1149 | /// ranging from startRun to endRun | |
1150 | ||
409de10f | 1151 | AliMUONVStore* gainStore = Create2DMap(); |
de01cdf0 | 1152 | Int_t ngenerated = MakeGainStore(*gainStore,defaultValues); |
1153 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1154 | WriteToCDB("MUON/Calib/Gains",gainStore,startRun,endRun,defaultValues); | |
1155 | delete gainStore; | |
1156 | } | |
1157 | ||
25e1df3e | 1158 | //_____________________________________________________________________________ |
1159 | void | |
1160 | AliMUONCDB::WriteCapacitances(const char* filename, | |
1161 | Int_t startRun, Int_t endRun) | |
1162 | { | |
1163 | /// read manu capacitance and injection gain values from file | |
1164 | /// and store them into CDB located at cdbpath, with a validity period | |
1165 | /// ranging from startRun to endRun | |
1166 | ||
1167 | AliMUONVStore* capaStore = new AliMUON1DMap(16828); | |
1168 | Int_t ngenerated = MakeCapacitanceStore(*capaStore,filename); | |
1169 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1170 | if ( ngenerated > 0 ) | |
1171 | { | |
1172 | WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,filename); | |
1173 | } | |
1174 | delete capaStore; | |
1175 | } | |
1176 | ||
de01cdf0 | 1177 | //_____________________________________________________________________________ |
1178 | void | |
1179 | AliMUONCDB::WriteCapacitances(Bool_t defaultValues, | |
1180 | Int_t startRun, Int_t endRun) | |
1181 | { | |
1182 | /// generate manu capacitance values (either 1 if defaultValues=true or random | |
1183 | /// if defaultValues=false, see makeCapacitanceStore) and | |
1184 | /// store them into CDB located at cdbpath, with a validity period | |
1185 | /// ranging from startRun to endRun | |
1186 | ||
a0eca509 | 1187 | AliMUONVStore* capaStore = new AliMUON1DMap(16828); |
de01cdf0 | 1188 | Int_t ngenerated = MakeCapacitanceStore(*capaStore,defaultValues); |
1189 | AliInfo(Form("Ngenerated = %d",ngenerated)); | |
1190 | WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,defaultValues); | |
1191 | delete capaStore; | |
1192 | } | |
1193 | ||
1194 | //_____________________________________________________________________________ | |
1195 | void | |
49e110ec | 1196 | AliMUONCDB::WriteTrigger(Bool_t defaultValues, Int_t startRun, Int_t endRun) |
de01cdf0 | 1197 | { |
1198 | /// Writes all Trigger related calibration to CDB | |
49e110ec | 1199 | WriteTriggerDCS(defaultValues,startRun,endRun); |
de01cdf0 | 1200 | WriteLocalTriggerMasks(startRun,endRun); |
92c23b09 | 1201 | WriteRegionalTriggerConfig(startRun,endRun); |
1202 | WriteGlobalTriggerConfig(startRun,endRun); | |
de01cdf0 | 1203 | WriteTriggerLut(startRun,endRun); |
1204 | WriteTriggerEfficiency(startRun,endRun); | |
1205 | } | |
1206 | ||
1207 | //_____________________________________________________________________________ | |
1208 | void | |
1209 | AliMUONCDB::WriteTracker(Bool_t defaultValues, Int_t startRun, Int_t endRun) | |
1210 | { | |
1211 | /// Writes all Tracker related calibration to CDB | |
1212 | WriteHV(defaultValues,startRun,endRun); | |
1213 | WritePedestals(defaultValues,startRun,endRun); | |
1214 | WriteGains(defaultValues,startRun,endRun); | |
1215 | WriteCapacitances(defaultValues,startRun,endRun); | |
1216 | WriteNeighbours(startRun,endRun); | |
2b8a1212 | 1217 | WriteKillMap(startRun,endRun,defaultValues); |
de01cdf0 | 1218 | } |
913f1b43 | 1219 |