Skip to content

Commit

Permalink
DONOTMERGE: dump LHCB layouts with custom colors
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Feb 11, 2024
1 parent b719ac5 commit 943a3f5
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions examples/root/lhcb_analysis/lhcb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

namespace
{
constexpr auto analysisRepetitions = 20; // excluding 1 warmup run
constexpr auto analysisRepetitions = 1; // excluding 1 warmup run
constexpr auto analysisRepetitionsInstrumentation
= 0; // costly, so turned off by default, use 1 for FieldAccessCounts and Heatmap
constexpr auto estimateLoadedCachelines = false;
Expand Down Expand Up @@ -420,11 +420,51 @@ namespace
return total;
}

uint32_t blendRGB(uint32_t c1, uint32_t c2, uint8_t p){
float mR, mG, mB;
uint8_t newR, newG, newB;

mR = (float)(((uint8_t)(c2 >> 16)) - ((uint8_t)(c1 >> 16))) / 255;
mG = (float)(((uint8_t)(c2 >> 8)) - ((uint8_t)(c1 >> 8))) / 255;
mB = (float)(((uint8_t)(c2)) - ((uint8_t)(c1))) / 255;

newR = (mR * p) + (uint8_t)(c1 >> 16);
newG = (mG * p) + (uint8_t)(c1 >> 8);
newB = (mB * p) + (uint8_t)(c1);

return ((uint32_t)newR << 16) | ((uint32_t)newG << 8) | newB;
}

template<typename Mapping>
void saveLayout(const std::filesystem::path& layoutFile)
{
std::filesystem::create_directories(layoutsFolder);
std::ofstream{layoutsFolder / layoutFile} << llama::toSvg(Mapping{typename Mapping::ArrayExtents{3}}, 32);

const std::vector<std::uint32_t> tudPalette = {
0x00305d, // TUD corporate design colors, except orange
0x006ab2,
0x009de0,
0x717778,
0x93107d,
0x54368a,
0x69af22,
0x007d3f,
// 0xee7f00,
0xBACC2F, // Dresden concept last color
blendRGB(0x00305d, 0xFFFFFF, 64), // repeat with 50%
blendRGB(0x006ab2, 0xFFFFFF, 64),
blendRGB(0x009de0, 0xFFFFFF, 64),
blendRGB(0x717778, 0xFFFFFF, 64),
blendRGB(0x93107d, 0xFFFFFF, 64),
blendRGB(0x54368a, 0xFFFFFF, 64),
blendRGB(0x69af22, 0xFFFFFF, 64),
blendRGB(0x007d3f, 0xFFFFFF, 64),
blendRGB(0xBACC2F, 0xFFFFFF, 64)
// 0xee7f0080
};

std::ofstream{layoutsFolder / layoutFile}
<< llama::toSvg(Mapping{typename Mapping::ArrayExtents{3}}, 32, true, tudPalette, "white");
}

template<typename View>
Expand Down Expand Up @@ -498,6 +538,7 @@ namespace
if(repetitions == 0)
return;
saveLayout<Mapping>(mappingName + ".svg");
return;

auto [view, conversionSeconds] = convertRNTupleToLLAMA<Mapping>(inputFile, treeName);
if constexpr(llama::mapping::isFieldAccessCount<Mapping>)
Expand Down

0 comments on commit 943a3f5

Please sign in to comment.