+ 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<AliMUONVStore*>(e->GetObject());
+
+ e = AliCDBManager::Instance()->Get("MUON/Calib/Capacitances");
+
+ if (!e) return;
+
+ AliMUONVStore* capacitances = static_cast<AliMUONVStore*>(e->GetObject());
+
+ AliInfoGeneral("ShowCapacitances",Form("%d capacitances are in OCDB",capacitances->GetSize()));
+
+ TIter nextManu(config->CreateIterator());
+ AliMUONVCalibParam* param;
+
+ while ( ( param = static_cast<AliMUONVCalibParam*>(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<AliMUONVCalibParam*>(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<AliMUONVStore*>(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();
+
+ 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<AliMUONVCalibParam*>(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<AliMpBusPatch*>(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;