1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
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
26 /// For more information, please see READMECDB
28 // \author Laurent Aphecetche
29 //-----------------------------------------------------------------------------
31 #include "AliMUONCDB.h"
33 #include "AliCodeTimer.h"
34 #include "AliCDBEntry.h"
35 #include "AliCDBManager.h"
36 #include "AliDCSValue.h"
38 #include "AliMUON1DArray.h"
39 #include "AliMUON1DMap.h"
40 #include "AliMUON2DMap.h"
41 #include "AliMUON2DStoreValidator.h"
42 #include "AliMUONCalibParamNF.h"
43 #include "AliMUONCalibParamNI.h"
44 #include "AliMUONConstants.h"
45 #include "AliMUONTriggerEfficiencyCells.h"
46 #include "AliMUONTriggerLut.h"
47 #include "AliMUONVStore.h"
48 #include "AliMUONVCalibParam.h"
49 #include "AliMUONVCalibParam.h"
51 #include "AliMpConstants.h"
52 #include "AliMpDDLStore.h"
53 #include "AliMpDEIterator.h"
54 #include "AliMpDEManager.h"
55 #include "AliMpDetElement.h"
56 #include "AliMpHVNamer.h"
57 #include "AliMpManuIterator.h"
58 #include "AliMpSegmentation.h"
59 #include "AliMpStationType.h"
60 #include "AliMpVSegmentation.h"
61 #include <Riostream.h>
67 #include <TObjString.h>
70 #include <TStopwatch.h>
80 //_____________________________________________________________________________
81 AliMUONVStore* Create2DMap()
83 return new AliMUON2DMap(true);
86 //_____________________________________________________________________________
87 void getBoundaries(const AliMUONVStore& store, Int_t dim,
88 Float_t* xmin, Float_t* xmax)
90 /// Assuming the store contains AliMUONVCalibParam objects, compute the
91 /// limits of the value contained in the VCalibParam, for each of its dimensions
92 /// xmin and xmax must be of dimension dim
94 for ( Int_t i = 0; i < dim; ++i )
100 TIter next(store.CreateIterator());
101 AliMUONVCalibParam* value;
103 while ( ( value = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
105 Int_t detElemId = value->ID0();
106 Int_t manuId = value->ID1();
108 const AliMpVSegmentation* seg =
109 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
111 for ( Int_t manuChannel = 0; manuChannel < value->Size(); ++manuChannel )
113 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE);
114 if (!pad.IsValid()) continue;
116 for ( Int_t i = 0; i < dim; ++i )
118 Float_t x0 = value->ValueAsFloat(manuChannel,i);
120 xmin[i] = TMath::Min(xmin[i],x0);
121 xmax[i] = TMath::Max(xmax[i],x0);
126 for ( Int_t i = 0; i < dim; ++i )
128 if ( TMath::Abs(xmin[i]-xmax[i]) < 1E-3 )
136 //_____________________________________________________________________________
137 Double_t GetRandom(Double_t mean, Double_t sigma, Bool_t mustBePositive)
140 if ( mustBePositive )
144 x = gRandom->Gaus(mean,sigma);
149 x = gRandom->Gaus(mean,sigma);
156 //_____________________________________________________________________________
157 AliMUONCDB::AliMUONCDB(const char* cdbpath)
160 fMaxNofChannelsToGenerate(-1)
163 AliMpDDLStore::ReadData();
166 //_____________________________________________________________________________
167 AliMUONCDB::~AliMUONCDB()
172 //_____________________________________________________________________________
174 AliMUONCDB::Diff(AliMUONVStore& store1, AliMUONVStore& store2,
177 /// creates a store which contains store1-store2
178 /// if opt="abs" the difference is absolute one,
179 /// if opt="rel" then what is stored is (store1-store2)/store1
180 /// if opt="percent" then what is stored is rel*100
182 /// WARNING Works only for stores which holds AliMUONVCalibParam objects
187 if ( !sopt.Contains("ABS") && !sopt.Contains("REL") && !sopt.Contains("PERCENT") )
189 AliErrorClass(Form("opt %s not supported. Only ABS, REL, PERCENT are",opt));
193 AliMUONVStore* d = static_cast<AliMUONVStore*>(store1.Clone());
195 TIter next(d->CreateIterator());
197 AliMUONVCalibParam* param;
199 while ( ( param = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
201 Int_t detElemId = param->ID0();
202 Int_t manuId = param->ID1();
204 AliMUONVCalibParam* param2 = dynamic_cast<AliMUONVCalibParam*>(store2.FindObject(detElemId,manuId));
205 //FIXME: this might happen. Handle it.
208 cerr << "param2 is null : FIXME : this might happen !" << endl;
213 for ( Int_t i = 0; i < param->Size(); ++i )
215 for ( Int_t j = 0; j < param->Dimension(); ++j )
218 if ( sopt.Contains("ABS") )
220 value = param->ValueAsFloat(i,j) - param2->ValueAsFloat(i,j);
222 else if ( sopt.Contains("REL") || sopt.Contains("PERCENT") )
224 if ( param->ValueAsFloat(i,j) )
226 value = (param->ValueAsFloat(i,j) - param2->ValueAsFloat(i,j))/param->ValueAsFloat(i,j);
232 if ( sopt.Contains("PERCENT") ) value *= 100.0;
234 param->SetValueAsFloat(i,j,value);
241 //_____________________________________________________________________________
243 AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins)
245 /// Make histograms of each dimension of the AliMUONVCalibParam
246 /// contained inside store.
247 /// It produces histograms named name_0, name_1, etc...
249 TIter next(store.CreateIterator());
250 AliMUONVCalibParam* param;
252 const Int_t kNStations = AliMpConstants::NofTrackingChambers()/2;
253 Int_t* nPerStation = new Int_t[kNStations];
256 for ( Int_t i = 0; i < kNStations; ++i ) nPerStation[i]=0;
258 while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) )
262 Int_t dim = param->Dimension();
264 Float_t* xmin = new Float_t[dim];
265 Float_t* xmax = new Float_t[dim];
266 getBoundaries(store,dim,xmin,xmax);
268 for ( Int_t i = 0; i < dim; ++i )
270 h[i] = new TH1F(Form("%s_%d",name,i),Form("%s_%d",name,i),
271 nbins,xmin[i],xmax[i]);
272 AliInfo(Form("Created histogram %s",h[i]->GetName()));
276 Int_t detElemId = param->ID0();
277 Int_t manuId = param->ID1();
278 Int_t station = AliMpDEManager::GetChamberId(detElemId)/2;
280 const AliMpVSegmentation* seg =
281 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
283 for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel )
285 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE);
286 if (!pad.IsValid()) continue;
289 ++nPerStation[station];
291 for ( Int_t dim = 0; dim < param->Dimension(); ++dim )
293 h[dim]->Fill(param->ValueAsFloat(manuChannel,dim));
298 for ( Int_t i = 0; i < kNStations; ++i )
300 AliInfo(Form("Station %d %d ",(i+1),nPerStation[i]));
303 AliInfo(Form("Number of channels = %d",n));
305 delete[] nPerStation;
308 //_____________________________________________________________________________
310 AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues)
312 /// Create a HV store
314 AliMpHVNamer hvNamer;
316 TObjArray* aliases = hvNamer.GenerateAliases();
321 for ( Int_t i = 0; i < aliases->GetEntries(); ++i )
323 TObjString* alias = static_cast<TObjString*>(aliases->At(i));
324 TString& aliasName = alias->String();
325 if ( aliasName.Contains("sw") )
327 // HV Switch (St345 only)
328 TObjArray* valueSet = new TObjArray;
329 valueSet->SetOwner(kTRUE);
331 Bool_t value = kTRUE;
335 Float_t r = gRandom->Uniform();
336 if ( r < 0.007 ) value = kFALSE;
339 for ( UInt_t timeStamp = 0; timeStamp < 60*3; timeStamp += 60 )
341 AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp);
342 valueSet->Add(dcsValue);
344 aliasMap.Add(new TObjString(*alias),valueSet);
349 TObjArray* valueSet = new TObjArray;
350 valueSet->SetOwner(kTRUE);
351 for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 )
353 Float_t value = 1500;
354 if (!defaultValues) value = GetRandom(1750,62.5,true);
355 AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp);
356 valueSet->Add(dcsValue);
358 aliasMap.Add(new TObjString(*alias),valueSet);
365 AliInfo(Form("%d HV channels and %d switches",nChannels,nSwitch));
367 return nChannels+nSwitch;
370 //_____________________________________________________________________________
372 AliMUONCDB::MakePedestalStore(AliMUONVStore& pedestalStore, Bool_t defaultValues)
374 /// Create a pedestal store. if defaultValues=true, ped.mean=ped.sigma=1,
375 /// otherwise mean and sigma are from a gaussian (with parameters
376 /// defined below by the kPedestal* constants)
378 AliCodeTimerAuto("");
383 const Int_t kChannels(AliMpConstants::ManuNofChannels());
384 const Float_t kPedestalMeanMean(200);
385 const Float_t kPedestalMeanSigma(10);
386 const Float_t kPedestalSigmaMean(1.0);
387 const Float_t kPedestalSigmaSigma(0.2);
392 AliMpManuIterator it;
394 while ( it.Next(detElemId,manuId) )
398 AliMUONVCalibParam* ped =
399 new AliMUONCalibParamNF(2,kChannels,detElemId,manuId,AliMUONVCalibParam::InvalidFloatValue());
401 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
403 for ( Int_t manuChannel = 0; manuChannel < kChannels; ++manuChannel )
405 if ( ! de->IsConnectedChannel(manuId,manuChannel) ) continue;
409 Float_t meanPedestal;
410 Float_t sigmaPedestal;
419 Bool_t positive(kTRUE);
421 while ( meanPedestal == 0.0 ) // avoid strict zero
423 meanPedestal = GetRandom(kPedestalMeanMean,kPedestalMeanSigma,positive);
425 sigmaPedestal = GetRandom(kPedestalSigmaMean,kPedestalSigmaSigma,positive);
427 ped->SetValueAsFloat(manuChannel,0,meanPedestal);
428 ped->SetValueAsFloat(manuChannel,1,sigmaPedestal);
431 Bool_t ok = pedestalStore.Add(ped);
434 AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
436 if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break;
439 AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels));
443 //_____________________________________________________________________________
445 AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, const char* file)
447 /// Read the capacitance values from file and append them to the capaStore
449 AliCodeTimerAuto(Form("file=%s",file));
451 ifstream in(gSystem->ExpandPathName(file));
452 if (in.bad()) return 0;
457 Int_t serialNumber(-1);
458 AliMUONVCalibParam* param(0x0);
460 while ( in.getline(line,1024,'\n') )
462 if ( isdigit(line[0]) )
464 serialNumber = atoi(line);
465 param = static_cast<AliMUONVCalibParam*>(capaStore.FindObject(serialNumber));
468 AliError(Form("serialNumber %d appears several times !",serialNumber));
472 param = new AliMUONCalibParamNF(2,AliMpConstants::ManuNofChannels(),serialNumber,0,1.0);
473 Bool_t ok = capaStore.Add(param);
476 AliError(Form("Could not set serialNumber=%d",serialNumber));
483 Float_t injectionGain;
484 sscanf(line,"%d %f %f",&channel,&capaValue,&injectionGain);
485 AliDebug(1,Form("SerialNumber %10d Channel %3d Capa %f injectionGain %f",
486 serialNumber,channel,capaValue,injectionGain));
487 param->SetValueAsFloat(channel,0,capaValue);
488 param->SetValueAsFloat(channel,1,injectionGain);
497 //_____________________________________________________________________________
499 AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, Bool_t defaultValues)
501 /// Create a capacitance store. if defaultValues=true, all capa are 1.0,
502 /// otherwise they are from a gaussian with parameters defined in the
503 /// kCapa* constants below.
505 AliCodeTimerAuto("");
509 Int_t nmanusOK(0); // manus for which we got the serial number
511 const Float_t kCapaMean(0.3);
512 const Float_t kCapaSigma(0.1);
513 const Float_t kInjectionGainMean(3);
514 const Float_t kInjectionGainSigma(1);
519 AliMpManuIterator it;
521 while ( it.Next(detElemId,manuId) )
525 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
526 Int_t serialNumber = de->GetManuSerialFromId(manuId);
528 if ( serialNumber <= 0 ) continue;
532 AliMUONVCalibParam* capa = static_cast<AliMUONVCalibParam*>(capaStore.FindObject(serialNumber));
536 capa = new AliMUONCalibParamNF(2,AliMpConstants::ManuNofChannels(),serialNumber,0,1.0);
537 Bool_t ok = capaStore.Add(capa);
540 AliError(Form("Could not set serialNumber=%d manuId=%d",serialNumber,manuId));
544 for ( Int_t manuChannel = 0; manuChannel < capa->Size(); ++manuChannel )
546 if ( ! de->IsConnectedChannel(manuId,manuChannel) ) continue;
551 Float_t injectionGain;
560 capaValue = GetRandom(kCapaMean,kCapaSigma,kTRUE);
561 injectionGain = GetRandom(kInjectionGainMean,kInjectionGainSigma,kTRUE);
563 capa->SetValueAsFloat(manuChannel,0,capaValue);
564 capa->SetValueAsFloat(manuChannel,1,injectionGain);
569 if ( nmanus ) percent = 100*nmanusOK/nmanus;
570 AliInfo(Form("%5d manus with serial number (out of %5d manus = %3.0f%%)",
571 nmanusOK,nmanus,percent));
572 AliInfo(Form("%5d channels",nchannels));
575 AliWarning("Did not get all serial numbers. capaStore is incomplete !!!!");
581 //_____________________________________________________________________________
583 AliMUONCDB::MakeGainStore(AliMUONVStore& gainStore, Bool_t defaultValues)
585 /// Create a gain store. if defaultValues=true, all gains set so that
586 /// charge = (adc-ped)
588 /// otherwise parameters are taken from gaussians with parameters
589 /// defined in the k* constants below.
591 AliCodeTimerAuto("");
596 const Int_t kSaturation(3000);
597 const Double_t kA0Mean(1.2);
598 const Double_t kA0Sigma(0.1);
599 const Double_t kA1Mean(1E-5);
600 const Double_t kA1Sigma(1E-6);
601 const Double_t kQualMean(0xFF);
602 const Double_t kQualSigma(0x10);
603 const Int_t kThresMean(1600);
604 const Int_t kThresSigma(100);
609 AliMpManuIterator it;
611 while ( it.Next(detElemId,manuId) )
615 AliMUONVCalibParam* gain =
616 new AliMUONCalibParamNF(5,AliMpConstants::ManuNofChannels(),
619 AliMUONVCalibParam::InvalidFloatValue());
621 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
623 for ( Int_t manuChannel = 0; manuChannel < gain->Size(); ++manuChannel )
625 if ( ! de->IsConnectedChannel(manuId,manuChannel) ) continue;
631 gain->SetValueAsFloat(manuChannel,0,1.0);
632 gain->SetValueAsFloat(manuChannel,1,0.0);
633 gain->SetValueAsInt(manuChannel,2,4095);
634 gain->SetValueAsInt(manuChannel,3,1);
635 gain->SetValueAsInt(manuChannel,4,kSaturation);
639 Bool_t positive(kTRUE);
640 gain->SetValueAsFloat(manuChannel,0,GetRandom(kA0Mean,kA0Sigma,positive));
641 gain->SetValueAsFloat(manuChannel,1,GetRandom(kA1Mean,kA1Sigma,!positive));
642 gain->SetValueAsInt(manuChannel,2,(Int_t)TMath::Nint(GetRandom(kThresMean,kThresSigma,positive)));
643 gain->SetValueAsInt(manuChannel,3,(Int_t)TMath::Nint(GetRandom(kQualMean,kQualSigma,positive)));
644 gain->SetValueAsInt(manuChannel,4,kSaturation);
648 Bool_t ok = gainStore.Add(gain);
651 AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
653 if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break;
656 AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels));
660 //_____________________________________________________________________________
662 AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks) const
664 /// Generate local trigger masks store. All masks are set to FFFF
666 AliCodeTimerAuto("");
669 // Generate fake mask values for 234 localboards and put that into
670 // one single container (localBoardMasks)
671 for ( Int_t i = 1; i <= 234; ++i )
673 AliMUONVCalibParam* localBoard = new AliMUONCalibParamNI(1,8,i,0,0);
674 for ( Int_t x = 0; x < 2; ++x )
676 for ( Int_t y = 0; y < 4; ++y )
679 localBoard->SetValueAsInt(index,0,0xFFFF);
683 localBoardMasks.Add(localBoard);
688 //_____________________________________________________________________________
690 AliMUONCDB::MakeRegionalTriggerMaskStore(AliMUONVStore& rtm) const
692 /// Make a regional trigger masks store. All masks are set to 3F
694 AliCodeTimerAuto("");
697 for ( Int_t i = 0; i < 16; ++i )
699 AliMUONVCalibParam* regionalBoard = new AliMUONCalibParamNI(1,16,i,0,0);
700 for ( Int_t j = 0; j < 16; ++j )
702 regionalBoard->SetValueAsInt(j,0,0x3F);
705 rtm.Add(regionalBoard);
711 //_____________________________________________________________________________
713 AliMUONCDB::MakeGlobalTriggerMaskStore(AliMUONVCalibParam& gtm) const
715 /// Make a global trigger masks store. All masks set to FFF
717 AliCodeTimerAuto("");
721 for ( Int_t j = 0; j < 16; ++j )
723 gtm.SetValueAsInt(j,0,0xFFF);
729 //_____________________________________________________________________________
731 AliMUONCDB::MakeTriggerLUT(const char* file) const
733 /// Make a triggerlut object, from a file.
735 AliCodeTimerAuto("");
737 AliMUONTriggerLut* lut = new AliMUONTriggerLut;
738 lut->ReadFromFile(file);
742 //_____________________________________________________________________________
743 AliMUONTriggerEfficiencyCells*
744 AliMUONCDB::MakeTriggerEfficiency(const char* file) const
746 /// Make a trigger efficiency object from a file.
748 AliCodeTimerAuto("");
750 return new AliMUONTriggerEfficiencyCells(file);
753 //_____________________________________________________________________________
755 AliMUONCDB::WriteToCDB(const char* calibpath, TObject* object,
756 Int_t startRun, Int_t endRun,
757 const char* filename)
759 /// Write a given object to OCDB
761 AliCDBId id(calibpath,startRun,endRun);
763 md.SetAliRootVersion(gROOT->GetVersion());
764 md.SetComment(gSystem->ExpandPathName(filename));
765 md.SetResponsible("Uploaded using AliMUONCDB class");
766 AliCDBManager* man = AliCDBManager::Instance();
767 man->SetDefaultStorage(fCDBPath);
768 man->Put(object,id,&md);
771 //_____________________________________________________________________________
773 AliMUONCDB::WriteToCDB(const char* calibpath, TObject* object,
774 Int_t startRun, Int_t endRun, Bool_t defaultValues)
776 /// Write a given object to OCDB
778 AliCDBId id(calibpath,startRun,endRun);
780 md.SetAliRootVersion(gROOT->GetVersion());
783 md.SetComment("Test with default values");
787 md.SetComment("Test with random values");
789 md.SetResponsible("AliMUONCDB tester class");
791 AliCDBManager* man = AliCDBManager::Instance();
792 man->SetDefaultStorage(fCDBPath);
793 man->Put(object,id,&md);
796 //_____________________________________________________________________________
798 AliMUONCDB::MakeNeighbourStore(AliMUONVStore& neighbourStore)
800 /// Fill the neighbours store with, for each channel, a TObjArray of its
801 /// neighbouring pads (including itself)
803 AliCodeTimerAuto("");
805 AliInfo("Generating NeighbourStore. This will take a while. Please be patient.");
814 AliMpManuIterator it;
816 while ( it.Next(detElemId,manuId) )
818 const AliMpVSegmentation* seg =
819 AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
821 AliMUONVCalibParam* calibParam = static_cast<AliMUONVCalibParam*>(neighbourStore.FindObject(detElemId,manuId));
825 Int_t size(AliMpConstants::ManuNofChannels());
826 Int_t defaultValue(-1);
827 Int_t packingFactor(size);
829 calibParam = new AliMUONCalibParamNI(dimension,size,detElemId,manuId,defaultValue,packingFactor);
830 Bool_t ok = neighbourStore.Add(calibParam);
833 AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
838 for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
840 AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE);
846 seg->GetNeighbours(pad,tmp,true,true);
847 Int_t nofPadNeighbours = tmp.GetEntriesFast();
849 for ( Int_t i = 0; i < nofPadNeighbours; ++i )
851 AliMpPad* pad = static_cast<AliMpPad*>(tmp.UncheckedAt(i));
854 calibParam->PackValues(pad->GetLocation().GetFirst(),pad->GetLocation().GetSecond(),x);
857 // AliError("Could not pack value. Something is seriously wrong. Please check");
858 // StdoutToAliError(pad->Print(););
861 calibParam->SetValueAsInt(manuChannel,i,x);
870 //_____________________________________________________________________________
872 AliMUONCDB::SetMaxNofChannelsToGenerate(Int_t n)
874 /// Set the maximum number of channels to generate (used for testing only)
875 /// n < 0 means no limit
876 fMaxNofChannelsToGenerate = n;
879 //_____________________________________________________________________________
881 AliMUONCDB::WriteLocalTriggerMasks(Int_t startRun, Int_t endRun)
883 /// Write local trigger masks to OCDB
885 AliMUONVStore* ltm = new AliMUON1DArray(235);
886 Int_t ngenerated = MakeLocalTriggerMaskStore(*ltm);
887 AliInfo(Form("Ngenerated = %d",ngenerated));
890 WriteToCDB("MUON/Calib/LocalTriggerBoardMasks",ltm,startRun,endRun,true);
895 //_____________________________________________________________________________
897 AliMUONCDB::WriteRegionalTriggerMasks(Int_t startRun, Int_t endRun)
899 /// Write regional trigger masks to OCDB
901 AliMUONVStore* rtm = new AliMUON1DArray(16);
902 Int_t ngenerated = MakeRegionalTriggerMaskStore(*rtm);
903 AliInfo(Form("Ngenerated = %d",ngenerated));
906 WriteToCDB("MUON/Calib/RegionalTriggerBoardMasks",rtm,startRun,endRun,true);
911 //_____________________________________________________________________________
913 AliMUONCDB::WriteGlobalTriggerMasks(Int_t startRun, Int_t endRun)
915 /// Write global trigger masks to OCDB
917 AliMUONVCalibParam* gtm = new AliMUONCalibParamNI(1,16,1,0,0);
919 Int_t ngenerated = MakeGlobalTriggerMaskStore(*gtm);
920 AliInfo(Form("Ngenerated = %d",ngenerated));
923 WriteToCDB("MUON/Calib/GlobalTriggerBoardMasks",gtm,startRun,endRun,true);
928 //_____________________________________________________________________________
930 AliMUONCDB::WriteTriggerLut(Int_t startRun, Int_t endRun)
932 /// Write trigger LUT to OCDB
934 AliMUONTriggerLut* lut = MakeTriggerLUT();
937 WriteToCDB("MUON/Calib/TriggerLut",lut,startRun,endRun,true);
942 //_____________________________________________________________________________
944 AliMUONCDB::WriteTriggerEfficiency(Int_t startRun, Int_t endRun)
946 /// Write trigger efficiency to OCDB
948 AliMUONTriggerEfficiencyCells* eff = MakeTriggerEfficiency();
951 WriteToCDB("MUON/Calib/TriggerEfficiency",eff,startRun,endRun,true);
956 //_____________________________________________________________________________
958 AliMUONCDB::WriteNeighbours(Int_t startRun, Int_t endRun)
960 /// Write neighbours to OCDB
962 AliMUONVStore* neighbours = Create2DMap();
963 Int_t ngenerated = MakeNeighbourStore(*neighbours);
964 AliInfo(Form("Ngenerated = %d",ngenerated));
967 WriteToCDB("MUON/Calib/Neighbours",neighbours,startRun,endRun,true);
972 //_____________________________________________________________________________
974 AliMUONCDB::WriteHV(Bool_t defaultValues,
975 Int_t startRun, Int_t endRun)
977 /// generate HV values (either cste = 1500 V) if defaultValues=true or random
978 /// if defaultValues=false, see makeHVStore) and
979 /// store them into CDB located at cdbpath, with a validity period
980 /// ranging from startRun to endRun
982 TMap* hvStore = new TMap;
983 Int_t ngenerated = MakeHVStore(*hvStore,defaultValues);
984 AliInfo(Form("Ngenerated = %d",ngenerated));
987 WriteToCDB("MUON/Calib/HV",hvStore,startRun,endRun,defaultValues);
992 //_____________________________________________________________________________
994 AliMUONCDB::WritePedestals(Bool_t defaultValues,
995 Int_t startRun, Int_t endRun)
997 /// generate pedestal values (either 0 if defaultValues=true or random
998 /// if defaultValues=false, see makePedestalStore) and
999 /// store them into CDB located at cdbpath, with a validity period
1000 /// ranging from startRun to endRun
1002 AliMUONVStore* pedestalStore = Create2DMap();
1003 Int_t ngenerated = MakePedestalStore(*pedestalStore,defaultValues);
1004 AliInfo(Form("Ngenerated = %d",ngenerated));
1005 WriteToCDB("MUON/Calib/Pedestals",pedestalStore,startRun,endRun,defaultValues);
1006 delete pedestalStore;
1010 //_____________________________________________________________________________
1012 AliMUONCDB::WriteGains(Bool_t defaultValues,
1013 Int_t startRun, Int_t endRun)
1015 /// generate gain values (either 1 if defaultValues=true or random
1016 /// if defaultValues=false, see makeGainStore) and
1017 /// store them into CDB located at cdbpath, with a validity period
1018 /// ranging from startRun to endRun
1020 AliMUONVStore* gainStore = Create2DMap();
1021 Int_t ngenerated = MakeGainStore(*gainStore,defaultValues);
1022 AliInfo(Form("Ngenerated = %d",ngenerated));
1023 WriteToCDB("MUON/Calib/Gains",gainStore,startRun,endRun,defaultValues);
1027 //_____________________________________________________________________________
1029 AliMUONCDB::WriteCapacitances(const char* filename,
1030 Int_t startRun, Int_t endRun)
1032 /// read manu capacitance and injection gain values from file
1033 /// and store them into CDB located at cdbpath, with a validity period
1034 /// ranging from startRun to endRun
1036 AliMUONVStore* capaStore = new AliMUON1DMap(16828);
1037 Int_t ngenerated = MakeCapacitanceStore(*capaStore,filename);
1038 AliInfo(Form("Ngenerated = %d",ngenerated));
1039 if ( ngenerated > 0 )
1041 WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,filename);
1046 //_____________________________________________________________________________
1048 AliMUONCDB::WriteCapacitances(Bool_t defaultValues,
1049 Int_t startRun, Int_t endRun)
1051 /// generate manu capacitance values (either 1 if defaultValues=true or random
1052 /// if defaultValues=false, see makeCapacitanceStore) and
1053 /// store them into CDB located at cdbpath, with a validity period
1054 /// ranging from startRun to endRun
1056 AliMUONVStore* capaStore = new AliMUON1DMap(16828);
1057 Int_t ngenerated = MakeCapacitanceStore(*capaStore,defaultValues);
1058 AliInfo(Form("Ngenerated = %d",ngenerated));
1059 WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,defaultValues);
1063 //_____________________________________________________________________________
1065 AliMUONCDB::WriteTrigger(Int_t startRun, Int_t endRun)
1067 /// Writes all Trigger related calibration to CDB
1068 WriteLocalTriggerMasks(startRun,endRun);
1069 WriteRegionalTriggerMasks(startRun,endRun);
1070 WriteGlobalTriggerMasks(startRun,endRun);
1071 WriteTriggerLut(startRun,endRun);
1072 WriteTriggerEfficiency(startRun,endRun);
1075 //_____________________________________________________________________________
1077 AliMUONCDB::WriteTracker(Bool_t defaultValues, Int_t startRun, Int_t endRun)
1079 /// Writes all Tracker related calibration to CDB
1080 WriteHV(defaultValues,startRun,endRun);
1081 WritePedestals(defaultValues,startRun,endRun);
1082 WriteGains(defaultValues,startRun,endRun);
1083 WriteCapacitances(defaultValues,startRun,endRun);
1084 WriteNeighbours(startRun,endRun);