ATLAS Offline Software
Loading...
Searching...
No Matches
HitsFillerAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id$
14
15
16#include "HitsFillerAlg.h"
21#include "CLHEP/Vector/ThreeVector.h"
23
24
25namespace D3PDTest {
26
27
33HitsFillerAlg::HitsFillerAlg (const std::string& name,
34 ISvcLocator* svcloc)
35 : AthAlgorithm (name, svcloc),
36 m_count (0)
37{
38 declareProperty ("MDTSimHitName", m_MDTSimHitName = "MDTSimHits");
39 declareProperty ("TrackRecordName", m_TrackRecordName = "TrackRecord");
40}
41
42
47{
48 m_count = 0;
49 return AthAlgorithm::initialize();
50}
51
52
57{
58 return AthAlgorithm::finalize();
59}
60
61
66{
68
69 for (int i = 0; i < 10; i++) {
70 int j = i * 10 + m_count;
71 MDTSimHit h (j,
72 j+10, // time
73 j+11, // radius
74 Amg::Vector3D(j+12,j+13,j+14), //position
75 j+15, // trackNumber
76 j+16, // stepLength
77 j+17, // energyDeposit
78 j+18, // particleEncoding,
79 j+19 // kineticEnergy
80 );
81 c->push_back (h);
82 }
83
84 CHECK( this->evtStore()->record (c, m_MDTSimHitName) );
85
86 return StatusCode::SUCCESS;
87}
88
89
94{
96
97 for (int i = 0; i < 10; i++) {
98 int j = i * 10 + m_count;
99 CLHEP::Hep3Vector p(j+11,j+12,j+13);
100 CLHEP::Hep3Vector x(j+14,j+15,j+16);
101 c->Emplace(j, // PDG
102 j+20, // status
103 (j+10)*1000, // energy
104 p, //position
105 x, //momentum
106 j+17, // time
107 j+18, // barcode
108 j+19, // id
109 "volname" // volume name
110 );
111 }
112
113 CHECK( this->evtStore()->record (c, m_TrackRecordName) );
114
115 return StatusCode::SUCCESS;
116}
117
118
123{
126
127 ++m_count;
128 return StatusCode::SUCCESS;
129}
130
131
132} // namespace D3PDTest
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Put objects into StoreGate to test D3PD maker.
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
AtlasHitsVector< TrackRecord > TrackRecordCollection
#define x
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Header file for AthHistogramAlgorithm.
StatusCode fillTrackRecordCollection()
Fill a TrackRecordCollection.
HitsFillerAlg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
std::string m_TrackRecordName
virtual StatusCode finalize()
Standard Gaudi finalize method.
virtual StatusCode initialize()
Standard Gaudi initialize method.
virtual StatusCode execute()
Standard Gaudi execute method.
StatusCode fillMDTSimHitCollection()
Fill a MDTSimHitCollection.
Eigen::Matrix< double, 3, 1 > Vector3D