File indexing completed on 2024-06-26 07:05:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "eicsmear/smear/PlanarTracker.h"
0011
0012 #include <algorithm>
0013 #include <cmath>
0014 #include <limits>
0015 #include <list>
0016
0017 #include <TMath.h>
0018
0019 namespace Smear {
0020
0021 PlanarTracker::PlanarTracker()
0022 : Tracker(2., 0.03, 0.001)
0023 , mNPlanes(25.)
0024 , mInnerRadius(0.1)
0025 , mOuterRadius(1.)
0026 , mZMin(-1.5)
0027 , mZMax(1.5) {
0028 }
0029
0030 PlanarTracker::PlanarTracker(double inner, double outer,
0031 double zmin, double zmax,
0032 double Bb, double nrl,
0033 double sigmaRPhi, double N)
0034 : Tracker(Bb, nrl, sigmaRPhi)
0035 , mNPlanes(N)
0036 , mInnerRadius(inner)
0037 , mOuterRadius(outer)
0038
0039 , mZMin(std::min(zmin, zmax))
0040 , mZMax(std::max(zmin, zmax)) {
0041 }
0042
0043 PlanarTracker::~PlanarTracker() {
0044 }
0045
0046 void PlanarTracker::Print(Option_t* ) const {
0047 std::cout << ClassName() << " with:" << std::endl <<
0048 "\tinner radius " << mInnerRadius << " m\n" <<
0049 "\touter radius " << mOuterRadius << " m\n" <<
0050 "\tlength " << mZMin << " to " << mZMax <<
0051 " (= " << mZMax - mZMin << ") m\n" <<
0052 "\tmagnetic field " << mMagField << " Tesla\n" <<
0053 "\t" << mNRadLengths << " radiation lengths\n" <<
0054 "\tpoint resolution " << mSigmaRPhi * 1.e6 << " microns\n" <<
0055 "\t" << mNPlanes << " planes" << std::endl;
0056 }
0057
0058 double PlanarTracker::GetThetaMin() const {
0059 if (mZMax > 0.) {
0060 return atan2(mInnerRadius, mZMax);
0061 } else {
0062 return atan2(mOuterRadius, mZMax);
0063 }
0064 }
0065
0066 double PlanarTracker::GetThetaMax() const {
0067 if (mZMin > 0.) {
0068 return atan2(mOuterRadius, mZMin);
0069 } else {
0070 return atan2(mInnerRadius, mZMin);
0071 }
0072 }
0073
0074 TVector3 PlanarTracker::ComputeIntersectionWithRadius(
0075 const erhic::VirtualParticle& p, double radius) const {
0076
0077
0078 const double z = radius / tan(p.GetTheta()) + p.GetVertex().z();
0079 TVector3 intersection(0., 0., std::numeric_limits<double>::quiet_NaN());
0080 if (z > mZMin && z < mZMax) {
0081
0082 intersection.SetXYZ(radius, 0., z);
0083 }
0084 return intersection;
0085 }
0086
0087 TVector3 PlanarTracker::ComputeIntersectionWithPlane(
0088 const erhic::VirtualParticle& p, double z) const {
0089
0090
0091 const double r = (z - p.GetVertex().z()) * tan(p.GetTheta());
0092 TVector3 intersection(0., 0., std::numeric_limits<double>::quiet_NaN());
0093 if (r > mInnerRadius && r < mOuterRadius) {
0094
0095 intersection.SetXYZ(r, 0., z);
0096 }
0097 return intersection;
0098 }
0099
0100 double PlanarTracker::L(const erhic::VirtualParticle& p) const {
0101 float r1 = 0., r2 = 0., pi = 3.1415926535;
0102 double zPlane1 = 0., zPlane2 = 0., Length = 0.;
0103
0104
0105
0106
0107 for (int i = 0; i < mNPlanes; i++) {
0108 zPlane1 = mZMin + i * (mZMax - mZMin) / (mNPlanes - 1);
0109 r1 = fabs(tan(p.GetTheta()) * zPlane1);
0110 if ((r1 > mInnerRadius) && (r1 < mOuterRadius)) {
0111 if (((p.GetTheta() < pi / 2.) && (zPlane1 > 0.)) ||
0112 ((p.GetTheta() > pi / 2.) && (zPlane1 < 0.))) {
0113 zPlane2 = zPlane1 + (NPoints(p) - 1) * (mZMax - mZMin) / (mNPlanes - 1);
0114 r2 = fabs(tan(p.GetTheta()) * zPlane2);
0115 break;
0116 }
0117 }
0118 }
0119 Length = sqrt((zPlane2 - zPlane1) * (zPlane2 - zPlane1) +
0120 (r2 - r1) * (r2 - r1));
0121 return Length;
0122 }
0123
0124 double PlanarTracker::LPrime(const erhic::VirtualParticle& p) const {
0125 float r1 = 0., r2 = 0., pi = 3.1415926535;
0126 double zPlane1 = 0., zPlane2 = 0.;
0127
0128 for (int i = 0; i < mNPlanes; i++) {
0129 zPlane1 = mZMin + i * (mZMax - mZMin) / (mNPlanes-1);
0130 r1 = fabs(tan(p.GetTheta()) * zPlane1);
0131 if ((r1 > mInnerRadius) && (r1 < mOuterRadius)) {
0132 if (((p.GetTheta() < pi / 2.) && (zPlane1 > 0.)) ||
0133 ((p.GetTheta() > pi / 2.) && (zPlane1 < 0.))) {
0134 zPlane2 = zPlane1 + (NPoints(p) - 1) * (mZMax - mZMin) / (mNPlanes - 1);
0135 r2 = fabs(tan(p.GetTheta()) * zPlane2);
0136 break;
0137 }
0138 }
0139 }
0140 return fabs(r2 - r1);
0141 }
0142
0143 int PlanarTracker::NPoints(const erhic::VirtualParticle& p) const {
0144 double zPlane = 0., pi = 3.1415926535;
0145 float r = 0.;
0146 int i, n = 0;
0147 for (i = 0; i < mNPlanes; i++) {
0148 zPlane = mZMin + i * (mZMax - mZMin) / (mNPlanes - 1);
0149
0150 r = fabs(tan(p.GetTheta()) * zPlane);
0151
0152 if ((r > mInnerRadius) && (r < mOuterRadius)) {
0153 if ((p.GetTheta() < pi / 2.) && (zPlane > 0)) n++;
0154 if ((p.GetTheta() > pi / 2.) && (zPlane < 0)) n++;
0155 }
0156 }
0157 return n;
0158 }
0159
0160 bool PlanarTracker::Accepts(const erhic::VirtualParticle& p) const {
0161 if (NPoints(p) >= 3) {
0162 return true;
0163 } else {
0164 return false;
0165 }
0166 }
0167
0168 }