CMS 3D CMS Logo

List of all members | Public Member Functions
hgcalUtils::DumpLegacySoA Class Reference

#include <DumpClustersDetails.h>

Public Member Functions

template<typename T >
void dumpInfos (const T &cells, const std::string &moduleType) const
 
 DumpLegacySoA ()=default
 

Detailed Description

Definition at line 150 of file DumpClustersDetails.h.

Constructor & Destructor Documentation

◆ DumpLegacySoA()

hgcalUtils::DumpLegacySoA::DumpLegacySoA ( )
default

Member Function Documentation

◆ dumpInfos()

template<typename T >
void hgcalUtils::DumpLegacySoA::dumpInfos ( const T cells,
const std::string &  moduleType 
) const
inline

Definition at line 155 of file DumpClustersDetails.h.

References hgcalTBTopologyTester_cfi::cells, corrVsCorr::filename, dqm-mbProfile::format, mps_fire::i, MainPageGenerator::l, das-up-to-nevents::outfile, and hcalRecHitTable_cff::time.

Referenced by HGCalCLUEAlgoT< TILE, STRATEGY >::makeClusters().

155  {
156  // Get the process ID
157  pid_t pid = getpid();
158 
159  // Create the filename using the PID
160  std::ostringstream filename;
161  // Seed the random number generator
162  srand(time(0));
163  // Generate a random number between 100 and 999
164  int random_number = 100 + rand() % 900;
165 
166  filename << "RECHITS_LEGACY_" << pid << "_" << moduleType << "_" << random_number << ".txt";
167  // Open the file
168  std::ofstream outfile(filename.str());
169  for (unsigned int l = 0; l < cells.size(); l++) {
170  for (unsigned int i = 0; i < cells.at(l).dim1.size(); ++i) {
171  outfile << fmt::format(
172  "Idx Cell: {}, x: {:.{}f}, y: {:.{}f}, layer: {}, weight: {:.{}f}, sigmaNoise: {:.{}f}, "
173  "delta: {:.{}f}, rho: {:.{}f}, nearestHigher: {}, clsIdx: {}, isSeed: {}, detid: {}",
174  i,
175  (cells.at(l).dim1.at(i)),
176  std::numeric_limits<float>::max_digits10,
177  (cells.at(l).dim2.at(i)),
178  std::numeric_limits<float>::max_digits10,
179  l,
180  (cells.at(l).weight.at(i)),
181  std::numeric_limits<float>::max_digits10,
182  (cells.at(l).sigmaNoise.at(i)),
183  std::numeric_limits<float>::max_digits10,
184  cells.at(l).delta.at(i),
185  std::numeric_limits<float>::max_digits10,
186  cells.at(l).rho.at(i),
187  std::numeric_limits<float>::max_digits10,
188  cells.at(l).nearestHigher.at(i),
189  cells.at(l).clusterIndex.at(i),
190  cells.at(l).isSeed.at(i),
191  cells.at(l).detid.at(i))
192  << std::endl;
193  }
194  }
195  outfile.close();
196  }