Ejemplo n.º 1
0
    def configure(self):
        mlog = logging.getLogger('METGetterAOD::configure:')
        mlog.info('entering')

        # now configure the algorithm
        try:
            from MissingET.MissingETConf import METAlg
            theMETAlg = METAlg("METAlg")
        except:
            mlog.error("could not import MissingET.METAlg")
            print traceback.format_exc()
            return False

#------------------------------------------------------------------------------------------------
# configure tools: METFinal
        try:
            from MissingET.MissingETConf import METFinalTool

            theMETRefFinal = METFinalTool(
                "RefFinal",
                WhichCalc="RefCalib",  # Refined Calib applied 
                EleRefKey="MET_RefEle",  # Specify key for Ref Ele	   
                GammaRefKey="MET_RefGamma",  # Specify key for Ref Gamma 
                #MuoRefKey   = "MET_RefMuon",    # Specify key for Ref Muon
                #TauRefKey   = "MET_RefTau",     # Specify key for Ref Tau
                JetRefKey="MET_RefJet",  # Specify key for Ref Jet	  
                CellOutKey="MET_CellOut",  # Specify key for Ref CellOut   
                muonKey=
                "MET_MuonBoy",  # Key for Muon contrib: MET_Muon, MET_MuonBoy 
                cryoTerm="Off",  # "On"/"Off"= cryostat corr On / Off    
                cryoKey="MET_Cryo",  # Key for Cryo corr: MET_Cryo, MET_CryoCone
                outKey="MET_RefFinal")

        except:
            mlog.error("could not get handle to METRefFinal Quit")
            print traceback.format_exc()
            return False

# add METFinalTool to list of tools
        theMETAlg.AlgTools += [theMETRefFinal.getFullName()]

        # add tools to alg
        theMETAlg += theMETRefFinal

        #------------------------------------------------------------------------------------------------
        # add algorithm to topSequence (this should always come at the end)

        mlog.info(" now adding to topSequence")

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence.ZeeSequence += theMETAlg

        return True
Ejemplo n.º 2
0
    def configure(self):
        mlog = logging.getLogger('METGetterTrack::configure:')
        mlog.info('entering')

        # now configure the algorithm
        try:
            from MissingET.MissingETConf import METAlg
            theMETAlg = METAlg("METAlg")
        except:
            mlog.error("could not import MissingET.METAlg")
            mlog.error(traceback.format_exc())
            return False

        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.detdescr.ID_on():
            try:
                from MissingET.MissingETConf import METTrackTool
                theMETTrackTool = METTrackTool("METTrack")

                # if doFastCaloSim set calibrator tool for ATLFAST2
                from CaloRec.CaloCellFlags import jobproperties
                if jobproperties.CaloCellFlags.doFastCaloSim:
                    doAtlfastII = True
                else:
                    doAtlfastII = False

                cellcalibtool = getStandardCalibTool(doAtlfastII)
                calibtool_name = cellcalibtool.name()

                # add track select user interface
                theMETTrackTool.trackd0 = 1.5  # cut on trackd0
                theMETTrackTool.trackz0 = 1.50  # cut on trackz0
                theMETTrackTool.trackPtMin = 500.0  # cut on trackPtMin
                theMETTrackTool.trackPtMax = 9999999.0
                theMETTrackTool.trackPixelHits = 1
                theMETTrackTool.trackSCTHits = 6
                theMETTrackTool.trackChi2OverNdf = 999999
                theMETTrackTool.UseInsideOut = 1

                theMETTrackTool.outKey = "MET_Track"

            except:
                mlog.error("could not get handle to METTrackTool Quit")
                mlog.error(traceback.format_exc())
                return False

            # add cellcalibtool
            theMETTrackTool += cellcalibtool

            # add  METTrackTool to list of tools
            theMETAlg.AlgTools += [theMETTrackTool.getFullName()]

            # add tools to alg
            theMETAlg += theMETTrackTool

