/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/eformat/eformat-00-00-04/test/source_id.cxx File Reference

Implements a program that uses the eformat library to produce updated versions of source identifiers. More...

#include <cstdlib>
#include "eformat/eformat.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Detailed Description

Implements a program that uses the eformat library to produce updated versions of source identifiers.

Author:
<a href="mailto:Andre.dos.Anjos@cern.ch>André Rabello dos ANJOS
Author
zhangy
Revision
1.1.1.1
Date
2009/06/19 07:35:41

Definition in file source_id.cxx.


Function Documentation

int main ( int  argc,
char **  argv 
)

The main application

Definition at line 21 of file source_id.cxx.

References HEX.

00022 {
00023   using namespace eformat;
00024 
00025   if ( argc != 2 && argc != 3 ) {
00026     std::cerr << "usage: " << argv[0] << " <source-id>" << std::endl;
00027     std::cerr << "usage: " << argv[0] << " <subdetector> "
00028               << "<module-id>" << std::endl;
00029     std::cerr << " 1. The first format transforms from source identifier"
00030               << " into components." << std::endl;
00031     std::cerr << " 2. The second format transforms from the components into"
00032               << " source identifiers." << std::endl;
00033     std::exit(1); 
00034   }
00035 
00036   if ( argc == 2 ) { //from source id into components
00037     uint32_t source_id = static_cast<uint32_t>(std::strtoul(argv[1], 0, 0));
00038     helper::SourceIdentifier my(source_id);
00039     std::cout << "Components for event format v3.0 are:" << std::endl;
00040     std::cout << " - SubDetector ID => " 
00041               << my.subdetector_id() << ", "
00042               << HEX(my.subdetector_id())
00043               << std::endl;
00044     std::cout << " - Module ID      => " 
00045               << HEX(static_cast<unsigned int>(my.module_id()))
00046               << std::endl;
00047   }
00048 
00049   if ( argc == 3 ) { //from source id into components
00050     SubDetector sd = static_cast<SubDetector> (std::strtoul(argv[1], 0, 0));
00051     uint16_t id = static_cast<uint16_t>(std::strtoul(argv[2], 0, 0));
00052     helper::SourceIdentifier my(sd, id);
00053     std::cout << "Source identifier for event format v3.0 is: " 
00054               << HEX(my.code()) << std::endl;
00055   }
00056 
00057   exit(0);
00058 
00059 }


Generated on Tue Nov 29 23:15:04 2016 for BOSS_7.0.2 by  doxygen 1.4.7