Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-24 08:23:41

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 
0012 
0013 def yes_no(val):
0014   if val:
0015     return "YES"
0016   return "NO "
0017 
0018 
0019 def run():
0020   import DigiTest
0021   digi = DigiTest.Test(geometry=None, process_data=False)
0022   info = digi.info
0023   num_tests = 0
0024   histo = digi.create_action('DigiDepositEnergyMonitor/TestHisto')
0025   histo.histo1D_deposits = ("Energy", u"Some main deposit Title", 101, -0.5, 100.5)
0026   num_tests = num_tests + 1
0027   histo.histo1D_delta = ("Delta", u"Some delta Title", 50, -5, 5)
0028   num_tests = num_tests + 1
0029   histo.printProperties()
0030   info('property: histo1D_deposits =       %s [%s]' %
0031        (str(histo.histo1D_deposits), str(histo.histo1D_deposits.__class__),))
0032   num_tests = num_tests + 1
0033 
0034   action = digi.input_action('DigiParallelActionSequence/Test')
0035 
0036   action.add_property('property_int', 1)
0037   info('property: has_property =           %s  [%s]' %
0038        (yes_no(action.hasProperty('property_int')), str(action.property_int.__class__),))
0039   info('property: property_int =           %s' % (str(action.property_int),))
0040   action.property_int = 123456
0041   info('property: property_int =           %s' % (str(action.property_int),))
0042   if action.hasProperty('property_int'):
0043     num_tests = num_tests + 1
0044 
0045   action.add_vector_property('property_vector_int', [1, 2, 3])
0046   info('property: has_property =           %s [%s]' %
0047        (yes_no(action.hasProperty('property_vector_int')), str(action.property_vector_int.__class__), ))
0048   info('property: property_vector_int =    %s' % (str(action.property_vector_int),))
0049   action.property_vector_int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
0050   info('property: property_vector_int =    %s' % (str(action.property_vector_int),))
0051   if action.hasProperty('property_vector_int'):
0052     num_tests = num_tests + 1
0053 
0054   action.add_list_property('property_list_int', [1, 2, 3])
0055   info('property: has_property =           %s [%s]' %
0056        (yes_no(action.hasProperty('property_list_int')), str(action.property_list_int.__class__),))
0057   info('property: property_list_int =      %s' % (str(action.property_list_int),))
0058   action.property_list_int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
0059   info('property: property_list_int =      %s' % (str(action.property_list_int),))
0060   if action.hasProperty('property_list_int'):
0061     num_tests = num_tests + 1
0062 
0063   action.add_set_property('property_set_int', [1, 2, 3])
0064   info('property: has_property =           %s [%s]' %
0065        (yes_no(action.hasProperty('property_set_int')), str(action.property_set_int.__class__),))
0066   info('property: property_set_int =       %s' % (str(action.property_set_int),))
0067   action.property_set_int = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
0068   info('property: property_set_int =       %s' % (str(action.property_set_int),))
0069   if action.hasProperty('property_set_int'):
0070     num_tests = num_tests + 1
0071 
0072   action.add_property('property_double', 1.0)
0073   info('property: has_property =           %s [%s]' %
0074        (yes_no(action.hasProperty('property_double')), str(action.property_double.__class__),))
0075   info('property: property_double =        %s' % (str(action.property_double),))
0076   action.property_double = 123456.7
0077   info('property: property_double =        %s' % (str(action.property_double),))
0078   if action.hasProperty('property_double'):
0079     num_tests = num_tests + 1
0080 
0081   action.add_vector_property('property_vector_double', [1.1, 2, 3])
0082   info('property: has_property =           %s [%s]' %
0083        (yes_no(action.hasProperty('property_vector_double')), str(action.property_vector_double.__class__),))
0084   info('property: property_vector_double = %s' % (str(action.property_vector_double),))
0085   action.property_vector_double = [1.5, 2, 3, 4, 5, 6, 7, 8, 9, 0]
0086   info('property: property_vector_double = %s' % (str(action.property_vector_double),))
0087   if action.hasProperty('property_vector_double'):
0088     num_tests = num_tests + 1
0089 
0090   action.add_list_property('property_list_double', [1.1, 2, 3])
0091   info('property: has_property =           %s [%s]' %
0092        (yes_no(action.hasProperty('property_list_double')), str(action.property_list_double.__class__), ))
0093   info('property: property_list_double =   %s' % (str(action.property_list_double),))
0094   action.property_list_double = [1.5, 2, 3, 4, 5, 6, 7, 8, 9, 0]
0095   info('property: property_list_double =   %s' % (str(action.property_list_double),))
0096   if action.hasProperty('property_list_double'):
0097     num_tests = num_tests + 1
0098 
0099   action.add_set_property('property_set_double', [1.1, 2, 3])
0100   info('property: has_property =           %s [%s]' %
0101        (yes_no(action.hasProperty('property_set_double')), str(action.property_set_double.__class__),))
0102   info('property: property_set_double =    %s' % (str(action.property_set_double),))
0103   action.property_set_double = [1.5, 2, 3, 4, 5, 6, 7, 8, 9, 0]
0104   info('property: property_set_double =    %s' % (str(action.property_set_double),))
0105   if action.hasProperty('property_set_double'):
0106     num_tests = num_tests + 1
0107 
0108   action.add_property('property_string', "string_1")
0109   info('property: has_property =           %s [%s]' %
0110        (yes_no(action.hasProperty('property_string')), str(action.property_string.__class__),))
0111   info('property: property_string =        %s' % (action.property_string,))
0112   action.property_string = "string_1123456"
0113   info('property: property_string =        %s' % (action.property_string,))
0114   if action.hasProperty('property_string'):
0115     num_tests = num_tests + 1
0116 
0117   action.add_vector_property('property_vector_string', ["string1", "string2", "string3"])
0118   info('property: has_property =           %s [%s]' %
0119        (yes_no(action.hasProperty('property_vector_string')), str(action.property_vector_string.__class__),))
0120   info('property: property_vector_string = %s' % (action.property_vector_string,))
0121   action.property_vector_string = ["string1", "string2", "string3", "string4", "string5", "string6"]
0122   info('property: property_vector_string = %s' % (action.property_vector_string,))
0123   if action.hasProperty('property_vector_string'):
0124     num_tests = num_tests + 1
0125 
0126   action.add_position_property('property_position', (1., 2., 3.))
0127   info('property: has_property =           %s [%s]' %
0128        (yes_no(action.hasProperty('property_position')), str(action.property_position.__class__),))
0129   info('property: property_position =      %s' % (action.property_position,))
0130   action.property_position = (111.1, 222.2, 333.3)
0131   info('property: property_position =      %s' % (action.property_position,))
0132   if action.hasProperty('property_position'):
0133     num_tests = num_tests + 1
0134 
0135   info('We checked %d properties interactions.' % (num_tests,))
0136   if num_tests == 14:
0137     info('Property test PASSED')
0138 
0139 
0140 if __name__ == '__main__':
0141   run()