83 #include <Riostream.h> 91 #include <TObjString.h> 94 #include <TStopwatch.h> 97 #include <TGeoGlobalMagField.h> 98 #include <TClonesArray.h> 107 using std::ostringstream;
120 Float_t* xmin, Float_t* xmax)
126 for ( Int_t i = 0; i < dim; ++i )
135 while ( ( value = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
137 Int_t detElemId = value->
ID0();
138 Int_t manuId = value->ID1();
145 for ( Int_t manuChannel = 0; manuChannel < value->Size(); ++manuChannel )
150 for ( Int_t i = 0; i < dim; ++i )
152 Float_t x0 = value->ValueAsFloat(manuChannel,i);
154 xmin[i] = TMath::Min(xmin[i],x0);
155 xmax[i] = TMath::Max(xmax[i],x0);
160 for ( Int_t i = 0; i < dim; ++i )
162 if ( TMath::Abs(xmin[i]-xmax[i]) < 1E-3 )
171 Double_t GetRandom(Double_t mean, Double_t sigma, Bool_t mustBePositive)
174 if ( mustBePositive )
178 x = gRandom->Gaus(mean,sigma);
183 x = gRandom->Gaus(mean,sigma);
206 if (pathOnly)
return kTRUE;
222 messages.SetOwner(kTRUE);
224 Bool_t patched(kTRUE);
251 TIter next(&messages);
255 Double_t meanHVValue(0.0);
256 Double_t nofHVValues(0.0);
258 while ((s = static_cast<TObjString *>(next()))) {
259 TObjArray *a = s->String().Tokenize(
":");
261 TString name(static_cast<TObjString *>(a->At(0))->String());
265 name =
static_cast<TObjString *
>(b->At(0))->String();
270 if (name.Contains(
"sw") || name.Contains(
"SUMMARY")) {
continue; }
279 AliErrorGeneral(
"CheckHV", Form(
"Could not get detElemId from dcsAlias %s", name.Data()));
293 Int_t status = statusMaker.
HVStatus(detElemId, manuId);
301 s->String() += Form(
" (DE %4d) ", detElemId);
305 TIter nextMessage(&messages);
308 while ((msg = static_cast<TObjString *>(nextMessage()))) {
309 if (verbose > 0 || msg->String().Contains(
"SUMMARY")) {
310 AliInfoGeneral(
"CheckHV", Form(
"RUN %09d HVchannel %s", runNumber, msg->String().Data()));
318 while (log.
Next(lmsg, occurance)) {
319 totalLog += Form(
"%s(%d)", lmsg.Data(), occurance);
323 AliInfoGeneral(
"CheckHV", Form(
"RUN %09d %s", runNumber, totalLog.Data()));
328 while ((msg = static_cast<TObjString *>(nextMessage()))) {
329 if (msg->String().Contains(
"HV ")) {
330 AliInfoGeneral(
"CheckHV", Form(
" Problem at %s", msg->String().Data()));
335 meanHVValue /= nofHVValues;
336 AliInfoGeneral(
"CheckHV", Form(
"Mean HV for run %09d was %7.2f", runNumber, meanHVValue));
349 std::vector<int> runnumbers;
353 std::vector<int> affectedRuns;
355 for (
unsigned int i = 0; i < runnumbers.size(); ++i) {
360 std::cout << Form(
"RUN %09d is potentially affected by bug ALIROOT-6402 : %s", runNumber, affected ?
"YES" :
"NO")
364 affectedRuns.push_back(runNumber);
368 std::cout << Form(
"%4lu runs affected in the list of %4lu runs : ", affectedRuns.size(), runnumbers.size());
369 for (
unsigned int i = 0; i < affectedRuns.size(); ++i) {
370 std::cout << affectedRuns[i] <<
",";
372 std::cout << std::endl;
388 messages.SetOwner(kTRUE);
400 PatchHV(*hvMap, &messages, kTRUE);
403 TIter next(&messages);
405 while ((msg = static_cast<TObjString *>(next()))) {
406 std::cout << Form(
"RUN %09d %s", runNumber, msg->String().Data()) << std::endl;
411 TObjString *hvChannelName;
413 Bool_t affected(kFALSE);
415 while ((hvChannelName = static_cast<TObjString *>(next()))) {
416 TString name(hvChannelName->String());
419 if (hvvalue < 1590.0) {
422 std::cout << Form(
"RUN %09d %40s HV VALUE %7.2f", runNumber, name.Data(), hvvalue) << std::endl;
440 AliErrorGeneral(
"AliMUONCDB",
"Mapping segmentation must be loaded first");
445 if (segmentationOnly)
return kTRUE;
460 if (name.Contains(
"Chamber00Left")) {
461 if (name.Contains(
"Quad1Sect0")) isit = kTRUE;
463 if (name.Contains(
"Quad1Sect1")) isit = kTRUE;
464 if (name.Contains(
"Quad1Sect2")) isit = kTRUE;
466 if (name.Contains(
"Quad2Sect2")) isit = kTRUE;
467 if (name.Contains(
"Quad2Sect1")) isit = kTRUE;
468 if (name.Contains(
"Quad2Sect0")) isit = kTRUE;
469 }
else if (name.Contains(
"Chamber01Left")) {
470 if (name.Contains(
"Quad2Sect2")) isit = kTRUE;
471 if (name.Contains(
"Quad2Sect0")) isit = kTRUE;
490 if (TGeoGlobalMagField::Instance()->IsLocked())
delete TGeoGlobalMagField::Instance();
493 AliErrorGeneral(
"AliMUONCDB",
"failed to load magnetic field from OCDB");
514 if (segmentationOnly) {
517 AliErrorGeneral(
"AliMUONCDB",
"failed to load segmentation from OCDB");
550 if (!(recoParam = dynamic_cast<AliMUONRecoParam *>(entry->
GetObject()))) {
555 for (Int_t i = 0; i < recoParamArray->GetEntriesFast(); i++) {
556 recoParam =
static_cast<AliMUONRecoParam *
>(recoParamArray->UncheckedAt(i));
565 if (!recoParam)
AliErrorGeneral(
"AliMUONCDB",
"failed to load RecoParam from OCDB");
580 TClonesArray *alignmentArray = 0x0;
585 alignmentArray =
dynamic_cast<TClonesArray *
>(entry->
GetObject());
588 if (!alignmentArray) {
592 return alignmentArray;
610 if (!sopt.Contains(
"ABS") && !sopt.Contains(
"REL") && !sopt.Contains(
"PERCENT")) {
611 AliErrorGeneral(
"AliMUONCDB", Form(
"opt %s not supported. Only ABS, REL, PERCENT are", opt));
621 while ((param = dynamic_cast<AliMUONVCalibParam *>(next()))) {
622 Int_t detElemId = param->
ID0();
623 Int_t manuId = param->ID1();
628 cerr <<
"param2 is null : FIXME : this might happen !" << endl;
633 for (Int_t i = 0; i < param->Size(); ++i) {
634 for (Int_t j = 0; j < param->Dimension(); ++j) {
636 if (sopt.Contains(
"ABS")) {
637 value = param->ValueAsFloat(i, j) - param2->
ValueAsFloat(i, j);
638 }
else if (sopt.Contains(
"REL") || sopt.Contains(
"PERCENT")) {
639 if (param->ValueAsFloat(i, j)) {
640 value = (param->ValueAsFloat(i, j) - param2->
ValueAsFloat(i, j)) / param->ValueAsFloat(i, j);
644 if (sopt.Contains(
"PERCENT")) value *= 100.0;
646 param->SetValueAsFloat(i, j, value);
667 Int_t *nPerStation =
new Int_t[kNStations];
670 for (Int_t i = 0; i < kNStations; ++i) nPerStation[i] = 0;
672 while ((param = static_cast<AliMUONVCalibParam *>(next()))) {
674 Int_t dim = param->Dimension();
676 Float_t *xmin =
new Float_t[dim];
677 Float_t *xmax =
new Float_t[dim];
678 getBoundaries(store, dim, xmin, xmax);
680 for (Int_t i = 0; i < dim; ++i) {
681 h[i] =
new TH1F(Form(
"%s_%d", name, i), Form(
"%s_%d", name, i),
682 nbins, xmin[i], xmax[i]);
683 AliInfoGeneral(
"AliMUONCDB", Form(
"Created histogram %s", h[i]->GetName()));
689 Int_t detElemId = param->ID0();
690 Int_t manuId = param->ID1();
698 for (Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel) {
703 ++nPerStation[station];
705 for (Int_t dim = 0; dim < param->Dimension(); ++dim) {
706 h[dim]->Fill(param->ValueAsFloat(manuChannel, dim));
711 for (Int_t i = 0; i < kNStations; ++i) {
712 AliInfoGeneral(
"AliMUONCDB", Form(
"Station %d %d ", (i + 1), nPerStation[i]));
717 delete[] nPerStation;
733 double xmax = xmin + 3600;
735 int nbins = TMath::Nint((xmax - xmin) / timeResolution);
742 TF1 f1(
"f1",
"pol0", xmin, xmax);
744 while ((bp = static_cast<AliMpBusPatch *>(next()))) {
746 TH1 *h =
new TH1F(Form(
"BP%04d", bp->
GetId()), Form(
"Number of hits in %d s bins", timeResolution), nbins, xmin,
748 f1.SetParameter(0, bp->
GetId());
749 h->FillRandom(
"f1", 10000);
750 h->GetXaxis()->SetTimeDisplay(1);
751 h->GetXaxis()->SetTimeFormat(
"%d/%m/%y %H:%M");
752 h->GetXaxis()->SetTimeOffset(origin.Convert());
753 hc.
Adopt(Form(
"/BUSPATCH/HITS/%ds", timeResolution), h);
758 TH1 *h =
new TH1F(Form(
"Nevents%ds", timeResolution), Form(
"Number of events %d s bins", timeResolution), nbins, xmin,
761 f1.SetParameter(0, 4200);
763 h->FillRandom(
"f1", 10000);
765 h->GetXaxis()->SetTimeDisplay(1);
766 h->GetXaxis()->SetTimeFormat(
"%d/%m/%y %H:%M");
767 h->GetXaxis()->SetTimeOffset(origin.Convert());
771 return (total == 888);
789 for (Int_t i = 0; i < aliases->GetEntries(); ++i) {
790 TObjString *alias =
static_cast<TObjString *
>(aliases->At(i));
791 TString &aliasName = alias->String();
792 if (aliasName.Contains(
"sw")) {
795 valueSet->SetOwner(kTRUE);
797 Bool_t value = kTRUE;
799 if (!defaultValues) {
800 Float_t r = gRandom->Uniform();
801 if (r < 0.007) value = kFALSE;
804 for (UInt_t timeStamp = 0; timeStamp < 60 * 3; timeStamp += 60) {
806 valueSet->Add(dcsValue);
808 aliasMap.Add(
new TObjString(*alias), valueSet);
810 }
else if (aliasName.Contains(
"Mon")) {
812 valueSet->SetOwner(kTRUE);
813 for (UInt_t timeStamp = 0; timeStamp < 60 * 15; timeStamp += 120) {
814 Float_t value = 1500;
815 if (!defaultValues) value = GetRandom(1750, 62.5,
true);
817 valueSet->Add(dcsValue);
819 aliasMap.Add(
new TObjString(*alias), valueSet);
826 AliInfoGeneral(
"AliMUONCDB", Form(
"%d HV channels and %d switches", nChannels, nSwitch));
828 return nChannels + nSwitch;
843 Int_t npos(0), nneg(0), ndig(0);
845 for (Int_t i = 0; i < aliases->GetEntries(); ++i) {
846 TObjString *alias =
static_cast<TObjString *
>(aliases->At(i));
847 TString &aliasName = alias->String();
848 Float_t refValue = 0;
850 if (aliasName.Contains(
"anp")) {
853 }
else if (aliasName.Contains(
"dig")) {
856 }
else if (aliasName.Contains(
"ann")) {
866 valueSet->SetOwner(kTRUE);
868 Float_t value = refValue;
870 for (UInt_t timeStamp = 0; timeStamp < 60 * 15; timeStamp += 120) {
871 if (!defaultValues) value = GetRandom(refValue, 0.05,
false);
873 valueSet->Add(dcsValue);
875 aliasMap.Add(
new TObjString(*alias), valueSet);
878 Bool_t ok = (npos == nneg) && (npos == ndig) && (ndig == nneg);
881 AliErrorGeneral(
"AliMUONCDB", Form(
"Wrong number of LV channels : npos=%d nneg=%d ndig=%d", npos, nneg, ndig));
883 AliInfoGeneral(
"AliMUONCDB", Form(
"%d LV groups - %d aliases", npos, aliasMap.GetEntries()));
892 void AddDCSValue(TMap &aliasMap, Int_t imeas,
const char *smt,
const char *sInOut, Int_t rpc, Float_t value)
895 TString alias = Form(
"MTR_%s_%s_RPC%i_%s", sInOut, smt, rpc, sMeasure.Data());
897 valueSet->SetOwner(kTRUE);
899 for (UInt_t timeStamp = 0; timeStamp < 60 * 2; timeStamp += 60) {
901 valueSet->Add(dcsValue);
904 aliasMap.Add(
new TObjString(alias), valueSet);
915 Int_t nChannels[2] = {0, 0};
999 TString chName[4] = {
"MT11",
"MT12",
"MT21",
"MT22"};
1001 for (Int_t ich = 0; ich < 4; ich++) {
1002 for (Int_t iside = 0; iside < 2; iside++) {
1003 TString sInOut = (iside == 0) ?
"INSIDE" :
"OUTSIDE";
1004 for (Int_t irpc = 1; irpc <= 9; irpc++) {
1011 AliInfoGeneral(
"AliMUONCDB", Form(
"Trigger channels I -> %i HV -> %i", nChannels[0], nChannels[1]));
1013 return nChannels[0] + nChannels[1];
1034 const Float_t kPedestalMeanMeanB(200.);
1035 const Float_t kPedestalMeanSigmaB(10.);
1036 const Float_t kPedestalSigmaMeanB(1.);
1037 const Float_t kPedestalSigmaSigmaB(0.2);
1040 const Float_t kPedestalMeanMeanNB(200.);
1041 const Float_t kPedestalMeanSigmaNB(10.);
1042 const Float_t kPedestalSigmaMeanNB(1.);
1043 const Float_t kPedestalSigmaSigmaNB(0.2);
1045 const Float_t kFractionOfDeadManu(0.);
1052 while (it.
Next(detElemId, manuId)) {
1054 if (kFractionOfDeadManu > 0. && gRandom->Uniform() < kFractionOfDeadManu)
continue;
1063 for (Int_t manuChannel = 0; manuChannel < kChannels; ++manuChannel) {
1068 Float_t meanPedestal;
1069 Float_t sigmaPedestal;
1071 if (defaultValues) {
1073 sigmaPedestal = 1.0;
1075 Bool_t positive(kTRUE);
1080 while (meanPedestal == 0.0)
1082 meanPedestal = GetRandom(kPedestalMeanMeanNB, kPedestalMeanSigmaNB, positive);
1084 sigmaPedestal = GetRandom(kPedestalSigmaMeanNB, kPedestalSigmaSigmaNB, positive);
1088 while (meanPedestal == 0.0)
1090 meanPedestal = GetRandom(kPedestalMeanMeanB, kPedestalMeanSigmaB, positive);
1092 sigmaPedestal = GetRandom(kPedestalSigmaMeanB, kPedestalSigmaSigmaB, positive);
1102 Bool_t ok = pedestalStore.
Add(ped);
1104 AliErrorGeneral(
"AliMUONCDB", Form(
"Could not set DetElemId=%d manuId=%d", detElemId, manuId));
1108 AliInfoGeneral(
"AliMUONCDB", Form(
"%d Manus and %d channels.", nmanus, nchannels));
1122 if (!defaultValues) {
1148 Int_t nevents(1000);
1150 while (it.
Next(detElemId, manuId)) {
1161 if (!defaultValues) occ = gRandom->Rndm(1);
1163 Double_t sumn = occ * nevents;
1171 Bool_t ok = occupancyMapStore.
Add(occupancy);
1173 AliErrorGeneral(
"AliMUONCDB", Form(
"Could not set DetElemId=%d manuId=%d", detElemId, manuId));
1188 Int_t ngenerated(0);
1193 for (Int_t x = 0; x < 2; ++x) {
1194 for (Int_t y = 0; y < 4; ++y) {
1195 Int_t index = x * 4 + y;
1200 localBoardMasks.
Add(localBoard);
1214 AliErrorGeneral(
"AliMUONCDB",
"Error when reading from mapping file");
1259 void PatchHV(TMap &hvMap, TList *messages, Bool_t onlySt1remapped)
1262 TObjString *hvChannelName;
1264 while ((hvChannelName = static_cast<TObjString *>(next()))) {
1265 TString name(hvChannelName->String());
1267 if (name.Contains(
"sw"))
continue;
1269 if (name.Contains(
"iMon"))
continue;
1271 if (onlySt1remapped) {
1277 TPair *hvPair =
static_cast<TPair *
>(hvMap.FindObject(name.Data()));
1280 AliErrorGeneral(
"PatchHV", Form(
"Could not get values for alias %s", name.Data()));
1287 messages->Add(
new TObjString(Form(
"%s %s", hvChannelName->String().Data(), msg.Data())));
1291 AliErrorGeneral(
"PatchHV", Form(
"PatchHVValue was not successfull ! This is serious ! " 1292 "You'll have to check the logic for channel %s",
1293 hvChannelName->String().Data()));
1303 Int_t startRun, Int_t endRun,
1304 const char *filename)
1308 TString
comment(gSystem->ExpandPathName(filename));
1316 Int_t startRun, Int_t endRun, Bool_t defaultValues)
1321 if (defaultValues) comment +=
"Test with default values";
1322 else comment +=
"Test with random values";
1324 WriteToCDB(
object, calibpath, startRun, endRun, comment.Data());
1329 WriteToCDB(TObject *
object,
const char *calibpath, Int_t startRun, Int_t endRun,
1330 const char *
comment,
const char *responsible)
1336 AliCDBId id(calibpath, startRun, endRun);
1352 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1353 if (ngenerated > 0) {
1354 WriteToCDB(
"MUON/Calib/LocalTriggerBoardMasks", ltm, startRun, endRun,
true);
1367 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1368 if (ngenerated > 0) {
1369 WriteToCDB(
"MUON/Calib/RegionalTriggerConfig", rtm, startRun, endRun,
true);
1384 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1385 if (ngenerated > 0) {
1386 WriteToCDB(
"MUON/Calib/GlobalTriggerCrateConfig", gtm, startRun, endRun,
true);
1400 WriteToCDB(
"MUON/Calib/TriggerLut", lut, startRun, endRun,
true);
1413 WriteToCDB(
"MUON/Calib/TriggerEfficiency", eff, startRun, endRun,
true);
1426 TFile *
f =
TFile::Open(gSystem->ExpandPathName(inputFile));
1428 if (!f->IsOpen())
return;
1430 TMap *hvStore =
static_cast<TMap *
>(f->Get(
"map"));
1432 WriteToCDB(
"MUON/Calib/HV", hvStore, runNumber, runNumber, kFALSE);
1440 Int_t startRun, Int_t endRun)
1447 TMap *hvStore =
new TMap;
1448 Int_t ngenerated =
MakeHVStore(*hvStore, defaultValues);
1449 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1450 if (ngenerated > 0) {
1451 WriteToCDB(
"MUON/Calib/HV", hvStore, startRun, endRun, defaultValues);
1459 Int_t startRun, Int_t endRun,
1467 TMap *lvStore =
new TMap;
1468 Int_t ngenerated =
MakeLVStore(*lvStore, defaultValues, refTime);
1469 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1470 if (ngenerated > 0) {
1471 WriteToCDB(
"MUON/Calib/LV", lvStore, startRun, endRun, defaultValues);
1484 TMap *triggerDCSStore =
new TMap;
1486 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1487 if (ngenerated > 0) {
1488 WriteToCDB(
"MUON/Calib/TriggerDCS", triggerDCSStore, startRun, endRun,
true);
1490 delete triggerDCSStore;
1496 Int_t startRun, Int_t endRun)
1505 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1506 WriteToCDB(
"MUON/Calib/Pedestals", pedestalStore, startRun, endRun, defaultValues);
1507 delete pedestalStore;
1513 Int_t startRun, Int_t endRun)
1522 AliInfoGeneral(
"AliMUONCDB", Form(
"Ngenerated = %d", ngenerated));
1523 WriteToCDB(
"MUON/Calib/OccupancyMap", occupancyMapStore, startRun, endRun, defaultValues);
1524 delete occupancyMapStore;
1530 Int_t startRun, Int_t endRun)
1538 WriteToCDB(
"MUON/Calib/RejectList", rl, startRun, endRun, defaultValues);
1545 gSystem->Setenv(
"MINSTALL", gSystem->ExpandPathName(
"$ALICE_ROOT/MUON/mapping"));
1568 ostringstream lines;
1571 while ((bp = static_cast<AliMpBusPatch *>(next()))) {
1572 for (Int_t imanu = 0; imanu < bp->
GetNofManus(); ++imanu) {
1581 WriteToCDB(
"MUON/Calib/Config", &config, startRun, endRun, kTRUE);
1593 WriteToCDB(
"MUON/Calib/BPEVO", &bpevo, startRun, endRun, kTRUE);
1603 WriteHV(defaultValues, startRun, endRun);
1604 WriteLV(defaultValues, startRun, endRun);
1636 if (withStatusMap) {
1654 const Bool_t deferredInitialization = kFALSE;
1664 while ((param = static_cast<AliMUONVCalibParam *>(nextManu()))) {
1665 Int_t detElemId = param->ID0();
1666 Int_t manuId = param->ID1();
1668 if (buspatches.
GetValue(busPatchId) == 0x0) {
1669 buspatches.
Add(busPatchId,
new TObjString(Form(
"BP%04d", busPatchId)));
1673 TArrayI removed(buspatches.
GetSize());
1683 while ((bp = static_cast<AliMpBusPatch *>(next()))) {
1687 removed.SetAt(bp->
GetId(), nremoved++);
1695 Int_t totalNumberOfChannels(0);
1696 Int_t removedChannels(0);
1697 Int_t badChannels(0);
1698 Int_t badAndRemovedChannels(0);
1699 Int_t badOrRemovedChannels(0);
1701 Int_t detElemId, manuId;
1703 while (it.
Next(detElemId, manuId)) {
1709 ++totalNumberOfChannels;
1710 Bool_t badBusPatch = (buspatches.
GetValue(busPatchId) == 0x0);
1712 if (withStatusMap) {
1713 Bool_t badChannel = (
1715 if (badChannel) ++badChannels;
1716 if (badBusPatch && badChannel) ++badAndRemovedChannels;
1717 if (badBusPatch || badChannel) ++badOrRemovedChannels;
1720 if (badBusPatch) ++removedChannels;
1725 Int_t *indices =
new Int_t[nremoved];
1727 TMath::Sort(nremoved, removed.GetArray(), indices, kFALSE);
1729 for (Int_t i = 0; i < nremoved; ++i) {
1730 Int_t busPatchId = removed[indices[i]];
1738 cout << Form(
"Bus patches n=%3d nok=%3d nremoved=%3d", n, nok, nremoved) << endl;
1740 cout << Form(
"Channels n=%6d nremoved=%6d bad=%6d bad and removed=%6d bad or removed=%6d",
1741 totalNumberOfChannels, removedChannels, badChannels, badAndRemovedChannels, badOrRemovedChannels)
1744 if (totalNumberOfChannels > 0) {
1745 cout << Form(
"Percentage of readout channels %5.1f %%", removedChannels * 100.0 / totalNumberOfChannels) << endl;
1746 if (withStatusMap) {
1747 cout << Form(
"Percentage of non useable channels (bad or removed) %5.1f %%",
1748 badOrRemovedChannels * 100.0 / totalNumberOfChannels) << endl;
1752 delete statusMapMaker;
1762 ifstream in(gSystem->ExpandPathName(filename));
1765 std::set<int> runset;
1769 in.getline(line, 10000,
'\n');
1771 TString sline(line);
1773 if (sline.Contains(
",")) {
1777 while ((s = static_cast<TObjString *>(next()))) {
1778 runset.insert(s->String().Atoi());
1782 runset.insert(sline.Atoi());
1789 for (std::set<int>::const_iterator it = runset.begin(); it != runset.end(); ++it) {
1790 integers.push_back((*it));
1793 std::sort(integers.begin(), integers.end());
1797 void GetBusPatchIdAndNofChannels(std::vector<int> &busPatchIds, std::vector<int> &busPatchNofChannels)
1799 busPatchIds.clear();
1800 busPatchNofChannels.clear();
1805 while ((bp = static_cast<AliMpBusPatch *>(nextBP()))) {
1806 busPatchIds.push_back(bp->
GetId());
1809 std::sort(busPatchIds.begin(),busPatchIds.end());
1811 for (
int i = 0; i < busPatchIds.size(); ++i ) {
1813 int bpid = busPatchIds[i];
1817 int bpnofchannels = 0;
1826 busPatchNofChannels.push_back(bpnofchannels);
1829 int totalNofChannels = 0;
1831 for (
int i = 0 ; i < busPatchIds.size(); ++i ) {
1832 totalNofChannels += busPatchNofChannels[i];
1835 assert(totalNofChannels==1064008);
1838 std::set<int> GetConfig(
int runNumber) {
1840 std::set<int> buspatches;
1849 while ( ( param = static_cast<AliMUONVCalibParam*>(next()))) {
1861 double fractionLimit,
1864 double outputFractionLimit,
1865 const char *outputBaseName,
1866 const char *ocdbPath)
1881 std::vector<int> runnumbers;
1885 if (runnumbers.empty()) {
1886 std::cout <<
"empty runlist. Bailing out\n";
1890 man->
SetRun(runnumbers[0]);
1894 std::vector<int> busPatchIds;
1895 std::vector<int> busPatchNofChannels;
1897 GetBusPatchIdAndNofChannels(busPatchIds,busPatchNofChannels);
1899 std::vector<int> busPatchInConfig(busPatchIds.size());
1900 std::vector<int> busPatchNotOK(busPatchIds.size());
1902 for (
int i = 0; i < runnumbers.size(); ++i ) {
1908 std::set<int> buspatches = GetConfig(runNumber);
1914 Form(
"Could not get Pedestals for run %09d", runNumber));
1920 for (
int i = 0; i < busPatchIds.size(); ++i ) {
1928 if (buspatches.find(busPatchIds[i]) != buspatches.end() ) {
1929 busPatchInConfig[i]++;
1944 for (
int c = 0; c < nofchannels; ++c) {
1947 if (mean >= meanLimit || sigma >= sigmaLimit) {
1953 if (nbad / busPatchNofChannels[i] > fractionLimit) {
1959 std::ofstream outfile(Form(
"%s.txt", outputBaseName));
1960 for (
int i = 0; i < busPatchIds.size(); ++i ) {
1961 if ( busPatchNotOK[i]) {
1962 float fraction = 1.0*busPatchNotOK[i]/busPatchInConfig[i];
1963 if (fraction>outputFractionLimit) {
1964 outfile << Form(
"BP %04d is bad for %3d runs in %3d (%7.2f%%)\n",
1965 busPatchIds[i], busPatchNotOK[i], busPatchInConfig[i],
1975 const char* outputBaseName,
1976 const char* ocdbPath)
1991 Bool_t first(kTRUE);
1993 std::vector<int> runnumbers;
1999 std::ofstream outfile(Form(
"%s.txt",outputBaseName));
2001 for (
unsigned int i = 0 ; i < runnumbers.size(); ++i )
2018 Form(
"Could not get OccupancyMap for run %09d",runNumber));
2028 std::set<int> buspatches;
2029 Double_t sumn = 1000.0;
2031 while ( ( bp = static_cast<AliMpBusPatch*>(nextBP()) ) )
2037 buspatches.insert(bp->
GetId());
2044 bpValues.
Add(param);
2051 for ( Int_t imanu = 0; imanu < bp->
GetNofManus(); ++imanu )
2062 Double_t sumw = sumn*(param->
ValueAsDouble(0)/sumn+1.0/runnumbers.size());
2063 Double_t sumw2 = 0.0;
2071 outfile << Form(
"RUN %09d",runNumber);
2073 for ( std::set<int>::const_iterator bit = buspatches.begin(); bit != buspatches.end(); ++bit )
2075 outfile << Form(
" %4d",*bit);
2082 if ( bpValues.
GetSize() == 0 )
2084 cout << Form(
"Great. No faulty bus patch (at the %g occupancy limit) found.",occLimit) << endl;
2085 gSystem->Exec(Form(
"rm %s.txt",outputBaseName));
2089 const char* name =
"BPfailureRate";
2094 TFile
f(Form(
"%s.root",outputBaseName),
"recreate");
2098 cout << Form(
"Results are in %s.txt and %s.root",outputBaseName,outputBaseName) << endl;
2100 gSystem->Exec(Form(
"cat %s.txt",outputBaseName));
2108 TPair* hvPair =
static_cast<TPair*
>(hvMap.FindObject(hvChannel));
2111 AliErrorGeneral(
"MeanHVValueForDCSAlias",Form(
"Did not find expected alias (%s)",hvChannel));
2119 AliErrorGeneral(
"MeanHVValueForDCSAlias",Form(
"Could not get values for alias %s",hvChannel));
2130 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
Int_t GetNofManus() const
Convert a pad status container into a pad status map container.
virtual TIterator * CreateIterator() const =0
Return an iterator to loop over the whole store.
Implementation of AliMUONVTrackerData.
#define AliCodeTimerAutoGeneral(message, counter)
TFile * Open(const char *filename, Long64_t &nevents)
The class defines the configuration of global crate.
static Float_t InvalidFloatValue()
Return 1E38 as invalid float value.
Bool_t CheckOCDB(Bool_t pathOnly)
Int_t MakeBusPatchEvolution(AliMergeableCollection &hc, int timeResolution)
AliMUONRejectList * MakeRejectListStore(Bool_t defaultValues)
void WriteLocalTriggerMasks(Int_t startRun, Int_t endRun)
static AliMpDEStore * Instance(Bool_t warn=true)
static Bool_t WriteMpData()
static void SetGlobalLogLevel(EType_t type)
static TString AsString(Int_t status)
static AliMpSegmentation * Instance(Bool_t warn=true)
virtual Float_t ValueAsFloat(Int_t i, Int_t j=0) const =0
TMap * HV(Bool_t patched=kTRUE) const
Get the HV values. Use patched=kFALSE to get unprocessed (i.e. "raw") values as they are in the OCDB...
Implementation of AliMUONVCalibParam for tuples of floats.
Bool_t IsSt1DCSAliasRemapped(const TString &name)
void CheckHV_ALIROOT_6402(const char *runlist, Bool_t verbose)
#define AliErrorGeneral(scope, message)
virtual void SetValueAsFloat(Int_t i, Int_t j, Float_t value)=0
Set one value, for channel i, dimension j. Consider value is a float.
TClonesArray * LoadAlignmentData()
virtual Double_t BusPatch(Int_t busPatchId, Int_t dim=0) const
Get the value for a given buspatch and given dimension.
Int_t MakeLVStore(TMap &aliasMap, Bool_t defaultValues, time_t refTime)
Int_t Log(const char *message)
Int_t GetNofTriggerCrates() const
Bool_t Adopt(TObject *obj)
static Bool_t WriteMpRunData()
Int_t GetDEfromBus(Int_t busPatchId) const
Store and give access to the trigger chamber efficiency.
void WriteTrigger(Bool_t defaultValues, Int_t startRun, Int_t endRun)
Collection of methods usefull to DCS handling for MUON TRK and TRG.
void WriteTriggerDCS(Int_t startRun, Int_t endRun)
Int_t MakePedestalStore(AliMUONVStore &pedestalStore, Bool_t defaultValues)
const AliMpVSegmentation * GetMpSegmentationByElectronics(Int_t detElemId, Int_t elCardID, Bool_t warn=true) const
virtual void SetDimensionName(Int_t index, const char *value)
Set the name of a given dimension.
static Int_t DecodeConfig(const char *data, AliMUONVStore &confStore)
Helper functions to experience the OCDB.
AliMUONTriggerLut * MakeTriggerLUT(const char *file)
Int_t MakeLocalTriggerMaskStore(AliMUONVStore &localBoardMasks)
virtual void SetValueAsInt(Int_t i, Int_t j, Int_t value)=0
Set one value, for channel i, dimension j. Consider value is an integer.
Class with MUON reconstruction parameters.
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
virtual Double_t ValueAsDouble(Int_t i, Int_t j=0) const
Int_t GetManuId(Int_t index) const
static AliMpManuStore * Instance(Bool_t warn=true)
void ShowFaultyPedestalsBusPatches(const char *runlist, double fractionLimit, double meanLimit, double sigmaLimit, double outputFractionLimit, const char *outputBaseName, const char *ocdbPath)
Bool_t LoadMapping(Bool_t segmentationOnly)
The class defines the electronics properties of detection element.
void CheckHV(Int_t runNumber, Int_t verbose)
Int_t MakeTriggerDCSStore(TMap &aliasMap)
void PatchHV(TMap &hvMap, TList *messages, Bool_t onlySt1remapped)
Bool_t Next(TString &msg, Int_t &occurance)
static AliLog * GetRootLogger()
void WriteOccupancyMap(Bool_t defaultValues, Int_t startRun, Int_t endRun)
void WriteHV(const char *inputFile, Int_t runNumber)
void WritePedestals(Bool_t defaultValues, Int_t startRun, Int_t endRun)
Bool_t Next(Int_t &detElemId, Int_t &manuId)
Class to loop over all manus of MUON Tracker.
AliCDBEntry * Get(const AliCDBId &query, Bool_t forceCaching=kFALSE)
AliMUONVStore * Diff(AliMUONVStore &store1, AliMUONVStore &store2, const char *opt)
static TString LocalTriggerBoardMapping()
void SetDetectionElementProbability(Int_t detElemId, Float_t proba=1.0)
A logger that keeps track of the number of times a message appeared.
void WriteRegionalTriggerConfig(Int_t startRun, Int_t endRun)
void AddDCSValue(TMap &aliasMap, Int_t imeas, const char *smt, const char *sInOut, Int_t rpc, Float_t value)
Container of calibration values for a given number of channels.
static AliMpDDLStore * Instance(Bool_t warn=true)
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
AliMUONVStore * StatusMap() const
static Int_t ManuNofChannels()
Max number of channels per manu.
void WriteBPEVO(Int_t startRun, Int_t endRun)
void ReadFromFile(const char *filename)
Int_t GetBusPatchId(Int_t detElemId, Int_t manuId) const
virtual TObject * FindObject(Int_t i, Int_t j) const
Find an object using 2 ids.
Implementation of AliMUONVCalibParam for tuples of ints.
void ShowFaultyBusPatches(const char *runlist, double occLimit, const char *outputBaseName, const char *ocdbPath)
Int_t MakeRegionalTriggerConfigStore(AliMUONRegionalTriggerConfig &rtm)
void WriteTriggerEfficiency(Int_t startRun, Int_t endRun)
Int_t MakeHVStore(TMap &aliasMap, Bool_t defaultValues)
virtual Int_t ID0() const
First id of this object.
static Bool_t PatchHVValues(TObjArray &values, TString *msg=0x0, Bool_t dryRun=kFALSE)
Implementation of AliMUONVCalibParam for tuples of double.
AliMpBusPatch * GetBusPatch(Int_t busPatchId, Bool_t warn=true) const
TObject * GetValue(Int_t keyFirst, Int_t keySecond) const
Int_t GetId() const
Return the unique Id.
Int_t DCSIndexFromDCSAlias(const char *dcsAlias) const
Bool_t Put(TObject *object, const AliCDBId &id, AliCDBMetaData *metaData, const char *mirrors="", DataType type=kPrivate)
static Int_t TotalNofLocalBoards()
Return total number of trigger local boards.
Int_t MakeGlobalTriggerConfigStore(AliMUONGlobalCrateConfig >m)
void Add(Int_t keyFirst, Int_t keySecond, TObject *object)
Helper class for sorted integer array.
Implementation of AliMUONVStore.
static Int_t SelfDeadMask()
Return status bit map to tell a pad is bad.
Int_t NofChannelsInManu(Int_t manuId) const
void WriteMapping(Int_t startRun, Int_t endRun)
Basic implementation of AliMUONVStore container using AliMpExMap internally.
void SetDefaultStorage(const char *dbString)
void WriteLV(Bool_t defaultValues, Int_t startRun, Int_t endRun, time_t refTime)
Bool_t IsValid() const
Return validity.
virtual Bool_t Add(TObject *object)=0
Add an object to the store.
The class defines the properties of BusPatch.
void WriteToCDB(const char *calibpath, TObject *object, Int_t startRun, Int_t endRun, const char *filename)
Single entry point to access MUON calibration data.
AliMUONTriggerEfficiencyCells * MakeTriggerEfficiency(const char *file)
TH1 ** Plot(const AliMUONVStore &store, const char *name, Int_t nbins)
virtual Bool_t Add(TObject *object)
Add an object to the store.
void WriteGlobalTriggerConfig(Int_t startRun, Int_t endRun)
The abstract base class for the segmentation.
Int_t MakeOccupancyMapStore(AliMUONVStore &occupancyMapStore, Bool_t defaultValues)
static TObject * CreateObject(Int_t runNumber, const char *path, Int_t *startOfValidity=0x0)
#define AliInfoGeneral(scope, message)
Int_t GetBusPatchId(Int_t index) const
void WriteConfig(Int_t startRun, Int_t endRun)
static TString GlobalTriggerBoardMapping()
void WriteTriggerLut(Int_t startRun, Int_t endRun)
TObjArray * GenerateAliases(const char *pattern="") const
Object to hold the list of elements we want to reject from the reconstruction.
void ReadIntegers(const char *filename, std::vector< int > &integers)
Class which encapsuate all information about a pad.
Int_t HVStatus(Int_t detElemId, Int_t manuId) const
static TMap * CreateHV(Int_t runNumber, Int_t *startOfValidity=0, Bool_t patched=kTRUE, TList *messages=0x0, Bool_t dryRun=kFALSE)
Create a hv map (which must be deleted) from OCDB for the given run.
const AliMpArrayI * ManusForHV(Int_t hvIndex) const
Bool_t CheckMapping(Bool_t segmentationOnly)
Double_t MeanHVValueForDCSAlias(TMap &hvMap, const char *hvChannel)
UInt_t PadGoodnessMask() const
Get the goodness mask.
Int_t GetValue(Int_t index) const
Bool_t IsConnectedChannel(Int_t manuId, Int_t manuChannel) const
void WriteTracker(Bool_t defaultValues, Int_t startRun, Int_t endRun)
void ShowConfig(Bool_t withStatusMap)
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning=true) const =0
Find pad by location.
Int_t DetElemIdFromDCSAlias(const char *dcsAlias) const
void WriteRejectList(Bool_t defaultValues, Int_t startRun, Int_t endRun)
Base class for MUON data stores.
Bool_t IsDefaultStorageSet() const
static Bool_t LoadAll(Bool_t warn=false)
Int_t ReadData(const TString &fileName="")
virtual Int_t GetSize() const
The number of objects stored.
MUON trigger look up table class.
static Bool_t LoadMpSegmentation(Bool_t warn=false)
Int_t ReadData(const TString &fileName="")
static Int_t NofTrackingChambers()
Return number of tracking chambers.
The class defines the properties of regional trigger crate.
Make a 2DStore of pad statuses, using different sources of information.
virtual TObject * FindObject(const char *name) const
Find an object by name.
Helper class making Root persistent TExMap.
static Int_t ManuMask(AliMp::PlaneType planeType)
AliMUONRecoParam * LoadRecoParam()
virtual void SetValueAsDouble(Int_t i, Int_t j, Double_t value)
void SetLimits(const AliMUONRecoParam &recoParams)
virtual void Print(Option_t *opt="") const