File indexing completed on 2025-08-05 08:14:59
0001 #ifndef CHECK_EPD_MAP_H
0002 #define CHECK_EPD_MAP_H
0003
0004 #include <fun4all/SubsysReco.h>
0005 #include <string>
0006 #include <vector>
0007 #include <iostream>
0008 #include <tuple>
0009
0010 class PHCompositeNode;
0011 class EpdGeom;
0012 class TowerInfoContainer;
0013 class TProfile2D;
0014 class TH1I;
0015 class TH2I;
0016 class TH2F;
0017 class TH1F;
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 class CheckEpdMap : public SubsysReco
0030 {
0031 public:
0032 explicit CheckEpdMap(const std::string& name = "CheckEpdMap");
0033 ~CheckEpdMap() override = default;
0034
0035
0036 int InitRun(PHCompositeNode* topNode) override;
0037
0038
0039 int process_event(PHCompositeNode* topNode) override;
0040 int End(PHCompositeNode*) override;
0041 void PrintReverseTable(std::ostream &os = std::cout) const;
0042
0043 void setSimulationMode(bool b) { m_simulationMode = b; }
0044 void SetOutputFile(const std::string &fname) { outputFile = fname; }
0045
0046
0047 private:
0048
0049 TProfile2D* m_profOld [2]{};
0050 TProfile2D* m_profNew [2]{};
0051 std::uint64_t m_eventCounter{0};
0052
0053 TH1I* m_diffCount = nullptr;
0054 TH2F* m_diffADC = nullptr;
0055 TH1F* m_hitCenterDist = nullptr;
0056
0057
0058 TH2F* m_simMatchPolarS01 = nullptr;
0059 TH2F* m_simMatchPolarN01 = nullptr;
0060
0061 TH2F* m_simMatchPolarS = nullptr;
0062 TH2F* m_simMatchPolarN = nullptr;
0063
0064
0065
0066 std::vector<unsigned> m_keyVec;
0067
0068 static constexpr int NRING = 16;
0069 static constexpr int NPHI = 24;
0070 mutable int m_reverse[2][NRING][NPHI]{};
0071
0072 static constexpr int NSEC = 12;
0073 static constexpr int NTILE = 31;
0074
0075 std::tuple<uint32_t,uint32_t,uint32_t> m_tile_bin[2][NSEC][NTILE];
0076 std::tuple<uint32_t,uint32_t,uint32_t> m_module_coords[2][NRING][NPHI];
0077
0078
0079 TH2F* m_tileHist[2][NRING][NPHI] = {};
0080 TowerInfoContainer *towers;
0081 EpdGeom *geom = nullptr;
0082 bool m_simulationMode = false;
0083 std::string outputFile;
0084
0085
0086 std::pair<
0087 std::vector<unsigned>,
0088 std::vector<int>
0089 > build_key_vector() const;
0090
0091 void check_map(const std::vector<unsigned>& vkey,
0092 const std::vector<int> mapped_vals) const;
0093
0094 int processEventDataMode(PHCompositeNode *topNode);
0095
0096 int processEventSimulationMode(PHCompositeNode *topNode);
0097
0098 void BuildSimMap();
0099 void InitializeSimMatchMap();
0100
0101 int Getphimap(int phiindex);
0102
0103 int Getrmap(int rindex);
0104
0105
0106
0107 };
0108
0109 #endif