Esempio n. 1
0
 def test_tfile(self):
     config = cfg.Service(TFileService, 
                          'myhists', 
                          fname = 'histos.root', 
                          option = 'recreate')
     dummy = None
     dirname = 'test_dir'
     if os.path.exists(dirname):
         shutil.rmtree(dirname)
     os.mkdir(dirname)
     fileservice = TFileService(config, dummy, dirname)
     fileservice.start()
     fileservice.stop()
     shutil.rmtree(dirname)
if sampleName == "all":
    selectedComponents = [
        cmsMatching_QCD_15_3000_L1TMuon_GenJet,
        cmsMatching_QCD_15_3000_L1TEGamma_GenJet,
        cmsMatching_QCD_15_3000_L1TTau_GenJet,
    ]
else:
    sample = globals()[sampleName]
    selectedComponents = [sample]

# Defining pdgids

source = cfg.Analyzer(CMSMatchingReader, )

tfile_service_1 = cfg.Service(TFileService,
                              'tfile1',
                              fname='histograms.root',
                              option='recreate')


def pt(ptc):
    return ptc.pt()


def deltaPt(ptc):
    return ptc.pt() - ptc.match.pt()


def eta(ptc):
    return ptc.eta()

Esempio n. 3
0
def particleCheckerFactory(ptcName):
    def particleChecker(ptc):
        if (abs(ptc.pdgid()) == pdgIds[ptcName]):
            import pdb
            pdb.set_trace()
        return (abs(ptc.pdgid()) == pdgIds[ptcName])

    return particleChecker


# All my stuff will be saved in this file

gSystem.Load("libdatamodelDict")

tfile_service_1 = cfg.Service(TFileService,
                              'tfile1',
                              fname='distributions.root',
                              option='recreate')
''' Returns pt'''


def pt(ptc):
    return ptc.pt()


'''Returns eta'''


def eta(ptc):
    return ptc.eta()

Esempio n. 4
0
        bins=ptBins,
        object_x_range=(-300, 300),
        probability_file=probabilityFile,
        probability_histogram=probabilityHistogram)

steps = []

x = 0
while x <= 500:
    steps.append(x)
    x += 0.5

# File in which all the rate plots will be stored

tfile_service_1 = cfg.Service(TFileService,
                              'ratePlotFile',
                              fname='ratePlots.root',
                              option='recreate')

simL1TObjectRate = cfg.Analyzer(RatePlotProducer,
                                instance_label='simL1TObjectRate',
                                file_label='ratePlotFile',
                                plot_name='simL1TObjectTriggerRate',
                                plot_title='Sim-' + triggerObjectName +
                                ' trigger rate',
                                input_objects='leading_' + triggerObjectName,
                                bins=steps,
                                pileup=140,
                                yscale=mySettings.yScale,
                                normalise=False)

genJetRate = cfg.Analyzer(RatePlotProducer,
    electrons='electrons',
    electronITags='electronITags',
    muons='muons',
    muonITags='muonITags',
    photons='photons',
    met='met',
)

from ROOT import gSystem
gSystem.Load("libdatamodelDict")

from EventStore import EventStore as Events

from heppy.framework.services.tfile import TFileService
tfile_service_1 = cfg.Service(TFileService,
                              'efficiencyFile',
                              fname='efficiency.root',
                              option='recreate')


def pt(ptc):
    return ptc.pt()


from heppy.analyzers.triggerrates.EfficiencyPlotProducer import EfficiencyPlotProducer
metEfficiency = cfg.Analyzer(EfficiencyPlotProducer,
                             file_label='efficiencyFile',
                             plot_name='metTriggerEfficiency',
                             plot_title='MET trigger efficiency',
                             input_objects='met',
                             min=0,
                             max=300,
Esempio n. 6
0
# creating a simple output tree
from heppy.FCChhAnalyses.HELHC.tth.TreeProducer import SimpleTreeProducer
tree = cfg.Analyzer(SimpleTreeProducer,
                    tree_name='events',
                    tree_title='A test tree')

# definition of a sequence of analyzers,
# the analyzers will process each event in this order
sequence = cfg.Sequence([
    random,
    # printer,
    # stopper,
    tree,
])

from heppy.framework.services.tfile import TFileService
output_rootfile = cfg.Service(TFileService,
                              'myhists',
                              fname='histograms.root',
                              option='recreate')

services = [output_rootfile]

# finalization of the configuration object.
config = cfg.Config(components=selectedComponents,
                    sequence=sequence,
                    services=services,
                    events_class=Events)

# print config
Esempio n. 7
0
    gen_jets='genJets',
    jets='jets',
    bTags='bTags',
    cTags='cTags',
    tauTags='tauTags',
    electrons='electrons',
    electronITags='electronITags',
    muons='muons',
    muonITags='muonITags',
    photons='photons',
    met='met',
)

from heppy.framework.services.tfile import TFileService
tfile_service_1 = cfg.Service(TFileService,
                              'tfile1',
                              fname='plots.root',
                              option='recreate')

from ROOT import gSystem
gSystem.Load("libdatamodelDict")

from EventStore import EventStore as Events


def pt(ptc):
    return ptc.pt()


def eta(ptc):
    return ptc.eta()