Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust metadata writing sequence to avoid StreamerInfo missing #435

Merged
merged 11 commits into from
Jun 15, 2023
Merged
48 changes: 20 additions & 28 deletions examples/01.alphaTrack/readout/readouts.rml
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
<?xml version="1.0" ?>
<?xml version="1.0"?>
<readouts>
<globals>
<!-- The pitch value in mm -->
<variable name="PITCH" value="1" overwrite="false" />
<variable name="PITCH" value="1" overwrite="false"/>
<!-- The number of modules per axis MxM -->
<variable name="N_MODULES" value="1" overwrite="false" />
<variable name="N_MODULES" value="1" overwrite="false"/>
<!-- The number of pixels per side PxP -->
<variable name="N_CHANNELS" value="120" overwrite="false" />
<variable name="N_CHANNELS" value="120" overwrite="false"/>
</globals>

<TRestDetectorReadout name="cathode" title="Cathode ${PITCH} mm-Pitch ${N_CHANNELS}+${N_CHANNELS} channels">

<constant name="pitch" value="${PITCH}" overwrite="false" />
<constant name="pitch" value="${PITCH}" overwrite="false"/>
<!-- The number of modules per axis MxM -->
<constant name="nModules" value="${N_MODULES}" overwrite="false" />

<constant name="nModules" value="${N_MODULES}" overwrite="false"/>
<!-- The number of pixels per side PxP -->
<constant name="nChannels" value="${N_CHANNELS}" overwrite="false" />
<constant name="pixelSize" value="${PITCH}/sqrt(2.)" />

<parameter name="mappingNodes" value="400" />
<include file="microbulkModule.rml" />
<readoutPlane position="(0,0,0)mm" planeVector="(0,0,1)" chargeCollection="1" cathodePosition="(0,0,50)mm">
<addReadoutModule id="0" name="module" origin="(-0.5*nChannels*pitch,-0.5*nChannels*pitch)" rotation="0" decodingFile="" firstDaqChannel="0" />
<constant name="nChannels" value="${N_CHANNELS}" overwrite="false"/>
<constant name="pixelSize" value="${PITCH}/sqrt(2.)"/>
<parameter name="mappingNodes" value="400"/>
<include file="microbulkModule.rml"/>
<readoutPlane position="(0,0,0)mm" normal="(0,0,1)" chargeCollection="1" height="50mm">
<addReadoutModule id="0" name="module" origin="(-0.5*nChannels*pitch,-0.5*nChannels*pitch)" rotation="0" decodingFile="" firstDaqChannel="0"/>
</readoutPlane>
</TRestDetectorReadout>

<TRestDetectorReadout name="readout" title="Readout ${PITCH} mm-Pitch ${N_CHANNELS}+${N_CHANNELS} channels">

<constant name="pitch" value="${PITCH}" overwrite="false" />
<constant name="pitch" value="${PITCH}" overwrite="false"/>
<!-- The number of modules per axis MxM -->
<constant name="nModules" value="${N_MODULES}" overwrite="false" />

<constant name="nModules" value="${N_MODULES}" overwrite="false"/>
<!-- The number of pixels per side PxP -->
<constant name="nChannels" value="${N_CHANNELS}" overwrite="false" />
<constant name="pixelSize" value="${PITCH}/sqrt(2.)" />

<parameter name="mappingNodes" value="400" />
<include file="microbulkModule.rml" />
<readoutPlane position="(0,0,50)mm" planeVector="(0,0,-1)" chargeCollection="1" cathodePosition="(0,0,0)mm">
<addReadoutModule id="0" name="module" origin="(-0.5*nChannels*pitch,-0.5*nChannels*pitch)" rotation="0" decodingFile="" firstDaqChannel="0" />
<constant name="nChannels" value="${N_CHANNELS}" overwrite="false"/>
<constant name="pixelSize" value="${PITCH}/sqrt(2.)"/>
<parameter name="mappingNodes" value="400"/>
<include file="microbulkModule.rml"/>
<readoutPlane position="(0,0,50)mm" normal="(0,0,-1)" chargeCollection="1" height="50mm">
<addReadoutModule id="0" name="module" origin="(-0.5*nChannels*pitch,-0.5*nChannels*pitch)" rotation="0" decodingFile="" firstDaqChannel="0"/>
</readoutPlane>
</TRestDetectorReadout>
</readouts>
Binary file modified examples/01.alphaTrack/readout/readouts.root
Binary file not shown.
122 changes: 18 additions & 104 deletions pipeline/pandaxiii_MC/readout-140kg.rml
Original file line number Diff line number Diff line change
@@ -1,137 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

