Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-29 07:05:55

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022 Chao Peng, Sylvester Joosten, Whitney Armstrong
0003 
0004 #pragma once
0005 
0006 #include <string>
0007 #include <iostream>
0008 
0009 namespace eicrecon {
0010 
0011   struct ImagingTopoClusterConfig {
0012 
0013     // maximum difference in layer numbers that can be considered as neighbours
0014     int neighbourLayersRange = 1;
0015     // maximum distance of local (x, y) to be considered as neighbors at the same layer
0016     std::vector<double> localDistXY = {1.0 * dd4hep::mm, 1.0 * dd4hep::mm};
0017     // maximum distance of global (eta, phi) to be considered as neighbors at different layers (if layerMode==etaphi)
0018     std::vector<double> layerDistEtaPhi = {0.01, 0.01};
0019     // maximum distance of global (x, y) to be considered as neighbors at different layers (if layerMode==xy)
0020     std::vector<double> layerDistXY = {1.0 * dd4hep::mm, 1.0 * dd4hep::mm};
0021     // determines how neighbors are determined for hits in different layers (using either eta and phi, or x and y)
0022     enum ELayerMode {etaphi=0, xy=1} layerMode = etaphi;
0023 
0024     // maximum global distance to be considered as neighbors in different sectors
0025     double sectorDist = 1.0 * dd4hep::cm;
0026 
0027     // minimum hit energy to participate clustering
0028     double minClusterHitEdep = 0.;
0029     // minimum cluster center energy (to be considered as a seed for cluster)
0030     double minClusterCenterEdep = 0.;
0031     // minimum cluster energy (to save this cluster)
0032     double minClusterEdep = 0.5 * dd4hep::MeV;
0033     // minimum number of hits (to save this cluster)
0034     int minClusterNhits = 10;
0035 
0036   };
0037 
0038   std::istream& operator>>(std::istream& in, ImagingTopoClusterConfig::ELayerMode& layerMode) {
0039     std::string s;
0040     in >> s;
0041     // stringifying the enums causes them to be converted to integers before conversion to strings
0042     if (s == "etaphi" or s=="0") {
0043         layerMode = ImagingTopoClusterConfig::ELayerMode::etaphi;
0044     } else if (s == "xy" or s=="1") {
0045         layerMode = ImagingTopoClusterConfig::ELayerMode::xy;
0046     } else {
0047         in.setstate(std::ios::failbit);  // Set the fail bit if the input is not valid
0048     }
0049 
0050     return in;
0051   }
0052   std::ostream& operator<<(std::ostream& out, ImagingTopoClusterConfig::ELayerMode& layerMode) {
0053     switch(layerMode) {
0054     case ImagingTopoClusterConfig::ELayerMode::etaphi:
0055       out << "etaphi";
0056       break;
0057     case ImagingTopoClusterConfig::ELayerMode::xy:
0058       out << "xy";
0059       break;
0060     default:
0061       out.setstate(std::ios::failbit);
0062     }
0063     return out;
0064   }
0065 } // namespace eicrecon