ATLAS Offline Software
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$
16 #include "HitsFillerAlg.h"
18 #include "MuonSimEvent/MDTSimHit.h"
21 #include "CLHEP/Vector/ThreeVector.h"
23 
24 
25 namespace D3PDTest {
26 
27 
33 HitsFillerAlg::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
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
MDTSimHit
Definition: MDTSimHit.h:21
initialize
void initialize()
Definition: run_EoverP.cxx:894
AtlasHitsVector
Definition: AtlasHitsVector.h:33
MDTSimHitCollection
AtlasHitsVector< MDTSimHit > MDTSimHitCollection
Definition: MDTSimHitCollection.h:14
TrackRecordCollection
AtlasHitsVector< TrackRecord > TrackRecordCollection
Definition: TrackRecordCollection.h:12
x
#define x
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
D3PDTest::HitsFillerAlg::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition: HitsFillerAlg.cxx:46
MDTSimHit.h
D3PDTest::HitsFillerAlg::m_TrackRecordName
std::string m_TrackRecordName
Definition: HitsFillerAlg.h:68
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
D3PDTest::HitsFillerAlg::finalize
virtual StatusCode finalize()
Standard Gaudi finalize method.
Definition: HitsFillerAlg.cxx:56
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
D3PDTest::HitsFillerAlg::fillTrackRecordCollection
StatusCode fillTrackRecordCollection()
Fill a TrackRecordCollection.
Definition: HitsFillerAlg.cxx:93
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PDTest::HitsFillerAlg::m_MDTSimHitName
std::string m_MDTSimHitName
Definition: HitsFillerAlg.h:67
AthAlgorithm
Definition: AthAlgorithm.h:47
TrackRecord.h
MDTSimHitCollection.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TrackRecordCollection.h
D3PDTest::HitsFillerAlg::execute
virtual StatusCode execute()
Standard Gaudi execute method.
Definition: HitsFillerAlg.cxx:122
D3PDTest::HitsFillerAlg::fillMDTSimHitCollection
StatusCode fillMDTSimHitCollection()
Fill a MDTSimHitCollection.
Definition: HitsFillerAlg.cxx:65
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
h
D3PDTest::HitsFillerAlg::m_count
int m_count
Definition: HitsFillerAlg.h:70
D3PDTest
Definition: MapDumper.h:25
HitsFillerAlg.h
Put objects into StoreGate to test D3PD maker.
python.compressB64.c
def c
Definition: compressB64.py:93
D3PDTest::HitsFillerAlg::HitsFillerAlg
HitsFillerAlg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
Definition: HitsFillerAlg.cxx:33