diff --git a/macro/print_alignment.C b/macro/print_alignment.C new file mode 100644 index 0000000000000000000000000000000000000000..2c6dd7bfdc7a0d13750ea74af84383aaa505a08b --- /dev/null +++ b/macro/print_alignment.C @@ -0,0 +1,35 @@ + +Bool_t print_alignment( std::string geoSetupTag ) +{ + TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory + TString alignmentMatrixFileName = srcDir + "/parameters/mcbm/AlignmentMatrices_" + geoSetupTag + ".root"; + if (alignmentMatrixFileName.Length() != 0) { + std::cout << "Reading alignment for file " << alignmentMatrixFileName << std::endl; + + // Define the basic structure which needs to be filled with information + // This structure is stored in the output file and later passed to the + // FairRoot framework to do the (miss)alignment + std::map<std::string, TGeoHMatrix>* matrices{nullptr}; + + // read matrices from disk + std::cout << "Filename: " << alignmentMatrixFileName << std::endl; + TFile* misalignmentMatrixRootfile = new TFile(alignmentMatrixFileName, "READ"); + if (misalignmentMatrixRootfile->IsOpen()) { + gDirectory->GetObject("MisalignMatrices", matrices); + misalignmentMatrixRootfile->Close(); + + for( auto it = matrices->begin(); it != matrices->end(); ++it) { + std::cout << "===========================" << std::endl; + std::cout << it->first << std::endl; + it->second.Print(); + std::cout << "===========================" << std::endl; + } + } + else { + std::cout << "Could not open file " << alignmentMatrixFileName << "\n Exiting" << std::endl; + return kFALSE; + } + + } + return kTRUE; +}