Commit febc391e authored by Jens Kroeger's avatar Jens Kroeger
Browse files

Merge branch 'master' into jobsub_newFeature

parents c35aa6f9 b7afa438
# - Try to find the MuPix telescope DAQ
# Once done this will define
# MUPIX8DAQ_FOUND - System has MuPixDAQ
# MUPIX8DAQ_INCLUDE_DIR - The MuPixDAQ main include directories
# MUPIX8DAQ_LIBRARY - The libraries needed to use MuPixDAQ
MESSAGE(STATUS "Looking for MuPix Telescope Readout...")
FIND_PATH(MUPIX8DAQ_INCLUDE_DIR NAMES "telescope_frame.hpp" "*.hpp" "*.h" PATHS "$ENV{MUPIX8DAQ}/library")
MESSAGE(STATUS "telescope_frame.hpp => ${MUPIX8DAQ_INCLUDE_DIR}")
IF(MUPIX8DAQ_INCLUDE_DIR)
SET(MUPIX8DAQ_INC_FOUND TRUE)
MESSAGE(STATUS "Found MUPIX8DAQ headers: ${MUPIX8DAQ_INCLUDE_DIR}")
ENDIF()
FIND_LIBRARY(MUPIX8DAQ_LIBRARY NAMES "libtelescope" HINTS "$ENV{MUPIX8DAQ}/build/library")
MESSAGE(STATUS "libMuPix8 => ${MUPIX8DAQ_LIBRARY}")
IF(MUPIX8DAQ_LIBRARY)
SET(MUPIX8DAQ_LIB_FOUND TRUE)
MESSAGE(STATUS "Found MuPix8DAQ library: ${MUPIX8DAQ_LIBRARY}")
ENDIF()
IF(MUPIX8DAQ_LIB_FOUND AND MUPIX8DAQ_INC_FOUND)
SET(MUPIX8DAQ_FOUND TRUE)
MESSAGE(STATUS "MUPIX8DAQ Found true")
ENDIF()
mark_as_advanced(MUPIX8DAQ_LIBRARY MUPIX8DAQ_INCLUDE_DIR)
......@@ -322,7 +322,7 @@ double Detector::getColumn(const PositionVector3D<Cartesian3D<double>> localPosi
}
// Function to get local position from row and column
PositionVector3D<Cartesian3D<double>> Detector::getLocalPosition(double row, double column) const {
PositionVector3D<Cartesian3D<double>> Detector::getLocalPosition(double column, double row) const {
return PositionVector3D<Cartesian3D<double>>(
m_pitch.X() * (column - m_nPixels.X() / 2.), m_pitch.Y() * (row - m_nPixels.Y() / 2.), 0.);
......
......@@ -203,8 +203,8 @@ namespace corryvreckan {
double getRow(PositionVector3D<Cartesian3D<double>> localPosition) const;
double getColumn(PositionVector3D<Cartesian3D<double>> localPosition) const;
// Function to get local position from row and column
PositionVector3D<Cartesian3D<double>> getLocalPosition(double row, double column) const;
// Function to get local position from column (x) and row (y) coordinates
PositionVector3D<Cartesian3D<double>> getLocalPosition(double column, double row) const;
/**
* Transformation from local (sensor) coordinates to in-pixel coordinates
......
......@@ -15,6 +15,7 @@ using namespace std;
AlignmentMillepede::AlignmentMillepede(Configuration config, std::vector<std::shared_ptr<Detector>> detectors)
: Module(std::move(config), std::move(detectors)) {
m_excludeDUT = m_config.get<bool>("exclude_dut", false);
m_numberOfTracksForAlignment = m_config.get<size_t>("number_of_tracks", 20000);
m_dofs = m_config.getArray<bool>("dofs", {});
m_nIterations = m_config.get<size_t>("iterations", 5);
......@@ -99,11 +100,11 @@ void AlignmentMillepede::finalise() {
size_t nPlanes = num_detectors();
for(const auto& det : get_detectors()) {
if(det->isDUT()) {
if(det->isDUT() && m_excludeDUT) {
nPlanes--;
}
}
LOG(INFO) << "Aligning " << nPlanes << "planes";
const size_t nParameters = 6 * nPlanes;
for(unsigned int iteration = 0; iteration < m_nIterations; ++iteration) {
// Define the constraint equations.
......
......@@ -153,6 +153,8 @@ namespace corryvreckan {
std::vector<unsigned int> m_fixedPlanes;
/// Flag to fix all degrees of freedom or only the translations.
bool m_fix_all;
/// It can be also reasonable to include the DUT in the alignemnt
bool m_excludeDUT;
};
} // namespace corryvreckan
......
......@@ -11,6 +11,8 @@ The Millepede algorthm allows a simultaneous fit of both the tracks and the alig
The modules stops if the convergence, i.e. the absolute sum of all corrections over the total number of parameters, is smaller than the configured value.
### Parameters
* `exclude_dut` : Exclude the DUT from the alignment procedure. Default value
is `false`.
* `number_of_tracks`: Number of tracks used in the alignment method chosen. Default value is `20000`.
* `iterations`: Number of times the chosen alignment method is to be iterated. Default value is `3`.
* `dofs`: Degrees of freedom to be aligned. This parameter should be given as vector of six boolean values for the parameters "Translation X", "Translation Y", "Translation Z", "Rotation X", "Rotation Y" and "Rotation Z". The default setting is an alignment of all parameters except for "Translation Z", i.e. `dofs = true, true, false, true, true, true`.
......@@ -25,4 +27,5 @@ The modules stops if the convergence, i.e. the absolute sum of all corrections o
[Millepede]
iterations = 10
dofs = true, true, false, true, true, true
exclude_dut = false
```
......@@ -409,7 +409,7 @@ StatusCode AnalysisCLICpix::run(std::shared_ptr<Clipboard> clipboard) {
// Get the pixel global position
LOG(TRACE) <<"New pixel, row = "<<(*itPixel)->row()<<", column = "<<(*itPixel)->column();
PositionVector3D<Cartesian3D<double> > pixelPositionLocal =
m_detector->getLocalPosition((*itPixel)->row(),(*itPixel)->column()); PositionVector3D<Cartesian3D<double> >
m_detector->getLocalPosition((*itPixel)->column(),(*itPixel)->row()); PositionVector3D<Cartesian3D<double> >
pixelPositionGlobal = *(m_detector->m_localToGlobal) * pixelPositionLocal;
// Check if it is close to the track
......@@ -586,7 +586,7 @@ void AnalysisCLICpix::fillResponseHistos(double trackInterceptX, double trackInt
Pixel* pixel = (*itp);
// Get the pixel local then global position
PositionVector3D<Cartesian3D<double>> pixelPositionLocal =
m_detector->getLocalPosition(pixel->row(), pixel->column());
m_detector->getLocalPosition(pixel->column(), pixel->row());
PositionVector3D<Cartesian3D<double>> pixelPositionGlobal = m_detector->localToGlobal(pixelPositionLocal);
// Fill the response histograms
......
......@@ -189,6 +189,14 @@ void AnalysisDUT::initialise() {
m_detector->nPixels().Y(),
0,
m_detector->nPixels().Y());
hUnassociatedTracksGlobalPosition = new TH2F("hUnassociatedTracksGlobalPosition",
"hUnassociatedTracksGlobalPosition; x / mm; y / mm",
200,
-10,
10,
200,
-10,
10);
}
StatusCode AnalysisDUT::run(std::shared_ptr<Clipboard> clipboard) {
......@@ -278,6 +286,7 @@ StatusCode AnalysisDUT::run(std::shared_ptr<Clipboard> clipboard) {
auto associated_clusters = track->associatedClusters();
if(std::find(associated_clusters.begin(), associated_clusters.end(), cluster) == associated_clusters.end()) {
LOG(DEBUG) << "No associated cluster found";
hUnassociatedTracksGlobalPosition->Fill(globalIntercept.X(), globalIntercept.Y());
continue;
}
......
......@@ -61,7 +61,7 @@ namespace corryvreckan {
TH2F* hAssociatedTracksGlobalPosition;
TH2F* hAssociatedTracksLocalPosition;
TH2F* hUnassociatedTracksGlobalPosition;
// Member variables
double spatialCut, m_timeCutFrameEdge;
double chi2ndofCut;
......
......@@ -17,6 +17,7 @@ Analysis module for CLICpix2 prototypes. This module is still work in progress,
* 2D Map of cluster sizes for associated clusters
* 2D Map of cluster ToT values from associated clusters
* 2D Map of associated hits
* 2D Map of tracks not associated to a cluster
* 2D Map of associated hits within the defined region-of-interest
* Distribution of pixel ToT values from associated clusters
* 2D Map of pixel ToT values from associated clusters
......
......@@ -20,7 +20,9 @@ AnalysisEfficiency::AnalysisEfficiency(Configuration config, std::shared_ptr<Det
m_detector = detector;
m_timeCutFrameEdge = m_config.get<double>("time_cut_frameedge", Units::get<double>(20, "ns"));
m_pixelTolerance = m_config.get<double>("pixel_tolerance", 1.);
m_chi2ndofCut = m_config.get<double>("chi2ndof_cut", 3.);
m_inpixelBinSize = m_config.get<double>("inpixel_bin_size", Units::get<double>(1.0, "um"));
}
void AnalysisEfficiency::initialise() {
......@@ -32,10 +34,10 @@ void AnalysisEfficiency::initialise() {
"#mum;y_{track} mod " + std::to_string(pitch_y) + "#mum;efficiency";
hPixelEfficiencyMap_trackPos = new TProfile2D("pixelEfficiencyMap_trackPos",
title.c_str(),
static_cast<int>(pitch_x),
static_cast<int>(ceil(pitch_x / m_inpixelBinSize)),
0,
pitch_x,
static_cast<int>(pitch_y),
static_cast<int>(ceil(pitch_y / m_inpixelBinSize)),
0,
pitch_y,
0,
......@@ -111,8 +113,8 @@ StatusCode AnalysisEfficiency::run(std::shared_ptr<Clipboard> clipboard) {
auto globalIntercept = m_detector->getIntercept(track);
auto localIntercept = m_detector->globalToLocal(globalIntercept);
if(!m_detector->hasIntercept(track, 0.5)) {
LOG(DEBUG) << " - track outside DUT area";
if(!m_detector->hasIntercept(track, m_pixelTolerance)) {
LOG(DEBUG) << " - track outside DUT area: " << localIntercept;
continue;
}
......
......@@ -45,7 +45,7 @@ namespace corryvreckan {
TProfile2D* hChipEfficiencyMap_clustPos;
TProfile2D* hGlobalEfficiencyMap_clustPos;
double m_chi2ndofCut, m_timeCutFrameEdge;
double m_chi2ndofCut, m_timeCutFrameEdge, m_pixelTolerance, m_inpixelBinSize;
int total_tracks, matched_tracks;
};
......
......@@ -8,8 +8,11 @@
This module measures the efficiency of the device under test by comparing its cluster positions with the interpolated track position at the DUT.
### Parameters
* `pixel_tolerance`: Parameter to discard tracks, which are extrapolated to
the edge of the DUT. Defaults to `1.`, which excludes column/row zero and max.
* `time_cut_frameedge`: Parameter to discard telescope tracks at the frame edges (start and end of the current event window). Defaults to `20ns`.
* `chi2ndof_cut`: Acceptance criterion for telescope tracks, defaults to a value of `3`.
* `inpixel_bin_size`: Parameter to set the bin size of the in-pixel 2D efficiency histogram. This should be given in units of distance and the same value is used in both axes. Defaults to `1.0um`.
### Plots produced
* 2D Map of in-pixel efficiency
......
......@@ -72,7 +72,7 @@ StatusCode Clustering4D::run(std::shared_ptr<Clipboard> clipboard) {
cluster->addPixel(pixel);
double clusterTime = pixel->timestamp();
used[pixel] = true;
LOG(DEBUG) << "Adding pixel: " << pixel->row() << "," << pixel->column();
LOG(DEBUG) << "Adding pixel: " << pixel->column() << "," << pixel->row();
size_t nPixels = 0;
while(cluster->size() != nPixels) {
......@@ -99,7 +99,7 @@ StatusCode Clustering4D::run(std::shared_ptr<Clipboard> clipboard) {
cluster->addPixel(neighbour);
clusterTime = neighbour->timestamp();
used[neighbour] = true;
LOG(DEBUG) << "Adding pixel: " << neighbour->row() << "," << neighbour->column() << " time "
LOG(DEBUG) << "Adding pixel: " << neighbour->column() << "," << neighbour->row() << " time "
<< Units::display(neighbour->timestamp(), {"ns", "us", "s"});
}
}
......
......@@ -37,6 +37,16 @@ void ClusteringSpatial::initialise() {
400,
-m_detector->size().Y() / 1.5,
m_detector->size().Y() / 1.5);
title = m_detector->name() + " Cluster Position (Local);x [px];y [px];events";
clusterPositionLocal = new TH2F("clusterPositionLocal",
title.c_str(),
m_detector->nPixels().X(),
-m_detector->nPixels().X() / 2.,
m_detector->nPixels().X() / 2.,
m_detector->nPixels().Y(),
-m_detector->nPixels().Y() / 2.,
m_detector->nPixels().Y() / 2.);
}
StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
......@@ -60,7 +70,7 @@ StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
// Pre-fill the hitmap with pixels
for(auto pixel : (*pixels)) {
hitmap[pixel->row()][pixel->column()] = pixel;
hitmap[pixel->column()][pixel->row()] = pixel;
}
for(auto pixel : (*pixels)) {
......@@ -94,18 +104,18 @@ StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
}
// If no pixel in this position, or is already in a cluster, do nothing
if(!hitmap[row][col]) {
if(!hitmap[col][row]) {
continue;
}
if(used[hitmap[row][col]]) {
if(used[hitmap[col][row]]) {
continue;
}
// Otherwise add the pixel to the cluster and store it as a found
// neighbour
cluster->addPixel(hitmap[row][col]);
used[hitmap[row][col]] = true;
neighbours.push_back(hitmap[row][col]);
cluster->addPixel(hitmap[col][row]);
used[hitmap[col][row]] = true;
neighbours.push_back(hitmap[col][row]);
}
}
......@@ -127,7 +137,8 @@ StatusCode ClusteringSpatial::run(std::shared_ptr<Clipboard> clipboard) {
clusterWidthColumn->Fill(cluster->columnWidth());
clusterTot->Fill(cluster->tot() * 1e-3);
clusterPositionGlobal->Fill(cluster->global().x(), cluster->global().y());
clusterPositionLocal->Fill(cluster->local().x(), cluster->local().y());
LOG(DEBUG) << "cluster local: " << cluster->local();
deviceClusters->push_back(cluster);
}
......@@ -159,14 +170,14 @@ void ClusteringSpatial::calculateClusterCentre(Cluster* cluster) {
tot += pixel->adc();
row += (pixel->row() * pixel->adc());
column += (pixel->column() * pixel->adc());
LOG(DEBUG) << "- pixel row, col: " << pixel->row() << "," << pixel->column();
LOG(DEBUG) << "- pixel col, row: " << pixel->column() << "," << pixel->row();
}
// Row and column positions are tot-weighted
row /= (tot > 0 ? tot : 1);
column /= (tot > 0 ? tot : 1);
LOG(DEBUG) << "- cluster row, col: " << row << "," << column;
LOG(DEBUG) << "- cluster col, row: " << column << "," << row;
// Create object with local cluster position
PositionVector3D<Cartesian3D<double>> positionLocal(m_detector->pitch().X() * (column - m_detector->nPixels().X() / 2.),
......
......@@ -33,6 +33,7 @@ namespace corryvreckan {
TH1F* clusterWidthColumn;
TH1F* clusterTot;
TH2F* clusterPositionGlobal;
TH2F* clusterPositionLocal;
};
} // namespace corryvreckan
#endif // ClusteringSpatial_H
......@@ -18,6 +18,7 @@ For each detector the following plots are produced:
* Cluster width (columns, in Y) histogram
* Cluster ToT histogram
* 2D cluster positions in global coordinates
* 2D cluster positions in local coordinates
### Usage
```toml
......
/**
* @file
* @brief Implementation of [Dummy] module
* @copyright Copyright (c) 2017 CERN and the Allpix Squared authors.
* Copyright (c) 2019 CERN and the Corryvreckan 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.
......
/**
* @file
* @brief Definition of [Dummy] module
* @copyright Copyright (c) 2017 CERN and the Allpix Squared authors.
* Copyright (c) 2019 CERN and the Corryvreckan 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.
......
......@@ -321,7 +321,7 @@ Pixels* EventLoaderATLASpix::read_caribou_data(double start_time, double end_tim
<< "\tTS_FULL: " << hit_ts << "\t" << Units::display(timestamp, {"s", "us", "ns"})
<< "\tTOT: " << tot; // << "\t" << Units::display(tot_ns, {"s", "us", "ns"});
Pixel* pixel = new Pixel(m_detector->name(), row, col, tot, timestamp);
Pixel* pixel = new Pixel(m_detector->name(), col, row, tot, timestamp);
LOG(DEBUG) << "PIXEL:\t" << *pixel;
pixels->push_back(pixel);
......@@ -532,7 +532,7 @@ Pixels* EventLoaderATLASpix::read_legacy_data(double, double) {
// Convert TOA to nanoseconds:
toa_timestamp /= (4096. * 0.04);
Pixel* pixel = new Pixel(m_detector->name(), row, col, tot, toa_timestamp);
Pixel* pixel = new Pixel(m_detector->name(), col, row, tot, toa_timestamp);
pixel->setCharge(cal_tot);
pixels->push_back(pixel);
}
......
Supports Markdown
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