Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:27:58

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Souvik Paul
0003 
0004 #pragma once
0005 
0006 namespace eicrecon {
0007 
0008 struct SiliconChargeSharingConfig {
0009   // Parameters of Silicon signal generation
0010   // determines the meaning of sigma_sharingx and y.
0011   // rel means relative, so charge sharing range = sigma_sharingx * cell_width_x, etc for y
0012   // abs means absolute, charge sharing range = sigma_shargeingx directly
0013   enum class ESigmaMode { abs = 0, rel = 1 } sigma_mode = ESigmaMode::abs;
0014   float sigma_sharingx;
0015   float sigma_sharingy;
0016   float min_edep;
0017   std::string readout;
0018 };
0019 
0020 std::istream& operator>>(std::istream& in, SiliconChargeSharingConfig::ESigmaMode& sigmaMode) {
0021   std::string s;
0022   in >> s;
0023   // stringifying the enums causes them to be converted to integers before conversion to strings
0024   if (s == "abs" or s == "0") {
0025     sigmaMode = SiliconChargeSharingConfig::ESigmaMode::abs;
0026   } else if (s == "rel" or s == "1") {
0027     sigmaMode = SiliconChargeSharingConfig::ESigmaMode::rel;
0028   } else {
0029     in.setstate(std::ios::failbit); // Set the fail bit if the input is not valid
0030   }
0031 
0032   return in;
0033 }
0034 std::ostream& operator<<(std::ostream& out,
0035                          const SiliconChargeSharingConfig::ESigmaMode& sigmaMode) {
0036   switch (sigmaMode) {
0037   case SiliconChargeSharingConfig::ESigmaMode::abs:
0038     out << "abs";
0039     break;
0040   case SiliconChargeSharingConfig::ESigmaMode::rel:
0041     out << "rel";
0042     break;
0043   default:
0044     out.setstate(std::ios::failbit);
0045   }
0046   return out;
0047 }
0048 
0049 } // namespace eicrecon