Example #1
0
preserveAllDescendants = False
from AthenaCommon.GlobalFlags import globalflags
if doTruthThinning and globalflags.DataSource() == 'geant4':
    truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"  # W, Z and Higgs
    truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"  # Leptons
    truth_cond_Quark = "((abs(TruthParticles.pdgId) <=  6))"  # Quarks
    truth_cond_Gluon = "((abs(TruthParticles.pdgId) == 21))"  # Gluons
    truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 10000.))"  # Photon

    truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_Lepton + ' || ' + truth_cond_Quark + '||' + truth_cond_Gluon + ' || ' + truth_cond_Photon + ')'

    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
    JETM7TruthThinningTool = DerivationFramework__GenericTruthThinning(
        name="JETM7TruthThinningTool",
        ThinningService=JETM7ThinningHelper.ThinningSvc(),
        ParticleSelectionString=truth_expression,
        PreserveDescendants=preserveAllDescendants,
        PreserveGeneratorDescendants=not preserveAllDescendants,
        PreserveAncestors=True)

    ToolSvc += JETM7TruthThinningTool
    thinningTools.append(JETM7TruthThinningTool)

#=======================================
# CREATE THE DERIVATION KERNEL ALGORITHM
#=======================================

from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel(
    name="JETM7Kernel",
    SkimmingTools=[JETM7SkimmingTool],
Example #2
0
# Truth leptons and their ancestors and descendants + final-state hadrons
truth_cond_boson = "((abs(TruthParticles.pdgId) == 23) || (abs(TruthParticles.pdgId) == 24))"
truth_cond_lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 14) &&(TruthParticles.pt > 1*GeV) && (TruthParticles.status ==1) && (TruthParticles.barcode<200000))"
photonthinningexpr = "(TruthPhotons.classifierParticleOrigin != 42) && !(TruthPhotons.classifierParticleOrigin >= 23 && TruthPhotons.classifierParticleOrigin <= 35)"
# Truth hadrons for UE analysis
truth_cond_hadrons = "( (TruthParticles.status ==1) && (TruthParticles.barcode<200000) )"

from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning

if globalflags.DataSource() == 'geant4':
    from DerivationFrameworkSM.STDMCommonTruthTools import *

    STDM7TruthLepTool = DerivationFramework__GenericTruthThinning(
        name="STDM7TruthLepTool",
        StreamName=streamName,
        ParticleSelectionString=truth_cond_lepton,
        PreserveDescendants=False,
        PreserveGeneratorDescendants=False,
        PreserveAncestors=True)

    STDM7TruthBosTool = DerivationFramework__GenericTruthThinning(
        name="STDM7TruthBosTool",
        StreamName=streamName,
        ParticleSelectionString=truth_cond_boson,
        PreserveDescendants=False,
        PreserveGeneratorDescendants=True,
        PreserveAncestors=False)

    STDM7PhotonThinning = DerivationFramework__GenericTruthThinning(
        name="STDM7PhotonThinning",
        StreamName=streamName,
Example #3
0
ToolSvc += HIGG3D3ElectronTPThinningTool
thinningTools.append(HIGG3D3ElectronTPThinningTool)

# Truth particles
truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"  # W, Z and Higgs
truth_cond2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"  # Leptons
truth_cond3 = "(abs(TruthParticles.pdgId) == 5 || abs(TruthParticles.pdgId) == 6)"  # b and Top quark
truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))"  # Photon

truth_expression = truth_cond1 + ' || ' + truth_cond2 + ' || ' + truth_cond3 + ' || ' + truth_cond4

from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
HIGG3D3TruthThinningTool = DerivationFramework__GenericTruthThinning(
    name="HIGG3D3TruthThinningTool",
    StreamName=streamName,
    ParticleSelectionString=truth_expression,
    PreserveDescendants=True,
    PreserveAncestors=True,
    SimBarcodeOffset=DerivationFrameworkSimBarcodeOffset)

if globalflags.DataSource() == 'geant4':
    ToolSvc += HIGG3D3TruthThinningTool
    thinningTools.append(HIGG3D3TruthThinningTool)

#====================================================================
# SKIMMING TOOL
#====================================================================
electronRequirements = '(Electrons.pt > 7*GeV) && (abs(Electrons.eta) < 2.6)'
muonsRequirements = '(Muons.pt > 7*GeV) && (abs(Muons.eta) < 2.7) && (Muons.DFCommonGoodMuon)'

from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__DeltaRTool
Example #4
0
                                                        WriteStatus3          = False,
                                                        PreserveGeneratorDescendants  = False,
                                                        PreserveAncestors     = True,
                                                        WriteFirstN           = -1)

from AthenaCommon.GlobalFlags import globalflags
if globalflags.DataSource()=='geant4':
  ToolSvc += EXOT0TruthTool
  thinningTools.append(EXOT0TruthTool)

truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.pt > 1*GeV) && ((TruthParticles.status ==1) || (TruthParticles.status ==2) || (TruthParticles.status ==3) || (TruthParticles.status ==23)) && (TruthParticles.barcode<200000))"

from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
EXOT0TruthTool2 = DerivationFramework__GenericTruthThinning(name                         = "EXOT0TruthTool2",
                                                            ThinningService              = "EXOT0ThinningSvc",
                                                            ParticleSelectionString      = truth_cond_Lepton,
                                                            PreserveDescendants          = False,
                                                            PreserveGeneratorDescendants = True,
                                                            PreserveAncestors            = True)
if globalflags.DataSource()=='geant4':
  ToolSvc += EXOT0TruthTool2
  thinningTools.append(EXOT0TruthTool2)

#====================================================================
# SKIMMING TOOL 
#====================================================================

beamEnergy = jobproperties.Beam.energy()
expression = ''
if (beamEnergy < 4.1e+06):
    expression = '(EventInfo.eventTypeBitmask == 1) || (EF_j15_a4tchad || EF_j25_a4tchad || EF_j35_a4tchad || EF_j45_a4tchad || EF_j55_a4tchad || EF_j80_a4tchad || EF_j110_a4tchad || EF_j145_a4tchad || EF_j180_a4tchad || EF_j220_a4tchad || EF_j280_a4tchad || EF_j360_a4tchad || EF_j460_a4tchad || EF_g35_loose_g25_loose)'
if (beamEnergy > 6.0e+06):
Example #5
0
#thinningTools.append(EGAM8TPThinningTool)



# Truth thinning
truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs
truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons
truth_cond_top = "((abs(TruthParticles.pdgId) ==  6))"                                     # Top quark
truth_cond_gam = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))"       # Photon
truth_cond_finalState = '(TruthParticles.status == 1 && TruthParticles.barcode < 200000)'   # stable particles
truth_expression = '(' + truth_cond_WZH + ' ||  ' + truth_cond_lep +' || '+truth_cond_top +' || '+truth_cond_gam + ') || (' + truth_cond_finalState+')'

from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
EGAM8TruthThinningTool = DerivationFramework__GenericTruthThinning(name                    = "EGAM8TruthThinningTool",
                                                                   ThinningService         = "EGAM8ThinningSvc",
                                                                   ParticleSelectionString = truth_expression,
                                                                   PreserveDescendants     = False,
                                                                   PreserveGeneratorDescendants     = True,
                                                                   PreserveAncestors      = True)

from AthenaCommon.GlobalFlags import globalflags
print "EGAM8 globalflags.DataSource(): ", globalflags.DataSource()
if globalflags.DataSource()=='geant4':
    ToolSvc += EGAM8TruthThinningTool
    thinningTools.append(EGAM8TruthThinningTool)
print "EGAM8 thinningTools: ", thinningTools


#=======================================
# CREATE THE DERIVATION KERNEL ALGORITHM
#=======================================
Example #6
0
HIGG5D2ThinningHelper = ThinningHelper("HIGG5D2ThinningHelper")
#trigger navigation content
HIGG5D2ThinningHelper.TriggerChains = 'HLT_e.*|HLT_mu.*|HLT_xe.*|HLT_j.*'
HIGG5D2ThinningHelper.AppendToStream(HIGG5D2Stream)

# MC truth thinning (not for data)
truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"  # W, Z and Higgs
truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"  # Leptons
truth_cond_Quark = "((abs(TruthParticles.pdgId) ==  6) || (abs(TruthParticles.pdgId) ==  5))"  # Top quark and Bottom quark
truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))"  # Photon
truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_Lepton + ' || ' + truth_cond_Quark + ' || ' + truth_cond_Photon + ')'
from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
HIGG5D2MCThinningTool = DerivationFramework__GenericTruthThinning(
    name="HIGG5D2MCThinningTool",
    ThinningService=HIGG5D2ThinningHelper.ThinningSvc(),
    ParticleSelectionString=truth_expression,
    PreserveDescendants=False,
    PreserveGeneratorDescendants=True,
    PreserveAncestors=True)

if globalflags.DataSource() == 'geant4':
    ToolSvc += HIGG5D2MCThinningTool
    thinningTools.append(HIGG5D2MCThinningTool)

# MET/Jet tracks
# thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)"
# from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning
# HIGG5D2TPThinningTool = DerivationFramework__TrackParticleThinning( name                = "HIGG5D2TPThinningTool",
#                                                                 ThinningService         = HIGG5D2ThinningHelper.ThinningSvc(),
#                                                                 SelectionString         = thinning_expression,
#                                                                 InDetTrackParticlesKey  = "InDetTrackParticles",
Example #7
0
def setup(TOPQname, streamName, ToolSvc):
    thinningTools = []

    #========================
    # Track Particle Thinning !!! BUGGY (yes, that's a technical term)...CURRENTLY NOT USING !!!
    #========================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/TrackParticleThinning.cxx
    thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)"
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning
    TOPQTPThinningTool = DerivationFramework__TrackParticleThinning(
        name=TOPQname + "TPThinningTool",
        StreamName=streamName,
        SelectionString=thinning_expression,
        InDetTrackParticlesKey="InDetTrackParticles")

    #ToolSvc += TOPQTPThinningTool
    #thinningTools.append(TOPQTPThinningTool)
    #print (TOPQname+".py", TOPQname+"TPThinningTool: ", TOPQTPThinningTool)

    #============================
    # Jet Track Particle Thinning
    #============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/JetTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning
    TOPQJetTPThinningTool = DerivationFramework__JetTrackParticleThinning(
        name=TOPQname + "JetTPThinningTool",
        StreamName=streamName,
        JetKey="AntiKt4EMTopoJets",
        InDetTrackParticlesKey="InDetTrackParticles",
        SelectionString="(AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 20*GeV)")

    ToolSvc += TOPQJetTPThinningTool
    thinningTools.append(TOPQJetTPThinningTool)
    print(TOPQname + ".py", TOPQname + "JetTPThinningTool: ",
          TOPQJetTPThinningTool)

    from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__SV1TrackThinning
    TOPQSV1ThinningTool = DerivationFramework__SV1TrackThinning(
        name=TOPQname + "SV1TrackThinning",
        StreamName=streamName,
        JetKey="AntiKt4EMTopoJets",
        InDetTrackParticlesKey="InDetTrackParticles",
        SelectionString="(AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 20*GeV)")

    ToolSvc += TOPQSV1ThinningTool
    thinningTools.append(TOPQSV1ThinningTool)
    print(TOPQname + ".py", TOPQname + "SV1ThinningTool: ",
          TOPQSV1ThinningTool)

    TOPQLargeJetTPThinningTool = DerivationFramework__JetTrackParticleThinning(
        name=TOPQname + "LargeJetTPThinningTool",
        StreamName=streamName,
        JetKey="AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
        InDetTrackParticlesKey="InDetTrackParticles",
        SelectionString="AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt>25*GeV")

    ToolSvc += TOPQLargeJetTPThinningTool
    thinningTools.append(TOPQLargeJetTPThinningTool)
    print(TOPQname + ".py", TOPQname + "LargeJetTPThinningTool: ",
          TOPQLargeJetTPThinningTool)

    from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__JetCaloClusterThinning
    TOPQAK4CCThinningTool = DerivationFramework__JetCaloClusterThinning(
        name=TOPQname + "AK4CCThinningTool",
        StreamName=streamName,
        SGKey="AntiKt4EMTopoJets",
        TopoClCollectionSGKey="CaloCalTopoClusters",
        SelectionString="AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 7*GeV",
        ConeSize=0.5)

    ToolSvc += TOPQAK4CCThinningTool
    thinningTools.append(TOPQAK4CCThinningTool)
    print(TOPQname + ".py", TOPQname + "AK4CCThinningTool: ",
          TOPQAK4CCThinningTool)

    from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__JetCaloClusterThinning
    TOPQLargeJetCCThinningTool = DerivationFramework__JetCaloClusterThinning(
        name=TOPQname + "LargeJetCCThinningTool",
        StreamName=streamName,
        SGKey="AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
        TopoClCollectionSGKey="CaloCalTopoClusters",
        SelectionString=
        "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.DFCommonJets_Calib_pt > 7*GeV",
        ConeSize=1.1)

    ToolSvc += TOPQLargeJetCCThinningTool
    thinningTools.append(TOPQLargeJetCCThinningTool)
    print(TOPQname + ".py", TOPQname + "LargeJetCCThinningTool: ",
          TOPQLargeJetCCThinningTool)

    #=================================
    # Electron Track Particle Thinning
    #=================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/EgammaTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning
    TOPQElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(
        name=TOPQname + "ElectronTPThinningTool",
        StreamName=streamName,
        SGKey="Electrons",
        InDetTrackParticlesKey="InDetTrackParticles")

    ToolSvc += TOPQElectronTPThinningTool
    thinningTools.append(TOPQElectronTPThinningTool)
    print(TOPQname + ".py", TOPQname + "ElectronTPThinningTool: ",
          TOPQElectronTPThinningTool)

    #===============================
    # Electron Calo Cluster Thinning
    #===============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/trunk/src/CaloClusterThinning.cxx
    from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning
    TOPQElectronCCThinningTool = DerivationFramework__CaloClusterThinning(
        name=TOPQname + "ElectronCCThinningTool",
        StreamName=streamName,
        SGKey="Electrons",
        CaloClCollectionSGKey="egammaClusters",
        SelectionString=
        "(Electrons.Loose || Electrons.DFCommonElectronsLHLoose)",
        ConeSize=0.4)

    ToolSvc += TOPQElectronCCThinningTool
    thinningTools.append(TOPQElectronCCThinningTool)
    print(TOPQname + ".py", TOPQname + "ElectronCCThinningTool: ",
          TOPQElectronCCThinningTool)

    #========================
    # Photon Track Particle Thinning
    #========================
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning
    TOPQPhotonTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(
        name=TOPQname + "PhotonTPThinningTool",
        StreamName=streamName,
        SGKey="Photons",
        InDetTrackParticlesKey="InDetTrackParticles")

    ToolSvc += TOPQPhotonTPThinningTool
    thinningTools.append(TOPQPhotonTPThinningTool)
    print(TOPQname + ".py", TOPQname + "PhotonTPThinningTool: ",
          TOPQPhotonTPThinningTool)

    #===============================
    # Photon Calo Cluster Thinning
    #===============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/trunk/src/CaloClusterThinning.cxx
    from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning
    TOPQPhotonCCThinningTool = DerivationFramework__CaloClusterThinning(
        name=TOPQname + "PhotonCCThinningTool",
        StreamName=streamName,
        SGKey="Photons",
        CaloClCollectionSGKey="egammaClusters",
        SelectionString="(Photons.Loose || Photons.DFCommonPhotonsIsEMLoose)",
        ConeSize=0.4)

    ToolSvc += TOPQPhotonCCThinningTool
    thinningTools.append(TOPQPhotonCCThinningTool)
    print(TOPQname + ".py", TOPQname + "PhotonCCThinningTool: ",
          TOPQPhotonCCThinningTool)

    #=============================
    # Muon Track Particle Thinning
    #=============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/MuonTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning
    TOPQMuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(
        name=TOPQname + "MuonTPThinningTool",
        StreamName=streamName,
        MuonKey="Muons",
        InDetTrackParticlesKey="InDetTrackParticles")

    ToolSvc += TOPQMuonTPThinningTool
    thinningTools.append(TOPQMuonTPThinningTool)
    print(TOPQname + ".py", TOPQname + "MuonTPThinningTool: ",
          TOPQMuonTPThinningTool)

    #============================
    # Tau Track Particle Thinning
    #============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/TauTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning
    TOPQTauTPThinningTool = DerivationFramework__TauTrackParticleThinning(
        name=TOPQname + "TauTPThinningTool",
        StreamName=streamName,
        TauKey="TauJets",
        InDetTrackParticlesKey="InDetTrackParticles")

    ToolSvc += TOPQTauTPThinningTool
    thinningTools.append(TOPQTauTPThinningTool)
    print(TOPQname + ".py", TOPQname + "TauTPThinningTool: ",
          TOPQTauTPThinningTool)

    #  #==============================
    #  # Large-R jet thinning
    #  #==============================
    #
    #  # we remove low pT large-R jets from the various collections
    #  from AthenaCommon.GlobalFlags import globalflags
    #  largeRjetCollsToThin = ["AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"]
    #  if globalflags.DataSource()=='geant4':
    #    largeRjetCollsToThin.append("AntiKt10TruthTrimmedPtFrac5SmallR20Jets")
    #    largeRjetCollsToThin.append("AntiKt10TruthJets")
    #  from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__GenericObjectThinning
    #  for largeRjetColl in largeRjetCollsToThin:
    #    #pTvariableToCutOn = ".DFCommonJets_Calib_pt" # use calibrated pT for reco jets
    #    pTvariableToCutOn = ".pt" # well for now the uncalibrated pT seems a more reasonable option
    #    # use normal pT for truth jets
    #    if largeRjetColl.find('Truth') > -1:
    #      pTvariableToCutOn = ".pt"
    #    TOPQLargeRJetThinning = DerivationFramework__GenericObjectThinning(
    #      name = TOPQname + largeRjetColl + "Thinning_LargeR",
    #      StreamName              = streamName,
    #      ContainerName    = largeRjetColl,
    #      SelectionString  = largeRjetColl + pTvariableToCutOn + " > 150.0*GeV")
    #    ToolSvc += TOPQLargeRJetThinning
    #    thinningTools.append(TOPQLargeRJetThinning)
    #    print (TOPQname+".py", TOPQname+largeRjetColl+"Thinning: ", TOPQLargeRJetThinning)

    #==============================
    # Photon thinning
    #==============================

    # we remove photons below 9GeV
    from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__GenericObjectThinning
    pTPhotonVariableToCutOn = ".pt"
    photonColl = "Photons"
    TOPQPhotonThinning = DerivationFramework__GenericObjectThinning(
        name=TOPQname + photonColl + "Thinning_lowpTphotons",
        StreamName=streamName,
        ContainerName=photonColl,
        SelectionString=photonColl + ".pt > 9.0*GeV")
    ToolSvc += TOPQPhotonThinning
    thinningTools.append(TOPQPhotonThinning)
    print(TOPQname + ".py", TOPQname + photonColl + "Thinning: ",
          TOPQPhotonThinning)

    #==============================================
    # TRUTH THINNING
    #==============================================
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.DataSource() == 'geant4':
        #==========================
        # MENU TRUTH THINNING
        #==========================
        from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning
        TOPQTruthThinningTool = DerivationFramework__MenuTruthThinning(
            name=TOPQname + "TruthThinningTool",
            StreamName=streamName,
            ParticlesKey="TruthParticles",
            VerticesKey="TruthVertices",
            EventsKey="TruthEvents",
            WritePartons=True,  # keep partons?  ###maybe set to FALSE?
            WriteHadrons=False,  # keep hadrons?
            WriteBHadrons=False,  # keep b-hadrons?
            WriteGeant=False,  # keep Geant particles?
            GeantPhotonPtThresh=
            -1.0,  # Set to <0 to not write any Geant photons; otherwise write with a pT above threshold
            WriteTauHad=True,  # keep hadronic taus?
            PartonPtThresh=-1.0,  # write partons with pT aboe this threhold
            WriteBSM=True,  # keep BSM particles?
            WriteBSMProducts=True,  # keep BSM particle decay products?
            WriteBosons=True,  # keep bosons?
            WriteBosonProducts=True,  # keep boson decay products?
            WriteTopAndDecays=
            True,  # keep top partons and immediate decay products?
            WriteEverything=False,  # keep everything?; overrides all other flags
            WriteAllLeptons=True,  # keep absolutely all leptons?
            WriteLeptonsNotFromHadrons=
            False,  # keep leptons not from hadron decays
            WriteAllStable=
            True,  # keep all stable particles?   ###maybe set to FALSE?
            WriteStatus3=False,  # keep all particles with status code 3?
            WriteFirstN=10,  # keep first N particles in record
            PreserveDescendants=False,  # keep descendants of retained particles?
            PreserveAncestors=True,  # keep ancestors of retained particles?
            SimBarcodeOffset=200000,  # barcode offset for simulation particles
            WritettHFHadrons=True)  # keep tt+HF hadrons

        ToolSvc += TOPQTruthThinningTool
        thinningTools.append(TOPQTruthThinningTool)
        print(TOPQname + ".py", TOPQname + "TruthThinningTool: ",
              TOPQTruthThinningTool)

        #==============================================================================
        # Thinning the photon truth collection : no photons from pi0 (origin=42)
        #==============================================================================
        # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/GenericTruthThinning.cxx
        from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
        TOPQPhotonThinning = DerivationFramework__GenericTruthThinning(
            name=TOPQname + "PhotonThinning",
            StreamName=streamName,
            ParticlesKey="TruthPhotons",
            ParticleSelectionString=
            "(TruthPhotons.classifierParticleOrigin != 42) || (TruthPhotons.pt > 20.0*GeV)"
        )

        ToolSvc += TOPQPhotonThinning
        thinningTools.append(TOPQPhotonThinning)
        print(TOPQname + ".py", TOPQname + "PhotonThinning: ",
              TOPQPhotonThinning)

        #==============================================================================
        # Thinning TruthParticles : no gluons
        #==============================================================================
        ## PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/GenericTruthThinning.cxx
        #from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
        #TOPQGluonThinning = DerivationFramework__GenericTruthThinning(
        #                      name                    = TOPQname + "GluonThinning",
        #                      StreamName              = streamName,
        #                      ParticlesKey            = "TruthParticles",
        #                      ParticleSelectionString = "(TruthParticles.pdgId  != 21)")

        #ToolSvc += TOPQGluonThinning
        #thinningTools.append(TOPQGluonThinning)
        #print (TOPQname+".py", TOPQname+"GluonThinning: ", TOPQGluonThinning)

    return thinningTools
