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

GetRefChild debug pollutes output #485

Closed
veprbl opened this issue Feb 15, 2023 · 12 comments
Closed

GetRefChild debug pollutes output #485

veprbl opened this issue Feb 15, 2023 · 12 comments
Labels
part:logging What goes to log and output topic: calorimetry relates to calorimetry

Comments

@veprbl
Copy link
Member

veprbl commented Feb 15, 2023

Environment: (where does this bug occur, have you tried other environments)

  • Which branch (often main for latest released): main?
  • Which version (or HEAD for the most recent on git): HEAD?
  • Any specific OS or system where the issue occurs? linux
  • Any special versions of ROOT or Geant4? no

Steps to reproduce: (give a step by step account of how to trigger the bug)

  1. Run reconstruction, look at the output

or look at logs in CI

  1. https://github.com/eic/EICrecon/actions/runs/4170888923/jobs/7220477374

Expected Result: (what do you expect when you execute the steps above)

Remove/hide this output or make it more clear to a regular user.

Actual Result: (what do you get when you execute the steps above)

GetRefChild: Failed to find child with name: HcalEndcapPInsertHits Map contains 25 elements.
   0  B0ECalHits
   0  B0TrackerHits
   0  DIRCBarHits
   0  DRICHHits
   0  EcalBarrelSciGlassHits
   0  EcalEndcapNHits
   0  EcalEndcapPHits
   0  ForwardOffMTrackerHits
   0  ForwardRomanPotHits
   0  HcalBarrelHits
   0  HcalEndcapNHits
   0  HcalEndcapPHits
   0  LumiSpecCALHits
   0  LumiSpecTrackerHits
   0  MPGDBarrelHits
   0  MPGDDIRCHits
   0  MRICHHits
   0  SiBarrelHits
   0  TOFBarrelHits
   0  TOFEndcapHits
   0  TaggerTrackerHits
   0  TrackerEndcapHits
   0  VertexBarrelHits
   0  ZDCEcalHits
   0  ZDCHcalHits
@veprbl
Copy link
Member Author

veprbl commented Feb 15, 2023

Somehow grep GetRefChild doesn't return anything for EICrecon

@DraTeots DraTeots added topic: calorimetry relates to calorimetry part:logging What goes to log and output labels Mar 6, 2023
@veprbl
Copy link
Member Author

veprbl commented Apr 26, 2023

@veprbl
Copy link
Member Author

veprbl commented Apr 26, 2023

Filed AIDASoft/DD4hep#1102

But we should still figure out how to not ignore those exceptions in a loop.

@wdconinc
Copy link
Contributor

wdconinc commented May 2, 2023

One related issue could be that we don't throw these runtime errors up to jana2 anymore, https://github.com/eic/EICrecon/blob/2a3f2680d102d8babd7952ca5ed18c7245783b49/src/algorithms/calorimetry/CalorimeterHitDigi.cc. That means jana2 doesn't know to start treating the algorithm as bad and we get GetRefChild errors for every event.

@veprbl
Copy link
Member Author

veprbl commented May 4, 2023

AIDASoft/DD4hep#1106
cc @wdconinc

@veprbl
Copy link
Member Author

veprbl commented May 4, 2023

Silencing the excessive output is an immediate issue for the upcoming production. The upstream PR above addresses that. The issue with exception handling in EICrecon would need to be filed and addressed separately.

@veprbl
Copy link
Member Author

veprbl commented May 4, 2023

Okay, it would seem there will be rebase conflicts due to recent changes. Here is a patch tested with 01-25-01:

diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp
index 12262bb7..c938ad6a 100644
--- a/DDCore/src/DetectorImp.cpp
+++ b/DDCore/src/DetectorImp.cpp
@@ -631,17 +631,22 @@ vector<DetElement> DetectorImp::detectors(const string& type1,
 }
 
 Handle<NamedObject> DetectorImp::getRefChild(const HandleMap& e, const string& name, bool do_throw) const {
-  HandleMap::const_iterator i = e.find(name);
-  if (i != e.end()) {
-    return (*i).second;
+  HandleMap::const_iterator it = e.find(name);
+  if (it != e.end()) {
+    return it->second;
   }
   if (do_throw) {
-    int cnt = 0;
-    cout << "GetRefChild: Failed to find child with name: " << name
-         << " Map contains " << e.size() << " elements." << endl;
-    for(i=e.begin(); i!=e.end(); ++i)
-      cout << "   " << cnt << "  " << (*i).first << endl;
-    throw runtime_error("Cannot find a child with the reference name:" + name);
+    std::stringstream err;
+    err << "getRefChild: Failed to find child with name: " << name
+        << " Map contains " << e.size() << " elements: {";
+    for (it = e.begin(); it != e.end(); ++it) {
+      if (it != e.begin()) {
+        err << ", " << endl;
+      }
+      err << it->first << endl;
+    }
+    err << "}";
+    throw runtime_error(err.str());
   }
   return 0;
 }

@wdconinc
Copy link
Contributor

wdconinc commented May 5, 2023

huh

/usr/bin/patch: **** malformed patch at line 34:  

not sure what's wrong

@veprbl
Copy link
Member Author

veprbl commented May 5, 2023

Could it be that you are missing a trailing newline?

@wdconinc
Copy link
Contributor

wdconinc commented May 5, 2023

That's what it seems like. I'm going through permutations and rediffing... On my phone...

@wdconinc
Copy link
Contributor

I think this can be closed, right?

@veprbl
Copy link
Member Author

veprbl commented Aug 29, 2023

Fixed in DD4hep

@veprbl veprbl closed this as completed Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:logging What goes to log and output topic: calorimetry relates to calorimetry
Projects
None yet
Development

No branches or pull requests

3 participants