Skip to content

Commit

Permalink
[ReadCaloCrosstalkMap] Avoid crashing when cross talk file does not e…
Browse files Browse the repository at this point in the history
…xists but we do not need cross talk emulation
  • Loading branch information
BrieucF committed Jul 9, 2024
1 parent ac3feb5 commit 4d68798
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions RecCalorimeter/src/components/ReadCaloCrosstalkMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ ReadCaloCrosstalkMap::ReadCaloCrosstalkMap(const std::string& type, const std::s
}

StatusCode ReadCaloCrosstalkMap::initialize() {
// prevent to initialize the tool if not intended (input file path empty)
// otherwise things will crash if m_fileName is not available
// not a perfect solution but tools seems to not be meant to be optional
if (m_fileName == "") return StatusCode::SUCCESS;

StatusCode sc = GaudiTool::initialize();
info() <<"Loading crosstalk map..." << endmsg;
if (sc.isFailure()) return sc;
Expand Down
2 changes: 1 addition & 1 deletion RecCalorimeter/src/components/ReadCaloCrosstalkMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ReadCaloCrosstalkMap : public GaudiTool, virtual public ICaloReadCrosstalk

private:
/// Name of input root file that contains the TTree with cellID->vec<list_crosstalk_neighboursCellID> and cellId->vec<list_crosstalksCellID>
Gaudi::Property<std::string> m_fileName{this, "fileName", "xtalk_neighbours_map_ecalB_thetamodulemerged.root", "Name of the file that contains the crosstalk map"};
Gaudi::Property<std::string> m_fileName{this, "fileName", "", "Name of the file that contains the crosstalk map. Leave the default empty to avoid crashes when cross-talk is not needed."};
/// Output maps to be used for the fast lookup in the creating calo-cells algorithm
std::unordered_map<uint64_t, std::vector<uint64_t>> m_mapNeighbours;
std::unordered_map<uint64_t, std::vector<double>> m_mapCrosstalks;
Expand Down

0 comments on commit 4d68798

Please sign in to comment.