Пример #1
0
#use tfile service to provide a single TFile to all modules where they
#can write any root object. If the name is 'outputfile' or the one specified in treeProducer
#also the treeProducer uses this file
from PhysicsTools.HeppyCore.framework.services.tfile import TFileService 
output_service = cfg.Service(
      TFileService,
      'outputfile',
      name="outputfile",
      fname='tree.root',
      option='recreate'
    )

# the following two lines are just for automatic testing
# they are not needed for running on your own samples
from PhysicsTools.Heppy.utils.miniAodFiles import miniAodFiles
testfiles=miniAodFiles()

sample = cfg.Component(
#specify the file you want to run on
#    files = ["/scratch/arizzi/Hbb/CMSSW_7_2_2_patch2/src/VHbbAnalysis/Heppy/test/ZLL-8A345C56-6665-E411-9C25-1CC1DE04DF20.root"],
    files = testfiles,
    name="SingleSample", isMC=False,isEmbed=False
    )

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = CmsswPreprocessor("makeAK5Jets.py")

# the following is declared in case this cfg is used in input to the heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
selectedComponents = [sample]
config = cfg.Config( components = selectedComponents,
]

#use tfile service to provide a single TFile to all modules where they
#can write any root object. If the name is 'outputfile' or the one specified in treeProducer
#also the treeProducer uses this file
from PhysicsTools.HeppyCore.framework.services.tfile import TFileService
output_service = cfg.Service(TFileService,
                             'outputfile',
                             name="outputfile",
                             fname='tree.root',
                             option='recreate')

# the following two lines are just for automatic testing
# they are not needed for running on your own samples
from PhysicsTools.Heppy.utils.miniAodFiles import miniAodFiles
testfiles = miniAodFiles()

sample = cfg.Component(
    #specify the file you want to run on
    #    files = ["/scratch/arizzi/Hbb/CMSSW_7_2_2_patch2/src/VHbbAnalysis/Heppy/test/ZLL-8A345C56-6665-E411-9C25-1CC1DE04DF20.root"],
    files=testfiles,
    name="SingleSample",
    isMC=False,
    isEmbed=False)

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = CmsswPreprocessor("makeAK5Jets.py")

# the following is declared in case this cfg is used in input to the heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
selectedComponents = [sample]
Пример #3
0
from PhysicsTools.Heppy.analyzers.objects.TauAnalyzer import TauAnalyzer

TauAna = TauAnalyzer.defaultConfig

from PhysicsTools.Heppy.analyzers.objects.JetAnalyzer import JetAnalyzer

JetAna = JetAnalyzer.defaultConfig

sequence = [VertexAna, LepAna, TauAna, PhoAna, JetAna, treeProducer]

from PhysicsTools.Heppy.utils.miniAodFiles import miniAodFiles

sample = cfg.Component(
    # files = "/scratch/arizzi/heppy/CMSSW_7_2_0_pre8/src/PhysicsTools/Heppy/test/E21AD523-E548-E411-8DF6-00261894388F.root",
    files=miniAodFiles(),
    name="ATEST",
    isMC=False,
    isEmbed=False)

# the following is declared in case this cfg is used in input to the heppy.py script
selectedComponents = [sample]
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events

config = cfg.Config(components=selectedComponents,
                    sequence=sequence,
                    events_class=Events)

# and the following runs the process directly
if __name__ == '__main__':
    from PhysicsTools.HeppyCore.framework.looper import Looper
Пример #4
0
from __future__ import print_function
import os
import PhysicsTools.HeppyCore.framework.config as cfg
from PhysicsTools.Heppy.utils.miniAodFiles import miniAodFiles

# set to True if you want several parallel processes
multi_thread = False

# input component
# several input components can be declared,
# and added to the list of selected components
inputSample = cfg.MCComponent(
    'test_component',
    files=miniAodFiles(),  # returns a list of file for this release
    # a list of local or xrootd files can be specified by hand.
)

if 'RelValZMM' not in inputSample.files[0]:
    print('''WARNING: this tutorial is supposed to run on Z->mumu events.
Do not expect meaningful results for this sample:''')
    print(inputSample)

if multi_thread:
    inputSample.splitFactor = len(inputSample.files)

selectedComponents = [inputSample]

# a very simple muon analyzer
# read miniaod muons and wrap them in python muons
from PhysicsTools.Heppy.analyzers.examples.SimpleMuonAnalyzer import SimpleMuonAnalyzer
muons = cfg.Analyzer(
Пример #5
0
import os
import PhysicsTools.HeppyCore.framework.config as cfg
from PhysicsTools.Heppy.utils.miniAodFiles import miniAodFiles


# input component 
# several input components can be declared,
# and added to the list of selected components
inputSample = cfg.Component(
    'test_component',
    files = miniAodFiles(),
    )
inputSample.isMC = True
# inputSample.splitFactor = 2 

selectedComponents  = [inputSample]

from PhysicsTools.Heppy.analyzers.examples.SimpleJetAnalyzer import SimpleJetAnalyzer
jets = cfg.Analyzer(
    SimpleJetAnalyzer,
    'jets',
    ptmin = 30. 
    )

from PhysicsTools.Heppy.analyzers.examples.SimpleTreeAnalyzer import SimpleTreeAnalyzer
tree = cfg.Analyzer(
    SimpleTreeAnalyzer
    )


# definition of a sequence of analyzers,
Пример #6
0
import os
import PhysicsTools.HeppyCore.framework.config as cfg
from PhysicsTools.Heppy.utils.miniAodFiles import miniAodFiles

# set to True if you want several parallel processes
multi_thread = False

# input component
# several input components can be declared,
# and added to the list of selected components
inputSample = cfg.MCComponent(
    "test_component",
    files=miniAodFiles(),  # returns a list of file for this release
    # a list of local or xrootd files can be specified by hand.
)

if "RelValZMM" not in inputSample.files[0]:
    print """WARNING: this tutorial is supposed to run on Z->mumu events.
Do not expect meaningful results for this sample:"""
    print inputSample

if multi_thread:
    inputSample.splitFactor = len(inputSample.files)

selectedComponents = [inputSample]

# a very simple muon analyzer
# read miniaod muons and wrap them in python muons
from PhysicsTools.Heppy.analyzers.examples.SimpleMuonAnalyzer import SimpleMuonAnalyzer

muons = cfg.Analyzer(SimpleMuonAnalyzer, "muons")