15# if defined( __EXTENSIONS__ )
18# define __EXTENSIONS__
22#elif defined( __GNUC__ )
23# if defined( _XOPEN_SOURCE )
32#if defined( __SUNPRO_CC )
41#include "TrkReco/TMDCUtil.h"
42#include "TrkReco/TMDCWire.h"
43#include "TrkReco/TMDCWireHit.h"
44#include "TrkReco/TMDCWireHitMC.h"
45#include "TrkReco/TMLink.h"
61 unsigned layer =
id / 64;
63 if ( layer == 0 ) {
return int(
id / 8 ); }
67 if (
id >= 127 )
id -= 64;
68 if ( (
id - 6 ) % 8 == 0 )
return (
id - 6 ) / 8 + 0.5;
69 else return int( (
id + 1 ) / 8 );
74 if (
id <= 129 )
id += 64;
75 return int( (
id - 2 ) / 8 );
86 for ( i = 0; i <
f - l; i++ )
88 if ( ( i % 8 ) == 0 ) std::cout <<
" ";
89 std::cout << ( val >> (
f - i ) ) % 2;
96 double c0x = c2.x() - c1.x();
97 double c0y = c2.y() - c1.y();
98 double c0 = sqrt( c0x * c0x + c0y * c0y );
99 double rr1 =
abs( r1 );
100 double rr2 =
abs( r2 );
101 double Radd = rr1 + rr2;
102 double Rsub =
abs( rr1 - rr2 );
106 if ( c0 > Radd +
eps || c0 < 0.001 || c0 < Rsub -
eps )
118 if ( c0 > Radd -
eps )
120 x1.setX( c1.x() + rr1 * c0x / c0 );
121 x1.setY( c1.y() + rr1 * c0y / c0 );
133 double chg =
abs( r1 ) / r1;
134 double cosPsi = ( c0 * c0 + rr1 * rr1 - rr2 * rr2 ) / ( 2. * c0 * rr1 );
135 double sinPsi = -( chg /
abs( chg ) ) * sqrt( 1.0 - cosPsi * cosPsi );
136 x1.setX( c1.x() + ( rr1 / c0 ) * ( cosPsi * c0x - sinPsi * c0y ) );
137 x1.setY( c1.y() + ( rr1 / c0 ) * ( cosPsi * c0y + sinPsi * c0x ) );
138 x2.setX( c1.x() + ( rr1 / c0 ) * ( cosPsi * c0x + sinPsi * c0y ) );
139 x2.setY( c1.y() + ( rr1 / c0 ) * ( cosPsi * c0y - sinPsi * c0x ) );
148#define SRTOPI 0.7978846
150#define ROOT2I 0.70710678
156 double temp_i, temp_n;
159 if ( (
n <= 0 ) || ( chi2 < 0.0 ) ) {
return prob; }
163 srty = sqrt( chi2 ) - sqrt( temp_n - 0.5 );
166 prob = 0.5 * erfc( srty );
171 if ( chi2 >
UPL ) {
return prob; }
172 sum =
exp( -0.5 * chi2 );
174 m = (int)floor(
n / 2. );
185 for ( i = 2; i < m + 1; i++ )
188 term = 0.5 * chi2 * term / ( temp_i - 1.0 );
198 prob = erfc(
ROOT2I * srty );
199 if (
n == 1 ) {
return prob; }
202 prob =
SRTOPI * srty * sum + prob;
208 for ( i = 1; i < k + 1; i++ )
211 term = term * chi2 / ( 2.0 * temp_i + 1.0 );
214 prob =
SRTOPI * srty * sum + prob;
HepGeom::Point3D< double > HepPoint3D
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
EvtComplex exp(const EvtComplex &c)
EvtTensor3C eps(const EvtVector3R &v)
const HepPoint3D ORIGIN
Constants.
int intersection(const HepPoint3D &c1, double r1, const HepPoint3D &c2, double r2, double eps, HepPoint3D &x1, HepPoint3D &x2)
Circle utilities.
void bitDisplay(unsigned val)
double chisq2confLevel(int n, double chi2)
ALPHA = 10000. / 2.99792458 / 15.
float CathodeSectorId(unsigned id)
geocdc utilities