From fb5c5541f15f5b1aa332e290d4dad8ce57dddae9 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Wed, 7 Mar 2012 09:50:57 +0000 Subject: [PATCH] some more work towards MusrRoot --- src/tests/MusrRoot/MusrRoot.xsd | 36 +++++++++++------------ src/tests/MusrRoot/root2xml.C | 51 +++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 20 deletions(-) diff --git a/src/tests/MusrRoot/MusrRoot.xsd b/src/tests/MusrRoot/MusrRoot.xsd index 8eb9a0e5..a672ad26 100644 --- a/src/tests/MusrRoot/MusrRoot.xsd +++ b/src/tests/MusrRoot/MusrRoot.xsd @@ -16,28 +16,30 @@ - + - + The histos folder is containing potentially various subfolders. - At least one subfolder, called DecayAnaModule, which holds the - muSR decay histograms, must be present. + At least two subfolders, called DecayAnaModule, and SlowControlAnaModule, + which holds the muSR decay histograms, must be present. - - - - - - - + + + + + + + + + @@ -53,7 +55,7 @@ - + @@ -71,17 +73,11 @@ - + - - - - - - - + diff --git a/src/tests/MusrRoot/root2xml.C b/src/tests/MusrRoot/root2xml.C index 9ab45895..2ddfb7c2 100644 --- a/src/tests/MusrRoot/root2xml.C +++ b/src/tests/MusrRoot/root2xml.C @@ -47,6 +47,14 @@ void root2xml(const char *filename, const char *xmlFilename) xml_data.push_back(""); + // the sort_histo_folders is needed since XML-Schema is not flexible enough to handle + // histos -| + // |- DecayAnaModule + // ... (any other analyzer module sub-folder + // |- SCAnaModule + // Hence SCAnaModule has artificially moved up, just to follow DecayAnaModule + sort_histo_folders(); + ofstream fout(xmlFilename); for (UInt_t i=0; i temp_xml_data; + + // first make a copy of the original xml_data + for (unsigned int i=0; i") != string::npos) + start = i; + if (temp_xml_data[i].find("") != string::npos) + end = i+1; + } + if ((start > 0) && (end > 0)) + temp_xml_data.erase(temp_xml_data.begin()+start, temp_xml_data.begin()+end); + else // no SCAnaModule present, hence nothing to be done + return; + + // insert SCAnaModule just after DecayAnaModule + // 1st find end of DecayAnaModule + unsigned int pos = 0; + for (unsigned int i=0; i") != string::npos) { + pos = i+1; + break; + } + } + if (pos == 0) // something is wrong, hence to not do anything + return; + temp_xml_data.insert(temp_xml_data.begin()+pos, xml_data.begin()+start, xml_data.begin()+end); + + // copy temp_xml_data back into xml_data + xml_data.clear(); + for (unsigned int i=0; i