ATLAS Offline Software
HIPKiller.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "HIPKiller.h"
6 #include <iostream>
7 
8 #include "G4Event.hh"
9 #include "G4Step.hh"
10 #include "G4RunManagerKernel.hh"
11 #include "G4EventManager.hh"
12 
14 #include "CLHEP/Units/PhysicalConstants.h"
15 
16 #include "GaudiKernel/Bootstrap.h"
17 #include "GaudiKernel/ISvcLocator.h"
18 #include "GaudiKernel/IMessageSvc.h"
19 
20 namespace G4UA
21 {
22 
23  //---------------------------------------------------------------------------
25  : AthMessaging(Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc"),
26  "HIPKiller")
27  {}
28 
29  //---------------------------------------------------------------------------
30  void HIPKiller::UserSteppingAction(const G4Step* aStep)
31  {
32  int PDGcode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
33 
34  // check if PDG code compatible with HIP (Monopole:411xxx0 or Qball:100xxxx0)
35  if ( MC::isMonopole(PDGcode) || ((int)(abs(PDGcode)/10000000) == 1) )
36  {
37  //std::cout << "SB: HIPKiller Step:" << PDGcode << ", energy="
38  // << aStep->GetTrack()->GetKineticEnergy() << std::endl;
39 
40  // Kill if energy is less than 1MeV
41  if (aStep->GetTrack()->GetKineticEnergy() < 1.0) {
42  aStep->GetTrack()->SetTrackStatus( fStopAndKill );
43  ATH_MSG_WARNING("HIP " << PDGcode << " is being killed: kinetic energy=" <<
44  aStep->GetTrack()->GetKineticEnergy()/CLHEP::MeV << "MeV");
45  }
46  }
47  }
48 
49 } // namespace G4UA
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::HIPKiller::HIPKiller
HIPKiller()
Definition: HIPKiller.cxx:24
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
isMonopole
bool isMonopole(const T &p)
Definition: AtlasPID.h:214
HIPKiller.h
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
G4UA::HIPKiller::UserSteppingAction
virtual void UserSteppingAction(const G4Step *) override
Definition: HIPKiller.cxx:30
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Gaudi
=============================================================================
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:273
HepMCHelpers.h