|
||||
File indexing completed on 2025-01-30 10:30:55
0001 #!/usr/bin/env ruby 0002 # ============================================================================= 0003 # @file RunEICReconWithTileMerging.rb 0004 # @author Derek Anderson 0005 # @date 12.19.2024 0006 # 0007 # This script generates the appropriate BHCal phi mapping and adjacency 0008 # matrix based on the provided number of tiles to merge into towers. 0009 # ============================================================================= 0010 0011 0012 0013 # main body of script ========================================================= 0014 0015 END { 0016 0017 # i/o parameters 0018 in_ddsim = "../input/forBHCalOnlyCheck.e10pim.file0.d30m10y2024.edm4hep.root" 0019 out_podio = "forTileMerger.afterReview_change0_removeMatrixMakers.d19m12y2024.podio.root" 0020 out_plugin = "forTileMerger.afterReview_change0_removeMatrixMakers.d19m12y2024.plugin.root" 0021 0022 # output collections from EICrecon 0023 out_collect = [ 0024 "HcalBarrelRecHits", 0025 "HcalBarrelMergedHits", 0026 "HcalBarrelClusters", 0027 "HcalBarrelSplitMergeClusters" 0028 ].compact.reject(&:empty?).join(',') 0029 0030 # plugins to run in EICrecon 0031 plugins = [ 0032 "dump_flags" 0033 ].compact.reject(&:empty?).join(',') 0034 0035 # options 0036 options = [ 0037 # "-Pjana:nevents=100", 0038 "-Peicrecon:LogLevel=trace" 0039 ].compact.reject(&:empty?).join(' ') 0040 0041 # add relevant mapping/matrix 0042 nmerge = if ARGV.empty? then 1 else ARGV[0] end 0043 add_map_and_matrix_to_options(nmerge, options) 0044 0045 # run EICrecon 0046 exec("eicrecon -Pplugins=#{plugins} -Ppodio:output_collections=#{out_collect} #{options} -Ppodio:output_file=#{out_podio} #{in_ddsim}") 0047 0048 } # end main body of script 0049 0050 0051 0052 # ============================================================================= 0053 # Make phi mapping 0054 # ----------------------------------------------------------------------------- 0055 # @brief helper function to generate appropriate phi mapping for the 0056 # provided number of tiles to merge 0057 # 0058 # @param[in] nmerge number of tiles adjacent in phi to merge 0059 # ============================================================================= 0060 def make_phi_mapping(nmerge) 0061 0062 map = if nmerge.to_i > 1 0063 "\"phi-(#{nmerge}*((phi/#{nmerge})-floor(phi/#{nmerge})))\"" 0064 else 0065 "phi" 0066 end 0067 return map 0068 0069 end # end :make_phi_mapping 0070 0071 0072 0073 # ============================================================================= 0074 # Make adjacency matrix 0075 # ----------------------------------------------------------------------------- 0076 # @brief helper function to generate appropriate adjacency matrix for 0077 # the provided number of tiles to merge 0078 # 0079 # @param[in] nmerge number of tiles adjacent in phi to merge 0080 # ============================================================================= 0081 def make_adjacency_matrix(nmerge) 0082 0083 # inject number to merge into matrix: 0084 # (1) 1st condition: checks for vertically adjacent tiles 0085 # (2) 2nd condition: checks for horizontally adjacenct tiles 0086 # based on provided number to merge 0087 # (3) 3rd condition: checks for tiles adjacent at horizontal 0088 # wraparound based on provided number to merge 0089 # n.b. 320 is the number of tiles per row 0090 return <<-EOS.gsub(/^[\s\t]*/, '').gsub(/[\s\t]*\n/, ' ').strip 0091 "( 0092 ( (abs(eta_1 - eta_2) == 1) && (abs(phi_1 - phi_2) == 0) ) || 0093 ( (abs(eta_1 - eta_2) == 0) && (abs(phi_1 - phi_2) == #{nmerge}) ) || 0094 ( (abs(eta_1 - eta_2) == 0) && (abs(320 - abs(phi_1 - phi_2)) <= #{nmerge}) ) 0095 ) == 1" 0096 EOS 0097 0098 end # end :make_adjacency_matrix 0099 0100 0101 0102 # ============================================================================= 0103 # Generate map, matrix and add to options 0104 # ----------------------------------------------------------------------------- 0105 # @brief helper function to generate appropriate mapping and adjacency 0106 # matrix and add to the provided list of EICrecon options 0107 # 0108 # @param[in] nmerge number of tiles adjacent in phi to merge 0109 # @param[out] options list of options to append to 0110 # ============================================================================= 0111 def add_map_and_matrix_to_options(nmerge, options) 0112 0113 # generate approriate mapping, add to options 0114 mapping = make_phi_mapping(nmerge) 0115 matrix = make_adjacency_matrix(nmerge) 0116 options.concat(" -PBHCAL:HcalBarrelMergedHits:mappings=#{mapping}") 0117 .concat(" -PBHCAL:HcalBarrelIslandProtoClusters:adjacencyMatrix=#{matrix}") 0118 0119 end 0120 0121 # end =========================================================================
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |