Commit 88cb935b authored by Jin Zhang's avatar Jin Zhang
Browse files

function name() and type()

parent 5ee8478c
......@@ -124,11 +124,11 @@ double Detector::getTimeResolution() const {
}
}
std::string Detector::name() const {
std::string Detector::Name() const {
return m_detectorName;
}
std::string Detector::type() const {
std::string Detector::Type() const {
return m_detectorType;
}
......@@ -160,7 +160,7 @@ void Detector::update() {
Configuration Detector::getConfiguration() const {
Configuration config(name());
Configuration config(Name());
config.set("type", m_detectorType);
// Store the role of the detector
......
......@@ -84,13 +84,13 @@ namespace corryvreckan {
* @brief Get type of the detector
* @return Type of the detector model
*/
std::string type() const;
std::string Type() const;
/**
* @brief Get name of the detector
* @return Detector name
*/
std::string name() const;
std::string Name() const;
/**
* @brief Check whether detector is registered as reference
......
......@@ -182,7 +182,7 @@ PositionVector3D<Cartesian3D<double>> PlanarDetector::getIntercept(const Track*
// FIXME: this is else statement can only be temporary
if(track->getType() == "gbl") {
return track->state(name());
return track->state(Name());
} else {
// Get the distance from the plane to the track initial state
double distance = (m_origin.X() - track->state(m_detectorName).X()) * m_normal.X();
......
......@@ -14,7 +14,7 @@
using namespace corryvreckan;
InvalidSettingError::InvalidSettingError(const Detector* detector, const std::string& key, const std::string& reason) {
error_message_ = "Setting '" + key + "' of detector '" + detector->name() + "' is not valid";
error_message_ = "Setting '" + key + "' of detector '" + detector->Name() + "' is not valid";
if(!reason.empty()) {
error_message_ += ": " + reason;
}
......
......@@ -117,7 +117,7 @@ void Module::set_ROOT_directory(TDirectory* directory) {
std::shared_ptr<Detector> Module::get_detector(std::string name) {
auto it = find_if(
m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) { return obj->name() == name; });
m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) { return obj->Name() == name; });
if(it == m_detectors.end()) {
throw ModuleError("Device with detector ID " + name + " is not registered.");
}
......@@ -131,7 +131,7 @@ std::shared_ptr<Detector> Module::get_reference() {
bool Module::has_detector(std::string name) {
auto it = find_if(
m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) { return obj->name() == name; });
m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) { return obj->Name() == name; });
if(it == m_detectors.end()) {
return false;
}
......
......@@ -54,7 +54,7 @@ void ModuleManager::load_detectors() {
// Check if we have a duplicate:
if(std::find_if(m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) {
return obj->name() == name;
return obj->Name() == name;
}) != m_detectors.end()) {
throw InvalidValueError(
global_config, "detectors_file", "Detector " + detector_section.getName() + " defined twice");
......@@ -305,7 +305,7 @@ std::vector<std::string> ModuleManager::get_type_vector(char* type_tokens) {
std::shared_ptr<Detector> ModuleManager::get_detector(std::string name) {
auto it = find_if(
m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) { return obj->name() == name; });
m_detectors.begin(), m_detectors.end(), [&name](std::shared_ptr<Detector> obj) { return obj->Name() == name; });
return (it != m_detectors.end() ? (*it) : nullptr);
}
......@@ -399,8 +399,8 @@ ModuleManager::create_detector_modules(void* library, Configuration config, bool
continue;
}
LOG(TRACE) << "Preparing \"name\" instance for " << det->name();
instantiations.emplace_back(det, ModuleIdentifier(module_base_name, det->name(), 0));
LOG(TRACE) << "Preparing \"name\" instance for " << det->Name();
instantiations.emplace_back(det, ModuleIdentifier(module_base_name, det->Name(), 0));
// Save the name (to not instantiate it again later)
module_names.insert(name);
}
......@@ -423,11 +423,11 @@ ModuleManager::create_detector_modules(void* library, Configuration config, bool
}
for(auto& det : m_detectors) {
auto detectortype = det->type();
auto detectortype = det->Type();
std::transform(detectortype.begin(), detectortype.end(), detectortype.begin(), ::tolower);
// Skip all that were already added by name
if(module_names.find(det->name()) != module_names.end()) {
if(module_names.find(det->Name()) != module_names.end()) {
continue;
}
for(auto& type : ctypes) {
......@@ -436,8 +436,8 @@ ModuleManager::create_detector_modules(void* library, Configuration config, bool
continue;
}
LOG(TRACE) << "Preparing \"type\" instance for " << det->name();
instantiations.emplace_back(det, ModuleIdentifier(module_base_name, det->name(), 1));
LOG(TRACE) << "Preparing \"type\" instance for " << det->Name();
instantiations.emplace_back(det, ModuleIdentifier(module_base_name, det->Name(), 1));
}
}
instances_created = !ctypes.empty();
......@@ -446,8 +446,8 @@ ModuleManager::create_detector_modules(void* library, Configuration config, bool
// Create for all detectors if no name / type provided
if(!instances_created) {
for(auto& det : m_detectors) {
LOG(TRACE) << "Preparing \"other\" instance for " << det->name();
instantiations.emplace_back(det, ModuleIdentifier(module_base_name, det->name(), 2));
LOG(TRACE) << "Preparing \"other\" instance for " << det->Name();
instantiations.emplace_back(det, ModuleIdentifier(module_base_name, det->Name(), 2));
}
}
......@@ -463,7 +463,7 @@ ModuleManager::create_detector_modules(void* library, Configuration config, bool
}
// Do not instantiate module if detector type is not mentioned as supported:
auto detectortype = detector->type();
auto detectortype = detector->Type();
std::transform(detectortype.begin(), detectortype.end(), detectortype.begin(), ::tolower);
if(!types.empty() && std::find(types.begin(), types.end(), detectortype) == types.end()) {
LOG(TRACE) << "Skipping instantiation \"" << identifier.getUniqueName() << "\", detector type mismatch";
......
......@@ -36,12 +36,12 @@ AlignmentDUTResidual::AlignmentDUTResidual(Configuration config, std::shared_ptr
m_maxAssocClusters = m_config.get<size_t>("max_associated_clusters", 1);
m_maxTrackChi2 = m_config.get<double>("max_track_chi2ndof", 10.);
LOG(INFO) << "Aligning detector \"" << m_detector->name() << "\"";
LOG(INFO) << "Aligning detector \"" << m_detector->Name() << "\"";
}
void AlignmentDUTResidual::initialise() {
auto detname = m_detector->name();
auto detname = m_detector->Name();
std::string title = detname + " Residuals X;x_{track}-x [#mum];events";
residualsXPlot = new TH1F("residualsX", title.c_str(), 1000, -500, 500);
title = detname + " Residuals Y;y_{track}-y [#mum];events";
......@@ -89,7 +89,7 @@ StatusCode AlignmentDUTResidual::run(std::shared_ptr<Clipboard> clipboard) {
// Find the cluster that needs to have its position recalculated
for(auto& associatedCluster : track->associatedClusters()) {
if(associatedCluster->detectorID() != m_detector->name()) {
if(associatedCluster->detectorID() != m_detector->Name()) {
continue;
}
// Local position of the cluster
......@@ -137,7 +137,7 @@ void AlignmentDUTResidual::MinimiseResiduals(Int_t&, Double_t*, Double_t& result
// Apply new alignment conditions
globalDetector->update();
LOG(DEBUG) << "Updated parameters for " << globalDetector->name();
LOG(DEBUG) << "Updated parameters for " << globalDetector->Name();
// The chi2 value to be returned
result = 0.;
......@@ -152,7 +152,7 @@ void AlignmentDUTResidual::MinimiseResiduals(Int_t&, Double_t*, Double_t& result
// Find the cluster that needs to have its position recalculated
for(auto& associatedCluster : track->associatedClusters()) {
if(associatedCluster->detectorID() != globalDetector->name()) {
if(associatedCluster->detectorID() != globalDetector->Name()) {
continue;
}
......@@ -210,7 +210,7 @@ void AlignmentDUTResidual::finalise() {
arglist[1] = 0.001; // tolerance
globalDetector = m_detector;
auto name = m_detector->name();
auto name = m_detector->Name();
size_t n_associatedClusters = 0;
// count associated clusters:
......@@ -273,12 +273,12 @@ void AlignmentDUTResidual::finalise() {
m_detector->rotation(
XYZVector(residualFitter->GetParameter(3), residualFitter->GetParameter(4), residualFitter->GetParameter(5)));
LOG(INFO) << m_detector->name() << "/" << iteration << " dT"
LOG(INFO) << m_detector->Name() << "/" << iteration << " dT"
<< Units::display(m_detector->displacement() - old_position, {"mm", "um"}) << " dR"
<< Units::display(m_detector->rotation() - old_orientation, {"deg"});
}
LOG(STATUS) << m_detector->name() << " new alignment: " << std::endl
LOG(STATUS) << m_detector->Name() << " new alignment: " << std::endl
<< "T" << Units::display(m_detector->displacement(), {"mm", "um"}) << " R"
<< Units::display(m_detector->rotation(), {"deg"});
}
......@@ -55,7 +55,7 @@ void AlignmentMillepede::initialise() {
if(det->isDUT() && m_excludeDUT) {
continue;
}
m_millePlanes[det->name()] = index;
m_millePlanes[det->Name()] = index;
++index;
}
......@@ -105,7 +105,7 @@ void AlignmentMillepede::finalise() {
nPlanes--;
}
if(det->isAuxiliary()) {
LOG(INFO) << "Excluding auxiliary detector " << det->name();
LOG(INFO) << "Excluding auxiliary detector " << det->Name();
nPlanes--;
}
}
......@@ -210,7 +210,7 @@ void AlignmentMillepede::setConstraints(const size_t nPlanes) {
if(det->isDUT() && m_excludeDUT) {
continue;
}
const unsigned int i = m_millePlanes[det->name()];
const unsigned int i = m_millePlanes[det->Name()];
const double sz = (det->displacement().Z() - avgz) / varz;
ftx[i] = 1.0;
fty[i + nPlanes] = 1.0;
......@@ -307,7 +307,7 @@ bool AlignmentMillepede::putTrack(Track* track, const size_t nPlanes) {
const double errx = cluster->errorX();
const double erry = cluster->errorY();
// Get the internal plane index in Millepede.
const unsigned int plane = m_millePlanes[detector->name()];
const unsigned int plane = m_millePlanes[detector->Name()];
// Set the local derivatives for the X equation.
std::vector<double> derlc = {1., zg, 0., 0.};
// Set the global derivatives (see LHCb-2005-101) for the X equation.
......@@ -593,7 +593,7 @@ void AlignmentMillepede::updateGeometry() {
if(det->isDUT() && m_excludeDUT) {
continue;
}
auto plane = m_millePlanes[det->name()];
auto plane = m_millePlanes[det->Name()];
det->displacement(XYZPoint(det->displacement().X() + m_dparm[plane + 0 * nPlanes],
det->displacement().Y() + m_dparm[plane + 1 * nPlanes],
......
......@@ -106,7 +106,7 @@ void AlignmentTrackChi2::MinimiseTrackChi2(Int_t&, Double_t*, Double_t& result,
// Find the cluster that needs to have its position recalculated
for(size_t iTrackCluster = 0; iTrackCluster < trackClusters.size(); iTrackCluster++) {
Cluster* trackCluster = trackClusters[iTrackCluster];
if(globalDetector->name() != trackCluster->detectorID()) {
if(globalDetector->Name() != trackCluster->detectorID()) {
continue;
}
......@@ -165,7 +165,7 @@ void AlignmentTrackChi2::finalise() {
int det = 0;
for(auto& detector : get_detectors()) {
string detectorID = detector->name();
string detectorID = detector->Name();
// Do not align the reference plane
if(detector->isReference() || detector->isDUT() || detector->isAuxiliary()) {
......@@ -233,7 +233,7 @@ void AlignmentTrackChi2::finalise() {
rotZ[detectorID].push_back(
static_cast<double>(Units::convert(detector->rotation().Z() - old_orientation.Z(), "deg")));
LOG(INFO) << detector->name() << "/" << iteration << " dT"
LOG(INFO) << detector->Name() << "/" << iteration << " dT"
<< Units::display(detector->displacement() - old_position, {"mm", "um"}) << " dR"
<< Units::display(detector->rotation() - old_orientation, {"deg"});
......@@ -264,7 +264,7 @@ void AlignmentTrackChi2::finalise() {
continue;
}
LOG(STATUS) << detector->name() << " new alignment: " << std::endl
LOG(STATUS) << detector->Name() << " new alignment: " << std::endl
<< "T" << Units::display(detector->displacement(), {"mm", "um"}) << " R"
<< Units::display(detector->rotation(), {"deg"});
......@@ -272,39 +272,39 @@ void AlignmentTrackChi2::finalise() {
std::vector<double> iterations(nIterations);
std::iota(std::begin(iterations), std::end(iterations), 0);
std::string name = "alignment_correction_displacementX_" + detector->name();
align_correction_shiftX[detector->name()] =
new TGraph(static_cast<int>(shiftsX[detector->name()].size()), &iterations[0], &shiftsX[detector->name()][0]);
align_correction_shiftX[detector->name()]->GetXaxis()->SetTitle("# iteration");
align_correction_shiftX[detector->name()]->GetYaxis()->SetTitle("correction [#mum]");
align_correction_shiftX[detector->name()]->Write(name.c_str());
name = "alignment_correction_displacementY_" + detector->name();
align_correction_shiftY[detector->name()] =
new TGraph(static_cast<int>(shiftsY[detector->name()].size()), &iterations[0], &shiftsY[detector->name()][0]);
align_correction_shiftY[detector->name()]->GetXaxis()->SetTitle("# iteration");
align_correction_shiftY[detector->name()]->GetYaxis()->SetTitle("correction [#mum]");
align_correction_shiftY[detector->name()]->Write(name.c_str());
name = "alignment_correction_rotationX_" + detector->name();
align_correction_rotX[detector->name()] =
new TGraph(static_cast<int>(rotX[detector->name()].size()), &iterations[0], &rotX[detector->name()][0]);
align_correction_rotX[detector->name()]->GetXaxis()->SetTitle("# iteration");
align_correction_rotX[detector->name()]->GetYaxis()->SetTitle("correction [deg]");
align_correction_rotX[detector->name()]->Write(name.c_str());
name = "alignment_correction_rotationY_" + detector->name();
align_correction_rotY[detector->name()] =
new TGraph(static_cast<int>(rotY[detector->name()].size()), &iterations[0], &rotY[detector->name()][0]);
align_correction_rotY[detector->name()]->GetXaxis()->SetTitle("# iteration");
align_correction_rotY[detector->name()]->GetYaxis()->SetTitle("correction [deg]");
align_correction_rotY[detector->name()]->Write(name.c_str());
name = "alignment_correction_rotationZ_" + detector->name();
align_correction_rotZ[detector->name()] =
new TGraph(static_cast<int>(rotZ[detector->name()].size()), &iterations[0], &rotZ[detector->name()][0]);
align_correction_rotZ[detector->name()]->GetXaxis()->SetTitle("# iteration");
align_correction_rotZ[detector->name()]->GetYaxis()->SetTitle("correction [deg]");
align_correction_rotZ[detector->name()]->Write(name.c_str());
std::string name = "alignment_correction_displacementX_" + detector->Name();
align_correction_shiftX[detector->Name()] =
new TGraph(static_cast<int>(shiftsX[detector->Name()].size()), &iterations[0], &shiftsX[detector->Name()][0]);
align_correction_shiftX[detector->Name()]->GetXaxis()->SetTitle("# iteration");
align_correction_shiftX[detector->Name()]->GetYaxis()->SetTitle("correction [#mum]");
align_correction_shiftX[detector->Name()]->Write(name.c_str());
name = "alignment_correction_displacementY_" + detector->Name();
align_correction_shiftY[detector->Name()] =
new TGraph(static_cast<int>(shiftsY[detector->Name()].size()), &iterations[0], &shiftsY[detector->Name()][0]);
align_correction_shiftY[detector->Name()]->GetXaxis()->SetTitle("# iteration");
align_correction_shiftY[detector->Name()]->GetYaxis()->SetTitle("correction [#mum]");
align_correction_shiftY[detector->Name()]->Write(name.c_str());
name = "alignment_correction_rotationX_" + detector->Name();
align_correction_rotX[detector->Name()] =
new TGraph(static_cast<int>(rotX[detector->Name()].size()), &iterations[0], &rotX[detector->Name()][0]);
align_correction_rotX[detector->Name()]->GetXaxis()->SetTitle("# iteration");
align_correction_rotX[detector->Name()]->GetYaxis()->SetTitle("correction [deg]");
align_correction_rotX[detector->Name()]->Write(name.c_str());
name = "alignment_correction_rotationY_" + detector->Name();
align_correction_rotY[detector->Name()] =
new TGraph(static_cast<int>(rotY[detector->Name()].size()), &iterations[0], &rotY[detector->Name()][0]);
align_correction_rotY[detector->Name()]->GetXaxis()->SetTitle("# iteration");
align_correction_rotY[detector->Name()]->GetYaxis()->SetTitle("correction [deg]");
align_correction_rotY[detector->Name()]->Write(name.c_str());
name = "alignment_correction_rotationZ_" + detector->Name();
align_correction_rotZ[detector->Name()] =
new TGraph(static_cast<int>(rotZ[detector->Name()].size()), &iterations[0], &rotZ[detector->Name()][0]);
align_correction_rotZ[detector->Name()]->GetXaxis()->SetTitle("# iteration");
align_correction_rotZ[detector->Name()]->GetYaxis()->SetTitle("correction [deg]");
align_correction_rotZ[detector->Name()]->Write(name.c_str());
}
}
......@@ -120,7 +120,7 @@ void AnalysisDUT::initialise() {
std::string mod_axes = "in-pixel x_{track} [#mum];in-pixel y_{track} [#mum];";
// cut flow histogram
std::string title = m_detector->name() + ": number of tracks discarded by different cuts;cut type;tracks";
std::string title = m_detector->Name() + ": number of tracks discarded by different cuts;cut type;tracks";
hCutHisto = new TH1F("hCutHisto", title.c_str(), 4, 1, 5);
hCutHisto->GetXaxis()->SetBinLabel(1, "High Chi2");
hCutHisto->GetXaxis()->SetBinLabel(2, "Outside DUT area");
......
......@@ -39,7 +39,7 @@ void AnalysisEfficiency::initialise() {
throw InvalidValueError(m_config, "inpixel_bin_size", "Too many bins for in-pixel histograms.");
}
std::string title =
m_detector->name() + " Pixel efficiency map;in-pixel x_{track} [#mum];in-pixel y_{track} #mum;efficiency";
m_detector->Name() + " Pixel efficiency map;in-pixel x_{track} [#mum];in-pixel y_{track} #mum;efficiency";
hPixelEfficiencyMap_trackPos = new TProfile2D("pixelEfficiencyMap_trackPos",
title.c_str(),
nbins_x,
......@@ -50,7 +50,7 @@ void AnalysisEfficiency::initialise() {
pitch_y / 2.,
0,
1);
title = m_detector->name() + " Chip efficiency map;x [px];y [px];efficiency";
title = m_detector->Name() + " Chip efficiency map;x [px];y [px];efficiency";
hChipEfficiencyMap_trackPos = new TProfile2D("chipEfficiencyMap_trackPos",
title.c_str(),
m_detector->nPixels().X(),
......@@ -61,7 +61,7 @@ void AnalysisEfficiency::initialise() {
m_detector->nPixels().Y() - 0.5,
0,
1);
title = m_detector->name() + " Global efficiency map;x [mm];y [mm];efficiency";
title = m_detector->Name() + " Global efficiency map;x [mm];y [mm];efficiency";
hGlobalEfficiencyMap_trackPos = new TProfile2D("globalEfficiencyMap_trackPos",
title.c_str(),
300,
......@@ -72,7 +72,7 @@ void AnalysisEfficiency::initialise() {
1.5 * m_detector->size().Y(),
0,
1);
title = m_detector->name() + " Chip efficiency map;x [px];y [px];efficiency";
title = m_detector->Name() + " Chip efficiency map;x [px];y [px];efficiency";
hChipEfficiencyMap_clustPos = new TProfile2D("chipEfficiencyMap_clustPos",
title.c_str(),
m_detector->nPixels().X(),
......@@ -83,7 +83,7 @@ void AnalysisEfficiency::initialise() {
m_detector->nPixels().Y() - 0.5,
0,
1);
title = m_detector->name() + " Global efficiency map;x [mm];y [mm];efficiency";
title = m_detector->Name() + " Global efficiency map;x [mm];y [mm];efficiency";
hGlobalEfficiencyMap_clustPos = new TProfile2D("globalEfficiencyMap_clustPos",
title.c_str(),
300,
......@@ -111,11 +111,11 @@ void AnalysisEfficiency::initialise() {
hTrackTimeToPrevHit_notmatched = new TH1D(
"trackTimeToPrevHit_notmatched", "trackTimeToPrevHit_notmatched;time to prev hit [us];# events", 1e6, 0, 1e6);
title = m_detector->name() + "time difference to previous track (if this has assoc cluster)";
title = m_detector->Name() + "time difference to previous track (if this has assoc cluster)";
hTimeDiffPrevTrack_assocCluster = new TH1D("timeDiffPrevTrack_assocCluster", title.c_str(), 11000, -1000, 10000);
hTimeDiffPrevTrack_assocCluster->GetXaxis()->SetTitle("time diff [#mus]");
hTimeDiffPrevTrack_assocCluster->GetYaxis()->SetTitle("events");
title = m_detector->name() + "time difference to previous track (if this has no assoc cluster)";
title = m_detector->Name() + "time difference to previous track (if this has no assoc cluster)";
hTimeDiffPrevTrack_noAssocCluster = new TH1D("timeDiffPrevTrack_noAssocCluster", title.c_str(), 11000, -1000, 10000);
hTimeDiffPrevTrack_noAssocCluster->GetXaxis()->SetTitle("time diff [#mus]");
hTimeDiffPrevTrack_noAssocCluster->GetYaxis()->SetTitle("events");
......@@ -256,7 +256,7 @@ StatusCode AnalysisEfficiency::run(std::shared_ptr<Clipboard> clipboard) {
auto ymod = static_cast<double>(Units::convert(inpixel.Y(), "um"));
// Get the DUT clusters from the clipboard
auto clusters = clipboard->getData<Cluster>(m_detector->name());
auto clusters = clipboard->getData<Cluster>(m_detector->Name());
if(clusters == nullptr) {
LOG(DEBUG) << " - no DUT clusters";
} else {
......@@ -329,9 +329,9 @@ StatusCode AnalysisEfficiency::run(std::shared_ptr<Clipboard> clipboard) {
// Before going to the next event, loop over all pixels (all hits incl. noise)
// and fill matrix with timestamps of previous pixels.
auto pixels = clipboard->getData<Pixel>(m_detector->name());
auto pixels = clipboard->getData<Pixel>(m_detector->Name());
if(pixels == nullptr) {
LOG(DEBUG) << "Detector " << m_detector->name() << " does not have any pixels on the clipboard";
LOG(DEBUG) << "Detector " << m_detector->Name() << " does not have any pixels on the clipboard";
return StatusCode::Success;
}
for(auto& pixel : (*pixels)) {
......@@ -354,7 +354,7 @@ void AnalysisEfficiency::finalise() {
<< "Accepted tracks: " << total_tracks;
double totalEff = 100 * static_cast<double>(matched_tracks) / (total_tracks > 0 ? total_tracks : 1);
LOG(STATUS) << "Total efficiency of detector " << m_detector->name() << ": " << totalEff << "%, measured with "
LOG(STATUS) << "Total efficiency of detector " << m_detector->Name() << ": " << totalEff << "%, measured with "
<< matched_tracks << "/" << total_tracks << " matched/total tracks";
totalEfficiency->SetName((to_string(totalEff) + " %").c_str());
......
......@@ -101,7 +101,7 @@ StatusCode AnalysisPowerPulsing::run(std::shared_ptr<Clipboard> clipboard) {
*/
// Now update the power pulsing with any new signals
auto spidrData = clipboard->getData<SpidrSignal>(m_detector->name());
auto spidrData = clipboard->getData<SpidrSignal>(m_detector->Name());
// If there are new signals
if(spidrData != nullptr) {
......@@ -145,7 +145,7 @@ StatusCode AnalysisPowerPulsing::run(std::shared_ptr<Clipboard> clipboard) {
}
// Get the DUT clusters from the clipboard
auto clusters = clipboard->getData<Cluster>(m_detector->name());
auto clusters = clipboard->getData<Cluster>(m_detector->Name());
if(clusters == nullptr) {
LOG(DEBUG) << "No DUT clusters on the clipboard!";
return StatusCode::Success;
......
......@@ -29,35 +29,35 @@ void AnalysisTelescope::initialise() {
// position of the DUTs
for(auto& detector : get_detectors()) {
TDirectory* directory = getROOTDirectory();
TDirectory* local_directory = directory->mkdir(detector->name().c_str());
TDirectory* local_directory = directory->mkdir(detector->Name().c_str());
if(local_directory == nullptr) {
throw RuntimeError("Cannot create or access local ROOT directory for module " + this->getUniqueName());
}
local_directory->cd();
if(detector->isDUT()) {
std::string title = detector->name() + " Telescope resolution X;x_{track}-x_{MC} [mm];events";
telescopeResolutionX[detector->name()] = new TH1F("telescopeResolutionX", title.c_str(), 600, -0.2, 0.2);
title = detector->name() + " Telescope resolution Y;y_{track}-y_{MC} [mm];events";
telescopeResolutionY[detector->name()] = new TH1F("telescopeResolutionY", title.c_str(), 600, -0.2, 0.2);
std::string title = detector->Name() + " Telescope resolution X;x_{track}-x_{MC} [mm];events";
telescopeResolutionX[detector->Name()] = new TH1F("telescopeResolutionX", title.c_str(), 600, -0.2, 0.2);
title = detector->Name() + " Telescope resolution Y;y_{track}-y_{MC} [mm];events";
telescopeResolutionY[detector->Name()] = new TH1F("telescopeResolutionY", title.c_str(), 600, -0.2, 0.2);
} else {
std::string title = detector->name() + " Biased residual X (local);x_{track}-x_{cluster} [mm];events";
telescopeResidualsLocalX[detector->name()] = new TH1F("residualX_local", title.c_str(), 400, -0.2, 0.2);
title = detector->name() + " Biased residual Y (local);y_{track}-y_{cluster} [mm];events";
telescopeResidualsLocalY[detector->name()] = new TH1F("residualY_local", title.c_str(), 400, -0.2, 0.2);
title = detector->name() + " Biased residual X (global);x_{track}-x_{cluster} [mm];events";
telescopeResidualsX[detector->name()] = new TH1F("residualX_global", title.c_str(), 400, -0.2, 0.2);
title = detector->name() + " Biased residual Y (global);y_{track}-y_{cluster} [mm];events";
telescopeResidualsY[detector->name()] = new TH1F("residualY_global", title.c_str(), 400, -0.2, 0.2);
title = detector->name() + " Biased MC residual X (local);x_{track}-x_{MC} [mm];events";
telescopeMCresidualsLocalX[detector->name()] = new TH1F("residualX_MC_local", title.c_str(), 400, -0.2, 0.2);
title = detector->name() + " Biased MC residual Y (local);y_{track}-y_{MC} [mm];events";
telescopeMCresidualsLocalY[detector->name()] = new TH1F("residualY_MC_local", title.c_str(), 400, -0.2, 0.2);
title = detector->name() + " Biased MC residual X (global);x_{track}-x_{MC} [mm];events";
telescopeMCresidualsX[detector->name()] = new TH1F("residualX_MC_global", title.c_str(), 400, -0.2, 0.2);
title = detector->name() + " Biased MC residual Y (global);y_{track}-y_{MC} [mm];events";
telescopeMCresidualsY[detector->name()] = new TH1F("residualY_MC_global", title.c_str(), 400, -0.2, 0.2);
std::string title = detector->Name() + " Biased residual X (local);x_{track}-x_{cluster} [mm];events";
telescopeResidualsLocalX[detector->Name()] = new TH1F("residualX_local", title.c_str(), 400, -0.2, 0.2);
title = detector->Name() + " Biased residual Y (local);y_{track}-y_{cluster} [mm];events";
telescopeResidualsLocalY[detector->Name()] = new TH1F("residualY_local", title.c_str(), 400, -0.2, 0.2);
title = detector->Name() + " Biased residual X (global);x_{track}-x_{cluster} [mm];events";
telescopeResidualsX[detector->Name()] = new TH1F("residualX_global", title.c_str(), 400, -0.2, 0.2);
title = detector->Name() + " Biased residual Y (global);y_{track}-y_{cluster} [mm];events";
telescopeResidualsY[detector->Name()] = new TH1F("residualY_global", title.c_str(), 400, -0.2, 0.2);
title = detector->Name() + " Biased MC residual X (local);x_{track}-x_{MC} [mm];events";
telescopeMCresidualsLocalX[detector->Name()] = new TH1F("residualX_MC_local", title.c_str(), 400, -0.2, 0.2);
title = detector->Name() + " Biased MC residual Y (local);y_{track}-y_{MC} [mm];events";
telescopeMCresidualsLocalY[detector->Name()] = new TH1F("residualY_MC_local", title.c_str(), 400, -0.2, 0.2);
title = detector->Name() + " Biased MC residual X (global);x_{track}-x_{MC} [mm];events";
telescopeMCresidualsX[detector->Name()] = new TH1F("residualX_MC_global", title.c_str(), 400, -0.2, 0.2);
title = detector->Name() + " Biased MC residual Y (global);y_{track}-y_{MC} [mm];events";
telescopeMCresidualsY[detector->Name()] = new TH1F("residualY_MC_global", title.c_str(), 400, -0.2, 0.2);
}
directory->cd();
......@@ -105,7 +105,7 @@ StatusCode AnalysisTelescope::run(std::shared_ptr<Clipboard> clipboard) {
continue;
}
auto name = detector->name();
auto name = detector->Name();
ROOT::Math::XYZPoint intercept = track->intercept(cluster->global().z());
auto interceptLocal = detector->globalToLocal(intercept);
telescopeResidualsLocalX[name]->Fill(cluster->local().x() - interceptLocal.X());
......@@ -133,7 +133,7 @@ StatusCode AnalysisTelescope::run(std::shared_ptr<Clipboard> clipboard) {
}
// Get the MC particles from the clipboard
auto mcParticles = clipboard->getData<MCParticle>(detector->name());
auto mcParticles = clipboard->getData<MCParticle>(detector->Name());
if(mcParticles == nullptr) {
continue;
}
......@@ -142,9 +142,9 @@ StatusCode AnalysisTelescope::run(std::shared_ptr<Clipboard> clipboard) {
auto interceptLocal = detector->globalToLocal(intercept);