5 '''@file JetMonitoringExample.py 
    8 @brief Main python configuration for the Run III Jet Monitoring 
   10 from AthenaMonitoring.DQConfigFlags 
import DQDataType
 
   11 from JetMonitoring.JetMonitoringConfig 
import JetMonAlgSpec, HistoSpec,  EventHistoSpec, SelectSpec, VarSpec
 
   31     "FracSamplingMaxIndex",
 
   45     "JetConstitScaleMomentum_pt",
"JetEMScaleMomentum_pt",
"JetPileupScaleMomentum_pt",
"JetEtaJESScaleMomentum_pt",
 
   46     "JetConstitScaleMomentum_eta",
"JetEMScaleMomentum_eta",
"JetPileupScaleMomentum_eta",
"JetEtaJESScaleMomentum_eta",
 
   47     "JetConstitScaleMomentum_phi",
"JetEMScaleMomentum_phi",
"JetPileupScaleMomentum_phi",
"JetEtaJESScaleMomentum_phi",
 
   52     EventHistoSpec(
'njets',(100,0.,100.),title=
"Number of Jets;Njets;"),
 
   53     EventHistoSpec(
'njetsPt20',(100,0.,100.),title=
"Number of Jets pT>20 GeV;Njets;"),
 
   54     EventHistoSpec(
'njetsPt200',(800,0.,8000.),title=
"Number of Jets pT>200 GeV;Njets;"),
 
   71     SelectSpec( 
'central',   
 
   74                 FillerTools = [
"pt",
"m",
"eta",
"phi",
"EMFrac",
"Tile0Frac",
"LArQuality",
"nconstit",
"N90Constituents",
 
   75                 "JetConstitScaleMomentum_pt",
"JetEMScaleMomentum_pt",
"JetPileupScaleMomentum_pt",
"JetEtaJESScaleMomentum_pt",
 
   76                 "JetConstitScaleMomentum_eta",
"JetEMScaleMomentum_eta",
"JetPileupScaleMomentum_eta",
"JetEtaJESScaleMomentum_eta",
 
   77                 "JetConstitScaleMomentum_phi",
"JetEMScaleMomentum_phi",
"JetPileupScaleMomentum_phi",
"JetEtaJESScaleMomentum_phi",
 
   80      SelectSpec( 
'tilegap3',   
 
   83                 FillerTools = [
"pt",
"m",
"eta",
"phi",
"EMFrac",
"Tile0Frac",
"HECFrac",
"LArQuality",
"nconstit",
"N90Constituents",
 
   87     SelectSpec( 
'leading',
 
   91                 FillerTools = [
"pt",
"m",
"eta",
"phi",
"EMFrac",
"Tile0Frac",
"HECFrac",
"LArQuality",
"nconstit",
"N90Constituents",
 
   92                 "JetConstitScaleMomentum_pt",
"JetEMScaleMomentum_pt",
"JetPileupScaleMomentum_pt",
"JetEtaJESScaleMomentum_pt",
 
   93                 "JetConstitScaleMomentum_eta",
"JetEMScaleMomentum_eta",
"JetPileupScaleMomentum_eta",
"JetEtaJESScaleMomentum_eta",
 
   94                 "JetConstitScaleMomentum_phi",
"JetEMScaleMomentum_phi",
"JetPileupScaleMomentum_phi",
"JetEtaJESScaleMomentum_phi",
 
   98     SelectSpec( 
'subleading',
 
  101                 path=
'SubleadingJets', 
 
  102                 FillerTools = [
"pt",
"m",
"eta",
"phi",
"EMFrac",
"Tile0Frac",
"HECFrac",
"LArQuality",
"nconstit",
"N90Constituents",
 
  103                 "JetConstitScaleMomentum_pt",
"JetEMScaleMomentum_pt",
"JetPileupScaleMomentum_pt",
"JetEtaJESScaleMomentum_pt",
 
  104                 "JetConstitScaleMomentum_eta",
"JetEMScaleMomentum_eta",
"JetPileupScaleMomentum_eta",
"JetEtaJESScaleMomentum_eta",
 
  105                 "JetConstitScaleMomentum_phi",
"JetEMScaleMomentum_phi",
"JetPileupScaleMomentum_phi",
"JetEtaJESScaleMomentum_phi",
 
  109     SelectSpec( 
'highptrange2TeVto8TeV',
'2000<pt:GeV<8000',path=
'highptrange2TeVto8TeV',FillerTools = [
"highpt",
"m",
"eta",
"phi",
"eta;phi",] ),
 
  110     SelectSpec( 
'highptrange1TeVto2TeV',
'1000<pt:GeV<2000',path=
'highptrange1TeVto2TeV',FillerTools = [
"highpt",
"m",
"eta",
"phi",
"eta;phi",] ),
 
  111     SelectSpec( 
'highptrange500GeVto1TeV',
'500<pt:GeV<1000',path=
'highptrange500GeVto1TeV',FillerTools = [
"highpt",
"m",
"eta",
"phi",
"eta;phi",] ),
 
  112     SelectSpec( 
'highptrange200GeVto500GeV',
'200<pt:GeV<500',path=
'highptrange200GeVto500GeV',FillerTools = [
"highpt",
"m",
"eta",
"phi",
"eta;phi",] ),
 
  115     SelectSpec( 
'LooseBadFailedJets', 
'LooseBad', InverseJetSel=
True, 
 
  116                 FillerTools = [
"pt",
"phi",
"eta",
"m",
"EMFrac",
"LArQuality",
"Tile0Frac",
"HECFrac",
"nconstit",
"N90Constituents",
 
  117                 "phi;eta",
"phi;eta;e",
"phi;eta;pt",
 
  121     SelectSpec( 
'LooseBadJets',
 
  123                 FillerTools = [ 
"pt",
"eta",
"phi",
"m",
"EMFrac",
"LArQuality",
"Tile0Frac",
"HECFrac",
"nconstit",
"N90Constituents",
 
  124                 "phi;eta",
"phi;eta;e",
"phi;eta;pt",
 
  130     SelectSpec( 
'highJVF',
 
  132                 FillerTools = [
"pt",
"m",
"eta",
"phi",
 
  138     HistoSpec(
"PreSamplerB",(100,0.,200.),title=
"Energy in PreSamplerB;E;Entries",xvar=VarSpec(
'EnergyPerSampling[0]')),
 
  139     HistoSpec(
"EMB1",(100,0.,200.),title=
"Energy in EMB1;E;Entries",xvar=VarSpec(
'EnergyPerSampling[1]')),
 
  140     HistoSpec(
"EMB2",(100,0.,200.),title=
"Energy in EMB2;E;Entries",xvar=VarSpec(
'EnergyPerSampling[2]')),
 
  141     HistoSpec(
"EMB3",(100,0.,200.),title=
"Energy in EMB3;E;Entries",xvar=VarSpec(
'EnergyPerSampling[3]')),
 
  142     HistoSpec(
"PreSamplerE",(100,0.,200.),title=
"Energy in PreSamplerE;E;Entries",xvar=VarSpec(
'EnergyPerSampling[4]')),
 
  143     HistoSpec(
"EME1",(100,0.,200.),title=
"Energy in EME2;E;Entries",xvar=VarSpec(
'EnergyPerSampling[5]')),
 
  144     HistoSpec(
"EME2",(100,0.,200.),title=
"Energy in EME2;E;Entries",xvar=VarSpec(
'EnergyPerSampling[6]')),
 
  145     HistoSpec(
"EME3",(100,0.,200.),title=
"Energy in EME3;E;Entries",xvar=VarSpec(
'EnergyPerSampling[7]')),
 
  146     HistoSpec(
"HEC0",(100,0.,200.),title=
"Energy in HEC0;E;Entries",xvar=VarSpec(
'EnergyPerSampling[8]')),
 
  147     HistoSpec(
"HEC1",(100,0.,200.),title=
"Energy in HEC1;E;Entries",xvar=VarSpec(
'EnergyPerSampling[9]')),
 
  148     HistoSpec(
"HEC2",(100,0.,200.),title=
"Energy in HEC2;E;Entries",xvar=VarSpec(
'EnergyPerSampling[10]')),
 
  149     HistoSpec(
"HEC3",(100,0.,200.),title=
"Energy in HEC3;E;Entries",xvar=VarSpec(
'EnergyPerSampling[11]')),
 
  150     HistoSpec(
"TileBar0",(100,0.,200.),title=
"Energy in TileBar0;E;Entries",xvar=VarSpec(
'EnergyPerSampling[12]')),
 
  151     HistoSpec(
"TileBar1",(100,0.,200.),title=
"Energy in TileBar1;E;Entries",xvar=VarSpec(
'EnergyPerSampling[13]')),
 
  152     HistoSpec(
"TileBar2",(100,0.,200.),title=
"Energy in TileBar1;E;Entries",xvar=VarSpec(
'EnergyPerSampling[14]')),
 
  153     HistoSpec(
"TileGap1",(100,0.,200.),title=
"Energy in TileGap1;E;Entries",xvar=VarSpec(
'EnergyPerSampling[15]')),
 
  154     HistoSpec(
"TileGap2",(100,0.,200.),title=
"Energy in TileGap2;E;Entries",xvar=VarSpec(
'EnergyPerSampling[16]')),
 
  155     HistoSpec(
"TileGap3",(100,0.,200.),title=
"Energy in TileGap3;E;Entries",xvar=VarSpec(
'EnergyPerSampling[17]')),
 
  156     HistoSpec(
"TileExt0",(100,0.,200.),title=
"Energy in TileExt0;E;Entries",xvar=VarSpec(
'EnergyPerSampling[18]')),
 
  157     HistoSpec(
"TileExt1",(100,0.,200.),title=
"Energy in TileExt1;E;Entries",xvar=VarSpec(
'EnergyPerSampling[19]')),
 
  158     HistoSpec(
"TileExt2",(100,0.,200.),title=
"Energy in TileExt2;E;Entries",xvar=VarSpec(
'EnergyPerSampling[20]')),
 
  159     HistoSpec(
"FCAL0",(100,0.,200.),title=
"Energy in FCAL0;E;Entries",xvar=VarSpec(
'EnergyPerSampling[21]')),
 
  160     HistoSpec(
"FCAL1",(100,0.,200.),title=
"Energy in FCAL1;E;Entries",xvar=VarSpec(
'EnergyPerSampling[22]')),
 
  161     HistoSpec(
"FCAL2",(100,0.,200.),title=
"Energy in FCAL2;E;Entries",xvar=VarSpec(
'EnergyPerSampling[23]')),
 
  166     "SumPtChargedPFOPt500[0]",
 
  176     """returns a specification of a JetMonitoringAlg (in the form of a JetMonAlgSpec dictionnary). 
  180     jetAlgConfig = JetMonAlgSpec(
 
  182         JetContainerName = jetName,
 
  183         TriggerChain = trigger ,  
 
  190     histoSpecs += commonHistoSpecs 
 
  192     if inputFlags.DQ.DataType 
is not DQDataType.Cosmics:
 
  193         histoSpecs += jvfHistosSpec
 
  195     if 'Topo' in jetName:
 
  196         histoSpecs += topoHistosSpec
 
  197     if 'PFlow' in jetName:
 
  198         histoSpecs += pflowHistosSpec
 
  201     if truthJetName != 
"" :
 
  203         from JetMonitoring.JetStandardHistoSpecs 
import responseAndEffSpecMap
 
  204         if truthJetName 
not in responseAndEffSpecMap:
 
  205             print( 
"ERROR !! can't schedule a JetHistoResponseAndEff for truth container : ",truthJetName, 
". No specification available" )
 
  208         histoSpecs +=[ responseAndEffSpecMap[truthJetName]  ]
 
  211     jetAlgConfig.appendHistos( * histoSpecs)
 
  218     """Standard jet monitoring function to be inserted from top-level algs.  
  219     returns an a component accumulator as given by AthMonitorCfgHelper.result() 
  220     Details of what goes into jet monitoring is implemented by dedicated functions such as jetMonAlgConfig(). 
  223     from AthenaConfiguration.ComponentAccumulator 
import ComponentAccumulator
 
  227     if inputFlags.DQ.Environment == 
'tier0Raw':
 
  230     from AthenaMonitoring 
import AthMonitorCfgHelper
 
  231     helper = AthMonitorCfgHelper(inputFlags,
'JetMonitoring')
 
  236     if inputFlags.Reco.EnableHI:
 
  237         if inputFlags.Tracking.doUPC:
 
  249     from AthenaMonitoring.EventFlagFilterToolConfig 
import EventFlagFilterToolCfg
 
  251     from AthenaMonitoring.BadLBFilterToolConfig 
import LArBadLBFilterToolCfg
 
  255     for conf 
in jetAlgConfs:        
 
  256        alg = conf.toAlg(helper)
 
  259     rv.merge(helper.result())