CMS 3D CMS Logo

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,int ncelly, std::vector<double>& cellw,double cellh,double pitchx,double pitchy,double pos, int res);
11  CTPPSToFDetector(int ncellx,int ncelly, double cellw,double cellh,double pitchx,double pitchy,double pos, int res);
12  virtual ~CTPPSToFDetector() {};
13 
14  double getHeight() {return detH_;};
15  double getWidth() {return detW_;};
16  double getPosition() {return detPosition_;};
17  int findCellId(double x, double y); // return the cell id corresponding to the given position
18  bool get_CellCenter(int cell_id, double& x, double& y); // return false if it failed
19  int get_CellId(int idx) {if (idx>=(int)theToFInfo.size()) return 0;
20  std::map<int,std::vector<double> >::const_iterator it=theToFInfo.begin();
21  std::advance(it,idx);
22  return it->first;
23  }
24  int get_CellMultiplicity() {return (int)theToFInfo.size();}; // return the number of cells with hit
25  int getMultiplicityByCell(int cellid) {if (!theToFInfo.count(cellid)) return 0;
26  return (int)theToFInfo.at(cellid).size();}; // return the hit multiplicity of the given cell
27 
28  int get_nHits_() {return nHits_;}; // return the total hit multiplicity (full det)
29  std::vector<double> get_ToF(int cell) {if (!theToFInfo.count(cell)) return std::vector<double>();
30  return theToFInfo.at(cell);
31  }; // return the tof of the given cell
32  int getADC(int cell, int hit) {
33  if (!nADC_.count(cell)) return 0;
34  if ((int)nADC_.at(cell).size()<hit) return 0;
35  return nADC_.at(cell).at(hit);
36  }
37 
38 
39  void AddHit(double x, double y,double tof);
40  void clear() {detId_=0;nHits_=0;theToFInfo.clear();};
41  private:
42  int nCellX_;
43  int nCellY_;
44  double cellWq_; // width (X, horizontal dimension in mm)
45  std::vector<double> cellW_;//move to vector - diamond geometry
46  double cellH_; // height(Y, vertical dimension in mm)
47  double pitchX_; // distance (in X) between cells
48  double pitchY_; // distance (in Y) between cells
49  int fToFResolution_; // in ps
50  std::vector<std::pair<double,double> > cellColumn_; // lower and upper limits of cells in X
51  std::vector<std::pair<double,double> > cellRow_; // lower and upper limits of cells in Y
52 //
53  double detW_; // detector width
54  double detH_; // detector height
55  double detPosition_; // detector position from beam (absolute value)
56 //
57  int detId_;
58  int nHits_;
59  std::map<int,std::vector<int> > nADC_; // fake ADC counter: in case of multiple hits in the same cell,
60  // it counts the number of overlaps
61  std::map<int,std::vector<double> > theToFInfo;
62 
63  typedef std::map<int,std::vector<double> > theToFInfo_t; // define a type for the tof info
64 };
65 #endif
bool get_CellCenter(int cell_id, double &x, double &y)
int get_CellId(int idx)
int findCellId(double x, double y)
int getMultiplicityByCell(int cellid)
virtual ~CTPPSToFDetector()
std::map< int, std::vector< double > > theToFInfo_t
Definition: Electron.h:6
int getADC(int cell, int hit)
void AddHit(double x, double y, double tof)
std::vector< double > get_ToF(int cell)
std::vector< std::pair< double, double > > cellRow_
CTPPSToFDetector(int ncellx, int ncelly, std::vector< double > &cellw, double cellh, double pitchx, double pitchy, double pos, int res)
std::vector< double > cellW_
std::map< int, std::vector< int > > nADC_
std::vector< std::pair< double, double > > cellColumn_
std::map< int, std::vector< double > > theToFInfo