Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-24 08:25:02

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2026 Chun Yuen Tsang, Minho Kim
0003 
0004 #pragma once
0005 
0006 #include <cstdint>
0007 #include <iostream>
0008 #include <string>
0009 #include <vector>
0010 
0011 namespace eicrecon {
0012 
0013 struct CalorimeterCALOROCRecoConfig {
0014   // readout fields
0015   std::string readout{""};
0016   std::string layerField{""};
0017   std::string sectorField{""};
0018 
0019   // name of detelment or fields to find the local detector (for global->local transform)
0020   // if nothing is provided, the lowest level DetElement (from cellID) will be used
0021   std::string localDetElement{""};
0022   std::vector<std::string> localDetFields{};
0023   std::string maskPos{""};
0024   std::vector<std::string> maskPosFields{};
0025 
0026   std::string edep_to_npe_filename{""};
0027   std::vector<std::string> edep_to_npe_fields{};
0028   enum class ProxyType { sum = 0, simpson = 1, templateFit = 2 } proxy_type = ProxyType::sum;
0029 
0030   bool timeWalkCor{false};
0031   bool useNpeHitPos{false};
0032 
0033   uint16_t highGainDR{0}; // high gain dynamic range
0034   double gainRatio{1};    // gain ratio of low gain to high gain, it should be < 1
0035 
0036   std::string attenuationReferencePositionNamePos{""};
0037   std::string attenuationReferencePositionNameNeg{""};
0038 
0039   // parameters for attenuation function
0040   // [0] * exp(-|z_ref - z| / [1]) + (1 - [0]) * exp(-|z_ref - z| / [2])
0041   // specified in edm4eic::units where dimensionfull
0042   std::vector<double> attenuationParameters{0};
0043 
0044   std::vector<double> timeWalkCorrectionParameters{0};
0045   std::vector<double> lightSpeedParameters{0};
0046 
0047   // calibration parameters
0048   double slope     = 1 / 9.41e-2;
0049   double intercept = 0;
0050 };
0051 
0052 std::istream& operator>>(std::istream& in, CalorimeterCALOROCRecoConfig::ProxyType& proxyType) {
0053   std::string s;
0054   in >> s;
0055   // stringifying the enums causes them to be converted to integers before conversion to strings
0056   if (s == "sum" or s == "0") {
0057     proxyType = CalorimeterCALOROCRecoConfig::ProxyType::sum;
0058   } else if (s == "simpson" or s == "1") {
0059     proxyType = CalorimeterCALOROCRecoConfig::ProxyType::simpson;
0060   } else if (s == "templateFit" or s == "2") {
0061     proxyType = CalorimeterCALOROCRecoConfig::ProxyType::templateFit;
0062   } else {
0063     in.setstate(std::ios::failbit); // Set the fail bit if the input is not valid
0064   }
0065 
0066   return in;
0067 }
0068 std::ostream& operator<<(std::ostream& out,
0069                          const CalorimeterCALOROCRecoConfig::ProxyType& proxyType) {
0070   switch (proxyType) {
0071   case CalorimeterCALOROCRecoConfig::ProxyType::sum:
0072     out << "sum";
0073     break;
0074   case CalorimeterCALOROCRecoConfig::ProxyType::simpson:
0075     out << "simpson";
0076     break;
0077   case CalorimeterCALOROCRecoConfig::ProxyType::templateFit:
0078     out << "templateFit";
0079     break;
0080   default:
0081     out.setstate(std::ios::failbit);
0082   }
0083   return out;
0084 }
0085 
0086 } // namespace eicrecon