Skip to content
Snippets Groups Projects
Commit 53568235 authored by Tamara Vazquez Schroeder's avatar Tamara Vazquez Schroeder
Browse files

Merge branch 'FCS_SD_MergingUpdate_21.0' into '21.0'

Simplify merging scheme for LArFCS_StepInfoSD

See merge request atlas/athena!7388
parents 53e157aa 4194af94
No related branches found
No related tags found
No related merge requests found
from AthenaCommon.CfgGetter import getPublicTool
stepInfoSDTool = getPublicTool("SensitiveDetectorMasterTool").SensitiveDetectors['FCS_StepInfoSensitiveDetector']
stepInfoSDTool.shift_lar_subhit=True
stepInfoSDTool.shift_lar_subhit=True #default
stepInfoSDTool.shorten_lar_step=True
stepInfoSDTool.maxRadiusLAr=1
stepInfoSDTool.maxRadiusFine=1. #default (for EMB1 and EME1)
stepInfoSDTool.maxRadius=25. #default
stepInfoSDTool.maxRadiusTile=25. #default
stepInfoSDTool.maxTime=25. #default
stepInfoSDTool.maxTimeTile=100. #default
......@@ -45,6 +45,7 @@ namespace FCS_Param {
// Merging properties
double m_maxRadius=25.; //!< property, see @link LArG4GenShowerLib::LArG4GenShowerLib @endlink
double m_maxRadiusFine=1.; //!< property, see @link LArG4GenShowerLib::LArG4GenShowerLib @endlink
double m_maxRadiusLAr=25.; //!< property, see @link LArG4GenShowerLib::LArG4GenShowerLib @endlink
double m_maxRadiusHEC=100.; //!< property, see @link LArG4GenShowerLib::LArG4GenShowerLib @endlink
double m_maxRadiusFCAL=100.; //!< property, see @link LArG4GenShowerLib::LArG4GenShowerLib @endlink
......
......@@ -92,6 +92,7 @@ namespace FCS_Param
declareProperty("shorten_lar_step",m_config.shorten_lar_step, "");
declareProperty("maxRadius",m_config.m_maxRadius, "");
declareProperty("maxRadiusFine",m_config.m_maxRadiusFine, "");
declareProperty("maxRadiusLAr",m_config.m_maxRadiusLAr, "");
declareProperty("maxRadiusHEC",m_config.m_maxRadiusHEC, "");
declareProperty("maxRadiusFCAL",m_config.m_maxRadiusFCAL, "");
......
......@@ -213,6 +213,50 @@ G4bool LArFCS_StepInfoSD::ProcessHits(G4Step* a_step,G4TouchableHistory*)
return result;
}
void LArFCS_StepInfoSD::update_map(const CLHEP::Hep3Vector & l_vec, const Identifier & l_cell, double l_energy, double l_time, bool l_valid, int l_detector)
{
// Drop any hits that don't have a good identifier attached
if (!m_calo_dd_man->get_element(l_cell)) {
if(m_config.verboseLevel > 4) {
G4cout<<this->GetName()<<" DEBUG update_map: bad identifier: "<<l_cell.getString()<<" skipping this hit."<<G4endl;
}
return;
}
auto map_item = m_hit_map.find( l_cell );
if (map_item==m_hit_map.end()) {
m_hit_map[l_cell] = new std::vector< ISF_FCS_Parametrization::FCS_StepInfo* >;
m_hit_map[l_cell]->reserve(200);
m_hit_map[l_cell]->push_back( new ISF_FCS_Parametrization::FCS_StepInfo( l_vec , l_cell , l_energy , l_time , l_valid , l_detector ) );
}
else {
// Get the appropriate merging limits
const CaloCell_ID::CaloSample& layer = m_calo_dd_man->get_element(l_cell)->getSampling();
const double tsame(m_config.m_maxTime);
const double maxRadius((layer == CaloCell_ID::EMB1 || layer == CaloCell_ID::EME1) ? m_config.m_maxRadiusFine : m_config.m_maxRadius); //Default 1mm merging in layers 1 & 5, 5mm merging elsewhere
bool match = false;
for (auto map_it : * map_item->second) {
// Time check
const double delta_t = std::fabs(map_it->time()-l_time);
if ( delta_t >= tsame ) { continue; }
// Distance check
const CLHEP::Hep3Vector & currentPosition = map_it->position();
const double hit_diff2 = currentPosition.diff2( l_vec );
if ( hit_diff2 >= maxRadius ) { continue; }
// Found a match. Make a temporary that will be deleted!
const ISF_FCS_Parametrization::FCS_StepInfo my_info( l_vec , l_cell , l_energy , l_time , l_valid , l_detector );
*map_it += my_info;
match = true;
break;
} // End of search for match in time and space
if (!match) {
map_item->second->push_back( new ISF_FCS_Parametrization::FCS_StepInfo( l_vec , l_cell , l_energy , l_time , l_valid , l_detector ) );
} // Didn't match
} // ID already in the map
return;
} // That's it for updating the map!
Identifier LArFCS_StepInfoSD::ConvertID(const LArG4Identifier& a_ident) const
{
Identifier id;
......
......@@ -41,6 +41,11 @@ public:
G4bool ProcessHits(G4Step* a_step, G4TouchableHistory*) override;
private:
/// Keep a map instead of trying to keep the full vector.
/// At the end of the event we'll push the map back into the
/// FCS_StepInfoCollection in StoreGate.
virtual void update_map(const CLHEP::Hep3Vector & l_vec, const Identifier & l_cell, double l_energy, double l_time, bool l_valid, int l_detector) override final;
/// Helper function for making "real" identifiers from LArG4Identifiers
Identifier ConvertID(const LArG4Identifier& a_ident) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment