Skip to content
Merged
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
48 changes: 24 additions & 24 deletions Detectors/MUON/MCH/Align/src/AlignmentSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ class AlignmentTask
}

doReAlign = ic.options().get<bool>("do-realign");
if (doReAlign) {
LOG(info) << "Re-alignment mode";
}

if (mCCDBRequest) {
LOG(info) << "Loading magnetic field and reference geometry from CCDB";
Expand All @@ -181,9 +178,9 @@ class AlignmentTask
LOG(fatal) << "No GRP file";
}

auto geoIdealFile = ic.options().get<string>("geo-file-ideal");
if (std::filesystem::exists(geoIdealFile)) {
base::GeometryManager::loadGeometry(geoIdealFile.c_str());
IdealGeoFileName = ic.options().get<string>("geo-file-ideal");
if (std::filesystem::exists(IdealGeoFileName)) {
base::GeometryManager::loadGeometry(IdealGeoFileName.c_str());
transformation = geo::transformationFromTGeoManager(*gGeoManager);
for (int i = 0; i < 156; i++) {
int iDEN = GetDetElemId(i);
Expand All @@ -193,9 +190,9 @@ class AlignmentTask
LOG(fatal) << "No ideal geometry";
}

auto geoRefFile = ic.options().get<string>("geo-file-ref");
if (std::filesystem::exists(geoRefFile)) {
base::GeometryManager::loadGeometry(geoRefFile.c_str());
RefGeoFileName = ic.options().get<string>("geo-file-ref");
if (std::filesystem::exists(RefGeoFileName)) {
base::GeometryManager::loadGeometry(RefGeoFileName.c_str());
transformation = geo::transformationFromTGeoManager(*gGeoManager);
for (int i = 0; i < 156; i++) {
int iDEN = GetDetElemId(i);
Expand All @@ -204,6 +201,22 @@ class AlignmentTask
} else {
LOG(fatal) << "No reference geometry";
}

if (doReAlign) {
LOG(info) << "Re-alignment mode";
LOG(info) << "Loading re-alignment geometry";
NewGeoFileName = ic.options().get<string>("geo-file-new");
if (std::filesystem::exists(NewGeoFileName)) {
base::GeometryManager::loadGeometry(NewGeoFileName.c_str());
transformation = geo::transformationFromTGeoManager(*gGeoManager);
for (int i = 0; i < 156; i++) {
int iDEN = GetDetElemId(i);
transformNew[iDEN] = transformation(iDEN);
}
} else {
LOG(fatal) << "No re-alignment geometry";
}
}
}

auto doEvaluation = ic.options().get<bool>("do-evaluation");
Expand Down Expand Up @@ -387,21 +400,6 @@ class AlignmentTask
}
}

// Load new geometry if we need to do re-align
if (doReAlign) {
if (NewGeoFileName != "") {
LOG(info) << "Loading re-alignment geometry";
base::GeometryManager::loadGeometry(NewGeoFileName.c_str());
transformation = geo::transformationFromTGeoManager(*gGeoManager);
for (int i = 0; i < 156; i++) {
int iDEN = GetDetElemId(i);
transformNew[iDEN] = transformation(iDEN);
}
} else {
LOG(fatal) << "No re-alignment geometry";
}
}

if (!readFromRec) {
// Loading input data
LOG(info) << "Loading MCH tracks";
Expand Down Expand Up @@ -875,6 +873,7 @@ class AlignmentTask
const string mchFileName{"mchtracks.root"};
const string muonFileName{"muontracks.root"};
string outFileName{"Alignment"};
string IdealGeoFileName{""};
string RefGeoFileName{""};
string NewGeoFileName{""};
bool doAlign{false};
Expand Down Expand Up @@ -918,6 +917,7 @@ o2::framework::DataProcessorSpec getAlignmentSpec(bool disableCCDB)
outputSpecs,
AlgorithmSpec{o2::framework::adaptFromTask<AlignmentTask>(ccdbRequest)},
Options{{"geo-file-ref", VariantType::String, o2::base::NameConf::getAlignedGeomFileName(), {"Name of the reference geometry file"}},
{"geo-file-new", VariantType::String, "", {"Name of the new geometry file"}},
{"geo-file-ideal", VariantType::String, o2::base::NameConf::getGeomFileName(), {"Name of the ideal geometry file"}},
{"grp-file", VariantType::String, o2::base::NameConf::getGRPFileName(), {"Name of the grp file"}},
{"do-align", VariantType::Bool, false, {"Switch for alignment, otherwise only residuals will be stored"}},
Expand Down