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 __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()