1 #ifndef RecoLocalCalo_HGCalRecProducers_DumpClustersDetails_h 2 #define RecoLocalCalo_HGCalRecProducers_DumpClustersDetails_h 13 #include <fmt/format.h> 18 static bool sortByDetId(
const std::pair<int, float>& pair1,
const std::pair<int, float>& pair2) {
19 return pair1.first < pair2.first;
32 bool dumpCellsDetId =
false)
const {
44 "Seed: {}, Idx: {}, energy: {:.{}f}, x: {:.{}f}, y: {:.{}f}, z: {:.{}f}, eta: {:.{}f}, phi: {:.{}f}",
48 std::numeric_limits<float>::max_digits10,
50 std::numeric_limits<float>::max_digits10,
52 std::numeric_limits<float>::max_digits10,
54 std::numeric_limits<float>::max_digits10,
56 std::numeric_limits<float>::max_digits10,
58 std::numeric_limits<float>::max_digits10);
60 auto sorted =
i.hitsAndFractions();
61 std::stable_sort(std::begin(sorted), std::end(sorted),
sortByDetId);
62 for (
auto const&
c : sorted) {
63 outfile <<
fmt::format(
" ({}, {:.{}f})",
c.first,
c.second, std::numeric_limits<float>::max_digits10);
93 for (
int i = 0;
i < clustersSoA->metadata().size(); ++
i) {
94 auto clusterSoAV = clustersSoA.view()[
i];
95 outfile <<
fmt::format(
"Idx: {}, delta: {:.{}f}, rho: {:.{}f}, nearest: {}, clsIdx: {}, isSeed: {}",
98 std::numeric_limits<float>::max_digits10,
100 std::numeric_limits<float>::max_digits10,
101 clusterSoAV.nearestHigher(),
102 clusterSoAV.clusterIndex(),
103 clusterSoAV.isSeed())
114 template <
typename T>
121 pid_t pid = getpid();
128 for (
int i = 0;
i <
cells->metadata().size(); ++
i) {
129 auto cellSoAV =
cells.view()[
i];
132 "Idx Cell: {}, x: {:.{}f}, y: {:.{}f}, layer: {}, weight: {:.{}f}, sigmaNoise: {:.{}f}, detid: {}",
135 std::numeric_limits<float>::max_digits10,
137 std::numeric_limits<float>::max_digits10,
140 std::numeric_limits<float>::max_digits10,
141 (cellSoAV.sigmaNoise()),
142 std::numeric_limits<float>::max_digits10,
154 template <
typename T>
157 pid_t pid = getpid();
164 int random_number = 100 + rand() % 900;
166 filename <<
"RECHITS_LEGACY_" << pid <<
"_" << moduleType <<
"_" << random_number <<
".txt";
169 for (
unsigned int l = 0;
l <
cells.size();
l++) {
170 for (
unsigned int i = 0;
i <
cells.at(
l).dim1.size(); ++
i) {
172 "Idx Cell: {}, x: {:.{}f}, y: {:.{}f}, layer: {}, weight: {:.{}f}, sigmaNoise: {:.{}f}, " 173 "delta: {:.{}f}, rho: {:.{}f}, nearestHigher: {}, clsIdx: {}, isSeed: {}, detid: {}",
176 std::numeric_limits<float>::max_digits10,
178 std::numeric_limits<float>::max_digits10,
181 std::numeric_limits<float>::max_digits10,
182 (
cells.at(
l).sigmaNoise.at(
i)),
183 std::numeric_limits<float>::max_digits10,
185 std::numeric_limits<float>::max_digits10,
187 std::numeric_limits<float>::max_digits10,
188 cells.at(
l).nearestHigher.at(
i),
189 cells.at(
l).clusterIndex.at(
i),
unsigned long long EventNumber_t
void dumpInfos(const T &clusters, const std::string &moduleLabel, edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event, bool dumpCellsDetId=false) const
unsigned int LuminosityBlockNumber_t
static bool sortByDetId(const std::pair< int, float > &pair1, const std::pair< int, float > &pair2)
void dumpInfos(const T &cells, const std::string &moduleType) const
void dumpInfos(const T &cells, const std::string &moduleLabel, edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event) const