def initialize(self): MSG_INFO(self, 'Initializing EventSimulator...') if super(EventReader, self).initialize().isFailure(): MSG_FATAL(self, "Impossible to initialize the TEventLoop services.") # RingerPhysVal hold the address of required branches if self._dataframe is DataframeEnum.Lorenzetti_v1: #self._t.SetBranchStatus("*", False) from CaloCell import CaloCellCollection from CaloRings import CaloRings from CaloCluster import CaloCluster from EventInfo import EventInfo from GaugiKernel.schema import Lorenzetti_v1 self._event = Lorenzetti_v1() self._t.GetEntry(0) else: return StatusCode.FATAL MSG_INFO(self, "Creating containers...") self._containersSvc['EventInfoContainer'] = EventInfo() self._containersSvc['CaloCellsContainer'] = CaloCellCollection() self._containersSvc['CaloRingsContainer'] = CaloRings() self._containersSvc['CaloClusterContainer'] = CaloCluster() # configure all EDMs needed for key, edm in self._containersSvc.items(): # attach the EDM pointer into the context list self.getContext().setHandler(key, edm) # add properties edm.dataframe = self._dataframe edm.tree = self._t edm.level = self._level edm.event = self._event edm.setContext(self.getContext()) # If initializations is failed, we must remove this from the container # service if (edm.initialize().isFailure()): MSG_WARNING(self, 'Impossible to create the EDM: %s', key) self.getContext().initialize() MSG_INFO(self, 'Initializing all tools...') from Gaugi import ToolSvc as toolSvc self._alg_tools = toolSvc.getTools() for alg in self._alg_tools: if alg.status is StatusTool.DISABLE: continue # Retrieve all services alg.level = self._level alg.setContext(self.getContext()) alg.setStoreGateSvc(self.getStoreGateSvc()) alg.dataframe = self._dataframe if alg.isInitialized(): continue if alg.initialize().isFailure(): MSG_FATAL(self, "Impossible to initialize the tool name: %s", alg.name) return StatusCode.SUCCESS
def initialize(self): MSG_INFO(self, 'Initializing EventATLAS...') if super(EventATLAS, self).initialize().isFailure(): MSG_FATAL(self, "Impossible to initialize the TEventLoop services.") if self._dataframe is DataframeEnum.Electron_v1: from EventAtlas import Electron_v1 self._event = Electron_v1() elif self._dataframe is DataframeEnum.ElectronForward_v1: from EventAtlas import ElectronForward_v1 self._event = ElectronForward_v1() elif self._dataframe is DataframeEnum.Photon_v1: from EventAtlas import Photon_v1 self._event = Photon_v1() else: return StatusCode.FATAL MSG_INFO(self, "Creating containers...") # Allocating containers from EventAtlas import Electron from EventAtlas import ElectronForward from EventAtlas import Photon from EventAtlas import TrigEMCluster from EventAtlas import TrigElectron from EventAtlas import CaloCluster from EventAtlas import TrackParticle from EventAtlas import EmTauRoI from EventAtlas import EventInfo from EventAtlas import MonteCarlo from EventAtlas import TDT from EventAtlas import Menu # Initialize the base of this container. # Do not change this key names! self._containersSvc = { # event dataframe containers 'EventInfoContainer': EventInfo(), 'MonteCarloContainer': MonteCarlo(), 'CaloClusterContainer': CaloCluster(), 'MenuContainer': Menu(), } if self._dataframe is DataframeEnum.Electron_v1: self._containersSvc.update({ 'ElectronContainer': Electron(), 'TrackParticleContainer': TrackParticle(), 'HLT__TrigElectronContainer': TrigElectron(), 'HLT__ElectronContainer': Electron(), 'HLT__TrackParticleContainer': TrackParticle(), }) self._containersSvc.update({ 'HLT__TrigEMClusterContainer': TrigEMCluster(), 'HLT__CaloClusterContainer': CaloCluster(), 'HLT__EmTauRoIContainer': EmTauRoI(), }) elif self._dataframe is DataframeEnum.ElectronForward_v1: self._containersSvc.update( {'ElectronForwardContainer': ElectronForward()}) elif self._dataframe is DataframeEnum.Photon_v1: self._containersSvc.update({ 'PhotonContainer': Photon(), 'HLT__PhotonContainer': Photon(), }) self._containersSvc.update({ 'HLT__TrigEMClusterContainer': TrigEMCluster(), 'HLT__CaloClusterContainer': CaloCluster(), 'HLT__EmTauRoIContainer': EmTauRoI(), }) else: return StatusCode.FATAL if self._dataframe is DataframeEnum.Electron_v1 or DataframeEnum.Photon_v1: self._containersSvc.update({ # metadata containers 'HLT__TDT': TDT(), }) # force the event id number for this event looper #self._containersSvc['EventInfoContainer'].setId( self.id() ) # Add decoration for ATLAS event information self._containersSvc['EventInfoContainer'].setDecor( "is_fakes", True if 'fakes' in self._treePath else False) # configure all EDMs needed for key, edm in self._containersSvc.items(): self.getContext().setHandler(key, edm) # add properties edm.dataframe = self._dataframe edm.tree = self._t edm.level = self._level edm.event = self._event edm.setContext(self.getContext()) # enable hlt property by the container key name if 'HLT' in key: edm.is_hlt = True # set basepath into the root file if edm.useMetadataParams(): edm.setMetadataParams({ 'basepath': self._metadataInputFile[1].rsplit('/', 1)[0], 'file': self._metadataInputFile[0] }) # remove the last name after '/' (tree name) # If initializations is failed, we must remove this from the container # service MSG_INFO(self, "Initialize the dataframe with name: %s", key) if (edm.initialize().isFailure()): MSG_WARNING(self, 'Impossible to create the EDM: %s', key) self.getContext().initialize() MSG_INFO(self, 'Initializing all tools...') from Gaugi import ToolSvc as toolSvc self._alg_tools = toolSvc.getTools() for alg in self._alg_tools: if alg.status is StatusTool.DISABLE: continue # Retrieve all services alg.level = self._level alg.setContext(self.getContext()) alg.setStoreGateSvc(self.getStoreGateSvc()) alg.dataframe = self._dataframe if alg.isInitialized(): continue if alg.initialize().isFailure(): MSG_FATAL(self, "Impossible to initialize the tool name: %s", alg.name) return StatusCode.SUCCESS