8     '''Function to configure LVL1 PPM Sim algorithm in the monitoring system.''' 
   11     from AthenaConfiguration.ComponentFactory 
import CompFactory
 
   12     from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
   16     from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig 
import L1CaloMonitorCfgHelper
 
   17     helper = L1CaloMonitorCfgHelper(flags,CompFactory.PPMSimBSMonitorAlgorithm,
'PPMSimBSMonAlg')
 
   20     PPMSimBSMonAlg = helper.alg
 
   23     from DetDescrCnvSvc.DetDescrCnvSvcConfig 
import DetDescrCnvSvcCfg 
 
   26     from TrigT1CaloCondSvc.L1CaloCondConfig 
import L1CaloCondAlgCfg 
 
   29     from TrigConfxAOD.TrigConfxAODConfig 
import getxAODConfigSvc
 
   33     groupName = 
'PPMSimBSMonitor'  
   34     PPMSimBSMonAlg.PackageName = groupName
 
   37     histPath_dev = 
'Developer/PPMSimBSMonAlg/Simulation' 
   38     histPath_exp = 
'Expert/PpmTrex/Simulation' 
   41     etabins = [-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
 
   42                -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
 
   43                -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
 
   44                -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
 
   45                -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
 
   46                0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
 
   47                1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
 
   48                3.1,3.2,3.625,4.050,4.475,4.9]
 
   57     histPath = histPath_exp+
'/BcidSim' 
   58     group_names = {
"peakf": 
"Peakfinder", 
"satBcid": 
"SaturatedBCID"}
 
   59     mismatch_map= {
"NonZeroMatches": 
"Data/Simulation Non-Zero Matches", 
"ZeroMatches":  
"Data/Simulation Zero Matches", 
"DataNoSim":
"Data but no Simulation", 
"SimNoData":
"Simulation but no Data"}
 
   62     for names 
in group_names:
 
   63         for elem 
in mismatch_map:
 
   64             helper.defineHistogram(
'etaTT_2D,phiTT_2D;ppm_2d_etaPhi_tt_'+names+
'_'+elem,
 
   65                                    fillGroup=
'group_Mismatch_{0}_{1}'.
format(names, elem),
 
   66                                    title=
'PPM '+group_names[names]+
' ' + mismatch_map[elem],
 
   67                                    type=
'TH2D', path=histPath,
 
   69                                        "description": 
'PPM '+group_names[names]+
' ' + mismatch_map[elem]
 
   71                                    xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins,
 
   80     histPath = histPath_exp+
'/LutSim' 
   81     lut_map =  { 
"SimEqData": 
"Data/Simulation Non-zero Matches", 
"SimNeData": 
"Data/Simulation Non-zero Mismatches", 
"SimNoData":  
"Simulation but no Data", 
"DataNoSim": 
"Data but no Simulation" }
 
   82     group_names_lut = {
"lutCp": [
"CP", histPath], 
"lutJep": [
"JEP", histPath] }
 
   86     histPath = histPath_dev+
'/LutSim' 
   87     for names 
in group_names_lut:
 
   89             helper.defineHistogram(
'etaTT_2D,phiTT_2D;ppm_em_2d_etaPhi_tt_'+names+
'_'+elem,
 
   90                                    fillGroup=
'groupLUT{0}_EM_{1}'.
format(group_names_lut[names][0],elem),
 
   91                                    title=
'PPM LUT-'+group_names_lut[names][0]+
' EM ' + lut_map[elem],
 
   92                                    type=
'TH2D', path=histPath,
 
   93                                    xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins,
 
   97     histPath = histPath_exp+
'/LutSim' 
   98     for names 
in group_names_lut:
 
  100             helper.defineHistogram(
'etaTT_2D,phiTT_2D;ppm_had_2d_etaPhi_tt_'+names+
'_'+elem,
 
  101                                    fillGroup=
'groupLUT{0}_HAD_{1}'.
format(group_names_lut[names][0],elem),
 
  102                                    title=
'PPM LUT-'+group_names_lut[names][0]+
' HAD ' + lut_map[elem],
 
  103                                    type=
'TH2D', path=histPath,
 
  105                                        "description": 
'PPM LUT-'+group_names_lut[names][0]+
' HAD ' + lut_map[elem]
 
  107                                    xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins,
 
  116     nModulesPerCrate = 16
 
  118     y = 2 * (nModulesPerCrate + 16 * (nCrates % 2) )
 
  120     crate_map= [ 
"cr0cr1", 
"cr2cr3", 
"cr4cr5", 
"cr6cr7"]
 
  122     for elem 
in crate_map:
 
  125         helper.defineHistogram(
'eventMonitor,y_2D;ppm_2d_LUT_MismatchEvents_'+ elem,
 
  126                                fillGroup=
'group_Error_{}'.
format(elem),
 
  127                                title=
'PPM LUT Mismatch Event Numbers;Events with Error/Mismatch;Crate/Module',
 
  128                                type=
'TH2I', path=histPath_exp,
 
  130                                    "display" : 
"SetGridx,SetGridy",
 
  131                                    "algorithm" : 
"Histogram_Empty",
 
  132                                    "description" : 
"PPM LUT Mismatch Event Numbers." 
  134                                xbins=10,xmin=0, xmax=10,
 
  135                                ybins=y, ymin=0, ymax=y,ylabels=yErrorLabels,
 
  136                                opt=
'kAlwaysCreate' if elem == 
'cr6cr7' else '')
 
  139     acc = helper.result()