| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /**\file | ||
| 2 | * \brief Declarations for hits data on APV managed detectors. | ||
| 3 | * | ||
| 4 | * APV chip is analogue demultiplexer generally used to communicate a vast | ||
| 5 | * number of analog wires into sampling ADC input. Though the ADC is | ||
| 6 | * generally a SADC chip we distinguish between SADC and APV managed detectors | ||
| 7 | * following convention of original COMPASS/NA64 DAQ data decoding library. | ||
| 8 | * | ||
| 9 | * For reconstruction, individual APV hits are usually joined together within | ||
| 10 | * a cluster that then represents a fact of ionazing particle passing through | ||
| 11 | * the detector's active medium. | ||
| 12 | * | ||
| 13 | * These clusters then used in tracking algorithms to reconstruct particle | ||
| 14 | * tracks. | ||
| 15 | * | ||
| 16 | * \author Alexey Shevelev | ||
| 17 | * \author Renat Dusaev | ||
| 18 | * | ||
| 19 | * \warning This is a file generated for event's data structure. | ||
| 20 | * \note Generated at 14/08/2025 23:52:56 with template utils/evstruct/templates/cpp/impl.cc | ||
| 21 | * \version 0.1 | ||
| 22 | */ | ||
| 23 | |||
| 24 | |||
| 25 | #include "na64event/data/apv.hh" | ||
| 26 | |||
| 27 | #include "na64event/data/apv.hh" | ||
| 28 | |||
| 29 | #include "na64event/data/apv.hh" | ||
| 30 | |||
| 31 | #include <cmath> | ||
| 32 | #include "na64event/reset-values.hh" | ||
| 33 | |||
| 34 | namespace na64dp { | ||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | namespace event { | ||
| 41 | ✗ | APVHit::APVHit( LocalMemory & lmem ) | |
| 42 | |||
| 43 | ✗ | {} | |
| 44 | } // namespace ::event::na64dp | ||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | namespace event { | ||
| 49 | ✗ | APVCluster::APVCluster( LocalMemory & lmem ) | |
| 50 | ✗ | : hits(lmem) | |
| 51 | |||
| 52 | ✗ | {} | |
| 53 | } // namespace ::event::na64dp | ||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | namespace util { | ||
| 59 | ✗ | void reset( event::RawDataAPV & obj ) { | |
| 60 | using namespace event; | ||
| 61 | |||
| 62 | ✗ | obj.wireNo = std::numeric_limits<uint16_t>::max();; | |
| 63 | ✗ | ::na64dp::util::reset(obj.chip); | |
| 64 | |||
| 65 | ✗ | ::na64dp::util::reset(obj.srcID); | |
| 66 | |||
| 67 | ✗ | ::na64dp::util::reset(obj.adcID); | |
| 68 | |||
| 69 | ✗ | ::na64dp::util::reset(obj.chipChannel); | |
| 70 | |||
| 71 | ✗ | ::na64dp::util::reset(obj.timeTag); | |
| 72 | obj.samples[0] | ||
| 73 | ✗ | = obj.samples[1] | |
| 74 | ✗ | = obj.samples[2] | |
| 75 | ✗ | = std::numeric_limits<uint32_t>::max(); | |
| 76 | |||
| 77 | } | ||
| 78 | } // namespace ::na64dp::util | ||
| 79 | |||
| 80 | namespace util { | ||
| 81 | ✗ | void reset( event::APVHit & obj ) { | |
| 82 | using namespace event; | ||
| 83 | |||
| 84 | ✗ | ::na64dp::util::reset(obj.rawData); | |
| 85 | |||
| 86 | ✗ | ::na64dp::util::reset(obj.maxCharge); | |
| 87 | |||
| 88 | ✗ | ::na64dp::util::reset(obj.timeRise); | |
| 89 | |||
| 90 | ✗ | ::na64dp::util::reset(obj.a02); | |
| 91 | |||
| 92 | ✗ | ::na64dp::util::reset(obj.a12); | |
| 93 | |||
| 94 | ✗ | ::na64dp::util::reset(obj.t02); | |
| 95 | |||
| 96 | ✗ | ::na64dp::util::reset(obj.t12); | |
| 97 | |||
| 98 | ✗ | ::na64dp::util::reset(obj.t02sigma); | |
| 99 | |||
| 100 | ✗ | ::na64dp::util::reset(obj.t12sigma); | |
| 101 | |||
| 102 | ✗ | ::na64dp::util::reset(obj.time); | |
| 103 | |||
| 104 | ✗ | ::na64dp::util::reset(obj.timeError); | |
| 105 | |||
| 106 | } | ||
| 107 | } // namespace ::na64dp::util | ||
| 108 | |||
| 109 | namespace util { | ||
| 110 | ✗ | void reset( event::APVCluster & obj ) { | |
| 111 | using namespace event; | ||
| 112 | |||
| 113 | ✗ | obj.hits.clear(); | |
| 114 | ✗ | ::na64dp::util::reset(obj.position); | |
| 115 | |||
| 116 | ✗ | ::na64dp::util::reset(obj.positionError); | |
| 117 | |||
| 118 | ✗ | ::na64dp::util::reset(obj.charge); | |
| 119 | |||
| 120 | ✗ | ::na64dp::util::reset(obj.mcTruePosition); | |
| 121 | |||
| 122 | ✗ | ::na64dp::util::reset(obj.time); | |
| 123 | |||
| 124 | ✗ | ::na64dp::util::reset(obj.timeError); | |
| 125 | |||
| 126 | } | ||
| 127 | } // namespace ::na64dp::util | ||
| 128 | |||
| 129 | |||
| 130 | namespace event { | ||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | ✗ | static StdFloat_t _RawDataAPV_get_wireNo( const RawDataAPV & obj ) { | |
| 136 | ✗ | return static_cast<StdFloat_t>(obj.wireNo); // simple value | |
| 137 | } | ||
| 138 | ✗ | static StdFloat_t _RawDataAPV_get_chip( const RawDataAPV & obj ) { | |
| 139 | ✗ | return static_cast<StdFloat_t>(obj.chip); // simple value | |
| 140 | } | ||
| 141 | ✗ | static StdFloat_t _RawDataAPV_get_srcID( const RawDataAPV & obj ) { | |
| 142 | ✗ | return static_cast<StdFloat_t>(obj.srcID); // simple value | |
| 143 | } | ||
| 144 | ✗ | static StdFloat_t _RawDataAPV_get_adcID( const RawDataAPV & obj ) { | |
| 145 | ✗ | return static_cast<StdFloat_t>(obj.adcID); // simple value | |
| 146 | } | ||
| 147 | ✗ | static StdFloat_t _RawDataAPV_get_chipChannel( const RawDataAPV & obj ) { | |
| 148 | ✗ | return static_cast<StdFloat_t>(obj.chipChannel); // simple value | |
| 149 | } | ||
| 150 | ✗ | static StdFloat_t _RawDataAPV_get_timeTag( const RawDataAPV & obj ) { | |
| 151 | ✗ | return static_cast<StdFloat_t>(obj.timeTag); // simple value | |
| 152 | } | ||
| 153 | // getter for RawDataAPV::samples disabled | ||
| 154 | |||
| 155 | |||
| 156 | |||
| 157 | const Traits<RawDataAPV>::Getters | ||
| 158 | Traits<RawDataAPV>::getters = { | ||
| 159 | |||
| 160 | { "wireNo", { "Triggered wire number (detector\u0027s channel)", _RawDataAPV_get_wireNo } }, | ||
| 161 | { "chip", { "chip ID wrt DDD DAQ", _RawDataAPV_get_chip } }, | ||
| 162 | { "srcID", { "source ID wrt DDD DAQ", _RawDataAPV_get_srcID } }, | ||
| 163 | { "adcID", { "adc ID wrt DDD DAQ", _RawDataAPV_get_adcID } }, | ||
| 164 | { "chipChannel", { "channel number inside chip (before remapping)", _RawDataAPV_get_chipChannel } }, | ||
| 165 | { "timeTag", { "Time with the respect to trigger time", _RawDataAPV_get_timeTag } }, | ||
| 166 | |||
| 167 | // getter for RawDataAPV::samples disabled | ||
| 168 | |||
| 169 | |||
| 170 | }; | ||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | |||
| 175 | |||
| 176 | |||
| 177 | // propagated from / rawData:mem::Ref<RawDataAPV> / wireNo:APVDAQWire_t | ||
| 178 | ✗ | static StdFloat_t _APVHit_get_rawData_wireNo( const APVHit & obj_ ) { | |
| 179 | ✗ | if(!obj_.rawData) return std::nan("0"); | |
| 180 | ✗ | const auto & rawData = *obj_.rawData; | |
| 181 | ✗ | const auto & obj = rawData; | |
| 182 | |||
| 183 | ✗ | return static_cast<StdFloat_t>(obj.wireNo); // simple value | |
| 184 | |||
| 185 | } | ||
| 186 | |||
| 187 | // propagated from / rawData:mem::Ref<RawDataAPV> / chip:uint16_t | ||
| 188 | ✗ | static StdFloat_t _APVHit_get_rawData_chip( const APVHit & obj_ ) { | |
| 189 | ✗ | if(!obj_.rawData) return std::nan("0"); | |
| 190 | ✗ | const auto & rawData = *obj_.rawData; | |
| 191 | ✗ | const auto & obj = rawData; | |
| 192 | |||
| 193 | ✗ | return static_cast<StdFloat_t>(obj.chip); // simple value | |
| 194 | |||
| 195 | } | ||
| 196 | |||
| 197 | // propagated from / rawData:mem::Ref<RawDataAPV> / srcID:uint16_t | ||
| 198 | ✗ | static StdFloat_t _APVHit_get_rawData_srcID( const APVHit & obj_ ) { | |
| 199 | ✗ | if(!obj_.rawData) return std::nan("0"); | |
| 200 | ✗ | const auto & rawData = *obj_.rawData; | |
| 201 | ✗ | const auto & obj = rawData; | |
| 202 | |||
| 203 | ✗ | return static_cast<StdFloat_t>(obj.srcID); // simple value | |
| 204 | |||
| 205 | } | ||
| 206 | |||
| 207 | // propagated from / rawData:mem::Ref<RawDataAPV> / adcID:uint16_t | ||
| 208 | ✗ | static StdFloat_t _APVHit_get_rawData_adcID( const APVHit & obj_ ) { | |
| 209 | ✗ | if(!obj_.rawData) return std::nan("0"); | |
| 210 | ✗ | const auto & rawData = *obj_.rawData; | |
| 211 | ✗ | const auto & obj = rawData; | |
| 212 | |||
| 213 | ✗ | return static_cast<StdFloat_t>(obj.adcID); // simple value | |
| 214 | |||
| 215 | } | ||
| 216 | |||
| 217 | // propagated from / rawData:mem::Ref<RawDataAPV> / chipChannel:uint16_t | ||
| 218 | ✗ | static StdFloat_t _APVHit_get_rawData_chipChannel( const APVHit & obj_ ) { | |
| 219 | ✗ | if(!obj_.rawData) return std::nan("0"); | |
| 220 | ✗ | const auto & rawData = *obj_.rawData; | |
| 221 | ✗ | const auto & obj = rawData; | |
| 222 | |||
| 223 | ✗ | return static_cast<StdFloat_t>(obj.chipChannel); // simple value | |
| 224 | |||
| 225 | } | ||
| 226 | |||
| 227 | // propagated from / rawData:mem::Ref<RawDataAPV> / timeTag:uint32_t | ||
| 228 | ✗ | static StdFloat_t _APVHit_get_rawData_timeTag( const APVHit & obj_ ) { | |
| 229 | ✗ | if(!obj_.rawData) return std::nan("0"); | |
| 230 | ✗ | const auto & rawData = *obj_.rawData; | |
| 231 | ✗ | const auto & obj = rawData; | |
| 232 | |||
| 233 | ✗ | return static_cast<StdFloat_t>(obj.timeTag); // simple value | |
| 234 | |||
| 235 | } | ||
| 236 | |||
| 237 | // no std getter for APVHit/rawData/samples | ||
| 238 | |||
| 239 | |||
| 240 | ✗ | static StdFloat_t _APVHit_get_maxCharge( const APVHit & obj ) { | |
| 241 | ✗ | return static_cast<StdFloat_t>(obj.maxCharge); // simple value | |
| 242 | } | ||
| 243 | ✗ | static StdFloat_t _APVHit_get_timeRise( const APVHit & obj ) { | |
| 244 | ✗ | return static_cast<StdFloat_t>(obj.timeRise); // simple value | |
| 245 | } | ||
| 246 | ✗ | static StdFloat_t _APVHit_get_a02( const APVHit & obj ) { | |
| 247 | ✗ | return static_cast<StdFloat_t>(obj.a02); // simple value | |
| 248 | } | ||
| 249 | ✗ | static StdFloat_t _APVHit_get_a12( const APVHit & obj ) { | |
| 250 | ✗ | return static_cast<StdFloat_t>(obj.a12); // simple value | |
| 251 | } | ||
| 252 | ✗ | static StdFloat_t _APVHit_get_t02( const APVHit & obj ) { | |
| 253 | ✗ | return static_cast<StdFloat_t>(obj.t02); // simple value | |
| 254 | } | ||
| 255 | ✗ | static StdFloat_t _APVHit_get_t12( const APVHit & obj ) { | |
| 256 | ✗ | return static_cast<StdFloat_t>(obj.t12); // simple value | |
| 257 | } | ||
| 258 | ✗ | static StdFloat_t _APVHit_get_t02sigma( const APVHit & obj ) { | |
| 259 | ✗ | return static_cast<StdFloat_t>(obj.t02sigma); // simple value | |
| 260 | } | ||
| 261 | ✗ | static StdFloat_t _APVHit_get_t12sigma( const APVHit & obj ) { | |
| 262 | ✗ | return static_cast<StdFloat_t>(obj.t12sigma); // simple value | |
| 263 | } | ||
| 264 | ✗ | static StdFloat_t _APVHit_get_time( const APVHit & obj ) { | |
| 265 | ✗ | return static_cast<StdFloat_t>(obj.time); // simple value | |
| 266 | } | ||
| 267 | ✗ | static StdFloat_t _APVHit_get_timeError( const APVHit & obj ) { | |
| 268 | ✗ | return static_cast<StdFloat_t>(obj.timeError); // simple value | |
| 269 | } | ||
| 270 | |||
| 271 | |||
| 272 | |||
| 273 | const Traits<APVHit>::Getters | ||
| 274 | Traits<APVHit>::getters = { | ||
| 275 | |||
| 276 | |||
| 277 | |||
| 278 | // propagated from / rawData:mem::Ref<RawDataAPV> / wireNo:APVDAQWire_t | ||
| 279 | { "rawData.wireNo", { "Triggered wire number (detector\u0027s channel)", _APVHit_get_rawData_wireNo } }, | ||
| 280 | // propagated from / rawData:mem::Ref<RawDataAPV> / chip:uint16_t | ||
| 281 | { "rawData.chip", { "chip ID wrt DDD DAQ", _APVHit_get_rawData_chip } }, | ||
| 282 | // propagated from / rawData:mem::Ref<RawDataAPV> / srcID:uint16_t | ||
| 283 | { "rawData.srcID", { "source ID wrt DDD DAQ", _APVHit_get_rawData_srcID } }, | ||
| 284 | // propagated from / rawData:mem::Ref<RawDataAPV> / adcID:uint16_t | ||
| 285 | { "rawData.adcID", { "adc ID wrt DDD DAQ", _APVHit_get_rawData_adcID } }, | ||
| 286 | // propagated from / rawData:mem::Ref<RawDataAPV> / chipChannel:uint16_t | ||
| 287 | { "rawData.chipChannel", { "channel number inside chip (before remapping)", _APVHit_get_rawData_chipChannel } }, | ||
| 288 | // propagated from / rawData:mem::Ref<RawDataAPV> / timeTag:uint32_t | ||
| 289 | { "rawData.timeTag", { "Time with the respect to trigger time", _APVHit_get_rawData_timeTag } }, | ||
| 290 | // no std getter for APVHit/rawData/samples | ||
| 291 | |||
| 292 | |||
| 293 | { "maxCharge", { "Hit max charge wrt APV waveform", _APVHit_get_maxCharge } }, | ||
| 294 | { "timeRise", { "Time of rising front", _APVHit_get_timeRise } }, | ||
| 295 | { "a02", { "APV samples amplitude ratio a0/a2", _APVHit_get_a02 } }, | ||
| 296 | { "a12", { "APV samples amplitude ratio a1/a2", _APVHit_get_a12 } }, | ||
| 297 | { "t02", { "Tangent values of raising front, at a0 and a2", _APVHit_get_t02 } }, | ||
| 298 | { "t12", { "Tangent values of raising front, at a1 and a2", _APVHit_get_t12 } }, | ||
| 299 | { "t02sigma", { "Error estimation of tangent raising front", _APVHit_get_t02sigma } }, | ||
| 300 | { "t12sigma", { "Error estimation of tangent raising front", _APVHit_get_t12sigma } }, | ||
| 301 | { "time", { "Estimated hit time, [SADC sample #]", _APVHit_get_time } }, | ||
| 302 | { "timeError", { "Error of hit time estimation, [SADC sample #]", _APVHit_get_timeError } }, | ||
| 303 | |||
| 304 | |||
| 305 | }; | ||
| 306 | |||
| 307 | |||
| 308 | |||
| 309 | |||
| 310 | // getter for APVCluster::hits disabled | ||
| 311 | ✗ | static StdFloat_t _APVCluster_get_position( const APVCluster & obj ) { | |
| 312 | ✗ | return static_cast<StdFloat_t>(obj.position); // simple value | |
| 313 | } | ||
| 314 | ✗ | static StdFloat_t _APVCluster_get_positionError( const APVCluster & obj ) { | |
| 315 | ✗ | return static_cast<StdFloat_t>(obj.positionError); // simple value | |
| 316 | } | ||
| 317 | ✗ | static StdFloat_t _APVCluster_get_charge( const APVCluster & obj ) { | |
| 318 | ✗ | return static_cast<StdFloat_t>(obj.charge); // simple value | |
| 319 | } | ||
| 320 | // getter for APVCluster::mcTruePosition disabled | ||
| 321 | ✗ | static StdFloat_t _APVCluster_get_time( const APVCluster & obj ) { | |
| 322 | ✗ | return static_cast<StdFloat_t>(obj.time); // simple value | |
| 323 | } | ||
| 324 | ✗ | static StdFloat_t _APVCluster_get_timeError( const APVCluster & obj ) { | |
| 325 | ✗ | return static_cast<StdFloat_t>(obj.timeError); // simple value | |
| 326 | } | ||
| 327 | |||
| 328 | ✗ | static StdFloat_t _APVCluster_get_size( const APVCluster & obj ) { return obj.hits.size(); } | |
| 329 | ✗ | static StdFloat_t _APVCluster_get_avrgCharge( const APVCluster & obj ) { return obj.charge / obj.hits.size(); } | |
| 330 | |||
| 331 | |||
| 332 | const Traits<APVCluster>::Getters | ||
| 333 | Traits<APVCluster>::getters = { | ||
| 334 | |||
| 335 | |||
| 336 | // getter for APVCluster::hits disabled | ||
| 337 | { "position", { "Coordinate of cluster\u0027s center, wire number units", _APVCluster_get_position } }, | ||
| 338 | { "positionError", { "Coordinate uncertainty, wire units", _APVCluster_get_positionError } }, | ||
| 339 | { "charge", { "Cluster charge sum (unnormed), sum of all hit\u0027s amplitude measurements", _APVCluster_get_charge } }, | ||
| 340 | |||
| 341 | // getter for APVCluster::mcTruePosition disabled | ||
| 342 | { "time", { "Cluster time", _APVCluster_get_time } }, | ||
| 343 | { "timeError", { "Cluster time estimated error", _APVCluster_get_timeError } }, | ||
| 344 | |||
| 345 | { "size", { "Returns number of hits included in cluster.", _APVCluster_get_size } }, | ||
| 346 | { "avrgCharge", { "Average charge value.", _APVCluster_get_avrgCharge } }, | ||
| 347 | |||
| 348 | }; | ||
| 349 | |||
| 350 | |||
| 351 | |||
| 352 | } // namespace ::na64dp::event | ||
| 353 | } // namespace na64dp | ||
| 354 |