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 
13 #include "CLHEP/Units/PhysicalConstants.h"
14 
15 #include "GaudiKernel/Bootstrap.h"
16 #include "GaudiKernel/ISvcLocator.h"
17 #include "GaudiKernel/IMessageSvc.h"
18 
19 namespace G4UA
20 {
21 
22  //---------------------------------------------------------------------------
24  : AthMessaging(Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc"),
25  "HIPKiller")
26  {}
27 
28  //---------------------------------------------------------------------------
29  void HIPKiller::UserSteppingAction(const G4Step* aStep)
30  {
31  int PDGcode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
32 
33  // check if PDG code compatible with HIP (Monopole:411xxx0 or Qball:100xxxx0)
34  if ( ((abs(PDGcode)/100000==41) && (PDGcode/10000000==0)) ||
35  ((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:23
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
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:29
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Gaudi
=============================================================================
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:273