With LHCbApp as the top level configurable, you can almost process a raw .mdf file like an ntuple. The raw files get written to castor from the pit and will remain staged to disk for a short period of time. E.g. for the TURBO stream:
nsls /castor/cern.ch/grid/lhcb/data/2016/RAW/TURBO/LHCb/COLLISION16/
Find a file from one of the most recent runs, which is likely to still be staged on disk. Something like:
/castor/cern.ch/grid/lhcb/data/2016/RAW/TURBO/LHCb/COLLISION16/175007/175007_0000000694.raw
What follows is an example to look at the Hlt decisions
lb-run Moore v26r5 python script.py
And here is the GaudiPython/LHCbApp script.
# minimal Gaudipython script to inspect the HLT selReports and decReports                                                
from os import environ, path
from Gaudi.Configuration import *
from Configurables import GaudiSequencer
from Configurables import LHCbApp

# the top level configurable is LHCbApp                                                                                  
LHCbApp().EvtMax = 10000

# configure the input data, tags, datatype etc...                                                                        
from GaudiConf import IOHelper
IOHelper('MDF').inputFiles(['mdf:root://castorlhcb.cern.ch//castor/cern.ch/grid/lhcb/data/2016/RAW/TURBO/LHCb/COLLISION16/175007/175007_0000000694.raw'])
LHCbApp().Simulation = False
LHCbApp().DataType = '2015'
LHCbApp().CondDBtag =  'cond-20150828'
LHCbApp().DDDBtag   =  'dddb-20150724'

# sequence for decoding the HltDecReports                                                                                
mySeq = GaudiSequencer("mySeq")
from DAQSys.Decoders import DecoderDB as ddb
from DAQSys.DecoderClass import decodersForBank
mySeq.Members+=[d.setup() for d in decodersForBank(ddb,"HltDecReports")]

# for the event loop                                                                                                     
from Configurables import EventSelector
EventSelector().PrintFreq = 1000

# set up the event loop based on GaudiPython                                                                             
import GaudiPython
ApplicationMgr().TopAlg+=[mySeq]
gaudi = GaudiPython.AppMgr()
evt = gaudi.evtsvc()

# dictionary to store some information about line decisions                                                              
stats = {'Hlt1':{},
         'Hlt2':{}}

# the event loop itself                                                                                                  
processed = 0
while processed < LHCbApp().EvtMax:
    processed += 1

    # process an event                                                                                                   
    gaudi.run(1)

    # odin banks                                                                                                         
    odin  = evt['DAQ/ODIN']
    if not odin: break ## basic check                                                                                    

    for HltLevel in ['Hlt1','Hlt2']:
        # get the raw bank                                                                                               
        hdr   = evt[HltLevel+'/DecReports']
	# print the reports if you want                                                                                  
        verbose = False
        if verbose:
            print [ i for i in hdr.decisionNames() if hdr.decReport(i).decision() ]
	# store the results in the dictionary for study                                                                  
        for lineName in hdr.decisionNames():
            if not lineName in stats[HltLevel].keys():
                stats[HltLevel][lineName] = 0
            elif hdr.decReport(lineName).decision():
                stats[HltLevel][lineName] += 1

import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(stats)

# end                                                                                                                    
gaudi.finalize()
Here is part of the print out that you should see at the end
EventSelector     SUCCESS Reading Event record 7001. Record number within stream 1: 7001
EventSelector     SUCCESS Reading Event record 8001. Record number within stream 1: 8001
EventSelector     SUCCESS Reading Event record 9001. Record number within stream 1: 9001
{   'Hlt1': {   'Hlt1B2GammaGammaDecision': 6,
                'Hlt1B2HH_LTUNB_KKDecision': 73,
                'Hlt1B2HH_LTUNB_KPiDecision': 85,
                'Hlt1B2HH_LTUNB_PiPiDecision': 63,
                'Hlt1B2PhiGamma_LTUNBDecision': 26,
                'Hlt1B2PhiPhi_LTUNBDecision': 3,
                'Hlt1BeamGasBeam1Decision': 8,
                'Hlt1BeamGasBeam2Decision': 0,
                'Hlt1BeamGasHighRhoVerticesDecision': 0,
                'Hlt1Bottomonium2KstarKstarDecision': 30,
                'Hlt1Bottomonium2PhiPhiDecision': 7,
                'Hlt1CalibHighPTLowMultTrksDecision': 1,
                'Hlt1CalibMuonAlignJpsiDecision': 44,
.... etc....
-- MikaVesterinen - 2016-05-26
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2017-08-23 - MarkWhitehead
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback