Skip to content

Commit

Permalink
Added some sanity checks of the HCal xml
Browse files Browse the repository at this point in the history
  • Loading branch information
Archil Durglishvili authored and BrieucF committed Dec 3, 2024
1 parent d5b35ae commit 4bfc5e6
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 2 deletions.
42 changes: 41 additions & 1 deletion detectorSegmentations/src/FCCSWHCalPhiRow_k4geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,51 @@ void FCCSWHCalPhiRow_k4geo::calculateLayerRadii() const {
// check if all necessary variables are available
if(m_detLayout==-1 || m_offsetZ.empty() || m_widthZ.empty() || m_offsetR.empty() || m_numLayers.empty() || m_dRlayer.empty())
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!",
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"One of the variables is missing: detLayout | offset_z | width_z | offset_r | numLayers | dRlayer");
return;
}

// some sanity checks of the xml
if( m_offsetZ.size() != m_offsetR.size() )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in offsetZ and offsetR must be the same!");
return;
}
if( m_widthZ.size() != m_offsetR.size() )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in widthZ and offsetR must be the same!");
return;
}
if( m_detLayout == 0 && m_offsetZ.size() != 1)
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in offsetZ/offsetR/widthZ must be 1 for the Barrel!");
return;
}
if( m_numLayers.size() % m_offsetZ.size() != 0 )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in numLayers must be multiple of offsetZ.size()!");
return;
}
if( m_dRlayer.size() != m_numLayers.size()/m_offsetZ.size() )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in dRlayer must be equal to numLayers.size()/offsetZ.size()!");
return;
}
uint nlayers = 0;
for(auto n : m_numLayers) nlayers+=n;
if( m_gridSizeRow.size() != nlayers )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in gridSizeRow must be equal to sum of contents of numLayers!");
return;
}

if(m_detLayout==0) dd4hep::printout(dd4hep::INFO, "FCCSWHCalPhiRow_k4geo","Barrel configuration found!");
else dd4hep::printout(dd4hep::INFO, "FCCSWHCalPhiRow_k4geo","EndCap configuration found!");

Expand Down
34 changes: 33 additions & 1 deletion detectorSegmentations/src/FCCSWHCalPhiTheta_k4geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,43 @@ void FCCSWHCalPhiTheta_k4geo::defineCellsInRZplan() const {
// check if all necessary variables are available
if(m_detLayout==-1 || m_offsetZ.empty() || m_widthZ.empty() || m_offsetR.empty() || m_numLayers.empty() || m_dRlayer.empty())
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!",
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"One of the variables is missing: detLayout | offset_z | width_z | offset_r | numLayers | dRlayer");
return;
}

// some sanity checks of the xml
if( m_offsetZ.size() != m_offsetR.size() )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in offsetZ and offsetR must be the same!");
return;
}
if( m_widthZ.size() != m_offsetR.size() )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in widthZ and offsetR must be the same!");
return;
}
if( m_detLayout == 0 && m_offsetZ.size() != 1)
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in offsetZ/offsetR/widthZ must be 1 for the Barrel!");
return;
}
if( m_numLayers.size() % m_offsetZ.size() != 0 )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in numLayers must be multiple of offsetZ.size()!");
return;
}
if( m_dRlayer.size() != m_numLayers.size()/m_offsetZ.size() )
{
dd4hep::printout(dd4hep::ERROR, "FCCSWHCalPhiRow_k4geo","Please check the readout description in the XML file!\n%s",
"Number of elements in dRlayer must be equal to numLayers.size()/offsetZ.size()!");
return;
}

if(m_detLayout==0) dd4hep::printout(dd4hep::INFO, "FCCSWHCalPhiRow_k4geo","Barrel configuration found!");
else dd4hep::printout(dd4hep::INFO, "FCCSWHCalPhiRow_k4geo","EndCap configuration found!");

Expand Down

0 comments on commit 4bfc5e6

Please sign in to comment.