Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:43

0001 #pragma once
0002 /**
0003 sphit.h
0004 =========
0005 
0006 Used by SEvt::getLocalHit interface for
0007 passing information from sframe into U4Hit
0008 
0009 Currently node_index is not included. As node_index is primarily
0010 of interest for debugging, it is not so critical to expose it all
0011 the way up to U4Hit level.
0012 
0013 Also stree.h has inst_nidx which will make getting the nidx
0014 of each instance straightforward : so node_index inclusion
0015 can wait until stree is more firmly integrated.
0016 
0017 **/
0018 
0019 #include <string>
0020 #include <sstream>
0021 #include <iomanip>
0022 
0023 struct sphit
0024 {
0025     unsigned iindex ;
0026     unsigned sensor_identifier ;
0027     unsigned sensor_index ;
0028     // int node_index ;
0029 
0030     void zero();
0031     std::string desc() const ;
0032 
0033     static bool Equal(const sphit& a, const sphit& b);
0034     bool operator==(const sphit& other) const ;
0035 };
0036 
0037 
0038 inline bool sphit::Equal(const sphit& a, const sphit& b ) // static
0039 {
0040     return a.iindex == b.iindex &&
0041            a.sensor_identifier == b.sensor_identifier &&
0042            a.sensor_index      == b.sensor_index
0043            ;
0044 }
0045 
0046 inline bool sphit::operator==(const sphit& other) const
0047 {
0048     return Equal(*this, other);
0049 }
0050 
0051 inline void sphit::zero()
0052 {
0053     iindex = 0 ;
0054     sensor_identifier = 0 ;
0055     sensor_index = 0 ;
0056 }
0057 
0058 inline std::string sphit::desc() const
0059 {
0060     std::stringstream ss ;
0061     ss << "sphit::desc"
0062        << " iindex " << std::setw(7) << iindex
0063        << " sensor_identifier " << std::setw(7) << sensor_identifier
0064        << " sensor_index " << std::setw(7) << sensor_index
0065        ;
0066     std::string s = ss.str();
0067     return s ;
0068 }
0069 
0070