Back to home page

EIC code displayed by LXR

 
 

    


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

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 from g4units import ns
0013 
0014 
0015 def run():
0016   import DigiTest
0017   digi = DigiTest.Test(geometry=None)
0018   keep_raw = False
0019   rdr_output = DigiTest.DEBUG
0020   erase_combined = True
0021 
0022   if digi.keep_raw:
0023     keep_raw = True
0024   if digi.output_level:
0025     rdr_output = int(digi.output_level)
0026   if digi.erase_combined:
0027     erase_combined = int(erase_combined)
0028 
0029   attenuation = digi.attenuation
0030   input_action = digi.input_action('DigiParallelActionSequence/READER')
0031   # ========================================================================================================
0032   input_action.adopt_action('DigiDDG4ROOT/SignalReader',
0033                             mask=0x0,
0034                             keep_raw=keep_raw,
0035                             input=[digi.next_input()],
0036                             OutputLevel=rdr_output)
0037   digi.info('Created input.signal')
0038   # ========================================================================================================
0039   digi.info('Creating spillover sequence for EARLIER bunch crossings.....')
0040   # ========================================================================================================
0041   spillover = input_action.adopt_action('DigiSequentialActionSequence/Spillover-25')
0042   evtreader = spillover.adopt_action('DigiDDG4ROOT/Reader-25ns',
0043                                      mask=0x1,
0044                                      keep_raw=keep_raw,
0045                                      input=[digi.next_input()],
0046                                      OutputLevel=rdr_output)
0047   attenuate = spillover.adopt_action('DigiAttenuatorSequence/Att-25ns',
0048                                      t0=-25 * ns,
0049                                      signal_decay='exponential',
0050                                      processor_type='DigiAttenuator',
0051                                      input_mask=evtreader.mask,
0052                                      input_segment='inputs',
0053                                      containers=attenuation)
0054   hist_drop = spillover.adopt_action('DigiHitHistoryDrop/Drop-25ns', masks=[evtreader.mask])
0055   digi.check_creation([spillover, evtreader, attenuate, hist_drop])
0056   digi.info('Created input.spillover-25')
0057   # ========================================================================================================
0058   spillover = input_action.adopt_action('DigiSequentialActionSequence/Spillover-50')
0059   evtreader = spillover.adopt_action('DigiDDG4ROOT/Reader-50ns',
0060                                      mask=0x2,
0061                                      keep_raw=keep_raw,
0062                                      input=[digi.next_input()],
0063                                      OutputLevel=rdr_output)
0064   attenuate = spillover.adopt_action('DigiAttenuatorSequence/Att-50ns',
0065                                      t0=-50 * ns,
0066                                      input_mask=evtreader.mask,
0067                                      containers=attenuation,
0068                                      OutputLevel=rdr_output)
0069   hist_drop = spillover.adopt_action('DigiHitHistoryDrop/Drop-50ns', masks=[evtreader.mask])
0070   digi.check_creation([spillover, evtreader, attenuate, hist_drop])
0071   digi.info('Created input.spillover-50')
0072   # ========================================================================================================
0073   spillover = input_action.adopt_action('DigiSequentialActionSequence/Spillover-75')
0074   evtreader = spillover.adopt_action('DigiDDG4ROOT/Reader-75ns',
0075                                      mask=0x3,
0076                                      keep_raw=keep_raw,
0077                                      input=[digi.next_input()],
0078                                      OutputLevel=rdr_output)
0079   attenuate = spillover.adopt_action('DigiAttenuatorSequence/Att-75ns',
0080                                      t0=-75 * ns,
0081                                      input_mask=evtreader.mask,
0082                                      containers=attenuation,
0083                                      OutputLevel=rdr_output)
0084   hist_drop = spillover.adopt_action('DigiHitHistoryDrop/Drop-75ns', masks=[evtreader.mask])
0085   digi.check_creation([spillover, evtreader, attenuate, hist_drop])
0086   digi.info('Created input.spillover-75')
0087   # ========================================================================================================
0088   digi.info('Creating spillover sequence for LATER bunch crossings.....')
0089   # ========================================================================================================
0090   spillover = input_action.adopt_action('DigiSequentialActionSequence/Spillover+25')
0091   evtreader = spillover.adopt_action('DigiDDG4ROOT/Reader+25ns',
0092                                      mask=0x4,
0093                                      keep_raw=keep_raw,
0094                                      input=[digi.next_input()],
0095                                      OutputLevel=rdr_output)
0096   attenuate = spillover.adopt_action('DigiAttenuatorSequence/Att+25ns',
0097                                      t0=25 * ns,
0098                                      input_mask=evtreader.mask,
0099                                      containers=attenuation,
0100                                      OutputLevel=rdr_output)
0101   hist_drop = spillover.adopt_action('DigiHitHistoryDrop/Drop+25ns', masks=[evtreader.mask])
0102   digi.check_creation([spillover, evtreader, attenuate, hist_drop])
0103   digi.info('Created input.spillover+25')
0104   # ========================================================================================================
0105   spillover = input_action.adopt_action('DigiSequentialActionSequence/Spillover+50')
0106   evtreader = spillover.adopt_action('DigiDDG4ROOT/Reader+50ns',
0107                                      mask=0x5,
0108                                      keep_raw=keep_raw,
0109                                      input=[digi.next_input()],
0110                                      OutputLevel=rdr_output)
0111   attenuate = spillover.adopt_action('DigiAttenuatorSequence/Att+50ns',
0112                                      t0=50 * ns,
0113                                      input_mask=evtreader.mask,
0114                                      containers=attenuation,
0115                                      OutputLevel=rdr_output)
0116   hist_drop = spillover.adopt_action('DigiHitHistoryDrop/Drop_50ns', masks=[evtreader.mask])
0117   digi.check_creation([spillover, evtreader, attenuate, hist_drop])
0118   digi.info('Created input.spillover+50')
0119   # ========================================================================================================
0120   spillover = input_action.adopt_action('DigiSequentialActionSequence/Spillover+75')
0121   evtreader = spillover.adopt_action('DigiDDG4ROOT/Reader+75ns',
0122                                      mask=0x6,
0123                                      keep_raw=keep_raw,
0124                                      input=[digi.next_input()],
0125                                      OutputLevel=rdr_output)
0126   attenuate = spillover.adopt_action('DigiAttenuatorSequence/Att+75ns',
0127                                      t0=75 * ns,
0128                                      input_mask=evtreader.mask,
0129                                      containers=attenuation,
0130                                      OutputLevel=rdr_output)
0131   hist_drop = spillover.adopt_action('DigiHitHistoryDrop/Drop+75ns', masks=[evtreader.mask])
0132   digi.check_creation([spillover, evtreader, attenuate, hist_drop])
0133   digi.info('Created input.spillover+75')
0134   # ========================================================================================================
0135   event = digi.event_action('DigiSequentialActionSequence/EventAction')
0136   combine = event.adopt_action('DigiContainerCombine/Combine',
0137                                input_masks=[0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6],
0138                                input_segment='inputs',
0139                                output_mask=0xFEED,
0140                                output_segment='deposits')
0141   combine.erase_combined = erase_combined
0142   evtdump = event.adopt_action('DigiStoreDump/StoreDump')
0143   digi.check_creation([combine, evtdump])
0144   digi.info('Created event.dump')
0145   # ========================================================================================================
0146   digi.run_checked(num_events=5, num_threads=5, parallel=3)
0147 
0148 
0149 if __name__ == '__main__':
0150   run()