<readouts>

<globals>
<variable name="PITCH" value="3" overwrite="false"/>
<!-- The pitch value in mm -->
<variable name="MODULES" value="10" overwrite="false"/>
<!-- The number of modules per axis MxM -->
<variable name="CHANNELS" value="64" overwrite="false"/>
<!-- The number of pixels per side PxP -->
</globals>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<readouts><globals><variable name="PITCH" value="3" overwrite="false"/><!-- The pitch value in mm --><variable name="MODULES" value="10" overwrite="false"/><!-- The number of modules per axis MxM --><variable name="CHANNELS" value="64" overwrite="false"/><!-- The number of pixels per side PxP --></globals>
jgalan marked this conversation as resolved.
Show resolved Hide resolved

//The Microbulk MicroMegas
<readoutModule name="module" size="((nChannels+1)*pitch-1*pitch/2,(nChannels+1)*pitch-pitch/2-pitch/4)"
tolerance="1.e-4">
<readoutModule name="module" size="((nChannels+1)*pitch-1*pitch/2,(nChannels+1)*pitch-pitch/2-pitch/4)" tolerance="1.e-4">

// Y-strips (pixel has fixed x coordinate)
<for variable="nCh" from="0" to="nChannels-2" step="1">
<readoutChannel id="${nCh}" type="y">
<for variable="nPix" from="0" to="nChannels-1" step="1">
<addPixel id="${nPix}" origin="((1+${nCh})*pitch,pitch/4+${nPix}*pitch)"
size="(pixelSize,pixelSize)" rotation="45"/>
</for>
<addPixel id="nChannels" origin="(${nCh}*pitch,pitch/4+(nChannels-1)*pitch+pitch/2)"
size="(pitch+pitch/2,pitch/2)" rotation="0"/>
</readoutChannel>
</for>
<for variable="nCh" from="0" to="nChannels-2" step="1"><readoutChannel id="${nCh}" type="y"><for variable="nPix" from="0" to="nChannels-1" step="1"><addPixel id="${nPix}" origin="((1+${nCh})*pitch,pitch/4+${nPix}*pitch)" size="(pixelSize,pixelSize)" rotation="45"/></for><addPixel id="nChannels" origin="(${nCh}*pitch,pitch/4+(nChannels-1)*pitch+pitch/2)" size="(pitch+pitch/2,pitch/2)" rotation="0"/></readoutChannel></for>

// Last strip is special
<readoutChannel id="nChannels-1" type="y">
<for variable="nPix" from="0" to="nChannels-1" step="1">
<addPixel id="${nPix}" origin="(nChannels*pitch,pitch/4+${nPix}*pitch)" size="(pixelSize,pixelSize)"
rotation="45"/>
<addPixel id="nChannels+${nPix}" origin="(nChannels*pitch,pitch/4+${nPix}*pitch)" size="(pitch/2,pitch)"
rotation="0"/>
</for>
<addPixel id="2*nChannels" origin="(nChannels*pitch-pitch/2,pitch/4+(nChannels-1)*pitch+pitch/2)"
size="(pitch,pitch/2)" rotation="0"/>
</readoutChannel>
<readoutChannel id="nChannels-1" type="y"><for variable="nPix" from="0" to="nChannels-1" step="1"><addPixel id="${nPix}" origin="(nChannels*pitch,pitch/4+${nPix}*pitch)" size="(pixelSize,pixelSize)" rotation="45"/><addPixel id="nChannels+${nPix}" origin="(nChannels*pitch,pitch/4+${nPix}*pitch)" size="(pitch/2,pitch)" rotation="0"/></for><addPixel id="2*nChannels" origin="(nChannels*pitch-pitch/2,pitch/4+(nChannels-1)*pitch+pitch/2)" size="(pitch,pitch/2)" rotation="0"/></readoutChannel>

