CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CTPPSToFDetector.h
Go to the documentation of this file.
1 #ifndef CTPPSToFDetector_h
2 #define CTPPSToFDetector_h
3 #include <vector>
4 #include <map>
5 #include <iterator>
6 #include <iostream>
7 
9 public:
10  CTPPSToFDetector(int ncellx,
11  int ncelly,
12  std::vector<double>& cellw,
13  double cellh,
14  double pitchx,
15  double pitchy,
16  double pos,
17  int res);
19  int ncellx, int ncelly, double cellw, double cellh, double pitchx, double pitchy, double pos, int res);
20  virtual ~CTPPSToFDetector(){};
21 
22  double getHeight() { return detH_; };
23  double getWidth() { return detW_; };
24  double getPosition() { return detPosition_; };
25  int findCellId(double x, double y); // return the cell id corresponding to the given position
26  bool get_CellCenter(int cell_id, double& x, double& y); // return false if it failed
27  int get_CellId(int idx) {
28  if (idx >= (int)theToFInfo.size())
29  return 0;
30  std::map<int, std::vector<double> >::const_iterator it = theToFInfo.begin();
31  std::advance(it, idx);
32  return it->first;
33  }
34  int get_CellMultiplicity() { return (int)theToFInfo.size(); }; // return the number of cells with hit
35  int getMultiplicityByCell(int cellid) {
36  if (!theToFInfo.count(cellid))
37  return 0;
38  return (int)theToFInfo.at(cellid).size();
39  }; // return the hit multiplicity of the given cell
40 
41  int get_nHits_() { return nHits_; }; // return the total hit multiplicity (full det)
42  std::vector<double> get_ToF(int cell) {
43  if (!theToFInfo.count(cell))
44  return std::vector<double>();
45  return theToFInfo.at(cell);
46  }; // return the tof of the given cell
47  int getADC(int cell, int hit) {
48  if (!nADC_.count(cell))
49  return 0;
50  if ((int)nADC_.at(cell).size() < hit)
51  return 0;
52  return nADC_.at(cell).at(hit);
53  }
54 
55  void AddHit(double x, double y, double tof);
56  void clear() {
57  detId_ = 0;
58  nHits_ = 0;
59  theToFInfo.clear();
60  };
61 
62 private:
63  int nCellX_;
64  int nCellY_;
65  double cellWq_; // width (X, horizontal dimension in mm)
66  std::vector<double> cellW_; //move to vector - diamond geometry
67  double cellH_; // height(Y, vertical dimension in mm)
68  double pitchX_; // distance (in X) between cells
69  double pitchY_; // distance (in Y) between cells
70  int fToFResolution_; // in ps
71  std::vector<std::pair<double, double> > cellColumn_; // lower and upper limits of cells in X
72  std::vector<std::pair<double, double> > cellRow_; // lower and upper limits of cells in Y
73  //
74  double detW_; // detector width
75  double detH_; // detector height
76  double detPosition_; // detector position from beam (absolute value)
77  //
78  int detId_;
79  int nHits_;
80  std::map<int, std::vector<int> > nADC_; // fake ADC counter: in case of multiple hits in the same cell,
81  // it counts the number of overlaps
82  std::map<int, std::vector<double> > theToFInfo;
83 
84  typedef std::map<int, std::vector<double> > theToFInfo_t; // define a type for the tof info
85 };
86 #endif
bool get_CellCenter(int cell_id, double &x, double &y)
int get_CellId(int idx)
std::vector< std::pair< double, double > > cellRow_
int findCellId(double x, double y)
int getMultiplicityByCell(int cellid)
virtual ~CTPPSToFDetector()
std::map< int, std::vector< int > > nADC_
int getADC(int cell, int hit)
void AddHit(double x, double y, double tof)
std::vector< std::pair< double, double > > cellColumn_
std::vector< double > get_ToF(int cell)
CTPPSToFDetector(int ncellx, int ncelly, std::vector< double > &cellw, double cellh, double pitchx, double pitchy, double pos, int res)
std::map< int, std::vector< double > > theToFInfo
std::vector< double > cellW_
std::map< int, std::vector< double > > theToFInfo_t