Example #8
0
                                                                 WriteTauHad                = False,
                                                                 PartonPtThresh             = -1.0,
                                                                 WriteBSM                   = True,
                                                                 WriteBosons                = True,
                                                                 WriteBSMProducts           = True,
                                                                 WriteTopAndDecays          = True,
                                                                 WriteEverything            = False,
                                                                 WriteAllLeptons            = False,
                                                                 WriteLeptonsNotFromHadrons = True,
                                                                 WriteStatus3               = False,
                                                                 WriteFirstN                = -1,
                                                                 PreserveDescendants        = True)

from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
EXOT11GenThinningTool = DerivationFramework__GenericTruthThinning( name = "EXOT11GenThinningTool",
                                                                   ThinningService = "EXOT11ThinningSvc",
                                                                   ParticleSelectionString = "abs(TruthParticles.pdgId) ==34 || abs(TruthParticles.pdgId)==5100039", 
                                                                   PreserveDescendants = False)

if isMC:
  ToolSvc += EXOT11MenuHadThinningTool
  thinningTools.append(EXOT11MenuHadThinningTool)
  ToolSvc += EXOT11MenuThinningTool
  thinningTools.append(EXOT11MenuThinningTool)
  ToolSvc += EXOT11GenThinningTool
  thinningTools.append(EXOT11GenThinningTool)

#=======================================
# SKIMMING TOOL   
#=======================================

#trig = " (HLT_e28_tight_iloose || HLT_e60_medium1)|| (HLT_mu26_imedium || HLT_mu50) "
Example #9
0
thinningTools.append(HIGG2D2MuonCCThinningTool)

# Truth particles
useGenericTruthThinning = True
if useGenericTruthThinning:
    truth_cond_WZH    = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs
    truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons
    truth_cond_Quark  = "((abs(TruthParticles.pdgId) ==  6))"                                      # Top quark
    truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 1*GeV))"       # Photon

    truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark +' || '+truth_cond_Photon+')'

    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
    HIGG2D2TruthThinningTool = DerivationFramework__GenericTruthThinning(name                         = "HIGG2D2TruthThinningTool", 
                                                                         StreamName                   = streamName,
                                                                         ParticleSelectionString      = truth_expression,
                                                                         PreserveDescendants          = False,
                                                                         PreserveGeneratorDescendants = True,
                                                                         PreserveAncestors            = True)
else:
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning
    HIGG2D2TruthThinningTool = DerivationFramework__MenuTruthThinning(name                         = "HIGG2D2TruthThinningTool",
                                                                      StreamName                   = streamName,
                                                                      WritePartons                 = False,
                                                                      WriteHadrons                 = False,
                                                                      WriteBHadrons                = True,
                                                                      WriteGeant                   = False,
                                                                      GeantPhotonPtThresh          = -1.0,
                                                                      WriteTauHad                  = True,
                                                                      PartonPtThresh               = -1.0,
                                                                      WriteBSM                     = True,
                                                                      WriteBosons                  = True,
Example #10
0
preserveAllDescendants = False
from AthenaCommon.GlobalFlags import globalflags
if doTruthThinning and globalflags.DataSource()=='geant4':
    truth_cond_WZH    = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"           # W, Z and Higgs
    truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"           # Leptons
    truth_cond_Quark  = "((abs(TruthParticles.pdgId) <=  6))"                                                # Quarks
    truth_cond_Gluon  = "((abs(TruthParticles.pdgId) == 21))"                                                # Gluons
    truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 10000.))"                # Photon
    
    truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark+'||'+truth_cond_Gluon+' || '+truth_cond_Photon+')'
    
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
    STDM1TruthThinningTool = DerivationFramework__GenericTruthThinning( name = "STDM1TruthThinningTool",
                                                                        ThinningService        = "STDM1ThinningSvc",
                                                                        ParticlesKey = "TruthParticles",
                                                                        VerticesKey = "TruthVertices",
                                                                        ParticleSelectionString = truth_expression,
                                                                        PreserveDescendants     = preserveAllDescendants,
                                                                        PreserveGeneratorDescendants = not preserveAllDescendants,
                                                                        PreserveAncestors = True)
    
    ToolSvc += STDM1TruthThinningTool
    thinningTools.append(STDM1TruthThinningTool)


#=======================================
# CREATE THE DERIVATION KERNEL ALGORITHM   
#=======================================

stdm1Seq = CfgMgr.AthSequencer("STDM1Sequence")
from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
stdm1Seq += CfgMgr.DerivationFramework__DerivationKernel("STDM1Kernel",SkimmingTools=skimmingTools,ThinningTools=thinningTools)
Example #11
0
ToolSvc += HIGG3D1TPThinningTool
thinningTools.append(HIGG3D1TPThinningTool)

# Truth particles
truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"  # W, Z and Higgs
truth_cond2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"  # Leptons
truth_cond3 = "(abs(TruthParticles.pdgId) == 6)"  # Top quark
truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))"  # Photon

truth_expression = truth_cond1 + ' || ' + truth_cond2 + ' || ' + truth_cond3 + ' || ' + truth_cond4

