Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:36:48

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 <algorithm>
0015 #include <stdexcept>
0016 
0017 namespace dd4hep{
0018 
0019 namespace DDSegmentation {
0020   
0021 
0022   std::string BitField64::valueString() const {
0023 
0024     std::stringstream  os ;
0025 
0026     for(unsigned i=0;i<size();i++){
0027       
0028       if( i != 0 )   os << "," ;
0029 
0030       os << _coder->fields()[i].name() <<  ":" << _coder->get( _value , i ) ;
0031 
0032     }
0033     return os.str() ;
0034   }
0035   
0036 
0037   std::ostream& operator<<(std::ostream& os, const BitField64& b){
0038 
0039     os << " bitfield:  0x" << std::hex // << std::ios::width(16) << std::ios::fill('0') <<
0040        << b._value << std::dec << std::endl ;
0041 
0042 
0043     for(unsigned i=0;i<b._coder->size();i++){
0044       
0045       const BitFieldElement& bv = b._coder->fields()[i] ;
0046       
0047       os << "  " <<  bv.name()
0048      << " [" <<  bv.offset()  << ":"  ;
0049       
0050       if(  bv.isSigned()  )  os << "-" ;
0051 
0052       os << bv.width() << "]  : "  ;
0053       
0054       os << b._coder->get( b._value , i)
0055      << std::endl ;
0056       
0057     }
0058   
0059     return os ;
0060   } 
0061 
0062 } // namespace
0063 
0064 } // namespace