#include "QQQDetector.h" QQQDetector::QQQDetector(double phiCentral, double zOffset, double xOffset, double yOffset) : m_centralPhi(phiCentral), m_translation(xOffset,yOffset,zOffset), m_norm(0.0,0.0,1.0), m_uniformFraction(0.0, 1.0), m_isSmearing(false) { m_zRotation.SetAngle(m_centralPhi); m_ringCoords.resize(s_nRings); m_wedgeCoords.resize(s_nWedges); for(auto& ring : m_ringCoords) ring.resize(4); for(auto& wedge : m_wedgeCoords) wedge.resize(4); CalculateCorners(); } QQQDetector::~QQQDetector() {} void QQQDetector::CalculateCorners() { double x0, x1, x2, x3; double y0, y1, y2, y3; double z0, z1, z2, z3; //Generate flat ring corner coordinates for(int i=0; i min_rho) { for(auto& wedge : m_wedgeCoords) { min_phi = wedge[0].Phi(); max_phi = wedge[3].Phi(); if(phi < min_phi && phi < max_phi) { result.SetXYZ(std::sin(theta)*std::cos(phi)*r_traj, std::sin(theta)*std::sin(phi)*r_traj, std::cos(theta)*r_traj); break; } } } } return result; } std::pair QQQDetector::GetTrajectoryRingWedge(double theta, double phi) { double z_to_detector = m_translation.Vect().Z(); double rho_traj = z_to_detector*std::tan(theta); double min_rho, max_rho, min_phi, max_phi; for(int r=0; r min_rho) { for(int w=0; w min_phi && phi < max_phi) return std::make_pair(r, w); } } } return std::make_pair(-1, -1); } ROOT::Math::XYZPoint QQQDetector::GetHitCoordinates(int ringch, int wedgech) { if(!CheckChannel(ringch) || !CheckChannel(wedgech)) return ROOT::Math::XYZPoint(); double r_center, phi_center; if(m_isSmearing) { r_center = s_innerR + (m_uniformFraction(Mask::RandomGenerator::GetInstance().GetGenerator())+ringch)*s_deltaR; phi_center = -s_deltaPhiTotal/2.0 + (m_uniformFraction(Mask::RandomGenerator::GetInstance().GetGenerator())+wedgech)*s_deltaPhi; } else { r_center = s_innerR + (0.5+ringch)*s_deltaR; phi_center = -s_deltaPhiTotal/2.0 + (0.5+wedgech)*s_deltaPhi; } double x = r_center*std::cos(phi_center); double y = r_center*std::sin(phi_center); double z = 0; ROOT::Math::XYZPoint hit(x, y, z); return TransformCoordinates(hit); }