![]() |
|
|||
File indexing completed on 2025-06-08 08:53:00
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 # NOTE: the `ClusterMergedHits` plugin needs to be compiled 0011 # beforehand. 0012 # ============================================================================= 0013 0014 0015 0016 # main body of script ========================================================= 0017 0018 END { 0019 0020 # i/o parameters 0021 in_ddsim = "output/forBHCalOnlyCheck_rerun.e1pim.file0.d18m5y2025.edm4hep.root" 0022 out_podio = "forHoleMystery.bhcalOnly_rerun_nMerge5_e1pim.d27m5y2025.podio.root" 0023 out_plugin = "forHoleMystery.bhcalOnly_rerun_nMerge5_e1pim.d27m5y2025.plugin.root" 0024 0025 # output collections from EICrecon 0026 out_collect = [ 0027 "HcalBarrelRecHits", 0028 "HcalBarrelMergedHits", 0029 "HcalBarrelClusters", 0030 "HcalBarrelMergedHitClusters", 0031 "HcalBarrelSplitMergeClusters", 0032 "GeneratedParticles" 0033 ].compact.reject(&:empty?).join(',') 0034 0035 # plugins to run in EICrecon 0036 plugins = [ 0037 "ClusterMergedHits" 0038 ].compact.reject(&:empty?).join(',') 0039 0040 # options 0041 options = [ 0042 ].compact.reject(&:empty?).join(' ') 0043 0044 # add relevant mapping/matrix 0045 nmerge = if ARGV.empty? then 5 else ARGV[0] end 0046 add_map_and_matrix_to_options(nmerge, options) 0047 0048 # run EICrecon 0049 exec("eicrecon -Pplugins=#{plugins} -Ppodio:output_collections=#{out_collect} #{options} -Ppodio:output_file=#{out_podio} #{in_ddsim}") 0050 0051 } # end main body of script 0052 0053 0054 0055 # ============================================================================= 0056 # Make phi mapping 0057 # ----------------------------------------------------------------------------- 0058 # @brief helper function to generate appropriate phi mapping for the 0059 # provided number of tiles to merge 0060 # 0061 # @param[in] nmerge number of tiles adjacent in phi to merge 0062 # ============================================================================= 0063 def make_phi_mapping(nmerge) 0064 0065 map = if nmerge.to_i > 1 0066 "\"phi:phi-(#{nmerge}*((phi/#{nmerge})-floor(phi/#{nmerge})))\"" 0067 else 0068 "phi:phi" 0069 end 0070 return map 0071 0072 end # end :make_phi_mapping 0073 0074 0075 0076 # ============================================================================= 0077 # Make adjacency matrix 0078 # ----------------------------------------------------------------------------- 0079 # @brief helper function to generate appropriate adjacency matrix for 0080 # the provided number of tiles to merge 0081 # 0082 # @param[in] nmerge number of tiles adjacent in phi to merge 0083 # ============================================================================= 0084 def make_adjacency_matrix(nmerge) 0085 0086 # inject number to merge into matrix: 0087 # (1) 1st condition: checks for vertically adjacent tiles 0088 # (2) 2nd condition: checks for horizontally adjacenct tiles 0089 # based on provided number to merge 0090 # (3) 3rd condition: checks for tiles adjacent at horizontal 0091 # wraparound based on provided number to merge 0092 # n.b. 320 is the number of tiles per row 0093 return <<-EOS.gsub(/^[\s\t]*/, '').gsub(/[\s\t]*\n/, ' ').strip 0094 "( 0095 ( (abs(eta_1 - eta_2) == 1) && (abs(phi_1 - phi_2) == 0) ) || 0096 ( (abs(eta_1 - eta_2) == 0) && (abs(phi_1 - phi_2) == #{nmerge}) ) || 0097 ( (abs(eta_1 - eta_2) == 0) && (abs(320 - abs(phi_1 - phi_2)) <= #{nmerge}) ) 0098 ) == 1" 0099 EOS 0100 0101 end # end :make_adjacency_matrix 0102 0103 0104 0105 # ============================================================================= 0106 # Generate map, matrix and add to options 0107 # ----------------------------------------------------------------------------- 0108 # @brief helper function to generate appropriate mapping and adjacency 0109 # matrix and add to the provided list of EICrecon options 0110 # 0111 # @param[in] nmerge number of tiles adjacent in phi to merge 0112 # @param[out] options list of options to append to 0113 # ============================================================================= 0114 def add_map_and_matrix_to_options(nmerge, options) 0115 0116 # generate approriate mapping, add to options 0117 mapping = make_phi_mapping(nmerge) 0118 matrix = make_adjacency_matrix(nmerge) 0119 options.concat(" -PBHCAL:HcalBarrelMergedHits:fieldTransformations=#{mapping}") 0120 .concat(" -PClusterMergedHits:HcalBarrelMergedHitIslandProtoClusters:adjacencyMatrix=#{matrix}") 0121 0122 end 0123 0124 # end =========================================================================
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |