17 int pid,
int etaMid,
const std::string& FastCaloGANInputFolderName) {
20 std::string xmlFullFileName = FastCaloGANInputFolderName +
"/binning.xml";
23 xmlDocPtr
doc = xmlParseFile(xmlFullFileName.c_str());
29 for (xmlNodePtr nodeRoot =
doc->children; nodeRoot !=
nullptr;
30 nodeRoot = nodeRoot->next) {
31 if (xmlStrEqual(nodeRoot->name, BAD_CAST
"Bins")) {
32 for (xmlNodePtr nodeParticle = nodeRoot->children;
33 nodeParticle !=
nullptr; nodeParticle = nodeParticle->next) {
34 if (xmlStrEqual(nodeParticle->name, BAD_CAST
"Particle")) {
35 int nodePid = std::stoi(
reinterpret_cast<const char*
>(
36 xmlGetProp(nodeParticle, BAD_CAST
"pid")));
39 for (xmlNodePtr nodeBin = nodeParticle->children;
40 nodeBin !=
nullptr; nodeBin = nodeBin->next) {
41 if (xmlStrEqual(nodeBin->name, BAD_CAST
"Bin")) {
42 int nodeEtaMin = std::stoi(
reinterpret_cast<const char*
>(
43 xmlGetProp(nodeBin, BAD_CAST
"etaMin")));
44 int nodeEtaMax = std::stoi(
reinterpret_cast<const char*
>(
45 xmlGetProp(nodeBin, BAD_CAST
"etaMax")));
46 int regionId = std::stoi(
reinterpret_cast<const char*
>(
47 xmlGetProp(nodeBin, BAD_CAST
"regionId")));
49 if (std::abs(etaMid) > nodeEtaMin &&
50 std::abs(etaMid) < nodeEtaMax) {
55 xmlGetProp(nodeBin, BAD_CAST
"ganVersion")));
56 m_latentDim = std::stod(
reinterpret_cast<const char*
>(
57 xmlGetProp(nodeParticle, BAD_CAST
"latentDim")));
59 for (xmlNodePtr nodeLayer = nodeBin->children;
60 nodeLayer !=
nullptr; nodeLayer = nodeLayer->next) {
61 if (xmlStrEqual(nodeLayer->name, BAD_CAST
"Layer")) {
62 std::vector<double> edges;
63 std::string
s(
reinterpret_cast<const char*
>(
64 xmlGetProp(nodeLayer, BAD_CAST
"r_edges")));
66 std::istringstream
ss(
s);
69 while (std::getline(
ss, token,
',')) {
70 edges.push_back(std::stod(token));
73 int binsInAlpha = std::stoi(
reinterpret_cast<const char*
>(
74 xmlGetProp(nodeLayer, BAD_CAST
"n_bin_alpha")));
75 int layer = std::stoi(
reinterpret_cast<const char*
>(
76 xmlGetProp(nodeLayer, BAD_CAST
"id")));
81 int xBins =
static_cast<int>(edges.size()) - 1;
85 "No bins defined in r for layer "
87 <<
", setting to 1 bin to avoid empty histogram");
93 double minAlpha = -
M_PI;
101 binsInAlpha, minAlpha,
M_PI));
119 std::string attribute =
120 reinterpret_cast<const char*
>(xmlGetProp(
node, BAD_CAST
name.c_str()));
121 return attribute ==
"true";
136 int layer = element.first;
137 const TH2D*
h = &element.second;
143 <<
layer <<
" is broken. Skipping.");
147 int xBinNum =
h->GetNbinsX();
148 const TAxis*
x =
h->GetXaxis();
157 for (
int ix = 1; ix <= xBinNum; ++ix) {