from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
HIGG3D1TruthThinningTool = DerivationFramework__GenericTruthThinning(
    name="HIGG3D1TruthThinningTool",
    ThinningService=HIGG3D1ThinningHelper.ThinningSvc(),
    ParticleSelectionString=truth_expression,
    PreserveDescendants=True,
    PreserveAncestors=True,
    SimBarcodeOffset=DerivationFrameworkSimBarcodeOffset)

if globalflags.DataSource() == 'geant4':
    ToolSvc += HIGG3D1TruthThinningTool
    thinningTools.append(HIGG3D1TruthThinningTool)

#====================================================================
# SKIMMING TOOL
#====================================================================
electronIDRequirements = '(Electrons.DFCommonElectronsLHLoose)'
electronRequirements = '(Electrons.pt > 7*GeV) && (abs(Electrons.eta) < 2.6)'
leadElectron = electronRequirements + ' && (Electrons.pt > 17*GeV)'
muonsRequirements = '(Muons.pt > 7*GeV) && (Muons.DFCommonGoodMuon)'
Example #12
0
def setup(HIGG4DxName, streamName, ToolSvc):
    thinningTools = []

    #jets and tracks
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning
    HIGG4DxJetTPThinningTool = DerivationFramework__JetTrackParticleThinning(
        name=HIGG4DxName + "JetTPThinningTool",
        StreamName=streamName,
        JetKey="AntiKt4EMTopoJets",
        SelectionString="AntiKt4EMTopoJets.pt > 18*GeV",
        InDetTrackParticlesKey="InDetTrackParticles",
        ApplyAnd=True)
    ToolSvc += HIGG4DxJetTPThinningTool
    thinningTools.append(HIGG4DxJetTPThinningTool)

    HIGG4DxJetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning(
        name=HIGG4DxName + "JetLCTPThinningTool",
        StreamName=streamName,
        JetKey="AntiKt4LCTopoJets",
        SelectionString="AntiKt4LCTopoJets.pt > 18*GeV",
        InDetTrackParticlesKey="InDetTrackParticles",
        ApplyAnd=True)
    ToolSvc += HIGG4DxJetLCTPThinningTool
    thinningTools.append(HIGG4DxJetLCTPThinningTool)

    #fat jets and track thinning
    if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']:
        from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning
        HIGG4DxJetTrackThinningTool1 = DerivationFramework__JetTrackParticleThinning(
            name=HIGG4DxName + "JetTrackThinningTool1",
            StreamName=streamName,
            JetKey="AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
            SelectionString=
            "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 150*GeV",
            InDetTrackParticlesKey="InDetTrackParticles",
            ApplyAnd=True)
        ToolSvc += HIGG4DxJetTrackThinningTool1
        thinningTools.append(HIGG4DxJetTrackThinningTool1)

    if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']:
        from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning
        HIGG4DxJetTrackThinningTool2 = DerivationFramework__JetTrackParticleThinning(
            name=HIGG4DxName + "JetTrackThinningTool2",
            StreamName=streamName,
            JetKey="AntiKt2PV0TrackJets",
            SelectionString="AntiKt2PV0TrackJets.pt > 6*GeV",
            InDetTrackParticlesKey="InDetTrackParticles",
            ApplyAnd=True)
        #ToolSvc += HIGG4DxJetTrackThinningTool2
        #thinningTools.append(HIGG4DxJetTrackThinningTool2)

    # Tracks associated with Muons
    HIGG4DxMuonSelectionString = ""
    if HIGG4DxName in ['HIGG4D3', 'HIGG4D4']:
        HIGG4DxMuonSelectionString = "Muons.pt > 1*GeV"
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning
    HIGG4DxMuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(
        name=HIGG4DxName + "MuonTPThinningTool",
        StreamName=streamName,
        MuonKey="Muons",
        SelectionString=HIGG4DxMuonSelectionString,
        InDetTrackParticlesKey="InDetTrackParticles")
    ToolSvc += HIGG4DxMuonTPThinningTool
    thinningTools.append(HIGG4DxMuonTPThinningTool)

    # Tracks associated with Electrons
    HIGG4DxElectronSelectionString = ""
    if HIGG4DxName in ['HIGG4D3', 'HIGG4D4']:
        HIGG4DxElectronSelectionString = "Electrons.pt > 1*GeV"
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning
    HIGG4DxElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(
        name=HIGG4DxName + "ElectronTPThinningTool",
        StreamName=streamName,
        SGKey="Electrons",
        SelectionString=HIGG4DxElectronSelectionString,
        InDetTrackParticlesKey="InDetTrackParticles")
    ToolSvc += HIGG4DxElectronTPThinningTool
    thinningTools.append(HIGG4DxElectronTPThinningTool)

    # Tracks associated with taus
    HIGG4DxTauSelectionString = "TauJets.pt > 18*GeV"
    if HIGG4DxName == 'HIGG4D4':
        HIGG4DxTauSelectionString = "TauJets.pt > 40*GeV"
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning
    HIGG4DxTauTPThinningTool = DerivationFramework__TauTrackParticleThinning(
        name=HIGG4DxName + "TauTPThinningTool",
        StreamName=streamName,
        TauKey="TauJets",
        SelectionString=HIGG4DxTauSelectionString,
        ConeSize=0.6,
        InDetTrackParticlesKey="InDetTrackParticles")
    ToolSvc += HIGG4DxTauTPThinningTool
    thinningTools.append(HIGG4DxTauTPThinningTool)

    #Truth tau/nutau and their ancestors and descendants
    truth_cond_tau = "((abs(TruthParticles.pdgId) == 15 || abs(TruthParticles.pdgId) == 16) && (TruthParticles.pt > 0.01*GeV) && (TruthParticles.barcode<200000))"
    truth_cond_lep = "((abs(TruthParticles.pdgId) >= 11 && abs(TruthParticles.pdgId) <= 14) && (TruthParticles.pt > 4.0*GeV) && (TruthParticles.status == 1) && (TruthParticles.barcode<200000))"
    truth_cond_comb = "(" + truth_cond_lep + "||" + truth_cond_tau + ")"

    #truth_photon_thinning = "(TruthPhotons.pt > 1.0*GeV) && (abs(TruthPhotons.eta)<3.0)"
    # PreserveGeneratorDescendants only keeps particles that came directly from the event generator
    # PreserveDescendants keeps all particles including those that come from Geant processes

    if DFisMC:
        #thin special containers
        from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
        #thin taus
        HIGG4DxTruthTool_TAU = DerivationFramework__GenericTruthThinning(
            name=HIGG4DxName + "TruthTool_TAU",
            StreamName=streamName,
            ParticleSelectionString=truth_cond_tau,
            PreserveDescendants=False,
            PreserveGeneratorDescendants=True,
            PreserveAncestors=False,
            TauHandling=False)
        ToolSvc += HIGG4DxTruthTool_TAU
        thinningTools.append(HIGG4DxTruthTool_TAU)

        #thin leptons and taus
        HIGG4DxTruthTool_COMB = DerivationFramework__GenericTruthThinning(
            name=HIGG4DxName + "TruthTool_COMB",
            StreamName=streamName,
            ParticleSelectionString=truth_cond_comb,
            PreserveDescendants=False,
            PreserveGeneratorDescendants=False,
            PreserveAncestors=True,
            TauHandling=False)

        ToolSvc += HIGG4DxTruthTool_COMB
        thinningTools.append(HIGG4DxTruthTool_COMB)

        #thin photons
        """HIGG4DxTruthTool_PHO = DerivationFramework__GenericTruthThinning(name                    = "HIGG4DxTruthTool_PHO",
                                                                     StreamName              = streamName,
                                                                     ParticlesKey            = "TruthPhotons",
                                                                     ParticleSelectionString = truth_photon_thinning)
    
                                                                     ToolSvc += HIGG4DxTruthTool_PHO
                                                                     thinningTools.append(HIGG4DxTruthTool_PHO)"""

        #thinning the master truth collection
        from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning
        HIGG4DxTruthTool_MENU = DerivationFramework__MenuTruthThinning(
            name=HIGG4DxName + "TruthTool_MENU",
            StreamName=streamName,
            WritePartons=False,
            WriteHadrons=False,
            WriteBHadrons=False,
            WriteGeant=False,
            GeantPhotonPtThresh=-1.0,
            WriteTauHad=False,
            PartonPtThresh=-1.0,
            WriteBSM=False,
            WriteBosons=False,
            WriteBSMProducts=False,
            WriteBosonProducts=False,
            WriteTopAndDecays=False,
            WriteEverything=False,
            WriteAllLeptons=False,
            WriteStatus3=False,
            PreserveDescendants=False,
            PreserveGeneratorDescendants=False,
            PreserveAncestors=True,
            WriteFirstN=15)

        ToolSvc += HIGG4DxTruthTool_MENU
        thinningTools.append(HIGG4DxTruthTool_MENU)
    #end of MC

    # return thinning tools
    return thinningTools
Example #13
0
#================
thinningTools = []

# Truth particles
truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"  # W, Z and Higgs
truth_cond2 = "((abs(TruthParticles.pdgId) == 11) && (TruthParticles.status == 1) && (TruthParticles.pt > 10*GeV))"  # Electron
truth_cond3 = "((abs(TruthParticles.pdgId) >= 1) && (abs(TruthParticles.pdgId) <= 6))"  # Partons
truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))"  # Photon

truth_expression = truth_cond1 + ' || ' + truth_cond2 + ' || ' + truth_cond3 + ' || ' + truth_cond4

from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
HIGG3D2TruthParticlesThinningTool = DerivationFramework__GenericTruthThinning(
    name="HIGG3D2TruthParticlesThinningTool",
    ThinningService="HIGG3D2ThinningSvc",
    ParticlesKey="TruthParticles",
    ParticleSelectionString=truth_expression,
    PreserveDescendants=False,
    PreserveAncestors=False)

if globalflags.DataSource() == 'geant4':
    ToolSvc += HIGG3D2TruthParticlesThinningTool
    thinningTools.append(HIGG3D2TruthParticlesThinningTool)

#=======================================
# CREATE THE DERIVATION KERNEL ALGORITHM
#=======================================
from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel(
    "HIGG3D2Kernel", ThinningTools=thinningTools)
Example #14
0
    WriteAllLeptons=False,
    WriteStatus3=False,
    PreserveDescendants=False,
    PreserveGeneratorDescendants=False,
    PreserveAncestors=True,
    WriteFirstN=10)
ToolSvc += TRUTH5TruthThinning

#==============================================================================
# Thinning the photon truth collection : no photons from pi0 (origin=42)
#==============================================================================
from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
TRUTH5PhotonThinning = DerivationFramework__GenericTruthThinning(
    name="TRUTH5PhotonThinning",
    StreamName=streamName,
    ParticlesKey="TruthPhotons",
    ParticleSelectionString=
    "(TruthPhotons.classifierParticleOrigin != 42) || (TruthPhotons.pt > 20.0*GeV)"
)
ToolSvc += TRUTH5PhotonThinning

#==============================================================================
# Create the derivation kernel algorithm
#==============================================================================
from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel(
    "TRUTH5Kernel",
    AugmentationTools=[
        DFCommonTruthClassificationTool, DFCommonTruthMuonTool,
        DFCommonTruthElectronTool, DFCommonTruthPhotonTool,
        DFCommonTruthTauTool, DFCommonTruthNeutrinoTool,
Example #15
0
preserveAllDescendants = False
from AthenaCommon.GlobalFlags import globalflags
if doTruthThinning and DerivationFrameworkIsMonteCarlo:
    truth_cond_WZH = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"  # W, Z and Higgs
    truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"  # Leptons
    truth_cond_Quark = "((abs(TruthParticles.pdgId) <=  5  && (TruthParticles.pt > 10000.)) || (abs(TruthParticles.pdgId) == 6))"  # Quarks
    truth_cond_Gluon = "((abs(TruthParticles.pdgId) == 21) && (TruthParticles.pt > 10000.))"  # Gluons
    truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 10000.) && (TruthParticles.barcode < 200000))"  # Photon

    truth_expression = '(' + truth_cond_WZH + ' || ' + truth_cond_Lepton + ' || ' + truth_cond_Quark + '||' + truth_cond_Gluon + ' || ' + truth_cond_Photon + ')'

    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
    JETM7TruthThinningTool = DerivationFramework__GenericTruthThinning(
        name="JETM7TruthThinningTool",
        StreamName=streamName,
        ParticleSelectionString=truth_expression,
        PreserveDescendants=preserveAllDescendants,
        PreserveGeneratorDescendants=not preserveAllDescendants,
        PreserveAncestors=True)

    ToolSvc += JETM7TruthThinningTool
    thinningTools.append(JETM7TruthThinningTool)

#=======================================
# CREATE PRIVATE SEQUENCE
#=======================================

jetm7Seq = CfgMgr.AthSequencer("JETM7Sequence")
DerivationFrameworkJob += jetm7Seq

#=======================================
Example #16
0
    InDetTrackParticlesKey="InDetTrackParticles")
ToolSvc += SUSY11TauTPThinningTool
thinningTools.append(SUSY11TauTPThinningTool)

#====================================================================
# TRUTH THINNING
#====================================================================

if DerivationFrameworkIsMonteCarlo:
    truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))"  # Leptons

    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
    SUSY11TruthThinningTool = DerivationFramework__GenericTruthThinning(
        name="SUSY11TruthThinningTool",
        ThinningService=SUSY11ThinningHelper.ThinningSvc(),
        ParticleSelectionString=truth_cond_Lepton,
        PreserveDescendants=True,
        PreserveGeneratorDescendants=False,
        SimBarcodeOffset=DerivationFrameworkSimBarcodeOffset)
    ToolSvc += SUSY11TruthThinningTool
    thinningTools.append(SUSY11TruthThinningTool)

#====================================================================
# TRIGGER SKIMMING
#====================================================================

