Beispiel #1
0
def getGlobalTagByDataset(runOnMC, dataset):
    """
    Uses the dataset name to select the correct global tag

    Information from here: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions?redirectedfrom=CMS.SWGuideFrontierConditions#Summary_of_Global_Tags_used_in_o
    Last updated: wreece 14/01/13 for 53 data, MC, parking
    """
    GT = None
    if runOnMC:
        if cmsswIs44X():
            GT = 'START44_V13::All'
        elif 'START53_LV6' in dataset:
            GT = 'START53_LV6::All'
        elif 'START53' in dataset:
            GT = 'START53_V27::All'
        elif 'START52' in dataset:
            GT = 'START52_V9F::All'
    else:
        if cmsswIs44X():
            GT = 'GR_R_44_V15::All'
        elif '12Oct2013' in dataset:
            GT = 'FT_R_53_LV5::All'  # the missing _ between FT and 53 is intentional, that's how it is called
        elif '22Jan2013' in dataset:
            GT = 'FT53_V21A_AN6::All'  # the missing _ between FT and 53 is intentional, that's how it is called
        elif '13Jul2012' in dataset:
            GT = 'FT_53_V6C_AN4::All'
        elif '06Aug2012' in dataset:
            GT = 'FT_53_V6C_AN4::All'
        elif '24Aug2012' in dataset:
            GT = 'FT_53_V10A_AN4::All'
        elif 'Run2012C-PromptReco-v1' in dataset:  #shouldn't be used...
            GT = 'GR_P_V40_AN3::All'
        elif 'Run2012C-PromptReco-v2' in dataset:
            GT = 'GR_P_V42_AN4::All'
        elif 'Run2012D' in dataset:
            GT = 'GR_P_V42_AN4::All'
        elif 'Run2012B-05Nov2012' in dataset:
            GT = 'FT_53_V6C_AN4::All'
        elif 'Run2012C-part1_05Nov2012' in dataset:
            GT = 'FT53_V10A_AN4::All'
        elif 'Run2012C-part2_05Nov2012' in dataset:
            GT = 'FT_P_V42C_AN4::All'
        elif 'Run2012D-part1_10Dec2012-v1' in dataset:
            GT = 'FT_P_V42_AN4::All'
        elif 'Run2012D-part2_17Jan2013-v1' in dataset:
            GT = 'FT_P_V42D_AN4::All'

    if GT is None:
        raise Exception(
            "No global tag found for dataset '%s'. Check getGlobalTagByDataset"
            % dataset)
    return GT
Beispiel #2
0
def getGlobalTagByDataset(runOnMC, dataset):
    """
    Uses the dataset name to select the correct global tag

    Information from here: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions?redirectedfrom=CMS.SWGuideFrontierConditions#Summary_of_Global_Tags_used_in_o
    Last updated: wreece 14/01/13 for 53 data, MC, parking
    """
    GT = None
    if runOnMC:
        if cmsswIs44X():
            GT = 'START44_V13::All'
        elif 'START53_LV6' in dataset:
            GT = 'START53_LV6::All' 
        elif 'START53' in dataset:
            GT = 'START53_V27::All' 
        elif 'START52' in dataset:
            GT = 'START52_V9F::All'
    else:
        if cmsswIs44X():
            GT = 'GR_R_44_V15::All'
        elif '12Oct2013' in dataset:
            GT = 'FT_R_53_LV5::All' # the missing _ between FT and 53 is intentional, that's how it is called
        elif '22Jan2013' in dataset:
            GT = 'FT53_V21A_AN6::All' # the missing _ between FT and 53 is intentional, that's how it is called
        elif '13Jul2012' in dataset:
            GT = 'FT_53_V6C_AN4::All'
        elif '06Aug2012' in dataset:
            GT = 'FT_53_V6C_AN4::All'
        elif '24Aug2012' in dataset:
            GT = 'FT_53_V10A_AN4::All'
        elif 'Run2012C-PromptReco-v1' in dataset:#shouldn't be used...
            GT = 'GR_P_V40_AN3::All'
        elif 'Run2012C-PromptReco-v2' in dataset:
            GT = 'GR_P_V42_AN4::All'
        elif 'Run2012D' in dataset:
            GT = 'GR_P_V42_AN4::All'
        elif 'Run2012B-05Nov2012' in dataset:
            GT = 'FT_53_V6C_AN4::All'
        elif 'Run2012C-part1_05Nov2012' in dataset:
            GT = 'FT53_V10A_AN4::All'
        elif 'Run2012C-part2_05Nov2012' in dataset:
            GT = 'FT_P_V42C_AN4::All'
        elif 'Run2012D-part1_10Dec2012-v1' in dataset:
            GT = 'FT_P_V42_AN4::All'
        elif 'Run2012D-part2_17Jan2013-v1' in dataset:
            GT = 'FT_P_V42D_AN4::All'
            

    if GT is None:
        raise Exception("No global tag found for dataset '%s'. Check getGlobalTagByDataset" % dataset)
    return GT
