From 88a5e36af0ad8fb9a2ddf268a1a3223fca241286 Mon Sep 17 00:00:00 2001
From: Eduardo Rodrigues <eduardo.rodrigues@cern.ch>
Date: Tue, 27 Feb 2018 21:06:23 +0000
Subject: [PATCH] Merge branch 'vanya-turbo-mc-v3' into '2018-patches'

DaVinci:minor adjustment for Turbo MC processing

See merge request lhcb/DaVinci!155

(cherry picked from commit 0dd24b7391bcd51458923b02cc1b2c479cdaae0b)

6f35fe49 DaVinci:
f0f62ef0 A bit more doc in DaVinci's Configuration.py.
d30e22ba  remove commented line and  suppress fake warning message
---
 Phys/DaVinci/python/DaVinci/Configuration.py | 40 +++++++++++++-------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/Phys/DaVinci/python/DaVinci/Configuration.py b/Phys/DaVinci/python/DaVinci/Configuration.py
index d8f6f37e8..9a748a7ca 100644
--- a/Phys/DaVinci/python/DaVinci/Configuration.py
+++ b/Phys/DaVinci/python/DaVinci/Configuration.py
@@ -173,6 +173,7 @@ class DaVinci(LHCbConfigurableUser) :
         if 'MDST' == self.getProp('InputType').upper() :
             if not self.getProp('RootInTES') :
                 log.warning ('RootInTES is not specified for MDST input')
+            elif self.getProp('Simulation') and     self.getProp('Turbo')     : pass 
             elif self.getProp('Simulation') and not self.getProp('RootInTES') in ( '/Event/AllStreams' , '/Event/AllStreams/' ) : 
                 log.warning ('RootInTES for MC-uDST ("%s") is not equal to "/Event/AllStreams"' % self.getProp('RootInTES') )
 
@@ -191,9 +192,34 @@ class DaVinci(LHCbConfigurableUser) :
         self.setOtherProps(AnalysisConf(),["DataType","Simulation","InputType","RootInTES"])
         self.setOtherProps(DstConf(),["DataType","Turbo"])
         self.setOtherProps(TrackSys(),["DataType"])
+
+        
         if self.getProp("Turbo"):
+            
+            data_type = self.getProp('DataType')
+
+            if not self.isPropertySet("RootInTES") :
+                if self.getProp('Simulation') and '2015' == data_type :
+                    self.setProp('RootInTES','/Event/Turbo')
+                else : 
+                    raise DaVinciConfigurationError ( "You must set DaVinci().RootInTES when DaVinci().Turbo is `True`")
+            
+            if   self.getProp('Simulation') and '2015' == data_type : pass 
+            elif 'MDST' != self.getProp('InputType') :
+                log.info ("Forcing `InputType` to `'MDST'` as `Turbo` is `True`")
+                self.setProp ( "InputType" , "MDST")
+                
             self.setOtherProps(TurboConf(), ["DataType","Simulation","RootInTES"])
 
+            # These lines are here and not in TurboConf because different applications need to process Turbo data differently:
+            # Tesla has to do a bit of juggling to get the data from HLT2 to locations under a single RootInTES, whereas DaVinci doesn't.
+            if data_type == "2016":
+                # Enable the decoding of the persisted reconstruction objects
+                TurboConf().RunPackedDataDecoder = True
+            if data_type in ["2016", "2017", "2018"]:
+                # Enable the unpacking of the persisted reconstruction objects
+                TurboConf().RunPersistRecoUnpacking = True                
+
     def _analysisSeq(self) :
         return GaudiSequencer('DaVinciAnalysisSeq', IgnoreFilterPassed = True)
 
@@ -407,20 +433,6 @@ class DaVinci(LHCbConfigurableUser) :
             if self.getProp("Simulation") :
                 DstConf().setProp("SimType","Full")
 
-        if self.getProp("Turbo"):
-            log.debug("Forcing `InputType` to `'MDST'` as `Turbo` is `True`")
-            self.setProp("InputType", "MDST")
-            if not self.getProp("RootInTES"):
-                raise DaVinciConfigurationError((
-                    "You must set DaVinci().RootInTES when DaVinci().Turbo is `True`"
-                ))
-            if self.getProp("DataType") == "2016":
-                # Enable the decoding of the persisted reconstruction objects
-                TurboConf().RunPackedDataDecoder = True
-            if self.getProp("DataType") in ["2016", "2017", "2018"]:
-                # Enable the unpacking of the persisted reconstruction objects
-                TurboConf().RunPersistRecoUnpacking = True
-
         return inputType
 
 ################################################################################
-- 
GitLab