Skip to content

Commit

Permalink
fixes to the DiMuonVertexValidation to work when files are on eos
Browse files Browse the repository at this point in the history
mmusich committed Feb 28, 2024
1 parent 859a2f4 commit 1004def
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Alignment/OfflineValidation/bin/DiMuonVmerge.cc
Original file line number Diff line number Diff line change
@@ -46,10 +46,14 @@ int merge(int argc, char* argv[]) {
// std::cout << " Attribute: " << attr.first << " = " << attr.second.data() << std::endl;
// }

std::cout << childTree.second.get<string>("file") << std::endl;
std::string file = childTree.second.get<string>("file");
std::cout << file << std::endl;
std::cout << childTree.second.get<string>("title") << std::endl;
std::string toAdd = childTree.second.get<string>("file") +
"/DiMuonVertexValidation.root=" + childTree.second.get<string>("title") + ",";

// Check if the file contains "/eos/cms/" and add the prefix accordingly
std::string prefixToAdd = file.find("/eos/cms/") != std::string::npos ? "root://eoscms.cern.ch/" : "";
std::string toAdd =
prefixToAdd + file + "/DiMuonVertexValidation.root=" + childTree.second.get<string>("title") + ",";
filesAndLabels += toAdd;
}

10 changes: 9 additions & 1 deletion Alignment/OfflineValidation/macros/loopAndPlot.C
Original file line number Diff line number Diff line change
@@ -68,7 +68,15 @@ void recurseOverKeys(TDirectory *target1, const std::vector<TString> &labels, bo
/************************************************/
{
// Figure out where we are
TString path((char *)strstr(target1->GetPath(), ":"));
TString fullPath = target1->GetPath();

// Check if the prefix "root://eoscms.cern.ch/" is present and remove it
TString prefixToRemove = "root://eoscms.cern.ch/";
if (fullPath.BeginsWith(prefixToRemove)) {
fullPath.Remove(0, prefixToRemove.Length());
}

TString path((char *)strstr(fullPath.Data(), ":"));
path.Remove(0, 2);

sourceFiles[0]->cd(path);

0 comments on commit 1004def

Please sign in to comment.