ATLAS Offline Software
Loading...
Searching...
No Matches
InDetGNNHardScatterSelection::dataprep Namespace Reference

Typedefs

typedef std::vector< std::pair< std::regex, std::string > > StringRegexes

Functions

std::tuple< std::vector< HSGNNInputConfig >, std::vector< ConstituentsInputConfig > > createGetterConfig (FlavorTagInference::SaltModelGraphConfig::GraphConfig &graph_config)
std::vector< internal::VarFromVertexcreateVertexVarGetters (const std::vector< HSGNNInputConfig > &inputs)

Typedef Documentation

◆ StringRegexes

Function Documentation

◆ createGetterConfig()

std::tuple< std::vector< HSGNNInputConfig >, std::vector< ConstituentsInputConfig > > InDetGNNHardScatterSelection::dataprep::createGetterConfig ( FlavorTagInference::SaltModelGraphConfig::GraphConfig & graph_config)

Definition at line 118 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/DataPrepUtilities.cxx.

119 {
120
121 // build the standard inputs
122
123 // type and default value-finding regexes are hardcoded for now
124 TypeRegexes type_regexes = {
125 {".*_isDefaults"_r, EDMType::CHAR},
126 {"sumPt2|chi2Over_ndf|z_asymmetry|weighted_z_asymmetry|z_kurtosis|z_skewness|photon_deltaz|photon_deltaPhi|actualIntPerXing"_r, EDMType::FLOAT},
127 {"ntrk"_r, EDMType::INT},
128 {"(log_)?pt|abs_eta|eta|phi|energy|mass|sumPt"_r, EDMType::CUSTOM_GETTER},
129 };
130
131 StringRegexes default_flag_regexes{
132 {"ntrk|sumPt2|chi2Over_ndf|z_asymmetry|weighted_z_asymmetry|z_kurtosis|z_skewness|photon_deltaz|photon_deltaPhi|actualIntPerXing"_r, ""},
133 {"((log_)?pt|abs_eta|eta|phi|energy|mass|sumPt)"_r, ""}}; // no default for custom cases
134
135 std::vector<HSGNNInputConfig> input_config;
136 for (auto& node: config.inputs){
137 std::vector<std::string> input_names;
138 input_names.reserve(node.variables.size());
139for (const auto& var: node.variables) {
140 input_names.push_back(var.name);
141 }
142 input_config = get_input_config(input_names, type_regexes, default_flag_regexes);
143 }
144
145 // build the constituents inputs
146 std::vector<std::pair<std::string, std::vector<std::string>>> constituent_names;
147 for (auto& node: config.input_sequences) {
148
149 std::vector<std::string> names;
150 names.reserve(node.variables.size());
151for (const auto& var: node.variables) {
152 names.push_back(var.name);
153 }
154 constituent_names.emplace_back(node.name, names);
155 }
156
157 std::vector<ConstituentsInputConfig> constituent_configs;
158 constituent_configs.reserve(constituent_names.size());
159for (const auto& el: constituent_names){
160 constituent_configs.push_back(
161 createConstituentsLoaderConfig(el.first, el.second));
162 }
163
164 return std::make_tuple(input_config, constituent_configs);
165 }
ConstituentsInputConfig createConstituentsLoaderConfig(const std::string &name, const std::vector< std::string > &input_variables)

◆ createVertexVarGetters()

std::vector< internal::VarFromVertex > InDetGNNHardScatterSelection::dataprep::createVertexVarGetters ( const std::vector< HSGNNInputConfig > & inputs)

Definition at line 171 of file InnerDetector/InDetRecTools/InDetGNNHardScatterSelection/Root/DataPrepUtilities.cxx.

173 {
174 std::vector<internal::VarFromVertex> varsFromVertex;
175
176 for (const auto& input: inputs) {
177 if (input.type != EDMType::CUSTOM_GETTER) {
178 auto filler = internal::get::varFromVertex(input.name, input.type,
179 input.default_flag);
180 varsFromVertex.push_back(filler);
181 } else {
182 varsFromVertex.push_back(getter_utils::customGetterAndName(input.name));
183 }
184 }
185
186 return varsFromVertex;
187 }
std::function< std::pair< std::string, double >(const xAOD::Vertex &)> customGetterAndName(const std::string &)
VarFromVertex varFromVertex(const std::string &name, EDMType, const std::string &defaultflag)