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