14     local_logger = logging.getLogger(
'AthenaMonitoringCfg')
 
   15     info = local_logger.info
 
   16     info(
'SCTErrMonAlgConfig')
 
   18     from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
   21     from IOVDbSvc.IOVDbSvcConfig 
import addFolders
 
   22     if flags.Common.isOnline:
 
   23         result.merge(
addFolders(flags,
'/TDAQ/RunCtrl/DataTakingMode',
'TDAQ',className=
'AthenaAttributeList'))
 
   24         info(
'SCTErrMonAlgConfig: added DATA COOL folders')
 
   26     from AthenaMonitoring 
import AthMonitorCfgHelper
 
   27     helper = AthMonitorCfgHelper(flags, 
'SCTErrMonCfg')
 
   29     from AthenaConfiguration.ComponentFactory 
import CompFactory
 
   30     myMonAlg = helper.addAlgorithm(CompFactory.SCTErrMonAlg, 
'SCTErrMonAlg')
 
   31     myMonAlg.TriggerChain = 
"" 
   33     from SCT_ConditionsTools.SCT_ConditionsToolsConfig 
import SCT_ConditionsSummaryToolCfg
 
   34     myMonAlg.SCT_ConditionsSummaryTool = result.popToolsAndMerge(
 
   38     myMonAlg.UseDCS = flags.InDet.useDCS
 
   40     myMonAlg.doOnlineMon = flags.Common.isOnline
 
   42     from LumiBlockComps.BunchCrossingCondAlgConfig 
import BunchCrossingCondAlgCfg
 
   45     myMonGroup = helper.addGroup(myMonAlg, 
"SCTErrMonitor", 
"SCT/")
 
   49     from ROOT 
import SCT_Monitoring 
as sctMon  
 
   52     myMonGroup.defineHistogram(varname=
"lumiBlock;NumberOfEventsVsLB",
 
   55                                title=
"Num of events per LB ;LumiBlock",
 
   57                                xbins=sctMon.NBINS_LBs,
 
   59                                xmax=sctMon.NBINS_LBs+0.5,
 
   63     myMonGroup.defineHistogram(varname=
"lumiBlock;NumberOfSCTFlagErrorsVsLB",
 
   66                                title=
"Num of SCT Flag errors per LB ;LumiBlock",
 
   68                                xbins=sctMon.NBINS_LBs,
 
   70                                xmax=sctMon.NBINS_LBs+0.5,
 
   74     myMonGroup.defineHistogram(varname=
"lumiBlock, sctFlag;FractionOfSCTFlagErrorsPerLB",
 
   76                                title=
"Frac of SCT Flag errors per LB ;LumiBlock",
 
   78                                xbins=sctMon.NBINS_LBs,
 
   80                                xmax=sctMon.NBINS_LBs+0.5,
 
   84     myMonGroup.defineHistogram(varname=
"detailedConfBin, nBad;SCTConfDetails",
 
   86                                title=
"Exclusion from the Configuration",
 
   88                                xbins=sctMon.ConfbinsDetailed,
 
   90                                xmax=sctMon.ConfbinsDetailed-0.5,
 
   91                                xlabels=[
"Modules", 
"Link 0", 
"Link 1",
 
   92                                         "Chips", 
"Strips (10^{2})"],
 
   96     myMonGroup.defineHistogram(varname=
"moduleOutBin, moduleOut;SCTConfOutM",
 
   98                                title=
"Num of Out Modules in All Region",
 
  107     from ROOT 
import SCT_ByteStreamErrors
 
  108     for i 
in range(SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES):
 
  109         myMonGroup.defineHistogram(
 
  110             varname=
"lumiBlock, n_" +
 
  111             SCT_ByteStreamErrors.ErrorTypeDescription[i] +
 
  113             SCT_ByteStreamErrors.ErrorTypeDescription[i] +
 
  117             SCT_ByteStreamErrors.ErrorTypeDescription[i] +
 
  118             " per LB in All Region;LumiBlock;Num of " +
 
  119             SCT_ByteStreamErrors.ErrorTypeDescription[i],
 
  121             xbins=sctMon.NBINS_LBs,
 
  123             xmax=sctMon.NBINS_LBs+0.5,
 
  127     for i 
in range(sctMon.N_ERRCATEGORY):
 
  128         myMonGroup.defineHistogram(
 
  129             varname=
"lumiBlock, n_" +
 
  130             sctMon.CategoryErrorsNames[i]+
";SCT_LinksWith" +
 
  131             sctMon.CategoryErrorsNames[i]+
"VsLbs",
 
  133             title=
"Ave. Num of Links with " +
 
  134             sctMon.CategoryErrorsNames[i] +
 
  135             " per LB in All Region;LumiBlock;Num of Links with " +
 
  136             sctMon.CategoryErrorsNames[i],
 
  138             xbins=sctMon.NBINS_LBs,
 
  140             xmax=sctMon.NBINS_LBs+0.5,
 
  144     for errCate 
in range(sctMon.N_ERRCATEGORY):
 
  145         for region 
in range(sctMon.N_REGIONS):
 
  146             for layer 
in range(sctMon.N_ENDCAPSx2):
 
  147                 myMonGroup.defineHistogram(
 
  148                     varname=
"eta, phi, hasError_" +
 
  149                     sctMon.CategoryErrorsNames[errCate]+
"_" +
 
  150                     sctMon.subDetNameShort[region].Data()+
"_" +
 
  151                     str(layer//2)+
"_"+
str(layer % 2) +
 
  152                     ";SCT_NumberOf"+sctMon.CategoryErrorsNames[errCate] +
 
  153                     sctMon.subDetNameShort[region].Data()+
"_" +
 
  154                     str(layer//2)+
"_"+
str(layer % 2),
 
  157                     sctMon.CategoryErrorsNames[errCate]+
" per "+sctMon.layerName[region].Data()+
str(
 
  158                         layer//2)+
"_"+
str(layer % 2),
 
  160                     sctMon.subDetNameShort[region].Data() +
 
  161                     "/errors/"+sctMon.CategoryErrorsNames[errCate],
 
  162                     xbins=sctMon.N_ETA_BINS 
if region == sctMon.BARREL_INDEX 
else sctMon.N_ETA_BINS_EC,
 
  164                         sctMon.FIRST_ETA_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.FIRST_ETA_BIN_EC)-0.5,
 
  166                         sctMon.LAST_ETA_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.LAST_ETA_BIN_EC)+0.5,
 
  167                     ybins=sctMon.N_PHI_BINS 
if region == sctMon.BARREL_INDEX 
else sctMon.N_PHI_BINS_EC,
 
  169                         sctMon.FIRST_PHI_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.FIRST_PHI_BIN_EC)-0.5,
 
  171                         sctMon.LAST_PHI_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.LAST_PHI_BIN_EC)+0.5,
 
  175                 if myMonAlg.doOnlineMon 
and sctMon.CategoryErrorsNames[errCate] == 
"Errors":
 
  176                     myMonGroup.defineHistogram(
 
  177                         varname=
"eta, phi, hasError_" +
 
  178                         sctMon.CategoryErrorsNames[errCate]+
"_recent_" +
 
  179                         sctMon.subDetNameShort[region].Data()+
"_" +
 
  180                         str(layer//2)+
"_"+
str(layer % 2)+
";SummaryErrsRecent_" +
 
  181                         sctMon.subDetNameShort[region].Data()+
"_" +
 
  182                         str(layer//2)+
"_"+
str(layer % 2),
 
  185                         sctMon.CategoryErrorsNames[errCate] +
 
  186                         " per "+sctMon.layerName[region].Data()
 
  187                         + 
str(layer//2)+
"_"+
str(layer % 2)+
" - recent",
 
  189                         sctMon.subDetNameShort[region].Data() +
 
  191                         xbins=sctMon.N_ETA_BINS 
if region == sctMon.BARREL_INDEX 
else sctMon.N_ETA_BINS_EC,
 
  193                             sctMon.FIRST_ETA_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.FIRST_ETA_BIN_EC)-0.5,
 
  195                             sctMon.LAST_ETA_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.LAST_ETA_BIN_EC)+0.5,
 
  196                         ybins=sctMon.N_PHI_BINS 
if region == sctMon.BARREL_INDEX 
else sctMon.N_PHI_BINS_EC,
 
  198                             sctMon.FIRST_PHI_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.FIRST_PHI_BIN_EC)-0.5,
 
  200                             sctMon.LAST_PHI_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.LAST_PHI_BIN_EC)+0.5,
 
  202                         opt=
'kLBNHistoryDepth=30,kAlwaysCreate')
 
  205     myMonGroup.defineHistogram(varname=
"maskedLinksBin, maskedLinks;MaskedLinks",
 
  207                                title=
"Number of Masked Links for SCT,ECA,B,ECC",
 
  208                                path=
"GENERAL/errors",
 
  209                                xbins=sctMon.N_REGIONS_INC_GENERAL,
 
  211                                xmax=sctMon.N_REGIONS_INC_GENERAL-0.5,
 
  212                                xlabels=[
"EndCapC", 
"Barrel", 
"EndCapA", 
"All"],
 
  216     myMonGroup.defineHistogram(varname=
"flaggedWafersIndices, nFlaggedWafers;FlaggedWafers",
 
  218                                title=
"Number of flagged wafers for SCT,ECA,B,ECC",
 
  219                                path=
"GENERAL/errors",
 
  220                                xbins=sctMon.N_REGIONS_INC_GENERAL,
 
  222                                xmax=sctMon.N_REGIONS_INC_GENERAL-0.5,
 
  223                                xlabels=[
"EndCapC", 
"Barrel", 
"EndCapA", 
"All"],
 
  229         "Ave. Coverage of Enabled Links per LB",  
 
  230         "Ave. Coverage of Links with No Bad LinkLevelError per LB",  
 
  231         "Ave. Coverage of Links with No Bad RODLevelError per LB",  
 
  232         "Ave. Coverage of Links with No Bad Error per LB",  
 
  233         "Ave. Coverage of links Not Affected by PS Trip",  
 
  234         "Ave. Coverage of Links With No Bad Problem per LB"   
  236     for iProblem 
in range(1, sctMon.numberOfProblemForCoverage):
 
  237         myMonGroup.defineHistogram(
 
  238             varname=
"lumiBlock, detectorCoverage" +
 
  239             sctMon.coverageVarNames[iProblem]+
";SCT_Coverage" +
 
  240             sctMon.coverageVarNames[iProblem]+
"VsLbs",
 
  242             title=coverageTitles[iProblem] +
 
  243             ";LumiBlock;Detector Coverage [%]",
 
  244             path=
"DetectorCoverage",
 
  245             xbins=sctMon.NBINS_LBs,
 
  247             xmax=sctMon.NBINS_LBs+0.5,
 
  250         if iProblem == sctMon.summary:
 
  251             myMonGroup.defineHistogram(
 
  252                 varname=
"lumiBlock, detectorCoverage" +
 
  253                 sctMon.coverageVarNames[iProblem]+
"InR4P;SCT_Coverage" +
 
  254                 sctMon.coverageVarNames[iProblem]+
"InR4PVsLbs",
 
  256                 title=coverageTitles[iProblem] + 
" in Ready for Physics" +
 
  257                 ";LumiBlock;Detector Coverage [%]",
 
  258                 path=
"DetectorCoverage",
 
  259                 xbins=sctMon.NBINS_LBs,
 
  261                 xmax=sctMon.NBINS_LBs+0.5,
 
  265     myMonGroup.defineHistogram(varname=
"lumiBlock, psTripModules;SCT_ModulesWithPSTripVsLbs",
 
  267                                title=
"Ave. Num of Modules Affected by PS Trip per LB in All Region;LumiBlock;Num. of Modules Affected by PS Trip",
 
  268                                path=
"DetectorCoverage",
 
  269                                xbins=sctMon.NBINS_LBs,
 
  271                                xmax=sctMon.NBINS_LBs+0.5,
 
  275     for region 
in range(sctMon.N_REGIONS):
 
  276         for layer 
in range(sctMon.n_layers[region]*2):
 
  277             myMonGroup.defineHistogram(
 
  278                 varname=
"eta_out, phi_out, modulemap" +
 
  279                 sctMon.subDetNameShort[region].Data()+
str(layer//2)+
"_" +
 
  280                 str(layer % 2)+
";modulemap" +
 
  281                 sctMon.subDetNameShort[region].Data()+
str(layer//2)+
"_" +
 
  284                 title=
"Module out of configuration: "+sctMon.layerName[region].Data()+
str(layer//2)+
" side "+
str(
 
  285                     layer % 2) + 
";Index in the direction of #eta;Index in the direction of #phi",
 
  287                 sctMon.subDetNameShort[region].Data()+
"/Conf/",
 
  288                 xbins=sctMon.N_ETA_BINS 
if region == sctMon.BARREL_INDEX 
else sctMon.N_ETA_BINS_EC,
 
  289                 xmin=(sctMon.FIRST_ETA_BIN 
if region ==
 
  290                       sctMon.BARREL_INDEX 
else sctMon.FIRST_ETA_BIN_EC)-0.5,
 
  292                     sctMon.LAST_ETA_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.LAST_ETA_BIN_EC)+0.5,
 
  293                 ybins=sctMon.N_PHI_BINS 
if region == sctMon.BARREL_INDEX 
else sctMon.N_PHI_BINS_EC,
 
  294                 ymin=(sctMon.FIRST_PHI_BIN 
if region ==
 
  295                       sctMon.BARREL_INDEX 
else sctMon.FIRST_PHI_BIN_EC)-0.5,
 
  297                     sctMon.LAST_PHI_BIN 
if region == sctMon.BARREL_INDEX 
else sctMon.LAST_PHI_BIN_EC)+0.5,
 
  302     xlabels = [SCT_ByteStreamErrors.ErrorTypeDescription[i]
 
  303                for i 
in range(SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES)]
 
  304     for reg 
in range(sctMon.N_REGIONS):
 
  305         nLayers = sctMon.n_layers[reg]*2
 
  306         ylabels = [
str(i//2)+
"_"+
str(i % 2) 
for i 
in range(nLayers)]
 
  307         myMonGroup.defineHistogram(varname=
"errorType, layerSide, errorFraction;RateErrorsPerLumi",
 
  309                                    sctMon.subDetNameShort[reg].Data(),
 
  311                                    title=
"Rate of Error Types for " +
 
  312                                    sctMon.layerName[reg].Data() +
 
  315                                    sctMon.subDetNameShort[reg].Data(
 
  317                                    xbins=SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES,
 
  319                                    xmax=SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES-0.5,
 
  328     result.merge(helper.result())