Commit b03bcb4e authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'track_updates' into 'master'

Adding material budget to detector & cmake root fix & track change

See merge request !187
parents 7aed012e b96429f4
Pipeline #1174908 failed with stages
in 6 minutes and 18 seconds
......@@ -57,6 +57,14 @@ Detector::Detector(const Configuration& config) : m_role(DetectorRole::NONE) {
m_nPixels = config.get<ROOT::Math::DisplacementVector2D<Cartesian2D<int>>>("number_of_pixels");
// Size of the pixels
m_pitch = config.get<ROOT::Math::XYVector>("pixel_pitch");
// Material budget of detector, including support material
if(!config.has("material_budget")) {
LOG(WARNING) << "No material budget given for " << m_detectorName << ", assuming zero";
} else if(config.get<double>("material_budget") < 0) {
throw InvalidValueError(config, "material_budget", "Material budget has to be positive");
} else {
m_materialBudget = config.get<double>("material_budget");
}
// Intrinsic position resolution, defaults to 4um:
m_resolution = config.get<ROOT::Math::XYVector>("resolution", ROOT::Math::XYVector(0.004, 0.004));
......@@ -252,7 +260,10 @@ Configuration Detector::getConfiguration() const {
}
config.setMatrix("roi", m_roi);
// material budget
if(m_materialBudget > 0.0) {
config.set("material_budget", m_materialBudget);
}
return config;
}
......@@ -260,16 +271,17 @@ Configuration Detector::getConfiguration() const {
PositionVector3D<Cartesian3D<double>> Detector::getIntercept(const Track* track) const {
// Get the distance from the plane to the track initial state
double distance = (m_origin.X() - track->state().X()) * m_normal.X();
distance += (m_origin.Y() - track->state().Y()) * m_normal.Y();
distance += (m_origin.Z() - track->state().Z()) * m_normal.Z();
distance /= (track->direction().X() * m_normal.X() + track->direction().Y() * m_normal.Y() +
track->direction().Z() * m_normal.Z());
double distance = (m_origin.X() - track->state(m_detectorName).X()) * m_normal.X();
distance += (m_origin.Y() - track->state(m_detectorName).Y()) * m_normal.Y();
distance += (m_origin.Z() - track->state(m_detectorName).Z()) * m_normal.Z();
distance /= (track->direction(m_detectorName).X() * m_normal.X() + track->direction(m_detectorName).Y() * m_normal.Y() +
track->direction(m_detectorName).Z() * m_normal.Z());
// Propagate the track
PositionVector3D<Cartesian3D<double>> globalIntercept(track->state().X() + distance * track->direction().X(),
track->state().Y() + distance * track->direction().Y(),
track->state().Z() + distance * track->direction().Z());
PositionVector3D<Cartesian3D<double>> globalIntercept(
track->state(m_detectorName).X() + distance * track->direction(m_detectorName).X(),
track->state(m_detectorName).Y() + distance * track->direction(m_detectorName).Y(),
track->state(m_detectorName).Z() + distance * track->direction(m_detectorName).Z());
return globalIntercept;
}
......
......@@ -257,6 +257,12 @@ namespace corryvreckan {
*/
bool isWithinROI(Cluster* cluster) const;
/**
* @brief Return the thickness of the senosr assembly layer (sensor+support) in fractions of radiation length
* @return thickness in fractions of radiation length
*/
double materialBudget() const { return m_materialBudget; }
private:
// Roles of the detector
DetectorRole m_role;
......@@ -275,6 +281,7 @@ namespace corryvreckan {
XYVector m_resolution;
ROOT::Math::DisplacementVector2D<ROOT::Math::Cartesian2D<int>> m_nPixels;
double m_timingOffset;
double m_materialBudget;
std::vector<std::vector<int>> m_roi;
static int winding_number(std::pair<int, int> probe, std::vector<std::vector<int>> polygon);
......
......@@ -146,8 +146,8 @@ void AlignmentDUTResidual::MinimiseResiduals(Int_t&, Double_t*, Double_t& result
// Loop over all tracks
for(auto& track : globalTracks) {
LOG(TRACE) << "track has chi2 " << track->chi2();
LOG(TRACE) << "- track has gradient x " << track->direction().X();
LOG(TRACE) << "- track has gradient y " << track->direction().Y();
auto detector = track->clusters().front()->detectorID();
LOG(TRACE) << "- track has gradient " << track->direction(detector) << " at detector " << detector;
// Find the cluster that needs to have its position recalculated
for(auto& associatedCluster : track->associatedClusters()) {
......
......@@ -269,8 +269,8 @@ bool AlignmentMillepede::putTrack(Track* track, const size_t nPlanes) {
/// Refit the track for the reference states.
track->fit();
const double tx = track->state().X();
const double ty = track->state().Y();
const double tx = track->state(track->clusters().front()->detectorID()).X();
const double ty = track->state(track->clusters().front()->detectorID()).Y();
// Iterate over each cluster on the track.
for(auto& cluster : track->clusters()) {
......
......@@ -225,8 +225,8 @@ StatusCode Tracking4D::run(std::shared_ptr<Clipboard> clipboard) {
trackChi2->Fill(track->chi2());
clustersPerTrack->Fill(static_cast<double>(track->nClusters()));
trackChi2ndof->Fill(track->chi2ndof());
trackAngleX->Fill(atan(track->direction().X()));
trackAngleY->Fill(atan(track->direction().Y()));
trackAngleX->Fill(atan(track->direction(track->clusters().front()->detectorID()).X()));
trackAngleY->Fill(atan(track->direction(track->clusters().front()->detectorID()).Y()));
// Make residuals
auto trackClusters = track->clusters();
......
......@@ -179,8 +179,8 @@ StatusCode TrackingSpatial::run(std::shared_ptr<Clipboard> clipboard) {
trackChi2->Fill(track->chi2());
clustersPerTrack->Fill(static_cast<double>(track->nClusters()));
trackChi2ndof->Fill(track->chi2ndof());
trackAngleX->Fill(atan(track->direction().X()));
trackAngleY->Fill(atan(track->direction().Y()));
trackAngleX->Fill(atan(track->direction(track->clusters().front()->detectorID()).X()));
trackAngleY->Fill(atan(track->direction(track->clusters().front()->detectorID()).Y()));
// Make residuals
for(auto& trackCluster : track->clusters()) {
......
......@@ -9,7 +9,7 @@ FIND_FILE(ROOT_MACROS_FILE
IF(NOT ROOT_MACROS_FILE)
MESSAGE(WARNING "Cannot find ROOT macros, including generic file as fallback.")
INCLUDE(${ROOT_USE_FILE})
INCLUDE("${ROOT_USE_FILE}")
ELSE()
INCLUDE(${ROOT_MACROS_FILE})
ENDIF()
......
......@@ -85,8 +85,8 @@ namespace corryvreckan {
size_t nClusters() const { return m_trackClusters.size(); }
ROOT::Math::XYZPoint intercept(double z) const;
ROOT::Math::XYZPoint state() const { return m_state; }
ROOT::Math::XYZVector direction() const { return m_direction; }
ROOT::Math::XYZPoint state(std::string) const { return m_state; }
ROOT::Math::XYZVector direction(std::string) const { return m_direction; }
private:
// Calculate the chi2 of the track
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment