Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:54

0001 # ==========================================================================
0002 #  AIDA Detector description implementation
0003 # --------------------------------------------------------------------------
0004 # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 # All rights reserved.
0006 #
0007 # For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 # For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 #
0010 # ==========================================================================
0011 from __future__ import absolute_import, unicode_literals
0012 import dddigi
0013 import os
0014 
0015 
0016 def make_input(kernel):
0017   input_1 = dddigi.TestAction(kernel, 'input_01', 50)
0018   input_2 = dddigi.TestAction(kernel, 'input_02', 100)
0019   input_3 = dddigi.TestAction(kernel, 'input_03', 75)
0020   input_4 = dddigi.TestAction(kernel, 'input_04', 30)
0021   seq = kernel.inputAction()
0022   seq.adopt(input_1)
0023   seq.adopt(input_2)
0024   seq.adopt(input_3)
0025   seq.adopt(input_4)
0026   return seq
0027 
0028 
0029 def make_subdetector(kernel, name):
0030   action_1 = dddigi.TestAction(kernel, name + '_deposits', 75)
0031   action_2 = dddigi.TestAction(kernel, name + '_rndmNoise', 50)
0032   action_3 = dddigi.TestAction(kernel, name + '_deadChan', 50)
0033   action_4 = dddigi.TestAction(kernel, name + '_noiseChan', 25)
0034   action_5 = dddigi.TestAction(kernel, name + '_merge', 60)
0035   seq = dddigi.Action(kernel, 'DigiActionSequence/' + name + '_sequence', parallel=True)
0036   seq.adopt(action_1)
0037   seq.adopt(action_2)
0038   seq.adopt(action_3)
0039   seq.adopt(action_4)
0040   seq.adopt(action_5)
0041   return seq
0042 
0043 
0044 def run():
0045   # import pdb
0046   # pdb.set_trace()
0047   dddigi.setPrintFormat(str('%-32s %5s %s'))
0048   kernel = dddigi.Kernel()
0049   install_dir = os.environ['DD4hepExamplesINSTALL']
0050   fname = "file:" + install_dir + "/examples/ClientTests/compact/MiniTel.xml"
0051   kernel.loadGeometry(str(fname))
0052   digi = dddigi.Digitize(kernel)
0053   digi.printDetectors()
0054 
0055   event_processor = dddigi.Action(kernel, 'DigiSynchronize/MainDigitizer')
0056   event_processor.parallel = True
0057   # input
0058   make_input(kernel)
0059   # Subdetector digitization
0060   dets = digi.activeDetectors()
0061   for d in dets:
0062     seq = make_subdetector(kernel, d['name'])
0063     event_processor.adopt(seq)
0064   kernel.eventAction().adopt(event_processor)
0065   # Output
0066   output = dddigi.TestAction(kernel, 'output_01', 50)
0067   kernel.outputAction().adopt(output)
0068 
0069   dddigi.setPrintLevel(dddigi.OutputLevel.DEBUG)
0070   kernel.numThreads = 0   # = number of concurrent threads
0071   kernel.numEvents = 5
0072   kernel.maxEventsParallel = 3
0073   kernel.run()
0074   dddigi.setPrintLevel(dddigi.OutputLevel.INFO)
0075 
0076 
0077 if __name__ == '__main__':
0078   run()