Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-13 10:32:59

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 inline std::istream& operator>>(std::istream& in,
0053                                 CalorimeterCALOROCRecoConfig::ProxyType& proxyType) {
0054   std::string s;
0055   in >> s;
0056   // stringifying the enums causes them to be converted to integers before conversion to strings
0057   if (s == "sum" or s == "0") {
0058     proxyType = CalorimeterCALOROCRecoConfig::ProxyType::sum;
0059   } else if (s == "simpson" or s == "1") {
0060     proxyType = CalorimeterCALOROCRecoConfig::ProxyType::simpson;
0061   } else if (s == "templateFit" or s == "2") {
0062     proxyType = CalorimeterCALOROCRecoConfig::ProxyType::templateFit;
0063   } else {
0064     in.setstate(std::ios::failbit); // Set the fail bit if the input is not valid
0065   }
0066 
0067   return in;
0068 }
0069 inline std::ostream& operator<<(std::ostream& out,
0070                                 const CalorimeterCALOROCRecoConfig::ProxyType& proxyType) {
0071   switch (proxyType) {
0072   case CalorimeterCALOROCRecoConfig::ProxyType::sum:
0073     out << "sum";
0074     break;
0075   case CalorimeterCALOROCRecoConfig::ProxyType::simpson:
0076     out << "simpson";
0077     break;
0078   case CalorimeterCALOROCRecoConfig::ProxyType::templateFit:
0079     out << "templateFit";
0080     break;
0081   default:
0082     out.setstate(std::ios::failbit);
0083   }
0084   return out;
0085 }
0086 
0087 } // namespace eicrecon