コード例 #1
0
def setupTruthJets(myjetfinder, myjetdr, GroomedDicts, theseq):
  if rec.doTruth():

    myGroomingTools, catNames = getGroomingTools(GroomedDicts)    
      
    sortertool = JetSorterTool('JS_JetSorter', SortOrder="ByPtDown", OutputLevel=3 )
    widthtool = JetWidthTool('JS_JetWidthTool')

    assoc_tools = [ JetSubStructure.GhostJetJetAssociatorTool("myTruthGhostJetJetAssociatorTool", JetdR = myjetdr, JetFinder = myjetfinder, JetInputTool = getStandardInputTools(input='Truth')[0],OutputLevel=3) ]

    assoc_tool_truth = JetSubStructure.JetAssociationTool(
                        name = 'JetAssocToolTruth',
                        AssociatorTools = assoc_tools, Area = True,
                        GroomingTools = myGroomingTools, UsedSignalState = 2,
                        JetAlgTools = [sortertool,widthtool], OutputLevel = 3
                       )

    jetsubstructure_tool_truth = JetSubStructure.JetSubstructureTool( 
                                  name = 'JetSubstructureToolTruth', UsedSignalState = 2, OutputLevel=3,
                                  SubstructureTools = [JetSubStructure.NSubjettinessTool("myNSubjettinessTool", N=[1,2,3], R0=myjetdr, GroomedjetsAuthor = catNames),
                                              JetSubStructure.KtHadSubstructureTool("myhadtool", GroomedjetsAuthor = catNames),
                                              JetSubStructure.DipolarityTool("myDipolarityTool",GroomedjetsAuthor = catNames),
                                              JetSubStructure.JetVoronoiAreaCalcTool("myVoronoiArea", GroomedjetsAuthor = catNames, JetdR = myjetdr, JetInputTool = getStandardInputTools(input='Truth')[0]) ])

    myjetgetter_truth = make_StandardJetGetter(myjetfinder, myjetdr, 'Truth', seq = theseq, doCalib=False, minPt=30*GeV)#,addDefaultMoment=False)
    truthcontname = myjetgetter_truth.outputKey()

    extra_moments_list = [] 
    if myjetgetter_truth.jetAlgorithmHandle() == None:
      if truthcontname ==  None:
         truthcontname = myjetgetter_truth.buildName()
      print 'yot: ', truthcontname
      extra_moments_list += [widthtool]  ## jet moments lost for truth jets in ESD->AOD transition

    make_JetMomentGetter(truthcontname , extra_moments_list + [assoc_tool_truth,jetsubstructure_tool_truth], theseq )


    return [ truthcontname, catNames ]
  
  else:
    return [ None, None ]
コード例 #2
0
def setupTrackJets(myjetfinder, myjetdr, GroomedDicts, theseq):

  myGroomingTools, catNames = getGroomingTools(GroomedDicts)

  sortertool = JetSorterTool('JS_JetSorter', SortOrder="ByPtDown", OutputLevel=3 )
  widthtool = JetWidthTool('JS_JetWidthTool')

  assoc_tool_track = JetSubStructure.JetAssociationTool(                                                                                  
                      name = 'JetAssocToolTrack',
                      AssociatorTools = [],
                      GroomingTools = myGroomingTools, UsedSignalState = 2, 
                      JetAlgTools = [sortertool, widthtool], OutputLevel = 3
                     )

  jetsubstructure_tool_track = JetSubStructure.JetSubstructureTool(
                                  name = 'JetSubstructureToolTrack', UsedSignalState = 2, OutputLevel=3,
                                  SubstructureTools = [JetSubStructure.NSubjettinessTool("myNSubjettinessTool", N=[1,2,3], R0=myjetdr, GroomedjetsAuthor = catNames),
                                              JetSubStructure.KtHadSubstructureTool("myhadtool", GroomedjetsAuthor = catNames),
                                              JetSubStructure.DipolarityTool("myDipolarityTool",GroomedjetsAuthor = catNames) ])


  #---- TrackJet ----
  jetFlags.finalMinEt = 30*GeV

  from QcdD3PDMaker.JSTrackJets import createJSTrackJets
  mygetter = createJSTrackJets(theseq, myjetfinder,myjetdr)

  jetFlags.finalMinEt =30*GeV

  trackjetcontname =  mygetter.outputKey()

  add_jetMoments_to_JetAlg(mygetter, [widthtool])

  #---- End TrackJet  ----

  make_JetMomentGetter(trackjetcontname , [assoc_tool_track, jetsubstructure_tool_track], theseq )

  return [ trackjetcontname, catNames ]
コード例 #3
0
#addSUSYCustomMissingET( topSequence )
#PhotonCustomMET()

ExtendedJetD3PDObject = JetD3PDObject.copy()
myMuonD3PDObject = MuonD3PDObject.copy()
ExtendedTauD3PDObject = TauD3PDObject.copy()

#from CaloD3PDMaker import ClusterMomentFillerTool as CMFT
#ClusterD3PDObject.defineBlock (99, 'CenterMagMoments', CMFT, Moments = [CMFT.CENTER_MAG, 'centermag'])

# make truth jets WIDTH and SPLIT variables for truth jets R=0.4/0.6
import JetSubStructure
from JetRec.JetMomentGetter import make_JetMomentGetter
from JetMomentTools.JetMomentToolsConf import JetWidthTool
from JetRec.JetRecConf import JetSorterTool
widthtool = JetWidthTool('JS_JetWidthTool')
assoc_tool_truth = JetSubStructure.JetAssociationTool(name='JetAssocToolTruth',
                                                      JetAlgTools=[widthtool],
                                                      OutputLevel=3)
jetsubstructure_tool_truth = JetSubStructure.JetSubstructureTool(
    name='JetSubstructureToolTruth',
    UsedSignalState=2,
    OutputLevel=3,
    SubstructureTools=[
        JetSubStructure.KtTruthLeptonSubstructureTool("mytruthleptontool",
                                                      OutputLevel=3,
                                                      GroomedjetsAuthor=[])
    ])

