Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 08:17:44

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 import dddigi
0012 import os
0013 
0014 
0015 def make_input(kernel):
0016   input_1 = dddigi.TestAction(kernel, 'input_01', 50)
0017   input_2 = dddigi.TestAction(kernel, 'input_02', 100)
0018   input_3 = dddigi.TestAction(kernel, 'input_03', 75)
0019   input_4 = dddigi.TestAction(kernel, 'input_04', 30)
0020   seq = kernel.inputAction()
0021   seq.adopt(input_1)
0022   seq.adopt(input_2)
0023   seq.adopt(input_3)
0024   seq.adopt(input_4)
0025   return seq
0026 
0027 
0028 def make_subdetector(kernel, name):
0029   action_1 = dddigi.TestAction(kernel, name + '_deposits', 75)
0030   action_2 = dddigi.TestAction(kernel, name + '_rndmNoise', 50)
0031   action_3 = dddigi.TestAction(kernel, name + '_deadChan', 50)
0032   action_4 = dddigi.TestAction(kernel, name + '_noiseChan', 25)
0033   action_5 = dddigi.TestAction(kernel, name + '_merge', 60)
0034   seq = dddigi.Action(kernel, 'DigiActionSequence/' + name + '_sequence', parallel=True)
0035   seq.adopt(action_1)
0036   seq.adopt(action_2)
0037   seq.adopt(action_3)
0038   seq.adopt(action_4)
0039   seq.adopt(action_5)
0040   return seq
0041 
0042 
0043 def run():
0044   # import pdb
0045   # pdb.set_trace()
0046   dddigi.setPrintFormat(str('%-32s %5s %s'))
0047   kernel = dddigi.Kernel()
0048   install_dir = os.environ['DD4hepExamplesINSTALL']
0049   fname = "file:" + install_dir + "/examples/ClientTests/compact/MiniTel.xml"
0050   kernel.loadGeometry(str(fname))
0051   digi = dddigi.Digitize(kernel)
0052   digi.printDetectors()
0053 
0054   event_processor = dddigi.Action(kernel, 'DigiSynchronize/MainDigitizer')
0055   event_processor.parallel = True
0056   # input
0057   make_input(kernel)
0058   # Subdetector digitization
0059   dets = digi.activeDetectors()
0060   for d in dets:
0061     seq = make_subdetector(kernel, d['name'])
0062     event_processor.adopt(seq)
0063   kernel.eventAction().adopt(event_processor)
0064   # Output
0065   output = dddigi.TestAction(kernel, 'output_01', 50)
0066   kernel.outputAction().adopt(output)
0067 
0068   dddigi.setPrintLevel(dddigi.OutputLevel.DEBUG)
0069   kernel.numThreads = 0   # = number of concurrent threads
0070   kernel.numEvents = 5
0071   kernel.maxEventsParallel = 3
0072   kernel.run()
0073   dddigi.setPrintLevel(dddigi.OutputLevel.INFO)
0074 
0075 
0076 if __name__ == '__main__':
0077   run()