Skip to content

Commit

Permalink
Merge pull request #270 from eic/davidl_error_messages_fixes
Browse files Browse the repository at this point in the history
Davidl error messages fixes
  • Loading branch information
faustus123 authored Oct 23, 2022
2 parents 096f333 + a28f25c commit d207873
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/algorithms/calorimetry/CalorimeterClusterRecoCoG.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ edm4eic::Cluster* reconstruct(const edm4eic::ProtoCluster* pcl) const {
for (unsigned i = 0; i < pcl->getHits().size(); ++i) {
const auto& hit = pcl->getHits()[i];
const auto weight = pcl->getWeights()[i];
// _DBG_<<" -- weight = " << weight << " E=" << hit.getEnergy() << " totalE=" <<totalE << " log(E/totalE)=" << std::log(hit.getEnergy()/totalE) << std::endl;
float w = weightFunc(hit.getEnergy() * weight, totalE, m_logWeightBase, 0);
tw += w;
v = v + (hit.getPosition() * w);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CalorimeterHit_factory_HcalBarrelMergedHits : public JFactoryT<edm4eic::Ca
m_input_tag = "HcalBarrelRecHits";

m_readout="HcalBarrelHits";
u_fields={"tower", "tile"};
u_fields={"layer", "slice"};
u_refs={1, 0};

m_geoSvc= app->GetService<JDD4hep_service>();
Expand Down
20 changes: 17 additions & 3 deletions src/global/digi/SiliconTrackerDigi_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,23 @@ void eicrecon::SiliconTrackerDigi_factory::Process(const std::shared_ptr<const J
// Collect all hits from different tags
std::vector<const edm4hep::SimTrackerHit*> total_sim_hits;
for(const auto &input_tag: GetInputTags()) {
auto sim_hits = event->Get<edm4hep::SimTrackerHit>(input_tag);
for (const auto hit : sim_hits) {
total_sim_hits.push_back(hit); /// TODO a better way to concatenate arrays
try {
auto sim_hits = event->Get<edm4hep::SimTrackerHit>(input_tag);
for (const auto hit: sim_hits) {
total_sim_hits.push_back(hit); /// TODO a better way to concatenate arrays
}
}catch(std::exception &e){
// If we get here it is likely due to there being no factory for edm4hep::SimTrackerHit
// with the given input tag. This can happen if the input file simply does not have those.
// (I have seen this for the SiBarrelHits). Assume this is the case and print a single
// warning message the first time it happens and ignore all other times.
// FIXME: This tag should probably be removed from the list so we don't keep throwing
// FIXME: and catching exceptions that are not shown to the user.
static std::set<std::string> bad_tags;
if( bad_tags.count(input_tag) == 0 ){
bad_tags.insert( input_tag );
m_log->warn( e.what() );
}
}
}

Expand Down

0 comments on commit d207873

Please sign in to comment.