32 {
33
34 const EventContext& ctx{Gaudi::Hive::currentContext()};
35
36 constexpr std::string_view delim = ",";
37 std::ofstream
file{std::string(Form(
"event%09zu-",++
m_event))+
"SpacePoints.csv"};
38
40 file<<
"sectorId"<<delim;
41
42 file<<
"bucketId"<<delim;
44 file<<
"locPositionX"<<delim;
45 file<<
"locPositionY"<<delim;
46 file<<
"locPositionZ"<<delim;
48 file<<
"locSensorDirX"<<delim;
49 file<<
"locSensorDirY"<<delim;
50 file<<
"locSensorDirZ"<<delim;
52 file<<
"locSensorNormX"<<delim;
53 file<<
"locSensorNormY"<<delim;
54 file<<
"locSensorNormZ"<<delim;
56 file<<
"locPlaneNormX"<<delim;
57 file<<
"locPlaneNormY"<<delim;
58 file<<
"locPlaneNormZ"<<delim;
64 file<<
"driftR"<<delim;
66 file<<
"gasGap"<<delim;
67 file<<
"primaryCh"<<delim;
68 file<<
"measuresEta"<<delim;
69 file<<
"measuresPhi"<<delim;
70 file<<
"measuresTime"<<delim;
72
73 auto dumpToFile = [&](const unsigned bucketId,
76
77 const Identifier& measId = spacePoint.identify();
79 int primaryCh{0};
81 const TechIndex techIdx =
m_idHelperSvc->technologyIndex(measId);
82 switch (techIdx) {
83 case TechIndex::MDT: {
85 primaryCh = idHelper.
tube(measId);
86 break;
87 }
88 case TechIndex::RPC: {
90 primaryCh = idHelper.
channel(measId);
91 break;
92 }
93 case TechIndex::TGC: {
95 primaryCh = idHelper.
channel(measId);
96 break;
97 }
98 case TechIndex::STGC: {
100 primaryCh = idHelper.
channel(measId);
101 break;
102 }
103 case TechIndex::MM: {
105 primaryCh = idHelper.
channel(measId);
106 break;
107 }
108 default:
110 };
111
112 const int secId = encodeId(static_cast<int8_t>(spacePoint.msSector()->chamberIndex()),
113 spacePoint.msSector()->side(),
114 spacePoint.msSector()->sector(),
115 static_cast<int8_t>(techIdx));
116
118 file<<bucketId<<delim;
119 file<<precCutOff(spacePoint.localPosition().x())<<delim;
120 file<<precCutOff(spacePoint.localPosition().y())<<delim;
121 file<<precCutOff(spacePoint.localPosition().z())<<delim;
122
123 file<<precCutOff(spacePoint.sensorDirection().x())<<delim;
124 file<<precCutOff(spacePoint.sensorDirection().y())<<delim;
125 file<<precCutOff(spacePoint.sensorDirection().z())<<delim;
126
127 file<<precCutOff(spacePoint.toNextSensor().x())<<delim;
128 file<<precCutOff(spacePoint.toNextSensor().y())<<delim;
129 file<<precCutOff(spacePoint.toNextSensor().z())<<delim;
130
131 file<<precCutOff(spacePoint.planeNormal().x())<<delim;
132 file<<precCutOff(spacePoint.planeNormal().y())<<delim;
133 file<<precCutOff(spacePoint.planeNormal().z())<<delim;
134
136 file<<precCutOff(spacePoint.covariance()[Acts::toUnderlying(CovIdx::phiCov)])<<delim;
137 file<<precCutOff(spacePoint.covariance()[Acts::toUnderlying(CovIdx::etaCov)])<<delim;
140 file<<precCutOff(spacePoint.driftRadius())<<delim;
142 file<<primaryCh<<delim;
143 file<<spacePoint.measuresEta()<<delim;
144 file<<spacePoint.measuresPhi()<<delim;
148 };
149
150 for (
const SG::ReadHandleKey<SpacePointContainer>& key :
m_readKeys) {
153
154 const SpacePointPerLayerSorter layerSorter{};
155 for(const SpacePointBucket* bucket : *spContainer) {
156 std::vector<unsigned int> layNumbers{};
157 for (const SpacePointBucket::value_type& spacePoint: *bucket) {
158 const unsigned int layNum = layerSorter.sectorLayerNum(*spacePoint);
159 if (std::find(layNumbers.begin(), layNumbers.end(), layNum) == layNumbers.end()) {
160 layNumbers.push_back(layNum);
161 }
162 const unsigned gasGap = layNumbers.size()-1;
163 dumpToFile(bucket->bucketId(), *spacePoint, gasGap);
164 }
165 }
166 }
167 return StatusCode::SUCCESS;
168}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
int tube(const Identifier &id) const
int channel(const Identifier &id) const override
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
SG::ReadHandleKeyArray< SpacePointContainer > m_readKeys
int channel(const Identifier &id) const override
int channel(const Identifier &id) const override
int channel(const Identifier &id) const override
SpacePoint::CovIdx CovIdx
########################################## SpacePointMakerAlg #######################################...
DataVector< SpacePointBucket > SpacePointContainer
Abrivation of the space point container type.
TechnologyIndex
enum to classify the different layers in the muon spectrometer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.