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,
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
CTPPSToFDetector::getWidth
double getWidth()
Definition: CTPPSToFDetector.h:23
DDAxes::y
CTPPSToFDetector::nHits_
int nHits_
Definition: CTPPSToFDetector.h:79
CTPPSToFDetector::get_CellMultiplicity
int get_CellMultiplicity()
Definition: CTPPSToFDetector.h:34
CTPPSToFDetector::pitchX_
double pitchX_
Definition: CTPPSToFDetector.h:68
pos
Definition: PixelAliasList.h:18
CTPPSToFDetector::cellH_
double cellH_
Definition: CTPPSToFDetector.h:67
CTPPSToFDetector::cellWq_
double cellWq_
Definition: CTPPSToFDetector.h:65
CTPPSToFDetector::pitchY_
double pitchY_
Definition: CTPPSToFDetector.h:69
DDAxes::x
CTPPSToFDetector::CTPPSToFDetector
CTPPSToFDetector(int ncellx, int ncelly, std::vector< double > &cellw, double cellh, double pitchx, double pitchy, double pos, int res)
Definition: CTPPSToFDetector.cc:4
CTPPSToFDetector
Definition: CTPPSToFDetector.h:8
CTPPSToFDetector::detW_
double detW_
Definition: CTPPSToFDetector.h:74
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
CTPPSToFDetector::get_CellId
int get_CellId(int idx)
Definition: CTPPSToFDetector.h:27
CTPPSToFDetector::cellRow_
std::vector< std::pair< double, double > > cellRow_
Definition: CTPPSToFDetector.h:72
CTPPSToFDetector::theToFInfo_t
std::map< int, std::vector< double > > theToFInfo_t
Definition: CTPPSToFDetector.h:84
CTPPSToFDetector::fToFResolution_
int fToFResolution_
Definition: CTPPSToFDetector.h:70
CTPPSToFDetector::getHeight
double getHeight()
Definition: CTPPSToFDetector.h:22
CTPPSToFDetector::get_CellCenter
bool get_CellCenter(int cell_id, double &x, double &y)
Definition: CTPPSToFDetector.cc:107
CTPPSToFDetector::getMultiplicityByCell
int getMultiplicityByCell(int cellid)
Definition: CTPPSToFDetector.h:35
CTPPSToFDetector::nADC_
std::map< int, std::vector< int > > nADC_
Definition: CTPPSToFDetector.h:80
CTPPSToFDetector::clear
void clear()
Definition: CTPPSToFDetector.h:56
CTPPSToFDetector::findCellId
int findCellId(double x, double y)
Definition: CTPPSToFDetector.cc:83
res
Definition: Electron.h:6
CTPPSToFDetector::detPosition_
double detPosition_
Definition: CTPPSToFDetector.h:76
CTPPSToFDetector::cellColumn_
std::vector< std::pair< double, double > > cellColumn_
Definition: CTPPSToFDetector.h:71
CTPPSToFDetector::get_nHits_
int get_nHits_()
Definition: CTPPSToFDetector.h:41
CTPPSToFDetector::getPosition
double getPosition()
Definition: CTPPSToFDetector.h:24
CTPPSToFDetector::AddHit
void AddHit(double x, double y, double tof)
Definition: CTPPSToFDetector.cc:62
CTPPSToFDetector::get_ToF
std::vector< double > get_ToF(int cell)
Definition: CTPPSToFDetector.h:42
CTPPSToFDetector::~CTPPSToFDetector
virtual ~CTPPSToFDetector()
Definition: CTPPSToFDetector.h:20
CTPPSToFDetector::nCellX_
int nCellX_
Definition: CTPPSToFDetector.h:60
CTPPSToFDetector::nCellY_
int nCellY_
Definition: CTPPSToFDetector.h:64
CTPPSToFDetector::detId_
int detId_
Definition: CTPPSToFDetector.h:78
hit
Definition: SiStripHitEffFromCalibTree.cc:88
CTPPSToFDetector::theToFInfo
std::map< int, std::vector< double > > theToFInfo
Definition: CTPPSToFDetector.h:82
CTPPSToFDetector::detH_
double detH_
Definition: CTPPSToFDetector.h:75
CTPPSToFDetector::getADC
int getADC(int cell, int hit)
Definition: CTPPSToFDetector.h:47
CTPPSToFDetector::cellW_
std::vector< double > cellW_
Definition: CTPPSToFDetector.h:66