ATLAS Offline Software
HIPLArVolumeAccept.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 "HIPLArVolumeAccept.h"
6 
7 #include "G4Event.hh"
8 #include "G4Step.hh"
9 #include "G4RunManagerKernel.hh"
10 #include "G4EventManager.hh"
11 
12 
13 namespace G4UA
14 {
15 
16  //---------------------------------------------------------------------------
18  : AthMessaging(Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc"),
19  "HIPLArVolumeAccept")
20  , m_report()
21  , m_HIPacc(false)
22  {}
23 
24  //---------------------------------------------------------------------------
25  void HIPLArVolumeAccept::UserSteppingAction(const G4Step* aStep)
26  {
27  int PDGcode=aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
28 
29  // check if PDG code compatible with HIP (Monopole:411xxx0 or Qball:100xxxx0)
30  if(abs(PDGcode)>4000000 && abs(PDGcode)<90000000) // likely a HIP, no heavy ion
31  {
32  // in EM calorimeter barrel mother volume (beyond presampler)
33  if(!m_HIPacc && aStep->GetTrack()->GetVolume()->GetName()=="Total LAR Volume") // EMB
34  {
35  m_HIPacc=1;
36  ATH_MSG_INFO("HIPLArVolumeAccept: a particle with PDG code "
37  <<PDGcode
38  <<" entered the volume "
39  <<aStep->GetTrack()->GetVolume()->GetName());
40  }
41  // in EM calorimeter endcap mother volume
42  if(!m_HIPacc && aStep->GetTrack()->GetVolume()->GetName()=="LArEndcapPos") // EMEC
43  {
44  m_HIPacc=1;
45  ATH_MSG_INFO("HIPLArVolumeAccept: a particle with PDG code "
46  <<PDGcode
47  <<" entered the volume "
48  <<aStep->GetTrack()->GetVolume()->GetName());
49  }
50  }
51 
52  }
53 
54  //---------------------------------------------------------------------------
56  m_HIPacc = false;
57  }
58 
59  //---------------------------------------------------------------------------
61  {
62  m_report.HIPevts++;
63  if(!m_HIPacc)
64  {
65  //anEvent->SetEventAborted();
66  G4RunManagerKernel *rmk = G4RunManagerKernel::GetRunManagerKernel();
67  rmk->GetEventManager()->AbortCurrentEvent();
68  rmk->GetEventManager()->GetNonconstCurrentEvent()->SetEventAborted();
70  ATH_MSG_INFO("HIPLArVolumeAccept: no HIP reach the LAr detector volumes. Event aborted.");
71  }
72  }
73 
74 } // namespace G4UA
G4UA::HIPLArVolumeAccept::Report::HIPevts_failed
int HIPevts_failed
Definition: HIPLArVolumeAccept.h:30
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::HIPLArVolumeAccept::m_report
Report m_report
Definition: HIPLArVolumeAccept.h:45
G4UA::HIPLArVolumeAccept::UserSteppingAction
virtual void UserSteppingAction(const G4Step *) override
Definition: HIPLArVolumeAccept.cxx:25
G4UA::HIPLArVolumeAccept::BeginOfEventAction
virtual void BeginOfEventAction(const G4Event *) override
Definition: HIPLArVolumeAccept.cxx:55
G4UA::HIPLArVolumeAccept::Report::HIPevts
int HIPevts
Definition: HIPLArVolumeAccept.h:29
HIPLArVolumeAccept.h
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
G4UA::HIPLArVolumeAccept::m_HIPacc
bool m_HIPacc
Definition: HIPLArVolumeAccept.h:46
G4UA::HIPLArVolumeAccept::EndOfEventAction
virtual void EndOfEventAction(const G4Event *) override
Definition: HIPLArVolumeAccept.cxx:60
Gaudi
=============================================================================
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:273
G4UA::HIPLArVolumeAccept::HIPLArVolumeAccept
HIPLArVolumeAccept()
Definition: HIPLArVolumeAccept.cxx:17