#make_JetMomentGetter("AntiKt4TruthNewJets", [widthtool, assoc_tool_truth, jetsubstructure_tool_truth], topSequence)
#make_JetMomentGetter("AntiKt6TruthNewJets", [widthtool, assoc_tool_truth, jetsubstructure_tool_truth], topSequence)
コード例 #4
0
def declareDefaultTools():

  from JetRecConfig.JetRecFlags import jetFlags
  from JetRecConfig.JetRecStandardToolManager import jtm
  try:
    from JetMomentTools.JetMomentToolsConf import JetCaloCellQualityTool
    jtm.haveJetCaloCellQualityTool = True
  except ImportError:
    jtm.haveJetCaloCellQualityTool = False

  try:
    from JetMomentTools.JetMomentToolsConf import JetJetBadChanCorrTool
    jtm.haveJetBadChanCorrTool = True
  except ImportError:
    jtm.haveJetBadChanCorrTool = False

  from JetRecTools.JetRecToolsConf import TrackVertexAssociationTool
  from JetRec.JetRecConf import PseudoJetGetter
  from JetRecTools.JetRecToolsConf import TrackPseudoJetGetter
  from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
  from JetRecTools.JetRecToolsConf import JetTrackSelectionTool
  from JetRecTools.JetRecToolsConf import SimpleJetTrackSelectionTool

  #--------------------------------------------------------------
  # Non-substructure moment builders.
  #--------------------------------------------------------------

  # Quality from clusters.
  jtm += JetCaloQualityTool(
    "caloqual_cluster",
    TimingCuts = [5, 10],
    Calculations = ["LArQuality", "N90Constituents", "FracSamplingMax",  "NegativeE", "Timing", "HECQuality", "Centroid", "AverageLArQF", "BchCorrCell"],
  )

  # Quality from cells.
  if jtm.haveJetCaloCellQualityTool:
    jtm += JetCaloCellQualityTool(
      "caloqual_cell",
      LArQualityCut = 4000,
      TileQualityCut = 254,
      TimingCuts = [5, 10],
      Calculations = ["LArQuality", "N90Cells", "FracSamplingMax",  "NegativeE", "Timing", "HECQuality", "Centroid", "AverageLArQF"]
    )

  # Jet width.
  jtm += JetWidthTool("width", WeightPFOToolEM=jtm.pflowweighter, WeightPFOToolLC=jtm.pflowweighterLC)

  # Calo layer energies.
  jtm += JetCaloEnergies("jetens")

  # Read in missing cell map (needed for the following)
  # commented out : incompatible with trigger : ATR-9696
  ## if jtm.haveJetRecCalo:
  ##     def missingCellFileReader(): 
  ##       import os
  ##       dataPathList = os.environ[ 'DATAPATH' ].split(os.pathsep)
  ##       dataPathList.insert(0, os.curdir)
  ##       from AthenaCommon.Utils.unixtools import FindFile
  ##       RefFileName = FindFile( "JetBadChanCorrTool.root" ,dataPathList, os.R_OK )
  ##       from AthenaCommon.AppMgr import ServiceMgr
  ##       if not hasattr(ServiceMgr, 'THistSvc'):
  ##         from GaudiSvc.GaudiSvcConf import THistSvc
  ##         ServiceMgr += THistSvc()
  ##       ServiceMgr.THistSvc.Input += ["JetBadChanCorrTool DATAFILE=\'%s\' OPT=\'READ\'" % RefFileName]
  ##       missingCellFileReader.called = True 

  ##     missingCellFileReader()

  ##     jtm += MissingCellListTool(
  ##       "missingcells",
  ##       AddCellList = [],
  ##       RemoveCellList = [],
  ##       AddBadCells = True,
  ##       DeltaRmax = 1.0,
  ##       AddCellFromTool = False,
  ##       LArMaskBit = 608517,
  ##       TileMaskBit = 1,
  ##       MissingCellMapName = "MissingCaloCellsMap"
  ## )

  ## # Bad channel corrections from cells
  ## if jtm.haveJetBadChanCorrTool:
  ##   jtm += JetBadChanCorrTool(
  ##     "bchcorrcell",
  ##     NBadCellLimit = 10000,
  ##     StreamName = "/JetBadChanCorrTool/",
  ##     ProfileName = "JetBadChanCorrTool.root",
  ##     ProfileTag = "",
  ##     UseCone = True,
  ##     UseCalibScale = False,
  ##     MissingCellMap = "MissingCaloCellsMap",
  ##     ForceMissingCellCheck = False,
  ##     UseClusters = False,
  ##   )

  ##   # Bad channel corrections from clusters
  ##   jtm += JetBadChanCorrTool(
  ##     "bchcorrclus",
  ##     NBadCellLimit = 0,
  ##     StreamName = "",
  ##     ProfileName = "",
  ##     ProfileTag = "",
  ##     UseCone = True,
  ##     UseCalibScale = False,
  ##     MissingCellMap = "",
  ##     ForceMissingCellCheck = False,
  ##     UseClusters = True
  ##   )

  # Bad LAr fractions.
  jtm += JetECPSFractionTool(
    "ecpsfrac",
  )

  #--------------------------------------------------------------
  # Track-vertex association.
  #--------------------------------------------------------------
  from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TightTrackVertexAssociationTool
  jtm += CP__TightTrackVertexAssociationTool("jetTighTVAtool", dzSinTheta_cut=3, doPV=True)

  jtm += TrackVertexAssociationTool(
    "tvassoc",
    TrackParticleContainer  = jtm.trackContainer,
    TrackVertexAssociation  = "JetTrackVtxAssoc",
    VertexContainer         = jtm.vertexContainer,
    TrackVertexAssoTool     = jtm.jetTighTVAtool,
  )

  jtm += TrackVertexAssociationTool(
    "tvassoc_old",
    TrackParticleContainer  = jtm.trackContainer,
    TrackVertexAssociation  = "JetTrackVtxAssoc_old",
    VertexContainer         = jtm.vertexContainer,
    MaxTransverseDistance   = 1.5,
    MaxLongitudinalDistance = 1.0e7,
    MaxZ0SinTheta = 1.5
  )

  #--------------------------------------------------------------
  # Track selection.
  #--------------------------------------------------------------

  # This is the InDet loose selection from
  # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/InDetTrackingPerformanceGuidelines
  # October 28, 2014
  #jtm += InDet__InDetDetailedTrackSelectionTool(
  jtm += InDet__InDetTrackSelectionTool(
    "trk_trackselloose",
    CutLevel                = "Loose"
  )

  jtm += JetTrackSelectionTool(
    "trackselloose",
    InputContainer  = jtm.trackContainer,
    OutputContainer = "JetSelectedTracks",
    Selector        = jtm.trk_trackselloose
  )

  jtm += InDet__InDetTrackSelectionTool(
    "trk_trackselloose_trackjets",
    CutLevel                = "Loose"
  )

  jtm += JetTrackSelectionTool(
     "trackselloose_trackjets",
    InputContainer  = jtm.trackContainer,
    OutputContainer = "JetSelectedTracks_LooseTrackJets",
    Selector        = jtm.trk_trackselloose_trackjets
  )

  if jetFlags.useInDetTrackSelection():
    jtm += JetTrackSelectionTool(
      "tracksel",
      InputContainer  = jtm.trackContainer,
      OutputContainer = "JetSelectedTracks",
      Selector        = jtm.trk_trackselloose
    )
  else:
    jtm += SimpleJetTrackSelectionTool(
      "tracksel",
      PtMin = 500.0,
      InputContainer  = jtm.trackContainer,
      OutputContainer = "JetSelectedTracks",
    )


  # Tracks.
  jtm += TrackPseudoJetGetter(
    "trackget",
    InputContainer = jtm.trackselloose_trackjets.OutputContainer,
    Label = "Track",
    OutputContainer = "PseudoJetTracks",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    SkipNegativeEnergy = True,
    GhostScale = 0.0
  )


  # Ghost tracks.
  jtm += TrackPseudoJetGetter(
    "gtrackget",
    InputContainer = jtm.tracksel.OutputContainer,
    Label = "GhostTrack",
    OutputContainer = "PseudoJetGhostTracks",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    SkipNegativeEnergy = True,
    GhostScale = 1e-20
  )


  # Jet vertex fraction.
  jtm += JetVertexFractionTool(
    "jvfold",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    JVFName = "JVFOld"
  )

  # Jet vertex fraction with selection.
  jtm += JetVertexFractionTool(
    "jvf",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    TrackSelector = jtm.trackselloose,
    JVFName = "JVF"
  )

  # Jet vertex tagger.
  jtm += JetVertexTaggerTool(
    "jvt",
    VertexContainer = jtm.vertexContainer,
    TrackParticleContainer  = jtm.trackContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    TrackSelector = jtm.trackselloose,
    JVTName = "Jvt",
    K_JVFCorrScale = 0.01,
    Z0Cut = 3.0,
    PUTrkPtCut = 30000.0
  )

  # Jet track info.
  jtm += JetTrackMomentsTool(
    "trkmoms",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    TrackMinPtCuts = [500, 1000],
    TrackSelector = jtm.trackselloose
  )

  # Jet track vector sum info
  jtm += JetTrackSumMomentsTool(
    "trksummoms",
    VertexContainer = jtm.vertexContainer,
    AssociatedTracks = "GhostTrack",
    TrackVertexAssociation = jtm.tvassoc.TrackVertexAssociation,
    RequireTrackPV = True,
    TrackSelector = jtm.trackselloose
  )

  # Jet cluster info.
  jtm += JetClusterMomentsTool(
    "clsmoms",
    DoClsPt = True,
    DoClsSecondLambda = True,
    DoClsCenterLambda = True,
    DoClsSecondR = True
  )


  jtm += JetVoronoiMomentsTool(
    "voromoms",
    AreaXmin= -5.,
    AreaXmax=  5.,
    AreaYmin= -3.141592,
    AreaYmax=  3.141592
  )

  # Isolations.
  # Note absence of PseudoJetGetter property means the jet inputs
  # are obtained according to the InputType property of the jet.
  jtm += JetIsolationTool(
    "jetisol",
    IsolationCalculations = ["IsoDelta:2:SumPt", "IsoDelta:3:SumPt"],
  )
  jtm += JetIsolationTool(
    "run1jetisol",
    IsolationCalculations = ["IsoKR:11:Perp", "IsoKR:11:Par", "IsoFixedCone:6:SumPt",],
  )


  # Bad LAr fractions.
  jtm += JetLArHVTool("larhvcorr")


  # Jet origin correction.
  jtm += JetOriginCorrectionTool(
    "jetorigincorr",
    VertexContainer = jtm.vertexContainer,
    OriginCorrectedName = "JetOriginConstitScaleMomentum"
  )

  # Just set the PV without applying origin correction
  jtm += JetOriginCorrectionTool(
    "jetorigin_setpv",
    VertexContainer = jtm.vertexContainer,
    OriginCorrectedName = "",
    OnlyAssignPV = True,
  )

  # Load the xAODCaloEvent dictionary for cluster scale enum
  import cppyy
  try: cppyy.loadDictionary('xAODCaloEventDict')
  except: pass
  from ROOT import xAOD
  # Touch an unrelated class so the dictionary is loaded
  # and therefore the CaloCluster version typedef is recognised
  xAOD.CaloVertexedTopoCluster