#------------------------------------------------------------------------------------------------
# add algorithm to topSequence (this should always come at the end)

        mlog.info(" now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theMETAlg

        return True
Ejemplo n.º 3
0
doMissingET = True
# main jobOption
include("RecExCommon/RecExCommon_flags.py")
include("RecExCommon/RecExCommon_topOptions.py")
GeoModelSvc = Service("GeoModelSvc")
GeoModelSvc.IgnoreTagDifference = True

from AthenaCommon.GlobalFlags import globalflags
globalflags.DetDescrVersion = "ATLAS-GEO-02-01-00"
include("RecExCond/AllDet_detDescr.py")

############################################################################################
#configure MET muon term re-reconstruction since it is off by default
############################################################################################
from MissingET.MissingETConf import METAlg
theMETAlg = METAlg("METAlg")

from MissingET.MissingETConf import METMuonTool
theMETMuonBoyTrackTool = METMuonTool(
    "MuonBoyTrack",
    MuonContainer="StacoMuonCollection",
    outKey="MET_MuonBoy_Track",
    ApplyChi2OverDoFCut="Off",
    cut1Chi2OverDoF=0.,
    cut2Chi2OverDoF=10.,
    CaloMuonCollection="CaloMuonCollection",
    MuTagCollection="StacoMuonCollection",
    JetContainerName="AntiKt6LCTopoJets",
    Muon_Selected_Type="Isol",  # Isol = use muon tracks
    Muon_Add_Crack="On"  # add muon tracks from cracks
)
#----------------------------------------------------------------------
#      jobOptions for MissingET package
#----------------------------------------------------------------------
from MissingET.MissingETConf import METAlg
topSequence += METAlg()

from MissingET.MissingETConf import METPartTruthTool
METPartTruth = METPartTruthTool('Truth')

#----------------------------------------------------------------------
# Name of MissingET AlgTools:
#----------------------------------------------------------------------
topSequence.METAlg.AlgTools = [METPartTruth.getFullName()]

#----------------------------------------------------------------------
#  AlgTools  steering
#----------------------------------------------------------------------
#
# - METPartTruthTool
#
METPartTruth.etafullsim = 3.2
METPartTruth.outKey = "MET_Truth"
Ejemplo n.º 5
0
    def configure(self):
        mlog = logging.getLogger('METRefGetter_newplup::configure:')
        mlog.info('entering')

        # now configure the algorithm
        try:
            from MissingET.MissingETConf import METRefinedAlgorithm
            theMETRefAlg = METRefinedAlgorithm("METRefAlg" + self.suffix)
            theMETRefAlgMu = METRefinedAlgorithm("METRefAlgMu" + self.suffix)

            from RecExConfig.RecFlags import rec
            theMETRefAlg.CompositionMapKey = "MET_RefComposition" + self.suffix

            if rec.readAOD():
                theMETRefAlg.UseCells = False
                theMETRefAlgMu.UseCells = False
            else:
                theMETRefAlg.UseCells = True
                theMETRefAlgMu.UseCells = True
        except:
            mlog.error("could not import MissingET.METRefAlg")
            mlog.error(traceback.format_exc())
            return False
#------------------------------------------------------------------------------------------------
# configure the tools: METRefinedEleTool => calibrator Tool for ATLFASTII

        try:
            from MissingET.MissingETConf import METRefinedEleTool
            theMETRefinedEleTool = METRefinedEleTool("METRefEle" + self.suffix)
            # refEleTool = theMETRefinedEleTool.getHandle()
            theMETRefinedEleTool.EgammaInputCollectionKey = self.ele_EgammaInputCollectionKey
            theMETRefinedEleTool.noCut = self.ele_noCut
            theMETRefinedEleTool.isEM = self.ele_isEM
            theMETRefinedEleTool.ElectronEtCut = self.ele_EtCut
            theMETRefinedEleTool.CalibType = self.ele_calibType  # H1 or EmScale or KFact or RefCalib
            # if doFastCaloSim set calibrator tool for ATLFAST2
            from CaloRec.CaloCellFlags import jobproperties
            if jobproperties.CaloCellFlags.doFastCaloSim:
                doAtlfastII = True
            else:
                doAtlfastII = False

            cellcalibtool = getStandardCalibTool(doAtlfastII)
            calibtool_name = cellcalibtool.name()
            theMETRefinedEleTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name
            theMETRefinedEleTool.BackNavigationTo = "Cell"  # to "Cell"
            theMETRefinedEleTool.MissingETOutKey = "MET_RefEle" + self.suffix
            print("******************* key = " +
                  theMETRefinedEleTool.MissingETOutKey)
            print("******************* key2 = " +
                  theMETRefinedEleTool.MissingETOutKey)
            #-----------------
            from MissingET.MissingETConf import METClusterResolverTool
            theMETEleResolver = METClusterResolverTool("EleResolve" +
                                                       self.suffix)
            theMETEleResolver.ReferenceClusterContainer = "CaloCalTopoCluster"
            theMETRefinedEleTool.ClusterResolverTool = theMETEleResolver.getFullName(
            )

            #------------------------------------------------------------------------------------
            if self.photon_doPhotonTool:
                theMETRefinedGammaTool = METRefinedEleTool("METRefGamma" +
                                                           self.suffix)
                theMETRefinedGammaTool.EgammaInputCollectionKey = self.gamma_EgammaInputCollectionKey
                theMETRefinedGammaTool.EleInputCollectionKey = self.gamma_EleInputCollectionKey
                theMETRefinedGammaTool.isEM = self.gamma_isEM
                theMETRefinedGammaTool.noCut = self.gamma_noCut
                theMETRefinedGammaTool.ElectronEtCut = self.gamma_EtCut
                theMETRefinedGammaTool.CalibType = self.gamma_calibType  # H1 or EmScale or KFact or RefCalib
                theMETRefinedGammaTool.isEMMatch = self.gamma_isEMMatch
                theMETRefinedGammaTool.ElectronEtCutMatch = self.gamma_ElectronEtCutMatch
                from CaloRec.CaloCellFlags import jobproperties
                if jobproperties.CaloCellFlags.doFastCaloSim:
                    doAtlfastII = True
                else:
                    doAtlfastII = False
                cellcalibtool = getStandardCalibTool(doAtlfastII)
                calibtool_name = cellcalibtool.name()
                theMETRefinedGammaTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

                theMETRefinedGammaTool.BackNavigationTo = "Cell"  # to "Cell"
                theMETRefinedGammaTool.MissingETOutKey = "MET_RefGamma" + self.suffix
                #-----------------
                theMETGammaResolver = METClusterResolverTool("GammaResolve" +
                                                             self.suffix)
                theMETGammaResolver.ReferenceClusterContainer = "CaloCalTopoCluster"
                theMETRefinedGammaTool.ClusterResolverTool = theMETGammaResolver.getFullName(
                )

        except:
            mlog.error("could not get handle to METRefinedEleTool Quit")
            mlog.error(traceback.format_exc())
            return False

# add cellcalibtool
        theMETRefinedEleTool += cellcalibtool
        theMETRefinedEleTool += theMETEleResolver
        if self.photon_doPhotonTool:
            theMETRefinedGammaTool += cellcalibtool
            theMETRefinedGammaTool += theMETGammaResolver

# add the METRefinedEleTool to list of tools
        theMETRefAlg.AlgTools += [theMETRefinedEleTool.getFullName()]
        if self.photon_doPhotonTool:
            theMETRefAlg.AlgTools += [theMETRefinedGammaTool.getFullName()]

# add tools to alg
        theMETRefAlg += theMETRefinedEleTool
        if self.photon_doPhotonTool:
            theMETRefAlg += theMETRefinedGammaTool
        #theMETRefAlg.OutputLevel = DEBUG

        #------------------------------------------------------------------------------------------------
        # configure tools: METRefinedTauTool => calibrator Tool for ATLFASTII
        if self.tau_doTauTool:
            try:
                from MissingET.MissingETConf import METRefinedTauTool
                theMETRefinedTauTool = METRefinedTauTool("METRefTau" +
                                                         self.suffix)

                theMETRefinedTauTool.TauInputCollectionKey = self.tau_TauInputCollectionKey  # or Tau1P3PContainer
                theMETRefinedTauTool.isTau = self.tau_isTau  #"Tight"  	 # Tight, Medium, Loose, Old
                theMETRefinedTauTool.CalibType = self.tau_calibType  # H1 or LocHad
                theMETRefinedTauTool.TauSignalConeSize = self.tau_TauSignalConeSize
                theMETRefinedTauTool.TauPtCut = self.tau_TauPtCut
                theMETRefinedTauTool.RemoveResiduals = self.tau_RemoveResiduals
                theMETRefinedTauTool.MinimumMETContribution = self.tau_MinimumMETContribution

                # if doFastCaloSim set calibrator tool for ATLFAST2
                from CaloRec.CaloCellFlags import jobproperties
                if jobproperties.CaloCellFlags.doFastCaloSim:
                    doAtlfastII = True
                else:
                    doAtlfastII = False

                cellcalibtool = getStandardCalibTool(doAtlfastII)
                calibtool_name = cellcalibtool.name()
                theMETRefinedTauTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

                theMETRefinedTauTool.BackNavigationTo = "Topo"
                theMETRefinedTauTool.Cell2ClusterMapKey = "CaloCell2TopoCluster"
                theMETRefinedTauTool.MissingETOutKey = "MET_RefTau" + self.suffix

            except:
                mlog.error("could not get handle to METRefinedTauTool Quit")
                mlog.error(traceback.format_exc())
                return False

# add cellcalibtool
            theMETRefinedTauTool += cellcalibtool

            # add  METRefinedTauTool to list of tools
            theMETRefAlg.AlgTools += [theMETRefinedTauTool.getFullName()]

            # add tools to alg
            theMETRefAlg += theMETRefinedTauTool

        #------------------------------------------------------------------------------------------------
        # configure tools: METRefinedJetTool => calibrator Tool for ATLFASTII
        try:
            from MissingET.MissingETConf import METRefinedJetTool
            theMETRefinedJetTool = METRefinedJetTool("METRefJet" + self.suffix)
            if rec.readAOD():
                theMETRefinedJetTool.JetInputCollectionKey = self.jet_JetInputCollectionKey
                theMETRefinedJetTool.VxContainerKey = self.jet_vxcontainerkey
                theMETRefinedJetTool.JVFTool = jvatool
                theMETRefinedJetTool.UseCustomVxContainer = self.jet_UseCustomVxContainer
                theMETRefinedJetTool.JetPtCut = self.jet_JetPtCut  # cut on jet pt
                #theMETRefinedJetTool.JetMaxPtCut           = self.jet_JetMaxPtCut       # cut on jet pt
                theMETRefinedJetTool.CalibType = self.jet_calibType  # H1 or LocHad
                theMETRefinedJetTool.ApplyJetScale = self.jet_ApplyJetScale
                theMETRefinedJetTool.UseJetMomentForScale = self.jet_UseJetMomentForScale
                theMETRefinedJetTool.JetMomentForScale = self.jet_JetMomentForScale
                theMETRefinedJetTool.ApplyJetJVF = self.jet_ApplyJetJVF
                theMETRefinedJetTool.UseJetMomentForScale = self.jet_UseJetMomentForScale
                theMETRefinedJetTool.MissingETOutKey = "MET_RefJet" + self.suffix
                theMETRefinedJetTool.RemoveResiduals = self.jet_RemoveResiduals
                theMETRefinedJetTool.MinimumMETContribution = self.jet_MinimumMETContribution
            else:
                theMETRefinedJetTool.JetInputCollectionKey = self.jet_JetInputCollectionKey
                theMETRefinedJetTool.VxContainerKey = self.jet_vxcontainerkey
                theMETRefinedJetTool.JVFTool = jvatool
                theMETRefinedJetTool.UseCustomVxContainer = self.jet_UseCustomVxContainer
                theMETRefinedJetTool.JetPtCut = self.jet_JetPtCut
                theMETRefinedJetTool.JetMaxPtCut = self.jet_JetMaxPtCut  # cut on jet pt
                theMETRefinedJetTool.CalibType = self.jet_calibType  # H1 or LocHad
                theMETRefinedJetTool.ApplyJetScale = self.jet_ApplyJetScale
                theMETRefinedJetTool.UseJetMomentForScale = self.jet_UseJetMomentForScale
                theMETRefinedJetTool.JetMomentForScale = self.jet_JetMomentForScale
                theMETRefinedJetTool.ApplyJetJVF = self.jet_ApplyJetJVF
                theMETRefinedJetTool.UseJetMomentForScale = self.jet_UseJetMomentForScale
                theMETRefinedJetTool.BackNavigationTo = "Topo"  # to "Topo" or to "Cell"
                theMETRefinedJetTool.MissingETOutKey = "MET_RefJet" + self.suffix
                theMETRefinedJetTool.RemoveResiduals = True
                theMETRefinedJetTool.MinimumMETContribution = 0.5

# if doFastCaloSim set calibrator tool for ATLFAST2
            from CaloRec.CaloCellFlags import jobproperties
            if jobproperties.CaloCellFlags.doFastCaloSim:
                doAtlfastII = True
            else:
                doAtlfastII = False
            cellcalibtool = getStandardCalibTool(doAtlfastII)
            calibtool_name = cellcalibtool.name()
            theMETRefinedJetTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name
        except:
            mlog.error("could not get handle to METRefinedJetTool Quit")
            mlog.error(traceback.format_exc())
            return False

        # add cellcalibtool
        theMETRefinedJetTool += cellcalibtool

        # add METRefinedJetTool to list of tools
        theMETRefAlg.AlgTools += [theMETRefinedJetTool.getFullName()]

        # add tools to alg
        theMETRefAlg += theMETRefinedJetTool
        #------------------------------------------------------------------------------------------------
        # configure tools: METSoftJetsTool
        if self.jet_RunSoftJetsTool:
            try:
                from MissingET.MissingETConf import METRefinedJetTool
                theMETSoftJetsTool = METRefinedJetTool("METSoftJets" +
                                                       self.suffix)
                if rec.readAOD():
                    theMETSoftJetsTool.JetInputCollectionKey = self.jet_JetInputCollectionKey
                    theMETSoftJetsTool.JVFTool = jvatool
                    theMETSoftJetsTool.UseCustomVxContainer = False
                    theMETSoftJetsTool.JetPtCut = self.jet_SoftJetsPtCut  # cut on jet pt
                    theMETSoftJetsTool.JetMaxPtCut = self.jet_SoftJetsMaxPtCut  # cut on jet pt
                    theMETSoftJetsTool.CalibType = self.jet_SoftJetsCalibType
                    theMETSoftJetsTool.ApplyJetScale = self.jet_ApplySoftJetsScale
                    theMETSoftJetsTool.UseJetMomentForScale = self.jet_UseJetMomentForScale
                    theMETSoftJetsTool.JetMomentForScale = self.jet_JetMomentForScale
                    theMETSoftJetsTool.MissingETOutKey = "MET_SoftJets" + self.suffix
                    theMETSoftJetsTool.RemoveResiduals = self.jet_SoftJetsRemoveResiduals
                    theMETSoftJetsTool.MinimumMETContribution = self.jet_SoftJetsMinimumMETContribution
                else:
                    theMETSoftJetsTool.JetInputCollectionKey = self.jet_JetInputCollectionKey
                    theMETSoftJetsTool.JVFTool = jvatool
                    theMETSoftJetsTool.UseCustomVxContainer = False
                    theMETSoftJetsTool.JetPtCut = self.jet_SoftJetsPtCut
                    theMETSoftJetsTool.JetMaxPtCut = self.jet_SoftJetsMaxPtCut
                    theMETSoftJetsTool.CalibType = self.jet_SoftJetsCalibType
                    theMETSoftJetsTool.ApplyJetScale = self.jet_ApplySoftJetsScale
                    theMETSoftJetsTool.UseJetMomentForScale = self.jet_UseJetMomentForScale
                    theMETSoftJetsTool.JetMomentForScale = self.jet_JetMomentForScale
                    theMETSoftJetsTool.BackNavigationTo = "Topo"  # to "Topo" or to "Cell"
                    theMETSoftJetsTool.MissingETOutKey = "MET_SoftJets" + self.suffix
                    theMETSoftJetsTool.RemoveResiduals = True
                    theMETSoftJetsTool.MinimumMETContribution = 0.5

                # if doFastCaloSim set calibrator tool for ATLFAST2
                from CaloRec.CaloCellFlags import jobproperties
                if jobproperties.CaloCellFlags.doFastCaloSim:
                    doAtlfastII = True
                else:
                    doAtlfastII = False
                cellcalibtool = getStandardCalibTool(doAtlfastII)
                calibtool_name = cellcalibtool.name()
                theMETSoftJetsTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name
            except:
                mlog.error("could not get handle to METSoftJetsTool Quit")
                mlog.error(traceback.format_exc())
                return False

            # add cellcalibtool
            theMETSoftJetsTool += cellcalibtool

            # add METSoftJetsTool to list of tools
            theMETRefAlg.AlgTools += [theMETSoftJetsTool.getFullName()]

            # add tools to alg
            theMETRefAlg += theMETSoftJetsTool

        #------------------------------------------------------------------------------------------------
# configure tools: METRefinedMuonTool
        if not rec.readAOD():
            try:
                from AthenaCommon.DetFlags import DetFlags
                if DetFlags.detdescr.Muon_on():
                    try:
                        from MissingET.MissingETConf import METRefinedMuonTool
                        theMETRefMuonTrackTool = METRefinedMuonTool(
                            "METRefMuonTrack" + self.suffix,
                            MuonContainer=self.muon_Container(),
                            outKey="MET_RefMuon_Track_" + self.muon_algorithm +
                            self.suffix,
                            cut1Chi2OverDoF=-1000.,  # or 0.  if Muid
                            cut2Chi2OverDoF=1000.,  # or 10. if Muid
                            CaloMuonCollection="CaloMuonCollection",
                            MuTagCollection=self.muon_Container(),
                            JetContainerName=self.
                            jet_JetInputCollectionKey,  #theMETRefinedJetTool.JetInputCollectionKey,
                            Muon_Selected_Type="Isol",  # Isol = use muon tracks
                            Muon_Add_Crack="On",  # add muon tracks from cracks
                            IsolDefinition=self.muon_isolationAlg,
                            fillComposition=False)
                        theMETRefMuonSpectroTool = METRefinedMuonTool(
                            "METRefMuonSpectro" + self.suffix,
                            MuonContainer=self.muon_Container(
                            ),  # or "MuidMuonCollection"
                            outKey="MET_RefMuon_" + self.muon_algorithm +
                            self.suffix,
                            cut1Chi2OverDoF=-1000.,  # or 0.  if Muid
                            cut2Chi2OverDoF=1000.,  # or 10. if Muid
                            CaloMuonCollection="CaloMuonCollection",
                            MuTagCollection=self.muon_Container(),
                            JetContainerName=self.
                            jet_JetInputCollectionKey,  #theMETRefinedJetTool.JetInputCollectionKey,
                            Muon_Selected_Type=
                            "NonIsol",  # NonIsol = use spectro muons
                            IsolDefinition=self.muon_isolationAlg,
                            Muon_Add_Crack="Off")
                        # add theMETRefMuonTool to list of tools
                        theMETRefAlg.AlgTools += [
                            theMETRefMuonTrackTool.getFullName()
                        ]
                        theMETRefAlg.AlgTools += [
                            theMETRefMuonSpectroTool.getFullName()
                        ]
                        # add tool to alg
                        theMETRefAlg += theMETRefMuonTrackTool
                        theMETRefAlg += theMETRefMuonSpectroTool
                    except:
                        mlog.error(
                            "could not get handle to METRefinedMuonTool Quit")
                        mlog.error(traceback.format_exc())
                        return False
            except:
                mlog.error("could not import DetFlags")

        #------------------------------------------------------------------------------------------------
        # configure tools: METRefinedClusterTool => calibrator Tool for ATLFASTII
        try:
            from MissingET.MissingETConf import METRefinedClusterTool
            from MissingET.MissingETConf import METTrackSelectorTool
            from AthenaCommon.AppMgr import ToolSvc
            ToolSvc += METTrackSelectorTool("METTrackSelTool" + self.suffix)

            theMETRefinedClusterTool = METRefinedClusterTool("METRefCluster" +
                                                             self.suffix)
            theMETRefinedClusterTool.ClusterInputCollectionKey = "CaloCalTopoCluster"
            theMETRefinedClusterTool.VxContainerKey = self.cellout_vxcontainerkey
            theMETRefinedClusterTool.CalibType = self.cellout_calibType  # Eflow, Tracks
            theMETRefinedClusterTool.TrackType = self.cellout_trackType  # STTrack, STTrackPV,STTrackCone
            theMETRefinedClusterTool.MissingETOutKey = "MET_CellOut" + self.suffix
            mytrackselector = METTrackSelectorTool("METTrackSelTool" +
                                                   self.suffix)
            mytrackselector.JetContainerName = self.cellout_JetInputCollectionKey
            mytrackselector.MinPtTrack = self.cellout_pttrack
            theMETRefinedClusterTool.METTrackSelTool = mytrackselector

            # if doFastCaloSim set calibrator tool for ATLFAST2
            from CaloRec.CaloCellFlags import jobproperties
            if jobproperties.CaloCellFlags.doFastCaloSim:
                doAtlfastII = True
            else:
                doAtlfastII = False
            cellcalibtool = getStandardCalibTool(doAtlfastII)
            calibtool_name = cellcalibtool.name()
            theMETRefinedClusterTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

        except:
            mlog.error("could not get handle to METRefinedClusterTool Quit")
            mlog.error(traceback.format_exc())
            return False

        # add cellcalibtool
        theMETRefinedClusterTool += cellcalibtool

        # add METRefinedClusterTool to list of tools
        theMETRefAlg.AlgTools += [theMETRefinedClusterTool.getFullName()]

        # add tools to alg
        theMETRefAlg += theMETRefinedClusterTool
        #--------------------------------------------------------------------------------
        # configure tools: METRefinedClusterTool (2)  => only for STVF pile-up suppression
        if self.plupSuppCorr == "STVF":
            try:
                from MissingET.MissingETConf import METRefinedClusterTool
                from MissingET.MissingETConf import METTrackSelectorTool
                from AthenaCommon.AppMgr import ToolSvc
                ToolSvc += METTrackSelectorTool("METTrackSelTool" +
                                                self.suffix)

                theMETRefinedClusterTrackTool = METRefinedClusterTool(
                    "METRefClusterTrack" + self.suffix)
                theMETRefinedClusterTrackTool.ClusterInputCollectionKey = "CaloCalTopoCluster"
                theMETRefinedClusterTrackTool.VxContainerKey = self.cellout_vxcontainerkey
                theMETRefinedClusterTrackTool.CalibType = self.cellout_calibType2  # Eflow, Tracks
                theMETRefinedClusterTrackTool.TrackType = self.cellout_trackType2  # STTrack, STTrackPV,STTrackCone
                theMETRefinedClusterTrackTool.MissingETOutKey = "MET_CellOut_Track" + self.suffix
                mytrackselector = METTrackSelectorTool("METTrackSelTool" +
                                                       self.suffix)
                mytrackselector.JetContainerName = self.cellout_JetInputCollectionKey
                mytrackselector.MinPtTrack = self.cellout_pttrack
                theMETRefinedClusterTrackTool.METTrackSelTool = mytrackselector

            except:
                mlog.error(
                    "could not get handle to METRefinedClusterTool Quit")
                mlog.error(traceback.format_exc())
                return False

            # add cellcalibtool
            theMETRefinedClusterTrackTool += cellcalibtool

            # add METRefinedClusterTool to list of tools
            theMETRefAlg.AlgTools += [
                theMETRefinedClusterTrackTool.getFullName()
            ]

            # add tools to alg
            theMETRefAlg += theMETRefinedClusterTrackTool
            #--------------------------------------------------------------------------------
            # configure tools: METRefinedClusterTool (3) => only for STVF pile-up suppression
            try:
                from MissingET.MissingETConf import METRefinedClusterTool
                from MissingET.MissingETConf import METTrackSelectorTool
                from AthenaCommon.AppMgr import ToolSvc
                ToolSvc += METTrackSelectorTool("METTrackSelTool" +
                                                self.suffix)

                theMETRefinedClusterTrackPVTool = METRefinedClusterTool(
                    "METRefClusterTrackPV" + self.suffix)
                theMETRefinedClusterTrackPVTool.ClusterInputCollectionKey = "CaloCalTopoCluster"
                theMETRefinedClusterTrackPVTool.VxContainerKey = self.cellout_vxcontainerkey
                theMETRefinedClusterTrackPVTool.CalibType = self.cellout_calibType3  # Eflow, Tracks
                theMETRefinedClusterTrackPVTool.TrackType = self.cellout_trackType3  # STTrack, STTrackPV,STTrackCone
                theMETRefinedClusterTrackPVTool.MissingETOutKey = "MET_CellOut_TrackPV" + self.suffix
                mytrackselector = METTrackSelectorTool("METTrackSelTool" +
                                                       self.suffix)
                mytrackselector.JetContainerName = self.cellout_JetInputCollectionKey
                mytrackselector.MinPtTrack = self.cellout_pttrack
                theMETRefinedClusterTrackPVTool.METTrackSelTool = mytrackselector

            except:
                mlog.error(
                    "could not get handle to METRefinedClusterTool Quit")
                mlog.error(traceback.format_exc())
                return False

            # add cellcalibtool
            theMETRefinedClusterTrackPVTool += cellcalibtool

            # add METRefinedClusterTool to list of tools
            theMETRefAlg.AlgTools += [
                theMETRefinedClusterTrackPVTool.getFullName()
            ]

            # add tools to alg
            theMETRefAlg += theMETRefinedClusterTrackPVTool

#------------------------------------------------------------------------------------------------
# configure tools: METMuonTool
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.detdescr.Muon_on():
            try:
                from MissingET.MissingETConf import METMuonTool
                theMETMuonBoyTrackTool = METMuonTool(
                    "MuonIsol" + self.suffix,
                    MuonContainer=self.muon_Container(),
                    outKey="MET_Muon_Isol_" + self.muon_algorithm +
                    self.suffix,
                    ApplyChi2OverDoFCut="Off",
                    cut1Chi2OverDoF=0.,
                    cut2Chi2OverDoF=10.,
                    CaloMuonCollection="CaloMuonCollection",
                    MuTagCollection=self.muon_Container(),
                    JetContainerName=theMETRefinedJetTool.
                    JetInputCollectionKey,
                    Muon_Selected_Type="Isol",  # Isol = use muon tracks
                    Add_MuTag="On",  # add muon tracks from cracks
                    IsolDefinition=self.muon_isolationAlg,
                    TrackMethod=self.muon_trackMethod())
                theMETMuonBoySpectroTool = METMuonTool(
                    "MuonNonIsol" + self.suffix,
                    MuonContainer=self.muon_Container(),
                    outKey="MET_Muon_NonIsol_" + self.muon_algorithm +
                    self.suffix,
                    ApplyChi2OverDoFCut="Off",
                    cut1Chi2OverDoF=0.,
                    cut2Chi2OverDoF=10.,
                    CaloMuonCollection="CaloMuonCollection",
                    MuTagCollection=self.muon_Container(),
                    JetContainerName=theMETRefinedJetTool.
                    JetInputCollectionKey,
                    Muon_Selected_Type="NonIsol",  # NonIsol = use spectro muons
                    IsolDefinition=self.muon_isolationAlg,
                    TrackMethod=self.muon_trackMethod())
                theMETMuonTool = METMuonTool(
                    "Muon" + self.suffix,
                    MuonContainer=self.muon_Container(),
                    outKey="MET_Muon_" + self.muon_algorithm + self.suffix,
                    ApplyChi2OverDoFCut="Off",
                    cut1Chi2OverDoF=0.,
                    cut2Chi2OverDoF=10.,
                    CaloMuonCollection="CaloMuonCollection",
                    MuTagCollection=self.muon_Container(),
                    JetContainerName=theMETRefinedJetTool.
                    JetInputCollectionKey,
                    Muon_Selected_Type="All",  # All = use spectro muons
                    IsolDefinition=self.muon_isolationAlg,
                    TrackMethod=self.muon_trackMethod())

            except:
                mlog.error("could not get handle to METMuonTool Quit")
                mlog.error(traceback.format_exc())
                return False

# add the METMuonTool to list of tools
            theMETRefAlg.AlgTools += [theMETMuonBoyTrackTool.getFullName()]
            theMETRefAlg.AlgTools += [theMETMuonBoySpectroTool.getFullName()]
            theMETRefAlgMu.AlgTools += [theMETMuonTool.getFullName()]

            # add tool to alg
            theMETRefAlg += theMETMuonBoyTrackTool
            theMETRefAlg += theMETMuonBoySpectroTool
            theMETRefAlgMu += theMETMuonTool

        #------------------------------------------------------------------------------------------------
        mlog.info(" now adding to sequence")
        self.sequence += theMETRefAlg
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.detdescr.Muon_on():
            self.sequence += theMETRefAlgMu
        #
        #
        #
        #
        #
        #
        #
        #
        #
        #
        try:
            from MissingET.MissingETConf import METAlg
            theMETAlg = METAlg("METAlg" + self.suffix)
        except:
            mlog.error("could not import MissingET.METAlg")
            mlog.error(traceback.format_exc())
            return False
#------------------------------------------------------------------------------------------------
        try:
            from MissingET.MissingETConf import METCryoTool

            theMETCryoTopoTool = METCryoTool("CryoTopo" + self.suffix)

            theMETCryoTopoTool.JetCollectionName = theMETRefinedJetTool.JetInputCollectionKey
            # if doFastCaloSim set calibrator tool for ATLFAST2
            from CaloRec.CaloCellFlags import jobproperties
            if jobproperties.CaloCellFlags.doFastCaloSim:
                doAtlfastII = True
            else:
                doAtlfastII = False

            cellcalibtool = getStandardCalibTool(doAtlfastII)
            calibtool_name = cellcalibtool.name()
            theMETCryoTopoTool.CalibToolName = 'H1WeightToolCSC12Generic/' + calibtool_name

            theMETCryoTopoTool.outKey = "MET_Cryo" + self.suffix

            # add cellcalibtool
            theMETCryoTopoTool += cellcalibtool

            # add theMETCryoTool to list of tools
            theMETAlg.AlgTools += [theMETCryoTopoTool.getFullName()]

            # add tool to alg
            theMETAlg += theMETCryoTopoTool
        except:
            mlog.error("could not get handle to METCryoTopoTool Quit")
            mlog.error(traceback.format_exc())
            return False

#------------------------------------------------------------------------------------------------
# configure tools: METFinal
        try:
            from MissingET.MissingETConf import METFinalTool
            theMETMuonFinal = METFinalTool(
                "MuFinal" + self.suffix,
                WhichCalc="MuonCalc",  # calculate final muon term
                outKey="MET_Muon_Total_" + self.muon_algorithm +
                self.suffix,  # output key
                muonBOYTrack="MET_Muon_Isol_" + self.muon_algorithm +
                self.suffix,  # key for track muons
                muonBOYSpectro="MET_Muon_NonIsol_" + self.muon_algorithm +
                self.suffix,  # key for spectro muons
            )
            if self.jet_RunSoftJetsTool:
                theMETRefFinal = METFinalTool(
                    "RefFinal" + self.suffix,
                    WhichCalc="RefCalib",  # Refined Calib applied 
                    plupSupp=self.plupSuppCorr,  # Off, STVF
                    EleRefKey="MET_RefEle" +
                    self.suffix,  # Specify key for Ref Ele        
                    GammaRefKey="MET_RefGamma" +
                    self.suffix,  # Specify key for Ref Gamma 
                    MuoRefKey="MET_RefMuon_" + self.muon_algorithm +
                    self.suffix,  # Specify key for Ref Muon	
                    TauRefKey="MET_RefTau" +
                    self.suffix,  # Specify key for Ref Tau       
                    JetRefKey="MET_RefJet" +
                    self.suffix,  # Specify key for Ref Jet       
                    SoftJetsKey="MET_SoftJets" +
                    self.suffix,  # Specify key for SoftJets    
                    CellOutKey="MET_CellOut" +
                    self.suffix,  # Specify key for Ref CellOut   
                    muonKey="MET_Muon_Total_" + self.muon_algorithm +
                    self.suffix,  # Key for Muon contrib
                    cryoTerm=self.
                    cryo_ApplyCorrection,  # "On"/"Off"= cryostat corr On / Off    
                    cryoKey="MET_Cryo" +
                    self.suffix,  # Key for Cryo corr: MET_Cryo, MET_CryoCone
                    outKey="MET_RefFinal" + self.suffix)
            if not self.jet_RunSoftJetsTool and self.plupSuppCorr != "STVF":
                theMETRefFinal = METFinalTool(
                    "RefFinal" + self.suffix,
                    WhichCalc="RefCalib",  # Refined Calib applied 
                    plupSupp=self.plupSuppCorr,  # Off, STVF
                    EleRefKey="MET_RefEle" +
                    self.suffix,  # Specify key for Ref Ele        
                    GammaRefKey="MET_RefGamma" +
                    self.suffix,  # Specify key for Ref Gamma 
                    MuoRefKey="MET_RefMuon_" + self.muon_algorithm +
                    self.suffix,  # Specify key for Ref Muon	
                    TauRefKey="MET_RefTau" +
                    self.suffix,  # Specify key for Ref Tau       
                    JetRefKey="MET_RefJet" +
                    self.suffix,  # Specify key for Ref Jet       
                    CellOutKey="MET_CellOut" +
                    self.suffix,  # Specify key for Ref CellOut   
                    muonKey="MET_Muon_Total_" + self.muon_algorithm +
                    self.suffix,  # Key for Muon contrib
                    cryoTerm=self.
                    cryo_ApplyCorrection,  # "On"/"Off"= cryostat corr On / Off    
                    cryoKey="MET_Cryo" +
                    self.suffix,  # Key for Cryo corr: MET_Cryo, MET_CryoCone
                    outKey="MET_RefFinal" + self.suffix)
            if not self.jet_RunSoftJetsTool and self.plupSuppCorr == "STVF":
                theMETRefFinal = METFinalTool(
                    "RefFinal" + self.suffix,
                    WhichCalc="RefCalib",  # Refined Calib applied 
                    plupSupp=self.plupSuppCorr,  # Off, STVF
                    EleRefKey="MET_RefEle" +
                    self.suffix,  # Specify key for Ref Ele        
                    GammaRefKey="MET_RefGamma" +
                    self.suffix,  # Specify key for Ref Gamma 
                    MuoRefKey="MET_RefMuon_" + self.muon_algorithm +
                    self.suffix,  # Specify key for Ref Muon	
                    TauRefKey="MET_RefTau" +
                    self.suffix,  # Specify key for Ref Tau       
                    JetRefKey="MET_RefJet",  # Specify key for default Ref Jet 
                    SoftJetsKey=
                    "MET_SoftJets",  # Specify key for default SoftJets   
                    CellOutKey=
                    "MET_CellOut_Eflow",  # Specify key for default CellOutEflow
                    JetRefCorrKey="MET_RefJet" +
                    self.suffix,  # Specify key for Ref Jet Corr
                    CellOutEflowKey="MET_CellOut" +
                    self.suffix,  # Specify key for Ref CellOut   
                    celloutTrackKey="MET_CellOut_Track" +
                    self.suffix,  # Specify key for Ref CellOut   
                    celloutTrackPVKey="MET_CellOut_TrackPV" +
                    self.suffix,  # Specify key for Ref CellOut   
                    muonKey="MET_Muon_Total_" + self.muon_algorithm +
                    self.suffix,  # Key for Muon contrib
                    cryoTerm=self.
                    cryo_ApplyCorrection,  # "On"/"Off"= cryostat corr On / Off    
                    cryoKey="MET_Cryo" +
                    self.suffix,  # Key for Cryo corr: MET_Cryo, MET_CryoCone
                    outKey="MET_RefFinal" + self.suffix)
            if self.plupSuppCorr == "STVF":
                theMETCellOutSTVF = METFinalTool(
                    "CellOutCorr" + self.suffix,
                    WhichCalc="RefCalib",  # Refined Calib applied 
                    plupSupp=self.plupSuppCorr,  # Off, STVF
                    cellOutCorr=self.celloutCorrection,
                    EleRefKey="MET_RefEle" +
                    self.suffix,  # Specify key for Ref Ele        
                    GammaRefKey="MET_RefGamma" +
                    self.suffix,  # Specify key for Ref Gamma 
                    MuoRefKey="MET_RefMuon_" + self.muon_algorithm +
                    self.suffix,  # Specify key for Ref Muon  
                    TauRefKey="MET_RefTau" +
                    self.suffix,  # Specify key for Ref Tau 
                    JetRefKey="MET_RefJet",  # Specify key for Ref Jet 
                    SoftJetsKey=
                    "MET_SoftJets",  # Specify key for default SoftJets   
                    CellOutKey=
                    "MET_CellOut_Eflow",  # Specify key for default CellOutEflow
                    JetRefCorrKey="MET_RefJet" +
                    self.suffix,  # Specify key for Ref Jet       
                    CellOutEflowKey="MET_CellOut" +
                    self.suffix,  # Specify key for Ref CellOut   
                    celloutTrackKey="MET_CellOut_Track" +
                    self.suffix,  # Specify key for Ref CellOut   
                    celloutTrackPVKey="MET_CellOut_TrackPV" +
                    self.suffix,  # Specify key for Ref CellOut   
                    muonKey="MET_Muon_Total_" + self.muon_algorithm +
                    self.suffix,  # Key for Muon contrib
                    cryoTerm=self.
                    cryo_ApplyCorrection,  # "On"/"Off"= cryostat corr On / Off    
                    cryoKey="MET_Cryo" +
                    self.suffix,  # Key for Cryo corr: MET_Cryo, MET_CryoCone
                    outKey="MET_CellOutCorr" + self.suffix)

        except:
            mlog.error("could not get handle to METRefFinal Quit")
            mlog.error(traceback.format_exc())
            return False

# add METFinalTool to list of tools
        theMETAlg.AlgTools += [theMETMuonFinal.getFullName()]
        theMETAlg.AlgTools += [theMETRefFinal.getFullName()]
        if self.plupSuppCorr == "STVF":
            theMETAlg.AlgTools += [theMETCellOutSTVF.getFullName()]
# add tools to alg
        theMETAlg += theMETMuonFinal
        theMETAlg += theMETRefFinal
        if self.plupSuppCorr == "STVF":
            theMETAlg += theMETCellOutSTVF

#------------------------------------------------------------------------------------------------
# add algorithm to the specified Sequence (this should always come at the end)

        mlog.info(" now adding to sequence")
        self.sequence += theMETAlg

        return True