| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | /**\file | ||
| 4 | * \brief Main event structure declaration | ||
| 5 | * | ||
| 6 | * The event structure is the principal declaration affecting every handler | ||
| 7 | * within the pipeline. Handlers take and modify the data from/within an event | ||
| 8 | * instance, by accessing its members. | ||
| 9 | * | ||
| 10 | * Refer to :ref:`event structure` for insights of | ||
| 11 | * how to modify the events composition. | ||
| 12 | * | ||
| 13 | * \warning This is a file generated for event's data structure. | ||
| 14 | * \note Generated at 14/08/2025 23:52:56 with template utils/evstruct/templates/cpp/decl.hh | ||
| 15 | * \version 0.1 | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <stdexcept> | ||
| 19 | #include <variant> | ||
| 20 | #include "na64event/mem-mapping.hh" | ||
| 21 | #include "na64util/mem/fwd.hh" | ||
| 22 | #include "na64event/reset-values.hh" | ||
| 23 | #include "na64event/stream.hh" | ||
| 24 | #include "na64detID/detectorID.hh" | ||
| 25 | #include "na64util/na64/event-id.hh" | ||
| 26 | #include "na64event/data/apv.hh" | ||
| 27 | #include "na64event/data/calo.hh" | ||
| 28 | #include "na64event/data/f1.hh" | ||
| 29 | #include "na64event/data/sadc.hh" | ||
| 30 | #include "na64event/data/stwTDC.hh" | ||
| 31 | #include "na64event/data/track.hh" | ||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | namespace na64dp { | ||
| 36 | |||
| 37 | namespace event { | ||
| 38 | /// \brief Singular event field for Monte-Carlo true values. | ||
| 39 | /// | ||
| 40 | /// These structure was copied from "official reconstruction" and corresponds to | ||
| 41 | /// field found in MK MC package. | ||
| 42 | /// | ||
| 43 | /// **GETTER**: | ||
| 44 | /// * `weight` \-- A "statistical weight" of the event | ||
| 45 | /// * getter for field `MCTruthInfo::beamPosition` **disabled** | ||
| 46 | /// * getter for field `MCTruthInfo::beamMomentum` **disabled** | ||
| 47 | /// * `beamE0` \-- initializing particle initial full E (TODO: redundant?) | ||
| 48 | /// * getter for field `MCTruthInfo::ecalEntryPoisition` **disabled** | ||
| 49 | /// * `beamPDG` \-- PDG code of initializing particle | ||
| 50 | struct MCTruthInfo { | ||
| 51 | /// A "statistical weight" of the event | ||
| 52 | double weight; | ||
| 53 | |||
| 54 | /// initializing particle initial position | ||
| 55 | double beamPosition[3]; | ||
| 56 | |||
| 57 | /// initializing particle initial momentum | ||
| 58 | double beamMomentum[3]; | ||
| 59 | |||
| 60 | /// initializing particle initial full E (TODO: redundant?) | ||
| 61 | double beamE0; | ||
| 62 | |||
| 63 | /// initializing particle initial full E (TODO: redundant?) | ||
| 64 | double ecalEntryPoisition[3]; | ||
| 65 | |||
| 66 | /// PDG code of initializing particle | ||
| 67 | int beamPDG; | ||
| 68 | |||
| 69 | /// Default ctr (creates uninitialized instance of MCTruthInfo. | ||
| 70 | MCTruthInfo(){} | ||
| 71 | /// A ctr, ignores memory arg (creates uninitialized instance of MCTruthInfo. | ||
| 72 | /// Needed to simplify compatibility with template code. | ||
| 73 | MCTruthInfo( LocalMemory & ) {} | ||
| 74 | |||
| 75 | }; // struct MCTruthInfo | ||
| 76 | |||
| 77 | #define M_for_every_MCTruthInfo_collection_attribute( m, ... ) \ | ||
| 78 | m(beamPosition, , double, __VA_RGS__) \ | ||
| 79 | m(beamMomentum, , double, __VA_RGS__) \ | ||
| 80 | m(ecalEntryPoisition, , double, __VA_RGS__) \ | ||
| 81 | /* ... */ | ||
| 82 | template<> | ||
| 83 | struct Traits<MCTruthInfo> { | ||
| 84 | static constexpr char typeName[] = "MCTruthInfo"; | ||
| 85 | /// Callback function type, receiving an instance of type `MCTruthInfo` and | ||
| 86 | /// returning certain `double` value. | ||
| 87 | typedef StdFloat_t (*Getter)(const MCTruthInfo & obj); | ||
| 88 | typedef std::unordered_map<std::string, std::pair<std::string, Getter> > Getters; | ||
| 89 | |||
| 90 | /// A map of (standard) getters; key is "name:str" of the getter, entry pair | ||
| 91 | /// is ("description:str", "callback:func") | ||
| 92 | static const Getters getters; | ||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | template<typename CallableT, typename ObjectT=MCTruthInfo> | ||
| 97 | static void for_each_attr( CallableT callable, ObjectT & obj ) { | ||
| 98 | callable( CallableTraits<CallableT>::attr_id(0, "weight"), obj.weight ); | ||
| 99 | callable( CallableTraits<CallableT>::attr_id(1, "beamPosition"), obj.beamPosition ); | ||
| 100 | callable( CallableTraits<CallableT>::attr_id(2, "beamMomentum"), obj.beamMomentum ); | ||
| 101 | callable( CallableTraits<CallableT>::attr_id(3, "beamE0"), obj.beamE0 ); | ||
| 102 | callable( CallableTraits<CallableT>::attr_id(4, "ecalEntryPoisition"), obj.ecalEntryPoisition ); | ||
| 103 | callable( CallableTraits<CallableT>::attr_id(5, "beamPDG"), obj.beamPDG ); | ||
| 104 | |||
| 105 | } | ||
| 106 | }; | ||
| 107 | |||
| 108 | } // namespace ::na64dp::event | ||
| 109 | |||
| 110 | namespace util { | ||
| 111 | /// Sets instance of `MCTruthInfo` to uninitialized state | ||
| 112 | void reset( event::MCTruthInfo & ); | ||
| 113 | } // namespace ::na64dp::util | ||
| 114 | |||
| 115 | |||
| 116 | namespace mem { | ||
| 117 | template<> struct PoolTraits<event::MCTruthInfo> { | ||
| 118 | static constexpr int id = 0; | ||
| 119 | }; | ||
| 120 | } // namespace ::na64dp::mem | ||
| 121 | |||
| 122 | |||
| 123 | namespace event { | ||
| 124 | /// \brief Production and/or decay vertex | ||
| 125 | /// | ||
| 126 | /// This vertex usually corresponds to various Dark Matter production spatial | ||
| 127 | /// point (MC-modelled or reconstructed). | ||
| 128 | /// | ||
| 129 | /// **GETTER**: | ||
| 130 | /// * `E0` \-- Initializing particle energy before DM producton [GeV] | ||
| 131 | /// * `E` \-- Initializing paritcle energy after DM production [GeV] | ||
| 132 | /// * getter for field `Vertex::position` **disabled** | ||
| 133 | /// * getter for field `Vertex::decayPosition` **disabled** | ||
| 134 | /// * getter for field `Vertex::lvEm` **disabled** | ||
| 135 | /// * getter for field `Vertex::lvEp` **disabled** | ||
| 136 | /// * `initPDG` \-- PDG code of the initializing particle (MC typically) | ||
| 137 | /// * `DMTRID1` \-- (unknown MK's MC datum) \todo | ||
| 138 | /// * `DMTRID2` \-- (unknown MK's MC datum) \todo | ||
| 139 | struct Vertex { | ||
| 140 | /// Initializing particle energy before DM producton [GeV] | ||
| 141 | double E0; | ||
| 142 | |||
| 143 | /// Initializing paritcle energy after DM production [GeV] | ||
| 144 | double E; | ||
| 145 | |||
| 146 | /// DM production vertex | ||
| 147 | double position[3]; | ||
| 148 | |||
| 149 | /// DM decay position | ||
| 150 | double decayPosition[3]; | ||
| 151 | |||
| 152 | /// Lorentz vector of electron in DM decay, e mas is 4th | ||
| 153 | double lvEm[3]; | ||
| 154 | |||
| 155 | /// Lorentz vector of positron in DM decay, e mas is 4th | ||
| 156 | double lvEp[3]; | ||
| 157 | |||
| 158 | /// PDG code of the initializing particle (MC typically) | ||
| 159 | int initPDG; | ||
| 160 | |||
| 161 | /// (unknown MK's MC datum) \todo | ||
| 162 | int DMTRID1; | ||
| 163 | |||
| 164 | /// (unknown MK's MC datum) \todo | ||
| 165 | int DMTRID2; | ||
| 166 | |||
| 167 | /// Default ctr (creates uninitialized instance of Vertex. | ||
| 168 | Vertex(){} | ||
| 169 | /// A ctr, ignores memory arg (creates uninitialized instance of Vertex. | ||
| 170 | /// Needed to simplify compatibility with template code. | ||
| 171 | Vertex( LocalMemory & ) {} | ||
| 172 | |||
| 173 | }; // struct Vertex | ||
| 174 | |||
| 175 | #define M_for_every_Vertex_collection_attribute( m, ... ) \ | ||
| 176 | m(position, , double, __VA_RGS__) \ | ||
| 177 | m(decayPosition, , double, __VA_RGS__) \ | ||
| 178 | m(lvEm, , double, __VA_RGS__) \ | ||
| 179 | m(lvEp, , double, __VA_RGS__) \ | ||
| 180 | /* ... */ | ||
| 181 | template<> | ||
| 182 | struct Traits<Vertex> { | ||
| 183 | static constexpr char typeName[] = "Vertex"; | ||
| 184 | /// Callback function type, receiving an instance of type `Vertex` and | ||
| 185 | /// returning certain `double` value. | ||
| 186 | typedef StdFloat_t (*Getter)(const Vertex & obj); | ||
| 187 | typedef std::unordered_map<std::string, std::pair<std::string, Getter> > Getters; | ||
| 188 | |||
| 189 | /// A map of (standard) getters; key is "name:str" of the getter, entry pair | ||
| 190 | /// is ("description:str", "callback:func") | ||
| 191 | static const Getters getters; | ||
| 192 | |||
| 193 | |||
| 194 | /// Natural key type to index collection of Vertex instances | ||
| 195 | typedef size_t NaturalKey; | ||
| 196 | |||
| 197 | |||
| 198 | template<typename CallableT, typename ObjectT=Vertex> | ||
| 199 | static void for_each_attr( CallableT callable, ObjectT & obj ) { | ||
| 200 | callable( CallableTraits<CallableT>::attr_id(0, "E0"), obj.E0 ); | ||
| 201 | callable( CallableTraits<CallableT>::attr_id(1, "E"), obj.E ); | ||
| 202 | callable( CallableTraits<CallableT>::attr_id(2, "position"), obj.position ); | ||
| 203 | callable( CallableTraits<CallableT>::attr_id(3, "decayPosition"), obj.decayPosition ); | ||
| 204 | callable( CallableTraits<CallableT>::attr_id(4, "lvEm"), obj.lvEm ); | ||
| 205 | callable( CallableTraits<CallableT>::attr_id(5, "lvEp"), obj.lvEp ); | ||
| 206 | callable( CallableTraits<CallableT>::attr_id(6, "initPDG"), obj.initPDG ); | ||
| 207 | callable( CallableTraits<CallableT>::attr_id(7, "DMTRID1"), obj.DMTRID1 ); | ||
| 208 | callable( CallableTraits<CallableT>::attr_id(8, "DMTRID2"), obj.DMTRID2 ); | ||
| 209 | |||
| 210 | } | ||
| 211 | }; | ||
| 212 | |||
| 213 | } // namespace ::na64dp::event | ||
| 214 | |||
| 215 | namespace util { | ||
| 216 | /// Sets instance of `Vertex` to uninitialized state | ||
| 217 | void reset( event::Vertex & ); | ||
| 218 | } // namespace ::na64dp::util | ||
| 219 | |||
| 220 | |||
| 221 | namespace mem { | ||
| 222 | template<> struct PoolTraits<event::Vertex> { | ||
| 223 | static constexpr int id = 1; | ||
| 224 | }; | ||
| 225 | } // namespace ::na64dp::mem | ||
| 226 | |||
| 227 | |||
| 228 | namespace event { | ||
| 229 | /// This struct maps hit instances over various identification schemes for | ||
| 230 | /// faster access. Instance of this structure is the major subject of | ||
| 231 | /// modification and data retrieval for all the handlers composing the pipeline. | ||
| 232 | /// | ||
| 233 | /// Refer to :ref:`event structure` for reference on modifying the content of | ||
| 234 | /// this struct. | ||
| 235 | /// | ||
| 236 | /// Type is not copyable since creation of copies must require | ||
| 237 | /// explicitly defined hit (re-)creation. | ||
| 238 | /// | ||
| 239 | /// **GETTER**: | ||
| 240 | /// * `id` \-- Event's unique identifier. | ||
| 241 | /// * `trigger` \-- Trigger code of this event | ||
| 242 | /// * `evType` \-- Event type code | ||
| 243 | /// * getter for field `Event::time` **disabled** | ||
| 244 | /// * `masterTime` \-- Relative event master time, [ns] | ||
| 245 | /// * `mcTruth.weight` \-- A "statistical weight" of the event | ||
| 246 | /// (propagated from `mcTruth:MCTruthInfo`, returns `weight`) | ||
| 247 | /// * `mcTruth.beamE0` \-- initializing particle initial full E (TODO: redundant?) | ||
| 248 | /// (propagated from `mcTruth:MCTruthInfo`, returns `beamE0`) | ||
| 249 | /// * `mcTruth.beamPDG` \-- PDG code of initializing particle | ||
| 250 | /// (propagated from `mcTruth:MCTruthInfo`, returns `beamPDG`) | ||
| 251 | /// * getter for field `Event::sadcHits` **disabled** | ||
| 252 | /// * getter for field `Event::apvHits` **disabled** | ||
| 253 | /// * getter for field `Event::stwtdcHits` **disabled** | ||
| 254 | /// * getter for field `Event::f1Hits` **disabled** | ||
| 255 | /// * getter for field `Event::caloHits` **disabled** | ||
| 256 | /// * getter for field `Event::apvClusters` **disabled** | ||
| 257 | /// * getter for field `Event::trackScores` **disabled** | ||
| 258 | /// * getter for field `Event::tracks` **disabled** | ||
| 259 | /// * getter for field `Event::vertices` **disabled** | ||
| 260 | struct Event { | ||
| 261 | /// Event's unique identifier. | ||
| 262 | EventID id; | ||
| 263 | |||
| 264 | /// Trigger code of this event | ||
| 265 | uint16_t trigger; | ||
| 266 | |||
| 267 | /// Event type code | ||
| 268 | uint16_t evType; | ||
| 269 | |||
| 270 | /// Event time represented by pair: seconds since epoch, usec | ||
| 271 | std::pair<time_t, uint32_t> time; | ||
| 272 | |||
| 273 | /// Relative event master time, [ns] | ||
| 274 | double masterTime; | ||
| 275 | |||
| 276 | /// "True" MC data | ||
| 277 | mem::Ref<MCTruthInfo> mcTruth; | ||
| 278 | |||
| 279 | /// SADC-based detectors hits (ECAL, WCAL, HCAL, VETO, etc.) | ||
| 280 | event::Map<DetID, SADCHit, MapTag::sparse> sadcHits; | ||
| 281 | |||
| 282 | /// APV-based detectors hits (MuMegas, GEMs) | ||
| 283 | event::Map<DetID, APVHit, MapTag::sparse> apvHits; | ||
| 284 | |||
| 285 | /// NA64TDC-based detectors hits (STRAW) | ||
| 286 | event::Map<DetID, StwTDCHit, MapTag::sparse> stwtdcHits; | ||
| 287 | |||
| 288 | /// F1-based detectors hits (BMS, etc.) | ||
| 289 | event::Map<DetID, F1Hit, MapTag::sparse_ambig> f1Hits; | ||
| 290 | |||
| 291 | /// Energy deposition in calorimetric detectors (e.g. ECAL, WCAL, HCAL, etc) | ||
| 292 | event::Map<DetID, CaloHit, MapTag::sparse_ambig> caloHits; | ||
| 293 | |||
| 294 | /// \brief 1D clusters (contains references to the APV hits) | ||
| 295 | /// | ||
| 296 | /// Cluster contains references to hits located in neighbouring group of | ||
| 297 | /// wires. | ||
| 298 | /// Clusters here are indexed by "incomplete" detector ID that contains only | ||
| 299 | /// chip ID, kin ID, number of station and projection ID (no wire number). | ||
| 300 | event::Map<PlaneKey, APVCluster, MapTag::sparse_ambig> apvClusters; | ||
| 301 | |||
| 302 | /// Track point candidates collection | ||
| 303 | event::Map<DetID, TrackScore, MapTag::sparse_ambig> trackScores; | ||
| 304 | |||
| 305 | /// Collection of reconstructed tracks | ||
| 306 | event::Map<TrackID, Track, MapTag::sparse> tracks; | ||
| 307 | |||
| 308 | /// Collection of vertices \-- particle's birth/decay spatial points | ||
| 309 | event::Map<size_t, Vertex, MapTag::ordered> vertices; | ||
| 310 | |||
| 311 | /// A ctr, needs the pool allocator instance to be bound with | ||
| 312 | Event( LocalMemory & ); | ||
| 313 | }; // struct Event | ||
| 314 | |||
| 315 | #define M_for_every_Event_collection_attribute( m, ... ) \ | ||
| 316 | m(sadcHits, DetID, SADCHit, __VA_RGS__) \ | ||
| 317 | m(apvHits, DetID, APVHit, __VA_RGS__) \ | ||
| 318 | m(stwtdcHits, DetID, StwTDCHit, __VA_RGS__) \ | ||
| 319 | m(f1Hits, DetID, F1Hit, __VA_RGS__) \ | ||
| 320 | m(caloHits, DetID, CaloHit, __VA_RGS__) \ | ||
| 321 | m(apvClusters, PlaneKey, APVCluster, __VA_RGS__) \ | ||
| 322 | m(trackScores, DetID, TrackScore, __VA_RGS__) \ | ||
| 323 | m(tracks, TrackID, Track, __VA_RGS__) \ | ||
| 324 | m(vertices, size_t, Vertex, __VA_RGS__) \ | ||
| 325 | /* ... */ | ||
| 326 | template<> | ||
| 327 | struct Traits<Event> { | ||
| 328 | static constexpr char typeName[] = "Event"; | ||
| 329 | /// Callback function type, receiving an instance of type `Event` and | ||
| 330 | /// returning certain `double` value. | ||
| 331 | typedef StdFloat_t (*Getter)(const Event & obj); | ||
| 332 | typedef std::unordered_map<std::string, std::pair<std::string, Getter> > Getters; | ||
| 333 | |||
| 334 | /// A map of (standard) getters; key is "name:str" of the getter, entry pair | ||
| 335 | /// is ("description:str", "callback:func") | ||
| 336 | static const Getters getters; | ||
| 337 | |||
| 338 | |||
| 339 | /// Natural key type to index collection of Event instances | ||
| 340 | typedef EventID NaturalKey; | ||
| 341 | |||
| 342 | |||
| 343 | template<typename CallableT, typename ObjectT=Event> | ||
| 344 | static void for_each_attr( CallableT callable, ObjectT & obj ) { | ||
| 345 | callable( CallableTraits<CallableT>::attr_id(0, "id"), obj.id ); | ||
| 346 | callable( CallableTraits<CallableT>::attr_id(1, "trigger"), obj.trigger ); | ||
| 347 | callable( CallableTraits<CallableT>::attr_id(2, "evType"), obj.evType ); | ||
| 348 | callable( CallableTraits<CallableT>::attr_id(3, "time"), obj.time ); | ||
| 349 | callable( CallableTraits<CallableT>::attr_id(4, "masterTime"), obj.masterTime ); | ||
| 350 | callable( CallableTraits<CallableT>::attr_id(5, "mcTruth"), obj.mcTruth ); | ||
| 351 | callable( CallableTraits<CallableT>::attr_id(6, "sadcHits"), obj.sadcHits ); | ||
| 352 | callable( CallableTraits<CallableT>::attr_id(7, "apvHits"), obj.apvHits ); | ||
| 353 | callable( CallableTraits<CallableT>::attr_id(8, "stwtdcHits"), obj.stwtdcHits ); | ||
| 354 | callable( CallableTraits<CallableT>::attr_id(9, "f1Hits"), obj.f1Hits ); | ||
| 355 | callable( CallableTraits<CallableT>::attr_id(10, "caloHits"), obj.caloHits ); | ||
| 356 | callable( CallableTraits<CallableT>::attr_id(11, "apvClusters"), obj.apvClusters ); | ||
| 357 | callable( CallableTraits<CallableT>::attr_id(12, "trackScores"), obj.trackScores ); | ||
| 358 | callable( CallableTraits<CallableT>::attr_id(13, "tracks"), obj.tracks ); | ||
| 359 | callable( CallableTraits<CallableT>::attr_id(14, "vertices"), obj.vertices ); | ||
| 360 | |||
| 361 | } | ||
| 362 | }; | ||
| 363 | |||
| 364 | } // namespace ::na64dp::event | ||
| 365 | |||
| 366 | namespace util { | ||
| 367 | /// Sets instance of `Event` to uninitialized state | ||
| 368 | void reset( event::Event & ); | ||
| 369 | } // namespace ::na64dp::util | ||
| 370 | |||
| 371 | |||
| 372 | namespace mem { | ||
| 373 | template<> struct PoolTraits<event::Event> { | ||
| 374 | static constexpr int id = 2; | ||
| 375 | }; | ||
| 376 | } // namespace ::na64dp::mem | ||
| 377 | |||
| 378 | |||
| 379 | |||
| 380 | namespace event { | ||
| 381 | |||
| 382 | template<typename fromT, typename toT> struct Association; // default def does not exist | ||
| 383 | |||
| 384 | |||
| 385 | |||
| 386 | |||
| 387 | template<> | ||
| 388 | struct Association<event::Event, event::SADCHit> { | ||
| 389 | /// Map features | ||
| 390 | constexpr static MapTag::Code mapTag = MapTag::sparse; | ||
| 391 | /// Type of (main) association of `SADCHit` instances with | ||
| 392 | /// instance `Event`. | ||
| 393 | typedef event::Map<DetID, SADCHit, MapTag::sparse> Collection; | ||
| 394 | /// Returns (main) collection of `SADCHit` instances associated | ||
| 395 | /// with `Event` by attribute `sadcHits`. | ||
| 396 | static Collection & map(event::Event & parent) { return parent.sadcHits; } | ||
| 397 | /// Remove instance of `SADCHit` from (main) collection | ||
| 398 | /// associated it with `Event` by attribute `sadcHits`. | ||
| 399 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 400 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 401 | parent.erase(it); | ||
| 402 | } | ||
| 403 | }; | ||
| 404 | |||
| 405 | |||
| 406 | |||
| 407 | template<> | ||
| 408 | struct Association<event::Event, event::APVHit> { | ||
| 409 | /// Map features | ||
| 410 | constexpr static MapTag::Code mapTag = MapTag::sparse; | ||
| 411 | /// Type of (main) association of `APVHit` instances with | ||
| 412 | /// instance `Event`. | ||
| 413 | typedef event::Map<DetID, APVHit, MapTag::sparse> Collection; | ||
| 414 | /// Returns (main) collection of `APVHit` instances associated | ||
| 415 | /// with `Event` by attribute `apvHits`. | ||
| 416 | static Collection & map(event::Event & parent) { return parent.apvHits; } | ||
| 417 | /// Remove instance of `APVHit` from (main) collection | ||
| 418 | /// associated it with `Event` by attribute `apvHits`. | ||
| 419 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 420 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 421 | parent.erase(it); | ||
| 422 | } | ||
| 423 | }; | ||
| 424 | |||
| 425 | |||
| 426 | |||
| 427 | template<> | ||
| 428 | struct Association<event::Event, event::StwTDCHit> { | ||
| 429 | /// Map features | ||
| 430 | constexpr static MapTag::Code mapTag = MapTag::sparse; | ||
| 431 | /// Type of (main) association of `StwTDCHit` instances with | ||
| 432 | /// instance `Event`. | ||
| 433 | typedef event::Map<DetID, StwTDCHit, MapTag::sparse> Collection; | ||
| 434 | /// Returns (main) collection of `StwTDCHit` instances associated | ||
| 435 | /// with `Event` by attribute `stwtdcHits`. | ||
| 436 | static Collection & map(event::Event & parent) { return parent.stwtdcHits; } | ||
| 437 | /// Remove instance of `StwTDCHit` from (main) collection | ||
| 438 | /// associated it with `Event` by attribute `stwtdcHits`. | ||
| 439 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 440 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 441 | parent.erase(it); | ||
| 442 | } | ||
| 443 | }; | ||
| 444 | |||
| 445 | |||
| 446 | |||
| 447 | template<> | ||
| 448 | struct Association<event::Event, event::F1Hit> { | ||
| 449 | /// Map features | ||
| 450 | constexpr static MapTag::Code mapTag = MapTag::sparse_ambig; | ||
| 451 | /// Type of (main) association of `F1Hit` instances with | ||
| 452 | /// instance `Event`. | ||
| 453 | typedef event::Map<DetID, F1Hit, MapTag::sparse_ambig> Collection; | ||
| 454 | /// Returns (main) collection of `F1Hit` instances associated | ||
| 455 | /// with `Event` by attribute `f1Hits`. | ||
| 456 | static Collection & map(event::Event & parent) { return parent.f1Hits; } | ||
| 457 | /// Remove instance of `F1Hit` from (main) collection | ||
| 458 | /// associated it with `Event` by attribute `f1Hits`. | ||
| 459 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 460 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 461 | parent.erase(it); | ||
| 462 | } | ||
| 463 | }; | ||
| 464 | |||
| 465 | |||
| 466 | |||
| 467 | template<> | ||
| 468 | struct Association<event::Event, event::CaloHit> { | ||
| 469 | /// Map features | ||
| 470 | constexpr static MapTag::Code mapTag = MapTag::sparse_ambig; | ||
| 471 | /// Type of (main) association of `CaloHit` instances with | ||
| 472 | /// instance `Event`. | ||
| 473 | typedef event::Map<DetID, CaloHit, MapTag::sparse_ambig> Collection; | ||
| 474 | /// Returns (main) collection of `CaloHit` instances associated | ||
| 475 | /// with `Event` by attribute `caloHits`. | ||
| 476 | static Collection & map(event::Event & parent) { return parent.caloHits; } | ||
| 477 | /// Remove instance of `CaloHit` from (main) collection | ||
| 478 | /// associated it with `Event` by attribute `caloHits`. | ||
| 479 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 480 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 481 | parent.erase(it); | ||
| 482 | } | ||
| 483 | }; | ||
| 484 | |||
| 485 | |||
| 486 | |||
| 487 | template<> | ||
| 488 | struct Association<event::Event, event::APVCluster> { | ||
| 489 | /// Map features | ||
| 490 | constexpr static MapTag::Code mapTag = MapTag::sparse_ambig; | ||
| 491 | /// Type of (main) association of `APVCluster` instances with | ||
| 492 | /// instance `Event`. | ||
| 493 | typedef event::Map<PlaneKey, APVCluster, MapTag::sparse_ambig> Collection; | ||
| 494 | /// Returns (main) collection of `APVCluster` instances associated | ||
| 495 | /// with `Event` by attribute `apvClusters`. | ||
| 496 | static Collection & map(event::Event & parent) { return parent.apvClusters; } | ||
| 497 | /// Remove instance of `APVCluster` from (main) collection | ||
| 498 | /// associated it with `Event` by attribute `apvClusters`. | ||
| 499 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 500 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 501 | parent.erase(it); | ||
| 502 | } | ||
| 503 | }; | ||
| 504 | |||
| 505 | |||
| 506 | |||
| 507 | template<> | ||
| 508 | struct Association<event::Event, event::TrackScore> { | ||
| 509 | /// Map features | ||
| 510 | constexpr static MapTag::Code mapTag = MapTag::sparse_ambig; | ||
| 511 | /// Type of (main) association of `TrackScore` instances with | ||
| 512 | /// instance `Event`. | ||
| 513 | typedef event::Map<DetID, TrackScore, MapTag::sparse_ambig> Collection; | ||
| 514 | /// Returns (main) collection of `TrackScore` instances associated | ||
| 515 | /// with `Event` by attribute `trackScores`. | ||
| 516 | static Collection & map(event::Event & parent) { return parent.trackScores; } | ||
| 517 | /// Remove instance of `TrackScore` from (main) collection | ||
| 518 | /// associated it with `Event` by attribute `trackScores`. | ||
| 519 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 520 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 521 | parent.erase(it); | ||
| 522 | } | ||
| 523 | }; | ||
| 524 | |||
| 525 | |||
| 526 | |||
| 527 | template<> | ||
| 528 | struct Association<event::Event, event::Track> { | ||
| 529 | /// Map features | ||
| 530 | constexpr static MapTag::Code mapTag = MapTag::sparse; | ||
| 531 | /// Type of (main) association of `Track` instances with | ||
| 532 | /// instance `Event`. | ||
| 533 | typedef event::Map<TrackID, Track, MapTag::sparse> Collection; | ||
| 534 | /// Returns (main) collection of `Track` instances associated | ||
| 535 | /// with `Event` by attribute `tracks`. | ||
| 536 | static Collection & map(event::Event & parent) { return parent.tracks; } | ||
| 537 | /// Remove instance of `Track` from (main) collection | ||
| 538 | /// associated it with `Event` by attribute `tracks`. | ||
| 539 | ✗ | static void remove( Collection & parent, typename Collection::const_iterator it ) { | |
| 540 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 541 | ✗ | parent.erase(it); | |
| 542 | } | ||
| 543 | }; | ||
| 544 | |||
| 545 | |||
| 546 | |||
| 547 | template<> | ||
| 548 | struct Association<event::Event, event::Vertex> { | ||
| 549 | /// Map features | ||
| 550 | constexpr static MapTag::Code mapTag = MapTag::ordered; | ||
| 551 | /// Type of (main) association of `Vertex` instances with | ||
| 552 | /// instance `Event`. | ||
| 553 | typedef event::Map<size_t, Vertex, MapTag::ordered> Collection; | ||
| 554 | /// Returns (main) collection of `Vertex` instances associated | ||
| 555 | /// with `Event` by attribute `vertices`. | ||
| 556 | static Collection & map(event::Event & parent) { return parent.vertices; } | ||
| 557 | /// Remove instance of `Vertex` from (main) collection | ||
| 558 | /// associated it with `Event` by attribute `vertices`. | ||
| 559 | static void remove( Collection & parent, typename Collection::const_iterator it ) { | ||
| 560 | //throw std::runtime_error("hits remove is not implemented"); // TODO | ||
| 561 | parent.erase(it); | ||
| 562 | } | ||
| 563 | }; | ||
| 564 | |||
| 565 | |||
| 566 | #define M_for_every_compound_type( m, ... ) \ | ||
| 567 | m( MoyalSADCWfFitParameters, __VA_ARGS__ ) \ | ||
| 568 | m( GaussianSADCFitParameters, __VA_ARGS__ ) \ | ||
| 569 | m( MSADCDFFTCoefficients, __VA_ARGS__ ) \ | ||
| 570 | m( MSADCPeak, __VA_ARGS__ ) \ | ||
| 571 | m( MSADCWaveform, __VA_ARGS__ ) \ | ||
| 572 | m( WBWaveform, __VA_ARGS__ ) \ | ||
| 573 | m( RawDataSADC, __VA_ARGS__ ) \ | ||
| 574 | m( SADCHit, __VA_ARGS__ ) \ | ||
| 575 | m( RawDataAPV, __VA_ARGS__ ) \ | ||
| 576 | m( APVHit, __VA_ARGS__ ) \ | ||
| 577 | m( APVCluster, __VA_ARGS__ ) \ | ||
| 578 | m( StwTDCRawData, __VA_ARGS__ ) \ | ||
| 579 | m( StwMCInfo, __VA_ARGS__ ) \ | ||
| 580 | m( StwTDCHit, __VA_ARGS__ ) \ | ||
| 581 | m( RawDataF1, __VA_ARGS__ ) \ | ||
| 582 | m( F1Hit, __VA_ARGS__ ) \ | ||
| 583 | m( CaloHit, __VA_ARGS__ ) \ | ||
| 584 | m( DriftDetScoreFeatures, __VA_ARGS__ ) \ | ||
| 585 | m( MCTrueTrackScore, __VA_ARGS__ ) \ | ||
| 586 | m( TrackScore, __VA_ARGS__ ) \ | ||
| 587 | m( ScoreFitInfo, __VA_ARGS__ ) \ | ||
| 588 | m( TrackFitInfo, __VA_ARGS__ ) \ | ||
| 589 | m( Track, __VA_ARGS__ ) \ | ||
| 590 | /* ... */ | ||
| 591 | |||
| 592 | |||
| 593 | } // namespace ::na64dp::event | ||
| 594 | } // namespace na64dp | ||
| 595 | |||
| 596 | #ifdef hdql_FOUND | ||
| 597 | namespace hdql { | ||
| 598 | namespace helpers { | ||
| 599 | class CompoundTypes; | ||
| 600 | } // namespace ::hdql::helpers | ||
| 601 | } // namespace hdql | ||
| 602 | struct hdql_Context; | ||
| 603 | namespace na64dp { | ||
| 604 | namespace event { | ||
| 605 | void define_event_hdql_compounds(::hdql::helpers::CompoundTypes &, hdql_Context *); | ||
| 606 | } // namespace ::na64dp::event | ||
| 607 | } // namespace na64dp | ||
| 608 | #endif | ||
| 609 |