14 constexpr
int encodeId(
const int8_t stName,
const int8_t stEta,
15 const int8_t sector,
const int8_t tech) {
16 return ( tech <<24 | sector <<16 |stEta << 8| stName);
18 constexpr
double precCutOff(
const double value,
const double cutOff = 1.
e-15) {
29 return StatusCode::SUCCESS;
34 const EventContext& ctx{Gaudi::Hive::currentContext()};
36 constexpr std::string_view delim =
",";
37 std::ofstream
file{std::string(Form(
"event%09zu-",++
m_event))+
"SpacePoints.csv"};
40 file<<
"sectorId"<<delim;
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<<
"locPlaneNormX"<<delim;
53 file<<
"locPlaneNormY"<<delim;
54 file<<
"locPlaneNormZ"<<delim;
61 file<<
"driftR"<<delim;
63 file<<
"gasGap"<<delim;
64 file<<
"primaryCh"<<delim;
65 file<<
"measuresEta"<<delim;
66 file<<
"measuresPhi"<<delim;
69 auto dumpToFile = [&](
const unsigned bucketId,
73 const Identifier& measId = spacePoint.identify();
77 const TechIndex techIdx =
m_idHelperSvc->technologyIndex(measId);
81 primaryCh = idHelper.tube(measId);
86 primaryCh = idHelper.channel(measId);
91 primaryCh = idHelper.channel(measId);
96 primaryCh = idHelper.channel(measId);
101 primaryCh = idHelper.channel(measId);
108 const int secId = encodeId(
static_cast<int8_t
>(spacePoint.msSector()->chamberIndex()),
109 spacePoint.msSector()->side(),
110 spacePoint.msSector()->sector(),
111 static_cast<int8_t
>(techIdx));
114 file<<bucketId<<delim;
115 file<<precCutOff(spacePoint.positionInChamber().x())<<delim;
116 file<<precCutOff(spacePoint.positionInChamber().y())<<delim;
117 file<<precCutOff(spacePoint.positionInChamber().z())<<delim;
119 file<<precCutOff(spacePoint.directionInChamber().x())<<delim;
120 file<<precCutOff(spacePoint.directionInChamber().y())<<delim;
121 file<<precCutOff(spacePoint.directionInChamber().z())<<delim;
123 file<<precCutOff(spacePoint.planeNormal().x())<<delim;
124 file<<precCutOff(spacePoint.planeNormal().y())<<delim;
125 file<<precCutOff(spacePoint.planeNormal().z())<<delim;
131 file<<precCutOff(spacePoint.driftRadius())<<delim;
133 file<<primaryCh<<delim;
134 file<<spacePoint.measuresEta()<<delim;
135 file<<spacePoint.measuresPhi()<<delim;
145 std::unordered_map<Identifier, unsigned> gasNumbers{};
146 for (
const SpacePointBucket::value_type& spacePoint: *bucket) {
147 unsigned int gasGap{gasNumbers.insert(
148 std::make_pair(layerSorter.detectorLayerId(spacePoint->identify()),
149 gasNumbers.size())).first->second};
150 dumpToFile(bucket->bucketId(), *spacePoint,
gasGap);
154 return StatusCode::SUCCESS;