jettrig = '( HLT_j15 || HLT_j25 || HLT_j35 || HLT_j55 || HLT_j60 || HLT_j85 || HLT_j110 || HLT_j150 || HLT_j175 || HLT_j200 || HLT_j260 || HLT_j300 || HLT_j320 || HLT_j360 || HLT_j380 || HLT_j400 || HLT_j420 || HLT_j440 || HLT_j460)'

from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool

SUSY11SkimmingTool = DerivationFramework__xAODStringSkimmingTool(
Example #17
0
    WriteBosons=False,
    WriteBSMProducts=False,
    WriteTopAndDecays=True,
    WriteEverything=False,
    WriteAllLeptons=False,
    WriteLeptonsNotFromHadrons=False,
    WriteStatus3=False,
    WriteFirstN=10,
    PreserveDescendants=False,
    PreserveAncestors=True)

#
from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
EXOT7MCGenThinningTool = DerivationFramework__GenericTruthThinning(
    name="EXOT7MCGenThinningTool",
    StreamName=streamName,
    ParticleSelectionString=
    "abs(TruthParticles.pdgId) ==25 || abs(TruthParticles.pdgId)==39 || abs(TruthParticles.pdgId)==32 || abs(TruthParticles.pdgId)==5100021",
    PreserveDescendants=False)

from AthenaCommon.GlobalFlags import globalflags
if globalflags.DataSource() == 'geant4':
    ToolSvc += EXOT7MCThinningTool
    thinningTools.append(EXOT7MCThinningTool)
    ToolSvc += EXOT7TMCThinningTool
    thinningTools.append(EXOT7TMCThinningTool)
    ToolSvc += EXOT7TAMCThinningTool
    thinningTools.append(EXOT7TAMCThinningTool)
    ToolSvc += EXOT7MCGenThinningTool
    thinningTools.append(EXOT7MCGenThinningTool)

#=======================================
Example #18
0
    WriteAllLeptons=True,
    WriteStatus3=False,
    PreserveDescendants=False,
    PreserveGeneratorDescendants=False,
    PreserveAncestors=True,
    WriteFirstN=10)
ToolSvc += TRUTH1TruthThinning

#==============================================================================
# Thinning the photon truth collection : no photons from pi0 (origin=42)
#==============================================================================
from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
TRUTH1PhotonThinning = DerivationFramework__GenericTruthThinning(
    name="TRUTH1PhotonThinning",
    ThinningService="TRUTH1ThinningSvc",
    ParticlesKey="TruthPhotons",
    ParticleSelectionString=
    "(TruthPhotons.classifierParticleOrigin != 42) || (TruthPhotons.pt > 20.0*GeV)"
)
ToolSvc += TRUTH1PhotonThinning

#Let's save the post-shower HT and MET filter values that will make combining filtered samples easier (adds to the EventInfo)
SUSYGenFilt_MCTruthClassifier = MCTruthClassifier(
    name="SUSYGenFilt_MCTruthClassifier", ParticleCaloExtensionTool="")
ToolSvc += SUSYGenFilt_MCTruthClassifier
GenFilter = CfgMgr.DerivationFramework__SUSYGenFilterTool("MTandHTGenFilt", )
ToolSvc += GenFilter

#==============================================================================
# Create the derivation kernel algorithm
#==============================================================================
Example #19
0
thinningTools= [STDM5JetTPThinningTool,STDM5MuonTPThinningTool,STDM5ElectronTPThinningTool,STDM5TauTPThinningTool]

if globalflags.DataSource()=='geant4':
    from DerivationFrameworkSM.STDMCommonTruthTools import *

    #TruthThinning
    # Truth leptons and their ancestors and descendants

    truth_cond_boson = "((abs(TruthParticles.pdgId) == 23) || (abs(TruthParticles.pdgId) == 24))"
    truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 14) &&(TruthParticles.pt > 1*GeV) && (TruthParticles.status ==1) && (TruthParticles.barcode<200000))"
    photonthinningexpr = "(TruthPhotons.classifierParticleOrigin != 42) && !(TruthPhotons.classifierParticleOrigin >= 23 && TruthPhotons.classifierParticleOrigin <= 35)"

    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
    STDM5TruthLepTool = DerivationFramework__GenericTruthThinning(name                         = "STDM5TruthLepTool", 
                                                                  ThinningService              = STDM5ThinningHelper.ThinningSvc(),
                                                                  ParticleSelectionString      = truth_cond_Lepton,
                                                                  PreserveDescendants          = False,
                                                                  PreserveGeneratorDescendants = False,
                                                                  PreserveAncestors            = True)
    
    STDM5PhotonThinning = DerivationFramework__GenericTruthThinning(name                    = "STDM5PhotonThinning",
                                                                    ThinningService         = STDM5ThinningHelper.ThinningSvc(),
                                                                    ParticlesKey            = "TruthPhotons", 
                                                                    ParticleSelectionString = photonthinningexpr)
    
    STDM5TruthBosTool = DerivationFramework__GenericTruthThinning(name                         = "STDM5TruthBosTool",
                                                                  ThinningService              = STDM5ThinningHelper.ThinningSvc(),
                                                                  ParticleSelectionString      = truth_cond_boson,
                                                                  PreserveDescendants          = False,
                                                                  PreserveGeneratorDescendants = True,
                                                                  PreserveAncestors            = False)
