ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
genericDetector.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file genericDetector.h
1 
2 
3 
4 
5 #ifndef __GENERICDETECTOR_H__
6 #define __GENERICDETECTOR_H__
7 
8 #include "PID.h"
9 
10 class genericDetector : public PID
11 {
12 public:
13  genericDetector() = default;
14  virtual ~genericDetector() = default;
15 
17 
19  void setType(EDetector_t val) { mType = val; };
20  void setName(string val) { mName = val; };
21  void setLength(double val) { mLength = val; };
22  void setRadius(double val) { mRadius = val; };
23  void setPositionZ(double val) { mPositionZ = val; };
24  void setRadiusIn(double val) { mRadiusIn = val; };
25  void setRadiusOut(double val) { mRadiusOut = val; };
26  void setMagneticField(double val) { mMagneticField = val; };
27 
29  virtual bool valid (double eta, double p) override { return isHit(eta, p); };
30  virtual double numSigma (double eta, double p, PID::type PID) override = 0;
31  virtual double maxP (double eta, double numSigma, PID::type PID) override = 0;
32  virtual double minP (double eta, double numSigma, PID::type PID) override = 0;
33  string name () override { return mName; };
34  void description() override { return mDescription; };
35 
36  double maxPt (double eta, double numSigma, PID::type PID) { return maxP(eta, numSigma, PID) / cosh(eta); };
37  double minPt (double eta, double numSigma, PID::type PID) { return ptMin(); };
38 
39 protected:
40 
41  double etaMin();
42  double etaMax();
43  double ptMin();
44  double pMin(double eta) { return ptMin() * cosh(eta); };
45  bool isHit(double eta, double p) { return eta > etaMin() && eta < etaMax() && p > pMin(eta); };
46  double trackLength(double eta);
47 
48  string mName = "genericDetector";
49  string mDescription = "Detector description";
51  double mLength = 200.; // [cm]
52  double mRadius = 200.; // [cm]
53  double mPositionZ = 200.; // [cm]
54  double mRadiusIn = 20.; // [cm]
55  double mRadiusOut = 200.; // [cm]
56  double mMagneticField = 2.; // [T]
57 
58  const double mLightSpeed = 29.9792458; // speed of light [cm/ns]
59  const double mMassElectron = 0.00051099891; // electron mass [GeV]
60  const double mMassPion = 0.13957018; // pion mass [GeV]
61  const double mMassKaon = 0.493677; // kaon mass [GeV]
62  const double mMassProton = 0.93827208816; // proton mass [GeV]
63 
64 };
65 
66 double
68 {
69  switch (mType) {
70  case kBarrel:
71  return -log( tan( atan2(mRadius, -mLength) * 0.5 ) );
72  case kForward:
73  return -log( tan( atan2(mRadiusOut, mPositionZ) * 0.5 ) );
74  }
75  return 0.;
76 }
77 
78 double
80 {
81  switch (mType) {
82  case kBarrel:
83  return -log( tan( atan2(mRadius, mLength) * 0.5 ) );
84  case kForward:
85  return -log( tan( atan2(mRadiusIn, mPositionZ) * 0.5 ) );
86  }
87  return 0.;
88 }
89 
90 double
92 {
93  switch (mType) {
94  case kBarrel:
95  return 0.003 * mMagneticField * 0.5 * mRadius;
96  case kForward:
97  return 0.003 * mMagneticField * 0.5 * mRadiusIn;
98  }
99  return 0.;
100 }
101 
102 double
104 {
105  auto theta = 2. * atan( exp(-eta) );
106 
107  switch (mType) {
108  case kBarrel:
109  return mRadius / sin(theta);
110  case kForward:
111  return mPositionZ / cos(theta);
112  }
113  return 0.;
114 }
115 
116 #endif /* __GENERICDETECTOR_H__ */