Esempio n. 1
0
 def __init__(self, collection = None, minEcalSeverity = 2, minHcalSeverity = 10, excludeHf = True, prune = True) :
     for item in ["collection", "minEcalSeverity", "minHcalSeverity", "prune"] :
         setattr(self, item, eval(item))
     self.considerSeverity = self.collection=="Calo"
     self.subdetectors = configuration.detectorSpecs()["cms"]["%sSubdetectors"%self.collection]
     if excludeHf : self.subdetectors = filter(lambda s:"Hf" not in s, self.subdetectors)
     self.recHitCollections = configuration.detectorSpecs()["cms"]["%sRecHitCollections"%self.collection]
Esempio n. 2
0
    def __init__(self,
                 jets=None,
                 met=None,
                 muons=None,
                 electrons=None,
                 photons=None,
                 taus=None,
                 scale=200,
                 prettyMode=True,
                 printExtraText=False):

        for item in [
                "jets", "met", "muons", "electrons", "photons", "taus",
                "scale", "prettyMode", "printExtraText"
        ]:
            setattr(self, item, eval(item))

        self.etaBE = configuration.detectorSpecs()["cms"]["etaBE"]
        self.jetRadius = 0.7 if "7" in self.jets[0] else 0.5
        self.genJets = "gen%sGenJetsP4" % (self.jets[0].replace("xc", "")[:3])
        self.genMet = "genmetP4True"
        self.titleSizeFactor = 1.0
        self.legendDict = collections.defaultdict(int)
        self.legendList = []
        self.keep = []

        self.prettyReName = {
            "clean jets (xcak5JetPFPat)": "jets (AK5 PF)",
            "MET (met)": "PF MET",
            "muons (mu)": "muons",
            "electrons (el)": "electrons",
            "jet": "AK5 PFNoPU Jets",
            "mu": "muons",
            "el": "electrons",
        }
Esempio n. 3
0
    def __init__(self, cs, jetCs, maxIndex = 0, DR = "04") :
        self.cs = cs
        self.jetCs = jetCs
        self.maxIndex = maxIndex
        self.DR = DR
        self.moreName="%s%s through index %d [DR %s]" % (self.cs+(maxIndex, self.DR,))
        self.photonIndicesName = "%sIndices%s" % self.cs
        self.p4sName = "%sP4%s" % self.cs
        self.seedTimes = "%sWrappedSeedTime%s" % self.cs

        self.jetIndicesName = "%sIndices%s" % self.jetCs
        self.jetP4Name = "%sCorrectedP4%s" % self.jetCs
        self.mhtName = "%sSumP4%s" % self.jetCs
        self.htName  = "%sSumEt%s"%self.jetCs
        self.etaBE = configuration.detectorSpecs()["cms"]["etaBE"]

        self.minDeltaRToJet = "%s%sMinDeltaRToJet%s%s"% (self.cs[0], self.cs[1], self.jetCs[0], self.jetCs[1])
Esempio n. 4
0
    def __init__(self, jets = None, met = None, muons = None, electrons = None, photons = None, taus = None, scale = 200 , prettyMode = True , printExtraText = False ) :

        for item in ["jets","met","muons","electrons","photons","taus","scale","prettyMode","printExtraText"] :
            setattr(self,item,eval(item))

        self.etaBE = configuration.detectorSpecs()["cms"]["etaBE"]
        self.jetRadius = 0.7 if "7" in self.jets[0] else 0.5
        self.genJets = "gen%sGenJetsP4"%(self.jets[0].replace("xc","")[:3])
        self.genMet  = "genmetP4True"
        self.titleSizeFactor = 1.0
        self.legendDict = collections.defaultdict(int)
        self.legendList = []
        self.keep = []
        
        self.prettyReName = {
            "clean jets (xcak5JetPFPat)": "jets (AK5 PF)",
            "MET (metP4PF)": "PF MET",
            "muons (muonPF)": "muons",
            "electrons (electronPF)": "electrons",
            "xcak5JetPFPat": "AK5 PF Jets",
            "muonPF": "muons",
            "electronPF": "electrons",
            }
