5 '''@file PFOMonitorAlgorithm.py 
    8 @python configuration for the Run III PArticle Flow Object (PFO) Monitoring package 
   12     '''Function to configures some algorithms in the monitoring system.''' 
   23     from AthenaMonitoring 
import AthMonitorCfgHelper
 
   24     helper = AthMonitorCfgHelper(inputFlags,
'PFOAthMonitorCfg')
 
   33     from AthenaMonitoring.AtlasReadyFilterConfig 
import AtlasReadyFilterCfg
 
   34     from AthenaMonitoring.BadLBFilterToolConfig 
import LArBadLBFilterToolCfg
 
   36     from AthenaConfiguration.ComponentFactory 
import CompFactory
 
   37     PFOMonAlg = helper.addAlgorithm(CompFactory.PFOMonitorAlgorithm,
'PFOMonAlg',
 
   59     pfosAllGroup = helper.addGroup(
 
   61         name=
'PFOMonitorAllPFOs',
 
   62         topPath=
'PFOs/AllPFOs/' 
   65     pfosChargedGroup = helper.addGroup(
 
   67         name=
'PFOMonitorChargedPFOs',
 
   68         topPath=
'PFOs/ChargedPFOs/' 
   71     pfosNeutralGroup = helper.addGroup(
 
   73         name=
'PFOMonitorNeutralPFOs',
 
   74         topPath=
'PFOs/NeutralPFOs/' 
   79     pfosAllGroup.defineHistogram(
'nPFOs',  title=
'No. of PFOs;N_{PFOs};Events',xbins=200,xmin=0.0,xmax=2000.0)
 
   80     pfosAllGroup.defineHistogram(
'pfopT',  title=
'PFO transverse momentum;pT;Events',xbins=200,xmin=0.0,xmax=400)
 
   81     pfosAllGroup.defineHistogram(
'pfoEta', title=
'PFO eta;eta;Events',xbins=98,xmin=-4.9,xmax=4.9)
 
   82     pfosAllGroup.defineHistogram(
'pfoPhi', title=
'PFO phi;phi;Events',xbins=64,xmin=-3.15,xmax=3.15)
 
   83     pfosAllGroup.defineHistogram(
'pfoMass',title=
'PFO mass;Mass;Events',xbins=100,xmin=0.0,xmax=100)
 
   84     pfosAllGroup.defineHistogram(
'pfoE',   title=
'PFO energy;E;Events',xbins=300,xmin=0.0,xmax=600)
 
   85     pfosAllGroup.defineHistogram(
'pfoRapidity', title=
'PFO rapidity;y;Events',xbins=98,xmin=-4.9,xmax=4.9)
 
   87     pfosAllGroup.defineHistogram(
'pfoEta,pfoPhi,pfoE', type=
'TProfile2D', title=
'Average PFO Energy;eta;phi',
 
   88                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
   89     pfosAllGroup.defineHistogram(
'pfoEta,pfoPhi,pfopT', type=
'TProfile2D', title=
'Average PFO Transverse Momentum;eta;phi',
 
   90                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
   91     pfosAllGroup.defineHistogram(
'pfoEta,pfoPhi', type=
'TH2F',title=
'PFO Occupancy - No Threshold;eta;phi',
 
   92                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
   96     pfosChargedGroup.defineHistogram(
'nChPFOs',  title=
'No. of Charged PFOs;N_{PFOs};Events',xbins=200,xmin=0.0,xmax=1000.0)    
 
   97     pfosChargedGroup.defineHistogram(
'ChpfopT',  title=
'Charged PFO transverse momentum;pT;Events',xbins=100,xmin=0.0,xmax=200)
 
   98     pfosChargedGroup.defineHistogram(
'ChpfoEta', title=
'Charged PFO eta;eta;Events',xbins=98,xmin=-4.9,xmax=4.9)
 
   99     pfosChargedGroup.defineHistogram(
'ChpfoPhi', title=
'Charged PFO phi;phi;Events',xbins=64,xmin=-3.15,xmax=3.15)
 
  100     pfosChargedGroup.defineHistogram(
'ChpfoMass',title=
'Charged PFO mass;Mass;Events',xbins=100,xmin=0.0,xmax=100)
 
  101     pfosChargedGroup.defineHistogram(
'ChpfoE',   title=
'Charged PFO energy;E;Events',xbins=300,xmin=0.0,xmax=300)
 
  102     pfosChargedGroup.defineHistogram(
'ChpfoDenseEnv',title=
'Charged PFO isInDenseEnvironment Flag',xbins=3,xmin=-1,xmax=2)
 
  103     pfosChargedGroup.defineHistogram(
'ChpfoExpE', title=
'Charged PFO Expected Energy From Tracks; E_{exp};Events', xbins=300,xmin=0.0,xmax=3000.0)
 
  104     pfosChargedGroup.defineHistogram(
'ChpfoExpE;DenseEnvFlagE', title=
'Charged PFO Expected Energy From Tracks - IsInDenseEvironmet=TRUE; E_{exp};Events',
 
  105                             xbins=200,xmin=0.0,xmax=2000.0, cutmask=
'DenseEnvFlag')
 
  107     pfosChargedGroup.defineHistogram(
'ChpfoEta,ChpfoPhi,ChpfoE', type=
'TProfile2D', title=
'Average Charged PFO Energy;eta;phi',
 
  108                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
  109     pfosChargedGroup.defineHistogram(
'ChpfoExpE,ChpfoPhi,ChpfoE', type=
'TProfile2D', title=
'Average Charged PFO Expected Energy From Tracks;eta;phi',
 
  110                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
  111     pfosChargedGroup.defineHistogram(
'ChpfoEta,ChpfoPhi,ChpfopT', type=
'TProfile2D', title=
'Average Charged PFO Transverse Monmentum;eta;phi',
 
  112                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
  113     pfosChargedGroup.defineHistogram(
'ChpfoEta,ChpfoPhi', type=
'TH2F',title=
'Charged PFO Occupancy - No Threshold;eta;phi',
 
  114                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
  115     pfosChargedGroup.defineHistogram(
'ChpfoEta,ChpfoPhi;DenseEnvFlagEtaPhi', type=
'TH2F',title=
'Charged PFO Occupancy - IsInDenseEvironmet=TRUE;eta;phi',
 
  116                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15, cutmask=
'DenseEnvFlag' )
 
  120     pfosNeutralGroup.defineHistogram(
'nNuPFOs',  title=
'No. of Neutral PFOs;N_{PFOs};Events',xbins=200,xmin=0.0,xmax=2000.0)
 
  121     pfosNeutralGroup.defineHistogram(
'NupfopT',  title=
'Neutral PFO transverse momentum;pT;Events',xbins=200,xmin=0.0,xmax=400)
 
  122     pfosNeutralGroup.defineHistogram(
'NupfoEta', title=
'Neutral PFO eta;eta;Events',xbins=98,xmin=-4.9,xmax=4.9)
 
  123     pfosNeutralGroup.defineHistogram(
'NupfoPhi', title=
'Neutral PFO phi;phi;Events',xbins=64,xmin=-3.15,xmax=3.15)
 
  124     pfosNeutralGroup.defineHistogram(
'NupfoMass',title=
'Neutral PFO mass;Mass;Events',xbins=100,xmin=0.0,xmax=100)
 
  125     pfosNeutralGroup.defineHistogram(
'NupfoE',   title=
'Neutral PFO energy;E;Events',xbins=300,xmin=0.0,xmax=600)
 
  126     pfosNeutralGroup.defineHistogram(
'NupfoRapidity', title=
'Neutral PFO rapidity;y;Events',xbins=98,xmin=-4.9,xmax=4.9)
 
  127     pfosNeutralGroup.defineHistogram(
'NupfoIsolation', title=
'Neutral PFO Isolation;Iso;Events',xbins=100,xmin=-1.5,xmax=2.0)
 
  128     pfosNeutralGroup.defineHistogram(
'NupfoEPos',title=
'Neutral PFO Energy From Positive Cells;E_{pos};Events',xbins=500,xmin=0.0,xmax=10000.0)
 
  129     pfosNeutralGroup.defineHistogram(
'NupfoSecondR',title=
'Neutral PFO SECOND_R',xbins=60,xmin=-1.0,xmax=50.0)
 
  130     pfosNeutralGroup.defineHistogram(
'NupfoSecondLambda',title=
'Neutral PFO SECOND_LAMBDA',xbins=60,xmin=-1.0,xmax=3000.0)
 
  131     pfosNeutralGroup.defineHistogram(
'NupfoCenterLambda',title=
'Neutral PFO CENTER_LAMBDA',xbins=60,xmin=-50.0,xmax=3000.0)
 
  133     pfosNeutralGroup.defineHistogram(
'NupfoBadLarQFrac',title=
'Neutral PFO BADLARQ_FRAC',xbins=25,xmin=-1.0,xmax=1.5)
 
  134     pfosNeutralGroup.defineHistogram(
'NupfoAvgLarQ',title=
'Neutral PFO AVG_LAR_Q',xbins=31,xmin=-1000.0,xmax=30000.0)
 
  135     pfosNeutralGroup.defineHistogram(
'NupfoAvgTileQ',title=
'Neutral PFO _AVG_TILE_Q',xbins=21,xmin=-10.0,xmax=200.0)
 
  136     pfosNeutralGroup.defineHistogram(
'NupfoEMProb',title=
'Neutral PFO EM_PROBABILITY',xbins=21,xmin=-1.0,xmax=1.0)
 
  138     pfosNeutralGroup.defineHistogram(
'NupfoNBadCells',title=
'Neutral PFO N_BAD_CELLS',xbins=30,xmin=-1.0,xmax=2.0)
 
  139     pfosNeutralGroup.defineHistogram(
'NupfoEBadCells',title=
'Neutral PFO Energy From Bad Cells;E_{bad cells};Events',xbins=210,xmin=-10.0,xmax=100.0)
 
  145     pfosNeutralGroup.defineHistogram(
'NupfoEta,NupfoPhi,NupfoE', type=
'TProfile2D', title=
'Average Neutral PFO Energy;eta;phi',
 
  146                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
  147     pfosNeutralGroup.defineHistogram(
'NupfoEta,NupfoPhi,NupfopT', type=
'TProfile2D', title=
'Average Neutral PFO Transverse Momentum;eta;phi',
 
  148                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
  149     pfosNeutralGroup.defineHistogram(
'NupfoEta,NupfoPhi', type=
'TH2F',title=
'Neutral PFO Occupancy - No Threshold;eta;phi',
 
  150                             xbins=98,xmin=-4.9,xmax=4.9,ybins=64,ymin=-3.15,ymax=3.15 )
 
  158     return helper.result()
 
  165 if __name__==
'__main__':
 
  167     from AthenaCommon.Logging 
import log
 
  172     from AthenaConfiguration.AllConfigFlags 
import initConfigFlags
 
  174     nightly = 
'/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/' 
  175     file = 
'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1' 
  177     flags.Input.Files = [nightly+file]
 
  178     flags.Input.isMC = 
False 
  179     flags.Output.HISTFileName = 
'PFOMonitorOutput.root' 
  180     flags.fillFromArgs(sys.argv[1:])
 
  185     from AthenaConfiguration.MainServicesConfig 
import MainServicesThreadedCfg 
 
  186     from AthenaPoolCnvSvc.PoolReadConfig 
import PoolReadCfg
 
  187     cfg = MainServicesThreadedCfg(flags)
 
  191     cfg.merge(pfoMonitorAcc)
 
  195     cfg.printConfig(withDetails=
False)