Skip to content
Snippets Groups Projects
Commit 87e70041 authored by Michel De Cian's avatar Michel De Cian Committed by Alex Pearce
Browse files

First commit of Configuration file, trying to get TurboSP MC to run with truthmatching

parent 0dafa217
No related branches found
No related tags found
No related merge requests found
......@@ -200,7 +200,7 @@ class Tesla(LHCbConfigurableUser):
HistogramPersistencySvc().OutputFile = self.getProp("Histogram")
def _configureTimingAuditor(self):
"""Enable the printing of the algorithm timing table."""
"""Enable the printing of the atelgorithm timing table."""
ApplicationMgr().ExtSvc += ['ToolSvc', 'AuditorSvc']
ApplicationMgr().AuditAlgorithms = True
AuditorSvc().Auditors += ['TimingAuditor']
......@@ -212,9 +212,11 @@ class Tesla(LHCbConfigurableUser):
def _configureTrackTruth(self,assocpp,trackLoc) :
assoctr = TrackAssociator("TurboAssocTr"+trackLoc)
assoctr.OutputLevel = self.getProp('OutputLevel')
assoctr.OutputLevel = self.getProp('OutputLevel')
assoctr.TracksInContainer = trackLoc
assocpp.TrackLocations += [ trackLoc ]
assoctr.TracksInContainer = trackLoc
assocpp.TrackLocations += [ trackLoc ]
#assocpp.OutputLevel = 1
# Add it to a sequence
return assoctr
......@@ -288,7 +290,8 @@ class Tesla(LHCbConfigurableUser):
copy_signal_mcp.OutputPrefix = output_prefix
# Don't copy the associated reconstruction, as Tesla already saves it
copy_signal_mcp.SaveAssociatedRecoInfo = False
copy_signal_mcp.OutputLevel = 1
algorithms = [copy_pp2mcp, copy_signal_mcp]
seq = GaudiSequencer('TurboMCFiltering', Members=algorithms)
......@@ -591,6 +594,45 @@ class Tesla(LHCbConfigurableUser):
# Add the output sequence
TeslaReportAlgoSeq.Members += [TeslaOutputStreamsSequence]
def _configureTruthMatching(self, name, packing):
# CHARGED STUFF #####################################################################
# Get the location of all tracks and all charged protoparticles we want to truthmatch
track_locs = [v for v in packing.outputs.values() if 'track' in v.lower()]
proto_locs = [v for v in packing.outputs.values() if 'proto' in v.lower()]
ChargedProtoSeq = GaudiSequencer("ChargedTruthSequencer")
assocpp = ChargedPP2MC("TurboProtoAssocPP")
assocpp.OutputLevel = self.getProp('OutputLevel')
#assocpp.OutputLevel = 1
assocpp.VetoEmpty=True
# Make all track -> MCParticle linker tables
for loc in track_locs:
truthSeq = self._configureTrackTruth(assocpp,loc)
ChargedProtoSeq.Members.append( truthSeq )
# Make the protoparticle -> track linker tables
assocpp.InputData += proto_locs
ChargedProtoSeq.Members.append( assocpp )
#relationsLocations = [os.path.join('Relations', path)
# for path in assocpp.InputData]
#relationsLocations.append(protoneutral)
print "++++++++++++++++"
print relationsLocations
print proto_locs
#dummy = [ loc.lstrip('/Event/') for loc in proto_locs ]
#relationsLocations = [ '/Event/Relations' + v for v in dummy ]
relationsLocations = [ loc.replace('/Event', '/Event/Relations') for loc in proto_locs ]
print relationsLocations
print "++++++++++++++++"
#relationsLocations = [ "/Event/Relations/Turbo/Long/Protos" ]
filterMCSeq = self._filterMCParticlesSequence(relationsLocations)
ChargedProtoSeq.Members += [filterMCSeq]
return ChargedProtoSeq
def _configureOutputStream(self, stream, lines_dict):
'''
The lines dictionary should have the following form:
......@@ -830,7 +872,7 @@ class Tesla(LHCbConfigurableUser):
)]
# Kill any links the output file might have had to the input file
if online:
if online and not simulation:
address_killer = [AddressKillerAlg()]
else:
address_killer = []
......@@ -901,6 +943,22 @@ class Tesla(LHCbConfigurableUser):
]
))
# MC stuff
if self.getProp("Simulation"):
# Make sure the DoD is alive and well
from Configurables import ApplicationMgr, DataOnDemandSvc
extsvc = ApplicationMgr().ExtSvc
dod = DataOnDemandSvc()
dod_enabled = ('DataOnDemandSvc' in extsvc) or (dod in extsvc)
if not dod_enabled:
ApplicationMgr().ExtSvc.append(dod)
# Check that the DoD is running
#dod.OutputLevel = 1
self._unpackMC()
stream_seq.Members.append(self._configureTruthMatching(name, packing))
# No need to clone if the output prefix is empty (everything stays
# under /Event/Turbo)
if output_prefix:
......@@ -1038,7 +1096,7 @@ class Tesla(LHCbConfigurableUser):
else:
fname = self.getProp('outputFile')
if online:
if online and not self.getProp('Simulation'):
writer = OutputStream(namer(self.writerName))
writer.AcceptAlgs += ['LumiSeq', 'PhysFilter']
# In online mode we perform the raw event juggling (otherwise
......@@ -1048,8 +1106,18 @@ class Tesla(LHCbConfigurableUser):
# In offline mode, e.g. after Brunel, propagate everything from the
# input file to the output
writer = InputCopyStream(namer(self.writerName))
optional_output_locations += self._output_raw_event_locations(raw_format_output)
optional_output_locations += ["/Event/Turbo/Relations#999"]
optional_output_locations += ["/Event/Turbo/MC#999"]
writer.ItemList = required_output_locations
writer.OptItemList = optional_output_locations
print "###############################"
print "###############################"
print "###############################"
print writer.ItemList
print writer.OptItemList
# Keep the 2016 behaviour by not writing out anything if the
# sel reports are missing
writer.RequireAlgs = [self._selReportsCheck(), stream_seq]
......@@ -1148,6 +1216,8 @@ class Tesla(LHCbConfigurableUser):
if self.getProp('Mode') is "Online":
self.setProp('WriteFSR',True)
self._configureLumi()
if self.getProp('Simulation')==True:
self._unpackMC()
else:
DecodeRawEvent().DataOnDemand=True
RecombineRawEvent(Version=self.getProp('SplitRawEventInput'))
......
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