File indexing completed on 2023-03-17 11:15:51
0001 import os
0002 import PhysicsTools.HeppyCore.framework.config as cfg
0003 from PhysicsTools.HeppyCore.framework.chain import Chain as Events
0004 import logging
0005 logging.basicConfig(level=logging.INFO)
0006
0007
0008
0009
0010 inputSample = cfg.Component(
0011 'test_component',
0012
0013
0014 files = [os.path.abspath('test_tree.root')],
0015 )
0016
0017 selectedComponents = [inputSample]
0018
0019 from PhysicsTools.HeppyCore.analyzers.Printer import Printer
0020 printer = cfg.Analyzer(
0021 Printer
0022 )
0023
0024 from PhysicsTools.HeppyCore.analyzers.SimpleTreeProducer import SimpleTreeProducer
0025 tree = cfg.Analyzer(
0026 SimpleTreeProducer,
0027 tree_name = 'tree',
0028 tree_title = 'A test tree'
0029 )
0030
0031 from PhysicsTools.HeppyCore.analyzers.Histogrammer import Histogrammer
0032 histos = cfg.Analyzer(
0033 Histogrammer,
0034 file_label = 'myhists'
0035 )
0036
0037
0038
0039 sequence = cfg.Sequence( [
0040 printer,
0041 tree,
0042 histos
0043 ] )
0044
0045 from PhysicsTools.HeppyCore.framework.services.tfile import TFileService
0046 output_rootfile = cfg.Service(
0047 TFileService,
0048 'myhists',
0049 fname='histograms.root',
0050 option='recreate'
0051 )
0052
0053 services = [output_rootfile]
0054
0055
0056 config = cfg.Config( components = selectedComponents,
0057 sequence = sequence,
0058 services = services,
0059 events_class = Events )
0060
0061