def muon_cuts(self, cg): import PyCintex PyCintex.loadDictionary("muonEventDict") from ROOT import MuonParameters if self.muon_algo == "Muid": good_author = lambda mu : mu.isAuthor(MuonParameters.MuidCo) else: good_author = lambda mu : mu.isAuthor(MuonParameters.STACO) and mu.isCombinedMuon() == 1 cg(Cut("author", good_author)) cg(Cut("pt", lambda mu : mu.pt() > 20*GeV, dep=good_author)) cg(Cut("msidmatch", lambda mu : abs(mu.inDetTrackParticle().pt() - mu.muonExtrapolatedTrackParticle().pt()) < 15*GeV, dep=good_author)) cg(Cut("mspt", lambda mu : mu.muonExtrapolatedTrackParticle().pt() > 10*GeV, dep=good_author)) cg(Cut("eta", lambda mu : abs(mu.eta()) < 2.4)) def vx_id_err(mu): vxp = self.vertices[0].recVertex().position() pavV0 = self.tool_ttv.perigeeAtVertex(mu.inDetTrackParticle(), vxp) return pavV0.parameters()[0]/pavV0.localErrorMatrix().error(0) cg(Cut("vx", lambda mu : abs(vx_id_err(mu)) < 10, dep=lambda mu : good_author(mu) and len(self.vertices) > 0)) cg(Cut("ptcone20", lambda mu : mu.parameter(MuonParameters.ptcone20)/mu.pt() < 0.1)) return cg
def loadLibs(): "Setup for both ROOTCORE and athena" import ROOT if 'AtlasVersion' in os.environ: # athena import PyCintex PyCintex.loadDictionary('egammaMVACalib') else: # ROOTCORE / AnalysisRelease if ROOT.gROOT.GetVersion()[0] == '5': # only for ROOT 5, not 6 tmp = ROOT.gROOT.ProcessLine('gSystem->Load("libCint")') tmp = ROOT.gROOT.ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C");
def electron_cuts(self, cg): # container selection electrons - all standalone # Electron Filters: import PyCintex PyCintex.loadDictionary('egammaEnumsDict') gROOT.ProcessLine(".L checkOQ.C+") from ROOT import egammaParameters, egammaOQ egOQ = egammaOQ() egOQ.initialize() from robustIsEMDefs import elRobusterTight cg(Cut("author", lambda el : el.author() in (1,3))) def author(el): return el.author() in (1,3) def pass_otx(el): rn = 999999 if self.is_mc else self.run_number eta, phi = el.cluster().eta(), el.cluster().phi() return egOQ.checkOQClusterElectron(rn, eta, phi) != 3 cg(Cut("otx", pass_otx, dep=author)) def cluster_pt(el): return el.cluster().e()*sin(theta_from_eta(el.cluster().eta())) cg(Cut("pt", lambda el : cluster_pt(el) > 20*GeV, dep=author)) def eta_in_range(eta): return abs(eta) < 2.47 and not (1.37 <= abs(eta) <= 1.52) cg(Cut("eta", lambda el: eta_in_range(el.cluster().eta()), dep=author)) cg(Cut("robusterTight", lambda el : elRobusterTight(el), dep=author)) def vertex0_d0_sig(el): assert self.vertices assert self.vertices[0] assert self.vertices[0].recVertex() assert self.vertices[0].recVertex().position() assert el.trackParticle() vxp = self.vertices[0].recVertex().position() pavV0 = self.tool_ttv.perigeeAtVertex(el.trackParticle(), vxp) return pavV0.parameters()[0]/pavV0.localErrorMatrix().error(0) cg(Cut("vertex_d0", lambda el : abs(vertex0_d0_sig(el)) < 10, dep=lambda el : author(el) and self.vertices)) cg(Cut("etiso30", lambda el : el.detailValue(egammaParameters.etcone30) < 6*GeV)) return cg
# mcROOTFileName = localMCFile, # mcROOTHistName = "mu_mc10b" # ) # add the fudge factors #include ( "gmsbFudgeFactors/gmsbFudgeFactors.py" ) #topSequence += theGmsbFudgeFactors #theGmsbFudgeFactors.WhichFudgeFactors = 200 # add the selection include("gmsbTools/gmsbTools_jobOptions.py") include("SUSYPhotonJetCleaningTool/SUSYPhotonJetCleaningTool_jobOptions.py") import PyCintex PyCintex.loadDictionary('egammaEnumsDict') from ROOT import egammaPID #if not 'RANDSEED' in dir(): # RANDSEED = 0 #print "random seed", RANDSEED gmsbSelectionTool.IsMC = True gmsbSelectionTool.SmearMC = False gmsbSelectionTool.SmearMC = False gmsbSelectionTool.ElectronPt = 25 * GeV gmsbSelectionTool.PhotonPt = 100 * GeV gmsbSelectionTool.MuonPt = 25 * GeV #gmsbSelectionTool.RandomSeed = RANDSEED #gmsbSelectionTool.MCEtconeShift = 0.0;
##=============================================================================== ## Name: TrigEgammaElectronIsEMCutDefs_medium.py ## ## Author: Ryan Mackenzie White ## Created: June 2014 ## ## Description: Medium trigger electron cut definitions for 2014 new tunes. ## ##=============================================================================== import PyCintex try : PyCintex.loadDictionary('ElectronPhotonSelectorToolsDict') except : pass from ROOT import egammaPID # Import a needed helper from PATCore.HelperUtils import * # Define GeV GeV = 1000.0 def TrigElectronIsEMMediumSelectorConfigDC14(theTool) : ''' This is for the Medium++ isEM definitions for the Trigger. ''' theTool = GetTool(theTool)
# main jobOption include("RecExCommon/RecExCommon_topOptions.py") from GaudiSvc.GaudiSvcConf import THistSvc ServiceMgr += THistSvc() ServiceMgr.THistSvc.Output += ["file1 DATAFILE='output.root' OPT='RECREATE'"] #topSequence += TrigDecChecker import PyUtils.RootUtils as ru ROOT = ru.import_root() import PyCintex PyCintex.loadDictionary('ElectronPhotonSelectorToolsDict') PyCintex.loadDictionary('egammaEnumsDict') from ROOT import LikeEnum from ROOT import egammaPID from ROOT import egammaParameters #from TrigEgammaHypo.TrigEGammaPIDdefs import SelectionDefElectron from ElectronPhotonSelectorTools.TrigEGammaPIDdefs import SelectionDefElectron from TrigEgammaValidation.TrigEgammaValidationConf import NavZeeTPCounts zee = NavZeeTPCounts() #zee.Chains = ['e24_medium1_iloose','e24_medium_iloose','e28_tight1_L2Star_idperf','e28_tight1_idperf'] #zee.Chains = ['e24_medium1_L1EM20V','e24_medium_L1EM20V','e24_medium1_iloose','e24_medium_iloose','e28_tight1_iloose_L2StarA','e28_tight_iloose_L2Star','e28_tight_iloose','e0_perf_L1EM15VH','e60_medium1'] #zee.IsEMloose = SelectionDefElectron.ElectronLoose1 #zee.IsEMloose1 = SelectionDefElectron.ElectronLoose1
import sys, platform, PyCintex as Dict if platform.system() == 'Linux': Dict.loadDictionary('libOnlineKernelDict.so') Dict.loadDictionary('libUPIDict.so') else: Dict.loadDictionary('OnlineKernelDict.dll') Dict.loadDictionary('UPIDict.dll') CPP = Dict.makeNamespace('CPP') gbl = Dict.makeNamespace('') #import os #l=os.popen("cat /proc/"+str(os.getpid())+"/maps | grep UPIR").readlines() #ll=os.popen('nm -C -D '+l[0].split(' ')[-1]) #for i in ll: # if i.find('upic_refresh')>=0: print i[:-1] EventType = 2 # graphics attributes NORMAL = 0x00 BOLD = 0x01 UNDERLINE = 0x02 INVERSE = 0x04 FLASH = 0x08 ATTRIBUTES = 0x0F ASCII = 0x00 GRAPHIC = 0x10 FONT_SUPP = 0x20 FONT_USER = 0x30 FONTS = 0x30
def init(self): self.a4 = OutputStream(open(self.file_name, "w"), "AOD2A4", Event, EventStreamInfo) import PyCintex PyCintex.loadDict("egammaAnalysisTools") self.tool_ciwt = PyAthena.py_tool("CaloIsolationWrapperTool", iface="ICaloIsolationWrapperTool") assert bool(self.tool_ciwt) PyCintex.loadDictionary("TrigMuonEvent") PyCintex.loadDictionary("TrigObjectMatching") self.tmefih = PyCintex.makeClass("TrigMatch::TrigMuonEFInfoHelper") from ROOT import vector PyCintex.loadDictionary("JetUtils") from ROOT import JetCaloHelper, JetCaloQualityUtils, Long, CaloSampling self.jet_emf = lambda jet : JetCaloHelper.jetEMFraction(jet) self.jet_hecF = lambda jet : JetCaloQualityUtils.hecF(jet) ### smax needed for jet cealning #### FIX THIS: don't know either getNumberOfSamplings() or Unknown #### UPDATE: getNumberOfSamplings just returns Unknown! self.jet_smax = Long(CaloSampling.getNumberOfSamplings()) self.jet_fmax = lambda jet : JetCaloQualityUtils.fracSamplingMax(jet, Long(CaloSampling.Unknown)) self.jet_time = lambda jet : JetCaloQualityUtils.jetTimeCells(jet) self.jet_quality_lar = lambda jet : JetCaloQualityUtils.jetQualityLAr(jet) self.jet_quality_hec = lambda jet : JetCaloQualityUtils.jetQualityHEC(jet) self.jet_bad = lambda jet : JetCaloQualityUtils.isBad(jet, False) self.jet_ugly = lambda jet : JetCaloQualityUtils.isUgly(jet, False) PyCintex.loadDictionary("egammaEnumsDict") PyCintex.loadDictionary("muonEventDict") PyCintex.loadDictionary("egammaAnalysisUtils") PyCintex.loadDictionary("MissingETEvent") from ROOT import MuonParameters, egammaParameters, egammaPID from ROOT import ElectronMCChargeCorrector self.MuonParameters = MuonParameters self.egammaParameters = egammaParameters self.egammaPID = egammaPID self.empp_helper = PyCintex.makeClass("isEMPlusPlusHelper")() if self.year == 2010: gROOT.ProcessLine(".L checkOQ.C++") from ROOT import egammaOQ self.egOQ = egammaOQ() self.egOQ.initialize() self.tool_ttv = PyAthena.py_tool("Reco::TrackToVertex", iface="Reco::ITrackToVertex") self.tool_tdt = PyAthena.py_tool('Trig::TrigDecisionTool/TrigDecisionTool') self.tool_tmt = PyAthena.py_tool("TrigMatchTool/TrigMatchTool") self.tool_hfor= PyAthena.py_tool("HforTool",iface="IHforTool") self.tool_timing = PyAthena.py_tool("Rec::MuonCombinedTimingTool/MuonCombinedTimingTool", iface="Rec::IMuonCombinedTimingTool") PyCintex.loadDictionary("TrkSpaceTimePoint")
import AthenaPython.PyAthena as PyAthena import AthenaCommon.SystemOfUnits as Units from AthenaPython.PyAthena import StatusCode import PyCintex import ROOT import math PyCintex.loadDictionary('egammaEnumsDict') # Needed for egammaParameters from ROOT import egammaParameters from ROOT import egammaPID PyCintex.loadDict("libTrkTrackSummaryDict") PyCintex.loadDict('libegammaAnalysisUtilsDict') from ROOT import TLorentzVector class HSG2_2L2QDPDFilter(PyAthena.AthFilterAlgorithm): def __init__(self, name="HSG2_2L2QDPDFilter",**kw): kw['name'] = name super(HSG2_2L2QDPDFilter, self).__init__(**kw) self.cutDict=dict() # types are e or mu or jet self.cutDict["types"] = kw.get("types", []) # pT cuts for muons and jets, ET cut for electrons self.cutDict["pTCuts"] = kw.get("pTCuts", []) # quality cuts are LoosePP or ORLH for electrons, combined+lowpt for muons, barrel for jets self.cutDict["qualityCuts"] = kw.get("qualityCuts", []) # Container names in AOD self.cutDict["collections"] = kw.get("collections", []) # Di-lepton mass cut self.cutDict["diLeptonMassCut"] = kw.get("diLeptonMassCut", 5.*Units.GeV) # Electron-jet dR cut self.cutDict["electronJetDRCut"] = kw.get("electronJetDRCut", 0.05) # Negative value means no overlap removal
__version__ = '1.0.0' __author__ = 'Joerg Stelzer <*****@*****.**>' __all__ = ['TrigConf', 'l1menuloader', 'hltmenuloader'] import ROOT, PyCintex PyCintex.Cintex.Enable() PyCintex.loadDictionary("libTrigConfL1DataDict") PyCintex.loadDictionary("libTrigConfHLTDataDict") PyCintex.loadDictionary("libTrigConfStorageDict") TrigConf = PyCintex.makeNamespace('TrigConf') # modify a few functions TrigConf.Menu.items = TrigConf.Menu.itemsV TrigConf.HLTFrame.chains = TrigConf.HLTFrame.chainsV TrigConf.HLTFrame.sequences = TrigConf.HLTFrame.sequencesV #from TrigConfOffline.menuloader import * from TrigConfOffline import menuloader hltmenuloader = menuloader.hltmenuloader l1menuloader = menuloader.l1menuloader
def initialize_jets(self): import PyCintex PyCintex.loadDictionary("JetUtils") from ROOT import JetCaloHelper, JetCaloQualityUtils self.jet_emf = lambda jet : JetCaloHelper.jetEMFraction(jet) self.jet_hecF = lambda jet : JetCaloQualityUtils.hecF(jet)
__version__ = "$Revision: 1.8 $" __author__ = "Sebastien Binet <*****@*****.**>" __all__ = [ 'CpuHdr', 'IoHdr', 'MemHdr', 'PersHdr', 'CpuData', 'IoData', 'MemData', #'PersData', ] import ROOT import PyCintex PyCintex.Cintex.Enable() PyCintex.loadDictionary('libPerfMonEventDict') PerfMon = PyCintex.makeNamespace('PerfMon') CpuHdr = PerfMon.CpuHdr IoHdr = PerfMon.IoHdr MemHdr = PerfMon.MemHdr PersHdr = PerfMon.PersHdr CpuData = PerfMon.CpuData IoData = PerfMon.IoData MemData = PerfMon.MemData #PersData = PerfMon.PersData
from PrimaryDPDMaker.PrimaryDPDFlags_EGammaStream import primEGammaDPD from PrimaryDPDMaker.ElectronFilter import ElectronFilter # pre-pend an external electron filter # filter just for robust loose, leave all the rest blank, # to be checked by ourselves later # ---- Load the egammaPID and egammaParameters information # This is needed to always be up-to-date with the egamma # IsEM selections and also the author selections import PyCintex PyCintex.loadDictionary('egammaEnumsDict') from ROOT import egammaPID from ROOT import egammaParameters # Import the needed algorithms and tools from AnalysisUtils.AnalysisUtilsConf import ElectronIDSelector from D2PDMaker.D2PDMakerConf import D2PDElectronSelector ToolSvc += ElectronIDSelector( "RobustLooseElectronFilterSelector", isEM = "RobustLoose" ) theJob += D2PDElectronSelector( "RobustLooseElectronFilter", OutputLevel = INFO, inputCollection = 'ElectronAODCollection', outputCollection = 'RobustLooseElectronCollection',
# ToolSvc += mycaloisolationtool #import MCTruthClassifier.MCTruthClassifierBase #print MCTruthClassifier.MCTruthClassifierBase.MCTruthClassifier #MCTruthClassifier.MCTruthClassifierBase.MCTruthClassifier.TrackParticleContainerName = "GSFTrackParticleCandidate" #MCTruthClassifier.MCTruthClassifierBase.MCTruthClassifier.TrackParticleTruthCollection = "GSFTrackParticleTruthCollection" #include ("RecExCommon/ContainerRemapping.py") print "ServiceMgr after:" print ServiceMgr print "end ServiceMgr after" import PyCintex PyCintex.loadDictionary('ElectronPhotonSelectorTools') from ROOT import egammaPID from ElectronPhotonSelectorTools.ConfiguredAsgElectronIsEMSelectors import ConfiguredAsgElectronIsEMSelector electronSelector = ConfiguredAsgElectronIsEMSelector( "myIsEmSelector", egammaPID.ElectronIDMediumPP, OutputLevel=DEBUG) ToolSvc += electronSelector from ElectronPhotonSelectorTools.ConfiguredAsgPhotonIsEMSelectors import ConfiguredAsgPhotonIsEMSelector photonSelector = ConfiguredAsgPhotonIsEMSelector("myPhotonSelector", egammaPID.PhotonIDTightAR, OutputLevel=DEBUG) ToolSvc += photonSelector # Add top algorithms to be run from simpleStudy.simpleStudyConf import TestAlg