BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Simulation/BOOST/PhySim/include/PhySim/BaBar.hh
Go to the documentation of this file.
1#ifndef BABAR_HH
2#define BABAR_HH
3
4//--------------------------------------------------------------------------
5// File and Version Information:
6// $Id: BaBar.hh,v 1.2 2011/02/15 05:50:00 dengzy Exp $
7//
8// Description:
9// Standard include file to contain global "fixes"
10// and type definitions
11//
12// This file is intended to be included by _lots_ of others
13// so should stay very light-weight. In particular, definitions
14// of static variables are not appropriate here, as they
15// will allocate memory in every BaBar object file.
16//
17// Environment:
18// Software developed for the BaBar Detector at the SLAC B-Factory.
19//
20// Author List:
21// David Quarrie
22// Bob Jacobsen (added F90 interface types, fixed bool, Mar 19,95)
23// Forest Rouse (added pi, bznom, chisq_undef, and epsilon)
24// Abi Soffer (added BbrLorentzVector)
25// A. De Silva (moved macros from Framework/AppModule.hh. Jan 29,99)
26//
27// Copyright Information:
28// Copyright (C) 1995, 1996
29//
30//------------------------------------------------------------------------
31
32// Need to make sure the very minimum gets into the dataflow builds
33#ifndef VXWORKS
34
35// Define very large integer types. These types are required by the
36// POSIX specification.
37
38# if defined( __SUNPRO_CC ) || defined( __linux__ )
39// ROOT's CINT cannot handle the type long long
40# ifndef __CINT__
41// typedef long long int64_t;
42// typedef unsigned long long uint64_t;
43# endif
44# endif
45
46// Activate large file support for Sun if it isn't already.
47// This should be done in CPPFLAGS (and is) but a bug in the template
48// support in the Workshop 4.2 compiler causes some files to be
49// compiled with _FILE_OFFSET_BITS set to "'64'" instead of "64". // FIXME
50// NB: This _MUST_ be done before <sys/feature_tests.h> is included.
51# if defined( __SUNPRO_CC )
52# ifdef _LARGEFILE_SOURCE
53# undef _LARGEFILE_SOURCE
54# endif
55# define _LARGEFILE_SOURCE 1
56# ifdef _FILE_OFFSET_BITS
57# undef _FILE_OFFSET_BITS
58# endif
59# define _FILE_OFFSET_BITS 64
60# endif // Sun
61
62// The following two "paragraphs" of code seem to make the ROOT
63// interpreter unhappy. For now we protect it from them. This is
64// not an ideal solution. // FIXME
65# ifndef __CINT__
66
67// Load the various platforms' feature-test include files, so that we
68// can properly take advantage of the various *POSIX* and *XOPEN* macros.
69// There is no way to do this in a platform-independent way without
70// loading something heavyweight like <unistd.h>, which might affect
71// code that doesn't want it. [gpdf 2001.01.29]
72# ifdef __SUNPRO_CC
73# include <sys/feature_tests.h>
74# else
75# ifdef __linux__
76# include <features.h>
77# else
78// Don't know what to do here. Try loading a lightweight include file.
79// On some platforms this brings in the feature tests, but not on all.
80# include <stddef.h>
81# endif
82# endif
83
84// Accommodate the variations in the adoption of socklen_t from Unix98.
85// Unix98 (XPG5) has socklen_t. Unix95 (XPG4v2) uses size_t (which is
86// typically unsigned) in places where socklen_t appears in Unix98.
87// Pre-standard APIs tend to have int instead. [added gpdf 2001.01.29]
88# if ( defined( _XOPEN_SOURCE ) && ( _XOPEN_SOURCE - 0 ) >= 500 )
89// Unix98 (XPG5): Solaris 7 with -D_XOPEN_SOURCE=500, Linux
90# define BABAR_socklen_t socklen_t
91# else
92# ifdef _XOPEN_SOURCE_EXTENDED
93// Unix95 (XPG4v2): OSF, Solaris 2.6 with -D_XOPEN_SOURCE_EXTENDED
94# define BABAR_socklen_t size_t
95# else
96// pre-standard: Solaris 7 & 2.6 "plain vanilla"
97# define BABAR_socklen_t int
98# endif
99# endif
100
101# endif // ifndef __CINT__
102
103# if defined( __SUNPRO_CC ) && \
104 ( !defined( __EXTENSIONS__ ) && \
105 ( defined( _POSIX_C_SOURCE ) || defined( _XOPEN_SOURCE ) ) )
106// This one is in the libraries on Solaris but only has a prototype
107// defined in <signal.h> if pure-Unix95/98 compilation is not in force.
108// We just restore the prototype.
109extern "C" char* strsignal( int sig );
110# endif
111
112// An error in the construction of the system and C++ header files on
113// Solaris 8 / Workshop 6 Updates 1&2 leads to a conflict between the use
114// of ::clock_t and std::clock_t when <string> is compiled under
115// -D_XOPEN_SOURCE=500. The following code ensures that ::clock_t is
116// always defined and thus allows <string> to compile.
117// This is just a workaround and should be monitored as compiler and
118// operating system versions evolve. [gpdf 2002.02.05]
119# if defined( __SUNPRO_CC ) && defined( _XOPEN_SOURCE ) && ( _XOPEN_SOURCE - 0 == 500 )
120# ifndef _CLOCK_T
121# define _CLOCK_T
122typedef long clock_t; /* relative time in a specified resolution
123 */
124# endif /* ifndef _CLOCK_T */
125# endif // SUN and XOPENSOURCE=500
126
127# if defined( __SUNPRO_CC )
128// There are two forms of each of the std::count and std::distance
129// functions: a pre-standard version that requires an extra argument
130// to hold the result, and a newer version, which made it into the
131// standard, that returns its result. On Solaris, the STL is built
132// with the _RWSTD_NO_CLASS_PARTIAL_SPEC flag set, which disables the
133// new forms. The following is an emulation of the standard versions.
134// Although this is not complete, it enables us to compile (our
135// current) standard code on Solaris. [bartoldu 2004.07.20]
136//
137// I included std::count_if here as well which suffers from the same
138problem.
139// [narsky 2005.02.18]
140
141# include <stddef.h>
142
143 namespace std {
144 template <class InputIterator, class T>
145 ptrdiff_t count( InputIterator first, InputIterator last, const T& value );
146
147 template <class InputIterator, class Predicate>
148 ptrdiff_t count_if( InputIterator first, InputIterator last, Predicate pred );
149
150 template <class InputIterator> ptrdiff_t distance( InputIterator first, InputIterator last );
151}
152
153# ifdef BABAR_COMP_INST
154# include "BaBar/BaBar.cc"
155# endif // BABAR_COMP_INST
156
157# endif // SUNCC
158
159// This block is for Mac OSX 10.3.5 with gcc 3.3
160# ifdef __APPLE_CC__
161
162// No clock_gettime in <time.h>
163typedef int clockid_t;
164# ifndef CLOCK_REALTIME
165# define CLOCK_REALTIME 0
166
167// No ENODATA, this is used in OepRemoteFramework
168# define ENODATA 61
169
170// No O_LARGEFILE as this is a 64bit platform
171// Used in OepFramework and OlmMerger
172# define O_LARGEFILE 0
173
174# endif
175
176// <cmath> undefines isnan() and friends without providing replacements
177// Only isnan() and isfinite() are used in BaBar; leave the others alone
178
179# if !defined( isfinite )
180extern "C" int isfinite( double );
181# endif
182# if !defined( isnan )
183extern "C" int isnan( double );
184# endif
185
186// ROOT's CINT has a problem with timespec not being defined
187# ifndef __CINT__
188int clock_gettime( clockid_t clock_id, struct timespec* tp );
189# endif
190
191# endif // __APPLE_CC__
192
193#endif // VXWORKS
194
195// Only below here should be seen by VXWORKS
196
197// DO NOT ADD NEW ENTRIES HERE, ONLY ABOVE THE #endif // VXWORKS !!!!
198
199#endif // BABAR_HH
DOUBLE_PRECISION count[3]