Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pdu surface normal #1068

Merged
merged 15 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/services/geometry/richgeo/IrtGeoDRICH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <IRT/G4Object.h>
#include <Math/GenVector/DisplacementVector3D.h>
#include <TRef.h>
#include <TVector3.h>
#include <fmt/core.h>
#include <stdint.h>
#include <exception>
Expand All @@ -23,9 +22,6 @@
#include <type_traits>
#include <unordered_map>
#include <utility>

#include "services/geometry/richgeo/RichGeo.h"

void richgeo::IrtGeoDRICH::DD4hep_to_IRT() {

// begin envelope
Expand Down Expand Up @@ -110,7 +106,6 @@ void richgeo::IrtGeoDRICH::DD4hep_to_IRT() {
// sector loop
for (int isec = 0; isec < nSectors; isec++) {
std::string secName = "sec" + std::to_string(isec);

// mirrors
auto mirrorRadius = m_det->constant<double>("DRICH_mirror_radius") / dd4hep::mm;
dd4hep::Position mirrorCenter(
Expand Down Expand Up @@ -167,7 +162,6 @@ void richgeo::IrtGeoDRICH::DD4hep_to_IRT() {
sensor_info.surface_centroid = posSensor;
sensor_info.surface_offset = surfaceOffset;
m_sensor_info.insert({ sensorID, sensor_info });

// create the optical surface
m_sensorFlatSurface = new FlatSurface(
TVector3(posSensor.x(), posSensor.y(), posSensor.z()),
Expand Down Expand Up @@ -209,7 +203,25 @@ void richgeo::IrtGeoDRICH::DD4hep_to_IRT() {
// define the `cell ID -> pixel position` converter
SetReadoutIDToPositionLambda();
}

TVector3 richgeo::IrtGeoDRICH::GetSensorSurfaceNorm(CellIDType id){
TVector3 sensorNorm;
auto cellMask = uint64_t(std::stoull(m_det->constant<std::string>("DRICH_cell_mask")));
auto sensor_info = this->m_sensor_info;
auto sID = id & cellMask;
auto sensor_info_it = sensor_info.find(sID);
if(sensor_info_it!=sensor_info.end()){
chchatte92 marked this conversation as resolved.
Show resolved Hide resolved
auto sensor_obj = sensor_info_it->second;
auto normZdir = sensor_obj.surface_offset.Unit();
sensorNorm.SetX(static_cast<double>(normZdir.x()));
sensorNorm.SetY(static_cast<double>(normZdir.y()));
sensorNorm.SetZ(static_cast<double>(normZdir.z()));
}
else{
m_log->error("Cannot find sensor {} in IrtGeoDRICH::GetSensorSurface", id);
wdconinc marked this conversation as resolved.
Show resolved Hide resolved
throw std::runtime_error("sensor not found in IrtGeoDRIC::GetSensorSurfaceNormal");
}
return sensorNorm;
}
// destructor
richgeo::IrtGeoDRICH::~IrtGeoDRICH() {
delete m_surfEntrance;
Expand Down
4 changes: 3 additions & 1 deletion src/services/geometry/richgeo/IrtGeoDRICH.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
#include <IRT/CherenkovPhotonDetector.h>
#include <IRT/OpticalBoundary.h>
#include <IRT/ParametricSurface.h>
#include <TVector3.h>
#include <spdlog/logger.h>
#include <gsl/pointers>
#include <memory>
#include <string>

#include "IrtGeo.h"
#include "services/geometry/richgeo/RichGeo.h"

namespace richgeo {
class IrtGeoDRICH : public IrtGeo {
Expand All @@ -23,7 +25,7 @@ namespace richgeo {
IrtGeoDRICH(gsl::not_null<const dd4hep::Detector*> det_, gsl::not_null<const dd4hep::rec::CellIDPositionConverter*> conv_, std::shared_ptr<spdlog::logger> log_) :
IrtGeo("DRICH",det_,conv_,log_) { DD4hep_to_IRT(); }
~IrtGeoDRICH();

TVector3 GetSensorSurfaceNorm(CellIDType);
wdconinc marked this conversation as resolved.
Show resolved Hide resolved
protected:
void DD4hep_to_IRT() override;

Expand Down
Loading