5 '''@file SCTLorentzMonAlg.py 
    8 @brief Based on AthenaMonitoring/ExampleMonitorAlgorithm.py 
   16     from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
   21     from AthenaMonitoring 
import AthMonitorCfgHelper
 
   22     helper = AthMonitorCfgHelper(flags, 
'SCTLorentzMonCfg')
 
   31     from AthenaConfiguration.ComponentFactory 
import CompFactory
 
   32     from InDetConfig.InDetAssociationToolsConfig 
import InDetPRDtoTrackMapToolGangedPixelsCfg
 
   33     from TrkConfig.TrkTrackSummaryToolConfig 
import InDetTrackSummaryToolCfg
 
   35     myMonAlg = helper.addAlgorithm(
 
   36         CompFactory.SCTLorentzMonAlg,
 
   38         AssociationTool = result.popToolsAndMerge(
 
   40         TrackSummaryTool = result.popToolsAndMerge(
 
   51     myMonAlg.TriggerChain = 
'' 
   60     from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConfig 
import SCT_DetectorElementCondAlgCfg
 
   70     myMonGroup = helper.addGroup(
 
   81     surfaceNames = [
"_100",   
"_111"]
 
   82     surfaceNames2 = [
"_100_",   
"_111_"]
 
   83     surfaceTitles = [
"100 - ", 
"111 - "]
 
   84     sideNames = [
"_0", 
"_1"]
 
   85     for l 
in range(N_BARRELS):
 
   86         for iSurface 
in range(nSurfaces):
 
   87             for side 
in range(nSides):
 
   88                 xVar = 
"phiToWafer_"+
str(l)+surfaceNames[iSurface]+sideNames[side]
 
   89                 yVar = 
"nStrip_"+
str(l)+surfaceNames[iSurface]+sideNames[side]
 
   90                 histTitle = surfaceTitles[iSurface]+
"Inc. Angle vs nStrips for Layer Side"+
str(l)+
str(side)
 
   91                 histName = 
"h_phiVsNstrips"+surfaceNames2[iSurface]+
str(l)+
"Side"+
str(side)
 
   92                 myMonGroup.defineHistogram(varname=xVar+
","+yVar+
";"+histName, 
 
   94                                            title=histTitle+
";#phi to Wafer;Num of Strips",
 
   96                                            xbins=360, xmin=-90., xmax=90.)
 
   98                 myMonGroup.defineHistogram(varname=xVar+
","+yVar+
";"+histName + 
"_e0p5", 
 
  100                                            title=histTitle+
"(|#eta| < 0.5);#phi to Wafer;Num of Strips",
 
  102                                            xbins=360, xmin=-90., xmax=90.,
 
  108     endcapNames = [
"ECA", 
"ECC"]
 
  109     etaNames = [
"outer", 
"middle", 
"inner"]
 
  110     sideNames = [
"_0", 
"_1"]
 
  111     for e 
in range(nEndcaps):
 
  112         for d 
in range(nDisks):
 
  113             for iEta 
in range(nEta):
 
  115                 if ((d == 1 
and iEta == 1) 
or  
  116                     (d == 3 
and iEta == 1) 
or 
  117                     (d == 4 
and iEta >= 1) 
or 
  118                     (d == 5 
and iEta == 2) 
or 
  119                     (d == 7 
and iEta == 1)):
 
  121                 elif (d == 2 
and iEta == 1):
 
  124                 for side 
in range(nSides):
 
  125                     xVar = 
"phiToWafer_"+endcapNames[e]+
str(d)+
"_"+etaNames[iEta]+sideNames[side]
 
  126                     yVar = 
"nStrip_"+endcapNames[e]+
str(d)+
"_"+etaNames[iEta]+sideNames[side]
 
  127                     histTitle = 
"111 (" + sensorType + 
") - Inc. Angle vs nStrips for " + endcapNames[e] + 
" Disk Eta Side"+
str(d)+
str(iEta)+
str(side)
 
  128                     histName = 
"h_phiVsNstrips_"+endcapNames[e]+
str(d)+
"_"+etaNames[iEta]+
"_Side"+
str(side)
 
  129                     myMonGroup.defineHistogram(varname=xVar+
","+yVar+
";"+histName, 
 
  131                                                title=histTitle+
";#phi to Wafer;Num of Strips",
 
  133                                                xbins=360, xmin=-90., xmax=90.)
 
  143     result.merge(helper.result())
 
  146 if __name__ == 
"__main__": 
 
  148     from AthenaCommon.Logging 
import log
 
  153     from AthenaConfiguration.AllConfigFlags 
import initConfigFlags
 
  155     flags.Input.Files = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc16_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s3170_r10572_homeMade.pool.root"]
 
  156     flags.Input.isMC = 
True 
  157     flags.Output.HISTFileName = 
'SCTLorentzMonOutput.root' 
  158     flags.GeoModel.Align.Dynamic = 
False 
  159     flags.Detector.GeometryPixel = 
True 
  160     flags.Detector.GeometrySCT = 
True 
  161     flags.Detector.GeometryTRT = 
True 
  162     flags.Detector.GeometryCalo = 
False 
  163     flags.Detector.GeometryMuon = 
True 
  167     from AthenaConfiguration.MainServicesConfig 
import MainServicesCfg 
 
  168     from AthenaPoolCnvSvc.PoolReadConfig 
import PoolReadCfg