コード例 #5
0
def setupTruthJets(myjetfinder, myjetdr, GroomedDicts, theseq):
    if rec.doTruth():

        myGroomingTools, catNames = getGroomingTools(GroomedDicts)

        catNames_trimmed = list(x for x in catNames if 'Trimmed' in x)

        sortertool = JetSorterTool('myJetSorter',
                                   SortOrder="ByPtDown",
                                   OutputLevel=3)
        wrapped_sortertool = JetSubStructure.JetAlgToolWrapper(
            "JetSorterWrapper",
            JetAlgTool=sortertool,
            GroomedjetsAuthor=catNames_trimmed)

        widthtool = JetWidthTool('JS_JetWidthTool')

        truth_assoc = JetSubStructure.TruthParticleJetAssociatorTool(
            "myTruthLeptonsAssoc",
            ContainerName="SpclMC",
            dR=myjetdr,
            OutputLevel=3,  #SpclMC for AODs, INav4MomTruthEvent for ESD
            ParticlesPdgID=[11, 13],
            ParticlesStatus=[1, 1],
            ParticlesType=[2, 6],
            ParticlesOrigin=[-1, -1])
        truth_assoc.mcTruthClassifier.OutputLevel = 3
        truth_assoc.mcTruthClassifier.McEventCollection = "GEN_AOD"  #"TruthEvent" for ESD
        from MCTruthClassifier.MCTruthClassifierBase import exToCalo
        truth_assoc.mcTruthClassifier.ExtrapolateToCaloTool = exToCalo

        assoc_tool_truth = JetSubStructure.JetAssociationTool(
            name='JetAssocToolTruth',
            AssociatorTools=[truth_assoc],
            GroomingTools=myGroomingTools,
            UsedSignalState=2,
            JetAlgTools=[wrapped_sortertool, widthtool],
            OutputLevel=3)

        jetsubstructure_tool_truth = JetSubStructure.JetSubstructureTool(
            name='JetSubstructureToolTruth',
            UsedSignalState=2,
            OutputLevel=3,
            SubstructureTools=[
                JetSubStructure.KtTruthLeptonSubstructureTool(
                    "mytruthleptontool", OutputLevel=3, GroomedjetsAuthor=[]),
                JetSubStructure.NSubjettinessTool(
                    "myNSubjettinessTool",
                    N=[1, 2, 3],
                    R0=myjetdr,
                    GroomedjetsAuthor=catNames_trimmed),
                JetSubStructure.KtHadSubstructureTool(
                    "myhadtool", GroomedjetsAuthor=catNames_trimmed),
                JetSubStructure.JetPullVectorTool(
                    "myJetPullVectorTool", GroomedjetsAuthor=catNames_trimmed)
            ])
        #need to use truth collection on disk for smaller R jets for the TrueFlavorComponent block
        if myjetdr < 0.9:
            contname = myjetfinder + '%dTruthJets' % (myjetdr * 10)
        else:
            contname = myjetfinder + '%dTruthJSJets' % (myjetdr * 10)

        myjetgetter_truth = make_StandardJetGetter(
            myjetfinder,
            myjetdr,
            'Truth',
            seq=theseq,
            doCalib=False,
            outputCollectionName=contname)  #,addDefaultMoment=False)
        truthcontname = myjetgetter_truth.outputKey()

        extra_moments_list = []
        if myjetgetter_truth.jetAlgorithmHandle() == None:
            if truthcontname == None:
                truthcontname = myjetgetter_truth.buildName()
            print 'yot: ', truthcontname
            extra_moments_list += [
                widthtool
            ]  ## jet moments lost for truth jets in ESD->AOD transition

        sss = make_JetMomentGetter(
            truthcontname, extra_moments_list +
            [assoc_tool_truth, jetsubstructure_tool_truth], theseq)

        ## for lepton assoc
        jetcont = truthcontname[:-4]  #removing the 'Jets'
        for x in catNames_trimmed:
            make_JetMomentGetter(jetcont + x + 'Jets', [
                JetSubStructure.JetAssociationTool(
                    'JetAssocToolTruthGr',
                    AssociatorTools=[truth_assoc],
                    GroomingTools=[],
                    UsedSignalState=2,
                    JetAlgTools=[]),
                JetSubStructure.JetSubstructureTool(
                    'JetSubstructureToolTruthGr',
                    UsedSignalState=2,
                    SubstructureTools=[
                        JetSubStructure.KtTruthLeptonSubstructureTool(
                            "mytruthleptontool", GroomedjetsAuthor=[])
                    ])
            ], theseq)

        return [truthcontname, catNames]

    else:
        return [None, None]
