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