checks momentum conservation
More...
#include <MomentumConservation.h>
|
| | MomentumConservation () |
| virtual void | EndOfEventAction (const G4Event *) override |
| virtual void | UserSteppingAction (const G4Step *) override |
| bool | msgLvl (const MSG::Level lvl) const |
| | Test the output level.
|
| MsgStream & | msg () const |
| | The standard message stream.
|
| MsgStream & | msg (const MSG::Level lvl) const |
| | The standard message stream.
|
| void | setLevel (MSG::Level lvl) |
| | Change the current logging level.
|
|
| void | initMessaging () const |
| | Initialize our message level and MessageSvc.
|
|
| double | _sum_edep |
| | Sum of energy deposited in the detector.
|
| double | _sum_eesc |
| | Sum of energy escaping the detector (volume = 0)
|
| std::string | m_nm |
| | Message source name.
|
| boost::thread_specific_ptr< MsgStream > | m_msg_tls |
| | MsgStream instance (a std::cout like with print-out levels)
|
| std::atomic< IMessageSvc * > | m_imsg { nullptr } |
| | MessageSvc pointer.
|
| std::atomic< MSG::Level > | m_lvl { MSG::NIL } |
| | Current logging level.
|
| std::atomic_flag m_initialized | ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
| | Messaging initialized (initMessaging)
|
checks momentum conservation
Definition at line 19 of file MomentumConservation.h.
◆ MomentumConservation()
| G4UA::MomentumConservation::MomentumConservation |
( |
| ) |
|
Definition at line 16 of file MomentumConservation.cxx.
19 {}
AthMessaging()
Default constructor:
double _sum_edep
Sum of energy deposited in the detector.
double _sum_eesc
Sum of energy escaping the detector (volume = 0)
◆ EndOfEventAction()
| void G4UA::MomentumConservation::EndOfEventAction |
( |
const G4Event * | anEvent | ) |
|
|
overridevirtual |
- Todo
- Does G4PrimaryParticle really have no Get(Total/Kinetic)Energy methods?
- Todo
- Todo
- Do we need to add up the total energy at the start?
- Todo
- Everything! Use truth strategy as for neutrinos
Definition at line 21 of file MomentumConservation.cxx.
22 {
23
24
25
26
27 double eprim = 0;
28
29 for (int iv = 0; iv < anEvent->GetNumberOfPrimaryVertex(); ++iv) {
30 const G4PrimaryVertex*
v = anEvent->GetPrimaryVertex(iv);
31 for (
int ip = 0;
ip <
v->GetNumberOfParticle(); ++
ip) {
32 const G4PrimaryParticle*
p =
v->GetPrimary(ip);
35 eprim +=
p->GetMomentum().mag();
36 }
37 }
38
39
40 double eneut = 0;
41
42
43
46 << "initial = " << eprim/CLHEP::GeV << " GeV, "
47 << "final = " << efinal/CLHEP::GeV << " GeV" );
48
49
50
52
53
56
57 }
◆ initMessaging()
| void AthMessaging::initMessaging |
( |
| ) |
const |
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
40{
42
43 if (
m_lvl == MSG::NIL) {
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)
◆ msg() [1/2]
| MsgStream & AthMessaging::msg |
( |
| ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 163 of file AthMessaging.h.
164{
166 if (!ms) {
170 }
171
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.
◆ msg() [2/2]
| MsgStream & AthMessaging::msg |
( |
const MSG::Level | lvl | ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 178 of file AthMessaging.h.
179{
return msg() << lvl; }
MsgStream & msg() const
The standard message stream.
◆ msgLvl()
| bool AthMessaging::msgLvl |
( |
const MSG::Level | lvl | ) |
const |
|
inlineinherited |
Test the output level.
- Parameters
-
| lvl | The message level to test against |
- Returns
- boolean Indicating if messages at given level will be printed
- Return values
-
| true | Messages at level "lvl" will be printed |
Definition at line 151 of file AthMessaging.h.
152{
155 return true;
156 } else {
157 return false;
158 }
159}
◆ setLevel()
| void AthMessaging::setLevel |
( |
MSG::Level | lvl | ) |
|
|
inherited |
◆ UserSteppingAction()
| void G4UA::MomentumConservation::UserSteppingAction |
( |
const G4Step * | aStep | ) |
|
|
overridevirtual |
- Todo
- Should this be GetKineticEnergy?
Definition at line 59 of file MomentumConservation.cxx.
59 {
60
61 if (aStep->GetPostStepPoint()->GetPhysicalVolume() != 0) {
62 const double edep = aStep->GetTotalEnergyDeposit();
64 } else {
66 const double eesc = aStep->GetPostStepPoint()->GetTotalEnergy();
68 }
69
70 }
◆ _sum_edep
| double G4UA::MomentumConservation::_sum_edep |
|
private |
◆ _sum_eesc
| double G4UA::MomentumConservation::_sum_eesc |
|
private |
◆ ATLAS_THREAD_SAFE
| std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ m_imsg
| std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_lvl
| std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ m_msg_tls
| boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls |
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels)
Definition at line 132 of file AthMessaging.h.
◆ m_nm
| std::string AthMessaging::m_nm |
|
privateinherited |
The documentation for this class was generated from the following files: