some more work towards MusrRoot
This commit is contained in:
@ -16,28 +16,30 @@
|
|||||||
|
|
||||||
<xs:complexType name="musrRoot">
|
<xs:complexType name="musrRoot">
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="histos" type="histosFolder"/>
|
<xs:element ref="histos"/>
|
||||||
<xs:element name="RunHeader" type="runHeaderFolder"/>
|
<xs:element name="RunHeader" type="runHeaderFolder"/>
|
||||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
<xs:complexType name="histosFolder">
|
<xs:element name="histos">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>
|
<xs:documentation>
|
||||||
The histos folder is containing potentially various subfolders.
|
The histos folder is containing potentially various subfolders.
|
||||||
At least one subfolder, called DecayAnaModule, which holds the
|
At least two subfolders, called DecayAnaModule, and SlowControlAnaModule,
|
||||||
muSR decay histograms, must be present.
|
which holds the muSR decay histograms, must be present.
|
||||||
</xs:documentation>
|
</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
|
|
||||||
<xs:sequence>
|
<xs:complexType>
|
||||||
<xs:element name="DecayAnaModule" type="decayHistoData"/>
|
<xs:sequence>
|
||||||
<xs:element name="SlowControlAnaModule" type="slowControlHistoData"/>
|
<xs:element name="DecayAnaModule" type="decayHistoData"/>
|
||||||
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
<xs:element name="SCAnaModule" type="slowControlHistoData"/>
|
||||||
</xs:sequence>
|
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
|
||||||
</xs:complexType>
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
|
||||||
<xs:complexType name="decayHistoData">
|
<xs:complexType name="decayHistoData">
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="DecayHistoEntry" type="decayHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
|
<xs:element name="DecayHistoEntry" type="decayHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
|
||||||
@ -53,7 +55,7 @@
|
|||||||
|
|
||||||
<xs:simpleType name="histoName">
|
<xs:simpleType name="histoName">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:pattern value="hDecay([0-9]){3}"/> <!-- this means hDecayXXX, where XXX are 3 digits -->
|
<xs:pattern value="hDecay([0-9]){4}"/> <!-- this means hDecayXXX, where XXX are 3 digits -->
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
|
|
||||||
@ -71,17 +73,11 @@
|
|||||||
|
|
||||||
<xs:complexType name="slowControlHistoEntry">
|
<xs:complexType name="slowControlHistoEntry">
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="SlowControlName" type="slowControlName"/>
|
<xs:element name="SlowControlName" type="xs:string"/>
|
||||||
<xs:element name="SlowControlType" type="slowControlType"/>
|
<xs:element name="SlowControlType" type="slowControlType"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
<xs:simpleType name="slowControlName">
|
|
||||||
<xs:restriction base="xs:string">
|
|
||||||
<xs:pattern value="h(\S)+"/> <!-- this means 'h' followed by one or more characters without space, e.g. 'hTemperature1', but NOT 'hTemp 1'-->
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
|
|
||||||
<xs:simpleType name="slowControlType">
|
<xs:simpleType name="slowControlType">
|
||||||
<xs:restriction base="xs:string">
|
<xs:restriction base="xs:string">
|
||||||
<xs:pattern value="TH1F"/>
|
<xs:pattern value="TH1F"/>
|
||||||
|
@ -47,6 +47,14 @@ void root2xml(const char *filename, const char *xmlFilename)
|
|||||||
|
|
||||||
xml_data.push_back("</MusrRoot>");
|
xml_data.push_back("</MusrRoot>");
|
||||||
|
|
||||||
|
// 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);
|
ofstream fout(xmlFilename);
|
||||||
|
|
||||||
for (UInt_t i=0; i<xml_data.size(); i++)
|
for (UInt_t i=0; i<xml_data.size(); i++)
|
||||||
@ -54,6 +62,49 @@ void root2xml(const char *filename, const char *xmlFilename)
|
|||||||
fout.close();
|
fout.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sort_histo_folders()
|
||||||
|
{
|
||||||
|
vector<string> temp_xml_data;
|
||||||
|
|
||||||
|
// first make a copy of the original xml_data
|
||||||
|
for (unsigned int i=0; i<xml_data.size(); i++)
|
||||||
|
temp_xml_data.push_back(xml_data[i]);
|
||||||
|
|
||||||
|
// remove SCAnaModule from temp_xml_data
|
||||||
|
unsigned int start = 0, end = 0;
|
||||||
|
for (unsigned int i=0; i<temp_xml_data.size(); i++) {
|
||||||
|
if (temp_xml_data[i].find("<SCAnaModule>") != string::npos)
|
||||||
|
start = i;
|
||||||
|
if (temp_xml_data[i].find("</SCAnaModule>") != 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<temp_xml_data.size(); i++) {
|
||||||
|
if (temp_xml_data[i].find("</DecayAnaModule>") != 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<temp_xml_data.size(); i++)
|
||||||
|
xml_data.push_back(temp_xml_data[i]);
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
temp_xml_data.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void dumpFolder(TFolder *folder, UInt_t offset)
|
void dumpFolder(TFolder *folder, UInt_t offset)
|
||||||
{
|
{
|
||||||
TString offsetStr="";
|
TString offsetStr="";
|
||||||
|
Reference in New Issue
Block a user