Esempio n. 5
0
from supy import wrappedChain,utils
import configuration
from muon import IndicesOther,IndicesNonIso,IndicesAnyIso,IndicesAnyIsoIsoOrder,LeadingPt
##############################
barrelEtaMax = configuration.detectorSpecs()["cms"]["barrelEtaMax"]
endcapEtaMin = configuration.detectorSpecs()["cms"]["endcapEtaMin"]
##############################
class Indices(wrappedChain.calculable) :
    def __init__(self, collection = None, ptMin = None, simpleEleID = None, useCombinedIso = True, flag2012 = "") :
        self.fixes = collection
        self.stash(["IndicesOther","IndicesNonIso","P4"])
        self.ptMin = ptMin
        self.flag2012 = flag2012
        if self.flag2012 :
            self.eID = ("%sId"+self.flag2012+"%s")% self.fixes
            self.moreName = "pt>%.1f; (2012 %s)" % (self.ptMin, self.flag2012)
        else :
            isotype = "c" if useCombinedIso else "rel"
            self.eID = ("%sID"+simpleEleID+"%s")% self.fixes
            self.eIso = ("%s"+isotype+"Iso"+simpleEleID+"%s") % self.fixes
            self.moreName = "pt>%.1f; simple%s; %sIso" % (ptMin, simpleEleID, isotype)

    def update(self,ignored) :
        self.value = []
        other = self.source[self.IndicesOther]
        nonIso = self.source[self.IndicesNonIso]
        p4s   = self.source[self.P4]
        eID   = self.source[self.eID]
        eIso  = self.source[self.eIso] if not self.flag2012 else [True]*p4s.size()
        for i in range(p4s.size()) :
            if p4s.at(i).pt() < self.ptMin : break
Esempio n. 6
0
    def __init__(self, jets = None, met = None, muons = None, electrons = None, photons = None, taus = None,
                 recHits = None, recHitPtThreshold = -100.0, scale = 200.0, etRatherThanPt = False, doGenParticles = False, doGenJets = False,
                 doEtaPhiPlot = True, deltaPhiStarExtraName = "", deltaPhiStarCut = None, deltaPhiStarDR = None, mhtOverMetName = "",
                 showAlphaTMet = True, jetsOtherAlgo = None, metOtherAlgo = None, recHitsOtherAlgo = None, printExtraText = True, j2Factor = None,
                 ra1Mode = True, ra1CutBits = True, prettyMode = False, tipToTail = False, triggersToPrint = [],
                 flagsToPrint = ["logErrorTooManyClusters","logErrorTooManySeeds",
                                 #"beamHaloCSCLooseHaloId","beamHaloCSCTightHaloId","beamHaloEcalLooseHaloId","beamHaloEcalTightHaloId",
                                 #"beamHaloGlobalLooseHaloId","beamHaloGlobalTightHaloId","beamHaloHcalLooseHaloId","beamHaloHcalTightHaloId"
                                 ],
                 bThresholds = {"JetProbabilityBJetTags":         {"L":0.275, "M":0.545, "T":0.790},
                                "CombinedSecondaryVertexBJetTags":{"L":0.244, "M":0.679, "T":0.898},
                                },#https://twiki.cern.ch/twiki/bin/viewauth/CMS/BTagPerformanceOP
                 ) :

        self.moreName = "(see below)"

        for item in ["scale","jets","met","muons","electrons","photons","taus","recHits","recHitPtThreshold","doGenParticles", "doGenJets",
                     "doEtaPhiPlot","deltaPhiStarExtraName", "deltaPhiStarCut", "deltaPhiStarDR", "mhtOverMetName", "showAlphaTMet",
                     "jetsOtherAlgo", "metOtherAlgo", "recHitsOtherAlgo", "printExtraText", "j2Factor", "ra1Mode", "ra1CutBits", "prettyMode",
                     "tipToTail", "triggersToPrint", "flagsToPrint", "bThresholds"] :
            setattr(self,item,eval(item))

        if len(self.flagsToPrint)>3 : print "WARNING: More than three flags specified in the displayer.  The list will run off the page."
        self.etaBE = configuration.detectorSpecs()["cms"]["etaBE"]
        self.subdetectors = {None: []}
        self.recHitCollections = {None: []}
        for rh in [self.recHits, self.recHitsOtherAlgo] :
            if not rh : continue
            self.recHitCollections[rh] = configuration.detectorSpecs()["cms"]["%sRecHitCollections"%rh]
            self.subdetectors[rh] = configuration.detectorSpecs()["cms"]["%sSubdetectors"%rh]

        self.jetRadius = 0.7 if "ak7Jet" in self.jets[0] else 0.5
        self.genJets = "gen%sGenJetsP4"%(self.jets[0].replace("xc","")[:3])
        self.genMet  = "genmetP4True"
        self.deltaHtName = "%sDeltaPseudoJetEt%s"%self.jets if etRatherThanPt else "%sDeltaPseudoJetPt%s"%self.jets
        
        self.doReco = not self.doGenParticles
        #self.helper = r.displayHelper()

        self.prettyReName = {
            "clean jets (xcak5JetPat)": "jets (AK5 Calo)",
            "clean jets (xcak5JetPFPat)": "jets (AK5 PF)",
            "ignored jets (xcak5JetPat)": "ignored jets (AK5 Calo)",
            "ignored jets (xcak5JetPFPat)": "ignored jets (AK5 PF)",
            "MHT (xcak5JetPat)": "MHT",
            "MHT (xcak5JetPFPat)": "MHT",
            "MET (metP4AK5TypeII)": "MET (Calo Type II)",
            "MET (metP4PF)": "MET (PF)",
            "MET (metP4TypeIPF)": "MET (PF Type I)",
            "muons (muonPat)": "muons",
            "electrons (electronPat)": "electrons",
            "photons (photonPat)": "photons",
            "xcak5JetPat": "AK5 Calo Jets",
            "xcak5JetPFPat": "AK5 PF Jets",
            "muonPat": "muons",
            "electronPat": "electrons",
            "photonPat": "photons",
            }

        self.titleSizeFactor = 1.0
        
        self.legendDict = collections.defaultdict(int)
        self.legendList = []

        self.ellipse = r.TEllipse()
        self.ellipse.SetFillStyle(0)

        self.deadBox = r.TBox()
        self.deadBox.SetFillColor(r.kMagenta)
        self.deadBox.SetLineColor(r.kMagenta)

        self.coldBox = r.TBox()
        self.coldBox.SetFillColor(r.kOrange+7)
        self.coldBox.SetLineColor(r.kOrange+7)

        self.hcalBox = r.TBox()
        self.hcalBox.SetFillColor(r.kGreen)
        self.hcalBox.SetLineColor(r.kGreen)
        
        self.line = r.TLine()
        self.arrow = r.TArrow()
        self.text = r.TText()
        self.latex = r.TLatex()

        self.alphaFuncs=[
            self.makeAlphaTFunc(0.55,r.kBlack),
            self.makeAlphaTFunc(0.50,r.kOrange+3),
            self.makeAlphaTFunc(0.45,r.kOrange+7)
            ]

        epsilon=1.0e-6
        self.mhtLlHisto=r.TH2D("mhtLlHisto",";log ( likelihood / likelihood0 ) / N varied jets;#slashH_{T};tries / bin",100,-20.0+epsilon,0.0+epsilon,100,0.0,300.0)
        self.metLlHisto=r.TH2D("metLlHisto",";log ( likelihood / likelihood0 ) / N varied jets;#slashE_{T};tries / bin",100,-20.0+epsilon,0.0+epsilon,100,0.0,300.0)
        self.mhtLlHisto.SetDirectory(0)
        self.metLlHisto.SetDirectory(0)
