CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ExceptionHandler Class Reference

#include <ExceptionHandler.h>

Inheritance diagram for ExceptionHandler:

Public Member Functions

 ExceptionHandler (const ExceptionHandler &)=delete
 
 ExceptionHandler (double th)
 
bool Notify (const char *exceptionOrigin, const char *exceptionCode, G4ExceptionSeverity severity, const char *description) override
 
int operator!= (const ExceptionHandler &right) const
 
ExceptionHandleroperator= (const ExceptionHandler &right)=delete
 
int operator== (const ExceptionHandler &right) const
 
 ~ExceptionHandler () override
 

Private Attributes

double m_eth
 

Detailed Description

Definition at line 19 of file ExceptionHandler.h.

Constructor & Destructor Documentation

◆ ExceptionHandler() [1/2]

ExceptionHandler::ExceptionHandler ( double  th)
explicit

Definition at line 12 of file ExceptionHandler.cc.

12 : m_eth(th) {}

◆ ~ExceptionHandler()

ExceptionHandler::~ExceptionHandler ( )
override

Definition at line 14 of file ExceptionHandler.cc.

14 {}

◆ ExceptionHandler() [2/2]

ExceptionHandler::ExceptionHandler ( const ExceptionHandler )
delete

Member Function Documentation

◆ Notify()

bool ExceptionHandler::Notify ( const char *  exceptionOrigin,
const char *  exceptionCode,
G4ExceptionSeverity  severity,
const char *  description 
)
override

Definition at line 16 of file ExceptionHandler.cc.

19  {
20  static const G4String es_banner = "\n-------- EEEE ------- G4Exception-START -------- EEEE -------\n";
21  static const G4String ee_banner = "\n-------- EEEE -------- G4Exception-END --------- EEEE -------\n";
22  static const G4String ws_banner = "\n-------- WWWW ------- G4Exception-START -------- WWWW -------\n";
23  static const G4String we_banner = "\n-------- WWWW -------- G4Exception-END --------- WWWW -------\n";
24 
25  const G4Track* track = G4EventManager::GetEventManager()->GetTrackingManager()->GetTrack();
26  double ekin = m_eth;
27 
28  std::stringstream message;
29  message << "*** G4Exception : " << exceptionCode << "\n"
30  << " issued by : " << exceptionOrigin << "\n"
31  << description;
32 
33  // part of exception happens outside tracking loop
34  if (nullptr != track) {
35  ekin = track->GetKineticEnergy();
36  message << "\n"
37  << "TrackID=" << track->GetTrackID() << " ParentID=" << track->GetParentID() << " "
38  << track->GetParticleDefinition()->GetParticleName() << "; Ekin(MeV)=" << ekin / CLHEP::MeV
39  << "; time(ns)=" << track->GetGlobalTime() / CLHEP::ns << "; status=" << track->GetTrackStatus()
40  << "\n position(mm): " << track->GetPosition() << "; direction: " << track->GetMomentumDirection();
41  const G4VPhysicalVolume* vol = track->GetVolume();
42  if (nullptr != vol) {
43  message << "\n PhysicalVolume: " << vol->GetName() << "; material: " << track->GetMaterial()->GetName();
44  }
45  message << "\n stepNumber=" << track->GetCurrentStepNumber()
46  << "; stepLength(mm)=" << track->GetStepLength() / CLHEP::mm << "; weight=" << track->GetWeight();
47  const G4VProcess* proc = track->GetCreatorProcess();
48  if (nullptr != proc) {
49  message << "; creatorProcess: " << proc->GetProcessName() << "; modelID=" << track->GetCreatorModelID();
50  }
51  }
52  message << "\n";
53 
54  G4ExceptionSeverity localSeverity = severity;
55  G4String code = G4String(*exceptionCode);
56  if (ekin < m_eth && code == "GeomNav0003") {
57  localSeverity = JustWarning;
58  }
59 
60  std::stringstream ss;
61  switch (localSeverity) {
62  case FatalException:
63  case FatalErrorInArgument:
64  case RunMustBeAborted:
65  case EventMustBeAborted:
66  ss << es_banner << message.str() << ee_banner;
67  throw SimG4Exception(ss.str());
68  break;
69 
70  case JustWarning:
71  edm::LogWarning("SimG4CoreApplication")
72  << ws_banner << message.str() << "*** This is just a warning message. ***" << we_banner;
73  break;
74  }
75  return false;
76 }

References edmLumisInFiles::description, m_eth, MeV, ValidateTausOnZEEFastSim_cff::proc, ErrorSummaryFilter_cfi::severity, contentValuesCheck::ss, and HLT_FULL_cff::track.

◆ operator!=()

int ExceptionHandler::operator!= ( const ExceptionHandler right) const
inline

Definition at line 25 of file ExceptionHandler.h.

25 { return (this != &right); }

◆ operator=()

ExceptionHandler& ExceptionHandler::operator= ( const ExceptionHandler right)
delete

◆ operator==()

int ExceptionHandler::operator== ( const ExceptionHandler right) const
inline

Definition at line 24 of file ExceptionHandler.h.

24 { return (this == &right); }

Member Data Documentation

◆ m_eth

double ExceptionHandler::m_eth
private

Definition at line 36 of file ExceptionHandler.h.

Referenced by Notify().

HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
ExceptionHandler::m_eth
double m_eth
Definition: ExceptionHandler.h:36
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
SimG4Exception
Definition: SimG4Exception.h:13
MeV
const double MeV
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
ValidateTausOnZEEFastSim_cff.proc
proc
Definition: ValidateTausOnZEEFastSim_cff.py:6
ErrorSummaryFilter_cfi.severity
severity
Definition: ErrorSummaryFilter_cfi.py:5