Ejemplo n.º 1
0
def fromHeppySample(sample, data_path, module = None, maxN = None):
    ''' Load CMG tuple from local directory
    '''

    from RootTools.core.Sample import Sample

    import importlib
    if module is not None:
        module_ = module
    elif "Run2016" in sample:
        module_ = 'CMGTools.RootTools.samples.samples_13TeV_DATA2016'
    elif "T2tt" in sample:
        module_ = 'CMGTools.RootTools.samples.samples_13TeV_signals'
    else: 
        module_ = 'CMGTools.RootTools.samples.samples_13TeV_RunIISpring16MiniAODv2'

    try:
        heppy_sample = getattr(importlib.import_module( module_ ), sample)
    except:
        raise ValueError( "Could not load sample '%s' from %s "%( sample, module_ ) )

    # helpers
    subDir = getSubDir(heppy_sample.dataset, data_path)
    if not subDir:
        raise ValueError( "Not a good dataset name: '%s'"%heppy_sample.dataset )

    path = os.path.join( data_path, subDir )
    sample = Sample.fromCMGOutput(
        heppy_sample.name, 
        path, 
        treeFilename = 'tree.root', 
        treeName = 'tree', isData = heppy_sample.isData, maxN = maxN)

    sample.heppy = heppy_sample
    return sample
Ejemplo n.º 2
0
argParser.add_argument('--outputDir',
    dest='outputDir',
    action='store',
    nargs='?',
    type=str,
    default='/data/rschoefbeck/JetMET/localJEC/',
    help="output directory"
    )
args = argParser.parse_args()
logger = get_logger(args.logLevel, logFile = None)

#make samples. 
maxN = -1
#qcd_AllChGood_Flat0to50 = Sample.fromCMGOutput("qcd_AllChGood_Flat0to50", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AllChlgoodAsymptFlat0to50bx25_AllChannelsGood_v0-v2_RunIISpring15MiniAODv2-74X", treeFilename='tree.root', maxN=maxN)
#qcd_Flat0to50 = Sample.fromCMGOutput("qcd_Flat0to50", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AsymptFlat0to50bx25Reco_MCRUN2_74_V9-v3_RunIISpring15MiniAODv2-74X_3", treeFilename='tree.root', maxN=maxN)
qcd_AllChGood_noPU = Sample.fromCMGOutput("qcd_AllChGood_noPU", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AllChlgoodAsymptNoPUbx25_AllChannelsGood_v0-v2_RunIISpring15MiniAODv2-74X", treeFilename='tree.root', maxN=maxN)
qcd_noPU = Sample.fromCMGOutput("qcd_noPU", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AsymptNoPUbx25Reco_MCRUN2_74_V9-v3_RunIISpring15MiniAODv2-74X_3", treeFilename='tree.root', maxN=maxN)

# Select samples
sample_ideal, sample_real = qcd_AllChGood_noPU, qcd_noPU

# Pickle file which will hold the commonf events
positions_filename = os.path.join(args.outputDir, "common_positions_%s_%s.pkl"%(sample_ideal.name, sample_real.name) )

# Make common event lists
if not os.path.isfile(positions_filename):
    logger.info( "File %s not found, therefore finding positions of common events.", positions_filename)
    variables =  map( Variable.fromString, ['evt/l','run/I', 'lumi/I'] )

    reader_ideal = sample_ideal.treeReader( variables = variables , selectionString = "1")
    reader_ideal.start()
Ejemplo n.º 3
0
# argParser
import argparse
argParser = argparse.ArgumentParser(description = "Argument parser")
argParser.add_argument('--logLevel',
      action='store',
      nargs='?',
      choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'TRACE', 'NOTSET'],
      default='INFO',
      help="Log level for logging"
)

args = argParser.parse_args()
logger = get_logger(args.logLevel, logFile = None)

#make samples. Samples are statisticall compatible.
jetHT_M2_5_500  = Sample.fromCMGOutput("jetHT_M2_5_500", baseDirectory = "/data/rschoefbeck/cmgTuples/JetHT_HCal/", chunkString = "JetHT_schoef-crab_JetHT_Run2015D_M2_5_500", treeFilename='tree.root')
jetHT           = Sample.fromCMGOutput("JetHT", baseDirectory = "/data/rschoefbeck/cmgTuples/JetHT_HCal/", chunkString = "JetHT_schoef-crab_JetHT_Run2015D", treeFilename='tree.root')
QCD_Pt_15to3000_M2_5_500 = Sample.fromCMGOutput("QCD_Pt_15to3000_M2_5_500", baseDirectory = "/data/rschoefbeck/cmgTuples/QCD_HCal/QCD_Pt_15to3000_M2_5_500", treeFilename='tree.root')
QCD_Pt_15to3000 = Sample.fromCMGOutput("QCD_Pt_15to3000", baseDirectory = "/data/rschoefbeck/cmgTuples/QCD_HCal/QCD_Pt_15to3000", treeFilename='tree.root')

variables =  map( Variable.fromString, ['evt/l','run/I', 'lumi/I', 'Jet[pt/F,rawPt/F,phi/F,eta/F]', 'nJet/I'] )

maxN = 10000

# define TProfiles
thresholds = [10**(x/10.) for x in range(11,36)]
jetResponse_data = ROOT.TProfile("response_data", "response_data", len(thresholds)-1, array.array('d', thresholds) )
jetResponse_data.texName = "JetHT 260431" 
jetResponse_data.style = lineStyle(ROOT.kBlue)
jetResponse_mc = ROOT.TProfile("response_mc", "response_mc", len(thresholds)-1, array.array('d', thresholds) )
jetResponse_mc.texName = "QCD flat"
Ejemplo n.º 4
0
# RootTools
from RootTools.core.Sample import Sample

jets = Sample.fromDirectory("jets",
                            "/data/rschoefbeck/JetMET/localJEC/jetTrees/",
                            treeName="jets")

maxN = -1
#qcd_AllChGood_Flat0to50 = Sample.fromCMGOutput("qcd_AllChGood_Flat0to50", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AllChlgoodAsymptFlat0to50bx25_AllChannelsGood_v0-v2_RunIISpring15MiniAODv2-74X", treeFilename='tree.root', maxN=maxN)
#qcd_Flat0to50 = Sample.fromCMGOutput("qcd_Flat0to50", "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AsymptFlat0to50bx25Reco_MCRUN2_74_V9-v3_RunIISpring15MiniAODv2-74X_3", treeFilename='tree.root', maxN=maxN)
qcd_AllChGood_noPU = Sample.fromCMGOutput(
    "qcd_AllChGood_noPU",
    "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AllChlgoodAsymptNoPUbx25_AllChannelsGood_v0-v2_RunIISpring15MiniAODv2-74X",
    treeFilename='tree.root',
    maxN=maxN)
qcd_noPU = Sample.fromCMGOutput(
    "qcd_noPU",
    "/data/rschoefbeck/cmgTuples/MC25ns_v2_0l/QCD_Pt-15to7000_TuneCUETP8M1_Flat_13TeV_pythia8_schoef-crab_QCD_Pt-15to7000_AsymptNoPUbx25Reco_MCRUN2_74_V9-v3_RunIISpring15MiniAODv2-74X_3",
    treeFilename='tree.root',
    maxN=maxN)

#Flag_HBHENoiseIsoFilter
#Flag_EcalDeadCellTriggerPrimitiveFilter
#Flag_trkPOG_manystripclus53X
#Flag_ecalLaserCorrFilter
#Flag_trkPOG_toomanystripclus53X
#Flag_hcalLaserEventFilter
#Flag_trkPOG_logErrorTooManyClusters
#Flag_trkPOGFilters
#Flag_trackingFailureFilter
#Flag_CSCTightHaloFilter