Skip to content
Snippets Groups Projects
Commit d7ea7aaa authored by Alex Pearce's avatar Alex Pearce
Browse files

Move imports to the top of the file.

parent c4ee977a
No related branches found
No related tags found
2 merge requests!85merge master to future,!66Configuration of Tesla with selective persistence
import logging as log
import os
import re
from Configurables import (
AddressKillerAlg,
CaloClusterMCTruth,
CaloDigit2MCLinks2Table,
ChargedPP2MC,
CopyLinePersistenceLocations,
CopyParticle2PVRelationsFromLinePersistenceLocations,
CopyProtoParticle2MCRelations,
CopySignalMCParticles,
DataOnDemandSvc,
DataPacking__Pack_LHCb__CaloClusterPacker_ as PackCaloClusters,
DataPacking__Unpack_LHCb__CaloClusterPacker_ as UnpackCaloClusters,
DecodeRawEvent,
DstConf,
EventSelector,
GaudiSequencer,
HltLinePersistenceSvc,
HltPackedDataDecoder,
HltRoutingBitsFilter,
InputCopyStream,
LHCbApp,
LHCbConfigurableUser,
LoKi__HDRFilter as HltDecReportsFilter,
LumiAlgsConf,
NeutralPP2MC,
OutputStream,
P2MCPFromProtoP,
PackCaloHypo as PackCaloHypos,
PackMCParticle,
PackMCVertex,
PackParticlesAndVertices,
PrintDuplicates,
RawEventFormatConf,
RawEventJuggler,
RecSummaryFromSelReports,
RecombineRawEvent,
RecordStream,
TeslaLineChecker,
TeslaReportAlgo,
TrackAssociator,
TrackSys,
TurboConf,
TurboPrescaler,
UnpackCaloHypo as UnpackCaloHypos,
UnpackParticlesAndVertices,
bankKiller
)
from DAQSys.Decoders import DecoderDB
from Gaudi.Configuration import *
from LHCbKernel.Configuration import *
from Configurables import LHCbApp
from GaudiConf import IOExtension, IOHelper
from GaudiConf.PersistRecoConf import PersistRecoPacking
import GaudiKernel.ProcessJobOptions
from Configurables import ( LHCbConfigurableUser, LHCbApp, RecSysConf, TrackSys,
GaudiSequencer, DstConf, L0Conf, CondDB, GlobalRecoConf, RawEventJuggler, DecodeRawEvent,
RawEventFormatConf, LumiAlgsConf, InputCopyStream, RecombineRawEvent)
from Configurables import TrackAssociator, ChargedPP2MC, P2MCPFromProtoP, TrackSys
from Configurables import PackParticlesAndVertices, bankKiller, TurboConf
from TurboStreamProd import prodDict
from copy import copy
from LHCbKernel.Configuration import *
class Tesla(LHCbConfigurableUser):
__used_configurables__ = [ LHCbApp, LumiAlgsConf, RawEventJuggler, DecodeRawEvent, RawEventFormatConf, DstConf, RecombineRawEvent, PackParticlesAndVertices, TrackAssociator, ChargedPP2MC, TrackSys, TurboConf]
......@@ -122,7 +166,6 @@ class Tesla(LHCbConfigurableUser):
if 'DataOnDemandSvc' in ApplicationMgr().ExtSvc :
ApplicationMgr().ExtSvc.pop('DataOnDemandSvc')
else:
from Configurables import DataOnDemandSvc
dod = DataOnDemandSvc()
if dod not in ApplicationMgr().ExtSvc :
ApplicationMgr().ExtSvc.append( dod )
......@@ -147,7 +190,6 @@ class Tesla(LHCbConfigurableUser):
return assoctr
def _configureDigitsTruth(self) :
from Configurables import CaloDigit2MCLinks2Table
assocdigits = CaloDigit2MCLinks2Table("TurboDigitAssoc")
return
......@@ -155,14 +197,12 @@ class Tesla(LHCbConfigurableUser):
retSeq = GaudiSequencer("NeutralTruth")
clusterTabLoc = self.base + "Relations/CaloClusters"
from Configurables import CaloClusterMCTruth
assoccluster = CaloClusterMCTruth("TurboClusterAssoc")
assoccluster.OutputLevel = self.getProp('OutputLevel')
assoccluster.Input = digits
assoccluster.Output = clusterTabLoc
assoccluster.Clusters+=clusters
from Configurables import NeutralPP2MC
# When filtering MC, the relations table cloners will copy the tables
# to /Event/Turbo for us. Otherwise we create them there directly
protoTabLoc = "Relations/Turbo/NeutralPP2MC"
......@@ -201,11 +241,6 @@ class Tesla(LHCbConfigurableUser):
if not self.getProp('FilterMC'):
return
from Configurables import (
CopyProtoParticle2MCRelations,
CopySignalMCParticles
)
output_prefix = self.base.replace('/', '')
# Algorithm to clone the existing relations tables and the MC particles
......@@ -261,7 +296,6 @@ class Tesla(LHCbConfigurableUser):
lumiSeq = GaudiSequencer("LumiSeq")
#
# Add ODIN decoder to LumiSeq ***
from DAQSys.Decoders import DecoderDB
CreateODIN=DecoderDB["createODIN"].setup()
#********************************
#
......@@ -281,10 +315,8 @@ class Tesla(LHCbConfigurableUser):
physFilterRequireMask = [ 0x0, 0x4, 0x0 ]
else:
physFilterRequireMask = [ 0x0, 0x0, 0x80000000 ]
from Configurables import HltRoutingBitsFilter
physFilter = HltRoutingBitsFilter( "PhysFilter", RequireMask = physFilterRequireMask )
from Configurables import RecordStream
FSRWriter = RecordStream( "FSROutputStreamDstWriter")
FSRWriter.OutputLevel = INFO
self.teslaSeq.Members += [lumiSeq, physFilter]
......@@ -300,7 +332,6 @@ class Tesla(LHCbConfigurableUser):
# Setting up online
if self.getProp('Mode') is "Online":
from DAQSys.Decoders import DecoderDB
Hlt1VertexReportsDecoder=DecoderDB["HltVertexReportsDecoder/Hlt1VertexReportsDecoder"].setup()
Hlt2VertexReportsDecoder=DecoderDB["HltVertexReportsDecoder/Hlt2VertexReportsDecoder"].setup()
Hlt2SelReportsDecoder=DecoderDB["HltSelReportsDecoder/Hlt2SelReportsDecoder"].setup()
......@@ -310,7 +341,7 @@ class Tesla(LHCbConfigurableUser):
totalLines=[]
if turbo_streams:
lines_left_over = copy(lines)
lines_left_over = lines[:]
missing_lines = []
for stream in turbo_streams:
for line in turbo_streams[stream]['lines']:
......@@ -327,7 +358,6 @@ class Tesla(LHCbConfigurableUser):
else:
totalLines = lines
from Configurables import TeslaLineChecker
if self.getProp('EnableLineChecker'):
lineChecker = TeslaLineChecker("TeslaLineChecker")
lineChecker.RequestedLines = totalLines
......@@ -337,7 +367,6 @@ class Tesla(LHCbConfigurableUser):
TeslaReportAlgoSeq.Members+=[trig1]
# make use of PrintDuplicates algorithm
from Configurables import PrintDuplicates
dplic = PrintDuplicates("TurboDuplicates")
dplic.OutputLevel = self.getProp('OutputLevel')
for l in totalLines:
......@@ -409,7 +438,6 @@ class Tesla(LHCbConfigurableUser):
## Add the digits associator
outputDigiLoc = tesROOT + "Digi2MCP"
from Configurables import CaloDigit2MCLinks2Table
assocdigits = CaloDigit2MCLinks2Table("TurboDigitAssoc")
assocdigits.OutputLevel = self.getProp('OutputLevel')
outputiDigiLoc = tesROOT + "Relations/CaloDigits"
......@@ -468,14 +496,12 @@ class Tesla(LHCbConfigurableUser):
AlwaysCreateOutput = True)
TeslaReportAlgoSeq.Members +=[packer]
from Configurables import PackCaloHypo as PackCaloHypos
hypopacker = PackCaloHypos( name = "PackCaloHypos",
AlwaysCreateOutput = True,
DeleteInput = False,
OutputLevel = self.getProp('OutputLevel'),
InputName = self.base+"CaloHypos",
OutputName = self.base+"pRec/neutral/Hypos" )
from Configurables import DataPacking__Pack_LHCb__CaloClusterPacker_ as PackCaloClusters
clusterpacker = PackCaloClusters( name = "PackCaloClusters",
AlwaysCreateOutput = True,
DeleteInput = False,
......@@ -486,7 +512,6 @@ class Tesla(LHCbConfigurableUser):
# Pack the filtered MC particles and vertices
if self.getProp('Simulation') and self.getProp('FilterMC'):
from Configurables import PackMCParticle, PackMCVertex
mcp_packer = PackMCParticle(
'TurboPackMCParticle',
AlwaysCreateOutput=True,
......@@ -518,7 +543,6 @@ class Tesla(LHCbConfigurableUser):
if ps:
newDict={}
newDict['lines']=turbo_streams[stream]['lines']
import re
pattern = re.compile("prescaled", re.IGNORECASE)
if "prescaled" in stream.lower():
turbo_streams[pattern.sub("parked", stream)]=newDict
......@@ -575,8 +599,7 @@ class Tesla(LHCbConfigurableUser):
prescale[line]=1.0
print prescale
prescaleVersion = lines_dict.get('prescaleVersion', None)
from Configurables import TurboPrescaler as ps
pscaler = ps("TurboPrescaler"+stream)
pscaler = TurboPrescaler("TurboPrescaler"+stream)
pscaler.FilterOutput=True
pscaler.ChosenOutputPrescales=prescale
pscaler.PrescaleVersion=prescaleVersion
......@@ -597,7 +620,6 @@ class Tesla(LHCbConfigurableUser):
if self.getProp("Persistency") is not None:
persistency=self.getProp("Persistency")
from GaudiConf import IOExtension, IOHelper
iox=IOExtension(persistency)
writer = InputCopyStream(self.writerName + stream)
......@@ -607,11 +629,10 @@ class Tesla(LHCbConfigurableUser):
# If HDR requested, then filter on the output (required if streaming)
if self.getProp("HDRFilter") or self.getProp("Streams"):
from Configurables import LoKi__HDRFilter
filtCode='|'.join(["HLT_TURBOPASS_RE(\'"+l+"Decision\')" for l in lines])
print("Filter code:")
print(filtCode)
HLTFilter = LoKi__HDRFilter ('Hlt2_HLTFilter' + stream
HLTFilter = HltDecReportsFilter ('Hlt2_HLTFilter' + stream
, Code = filtCode
, Location = "Hlt2/DecReports"
)
......@@ -674,7 +695,6 @@ class Tesla(LHCbConfigurableUser):
return seq
def _configureReportAlg(self, lines):
from Configurables import TeslaReportAlgo
trig1 = TeslaReportAlgo("TeslaReportAlgo")
trig1.OutputPrefix=self.base
trig1.PV=self.getProp('PV')
......@@ -700,26 +720,6 @@ class Tesla(LHCbConfigurableUser):
log.warning('Not streaming and not running on MC, nothing to do!')
return
# XXX move these up top
from Configurables import (
AddressKillerAlg,
CopyLinePersistenceLocations,
CopyParticle2PVRelationsFromLinePersistenceLocations,
DataPacking__Pack_LHCb__CaloClusterPacker_ as PackCaloClusters,
DataPacking__Unpack_LHCb__CaloClusterPacker_ as UnpackCaloClusters,
HltLinePersistenceSvc,
HltPackedDataDecoder,
LoKi__HDRFilter,
OutputStream,
PackCaloHypo as PackCaloHypos,
RecSummaryFromSelReports,
UnpackCaloHypo as UnpackCaloHypos,
UnpackParticlesAndVertices
)
from DAQSys.Decoders import DecoderDB
from GaudiConf import IOHelper
from GaudiConf.PersistRecoConf import PersistRecoPacking
# Setting up online
decoders_seq = GaudiSequencer('TeslaDecoders')
if online:
......@@ -928,7 +928,6 @@ class Tesla(LHCbConfigurableUser):
else:
self._configureOutput()
#
from Configurables import EventSelector
EventSelector().PrintFreq = 1000
# Add monitors if they are there
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment