src/core/geometry/Detector.hpp
Base of detector implementation. More…
Namespaces
Name |
---|
allpix Helper class to hold support layers for a detector model. |
Classes
Name | |
---|---|
class | allpix::Detector Instantiation of a detector model in the world. |
Detailed Description
Base of detector implementation.
Copyright: Copyright (c) 2017-2024 CERN and the Allpix Squared authors. This software is distributed under the terms of the MIT License, copied verbatim in the file “LICENSE.md”. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. SPDX-License-Identifier: MIT
Source code
#ifndef ALLPIX_DETECTOR_H
#define ALLPIX_DETECTOR_H
#include <array>
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <tuple>
#include <typeindex>
#include <vector>
#include <Math/Point3D.h>
#include <Math/Rotation3D.h>
#include <Math/Transform3D.h>
#include "DetectorField.hpp"
#include "DetectorModel.hpp"
#include "objects/Pixel.hpp"
namespace allpix {
class Detector {
friend class GeometryManager;
public:
Detector(std::string name,
std::shared_ptr<DetectorModel> model,
ROOT::Math::XYZPoint position,
const ROOT::Math::Rotation3D& orientation);
const std::string& getName() const { return name_; }
const std::string& getType() const { return model_->getType(); }
const ROOT::Math::XYZPoint& getPosition() const { return position_; }
const ROOT::Math::Rotation3D& getOrientation() const { return orientation_; }
ROOT::Math::XYZPoint getLocalPosition(const ROOT::Math::XYZPoint& global_pos) const;
ROOT::Math::XYZPoint getGlobalPosition(const ROOT::Math::XYZPoint& local_pos) const;
Pixel getPixel(int x, int y) const;
Pixel getPixel(const Pixel::Index& index) const;
bool hasElectricField() const { return electric_field_.isValid(); }
FieldType getElectricFieldType() const { return electric_field_.getType(); }
ROOT::Math::XYZVector getElectricField(const ROOT::Math::XYZPoint& local_pos) const;
void setElectricFieldGrid(const std::shared_ptr<std::vector<double>>& field,
std::array<size_t, 3> bins,
std::array<double, 3> size,
FieldMapping mapping,
std::array<double, 2> scales,
std::array<double, 2> offset,
std::pair<double, double> thickness_domain);
void setElectricFieldFunction(FieldFunction<ROOT::Math::XYZVector> function,
std::pair<double, double> thickness_domain,
FieldType type = FieldType::CUSTOM);
bool hasDopingProfile() const { return doping_profile_.isValid(); }
FieldType getDopingProfileType() const { return doping_profile_.getType(); }
double getDopingConcentration(const ROOT::Math::XYZPoint& local_pos) const;
void setDopingProfileGrid(std::shared_ptr<std::vector<double>> field,
std::array<size_t, 3> bins,
std::array<double, 3> size,
FieldMapping mapping,
std::array<double, 2> scales,
std::array<double, 2> offset,
std::pair<double, double> thickness_domain);
void setDopingProfileFunction(FieldFunction<double> function, FieldType type = FieldType::CUSTOM);
bool hasWeightingPotential() const { return weighting_potential_.isValid(); }
FieldType getWeightingPotentialType() const { return weighting_potential_.getType(); }
double getWeightingPotential(const ROOT::Math::XYZPoint& local_pos, const Pixel::Index& reference) const;
void setWeightingPotentialGrid(const std::shared_ptr<std::vector<double>>& potential,
std::array<size_t, 3> bins,
std::array<double, 3> size,
FieldMapping mapping,
std::array<double, 2> scales,
std::array<double, 2> offset,
std::pair<double, double> thickness_domain);
void setWeightingPotentialFunction(FieldFunction<double> function,
std::pair<double, double> thickness_domain,
FieldType type = FieldType::CUSTOM);
void setMagneticField(ROOT::Math::XYZVector b_field);
bool hasMagneticField() const { return magnetic_field_on_; }
ROOT::Math::XYZVector getMagneticField(const ROOT::Math::XYZPoint& local_pos) const;
const std::shared_ptr<DetectorModel> getModel() const { return model_; }
private:
Detector(std::string name, ROOT::Math::XYZPoint position, const ROOT::Math::Rotation3D& orientation);
void set_model(std::shared_ptr<DetectorModel> model);
void build_transform();
void check_field_match(std::array<double, 3> size,
FieldMapping mapping,
std::array<double, 2> field_scale,
std::pair<double, double> thickness_domain) const;
std::string name_;
std::shared_ptr<DetectorModel> model_;
ROOT::Math::XYZPoint position_;
ROOT::Math::Rotation3D orientation_;
// Transform matrix from global to local coordinates
ROOT::Math::Transform3D transform_;
// Electric field
DetectorField<ROOT::Math::XYZVector, 3> electric_field_;
// Weighting potential
DetectorField<double, 1> weighting_potential_;
// Magnetic field properties
ROOT::Math::XYZVector magnetic_field_;
bool magnetic_field_on_;
// Doping profile properties
DetectorField<double, 1> doping_profile_;
};
} // namespace allpix
#endif /* ALLPIX_DETECTOR_H */
Updated on 2025-02-27 at 14:14:46 +0000