X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONCDB.cxx;h=d1a2cb5a665e131d9099ea69521c307f002ca8c5;hb=6a62da73fb1ac261f88e15bf2ed2f5172012ad8b;hp=2f638f5fb8f38e2f1df83c7caae444891ecce67f;hpb=168e9c4d964fb4c171ece6ecd58086a307241034;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONCDB.cxx b/MUON/AliMUONCDB.cxx index 2f638f5fb8f..d1a2cb5a665 100644 --- a/MUON/AliMUONCDB.cxx +++ b/MUON/AliMUONCDB.cxx @@ -14,18 +14,21 @@ **************************************************************************/ /* $Id$ */ - + //----------------------------------------------------------------------------- -/// \class AliMUONCDB +/// \namespace AliMUONCDB +/// +/// Helper functions to experience the OCDB /// -/// Helper class to experience the OCDB -/// It allows to generate dummy (but complete) containers for all the +/// They allow to read magnetic field, mapping and recoParam from OCDB +/// +/// And also to generate dummy (but complete) containers for all the /// calibration data types we have for tracker and trigger, and to write /// them into OCDB. /// -/// For more information, please see READMECDB +/// For more information, please see READMEcalib /// -// \author Laurent Aphecetche +/// \author Laurent Aphecetche //----------------------------------------------------------------------------- #include "AliMUONCDB.h" @@ -34,20 +37,29 @@ #include "AliMUON1DMap.h" #include "AliMUON2DMap.h" #include "AliMUON2DStoreValidator.h" +#include "AliMUONCalibParamND.h" #include "AliMUONCalibParamNF.h" #include "AliMUONCalibParamNI.h" +#include "AliMUONCalibrationData.h" #include "AliMUONConstants.h" +#include "AliMUONGlobalCrateConfig.h" +#include "AliMUONLogger.h" +#include "AliMUONPadStatusMaker.h" +#include "AliMUONPadStatusMapMaker.h" +#include "AliMUONRecoParam.h" +#include "AliMUONRegionalTriggerConfig.h" +#include "AliMUONRejectList.h" +#include "AliMUONTrackerData.h" #include "AliMUONTrackerIO.h" #include "AliMUONTriggerEfficiencyCells.h" #include "AliMUONTriggerLut.h" -#include "AliMUONVStore.h" #include "AliMUONVCalibParam.h" #include "AliMUONVCalibParam.h" -#include "AliMUONGlobalCrateConfig.h" -#include "AliMUONRegionalTriggerConfig.h" +#include "AliMUONVStore.h" #include "AliMpCDB.h" #include "AliMpConstants.h" +#include "AliMpDEStore.h" #include "AliMpDDLStore.h" #include "AliMpManuStore.h" #include "AliMpDEManager.h" @@ -62,12 +74,15 @@ #include "AliCodeTimer.h" #include "AliCDBEntry.h" #include "AliCDBManager.h" +#include "AliGRPManager.h" #include "AliDCSValue.h" #include "AliLog.h" +#include "AliMpBusPatch.h" #include #include #include +#include #include #include #include @@ -77,11 +92,16 @@ #include #include #include +#include +#include +#include +#include - -/// \cond CLASSIMP -ClassImp(AliMUONCDB) -/// \endcond +using std::endl; +using std::cout; +using std::cerr; +using std::ostringstream; +using std::ifstream; namespace { @@ -116,6 +136,8 @@ void getBoundaries(const AliMUONVStore& store, Int_t dim, const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); + if (!seg) continue; + for ( Int_t manuChannel = 0; manuChannel < value->Size(); ++manuChannel ) { AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); @@ -162,26 +184,167 @@ Double_t GetRandom(Double_t mean, Double_t sigma, Bool_t mustBePositive) } //_____________________________________________________________________________ -AliMUONCDB::AliMUONCDB(const char* cdbpath) -: TObject(), - fCDBPath(cdbpath), - fMaxNofChannelsToGenerate(-1) +Bool_t AliMUONCDB::CheckOCDB(Bool_t pathOnly) +{ + /// Check that OCDB path and run number are properly set + + AliCDBManager* man = AliCDBManager::Instance(); + + // first OCDB path + if (!man->IsDefaultStorageSet()) { + AliErrorGeneral("AliMUONCDB", "OCDB path must be properly set"); + return kFALSE; + } + + // then run number if required + if (pathOnly) return kTRUE; + if (man->GetRun() < 0) { + AliErrorGeneral("AliMUONCDB", "Run number must be properly set"); + return kFALSE; + } + + return kTRUE; + +} + +//_____________________________________________________________________________ +Bool_t AliMUONCDB::CheckMapping(Bool_t segmentationOnly) +{ + /// Check that the mapping has been loaded + + // first the segmentation + if (!AliMpSegmentation::Instance(false)) { + AliErrorGeneral("AliMUONCDB", "Mapping segmentation must be loaded first"); + return kFALSE; + } + + // then the others if required + if (segmentationOnly) return kTRUE; + if (!AliMpDDLStore::Instance(false) || !AliMpDEStore::Instance(false) || !AliMpManuStore::Instance(false)) { + AliErrorGeneral("AliMUONCDB", "Full mapping must be loaded first"); + return kFALSE; + } + + return kTRUE; + +} + +//_____________________________________________________________________________ +Bool_t AliMUONCDB::LoadField() +{ + /// Load magnetic field (existing field will be deleted). + /// OCDB path and run number are supposed to be set. + + AliInfoGeneral("AliMUONCDB","Loading field map from GRP..."); + + if (!AliMUONCDB::CheckOCDB()) return kFALSE; + + AliGRPManager grpMan; + + // make sure the old field is deleted even if it is locked + if(TGeoGlobalMagField::Instance()->IsLocked()) delete TGeoGlobalMagField::Instance(); + + if (!grpMan.ReadGRPEntry() || !grpMan.SetMagField()) { + AliErrorGeneral("AliMUONCDB", "failed to load magnetic field from OCDB"); + return kFALSE; + } + + return kTRUE; + +} + +//_____________________________________________________________________________ +Bool_t AliMUONCDB::LoadMapping(Bool_t segmentationOnly) { - /// ctor - // Load mapping - if ( ! AliMpCDB::LoadDDLStore() ) { - AliFatal("Could not access mapping from OCDB !"); + /// Load mapping (existing mapping will be unloaded). + /// OCDB path and run number are supposed to be set. + + AliInfoGeneral("AliMUONCDB", "Loading mapping from OCDB..."); + + if (!AliMUONCDB::CheckOCDB()) return kFALSE; + + // in case it has already been set + AliMpCDB::UnloadAll(); + + if (segmentationOnly) { + + if (!AliMpCDB::LoadMpSegmentation(kTRUE)){ + AliErrorGeneral("AliMUONCDB", "failed to load segmentation from OCDB"); + return kFALSE; + } + + } else { + + if (!AliMpCDB::LoadAll(kTRUE)) { + AliErrorGeneral("AliMUONCDB", "failed to load mapping from OCDB"); + return kFALSE; } + + } + + return kTRUE; + +} - if ( ! AliMpCDB::LoadManuStore() ) { - AliFatal("Could not access run-dependent mapping from OCDB !"); +//_____________________________________________________________________________ +AliMUONRecoParam* AliMUONCDB::LoadRecoParam() +{ + /// Load and return reconstruction parameters. + /// OCDB path is supposed to be set. + + AliInfoGeneral("AliMUONCDB", "Loading RecoParam from OCDB..."); + + if (!AliMUONCDB::CheckOCDB()) return 0x0; + + AliMUONRecoParam* recoParam = 0x0; + AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Calib/RecoParam"); + + if(entry) { + + // load recoParam according OCDB content (single or array) + if (!(recoParam = dynamic_cast(entry->GetObject()))) { + + TObjArray* recoParamArray = static_cast(entry->GetObject()); +// recoParamArray->SetOwner(kTRUE); // FIXME: this should be done, but is causing a problem at the end of the reco... investigate why... + + for(Int_t i = 0; i < recoParamArray->GetEntriesFast(); i++) { + recoParam = static_cast(recoParamArray->UncheckedAt(i)); + if (recoParam->IsDefault()) break; + recoParam = 0x0; + } + } + + } + + if (!recoParam) AliErrorGeneral("AliMUONCDB", "failed to load RecoParam from OCDB"); + + return recoParam; + } //_____________________________________________________________________________ -AliMUONCDB::~AliMUONCDB() +TClonesArray* AliMUONCDB::LoadAlignmentData() { - /// dtor + /// Load and return the array of alignment objects. + + AliInfoGeneral("AliMUONCDB", "Loading Alignemnt from OCDB..."); + + if (!AliMUONCDB::CheckOCDB()) return 0x0; + + TClonesArray* alignmentArray = 0x0; + AliCDBEntry* entry = AliCDBManager::Instance()->Get("MUON/Align/Data"); + + if (entry) { + // load alignement array + alignmentArray = dynamic_cast(entry->GetObject()); + } + + if (!alignmentArray) { + AliErrorGeneral("AliMUONCDB", "failed to load Alignemnt from OCDB"); + } + + return alignmentArray; } //_____________________________________________________________________________ @@ -201,7 +364,7 @@ AliMUONCDB::Diff(AliMUONVStore& store1, AliMUONVStore& store2, if ( !sopt.Contains("ABS") && !sopt.Contains("REL") && !sopt.Contains("PERCENT") ) { - AliErrorClass(Form("opt %s not supported. Only ABS, REL, PERCENT are",opt)); + AliErrorGeneral("AliMUONCDB", Form("opt %s not supported. Only ABS, REL, PERCENT are",opt)); return 0x0; } @@ -254,13 +417,15 @@ AliMUONCDB::Diff(AliMUONVStore& store1, AliMUONVStore& store2, } //_____________________________________________________________________________ -void +TH1** AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins) { /// Make histograms of each dimension of the AliMUONVCalibParam /// contained inside store. /// It produces histograms named name_0, name_1, etc... + if (!AliMUONCDB::CheckMapping(kTRUE)) return 0x0; + TIter next(store.CreateIterator()); AliMUONVCalibParam* param; Int_t n(0); @@ -284,8 +449,10 @@ AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins) { h[i] = new TH1F(Form("%s_%d",name,i),Form("%s_%d",name,i), nbins,xmin[i],xmax[i]); - AliInfo(Form("Created histogram %s",h[i]->GetName())); + AliInfoGeneral("AliMUONCDB", Form("Created histogram %s",h[i]->GetName())); } + delete [] xmin; + delete [] xmax; } Int_t detElemId = param->ID0(); @@ -295,6 +462,8 @@ AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins) const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); + if (!seg) continue; + for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel ) { AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); @@ -312,12 +481,14 @@ AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins) for ( Int_t i = 0; i < kNStations; ++i ) { - AliInfo(Form("Station %d %d ",(i+1),nPerStation[i])); + AliInfoGeneral("AliMUONCDB", Form("Station %d %d ",(i+1),nPerStation[i])); } - AliInfo(Form("Number of channels = %d",n)); + AliInfoGeneral("AliMUONCDB", Form("Number of channels = %d",n)); delete[] nPerStation; + + return h; } //_____________________________________________________________________________ @@ -326,6 +497,8 @@ AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues) { /// Create a HV store + if (!AliMUONCDB::CheckMapping()) return 0; + AliMpDCSNamer hvNamer("TRACKER"); TObjArray* aliases = hvNamer.GenerateAliases(); @@ -377,7 +550,7 @@ AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues) delete aliases; - AliInfo(Form("%d HV channels and %d switches",nChannels,nSwitch)); + AliInfoGeneral("AliMUONCDB", Form("%d HV channels and %d switches",nChannels,nSwitch)); return nChannels+nSwitch; } @@ -388,6 +561,8 @@ AliMUONCDB::MakeTriggerDCSStore(TMap& aliasMap, Bool_t defaultValues) { /// Create a Trigger HV and Currents store + if (!AliMUONCDB::CheckMapping()) return 0; + AliMpDCSNamer triggerDCSNamer("TRIGGER"); TObjArray* aliases = triggerDCSNamer.GenerateAliases(); @@ -401,7 +576,15 @@ AliMUONCDB::MakeTriggerDCSStore(TMap& aliasMap, Bool_t defaultValues) TObjArray* valueSet = new TObjArray; valueSet->SetOwner(kTRUE); + Int_t measureType = triggerDCSNamer.DCSvariableFromDCSAlias(aliasName.Data()); + if ( measureType < 0 ) { + AliErrorGeneralStream("AliMUONCDB") + << "Failed to get DCS variable from an alias (trigger): " + << aliasName.Data() << endl; + return 0; + } + for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 ) { Float_t value = @@ -425,7 +608,7 @@ AliMUONCDB::MakeTriggerDCSStore(TMap& aliasMap, Bool_t defaultValues) delete aliases; - AliInfo(Form("Trigger channels I -> %i HV -> %i",nChannels[0], nChannels[1])); + AliInfoGeneral("AliMUONCDB", Form("Trigger channels I -> %i HV -> %i",nChannels[0], nChannels[1])); return nChannels[0] + nChannels[1]; } @@ -438,7 +621,9 @@ AliMUONCDB::MakePedestalStore(AliMUONVStore& pedestalStore, Bool_t defaultValues /// otherwise mean and sigma are from a gaussian (with parameters /// defined below by the kPedestal* constants) - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); + + if (!AliMUONCDB::CheckMapping()) return 0; Int_t nchannels(0); Int_t nmanus(0); @@ -522,21 +707,93 @@ AliMUONCDB::MakePedestalStore(AliMUONVStore& pedestalStore, Bool_t defaultValues Bool_t ok = pedestalStore.Add(ped); if (!ok) { - AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); + AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); } - if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break; } - AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels)); + AliInfoGeneral("AliMUONCDB", Form("%d Manus and %d channels.",nmanus,nchannels)); return nchannels; } +//_____________________________________________________________________________ +AliMUONRejectList* +AliMUONCDB::MakeRejectListStore(Bool_t defaultValues) +{ + /// Create a reject list + + AliCodeTimerAutoGeneral("",0); + + AliMUONRejectList* rl = new AliMUONRejectList; + + if (!defaultValues) + { + rl->SetDetectionElementProbability(510); + rl->SetDetectionElementProbability(508); + return rl; + } + + return rl; +} + +//_____________________________________________________________________________ +Int_t +AliMUONCDB::MakeOccupancyMapStore(AliMUONVStore& occupancyMapStore, Bool_t defaultValues) +{ + /// Create an occupancy map. + + AliCodeTimerAutoGeneral("",0); + + if (!AliMUONCDB::CheckMapping()) return 0; + + Int_t nmanus(0); + + Int_t detElemId; + Int_t manuId; + + AliMpManuIterator it; + + Int_t nevents(1000); + + while ( it.Next(detElemId,manuId) ) + { + ++nmanus; + + AliMUONVCalibParam* occupancy = new AliMUONCalibParamND(5,1,detElemId,manuId,0); + + Double_t occ = 0.0; + + AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); + + Int_t numberOfChannelsInManu = de->NofChannelsInManu(manuId); + + if (!defaultValues) occ = gRandom->Rndm(1); + + Double_t sumn = occ*nevents; + + occupancy->SetValueAsFloat(0,0,sumn); + occupancy->SetValueAsFloat(0,1,sumn); + occupancy->SetValueAsFloat(0,2,sumn); + occupancy->SetValueAsInt(0,3,numberOfChannelsInManu); + occupancy->SetValueAsInt(0,4,nevents); + + Bool_t ok = occupancyMapStore.Add(occupancy); + if (!ok) + { + AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); + } + } + + return nmanus; +} + //_____________________________________________________________________________ Int_t AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, const char* file) { /// Read the capacitance values from file and append them to the capaStore + if (!AliMUONCDB::CheckMapping()) return 0; + return AliMUONTrackerIO::ReadCapacitances(file,capaStore); } @@ -548,7 +805,9 @@ AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, Bool_t defaultValues) /// otherwise they are from a gaussian with parameters defined in the /// kCapa* constants below. - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); + + if (!AliMUONCDB::CheckMapping()) return 0; Int_t nchannels(0); Int_t nmanus(0); @@ -583,7 +842,7 @@ AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, Bool_t defaultValues) Bool_t ok = capaStore.Add(capa); if (!ok) { - AliError(Form("Could not set serialNumber=%d manuId=%d",serialNumber,manuId)); + AliErrorGeneral("AliMUONCDB", Form("Could not set serialNumber=%d manuId=%d",serialNumber,manuId)); } } @@ -613,12 +872,12 @@ AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, Bool_t defaultValues) Float_t percent = 0; if ( nmanus ) percent = 100*nmanusOK/nmanus; - AliInfo(Form("%5d manus with serial number (out of %5d manus = %3.0f%%)", + AliInfoGeneral("AliMUONCDB", Form("%5d manus with serial number (out of %5d manus = %3.0f%%)", nmanusOK,nmanus,percent)); - AliInfo(Form("%5d channels",nchannels)); + AliInfoGeneral("AliMUONCDB", Form("%5d channels",nchannels)); if ( percent < 100 ) { - AliWarning("Did not get all serial numbers. capaStore is incomplete !!!!"); + AliWarningGeneral("AliMUONCDB", "Did not get all serial numbers. capaStore is incomplete !!!!"); } return nchannels; @@ -634,7 +893,9 @@ AliMUONCDB::MakeGainStore(AliMUONVStore& gainStore, Bool_t defaultValues) /// otherwise parameters are taken from gaussians with parameters /// defined in the k* constants below. - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); + + if (!AliMUONCDB::CheckMapping()) return 0; Int_t nchannels(0); Int_t nmanus(0); @@ -694,22 +955,21 @@ AliMUONCDB::MakeGainStore(AliMUONVStore& gainStore, Bool_t defaultValues) Bool_t ok = gainStore.Add(gain); if (!ok) { - AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); + AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); } - if ( fMaxNofChannelsToGenerate > 0 && nchannels >= fMaxNofChannelsToGenerate ) break; } - AliInfo(Form("%d Manus and %d channels.",nmanus,nchannels)); + AliInfoGeneral("AliMUONCDB", Form("%d Manus and %d channels.",nmanus,nchannels)); return nchannels; } //_____________________________________________________________________________ Int_t -AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks) const +AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks) { /// Generate local trigger masks store. All masks are set to FFFF - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); Int_t ngenerated(0); // Generate fake mask values for all localboards and put that into @@ -733,14 +993,14 @@ AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks) const //_____________________________________________________________________________ Int_t -AliMUONCDB::MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm) const +AliMUONCDB::MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm) { /// Make a regional trigger config store. Mask is set to FFFF for each local board (Ch.F.) - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); if ( ! rtm.ReadData(AliMpFiles::LocalTriggerBoardMapping()) ) { - AliErrorStream() << "Error when reading from mapping file" << endl; + AliErrorGeneral("AliMUONCDB", "Error when reading from mapping file"); return 0; } @@ -750,11 +1010,11 @@ AliMUONCDB::MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig& rtm) co //_____________________________________________________________________________ Int_t -AliMUONCDB::MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm) const +AliMUONCDB::MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm) { /// Make a global trigger config store. All masks (disable) set to 0x00 for each Darc board (Ch.F.) - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); return gtm.ReadData(AliMpFiles::GlobalTriggerBoardMapping()); } @@ -762,11 +1022,11 @@ AliMUONCDB::MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig& gtm) const //_____________________________________________________________________________ AliMUONTriggerLut* -AliMUONCDB::MakeTriggerLUT(const char* file) const +AliMUONCDB::MakeTriggerLUT(const char* file) { /// Make a triggerlut object, from a file. - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); AliMUONTriggerLut* lut = new AliMUONTriggerLut; lut->ReadFromFile(file); @@ -775,11 +1035,11 @@ AliMUONCDB::MakeTriggerLUT(const char* file) const //_____________________________________________________________________________ AliMUONTriggerEfficiencyCells* -AliMUONCDB::MakeTriggerEfficiency(const char* file) const +AliMUONCDB::MakeTriggerEfficiency(const char* file) { /// Make a trigger efficiency object from a file. - AliCodeTimerAuto(""); + AliCodeTimerAutoGeneral("",0); return new AliMUONTriggerEfficiencyCells(file); } @@ -818,97 +1078,14 @@ AliMUONCDB::WriteToCDB(TObject* object, const char* calibpath, Int_t startRun, I { /// Write a given object to OCDB + if (!AliMUONCDB::CheckOCDB(kTRUE)) return; + AliCDBId id(calibpath,startRun,endRun); AliCDBMetaData md; md.SetAliRootVersion(gROOT->GetVersion()); md.SetComment(comment); md.SetResponsible(responsible); - AliCDBManager* man = AliCDBManager::Instance(); - if (!man->IsDefaultStorageSet()) man->SetDefaultStorage(fCDBPath); - man->Put(object,id,&md); -} - -//_____________________________________________________________________________ -Int_t -AliMUONCDB::MakeNeighbourStore(AliMUONVStore& neighbourStore) -{ - /// Fill the neighbours store with, for each channel, a TObjArray of its - /// neighbouring pads (including itself) - - AliCodeTimerAuto(""); - - AliInfo("Generating NeighbourStore. This will take a while. Please be patient."); - - Int_t nchannels(0); - - TObjArray tmp; - - Int_t detElemId; - Int_t manuId; - - AliMpManuIterator it; - - while ( it.Next(detElemId,manuId) ) - { - const AliMpVSegmentation* seg = - AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); - - AliMUONVCalibParam* calibParam = static_cast(neighbourStore.FindObject(detElemId,manuId)); - if (!calibParam) - { - Int_t dimension(11); - Int_t size(AliMpConstants::ManuNofChannels()); - Int_t defaultValue(-1); - Int_t packingFactor(size); - - calibParam = new AliMUONCalibParamNI(dimension,size,detElemId,manuId,defaultValue,packingFactor); - Bool_t ok = neighbourStore.Add(calibParam); - if (!ok) - { - AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId)); - return -1; - } - } - - for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) - { - AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); - - if (pad.IsValid()) - { - ++nchannels; - - seg->GetNeighbours(pad,tmp,true,true); - Int_t nofPadNeighbours = tmp.GetEntriesFast(); - - for ( Int_t i = 0; i < nofPadNeighbours; ++i ) - { - AliMpPad* p = static_cast(tmp.UncheckedAt(i)); - Int_t x; -// Bool_t ok = - calibParam->PackValues(p->GetManuId(),p->GetManuChannel(),x); -// if (!ok) -// { -// AliError("Could not pack value. Something is seriously wrong. Please check"); -// StdoutToAliError(pad->Print();); -// return -1; -// } - calibParam->SetValueAsInt(manuChannel,i,x); - } - } - } - } - - return nchannels; -} - -//_____________________________________________________________________________ -void -AliMUONCDB::SetMaxNofChannelsToGenerate(Int_t n) -{ - /// Set the maximum number of channels to generate (used for testing only) - /// n < 0 means no limit - fMaxNofChannelsToGenerate = n; + AliCDBManager::Instance()->Put(object,id,&md); } //_____________________________________________________________________________ @@ -919,7 +1096,7 @@ AliMUONCDB::WriteLocalTriggerMasks(Int_t startRun, Int_t endRun) AliMUONVStore* ltm = new AliMUON1DArray(AliMpConstants::TotalNofLocalBoards()+1); Int_t ngenerated = MakeLocalTriggerMaskStore(*ltm); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); if (ngenerated>0) { WriteToCDB("MUON/Calib/LocalTriggerBoardMasks",ltm,startRun,endRun,true); @@ -935,7 +1112,7 @@ AliMUONCDB::WriteRegionalTriggerConfig(Int_t startRun, Int_t endRun) AliMUONRegionalTriggerConfig* rtm = new AliMUONRegionalTriggerConfig(); Int_t ngenerated = MakeRegionalTriggerConfigStore(*rtm); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); if (ngenerated>0) { WriteToCDB("MUON/Calib/RegionalTriggerConfig",rtm,startRun,endRun,true); @@ -953,7 +1130,7 @@ AliMUONCDB::WriteGlobalTriggerConfig(Int_t startRun, Int_t endRun) AliMUONGlobalCrateConfig* gtm = new AliMUONGlobalCrateConfig(); Int_t ngenerated = MakeGlobalTriggerConfigStore(*gtm); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); if (ngenerated>0) { WriteToCDB("MUON/Calib/GlobalTriggerCrateConfig",gtm,startRun,endRun,true); @@ -990,22 +1167,6 @@ AliMUONCDB::WriteTriggerEfficiency(Int_t startRun, Int_t endRun) delete eff; } -//_____________________________________________________________________________ -void -AliMUONCDB::WriteNeighbours(Int_t startRun, Int_t endRun) -{ - /// Write neighbours to OCDB - - AliMUONVStore* neighbours = Create2DMap(); - Int_t ngenerated = MakeNeighbourStore(*neighbours); - AliInfo(Form("Ngenerated = %d",ngenerated)); - if (ngenerated>0) - { - WriteToCDB("MUON/Calib/Neighbours",neighbours,startRun,endRun,true); - } - delete neighbours; -} - //_____________________________________________________________________________ void AliMUONCDB::WriteHV(Bool_t defaultValues, @@ -1018,7 +1179,7 @@ AliMUONCDB::WriteHV(Bool_t defaultValues, TMap* hvStore = new TMap; Int_t ngenerated = MakeHVStore(*hvStore,defaultValues); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); if (ngenerated>0) { WriteToCDB("MUON/Calib/HV",hvStore,startRun,endRun,defaultValues); @@ -1038,7 +1199,7 @@ AliMUONCDB::WriteTriggerDCS(Bool_t defaultValues, TMap* triggerDCSStore = new TMap; Int_t ngenerated = MakeTriggerDCSStore(*triggerDCSStore,defaultValues); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); if (ngenerated>0) { WriteToCDB("MUON/Calib/TriggerDCS",triggerDCSStore,startRun,endRun,defaultValues); @@ -1058,11 +1219,43 @@ AliMUONCDB::WritePedestals(Bool_t defaultValues, AliMUONVStore* pedestalStore = Create2DMap(); Int_t ngenerated = MakePedestalStore(*pedestalStore,defaultValues); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); WriteToCDB("MUON/Calib/Pedestals",pedestalStore,startRun,endRun,defaultValues); delete pedestalStore; } +//_____________________________________________________________________________ +void +AliMUONCDB::WriteOccupancyMap(Bool_t defaultValues, + Int_t startRun, Int_t endRun) +{ + /// generate occupancy map values (either empty one if defaultValues=true, or + /// random one, see MakeOccupancyMapStore) and + /// store them into CDB located at cdbpath, with a validity period + /// ranging from startRun to endRun + + AliMUONVStore* occupancyMapStore = Create2DMap(); + Int_t ngenerated = MakeOccupancyMapStore(*occupancyMapStore,defaultValues); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); + WriteToCDB("MUON/Calib/OccupancyMap",occupancyMapStore,startRun,endRun,defaultValues); + delete occupancyMapStore; +} + +//_____________________________________________________________________________ +void +AliMUONCDB::WriteRejectList(Bool_t defaultValues, + Int_t startRun, Int_t endRun) +{ + /// generate reject list values (either empty one if defaultValues=true, or + /// random one, see MakeRejectListStore) and + /// store them into CDB located at cdbpath, with a validity period + /// ranging from startRun to endRun + + AliMUONRejectList* rl = MakeRejectListStore(defaultValues); + WriteToCDB("MUON/Calib/RejectList",rl,startRun,endRun,defaultValues); + delete rl; +} + //_____________________________________________________________________________ void @@ -1076,7 +1269,7 @@ AliMUONCDB::WriteGains(Bool_t defaultValues, AliMUONVStore* gainStore = Create2DMap(); Int_t ngenerated = MakeGainStore(*gainStore,defaultValues); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); WriteToCDB("MUON/Calib/Gains",gainStore,startRun,endRun,defaultValues); delete gainStore; } @@ -1092,7 +1285,7 @@ AliMUONCDB::WriteCapacitances(const char* filename, AliMUONVStore* capaStore = new AliMUON1DMap(16828); Int_t ngenerated = MakeCapacitanceStore(*capaStore,filename); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); if ( ngenerated > 0 ) { WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,filename); @@ -1112,7 +1305,7 @@ AliMUONCDB::WriteCapacitances(Bool_t defaultValues, AliMUONVStore* capaStore = new AliMUON1DMap(16828); Int_t ngenerated = MakeCapacitanceStore(*capaStore,defaultValues); - AliInfo(Form("Ngenerated = %d",ngenerated)); + AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated)); WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,defaultValues); delete capaStore; } @@ -1130,6 +1323,29 @@ AliMUONCDB::WriteTrigger(Bool_t defaultValues, Int_t startRun, Int_t endRun) WriteTriggerEfficiency(startRun,endRun); } +//_____________________________________________________________________________ +void +AliMUONCDB::WriteConfig(Int_t startRun, Int_t endRun) +{ + /// Write complete tracker configuration to OCDB + ostringstream lines; + TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator()); + AliMpBusPatch* bp; + while ( ( bp = static_cast(next()) ) ) + { + for (Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu) + { + lines << bp->GetId() << " " << bp->GetManuId(imanu) << endl; + } + } + + AliMUON2DMap config(kTRUE); + + AliMUONTrackerIO::DecodeConfig(lines.str().c_str(),config); + + WriteToCDB("MUON/Calib/Config",&config,startRun,endRun,kTRUE); +} + //_____________________________________________________________________________ void AliMUONCDB::WriteTracker(Bool_t defaultValues, Int_t startRun, Int_t endRun) @@ -1139,6 +1355,516 @@ AliMUONCDB::WriteTracker(Bool_t defaultValues, Int_t startRun, Int_t endRun) WritePedestals(defaultValues,startRun,endRun); WriteGains(defaultValues,startRun,endRun); WriteCapacitances(defaultValues,startRun,endRun); - WriteNeighbours(startRun,endRun); + WriteOccupancyMap(defaultValues,startRun,endRun); + WriteRejectList(defaultValues,startRun,endRun); + WriteConfig(startRun,endRun); } +//_____________________________________________________________________________ +void +AliMUONCDB::ShowCapacitances() +{ + /// Show briefly the number of capa values we have in the OCDB, + /// and the list of manu that are actually in the config and for which + /// we miss the capa (if any). + + if (!AliMUONCDB::CheckOCDB()) return; + + AliMUONCDB::LoadMapping(); + + if (!AliMUONCDB::CheckMapping()) return; + + AliCDBEntry* e = AliCDBManager::Instance()->Get("MUON/Calib/Config"); + + if (!e) return ; + + AliMUONVStore* config = static_cast(e->GetObject()); + + e = AliCDBManager::Instance()->Get("MUON/Calib/Capacitances"); + + if (!e) return; + + AliMUONVStore* capacitances = static_cast(e->GetObject()); + + AliInfoGeneral("ShowCapacitances",Form("%d capacitances are in OCDB",capacitances->GetSize())); + + TIter nextManu(config->CreateIterator()); + AliMUONVCalibParam* param; + + while ( ( param = static_cast(nextManu()) ) ) + { + Int_t detElemId = param->ID0(); + Int_t manuId = param->ID1(); + + Int_t serialNumber + = AliMpManuStore::Instance()->GetManuSerial(detElemId, manuId); + + if (serialNumber<0) + { + AliErrorGeneral("ShowCapacitances",Form("Did not find serial for DE %04d MANUID %04d",detElemId,manuId)); + } + else + { + AliMUONVCalibParam* capa = static_cast(capacitances->FindObject(serialNumber)); + if (!capa) + { + AliErrorGeneral("ShowCapacitances",Form("Did not find capacitance for DE %04d MANUID %04d SERIAL %d",detElemId,manuId,serialNumber)); + } + } + } + +} + +//_____________________________________________________________________________ +void +AliMUONCDB::ShowConfig(Bool_t withStatusMap) +{ + /// Dumps the current tracker configuration, i.e. number and identity of missing buspatches + /// If statusMap is true, will also take into account the status map to report the number + /// of good channels + + if (!AliMUONCDB::CheckOCDB()) return; + + AliMUONCDB::LoadMapping(); + + if (!AliMUONCDB::CheckMapping()) return; + + AliCDBEntry* e = AliCDBManager::Instance()->Get("MUON/Calib/Config"); + + if (!e) return ; + + AliMUONVStore* config = static_cast(e->GetObject()); + + AliMUONPadStatusMapMaker* statusMapMaker(0x0); + AliMUONCalibrationData* cd(0x0); + AliMUONPadStatusMaker* statusMaker(0x0); + + if ( withStatusMap ) + { + cd = new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun()); + + statusMaker = new AliMUONPadStatusMaker(*cd); + + AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam(); + + if (!recoParam) + { + AliErrorGeneral("AliMUONCDB::ShowConfig","Cannot get recoParams from OCDB !"); + return; + } + + statusMaker->SetLimits(*recoParam); + + UInt_t mask = recoParam->PadGoodnessMask(); + + delete recoParam; + + const Bool_t deferredInitialization = kFALSE; + + statusMapMaker = new AliMUONPadStatusMapMaker(*cd,mask,deferredInitialization); + } + + TIter nextManu(config->CreateIterator()); + AliMUONVCalibParam* param; + + AliMpExMap buspatches; + + while ( ( param = static_cast(nextManu()) ) ) + { + Int_t detElemId = param->ID0(); + Int_t manuId = param->ID1(); + Int_t busPatchId = AliMpDDLStore::Instance()->GetBusPatchId(detElemId,manuId); + if ( buspatches.GetValue(busPatchId) == 0x0 ) + { + buspatches.Add(busPatchId,new TObjString(Form("BP%04d",busPatchId))); + } + } + + TArrayI removed(buspatches.GetSize()); + + TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator()); + AliMpBusPatch* bp; + Int_t n(0); + Int_t nok(0); + Int_t nremoved(0); + + // accounting of bus patches first + + while ( ( bp = static_cast(next()))) + { + if ( buspatches.GetValue(bp->GetId()) ) + { + ++nok; + } + else + { + removed.SetAt(bp->GetId(),nremoved++); + } + } + + // accounting of channels + + AliMpManuIterator it; + + Int_t totalNumberOfChannels(0); + Int_t removedChannels(0); + Int_t badChannels(0); + Int_t badAndRemovedChannels(0); + Int_t badOrRemovedChannels(0); + + Int_t detElemId, manuId; + + while ( it.Next(detElemId,manuId) ) + { + AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); + for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i ) + { + Int_t busPatchId = AliMpDDLStore::Instance()->GetBusPatchId(detElemId,manuId); + + if ( de->IsConnectedChannel(manuId,i) ) + { + ++totalNumberOfChannels; + Bool_t badBusPatch = ( buspatches.GetValue(busPatchId) == 0x0 ); + + if ( withStatusMap ) + { + Bool_t badChannel = ( ( statusMapMaker->StatusMap(detElemId,manuId,i) & AliMUONPadStatusMapMaker::SelfDeadMask() ) != 0); + if ( badChannel ) ++badChannels; + if ( badBusPatch && badChannel ) ++badAndRemovedChannels; + if ( badBusPatch || badChannel ) ++badOrRemovedChannels; + } + + if ( badBusPatch) ++removedChannels; + } + } + } + + + Int_t* indices = new Int_t[nremoved]; + + TMath::Sort(nremoved,removed.GetArray(),indices,kFALSE); + + for ( Int_t i = 0; i < nremoved; ++i ) + { + Int_t busPatchId = removed[indices[i]]; + bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId); + bp->Print(); + } + + delete[] indices; + + cout << endl; + cout << Form("Bus patches n=%3d nok=%3d nremoved=%3d",n,nok,nremoved) << endl; + + cout << Form("Channels n=%6d nremoved=%6d bad=%6d bad and removed=%6d bad or removed=%6d", + totalNumberOfChannels,removedChannels,badChannels,badAndRemovedChannels,badOrRemovedChannels) << endl; + + if (totalNumberOfChannels>0) + { + cout << Form("Percentage of readout channels %5.1f %%",removedChannels*100.0/totalNumberOfChannels) << endl; + if ( withStatusMap ) + { + cout << Form("Percentage of non useable channels (bad or removed) %5.1f %%", + badOrRemovedChannels*100.0/totalNumberOfChannels) << endl; + } + } + + + delete statusMapMaker; + delete cd; + delete statusMaker; +} + +//______________________________________________________________________________ +void AliMUONCDB::ReadIntegers(const char* filename, std::vector& integers) +{ + /// Read integers from filename, where integers are either + /// separated by "," or by return carriage + ifstream in(gSystem->ExpandPathName(filename)); + int i; + + std::set runset; + + char line[10000]; + + in.getline(line,10000,'\n'); + + TString sline(line); + + if (sline.Contains(",")) + { + TObjArray* a = sline.Tokenize(","); + TIter next(a); + TObjString* s; + while ( ( s = static_cast(next()) ) ) + { + runset.insert(s->String().Atoi()); + } + delete a; + } + else + { + runset.insert(sline.Atoi()); + + while ( in >> i ) + { + runset.insert(i); + } + } + + for ( std::set::const_iterator it = runset.begin(); it != runset.end(); ++it ) + { + integers.push_back((*it)); + } + + std::sort(integers.begin(),integers.end()); +} + +//______________________________________________________________________________ +void AliMUONCDB::ShowFaultyBusPatches(const char* runlist, double occLimit, + const char* outputBaseName, + const char* ocdbPath) +{ + /// Shows the list of bus patches above a given occupancy limit, + /// for each run in the runlist + + AliLog::GetRootLogger()->SetGlobalLogLevel(AliLog::kError); + + // AliLog::SetPrintType(AliLog::kInfo,kFALSE); + // AliLog::SetPrintType(AliLog::kWarning,kFALSE); + // gErrorIgnoreLevel=kError; // to avoid all the TAlienFile::Open messages... + + AliCDBManager* man = AliCDBManager::Instance(); + + man->SetDefaultStorage(ocdbPath); + + Bool_t first(kTRUE); + + std::vector runnumbers; + + ReadIntegers(runlist,runnumbers); + + AliMUON2DMap bpValues(kFALSE); + + std::ofstream outfile(Form("%s.txt",outputBaseName)); + + for ( unsigned int i = 0 ; i < runnumbers.size(); ++i ) + { + int runNumber = runnumbers[i]; + + man->SetRun(runNumber); + + if ( first ) + { + AliMpCDB::LoadAll(); + first = kFALSE; + } + + AliCDBEntry* e = man->Get("MUON/Calib/OccupancyMap",runNumber); + + if (!e) + { + AliErrorGeneral("AliMUONCDB::ShowFaultyBusPatches", + Form("Could not get OccupancyMap for run %09d",runNumber)); + continue; + } + + AliMUONVStore* occmap = static_cast(e->GetObject()); + + AliMUONTrackerData td("occ","occ",*occmap); + + TIter nextBP(AliMpDDLStore::Instance()->CreateBusPatchIterator()); + AliMpBusPatch* bp; + std::set buspatches; + Double_t sumn = 1000.0; + + while ( ( bp = static_cast(nextBP()) ) ) + { + Double_t occ = td.BusPatch(bp->GetId(),2); + + if (occ>occLimit) + { + buspatches.insert(bp->GetId()); + + AliMUONVCalibParam* param = static_cast(bpValues.FindObject(bp->GetId())); + + if (!param) + { + param = new AliMUONCalibParamND(5, 1, bp->GetId(), 0); + bpValues.Add(param); + + Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(bp->GetId()); + AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); + + Int_t nchannels(0); + + for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu ) + { + Int_t manuId = bp->GetManuId(imanu); + nchannels += de->NofChannelsInManu(manuId); + } + + param->SetValueAsDouble(0,2,sumn); + param->SetValueAsDouble(0,3,nchannels); + param->SetValueAsDouble(0,4,1); + } + + Double_t sumw = sumn*(param->ValueAsDouble(0)/sumn+1.0/runnumbers.size()); + Double_t sumw2 = 0.0; //(sumn-1)*ey*ey+sumw*sumw/sumn; + + param->SetValueAsDouble(0,0,sumw); + param->SetValueAsDouble(0,1,sumw2); + + } + } + + outfile << Form("RUN %09d",runNumber); + + for ( std::set::const_iterator bit = buspatches.begin(); bit != buspatches.end(); ++bit ) + { + outfile << Form(" %4d",*bit); + } + outfile << endl; + } + + outfile.close(); + + const char* name = "BPfailureRate"; + + AliMUONTrackerData* mpData = new AliMUONTrackerData(name,name,bpValues,2); + mpData->SetDimensionName(0,name); + + TFile f(Form("%s.root",outputBaseName),"recreate"); + mpData->Write(); + f.Close(); + + cout << Form("Results are in %s.txt and %s.root",outputBaseName,outputBaseName) << endl; + + gSystem->Exec(Form("cat %s.txt",outputBaseName)); + +} + +//______________________________________________________________________________ +void AliMUONCDB::CheckHV(Int_t runNumber, Int_t verbose) +{ + /// Check the HV values in OCDB for a given run + + TList messages; + messages.SetOwner(kTRUE); + + Bool_t patched(kTRUE); + + if (!AliCDBManager::Instance()->IsDefaultStorageSet()) + { + AliCDBManager::Instance()->SetDefaultStorage("raw://"); + } + + AliCDBManager::Instance()->SetRun(runNumber); + + LoadMapping(); + + AliMUONCalibrationData::CreateHV(runNumber,0,patched,&messages); + + AliMUONCalibrationData cd(runNumber,true); + + AliMUONPadStatusMaker statusMaker(cd); + + AliMUONRecoParam* rp = AliMUONCDB::LoadRecoParam(); + + if (!rp) + { + AliErrorGeneral("AliMUONCDB::CheckHV","Could not get RecoParam !!!"); + return; + } + + statusMaker.SetLimits(*rp); + + TIter next(&messages); + TObjString* s; + AliMpDCSNamer hvNamer("TRACKER"); + AliMUONLogger log; + + while ( ( s = static_cast(next()) ) ) + { + TObjArray* a = s->String().Tokenize(":"); + + TString name(static_cast(a->At(0))->String()); + + if ( name.Contains("sw") || name.Contains("SUMMARY") ) {delete a; continue;} + + Int_t index = hvNamer.DCSIndexFromDCSAlias(name.Data()); + + Int_t detElemId = hvNamer.DetElemIdFromDCSAlias(name.Data()); + + AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); + + if (!de) + { + AliErrorGeneral("AliMUONCDB::CheckHV",Form("Could not get detElemId from dcsAlias %s",name.Data())); + delete a; + continue; + } + + Int_t manuId; + + if ( index >= 0 ) + { + const AliMpArrayI* array = de->ManusForHV(index); + manuId = array->GetValue(0); + } + else + + { + AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(de->GetBusPatchId(0)); + + manuId = bp->GetManuId(0); + } + + Int_t status = statusMaker.HVStatus(detElemId,manuId); + + log.Log(AliMUONPadStatusMaker::AsString(status).Data()); + + s->String() += Form(" (DE %4d) ",detElemId); + s->String() += AliMUONPadStatusMaker::AsString(status).Data(); + + delete a; + } + + TIter nextMessage(&messages); + TObjString* msg; + + while ( ( msg = static_cast(nextMessage()) ) ) + { + if ( verbose > 0 || msg->String().Contains("SUMMARY") ) + { + AliInfoGeneral("AliMUONCDB::CheckHV",Form("RUN %09d HVchannel %s",runNumber,msg->String().Data())); + } + } + + TString lmsg; + Int_t occurance; + TString totalLog; + + while (log.Next(lmsg,occurance)) + { + totalLog += Form("%s(%d)",lmsg.Data(),occurance); + totalLog += " | "; + } + + AliInfoGeneral("AliMUONCDB::CheckHV",Form("RUN %09d %s",runNumber,totalLog.Data())); + + // one last loop to get the list of problematic HV channels + nextMessage.Reset(); + + while ( ( msg = static_cast(nextMessage()) ) ) + { + if ( msg->String().Contains("HV ") ) + { + AliInfoGeneral("AliMUONCDB::CheckHV",Form(" Problem at %s",msg->String().Data())); + } + } + + AliCDBManager::Instance()->ClearCache(); +} + +