Example #20
0
def setup(TOPQname, TOPQThinningSvc, ToolSvc):
    thinningTools = []

    #========================
    # Track Particle Thinning !!! BUGGY (yes, that's a technical term)...CURRENTLY NOT USING !!!
    #========================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/TrackParticleThinning.cxx
    thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)"
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning
    TOPQTPThinningTool = DerivationFramework__TrackParticleThinning(
        name=TOPQname + "TPThinningTool",
        ThinningService=TOPQThinningSvc,
        SelectionString=thinning_expression,
        InDetTrackParticlesKey="InDetTrackParticles",
        ApplyAnd=False)

    #ToolSvc += TOPQTPThinningTool
    #thinningTools.append(TOPQTPThinningTool)
    #print TOPQname+".py", TOPQname+"TPThinningTool: ", TOPQTPThinningTool

    #============================
    # Jet Track Particle Thinning
    #============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/JetTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning
    TOPQJetTPThinningTool = DerivationFramework__JetTrackParticleThinning(
        name=TOPQname + "JetTPThinningTool",
        ThinningService=TOPQThinningSvc,
        JetKey="AntiKt4EMTopoJets",
        InDetTrackParticlesKey="InDetTrackParticles",
        ApplyAnd=False)

    ToolSvc += TOPQJetTPThinningTool
    thinningTools.append(TOPQJetTPThinningTool)
    print TOPQname + ".py", TOPQname + "JetTPThinningTool: ", TOPQJetTPThinningTool

    #=================================
    # Electron Track Particle Thinning
    #=================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/EgammaTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning
    TOPQElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(
        name=TOPQname + "ElectronTPThinningTool",
        ThinningService=TOPQThinningSvc,
        SGKey="Electrons",
        InDetTrackParticlesKey="InDetTrackParticles",
        ApplyAnd=False)

    ToolSvc += TOPQElectronTPThinningTool
    thinningTools.append(TOPQElectronTPThinningTool)
    print TOPQname + ".py", TOPQname + "ElectronTPThinningTool: ", TOPQElectronTPThinningTool

    #===============================
    # Electron Calo Cluster Thinning
    #===============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/trunk/src/CaloClusterThinning.cxx
    from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning
    TOPQElectronCCThinningTool = DerivationFramework__CaloClusterThinning(
        name=TOPQname + "ElectronCCThinningTool",
        ThinningService=TOPQThinningSvc,
        SGKey="Electrons",
        CaloClCollectionSGKey="egammaClusters",
        SelectionString=
        "(Electrons.Loose || Electrons.DFCommonElectronsLHLoose)",
        ConeSize=0.4,
        ApplyAnd=False)

    ToolSvc += TOPQElectronCCThinningTool
    thinningTools.append(TOPQElectronCCThinningTool)
    print TOPQname + ".py", TOPQname + "ElectronCCThinningTool: ", TOPQElectronCCThinningTool

    #===============================
    # Photon Calo Cluster Thinning
    #===============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkCalo/trunk/src/CaloClusterThinning.cxx
    from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning
    TOPQPhotonCCThinningTool = DerivationFramework__CaloClusterThinning(
        name=TOPQname + "PhotonCCThinningTool",
        ThinningService=TOPQThinningSvc,
        SGKey="Photons",
        CaloClCollectionSGKey="egammaClusters",
        SelectionString="(Photons.Loose || Photons.DFCommonPhotonsIsEMLoose)",
        ConeSize=0.4,
        ApplyAnd=False)

    ToolSvc += TOPQPhotonCCThinningTool
    thinningTools.append(TOPQPhotonCCThinningTool)
    print TOPQname + ".py", TOPQname + "PhotonCCThinningTool: ", TOPQPhotonCCThinningTool

    #=============================
    # Muon Track Particle Thinning
    #=============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/MuonTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning
    TOPQMuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(
        name=TOPQname + "MuonTPThinningTool",
        ThinningService=TOPQThinningSvc,
        MuonKey="Muons",
        InDetTrackParticlesKey="InDetTrackParticles",
        ApplyAnd=False)

    ToolSvc += TOPQMuonTPThinningTool
    thinningTools.append(TOPQMuonTPThinningTool)
    print TOPQname + ".py", TOPQname + "MuonTPThinningTool: ", TOPQMuonTPThinningTool

    #============================
    # Tau Track Particle Thinning
    #============================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/trunk/src/TauTrackParticleThinning.cxx
    from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning
    TOPQTauTPThinningTool = DerivationFramework__TauTrackParticleThinning(
        name=TOPQname + "TauTPThinningTool",
        ThinningService=TOPQThinningSvc,
        TauKey="TauJets",
        ConeSize=0.6,
        InDetTrackParticlesKey="InDetTrackParticles",
        ApplyAnd=False)

    ToolSvc += TOPQTauTPThinningTool
    thinningTools.append(TOPQTauTPThinningTool)
    print TOPQname + ".py", TOPQname + "TauTPThinningTool: ", TOPQTauTPThinningTool

    #==============================================
    # TRUTH THINNING
    #==============================================
    from AthenaCommon.GlobalFlags import globalflags
    if globalflags.DataSource() == 'geant4':
        #==========================
        # MENU TRUTH THINNING
        #==========================
        from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__MenuTruthThinning
        TOPQTruthThinningTool = DerivationFramework__MenuTruthThinning(
            name=TOPQname + "TruthThinningTool",
            ThinningService=TOPQThinningSvc,
            ParticlesKey="TruthParticles",
            VerticesKey="TruthVertices",
            EventsKey="TruthEvents",
            WritePartons=True,  # keep partons?  ###maybe set to FALSE?
            WriteHadrons=False,  # keep hadrons?
            WriteBHadrons=False,  # keep b-hadrons?
            WriteGeant=False,  # keep Geant particles?
            GeantPhotonPtThresh=
            -1.0,  # Set to <0 to not write any Geant photons; otherwise write with a pT above threshold
            WriteTauHad=True,  # keep hadronic taus?
            PartonPtThresh=-1.0,  # write partons with pT aboe this threhold
            WriteBSM=True,  # keep BSM particles?
            WriteBSMProducts=True,  # keep BSM particle decay products?
            WriteBosons=True,  # keep bosons?
            WriteBosonProducts=True,  # keep boson decay products?
            WriteTopAndDecays=
            True,  # keep top partons and immediate decay products?
            WriteEverything=False,  # keep everything?; overrides all other flags
            WriteAllLeptons=True,  # keep absolutely all leptons?
            WriteLeptonsNotFromHadrons=
            False,  # keep leptons not from hadron decays
            WriteAllStable=
            True,  # keep all stable particles?   ###maybe set to FALSE?
            WriteStatus3=False,  # keep all particles with status code 3?
            WriteFirstN=10,  # keep first N particles in record
            PreserveDescendants=False,  # keep descendants of retained particles?
            PreserveAncestors=True,  # keep ancestors of retained particles?
            SimBarcodeOffset=200000,  # barcode offset for simulation particles
            WritettHFHadrons=True)  # keep tt+HF hadrons

        ToolSvc += TOPQTruthThinningTool
        thinningTools.append(TOPQTruthThinningTool)
        print TOPQname + ".py", TOPQname + "TruthThinningTool: ", TOPQTruthThinningTool

        #==============================================================================
        # Thinning the photon truth collection : no photons from pi0 (origin=42)
        #==============================================================================
        # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/GenericTruthThinning.cxx
        from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
        TOPQPhotonThinning = DerivationFramework__GenericTruthThinning(
            name=TOPQname + "PhotonThinning",
            ThinningService=TOPQThinningSvc,
            ParticlesKey="TruthPhotons",
            ParticleSelectionString=
            "(TruthPhotons.classifierParticleOrigin != 42) || (TruthPhotons.pt > 20.0*GeV)"
        )

        ToolSvc += TOPQPhotonThinning
        thinningTools.append(TOPQPhotonThinning)
        print TOPQname + ".py", TOPQname + "PhotonThinning: ", TOPQPhotonThinning

        #==============================================================================
        # Thinning TruthParticles : no gluons
        #==============================================================================
        ## PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/GenericTruthThinning.cxx
        #from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
        #TOPQGluonThinning = DerivationFramework__GenericTruthThinning(
        #                      name                    = TOPQname + "GluonThinning",
        #                      ThinningService         = TOPQThinningSvc,
        #                      ParticlesKey            = "TruthParticles",
        #                      ParticleSelectionString = "(TruthParticles.pdgId  != 21)")

        #ToolSvc += TOPQGluonThinning
        #thinningTools.append(TOPQGluonThinning)
        #print TOPQname+".py", TOPQname+"GluonThinning: ", TOPQGluonThinning

    return thinningTools