// X-strips (pixel has fixed y coordinate)

// First strip is special
<readoutChannel id="nChannels" type="x">
<addPixel id="0" origin="(0,0)" size="(nChannels*pitch+pitch/2,3*pitch/4)" rotation="0"/>
</readoutChannel>

<for variable="nCh" from="1" to="nChannels-1" step="1">
<readoutChannel id="nChannels+${nCh}" type="x">
<addPixel id="0" origin="(0,${nCh}*pitch-pitch/4)" size="(pitch/2,pitch)" rotation="0"/>
<for variable="nPix" from="0" to="nChannels-1" step="1">
<addPixel id="${nPix}+1" origin="((0.5+${nPix})*pitch,${nCh}*pitch-pitch/4)"
size="(pixelSize,pixelSize)" rotation="45"/>
</for>
</readoutChannel>
</for>
<readoutChannel id="nChannels" type="x"><addPixel id="0" origin="(0,0)" size="(nChannels*pitch+pitch/2,3*pitch/4)" rotation="0"/></readoutChannel>

<for variable="nCh" from="1" to="nChannels-1" step="1"><readoutChannel id="nChannels+${nCh}" type="x"><addPixel id="0" origin="(0,${nCh}*pitch-pitch/4)" size="(pitch/2,pitch)" rotation="0"/><for variable="nPix" from="0" to="nChannels-1" step="1"><addPixel id="${nPix}+1" origin="((0.5+${nPix})*pitch,${nCh}*pitch-pitch/4)" size="(pixelSize,pixelSize)" rotation="45"/></for></readoutChannel></for>

</readoutModule>

<!-- This readout (Panda-140kg) is the latest design of PandaIII detector_2019.5.28-->
<TRestDetectorReadout name="Panda-140kg"
title="PANDA SJTU Jinping readout. 1 plane 52 modules ${PITCH}mm-Pitch ${CHANNELS}+${CHANNELS} channels">
<constant name="nChannels" value="${CHANNELS}"/>
<constant name="pitch" value="${PITCH}"/>
<constant name="pixelSize" value="${PITCH}/sqrt(2.)"/>

<parameter name="mappingNodes" value="0"/>

<readoutModule name="module" file="readouts.rml"/>

<readoutPlane position="(0,0,600.5)mm" planeVector="(0,0,-1)"
chargeCollection="1"
cathodePosition="(0,0,-601)mm">
<TRestDetectorReadout name="Panda-140kg" title="PANDA SJTU Jinping readout. 1 plane 52 modules ${PITCH}mm-Pitch ${CHANNELS}+${CHANNELS} channels"><constant name="nChannels" value="${CHANNELS}"/><constant name="pitch" value="${PITCH}"/><constant name="pixelSize" value="${PITCH}/sqrt(2.)"/><parameter name="mappingNodes" value="0"/><readoutModule name="module" file="readouts.rml"/><readoutPlane position="(0,0,600.5)mm" normal="(0,0,-1)" chargeCollection="1" height="1201.5mm">

// 4 modules
<for variable="modX" from="1" to="4" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(( (nChannels+1)*pitch-1*pitch/2)*(-2+(${modX}-1)) , 3 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>
<for variable="modX" from="1" to="4" step="1"><addReadoutModule id="${modX}" name="module" origin="(( (nChannels+1)*pitch-1*pitch/2)*(-2+(${modX}-1)) , 3 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

// 6-modules
<for variable="modX" from="5" to="10" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(((nChannels+1)*pitch-1*pitch/2)*(-3+(${modX}-5)) , 2 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>
<for variable="modX" from="5" to="10" step="1"><addReadoutModule id="${modX}" name="module" origin="(((nChannels+1)*pitch-1*pitch/2)*(-3+(${modX}-5)) , 2 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

// 8-modules
<for variable="modX" from="11" to="18" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-11)) , 1 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>
<for variable="modX" from="11" to="18" step="1"><addReadoutModule id="${modX}" name="module" origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-11)) , 1 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

