File indexing completed on 2024-09-07 04:36:18
0001 #ifndef CTPPSToFDetector_h
0002 #define CTPPSToFDetector_h
0003 #include <vector>
0004 #include <map>
0005 #include <iterator>
0006 #include <iostream>
0007
0008 class CTPPSToFDetector {
0009 public:
0010 CTPPSToFDetector(int ncellx,
0011 int ncelly,
0012 std::vector<double>& cellw,
0013 double cellh,
0014 double pitchx,
0015 double pitchy,
0016 double pos,
0017 int res);
0018 CTPPSToFDetector(
0019 int ncellx, int ncelly, double cellw, double cellh, double pitchx, double pitchy, double pos, int res);
0020 virtual ~CTPPSToFDetector() {}
0021
0022 double getHeight() { return detH_; };
0023 double getWidth() { return detW_; };
0024 double getPosition() { return detPosition_; };
0025 int findCellId(double x, double y);
0026 bool get_CellCenter(int cell_id, double& x, double& y);
0027 int get_CellId(int idx) {
0028 if (idx >= (int)theToFInfo.size())
0029 return 0;
0030 std::map<int, std::vector<double> >::const_iterator it = theToFInfo.begin();
0031 std::advance(it, idx);
0032 return it->first;
0033 }
0034 int get_CellMultiplicity() { return (int)theToFInfo.size(); };
0035 int getMultiplicityByCell(int cellid) {
0036 if (!theToFInfo.count(cellid))
0037 return 0;
0038 return (int)theToFInfo.at(cellid).size();
0039 };
0040
0041 int get_nHits_() { return nHits_; };
0042 std::vector<double> get_ToF(int cell) {
0043 if (!theToFInfo.count(cell))
0044 return std::vector<double>();
0045 return theToFInfo.at(cell);
0046 };
0047 int getADC(int cell, int hit) {
0048 if (!nADC_.count(cell))
0049 return 0;
0050 if ((int)nADC_.at(cell).size() < hit)
0051 return 0;
0052 return nADC_.at(cell).at(hit);
0053 }
0054
0055 void AddHit(double x, double y, double tof);
0056 void clear() {
0057 detId_ = 0;
0058 nHits_ = 0;
0059 theToFInfo.clear();
0060 };
0061
0062 private:
0063 int nCellX_;
0064 int nCellY_;
0065 double cellWq_;
0066 std::vector<double> cellW_;
0067 double cellH_;
0068 double pitchX_;
0069 double pitchY_;
0070 int fToFResolution_;
0071 std::vector<std::pair<double, double> > cellColumn_;
0072 std::vector<std::pair<double, double> > cellRow_;
0073
0074 double detW_;
0075 double detH_;
0076 double detPosition_;
0077
0078 int detId_;
0079 int nHits_;
0080 std::map<int, std::vector<int> > nADC_;
0081
0082 std::map<int, std::vector<double> > theToFInfo;
0083
0084 typedef std::map<int, std::vector<double> > theToFInfo_t;
0085 };
0086 #endif