コード例 #6
0
def setupCaloJets(myjetfinder, myjetdr, myjetinput, GroomedDicts, theseq):

    myGroomingTools, catNames = getGroomingTools(GroomedDicts)

    catNames_trimmed = list(x for x in catNames if 'Trimmed' in x)

    sortertool = JetSorterTool('myJetSorter',
                               SortOrder="ByPtDown",
                               OutputLevel=3)
    wrapped_sortertool = JetSubStructure.JetAlgToolWrapper(
        "JetSorterWrapper",
        JetAlgTool=sortertool,
        GroomedjetsAuthor=catNames_trimmed)

    widthtool = JetWidthTool('JS_JetWidthTool')

    grjets_calib = []

    from JetSubStructure.mySetupJetCalibrators import doEtaMassJESCorrection
    from JetCalibTools.MakeCalibSequences import calibTags
    calibTags['ETAMASSJES'] = doEtaMassJESCorrection

    ## Origin correction

    mydoCalib = False
    mycalibName = ''

    if 'LCTopo' in myjetinput:
        mydoCalib = False
        if (myjetfinder + '%d' %
            (myjetdr * 10) == 'AntiKt10') or (myjetfinder + '%d' %
                                              (myjetdr * 10) == 'CamKt12'):
            mycalibName = 'LC:ORIGIN_ETAMASSJES'
        else:
            mycalibName = 'LC:ORIGIN'

        stdcaliblist = []
        allowedcalib = [
            'AntiKt10LCTopoTrimmedJets',
            'AntiKt10LCTopoTrimmedPtFrac3SmallR30Jets',
            'AntiKt10LCTopoTrimmedPtFrac5SmallR30Jets',
            'CamKt12LCTopoTrimmedPtFrac5SmallR30Jets'
        ]
        for x in catNames:
            author = myjetfinder + '%d' % (myjetdr *
                                           10) + myjetinput + x + 'Jets'
            #if author in allowedcalib :
            #grjets_calib += [JetSubStructure.JetAlgToolWrapper(name = 'calibtool_origin_etamassjes_'+x,
            #                                                    JetAlgTool = getStandardCalibTool(myjetfinder,myjetdr, myjetinput+x, doCalib=True, calibName='LC:ORIGIN_ETAMASSJES')[0],
            #                                                    GroomedjetsAuthor = [x] )]
            #elif 'Trimmed' in x:
            #    stdcaliblist += [x]

        #if stdcaliblist != [] :
        #grjets_calib += [JetSubStructure.JetAlgToolWrapper(name = 'calibtool_origin',
        #                                                    JetAlgTool = getStandardCalibTool(myjetfinder,myjetdr, myjetinput, doCalib=True, calibName='LC:ORIGIN')[0],
        #                                                    GroomedjetsAuthor = stdcaliblist )]
    elif 'Topo' in myjetinput:
        mydoCalib = True
        mycalibName = 'EM:ORIGIN'
        grjets_calib += [
            JetSubStructure.JetAlgToolWrapper(
                name='calibtool_origin',
                JetAlgTool=getStandardCalibTool(myjetfinder,
                                                myjetdr,
                                                myjetinput,
                                                doCalib=True,
                                                calibName='EM:ORIGIN')[0],
                GroomedjetsAuthor=catNames_trimmed)
        ]

    truthcontname = 'none'
    if rec.doTruth():
        if myjetdr < 0.9:  #need to use truth collection on disk for smaller R jets for the TrueFlavorComponent block
            truthcontname = myjetfinder + '%dTruthJets' % (myjetdr * 10)
        else:
            truthcontname = myjetfinder + '%dTruthJSJets' % (myjetdr * 10)

    trackjetcontname = myjetfinder + '%dTrackZJets' % (myjetdr * 10)

    assoc_tools = []

    trkj_assoc = JetSubStructure.JetJetAssociatorTool(
        "Trk_JetJetAssociatorTool",
        ContainerName=trackjetcontname,
        AssociationName="TrackJets",
        MatchOrigin=True)
    assoc_tools += [trkj_assoc]

    if rec.doTruth():
        truthj_assoc = JetSubStructure.JetJetAssociatorTool(
            "Truth_JetJetAssociatorTool",
            ContainerName=truthcontname,
            AssociationName="TruthJets",
            MatchOrigin=False)
        assoc_tools += [truthj_assoc]

    e_assoc = JetSubStructure.ElectronJetAssociatorTool(
        "JSEAssoc",
        ContainerName='ElectronAODCollection',
        UseCluster=True,
        UseTrack=False,
        dR=myjetdr,
        ResolveCluster=True,
        OutputLevel=3)

    e_assoc.METClusterResolver.MaximumRadialDistance = 0.2
    e_assoc.METClusterResolver.LongitudinalExtension = 1.0
    e_assoc.METClusterResolver.RadialExtension = 1.0
    e_assoc.METClusterResolver.EnergyFractionThreshold = 0.1
    e_assoc.METClusterResolver.OutputLevel = 3

    mu_assoc = JetSubStructure.MuonJetAssociatorTool(
        "JSMuAssoc",
        ContainerName='MuidMuonCollection',
        UseTrack=False,
        dR=myjetdr,
        OutputLevel=3)
    assoc_tools += [e_assoc, mu_assoc]

    assoc_tool = JetSubStructure.JetAssociationTool(
        name='JetAssocTool',
        AssociatorTools=assoc_tools,
        GroomingTools=myGroomingTools,
        UsedSignalState=2,
        JetAlgTools=grjets_calib + [wrapped_sortertool, widthtool],
        OutputLevel=5)

    jetsubstructure_tool = JetSubStructure.JetSubstructureTool(
        name='JetSubstructureTool',
        UsedSignalState=2,
        OutputLevel=3,
        SubstructureTools=[
            JetSubStructure.NSubjettinessTool(
                "myNSubjettinessTool",
                N=[1, 2, 3],
                R0=myjetdr,
                GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.KtHadSubstructureTool(
                "myhadtool", GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.KtElectronSubstructureTool("myelectool",
                                                       GroomedjetsAuthor=[]),
            JetSubStructure.KtMuonSubstructureTool("mymuontool",
                                                   GroomedjetsAuthor=[]),
            JetSubStructure.JetPullVectorTool(
                "myJetPullVectorTool", GroomedjetsAuthor=catNames_trimmed)
        ])

    outkey = myjetfinder + '%d' % (myjetdr * 10) + myjetinput
    if myjetinput == 'Topo':
        outkey += 'EM'
    outkey += 'Jets'  #'JSJets' for rebuilding on the fly

    myjetgetter = make_StandardJetGetter(myjetfinder,
                                         myjetdr,
                                         myjetinput,
                                         seq=theseq,
                                         doCalib=mydoCalib,
                                         calibName=mycalibName,
                                         addDefaultMoment=False,
                                         outputCollectionName=outkey)

    contname = myjetgetter.outputKey()

    extra_moments_list = []
    if myjetgetter.jetAlgorithmHandle(
    ) == None:  # JetCollection already in AOD
        if contname == None:
            contname = myjetgetter.buildName()

        if contname == 'AntiKt4LCTopoJets':
            contname = 'AntiKt4LCTopoJetsReTagged'
    else:
        extra_moments_list += [widthtool]

    # ------------------------------------------------
    # Associate a vertex and set the JVF moment. Must be placed AFTER vertex correction
    # ------------------------------------------------
    from AthenaCommon.DetFlags import DetFlags
    from AthenaCommon.AppMgr import ToolSvc
    noVertex = jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam'
    if DetFlags.detdescr.ID_on() and jetFlags.doJVF(
    ) and 'Truth' not in myjetinput and not noVertex and myjetdr >= 0.7:
        from JetSubStructure.mySetupJetMomentTools import mygetJetVertexAssociationTool
        myjvatool = mygetJetVertexAssociationTool(myjetfinder, myjetdr,
                                                  myjetinput,
                                                  'Custom%d' % (myjetdr * 10))
        #add_jetMoments_to_JetAlg(myjetgetter, [myjvatool])
        extra_moments_list += [myjvatool]

    make_JetMomentGetter(
        contname, extra_moments_list + [assoc_tool, jetsubstructure_tool],
        theseq)

    ## for lepton assoc
    jetcont = contname[:-4]  #removing the 'Jets'
    if contname == 'AntiKt4LCTopoJetsReTagged':
        jetcont = 'AntiKt4LCTopo'

    for x in catNames_trimmed:
        make_JetMomentGetter(jetcont + x + 'Jets', [
            JetSubStructure.JetAssociationTool(
                'JetAssocToolGr',
                AssociatorTools=[e_assoc, mu_assoc],
                GroomingTools=[],
                UsedSignalState=2,
                JetAlgTools=[],
                OutputLevel=5),
            JetSubStructure.JetSubstructureTool(
                'JetSubstructureToolGr',
                UsedSignalState=2,
                SubstructureTools=[
                    JetSubStructure.KtElectronSubstructureTool(
                        "myelectool", GroomedjetsAuthor=[]),
                    JetSubStructure.KtMuonSubstructureTool(
                        "mymuontool", GroomedjetsAuthor=[])
                ])
        ], theseq)

    return [contname, catNames]
コード例 #7
0
def setupTrackJets(myjetfinder, myjetdr, GroomedDicts, theseq):

    myGroomingTools, catNames = getGroomingTools(GroomedDicts)

    catNames_trimmed = list(x for x in catNames if 'Trimmed' in x)

    sortertool = JetSorterTool('myJetSorter',
                               SortOrder="ByPtDown",
                               OutputLevel=3)
    wrapped_sortertool = JetSubStructure.JetAlgToolWrapper(
        "JetSorterWrapper",
        JetAlgTool=sortertool,
        GroomedjetsAuthor=catNames_trimmed)

    widthtool = JetWidthTool('JS_JetWidthTool')

    e_assoc = JetSubStructure.ElectronJetAssociatorTool(
        "JSEAssocTrack",
        ContainerName='ElectronAODCollection',
        UseCluster=False,
        UseTrack=True,
        dR=myjetdr,
        OutputLevel=3)
    mu_assoc = JetSubStructure.MuonJetAssociatorTool(
        "JSMuAssocTrack",
        ContainerName='MuidMuonCollection',
        UseTrack=True,
        dR=myjetdr,
        OutputLevel=3)

    assoc_tool_track = JetSubStructure.JetAssociationTool(
        name='JetAssocToolTrack',
        AssociatorTools=[e_assoc, mu_assoc],
        GroomingTools=myGroomingTools,
        UsedSignalState=2,
        JetAlgTools=[wrapped_sortertool, widthtool],
        OutputLevel=3)

    jetsubstructure_tool_track = JetSubStructure.JetSubstructureTool(
        name='JetSubstructureToolTrack',
        UsedSignalState=2,
        OutputLevel=3,
        SubstructureTools=[
            JetSubStructure.NSubjettinessTool(
                "myNSubjettinessTool",
                N=[1, 2, 3],
                R0=myjetdr,
                GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.KtHadSubstructureTool(
                "myhadtool", GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.KtElectronSubstructureTool("myelectool",
                                                       GroomedjetsAuthor=[]),
            JetSubStructure.KtMuonSubstructureTool("mymuontool",
                                                   GroomedjetsAuthor=[]),
            JetSubStructure.JetPullVectorTool(
                "myJetPullVectorTool", GroomedjetsAuthor=catNames_trimmed)
        ])

    #---- TrackJet ----
    #jetFlags.finalMinEt = 5*GeV

    from BoostedTopD3PDMaker.JSTrackJets import createJSTrackJets
    mygetter = createJSTrackJets(theseq, myjetfinder, myjetdr)

    trackjetcontname = mygetter.outputKey()

    add_jetMoments_to_JetAlg(mygetter, [widthtool])

    #---- End TrackJet  ----

    sss = make_JetMomentGetter(trackjetcontname,
                               [assoc_tool_track, jetsubstructure_tool_track],
                               theseq)

    ## for lepton assoc
    jetcont = trackjetcontname[:-4]  #removing the 'Jets'
    for x in catNames_trimmed:
        make_JetMomentGetter(jetcont + x + 'Jets', [
            JetSubStructure.JetAssociationTool(
                'JetAssocToolTrackGr',
                AssociatorTools=[e_assoc, mu_assoc],
                GroomingTools=[],
                UsedSignalState=2,
                JetAlgTools=[]),
            JetSubStructure.JetSubstructureTool(
                'JetSubstructureToolTrackGr',
                UsedSignalState=2,
                SubstructureTools=[
                    JetSubStructure.KtElectronSubstructureTool(
                        "myelectool", GroomedjetsAuthor=[]),
                    JetSubStructure.KtMuonSubstructureTool(
                        "mymuontool", GroomedjetsAuthor=[])
                ])
        ], theseq)

    return [trackjetcontname, catNames]
コード例 #8
0
)

# Quality from cells.
if jtm.haveJetCaloCellQualityTool:
    jtm += JetCaloCellQualityTool("caloqual_cell",
                                  LArQualityCut=4000,
                                  TileQualityCut=254,
                                  TimingCuts=[5, 10],
                                  Calculations=[
                                      "LArQuality", "N90Cells",
                                      "FracSamplingMax", "NegativeE", "Timing",
                                      "HECQuality", "Centroid", "AverageLArQF"
                                  ])

# Jet width.
jtm += JetWidthTool("width")

# Calo layer energies.
jtm += JetCaloEnergies("jetens")

# Read in missing cell map (needed for the following)
# commented out : incompatible with trigger : ATR-9696
## if jtm.haveJetRecCalo:
##     def missingCellFileReader():
##       import os
##       dataPathList = os.environ[ 'DATAPATH' ].split(os.pathsep)
##       dataPathList.insert(0, os.curdir)
##       from AthenaCommon.Utils.unixtools import FindFile
##       RefFileName = FindFile( "JetBadChanCorrTool.root" ,dataPathList, os.R_OK )
##       from AthenaCommon.AppMgr import ServiceMgr
##       if not hasattr(ServiceMgr, 'THistSvc'):
コード例 #9
0
def setupCaloJets(myjetfinder, myjetdr, myjetinput, GroomedDicts, theseq):

    myGroomingTools, catNames = getGroomingTools(GroomedDicts)

    #catNames_trimmed = list(x for x in catNames if 'Trimmed' in x)
    #catNames_trimmed += list(x for x in catNames if 'Filter' in x)
    #catNames_trimmed = catNames
    catNames_trimmed = list(x for x in catNames if 'Subjet' not in x)

    sortertool = JetSorterTool('myJetSorter',
                               SortOrder="ByPtDown",
                               OutputLevel=3)
    wrapped_sortertool = JetSubStructure.JetAlgToolWrapper(
        "JetSorterWrapper",
        JetAlgTool=sortertool,
        GroomedjetsAuthor=catNames_trimmed)

    widthtool = JetWidthTool('JS_JetWidthTool')

    grjets_calib = []

    from JetSubStructure.mySetupJetCalibrators import doEtaMassJESCorrection
    from JetCalibTools.MakeCalibSequences import calibTags
    calibTags['ETAMASSJES'] = doEtaMassJESCorrection

    ## Origin correction

    mydoCalib = False
    mycalibName = ''

    if 'LCTopo' in myjetinput:
        mydoCalib = True
        if (myjetfinder + '%d' %
            (myjetdr * 10) == 'AntiKt10') or (myjetfinder + '%d' %
                                              (myjetdr * 10) == 'CamKt12'):
            mycalibName = 'LC:ORIGIN_ETAMASSJES'
        else:
            mycalibName = 'LC:ORIGIN'
        # overwrite with latest offset substraction
        mycalibName = "LC:ApplyAreaOffset"

        stdcaliblist = []
        #allowedcalib = ['AntiKt10LCTopoTrimmedJets', 'AntiKt10LCTopoTrimmedPtFrac3SmallR30Jets','AntiKt10LCTopoTrimmedPtFrac5SmallR30Jets','CamKt12LCTopoTrimmedPtFrac5SmallR30Jets']
        allowedcalib = []  # etamassjes is currently obsolete for these jets
        for x in catNames:
            author = myjetfinder + '%d' % (myjetdr *
                                           10) + myjetinput + x + 'Jets'
            if author in allowedcalib:
                grjets_calib += [
                    JetSubStructure.JetAlgToolWrapper(
                        name='calibtool_origin_etamassjes_' + x,
                        JetAlgTool=getStandardCalibTool(
                            myjetfinder,
                            myjetdr,
                            myjetinput + x,
                            doCalib=True,
                            calibName='LC:ORIGIN_ETAMASSJES')[0],
                        GroomedjetsAuthor=[x])
                ]
            #elif 'Trimmed' in x:
            else:
                stdcaliblist += [x]

        if stdcaliblist != []:
            grjets_calib += [
                JetSubStructure.JetAlgToolWrapper(
                    name='calibtool_origin',
                    JetAlgTool=getStandardCalibTool(myjetfinder,
                                                    myjetdr,
                                                    myjetinput,
                                                    doCalib=True,
                                                    calibName='LC:ORIGIN')[0],
                    GroomedjetsAuthor=stdcaliblist)
            ]
    elif 'Topo' in myjetinput:
        mydoCalib = True
        #mycalibName = 'EM:ORIGIN'
        # overwrite with latest offset substraction
        mycalibName = "EM:ApplyAreaOffset"

        grjets_calib += [
            JetSubStructure.JetAlgToolWrapper(
                name='calibtool_origin',
                JetAlgTool=getStandardCalibTool(myjetfinder,
                                                myjetdr,
                                                myjetinput,
                                                doCalib=True,
                                                calibName='EM:ORIGIN')[0],
                GroomedjetsAuthor=catNames_trimmed)
        ]
        #grjets_calib += getStandardCalibTool(myjetfinder,myjetdr, myjetinput, doCalib=True, calibName='EM:ORIGIN')

    truthcontname = 'none'
    if rec.doTruth():
        if myjetdr < 0.9:  #need to use truth collection on disk for smaller R jets for the TrueFlavorComponent block
            truthcontname = myjetfinder + '%dTruthJets' % (myjetdr * 10)
        else:
            truthcontname = myjetfinder + '%dTruthJSJets' % (myjetdr * 10)

    trackjetcontname = myjetfinder + '%dTrackZJets' % (myjetdr * 10)

    assoc_tools = []

    trkj_assoc = JetSubStructure.JetJetAssociatorTool(
        "Trk_JetJetAssociatorTool",
        ContainerName=trackjetcontname,
        AssociationName="TrackJets",
        MatchOrigin=True)
    assoc_tools += [trkj_assoc]

    if rec.doTruth():
        truthj_assoc = JetSubStructure.JetJetAssociatorTool(
            "Truth_JetJetAssociatorTool",
            ContainerName=truthcontname,
            AssociationName="TruthJets",
            MatchOrigin=False)
        assoc_tools += [truthj_assoc]

    e_assoc = JetSubStructure.ElectronJetAssociatorTool(
        "JSEAssoc",
        ContainerName='ElectronAODCollection',
        UseCluster=True,
        UseTrack=False,
        dR=myjetdr,
        ResolveCluster=True,
        OutputLevel=3)

    e_assoc.METClusterResolver.MaximumRadialDistance = 0.2
    e_assoc.METClusterResolver.LongitudinalExtension = 1.0
    e_assoc.METClusterResolver.RadialExtension = 1.0
    e_assoc.METClusterResolver.EnergyFractionThreshold = 0.1
    e_assoc.METClusterResolver.OutputLevel = 3

    mu_assoc = JetSubStructure.MuonJetAssociatorTool(
        "JSMuAssoc",
        ContainerName='MuidMuonCollection',
        UseTrack=False,
        dR=myjetdr,
        OutputLevel=3)
    assoc_tools += [e_assoc, mu_assoc]

    assoc_tool_ghost = JetSubStructure.GhostJetJetAssociatorTool(
        "myGhostJetJetAssociatorTool",
        JetdR=myjetdr,
        JetFinder=myjetfinder,
        JetInputTool=getStandardInputTools(input=myjetinput)[0],
        OutputLevel=3)

    ## btgging ##
    subjets_names = [x for x in catNames if "Subjets" in x]

    btag_tool = []
    if subjets_names != []:
        from JetRec.JetGetters import getStandardBTaggerTool
        jetFlags.doBTagging = True
        _btag_tool = getStandardBTaggerTool('AntiKt', 0.4, 'LCTopo')
        if len(_btag_tool) > 0:
            btag_tool += [
                JetSubStructure.JetAlgToolWrapper(
                    name='JetBTagger_' + ''.join(subjets_names),
                    JetAlgTool=_btag_tool[0],
                    GroomedjetsAuthor=subjets_names)
            ]
        jetFlags.doBTagging = True
    ## btagging end ##

    assoc_tool = JetSubStructure.JetAssociationTool(
        name='JetAssocTool',
        AssociatorTools=assoc_tools + [assoc_tool_ghost],
        GroomingTools=myGroomingTools,
        UsedSignalState=2,
        Area=True,
        JetAlgTools=grjets_calib + [wrapped_sortertool, widthtool] + btag_tool,
        OutputLevel=5)

    jetsubstructure_tool = JetSubStructure.JetSubstructureTool(
        name='JetSubstructureTool',
        UsedSignalState=2,
        OutputLevel=3,
        SubstructureTools=[
            JetSubStructure.NSubjettinessTool(
                "myNSubjettinessTool",
                N=[1, 2, 3],
                R0=myjetdr,
                GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.KtHadSubstructureTool(
                "myhadtool", GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.KtElectronSubstructureTool("myelectool",
                                                       GroomedjetsAuthor=[]),
            JetSubStructure.KtMuonSubstructureTool("mymuontool",
                                                   GroomedjetsAuthor=[]),
            JetSubStructure.DipolarityTool("myDipolarityTool",
                                           GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.JetVoronoiAreaCalcTool(
                "myVoronoiArea",
                GroomedjetsAuthor=catNames_trimmed,
                JetdR=myjetdr,
                JetInputTool=getStandardInputTools(input=myjetinput)[0]),
            JetSubStructure.JetShapesSubstructureTool(
                "myJetShapesTool", GroomedjetsAuthor=catNames_trimmed),
            JetSubStructure.JetPullVectorTool(
                "myJetPullVectorTool", GroomedjetsAuthor=catNames_trimmed)
        ])

    outkey = myjetfinder + '%d' % (myjetdr * 10) + myjetinput
    if myjetinput == 'Topo':
        outkey += 'EM'
    outkey += 'Jets'  #'JSJets' for rebuilding on the fly

    myjetgetter = make_StandardJetGetter(myjetfinder,
                                         myjetdr,
                                         myjetinput,
                                         seq=theseq,
                                         doCalib=mydoCalib,
                                         calibName=mycalibName,
                                         addDefaultMoment=False,
                                         outputCollectionName=outkey,
                                         minPt=50 * GeV)

    contname = myjetgetter.outputKey()

    extra_moments_list = []
    if myjetgetter.jetAlgorithmHandle(
    ) == None:  # JetCollection already in AOD
        if contname == None:
            contname = myjetgetter.buildName()

        #if contname == 'AntiKt4LCTopoJets':
        #   contname = 'AntiKt4LCTopoJetsReTagged'
    else:
        extra_moments_list += [widthtool]

    # ------------------------------------------------
    # Associate a vertex and set the JVF moment. Must be placed AFTER vertex correction
    # ------------------------------------------------
    from AthenaCommon.DetFlags import DetFlags
    from AthenaCommon.AppMgr import ToolSvc
    noVertex = jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam'
    if DetFlags.detdescr.ID_on() and jetFlags.doJVF(
    ) and 'Truth' not in myjetinput and not noVertex and myjetdr >= 0.7:
        from JetSubStructure.mySetupJetMomentTools import mygetJetVertexAssociationTool
        myjvatool = mygetJetVertexAssociationTool(myjetfinder, myjetdr,
                                                  myjetinput,
                                                  'Custom%d' % (myjetdr * 10))
        #add_jetMoments_to_JetAlg(myjetgetter, [myjvatool])
        extra_moments_list += [myjvatool]

    ## Ghost Track Matching
    from JetMomentTools.GhostAssociation import setupGhostAssociationTool
    t = setupGhostAssociationTool(contname, ["TrackAssoc"])
    t.GhostAssociators[0].AssociationName = "TrackAssocTmp"
    t.CopyJetFindingMoment = False
    extra_moments_list += [t]

    make_JetMomentGetter(
        contname, extra_moments_list + [assoc_tool, jetsubstructure_tool],
        theseq)

    ## for lepton assoc
    jetcont = contname[:-4]  #removing the 'Jets'

    if contname == 'AntiKt4LCTopoJetsReTagged' or contname == 'AntiKt4LCTopoNewJets':
        jetcont = 'AntiKt4LCTopo'

    for x in catNames_trimmed:
        make_JetMomentGetter(jetcont + x + 'Jets', [
            JetSubStructure.JetAssociationTool(
                'JetAssocToolGr',
                AssociatorTools=[e_assoc, mu_assoc],
                GroomingTools=[],
                UsedSignalState=2,
                Area=True,
                JetAlgTools=[],
                OutputLevel=5),
            JetSubStructure.JetSubstructureTool(
                'JetSubstructureToolGr',
                UsedSignalState=2,
                SubstructureTools=[
                    JetSubStructure.KtElectronSubstructureTool(
                        "myelectool", GroomedjetsAuthor=[]),
                    JetSubStructure.KtMuonSubstructureTool(
                        "mymuontool", GroomedjetsAuthor=[])
                ])
        ], theseq)

    jetFlags.doBTagging = True

    return [contname, catNames]
コード例 #10
0
def setupCaloJets(myjetfinder, myjetdr, myjetinput, GroomedDicts, theseq):

  myGroomingTools, catNames = getGroomingTools(GroomedDicts)

  sortertool = JetSorterTool('JS_JetSorter', SortOrder="ByPtDown", OutputLevel=3 )
  widthtool = JetWidthTool('JS_JetWidthTool')

  grjets_calib = []

  ## Origin correction

  mydoCalib = False
  mycalibName = ''

  from JetSubStructure.mySetupJetCalibrators import doEtaMassJESCorrection
  from JetCalibTools.MakeCalibSequences import calibTags
  calibTags['ETAMASSJES'] = doEtaMassJESCorrection

  if 'LCTopo' in myjetinput:
    #mydoCalib =	True
    mydoCalib =	False
    if (myjetfinder + '%d'%(myjetdr*10) == 'AntiKt10') or (myjetfinder + '%d'%(myjetdr*10) == 'CamKt12'):
       mycalibName = 'LC:ORIGIN_ETAMASSJES'
    else:
       mycalibName = 'LC:ORIGIN'

    stdcaliblist = []
    allowedcalib = ['AntiKt10LCTopoTrimmedJets', 'AntiKt10LCTopoTrimmedPtFrac3SmallR30Jets','AntiKt10LCTopoTrimmedPtFrac5SmallR30Jets','CamKt12LCTopoTrimmedPtFrac5SmallR30Jets']
    for x in catNames:
       author  = myjetfinder + '%d'%(myjetdr*10) + myjetinput + x + 'Jets'
       if author in allowedcalib :
           #grjets_calib += [JetSubStructure.JetAlgToolWrapper(name = 'calibtool_origin_etamassjes_'+x, JetAlgTool = getStandardCalibTool(myjetfinder,myjetdr, myjetinput+x, doCalib=True, calibName='LC:ORIGIN_ETAMASSJES')[0], GroomedjetsAuthor = stdcaliblist )]
           #grjets_calib += [JetSubStructure.JetAlgToolWrapper(name = 'calibtool_origin_etamassjes_'+x, JetAlgTool = getStandardCalibTool(myjetfinder,myjetdr, myjetinput+x, doCalib=False)[0], GroomedjetsAuthor = stdcaliblist) ]
           pass
       else:
           stdcaliblist += [x]

    if stdcaliblist != [] :
        #grjets_calib += [JetSubStructure.JetAlgToolWrapper(name = 'calibtool_origin',JetAlgTool = getStandardCalibTool(myjetfinder,myjetdr, myjetinput, doCalib=False, calibName='LC:ORIGIN')[0], GroomedjetsAuthor = stdcaliblist )]
        pass
  elif 'Topo' in myjetinput:
    #mydoCalib = True
    mydoCalib = False
    mycalibName = 'EM:ORIGIN'
    #grjets_calib += getStandardCalibTool(myjetfinder,myjetdr, myjetinput, doCalib=True, calibName='EM:ORIGIN')
    grjets_calib += getStandardCalibTool(myjetfinder,myjetdr, myjetinput, doCalib=False, calibName='EM:ORIGIN')
 

  truthcontname = 'none'
  if rec.doTruth():
    truthcontname = myjetfinder + '%dTruthJets' % (myjetdr*10)
  trackjetcontname =  myjetfinder + '%dTrackZJets' % (myjetdr*10)


  assoc_tools = []

  trkj_assoc = JetSubStructure.JetJetAssociatorTool("Trk_JetJetAssociatorTool", ContainerName = trackjetcontname,
                                                                               AssociationName = "TrackJets",
                                                                               MatchOrigin = True)
  assoc_tools += [ trkj_assoc ]

  if rec.doTruth():
    truthj_assoc = JetSubStructure.JetJetAssociatorTool("Truth_JetJetAssociatorTool", ContainerName = truthcontname,
                                                                               AssociationName = "TruthJets",
                                                                               MatchOrigin = False)
    assoc_tools += [ truthj_assoc ]

  doArea = False
  if 'LCTopo' in myjetinput:
    doArea = True
    assoc_tools += [ JetSubStructure.GhostJetJetAssociatorTool("myGhostJetJetAssociatorTool", JetdR = myjetdr, JetFinder = myjetfinder, JetInputTool = getStandardInputTools(input=myjetinput)[0],OutputLevel=3) ]

  assoc_tool = JetSubStructure.JetAssociationTool(                                                                                  
                      name = 'JetAssocTool',
                      AssociatorTools = assoc_tools, 
                      GroomingTools = myGroomingTools, UsedSignalState = 2, Area = doArea,
                      JetAlgTools = grjets_calib +  [sortertool, widthtool], OutputLevel = 3
                     )

  jetsubstructure_tool = JetSubStructure.JetSubstructureTool(
                           name = 'JetSubstructureTool', UsedSignalState = 2, OutputLevel=3,
                           SubstructureTools = [JetSubStructure.NSubjettinessTool("myNSubjettinessTool", N=[1,2,3], R0=myjetdr, GroomedjetsAuthor = catNames),
                                       JetSubStructure.KtHadSubstructureTool("myhadtool", GroomedjetsAuthor = catNames),
                                       JetSubStructure.DipolarityTool("myDipolarityTool",GroomedjetsAuthor = catNames),
                                       JetSubStructure.JetVoronoiAreaCalcTool("myVoronoiArea", GroomedjetsAuthor = catNames, JetdR = myjetdr, JetInputTool = getStandardInputTools(input=myjetinput)[0]) ])


  outkey = myjetfinder + '%d'%(myjetdr*10) + myjetinput
  if myjetinput == 'Topo':
     outkey += 'EM'
  outkey += 'Jets'
 
  myjetgetter = make_StandardJetGetter(myjetfinder, myjetdr, myjetinput, seq = theseq, doCalib=mydoCalib, calibName=mycalibName,addDefaultMoment=False, minPt=30*GeV,
                                       outputCollectionName = outkey)
  contname = myjetgetter.outputKey()

  extra_moments_list = []
  if myjetgetter.jetAlgorithmHandle() == None:     # JetCollection already in AOD
      if contname == None:
         contname=myjetgetter.buildName()
      print 'yo2: ', contname
  else:
      extra_moments_list += [widthtool] 


  #add_jetMoments_to_JetAlg(myjetgetter, [JetWidthTool()])

  # ------------------------------------------------
  # Associate a vertex and set the JVF moment. Must be placed AFTER vertex correction
  # ------------------------------------------------
  from AthenaCommon.DetFlags import DetFlags
  from AthenaCommon.AppMgr import ToolSvc
  noVertex = jobproperties.Beam.beamType == 'cosmics' or jobproperties.Beam.beamType == 'singlebeam'
  if DetFlags.detdescr.ID_on() and jetFlags.doJVF() and 'Truth' not in myjetinput and not noVertex:
     from JetSubStructure.mySetupJetMomentTools import mygetJetVertexAssociationTool
     myjvatool = mygetJetVertexAssociationTool(myjetfinder, myjetdr,myjetinput,'Custom%d'%(myjetdr*10))
     #add_jetMoments_to_JetAlg(myjetgetter, [myjvatool])
     extra_moments_list += [myjvatool]

  make_JetMomentGetter(contname , extra_moments_list + [assoc_tool, jetsubstructure_tool], theseq )

  return [ contname, catNames ]
コード例 #11
0
# Quality from cells.
if jtm.haveJetCaloCellQualityTool:
    jtm += JetCaloCellQualityTool("caloqual_cell",
                                  LArQualityCut=4000,
                                  TileQualityCut=254,
                                  TimingCuts=[5, 10],
                                  Calculations=[
                                      "LArQuality", "N90Cells",
                                      "FracSamplingMax", "NegativeE", "Timing",
                                      "HECQuality", "Centroid", "AverageLArQF"
                                  ])

# Jet width.
jtm += JetWidthTool("width",
                    WeightPFOToolEM=jtm.pflowweighter,
                    WeightPFOToolLC=jtm.pflowweighter_LC)

# Calo layer energies.
jtm += JetCaloEnergies("jetens")

# Read in missing cell map (needed for the following)
# commented out : incompatible with trigger : ATR-9696
## if jtm.haveJetRecCalo:
##     def missingCellFileReader():
##       import os
##       dataPathList = os.environ[ 'DATAPATH' ].split(os.pathsep)
##       dataPathList.insert(0, os.curdir)
##       from AthenaCommon.Utils.unixtools import FindFile
##       RefFileName = FindFile( "JetBadChanCorrTool.root" ,dataPathList, os.R_OK )
##       from AthenaCommon.AppMgr import ServiceMgr