ATLAS Offline Software
MCTruthSteppingActionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 
8 namespace G4UA
9 {
10 
11  //---------------------------------------------------------------------------
12  // Constructor
13  //---------------------------------------------------------------------------
15  MCTruthSteppingActionTool(const std::string& type, const std::string& name,
16  const IInterface* parent)
18  {
19  declareProperty("VolumeCollectionMap", m_volumeCollectionMap,
20  "Map of volume name to output collection name");
21  }
22 
23  //---------------------------------------------------------------------------
24  // Initialize the tool
25  //---------------------------------------------------------------------------
27  {
28  ATH_MSG_DEBUG( "Initializing " << name() );
29  return StatusCode::SUCCESS;
30  }
31 
32  //---------------------------------------------------------------------------
33  // Create an MCTruthSteppingAction
34  //---------------------------------------------------------------------------
35  std::unique_ptr<MCTruthSteppingAction>
37  {
38  ATH_MSG_DEBUG("Constructing an MCTruthSteppingAction");
39  auto action = std::make_unique<MCTruthSteppingAction> (
41  actionLists.eventActions.push_back( action.get() );
42  actionLists.steppingActions.push_back( action.get() );
43  return action;
44  }
45 
48  {
49  for(const auto& volCollPair : m_volumeCollectionMap) {
50  hitCollections.Emplace<TrackRecordCollection>(volCollPair.second, volCollPair.second);
51  }
52  return StatusCode::SUCCESS;
53  }
56  {
57  for(const auto& volCollPair : m_volumeCollectionMap) {
58  hitCollections.Record<TrackRecordCollection>(volCollPair.second);
59  }
60  return StatusCode::SUCCESS;
61  }
62 
63 } // namespace G4UA
G4UA::G4AtlasUserActions
Struct for passing around user actions.
Definition: IUserActionTool.h:34
HitCollectionMap
Small wrapper around hit collection map to facilitate accessing the hit collection.
Definition: HitCollectionMap.h:21
G4UA::MCTruthSteppingActionTool::BeginOfAthenaEvent
StatusCode BeginOfAthenaEvent(HitCollectionMap &) override
Calls BeginOfAthenaEvent.
Definition: MCTruthSteppingActionTool.cxx:47
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::MCTruthSteppingActionTool::initialize
virtual StatusCode initialize() override final
Initialize the tool.
Definition: MCTruthSteppingActionTool.cxx:26
AtlasHitsVector
Definition: AtlasHitsVector.h:32
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
G4UA::MCTruthSteppingActionTool::MCTruthSteppingActionTool
MCTruthSteppingActionTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: MCTruthSteppingActionTool.cxx:15
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
HitCollectionMap::Emplace
std::pair< StorageIterator, bool > Emplace(std::string const &hitCollectionName, CollectionArgs &&... args)
Insert a container in the map with in-place construction.
Definition: HitCollectionMap.h:38
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
G4UA::MCTruthSteppingActionTool::m_volumeCollectionMap
std::map< std::string, std::string > m_volumeCollectionMap
Map of volume name to output collection name.
Definition: MCTruthSteppingActionTool.h:52
G4UA::MCTruthSteppingAction
User action which handles recording-envelope truth tracks.
Definition: MCTruthSteppingAction.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
G4UA::MCTruthSteppingActionTool::makeAndFillAction
virtual std::unique_ptr< MCTruthSteppingAction > makeAndFillAction(G4AtlasUserActions &) override final
Setup the user action for current thread.
Definition: MCTruthSteppingActionTool.cxx:36
HitCollectionMap::Record
void Record(std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx)
Record the hit collection hitCollectionName to the StoreGate sgKey.
Definition: HitCollectionMap.h:82
G4UA::UserActionToolBase
abstract template utility base-class for G4 user-action tools.
Definition: UserActionToolBase.h:35
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
G4UA::G4AtlasUserActions::eventActions
std::vector< G4UserEventAction * > eventActions
Definition: IUserActionTool.h:38
MCTruthSteppingActionTool.h
G4UA::G4AtlasUserActions::steppingActions
std::vector< G4UserSteppingAction * > steppingActions
Definition: IUserActionTool.h:40
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
G4UA::MCTruthSteppingActionTool::EndOfAthenaEvent
StatusCode EndOfAthenaEvent(HitCollectionMap &) override
Calls EndOfAthenaEvent.
Definition: MCTruthSteppingActionTool.cxx:55