Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:36

0001 #include "DD4hep/DDTest.h"
0002 #include <exception>
0003 #include <iostream>
0004 #include <assert.h>
0005 #include <cmath>
0006 
0007 #include "DD4hep/DetType.h"
0008 
0009 
0010 using namespace std ;
0011 using namespace dd4hep ;
0012 
0013 // this should be the first line in your test
0014 static DDTest test( "bitfield64" ) ; 
0015 
0016 //=============================================================================
0017 
0018 int main(int /* argc */, char** /* argv */ ){
0019     
0020   try{
0021     
0022     // ----- write your tests in here -------------------------------------
0023 
0024     test.log( "test DetType" );
0025     
0026     DetType type( DetType::TRACKER | DetType::STRIP | DetType::BARREL ) ;
0027 
0028     std::cout << type << std::endl ;
0029 
0030     test(  type.is( DetType::TRACKER ) ,  true , " is DetType::TRACKER " ) ; 
0031 
0032     test(  type.is( DetType::STRIP | DetType::BARREL ) ,  true , 
0033        " is DetType::STRIP | DetType::BARREL" ) ; 
0034 
0035     test(  type.is( DetType::CALORIMETER ) ,  false , " DetType::CALORIMETER is false " ) ; 
0036 
0037     test(  type.isNot( DetType::SUPPORT | DetType::CHERENKOV ) ,  true , 
0038        " is not DetType::SUPPORT | DetType::CHERENKOV " ) ;
0039 
0040 
0041     type.unset( DetType::STRIP | DetType::BARREL  )  ;
0042     
0043     std::cout << type << std::endl ;
0044     
0045     type.set( DetType::PIXEL | DetType::ENDCAP | DetType::VERTEX  )  ;
0046     
0047     std::cout << type << std::endl ;
0048    
0049     test(  type.isNot( DetType::STRIP | DetType::BARREL ) ,  true , 
0050        " is not DetType::STRIP | DetType::BARREL " ) ;
0051     
0052 
0053     // --------------------------------------------------------------------
0054 
0055 
0056   } catch( exception &e ){
0057     //} catch( ... ){
0058 
0059     test.log( e.what() );
0060     test.error( "exception occurred" );
0061   }
0062 
0063   return 0;
0064 }
0065 
0066 //=============================================================================