// 8-modules
<for variable="modX" from="19" to="26" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-19)) , 0.0 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>
<for variable="modX" from="19" to="26" step="1"><addReadoutModule id="${modX}" name="module" origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-19)) , 0.0 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

// 8-modules
<for variable="modX" from="27" to="34" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-27)) , -1 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>
<for variable="modX" from="27" to="34" step="1"><addReadoutModule id="${modX}" name="module" origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-27)) , -1 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

// 8-modules
<for variable="modX" from="35" to="42" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-35)) , -2 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>
<for variable="modX" from="35" to="42" step="1"><addReadoutModule id="${modX}" name="module" origin="(((nChannels+1)*pitch-1*pitch/2)*(-4+(${modX}-35)) , -2 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

// 6-modules
<for variable="modX" from="43" to="48" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(((nChannels+1)*pitch-1*pitch/2)*(-3+(${modX}-43)) , -3 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>
<for variable="modX" from="43" to="48" step="1"><addReadoutModule id="${modX}" name="module" origin="(((nChannels+1)*pitch-1*pitch/2)*(-3+(${modX}-43)) , -3 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

// 4-modules
<for variable="modX" from="49" to="52" step="1">
<addReadoutModule id="${modX}" name="module"
origin="(((nChannels+1)*pitch-1*pitch/2)*(-2+(${modX}-49)) , -4 * ((nChannels+1)*pitch-pitch/2-pitch/4) )"
rotation="0"/>
</for>

</readoutPlane>

<for variable="modX" from="49" to="52" step="1"><addReadoutModule id="${modX}" name="module" origin="(((nChannels+1)*pitch-1*pitch/2)*(-2+(${modX}-49)) , -4 * ((nChannels+1)*pitch-pitch/2-pitch/4) )" rotation="0"/></for>

</TRestDetectorReadout>
</readoutPlane></TRestDetectorReadout>

</readouts>
7 changes: 6 additions & 1 deletion pipeline/trex/validateStreamer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import os, sys

os.system(
"restRoot -b -q StreamerOutput.C'(\"Hits_01928.root\")' | grep Process | grep TRest | grep version"
)

os.system(
"restRoot -b -q StreamerOutput.C'(\"Hits_01928.root\")' | grep Process | grep TRest | grep version | wc -l > output.log 2>&1"
)
Expand All @@ -12,7 +16,8 @@
print("The number of processes inside the event data chain is 9. Succeed!")
sys.exit(0)
else:
print("The number of processes inside the event data chain is NOT 6! Fail!")
print("The number of processes inside the event data chain is NOT 9! Fail!")
print("The number of processes is: " + line + "\n")
sys.exit(1)

sys.exit(0)
18 changes: 15 additions & 3 deletions source/framework/core/src/TRestManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,28 @@ ClassImp(TRestManager);

TRestManager::TRestManager() { Initialize(); }

TRestManager::~TRestManager() {}
TRestManager::~TRestManager() {
// delete all the added metadata objects(besides self)
if (fMetaObjects.size() > 1) {
for (unsigned int i = fMetaObjects.size() - 1; i >= 1; i--) {
delete fMetaObjects[i];
}
}
}

///////////////////////////////////////////////
/// \brief Set the class name as section name during initialization.
///
void TRestManager::Initialize() {
SetSectionName(this->ClassName());

// delete all the added metadata objects(besides self)
if (fMetaObjects.size() > 1) {
for (unsigned int i = fMetaObjects.size() - 1; i >= 1; i--) {
delete fMetaObjects[i];
}
}
// add self to the metadata objects list
fMetaObjects.clear();

fMetaObjects.push_back(this);
}

Expand Down
Loading