def declareHandles(self): super(XZZGenLep, self).declareHandles() #leptons self.handles['muons'] = AutoHandle(self.cfg_ana.muons, "std::vector<pat::Muon>") self.handles['electrons'] = AutoHandle(self.cfg_ana.electrons, "std::vector<pat::Electron>") # packedCandidates self.handles['packedCandidates'] = AutoHandle( self.cfg_ana.packedCandidates, 'std::vector<pat::PackedCandidate>') #rho for muons self.handles['rhoMu'] = AutoHandle(self.cfg_ana.rhoMuon, 'double') #rho for electrons self.handles['rhoEle'] = AutoHandle(self.cfg_ana.rhoElectron, 'double') # effective area self.ele_effectiveAreas = getattr(self.cfg_ana, 'ele_effectiveAreas', "Spring15_25ns_v1") self.mu_effectiveAreas = getattr(self.cfg_ana, 'mu_effectiveAreas', "Spring15_25ns_v1") self.miniIsolationPUCorr = self.cfg_ana.miniIsolationPUCorr if self.miniIsolationPUCorr == "weights": self.IsolationComputer = heppy.IsolationComputer(0.4) else: self.IsolationComputer = heppy.IsolationComputer()
def __init__(self, cfg_ana, cfg_comp, looperName): super(LeptonAnalyzer, self).__init__(cfg_ana, cfg_comp, looperName) if self.cfg_ana.doMuScleFitCorrections and self.cfg_ana.doMuScleFitCorrections != "none": if self.cfg_ana.doMuScleFitCorrections not in [ "none", "prompt", "prompt-sync", "rereco", "rereco-sync" ]: raise RuntimeError, 'doMuScleFitCorrections must be one of "none", "prompt", "prompt-sync", "rereco", "rereco-sync"' rereco = ("prompt" not in self.cfg_ana.doMuScleFitCorrections) sync = ("sync" in self.cfg_ana.doMuScleFitCorrections) self.muscleCorr = MuScleFitCorr(cfg_comp.isMC, rereco, sync) if hasattr(self.cfg_ana, "doRochesterCorrections" ) and self.cfg_ana.doRochesterCorrections: raise RuntimeError, "You can't run both Rochester and MuScleFit corrections!" else: self.cfg_ana.doMuScleFitCorrections = False #FIXME: only Embedded works self.electronEnergyCalibrator = EmbeddedElectronCalibrator() # if hasattr(cfg_comp,'efficiency'): # self.efficiency= EfficiencyCorrector(cfg_comp.efficiency) # Isolation cut if hasattr(cfg_ana, 'loose_electron_isoCut'): self.eleIsoCut = cfg_ana.loose_electron_isoCut else: self.eleIsoCut = lambda ele: ( ele.relIso03 <= self.cfg_ana. loose_electron_relIso and ele.absIso03 < getattr( self.cfg_ana, 'loose_electron_absIso', 9e99)) if hasattr(cfg_ana, 'loose_muon_isoCut'): self.muIsoCut = cfg_ana.loose_muon_isoCut else: self.muIsoCut = lambda mu: ( mu.relIso03 <= self.cfg_ana.loose_muon_relIso and mu.absIso03 < getattr(self.cfg_ana, 'loose_muon_absIso', 9e99)) self.eleEffectiveArea = getattr(cfg_ana, 'ele_effectiveAreas', "Phys14_25ns_v1") self.muEffectiveArea = getattr(cfg_ana, 'mu_effectiveAreas', "Phys14_25ns_v1") # MiniIsolation self.doMiniIsolation = getattr(cfg_ana, 'doMiniIsolation', False) if self.doMiniIsolation: self.miniIsolationPUCorr = self.cfg_ana.miniIsolationPUCorr self.miniIsolationVetoLeptons = self.cfg_ana.miniIsolationVetoLeptons if self.miniIsolationVetoLeptons not in [None, 'any', 'inclusive']: raise RuntimeError, "miniIsolationVetoLeptons should be None, or 'any' (all reco leptons), or 'inclusive' (all inclusive leptons)" if self.miniIsolationPUCorr == "weights": self.IsolationComputer = heppy.IsolationComputer(0.4) else: self.IsolationComputer = heppy.IsolationComputer() self.doIsolationScan = getattr(cfg_ana, 'doIsolationScan', False) if self.doIsolationScan: if self.doMiniIsolation: assert (self.miniIsolationPUCorr != "weights") assert (self.miniIsolationVetoLeptons == None) else: self.IsolationComputer = heppy.IsolationComputer()
def declareHandles(self): super(XZZLeptonAnalyzer, self).declareHandles() #leptons self.handles['muons'] = AutoHandle(self.cfg_ana.muons, "std::vector<pat::Muon>") self.handles['electrons'] = AutoHandle(self.cfg_ana.electrons, "std::vector<pat::Electron>") # packedCandidates self.handles['packedCandidates'] = AutoHandle( self.cfg_ana.packedCandidates, 'std::vector<pat::PackedCandidate>') #rho for muons self.handles['rhoMu'] = AutoHandle(self.cfg_ana.rhoMuon, 'double') #rho for electrons self.handles['rhoEleMiniIso'] = AutoHandle( self.cfg_ana.rhoElectronMiniIso, 'double') #rho for electron pfIso self.handles['rhoElePfIso'] = AutoHandle(self.cfg_ana.rhoElectronPfIso, 'double') # decide to filter events not passing lepton requirements self.do_filter = getattr(self.cfg_ana, 'do_filter', True) # use ISO self.applyIso = getattr(self.cfg_ana, 'applyIso', True) self.applyID = getattr(self.cfg_ana, 'applyID', True) # electronIDVersion self.electronIDVersion = getattr(self.cfg_ana, 'electronIDVersion', 'looseID') # can be looseID or HEEPv6 # electronIsoVersion self.electronIsoVersion = getattr(self.cfg_ana, 'electronIsoVersion', 'pfISO') # can be pfISO or miniISO # effective area self.ele_effectiveAreas = getattr(self.cfg_ana, 'ele_effectiveAreas', "Spring15_25ns_v1") self.mu_effectiveAreas = getattr(self.cfg_ana, 'mu_effectiveAreas', "Spring15_25ns_v1") self.miniIsolationPUCorr = self.cfg_ana.miniIsolationPUCorr if self.miniIsolationPUCorr == "weights": self.IsolationComputer = heppy.IsolationComputer(0.4) else: self.IsolationComputer = heppy.IsolationComputer() if self.cfg_comp.isMC: self.esfinput = ROOT.TFile(self.cfg_comp.eSFinput) self.esfh2 = self.esfinput.Get("EGamma_SF2D")
def __init__(self, cfg_ana, cfg_comp, looperName ): super(PhotonAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName) self.etaCentral = self.cfg_ana.etaCentral if hasattr(self.cfg_ana, 'etaCentral') else 9999 # footprint removed isolation self.doFootprintRemovedIsolation = getattr(cfg_ana, 'doFootprintRemovedIsolation', False) if self.doFootprintRemovedIsolation: self.footprintRemovedIsolationPUCorr = self.cfg_ana.footprintRemovedIsolationPUCorr self.IsolationComputer = heppy.IsolationComputer()
def declareHandles(self): super(MuonIsolationCalculator, self).declareHandles() self.handles['pf'] = AutoHandle('packedPFCandidates', 'std::vector<pat::PackedCandidate>') self.IsolationComputer = heppy.IsolationComputer() self.miniIsolationPUCorr = 'rhoArea'
def declareHandles(self): super(MuonIsolationCalculator, self).declareHandles() self.handles['puppi'] = AutoHandle(('puppi'), 'std::vector<reco::PFCandidate>') self.handles['puppi_no_muon'] = AutoHandle( ('particleFlowNoMuonPUPPI'), 'std::vector<reco::PFCandidate>') self.handles['packedCandidates'] = AutoHandle( 'packedPFCandidates', 'std::vector<pat::PackedCandidate>') self.IsolationComputer = heppy.IsolationComputer() self.miniIsolationPUCorr = 'rhoArea'
def __init__(self, cfg_ana, cfg_comp, looperName): super(Tau3MuIsolationAnalyzer, self).__init__(cfg_ana, cfg_comp, looperName) self.dBetaCone = self.cfg_ana.dBetaCone if hasattr( self.cfg_ana, 'dBetaCone') else 0.8 self.dBetaValue = self.cfg_ana.dBetaValue if hasattr( self.cfg_ana, 'dBetaValue') else 0.2 self.isoRadius = self.cfg_ana.isoRadius if hasattr( self.cfg_ana, 'isoRadius') else 0.4 # instantiate the isolation computer (by default with delta beta cone 0.8) self.IsolationComputer = heppy.IsolationComputer( self.dBetaCone) # keyword arguments not supported, sigh...
def declareHandles(self): super(LeptonIsolationCalculator, self).declareHandles() self.handles['pf'] = AutoHandle('packedPFCandidates', 'std::vector<pat::PackedCandidate>') self.getter = self.cfg_ana.getter if hasattr( self.cfg_ana, 'getter') else lambda event: event.selectedTaus self.lepton = self.cfg_ana.lepton if hasattr(self.cfg_ana, 'lepton') else 'muon' self.IsolationComputer = heppy.IsolationComputer() self.miniIsolationPUCorr = 'rhoArea'
def __init__(self, cfg_ana, cfg_comp, looperName ): super(PhotonAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName) self.etaCentral = self.cfg_ana.etaCentral if hasattr(self.cfg_ana, 'etaCentral') else 9999 # footprint removed isolation self.doFootprintRemovedIsolation = getattr(cfg_ana, 'doFootprintRemovedIsolation', False) if self.doFootprintRemovedIsolation: self.footprintRemovedIsolationPUCorr = self.cfg_ana.footprintRemovedIsolationPUCorr self.IsolationComputer = heppy.IsolationComputer() #FIXME: only Embedded works if self.cfg_ana.doPhotonScaleCorrections: conf = cfg_ana.doPhotonScaleCorrections self.photonEnergyCalibrator = Run2PhotonCalibrator( conf['data'], cfg_comp.isMC, conf['isSync'] if 'isSync' in conf else False, )
def __init__(self, cfg_ana, cfg_comp, looperName): super(LeptonAnalyzer, self).__init__(cfg_ana, cfg_comp, looperName) if hasattr(self.cfg_ana, 'doMuScleFitCorrections'): raise RuntimeError( "doMuScleFitCorrections is not supported. Please set instead doMuonScaleCorrections = ( 'MuScleFit', <name> )" ) if hasattr(self.cfg_ana, 'doRochesterCorrections'): raise RuntimeError( "doRochesterCorrections is not supported. Please set instead doMuonScaleCorrections = ( 'Rochester', <name> )" ) if self.cfg_ana.doMuonScaleCorrections: algo, options = self.cfg_ana.doMuonScaleCorrections if algo == "Kalman": corr = options['MC' if self.cfg_comp.isMC else 'Data'] self.muonScaleCorrector = KalmanMuonCorrector( corr, self.cfg_comp.isMC, options['isSync'] if 'isSync' in options else False, options['smearMode'] if 'smearMode' in options else "ebe") elif algo == "Rochester": print( "WARNING: the Rochester correction in heppy is still from Run 1" ) self.muonScaleCorrector = RochesterCorrections() elif algo == "MuScleFit": print( "WARNING: the MuScleFit correction in heppy is still from Run 1 (and probably no longer functional)" ) if options not in [ "prompt", "prompt-sync", "rereco", "rereco-sync" ]: raise RuntimeError( 'MuScleFit correction name must be one of [ "prompt", "prompt-sync", "rereco", "rereco-sync" ] ' ) rereco = ("prompt" not in self.cfg_ana.doMuScleFitCorrections) sync = ("sync" in self.cfg_ana.doMuScleFitCorrections) self.muonScaleCorrector = MuScleFitCorr( cfg_comp.isMC, rereco, sync) else: raise RuntimeError("Unknown muon scale correction algorithm") else: self.muonScaleCorrector = None #FIXME: only Embedded works if self.cfg_ana.doElectronScaleCorrections: conf = cfg_ana.doElectronScaleCorrections self.electronEnergyCalibrator = Run2ElectronCalibrator( conf['data'], conf['GBRForest'], cfg_comp.isMC, conf['isSync'] if 'isSync' in conf else False, ) # if hasattr(cfg_comp,'efficiency'): # self.efficiency= EfficiencyCorrector(cfg_comp.efficiency) # Isolation cut if hasattr(cfg_ana, 'loose_electron_isoCut'): self.eleIsoCut = cfg_ana.loose_electron_isoCut else: self.eleIsoCut = lambda ele: ( ele.relIso03 <= self.cfg_ana. loose_electron_relIso and ele.absIso03 < getattr( self.cfg_ana, 'loose_electron_absIso', 9e99)) if hasattr(cfg_ana, 'loose_muon_isoCut'): self.muIsoCut = cfg_ana.loose_muon_isoCut else: self.muIsoCut = lambda mu: ( mu.relIso03 <= self.cfg_ana.loose_muon_relIso and mu.absIso03 < getattr(self.cfg_ana, 'loose_muon_absIso', 9e99)) self.eleEffectiveArea = getattr(cfg_ana, 'ele_effectiveAreas', "Spring15_25ns_v1") self.muEffectiveArea = getattr(cfg_ana, 'mu_effectiveAreas', "Spring15_25ns_v1") # MiniIsolation self.doMiniIsolation = getattr(cfg_ana, 'doMiniIsolation', False) if self.doMiniIsolation: self.miniIsolationPUCorr = self.cfg_ana.miniIsolationPUCorr self.miniIsolationVetoLeptons = self.cfg_ana.miniIsolationVetoLeptons if self.miniIsolationVetoLeptons not in [None, 'any', 'inclusive']: raise RuntimeError( "miniIsolationVetoLeptons should be None, or 'any' (all reco leptons), or 'inclusive' (all inclusive leptons)" ) if self.miniIsolationPUCorr == "weights": self.IsolationComputer = heppy.IsolationComputer(0.4) else: self.IsolationComputer = heppy.IsolationComputer() self.doIsoAnnulus = getattr(cfg_ana, 'doIsoAnnulus', False) if self.doIsoAnnulus: if not self.doMiniIsolation: self.IsolationComputer = heppy.IsolationComputer() self.doIsolationScan = getattr(cfg_ana, 'doIsolationScan', False) if self.doIsolationScan: if self.doMiniIsolation: assert (self.miniIsolationPUCorr != "weights") assert (self.miniIsolationVetoLeptons == None) else: self.IsolationComputer = heppy.IsolationComputer() self.doMatchToPhotons = getattr(cfg_ana, 'do_mc_match_photons', False)
def __init__(self, cfg_ana, cfg_comp, looperName ): super(FSRPhotonMaker,self).__init__(cfg_ana,cfg_comp,looperName) self.enable = getattr(cfg_ana, 'enable', True) self.leptonTag = cfg_ana.leptons self.electronID = cfg_ana.electronID self.IsolationComputer = heppy.IsolationComputer(0.3)
def __init__(self, cfg_ana, cfg_comp, looperName): super(IsoTrackAnalyzer, self).__init__(cfg_ana, cfg_comp, looperName) self.IsoTrackIsolationComputer = heppy.IsolationComputer() self.doIsoAnnulus = getattr(cfg_ana, 'doIsoAnnulus', False) self.useLegacy2016 = getattr(cfg_ana, 'useLegacy2016', False)
def __init__(self, cfg_ana, cfg_comp, looperName ): super(IsoTrackAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName) self.IsoTrackIsolationComputer = heppy.IsolationComputer(self.cfg_ana.isoDR)