Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 07:54:08

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 //==========================================================================
0011 #include <DDSegmentation/BitField64.h>
0012 
0013 #include <cmath>
0014 #include <ostream>
0015 #include <sstream>
0016 #include <string>
0017 
0018 namespace dd4hep{
0019 
0020 namespace DDSegmentation {
0021   
0022 
0023   std::string BitField64::valueString() const {
0024 
0025     std::stringstream  os ;
0026 
0027     for(unsigned i=0;i<size();i++){
0028       
0029       if( i != 0 )   os << "," ;
0030 
0031       os << _coder->fields()[i].name() <<  ":" << _coder->get( _value , i ) ;
0032 
0033     }
0034     return os.str() ;
0035   }
0036   
0037 
0038   std::ostream& operator<<(std::ostream& os, const BitField64& b){
0039 
0040     os << " bitfield:  0x" << std::hex // << std::ios::width(16) << std::ios::fill('0') <<
0041        << b._value << std::dec << std::endl ;
0042 
0043 
0044     for(unsigned i=0;i<b._coder->size();i++){
0045       
0046       const BitFieldElement& bv = b._coder->fields()[i] ;
0047       
0048       os << "  " <<  bv.name()
0049      << " [" <<  bv.offset()  << ":"  ;
0050       
0051       if(  bv.isSigned()  )  os << "-" ;
0052 
0053       os << bv.width() << "]  : "  ;
0054       
0055       os << b._coder->get( b._value , i)
0056      << std::endl ;
0057       
0058     }
0059   
0060     return os ;
0061   } 
0062 
0063 } // namespace
0064 
0065 } // namespace