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