2021-08-23 10:00:36 -04:00
|
|
|
/*
|
|
|
|
QQQDetector.h
|
|
|
|
Class implementing geometry for QQQDetector where the detector is perpendicular to the beam axis.
|
|
|
|
Detector is first generated centered on the x-axis (phi=0)
|
|
|
|
|
|
|
|
Coordinate convention : +z is downstream, -z is upstream. +y is vertically up in the lab.
|
|
|
|
*/
|
|
|
|
#ifndef QQQDETECTOR_H
|
|
|
|
#define QQQDETECTOR_H
|
|
|
|
|
|
|
|
#include <cmath>
|
2021-09-03 17:03:41 -04:00
|
|
|
#include <vector>
|
2021-09-23 11:42:14 -04:00
|
|
|
#include <random>
|
2021-08-23 10:00:36 -04:00
|
|
|
|
|
|
|
#include "Vec3.h"
|
|
|
|
#include "Rotation.h"
|
2021-09-23 11:42:14 -04:00
|
|
|
#include "RandomGenerator.h"
|
2021-08-23 10:00:36 -04:00
|
|
|
|
|
|
|
class QQQDetector {
|
|
|
|
public:
|
|
|
|
QQQDetector(double R_in, double R_out, double deltaPhi, double phiCentral, double z, double x=0, double y=0);
|
|
|
|
~QQQDetector();
|
2021-09-23 11:42:14 -04:00
|
|
|
inline Mask::Vec3 GetRingCoordinates(int ringch, int corner) { return m_ringCoords[ringch][corner]; }
|
|
|
|
inline Mask::Vec3 GetWedgeCoordinates(int wedgech, int corner) { return m_wedgeCoords[wedgech][corner]; }
|
|
|
|
inline Mask::Vec3 GetNorm() { return m_norm; }
|
2021-08-23 10:00:36 -04:00
|
|
|
Mask::Vec3 GetTrajectoryCoordinates(double theta, double phi);
|
|
|
|
std::pair<int, int> GetTrajectoryRingWedge(double theta, double phi);
|
|
|
|
Mask::Vec3 GetHitCoordinates(int ringch, int wedgech);
|
2021-09-23 11:42:14 -04:00
|
|
|
inline void TurnOnRandomizedCoordinates() { rndmFlag = true; }
|
|
|
|
inline void TurnOffRandomizedCoordinates() { rndmFlag = false; }
|
2021-08-23 10:00:36 -04:00
|
|
|
|
2021-09-23 11:42:14 -04:00
|
|
|
inline int GetNumberOfRings() { return nrings; }
|
|
|
|
inline int GetNumberOfWedges() { return nwedges; }
|
2021-08-23 10:00:36 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2021-09-23 11:42:14 -04:00
|
|
|
inline bool CheckChannel(int ch) { return (ch >=0 && ch < nrings); }
|
|
|
|
inline bool CheckCorner(int corner) { return (corner >=0 && corner < 4); }
|
2021-08-23 10:00:36 -04:00
|
|
|
|
|
|
|
void CalculateCorners();
|
2021-09-23 11:42:14 -04:00
|
|
|
Mask::Vec3 TransformCoordinates(Mask::Vec3& vector) { return m_ZRot*vector + m_translation; }
|
2021-08-23 10:00:36 -04:00
|
|
|
|
|
|
|
double m_Rinner, m_Router, m_deltaR, m_deltaPhi, m_deltaPhi_per_wedge, m_phiCentral;
|
|
|
|
std::vector<std::vector<Mask::Vec3>> m_ringCoords, m_wedgeCoords;
|
|
|
|
Mask::Vec3 m_translation;
|
2021-09-23 11:42:14 -04:00
|
|
|
Mask::Vec3 m_norm;
|
2021-08-23 10:00:36 -04:00
|
|
|
Mask::ZRotation m_ZRot;
|
|
|
|
|
2021-09-23 11:42:14 -04:00
|
|
|
std::uniform_real_distribution<double> m_uniform_fraction;
|
|
|
|
bool rndmFlag;
|
|
|
|
|
2021-08-23 10:00:36 -04:00
|
|
|
static constexpr int nrings = 16;
|
|
|
|
static constexpr int nwedges = 16;
|
|
|
|
static constexpr double deg2rad = M_PI/180.0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|