Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:10:46

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019-2022 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include <ActsExamples/EventData/Index.hpp>
0012 
0013 #include <cstdint>
0014 
0015 #include <dfe/dfe_namedtuple.hpp>
0016 
0017 namespace ActsExamples {
0018 
0019 struct ParticleData {
0020   /// Event-unique particle identifier a.k.a barcode.
0021   uint64_t particle_id = 0;
0022   /// Particle type number a.k.a. PDG particle number.
0023   int32_t particle_type = 0;
0024   /// Production process type. Not available in the TrackML datasets.
0025   uint32_t process = 0u;
0026   /// Production position components in mm.
0027   float vx = 0, vy = 0, vz = 0;
0028   // Production time in ns. Not available in the TrackML datasets.
0029   float vt = 0.0f;
0030   /// Momentum components in GeV.
0031   float px = 0, py = 0, pz = 0;
0032   /// Mass in GeV. Not available in the TrackML datasets
0033   float m = 0.0f;
0034   /// Charge in e.
0035   float q = 0;
0036 
0037   DFE_NAMEDTUPLE(ParticleData, particle_id, particle_type, process, vx, vy, vz,
0038                  vt, px, py, pz, m, q);
0039 };
0040 
0041 // Write out simhits before digitization (no hi_id associated)
0042 struct SimHitData {
0043   /// Hit surface identifier. Not available in the TrackML datasets.
0044   uint64_t geometry_id = 0u;
0045   /// Event-unique particle identifier of the generating particle.
0046   uint64_t particle_id = 0;
0047   /// True global hit position components in mm.
0048   float tx = 0, ty = 0, tz = 0;
0049   // True global hit time in ns. Not available in the TrackML datasets.
0050   float tt = 0.0f;
0051   /// True particle momentum in GeV before interaction.
0052   float tpx = 0, tpy = 0, tpz = 0;
0053   /// True particle energy in GeV before interaction.
0054   /// Not available in the TrackML datasets.
0055   float te = 0.0f;
0056   /// True four-momentum change in GeV due to interaction.
0057   /// Not available in the TrackML datasets.
0058   float deltapx = 0.0f;
0059   float deltapy = 0.0f;
0060   float deltapz = 0.0f;
0061   float deltae = 0.0f;
0062   // Hit index along the trajectory. Not available in the TrackML datasets.
0063   int32_t index = -1;
0064 
0065   DFE_NAMEDTUPLE(SimHitData, particle_id, geometry_id, tx, ty, tz, tt, tpx, tpy,
0066                  tpz, te, deltapx, deltapy, deltapz, deltae, index);
0067 };
0068 
0069 // Write out muon simhits before digitization
0070 struct MuonSimHitData {
0071   /// Hit surface identifier. Not available in the TrackML datasets.
0072   int pdgId = 0;
0073   /// three components of the muon station identifier
0074   int StationName = 0;
0075   int StationEta = 0;
0076   int StationPhi = 0;
0077   // True hit location in station frame, in mm.
0078   float LocalPositionExtrx = 0.0f, LocalPositionExtry = 0.0f,
0079         LocalPositionExtrz = 0.0f;
0080   /// True particle momentum in GeV before interaction.
0081   float LocalDirectionx = 0.0f, LocalDirectiony = 0.0f, LocalDirectionz = 0.0f;
0082   DFE_NAMEDTUPLE(MuonSimHitData, pdgId, StationName, StationEta, StationPhi,
0083                  LocalPositionExtrx, LocalPositionExtry, LocalPositionExtrz,
0084                  LocalDirectionx, LocalDirectiony, LocalDirectionz);
0085 };
0086 
0087 // Write out muon simhits before digitization
0088 struct MuonDriftCircleData {
0089   /// Drift radius, in mm.
0090   float driftRadius = 0.0f;
0091   /// Drift tube center location in the station frame
0092   float tubePositionx = 0.0f, tubePositiony = 0.0f, tubePositionz = 0.0f;
0093   /// three components of the muon station identifier
0094   int stationName = 0;
0095   int stationEta = 0;
0096   int stationPhi = 0;
0097   // components of the tube identifier within the station
0098   int multilayer = 0;
0099   int tubelayer = 0;
0100   int tube = 0;
0101 
0102   DFE_NAMEDTUPLE(MuonDriftCircleData, driftRadius, tubePositionx, tubePositiony,
0103                  tubePositionz, stationName, stationEta, stationPhi, multilayer,
0104                  tubelayer, tube);
0105 };
0106 
0107 struct TruthHitData {
0108   /// Event-unique hit identifier. As defined for the simulated hit below and
0109   /// used to link back to it; same value can appear multiple times here due to
0110   /// shared hits in dense environments.
0111   uint64_t hit_id = 0;
0112   /// Hit surface identifier. Not available in the TrackML datasets.
0113   uint64_t geometry_id = 0u;
0114   /// Event-unique particle identifier of the generating particle.
0115   uint64_t particle_id = 0;
0116   /// True global hit position components in mm.
0117   float tx = 0, ty = 0, tz = 0;
0118   // True global hit time in ns. Not available in the TrackML datasets.
0119   float tt = 0.0f;
0120   /// True particle momentum in GeV before interaction.
0121   float tpx = 0, tpy = 0, tpz = 0;
0122   /// True particle energy in GeV before interaction.
0123   /// Not available in the TrackML datasets.
0124   float te = 0.0f;
0125   /// True four-momentum change in GeV due to interaction.
0126   /// Not available in the TrackML datasets.
0127   float deltapx = 0.0f;
0128   float deltapy = 0.0f;
0129   float deltapz = 0.0f;
0130   float deltae = 0.0f;
0131   // Hit index along the trajectory. Not available in the TrackML datasets.
0132   int32_t index = -1;
0133 
0134   DFE_NAMEDTUPLE(TruthHitData, hit_id, particle_id, geometry_id, tx, ty, tz, tt,
0135                  tpx, tpy, tpz, te, deltapx, deltapy, deltapz, deltae, index);
0136 };
0137 
0138 struct HitData {
0139   /// Event-unique hit identifier. Each value can appear at most once.
0140   uint64_t hit_id = 0;
0141   /// Hit surface identifier. Not available in the TrackML datasets.
0142   uint64_t geometry_id = 0u;
0143   /// Global hit position components in mm.
0144   float x = 0, y = 0, z = 0;
0145   /// Global hit time in ns. Not available in the TrackML datasets.
0146   float t = 0.0f;
0147 
0148   DFE_NAMEDTUPLE(HitData, hit_id, geometry_id, x, y, z, t);
0149 };
0150 
0151 struct MeasurementSimHitLink {
0152   /// Event-unique measurement identifier. Each value can appear at most once.
0153   uint64_t measurement_id = 0;
0154   /// Event-unique measurement sim hit identifier.
0155   uint64_t hit_id = 0;
0156 
0157   DFE_NAMEDTUPLE(MeasurementSimHitLink, measurement_id, hit_id);
0158 };
0159 
0160 struct MeasurementData {
0161   /// Event-unique measurement identifier. Each value can appear at most once.
0162   uint64_t measurement_id = 0;
0163   /// Hit surface identifier.
0164   uint64_t geometry_id = 0u;
0165   /// Local hit information - bit identification what's measured
0166   uint8_t local_key = 0;
0167   float local0 = 0, local1 = 0, phi = 0, theta = 0, time = 0;
0168   float var_local0 = 0, var_local1 = 0, var_phi = 0, var_theta = 0,
0169         var_time = 0;
0170 
0171   DFE_NAMEDTUPLE(MeasurementData, measurement_id, geometry_id, local_key,
0172                  local0, local1, phi, theta, time, var_local0, var_local1,
0173                  var_phi, var_theta, var_time);
0174 };
0175 
0176 struct CellData {
0177   /// Hit surface identifier.
0178   uint64_t geometry_id = 0u;
0179   /// Event-unique measurement identifier. As defined for the measurement above
0180   /// and used to link back to it; same value can appear multiple times for
0181   /// clusters with more than one active cell.
0182   uint64_t measurement_id = 0;
0183   /// Digital cell address/ channel
0184   int32_t channel0 = 0, channel1 = 0;
0185   /// Digital cell timestamp. Not available in the TrackML datasets.
0186   float timestamp = 0;
0187   /// (Digital) measured cell value, e.g. amplitude or time-over-threshold.
0188   float value = 0;
0189 
0190   DFE_NAMEDTUPLE(CellData, geometry_id, measurement_id, channel0, channel1,
0191                  timestamp, value);
0192 };
0193 
0194 // uses hit id
0195 struct CellDataLegacy {
0196   /// Hit surface identifier.
0197   uint64_t geometry_id = 0u;
0198   /// Event-unique measurement identifier. As defined for the measurement above
0199   /// and used to link back to it; same value can appear multiple times for
0200   /// clusters with more than one active cell.
0201   uint64_t hit_id = 0;
0202   /// Digital cell address/ channel
0203   int32_t channel0 = 0, channel1 = 0;
0204   /// Digital cell timestamp. Not available in the TrackML datasets.
0205   float timestamp = 0;
0206   /// (Digital) measured cell value, e.g. amplitude or time-over-threshold.
0207   float value = 0;
0208 
0209   DFE_NAMEDTUPLE(CellDataLegacy, geometry_id, hit_id, channel0, channel1,
0210                  timestamp, value);
0211 };
0212 
0213 struct SurfaceData {
0214   /// Surface identifier. Not available in the TrackML datasets.
0215   uint64_t geometry_id = 0;
0216   /// Partially decoded surface identifier components.
0217   uint32_t volume_id = 0, boundary_id = 0, layer_id = 0, module_id = 0;
0218   /// Center position components in mm.
0219   float cx = 0, cy = 0, cz = 0;
0220   /// Rotation matrix components.
0221   float rot_xu = 0, rot_xv = 0, rot_xw = 0;
0222   float rot_yu = 0, rot_yv = 0, rot_yw = 0;
0223   float rot_zu = 0, rot_zv = 0, rot_zw = 0;
0224   /// The type of the surface bpounds object, determines the parameters filled
0225   int bounds_type = 0;
0226   float bound_param0 = -1.f;
0227   float bound_param1 = -1.f;
0228   float bound_param2 = -1.f;
0229   float bound_param3 = -1.f;
0230   float bound_param4 = -1.f;
0231   float bound_param5 = -1.f;
0232   float bound_param6 = -1.f;
0233 
0234   float module_t = -1.f;
0235   float pitch_u = -1.f;
0236   float pitch_v = -1.f;
0237 
0238   DFE_NAMEDTUPLE(SurfaceData, geometry_id, volume_id, boundary_id, layer_id,
0239                  module_id, cx, cy, cz, rot_xu, rot_xv, rot_xw, rot_yu, rot_yv,
0240                  rot_yw, rot_zu, rot_zv, rot_zw, bounds_type, bound_param0,
0241                  bound_param1, bound_param2, bound_param3, bound_param4,
0242                  bound_param5, bound_param6, module_t, pitch_u, pitch_v);
0243 };
0244 
0245 struct LayerVolumeData {
0246   /// Surface identifier. Not available in the TrackML datasets.
0247   uint64_t geometry_id = 0;
0248   /// Partially decoded surface identifier components.
0249   uint32_t volume_id = 0, layer_id = 0;
0250   /// The type of the surface bpounds object, determines the parameters filled
0251   int volume_type = 0;
0252   float min_v0 = -1.f;
0253   float max_v0 = -1.f;
0254   float min_v1 = -1.f;
0255   float max_v1 = -1.f;
0256   float min_v2 = -1.f;
0257   float max_v2 = -1.f;
0258 
0259   DFE_NAMEDTUPLE(LayerVolumeData, geometry_id, volume_id, layer_id, min_v0,
0260                  max_v0, min_v1, max_v1, min_v2, max_v2);
0261 };
0262 
0263 struct SpacePointData {
0264   /// Event-unique measurement identifier. Each value can appear at most once.
0265   uint64_t measurement_id = 0;
0266   /// Space point information
0267   float sp_x = 0, sp_y = 0, sp_z = 0, sp_radius = 0;
0268   float sp_covr = 0, sp_covz = 0;
0269 
0270   // half of the length of the top strip
0271   float sp_topHalfStripLength = 0;
0272   // half of the length of the bottom strip
0273   float sp_bottomHalfStripLength = 0;
0274   // direction of the top strip
0275   Acts::Vector3 sp_topStripDirection;
0276   // direction of the bottom strip
0277   Acts::Vector3 sp_bottomStripDirection;
0278   // distance between the center of the two strips
0279   Acts::Vector3 sp_stripCenterDistance;
0280   // position of the center of the bottom strip
0281   Acts::Vector3 sp_topStripCenterPosition;
0282 
0283   DFE_NAMEDTUPLE(SpacePointData, measurement_id, sp_x, sp_y, sp_z, sp_radius,
0284                  sp_covr, sp_covz, sp_topHalfStripLength,
0285                  sp_bottomHalfStripLength, sp_topStripDirection[0],
0286                  sp_topStripDirection[1], sp_topStripDirection[2],
0287                  sp_bottomStripDirection[0], sp_bottomStripDirection[1],
0288                  sp_bottomStripDirection[2], sp_stripCenterDistance[0],
0289                  sp_stripCenterDistance[1], sp_stripCenterDistance[2],
0290                  sp_topStripCenterPosition[0], sp_topStripCenterPosition[1],
0291                  sp_topStripCenterPosition[2]);
0292 };
0293 
0294 struct SurfaceGridData {
0295   /// Surface identifier. Not available in the TrackML datasets.
0296   uint64_t geometry_id = 0;
0297   /// Partially decoded surface identifier components.
0298   uint32_t volume_id = 0, layer_id = 0, surface_id = 0;
0299   /// The number of bins in loc 0 / 1
0300   int type_loc0 = -1;
0301   int nbins_loc0 = -1;
0302   float min_loc0 = 0, max_loc0 = 0;
0303   int type_loc1 = -1;
0304   int nbins_loc1 = -1;
0305   float min_loc1 = 0, max_loc1 = 0;
0306 
0307   DFE_NAMEDTUPLE(SurfaceGridData, geometry_id, volume_id, layer_id, surface_id,
0308                  type_loc0, nbins_loc0, min_loc0, max_loc0, type_loc1,
0309                  nbins_loc1, min_loc1, max_loc1);
0310 };
0311 
0312 struct SpacepointData {
0313   uint64_t measurement_id;
0314   uint64_t geometry_id;
0315   float x, y, z;
0316   float var_r, var_z;
0317   DFE_NAMEDTUPLE(SpacepointData, measurement_id, geometry_id, x, y, z, var_r,
0318                  var_z);
0319 };
0320 
0321 struct TrackParameterData {
0322   double d0;
0323   double z0;
0324   double phi;
0325   double theta;
0326   double qop;
0327 
0328   double var_d0, var_z0, var_phi, var_theta, var_qop;
0329 
0330   double cov_d0z0, cov_d0phi, cov_d0theta, cov_d0qop;
0331   double cov_z0d0, cov_z0phi, cov_z0theta, cov_z0qop;
0332   double cov_phid0, cov_phiz0, cov_phitheta, cov_phiqop;
0333   double cov_thetad0, cov_thetaz0, cov_thetaphi, cov_thetaqop;
0334   double cov_qopd0, cov_qopz0, cov_qopphi, cov_qoptheta;
0335 
0336   DFE_NAMEDTUPLE(TrackParameterData, d0, z0, phi, theta, qop, var_d0, var_z0,
0337                  var_phi, var_theta, var_qop, cov_d0z0, cov_d0phi, cov_d0theta,
0338                  cov_d0qop, cov_z0d0, cov_z0phi, cov_z0theta, cov_z0qop,
0339                  cov_phid0, cov_phiz0, cov_phitheta, cov_phiqop, cov_thetad0,
0340                  cov_thetaz0, cov_thetaphi, cov_thetaqop, cov_qopd0, cov_qopz0,
0341                  cov_qopphi, cov_qoptheta);
0342 };
0343 
0344 struct ProtoTrackData {
0345   std::size_t trackId;
0346   Index measurementId;
0347   double x, y, z;
0348 
0349   DFE_NAMEDTUPLE(ProtoTrackData, trackId, measurementId, x, y, z);
0350 };
0351 
0352 }  // namespace ActsExamples