Esempio n. 7
0
 def __init__(self, collection = None, minEcalSeverity = 2, minHcalSeverity = 10) :
     for item in ["collection", "minEcalSeverity", "minHcalSeverity"] :
         setattr(self, item, eval(item))
     self.considerSeverity = self.collection=="Calo"
     self.subdetectors = configuration.detectorSpecs()["cms"]["%sSubdetectors"%self.collection]
     self.recHitCollections = configuration.detectorSpecs()["cms"]["%sRecHitCollections"%self.collection]
Esempio n. 8
0
import configuration
from supy import wrappedChain, utils
from calculables.other import ScaleFactors
##############################
barrelEtaMax = configuration.detectorSpecs()["cms"]["barrelEtaMax"]
endcapEtaMin = configuration.detectorSpecs()["cms"]["endcapEtaMin"]
##############################


class Indices(wrappedChain.calculable):
    def __init__(
        self,
        collection=None,
        ptMin=30,
        absEtaMax=2.5,
    ):
        self.fixes = collection
        for item in ['ptMin', 'absEtaMax']:
            setattr(self, item, eval(item))
        self.stashed = ['P4', 'SignalID']
        self.stash(self.stashed)
        self.moreName = 'pt>%.1f; |eta|<%.1f; SignalID' % (ptMin, absEtaMax)

    def accept(self, p4, id):
        return all([id, p4.pt() > self.ptMin, abs(p4.eta()) < self.absEtaMax])

    def update(self, _):
        self.value = [
            i for i, a in enumerate(
                utils.hackMap(
                    self.accept, *[
Esempio n. 9
0
    def __init__(self, collection=None, level=None):
        self.cs = collection
        self.idName = "%sID%s%s" % (self.cs[0], level, self.cs[1])
        self.p4Name = "%sP4%s" % self.cs

        for var in [
            "EcalRecHitEtConeDR04",
            "HcalTowSumEtConeDR04",
            "HadronicOverEm",
            "TrkSumPtHollowConeDR04",
            "SigmaIetaIeta",
            "HasPixelSeed",
        ]:
            setattr(self, var, ("%s" + var + "%s") % self.cs)

        jei = {}
        jeiLower = {}
        tbhi = {}
        tbhiLower = {}
        hcti = {}
        hctiLower = {}
        hoe = {}
        shhBarrel = {}
        shhEndcap = {}
        ptVar = {}
        etaBE = {}
        moreName = {}
        for l in [
            "EmFromTwiki",
            "LooseFromTwiki",
            "TightFromTwiki",
            "AnalysisNote_10_268",
            "EGM_10_006_Loose",
            "EGM_10_006_Tight",
            "TrkIsoSideBand",
            "TrkIsoRelaxed",
            "IsoSideBand",
            "IsoRelaxed",
            "NoIsoReq",
        ]:
            jei[l] = (4.2, 0.0060)
            jeiLower[l] = None
            tbhi[l] = (2.2, 0.0025)
            tbhiLower[l] = None
            hcti[l] = None
            hctiLower[l] = None
            hoe[l] = (0.05, 0.0000)
            shhBarrel[l] = None
            shhEndcap[l] = None
            ptVar[l] = "pt"
            etaBE[l] = configuration.detectorSpecs()["cms"]["etaBE"]
            moreName[l] = "PhotonID twiki, 2010-10-14, %s" % ("is" + l.replace("FromTwiki", ""))

        hcti["LooseFromTwiki"] = (3.5, 0.001)

        hcti["TightFromTwiki"] = (2.0, 0.001)
        shhBarrel["TightFromTwiki"] = (0.013, 0.0)
        shhEndcap["TightFromTwiki"] = (0.030, 0.0)

        jei["AnalysisNote_10_268"] = (4.2, 0.003)
        tbhi["AnalysisNote_10_268"] = (2.2, 0.001)
        hcti["AnalysisNote_10_268"] = (2.0, 0.001)
        ptVar["AnalysisNote_10_268"] = "Et"
        moreName["AnalysisNote_10_268"] = "from CMS AN 10-268"

        jei["EGM_10_006_Tight"] = (2.4, 0.0)
        tbhi["EGM_10_006_Tight"] = (1.0, 0.0)
        hcti["EGM_10_006_Tight"] = (0.9, 0.0)
        hoe["EGM_10_006_Tight"] = (0.03, 0.0)
        shhBarrel["EGM_10_006_Tight"] = (0.01, 0.0)
        shhEndcap["EGM_10_006_Tight"] = (0.028, 0.0)
        moreName["EGM_10_006_Tight"] = "EGM 10-006 tight"

        jei["EGM_10_006_Loose"] = (4.2, 0.0)
        tbhi["EGM_10_006_Loose"] = (2.2, 0.0)
        hcti["EGM_10_006_Loose"] = (2.0, 0.0)
        hoe["EGM_10_006_Loose"] = (0.05, 0.0)
        shhBarrel["EGM_10_006_Loose"] = (0.01, 0.0)
        shhEndcap["EGM_10_006_Loose"] = (0.03, 0.0)
        moreName["EGM_10_006_Loose"] = "EGM 10-006 loose"

        hcti["TrkIsoRelaxed"] = (10.0, 0.001)
        moreName["TrkIsoRelaxed"] = "relaxed trkIso"

        hcti["TrkIsoSideBand"] = (10.0, 0.001)
        hctiLower["TrkIsoSideBand"] = (2.0, 0.001)
        moreName["TrkIsoSideBand"] = "side-band of trkIso"

        jei["NoIsoReq"] = (100.0, 0.0)
        tbhi["NoIsoReq"] = (100.0, 0.0)
        hcti["NoIsoReq"] = (100.0, 0.0)
        moreName["NoIsoReq"] = "relaxed trkIso [ ,100]; hcalIso[ ,100]; ecalIso[ ,100]"

        jei["IsoRelaxed"] = (8.2, 0.0060)
        tbhi["IsoRelaxed"] = (6.2, 0.0025)
        hcti["IsoRelaxed"] = (10.0, 0.001)
        moreName["IsoRelaxed"] = "relaxed trkIso [ ,10]; hcalIso[ ,6]; ecalIso[ ,8]"

        jei["IsoSideBand"] = (8.2, 0.0060)
        jeiLower["IsoSideBand"] = jei["TightFromTwiki"]
        tbhi["IsoSideBand"] = (6.2, 0.0025)
        tbhiLower["IsoSideBand"] = tbhi["TightFromTwiki"]
        hcti["IsoSideBand"] = (10.0, 0.001)
        hctiLower["IsoSideBand"] = hcti["TightFromTwiki"]
        moreName["IsoSideBand"] = "side-band of trkIso [2,10]; hcalIso[2,6]; ecalIso[4,8]"

        for item in [
            "jei",
            "jeiLower",
            "tbhi",
            "tbhiLower",
            "hcti",
            "hctiLower",
            "hoe",
            "shhBarrel",
            "shhEndcap",
            "ptVar",
            "etaBE",
            "moreName",
        ]:
            setattr(self, item, eval(item)[level])