def getGlobalTag(runOnMC, runOld5XGT):
    """Return the global tag, based on
    - the runOnMC flag
    - the file name
    - the CMSSW release

    Please have a look at the python source for more information
    """

    # we run on a 52 sample if:
    # - we have START52 in the name (52 MC)
    # - we have PromptReco and (2012A or 2012B) in the name (52 data)
##     runOld5XGT = file.find('START52') != -1 or \
##                     ( (file.find('2012A') != -1 or file.find('2012B') !=-1 ) and file.find('PromptReco') != -1 )
    
    if cmsswIs44X():
        if runOnMC:
            GT = 'START44_V13::All'
        else:
            GT = 'GR_R_44_V15::All'
    else:
        if runOnMC:
            if runOld5XGT:
                GT = 'START53_V10::All' # for 53X MC in >= 533
                # GT = 'START53_V7E::All' # for 53X MC in < 533
            else:
                GT = 'START53_V15::All' # Moriond calibration
        else:
            if runOld5XGT:
                GT = 'GR_P_V41_AN1::All' # for 53X data in >= 533
                # GT = 'GR_P_V40_AN1::All' # for 53X data in < 533
            else:
                GT = 'GR_P_V39_AN3::All' # Moriond calibration
    return GT
Beispiel #4
0
def getGlobalTag(runOnMC, runOld5XGT):
    """Return the global tag, based on
    - the runOnMC flag
    - the file name
    - the CMSSW release

    Please have a look at the python source for more information
    """

    # we run on a 52 sample if:
    # - we have START52 in the name (52 MC)
    # - we have PromptReco and (2012A or 2012B) in the name (52 data)
    ##     runOld5XGT = file.find('START52') != -1 or \
    ##                     ( (file.find('2012A') != -1 or file.find('2012B') !=-1 ) and file.find('PromptReco') != -1 )

    if cmsswIs44X():
        if runOnMC:
            GT = 'START44_V13::All'
        else:
            GT = 'GR_R_44_V15::All'
    else:
        if runOnMC:
            if runOld5XGT:
                GT = 'START53_V10::All'  # for 53X MC in >= 533
                # GT = 'START53_V7E::All' # for 53X MC in < 533
            else:
                GT = 'START53_V27::All'  # Moriond calibration
        else:
            if runOld5XGT:
                GT = 'GR_P_V41_AN1::All'  # for 53X data in >= 533
                # GT = 'GR_P_V40_AN1::All' # for 53X data in < 533
            else:
                GT = 'FT53_V21A_AN6::All'  # Moriond calibration
    return GT
Beispiel #5
0
def getGlobalTagByDataset(runOnMC, dataset):
    """
    Uses the dataset name to select the correct global tag

    Information from here: https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideFrontierConditions?redirectedfrom=CMS.SWGuideFrontierConditions#Summary_of_Global_Tags_used_in_o
    Last updated: wreece 14/01/13 for 53 data, MC, parking
    """
    GT = None
    if runOnMC:
        if cmsswIs44X():
            GT = 'START44_V13::All'
        elif 'START53' in dataset:
            GT = 'START53_V7G::All' 
        elif 'START52' in dataset:
            GT = 'START52_V9F::All'
    else:
        if cmsswIs44X():
            GT = 'GR_R_44_V15::All'
        elif '13Jul2012' in dataset:
            GT = 'FT_53_V6_AN3::All'
        elif '06Aug2012' in dataset:
            GT = 'FT_53_V6C_AN3::All'
        elif '24Aug2012' in dataset:
            GT = 'FT_53_V10_AN3::All'
        elif 'Run2012C-PromptReco-v1' in dataset:
            GT = 'GR_P_V40_AN3::All'
        elif 'Run2012C-PromptReco-v2' in dataset:
            GT = 'GR_P_V41_AN3::All'
        elif 'Run2012D' in dataset:
            GT = 'GR_P_V42_AN3::All'
        elif 'Run2012B-05Nov2012' in dataset:
            GT = 'FT_53_V6C_AN3::All'
        elif 'Run2012C-part1_05Nov2012' in dataset:
            GT = 'FT53_V10A_AN3::All'
        elif 'Run2012C-part2_05Nov2012' in dataset:
            GT = 'FT_P_V42C_AN3::All'

    if GT is None:
        raise Exception("No global tag found for dataset '%s'. Check getGlobalTagByDataset" % dataset)
    return GT
Beispiel #6
0
 def __init__(self,isData = True,doComponents = True,scaleErrors = True ):
     self.is44X = cmsswIs44X()
     self.doComponents = doComponents
     if scaleErrors:
         self.rootfile = ROOT.TFile(getFullPath('data/ebe_scalefactors.root'))
         if self.is44X:
             if isData:
                 self.muonHisto = self.rootfile.Get('mu_reco42x')
                 self.eleHisto = self.rootfile.Get('el_reco42x')
             else:
                 self.muonHisto = self.rootfile.Get('mu_mc42x')
                 self.eleHisto = self.rootfile.Get('el_mc42x')
         else:
             if isData:
                 self.muonHisto = self.rootfile.Get('mu_reco53x')
                 self.eleHisto = self.rootfile.Get('el_reco53x')
             else:
                 self.muonHisto = self.rootfile.Get('mu_mc53x')
                 self.eleHisto = self.rootfile.Get('el_mc53x')
Beispiel #7
0
 def __init__(self, isData=True, doComponents=True, scaleErrors=True):
     self.is44X = cmsswIs44X()
     self.doComponents = doComponents
     if scaleErrors:
         self.rootfile = ROOT.TFile(
             getFullPath('data/ebe_scalefactors.root'))
         if self.is44X:
             if isData:
                 self.muonHisto = self.rootfile.Get('mu_reco42x')
                 self.eleHisto = self.rootfile.Get('el_reco42x')
             else:
                 self.muonHisto = self.rootfile.Get('mu_mc42x')
                 self.eleHisto = self.rootfile.Get('el_mc42x')
         else:
             if isData:
                 self.muonHisto = self.rootfile.Get('mu_reco53x')
                 self.eleHisto = self.rootfile.Get('el_reco53x')
             else:
                 self.muonHisto = self.rootfile.Get('mu_mc53x')
                 self.eleHisto = self.rootfile.Get('el_mc53x')
Beispiel #8
0
    def __init__(self, cfg_ana, cfg_comp, looperName ):
        super(MultiLeptonAnalyzerBase,self).__init__(cfg_ana,cfg_comp,looperName)

        self.fakeRates=[]

        #check if there is fake rate 
        if hasattr(cfg_comp,'fakeRates'):
            for fr in cfg_comp.fakeRates:
                self.fakeRates.append(FakeRateCalculator(fr))

        #check if there is efficiency        
        if hasattr(cfg_comp,'efficiency'):
            self.efficiency= EfficiencyCorrector(cfg_comp.efficiency)

        #initialize MELA    
        self.kdCalc = KDCalculator()
        #initialize mass errors
        self.massRes = MassErrors(cfg_comp.isData)

        if  hasattr(self.cfg_ana,"FSR"):
            self.FSR=FSRRecovery(self.cfg_ana.FSR)


        self.is44X = cmsswIs44X()
Beispiel #9
0

# Message logger setup.
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = reportInterval
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )


# Jet recalibration

if jetRecalib: 
    process.load('Configuration.StandardSequences.Services_cff')
    process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
    GT = None
    if runOnMC:
        if cmsswIs44X():
            GT = 'START44_V13::All'
        else:
            GT = 'START52_V10::All'
    else:
        if cmsswIs44X():
            GT = 'GR_R_44_V15::All'
        else:
            GT = 'GR_R_52_V8::All'  
    process.GlobalTag.globaltag = GT
    from CMGTools.Common.miscProducers.cmgPFJetCorrector_cfi import cmgPFJetCorrector
    process.cmgPFJetSel = cmgPFJetCorrector.clone(src='cmgPFJetSel',
                                                  payload='AK5PF')
    process.cmgPFJetSelCHS = cmgPFJetCorrector.clone(src='cmgPFJetSelCHS',
                                                     payload='AK5PFchs')
Beispiel #10
0
from CMGTools.Common.skims.leadingCMGBaseJetSelector_cfi import leadingCMGBaseJetSelector
cmgPFBaseJetLead = leadingCMGBaseJetSelector.clone()
cmgPFBaseJetLead.inputCollection = 'cmgPFBaseJetAll'
cmgPFBaseJetLead.index = 4

PATCMGJetSequence = cms.Sequence(
    PATJetSequence + 
    jetSequence +
    cmgPFBaseJetAll + 
    cmgPFBaseJetLead
    )

from CMGTools.Common.Tools.cmsswRelease import cmsswIs44X, isNewerThan
from RecoJets.JetProducers.ak5PFJets_cfi import ak5PFJets

if cmsswIs44X():
    # ak5PFJets in 42X Fall11 MC samples are missing the jet area
    # add them to rho sequence, so they don't get duplicated for the CHS jets
    PATCMGRhoSequence += ak5PFJets


# TAUS NO PU CHS  ----------------------------

from CMGTools.Common.PAT.PATTaus_cff import *

cmgTau.cfg.inputCollection = 'selectedPatTaus'

PATCMGTauSequence = cms.Sequence(
    PATTauSequence + 
    tauSequence
    )