BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TMDCUtil.h File Reference
#include <string>
#include "CLHEP/Geometry/Point3D.h"
#include "CLHEP/Alist/AList.h"

Go to the source code of this file.

Macros

#define TMDCUtil_INLINE_DEFINE_HERE

Typedefs

typedef HepGeom::Point3D< double > HepPoint3D

Functions

double chisq2confLevel (int, double)
 ALPHA = 10000. / 2.99792458 / 15.
float CathodeSectorId (unsigned id)
 geocdc utilities
int sortByWireId (const TMDCWireHit **a, const TMDCWireHit **b)
 TMDCWireHit utilities.
int intersection (const HepPoint3D &c1, double r1, const HepPoint3D &c2, double r2, double eps, HepPoint3D &x1, HepPoint3D &x2)
 Circle utilities.
void bitDisplay (unsigned)
void bitDisplay (unsigned val, unsigned firstDigit, unsigned lastDigit)

Variables

const HepPoint3D ORIGIN
 Constants.

Macro Definition Documentation

◆ TMDCUtil_INLINE_DEFINE_HERE

#define TMDCUtil_INLINE_DEFINE_HERE

Typedef Documentation

◆ HepPoint3D

typedef HepGeom::Point3D<double> HepPoint3D

Function Documentation

◆ bitDisplay() [1/2]

void bitDisplay ( unsigned val,
unsigned firstDigit,
unsigned lastDigit )

Definition at line 84 of file TMDCUtil.cxx.

84 {
85 unsigned i;
86 for ( i = 0; i < f - l; i++ )
87 {
88 if ( ( i % 8 ) == 0 ) std::cout << " ";
89 std::cout << ( val >> ( f - i ) ) % 2;
90 }
91}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")

◆ bitDisplay() [2/2]

void bitDisplay ( unsigned val)

Definition at line 82 of file TMDCUtil.cxx.

82{ bitDisplay( val, 31, 0 ); }
void bitDisplay(unsigned val)
Definition TMDCUtil.cxx:82

Referenced by bitDisplay().

◆ CathodeSectorId()

float CathodeSectorId ( unsigned id)

geocdc utilities

Definition at line 59 of file TMDCUtil.cxx.

59 {
60
61 unsigned layer = id / 64;
62
63 if ( layer == 0 ) { return int( id / 8 ); }
64
65 if ( layer == 1 )
66 {
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 );
70 }
71
72 if ( layer == 2 )
73 {
74 if ( id <= 129 ) id += 64;
75 return int( ( id - 2 ) / 8 );
76 }
77
78 return 9999;
79}

◆ chisq2confLevel()

double chisq2confLevel ( int n,
double chi2 )

ALPHA = 10000. / 2.99792458 / 15.

Converter

Definition at line 147 of file TMDCUtil.cxx.

147 {
148#define SRTOPI 0.7978846
149#define UPL 340.0
150#define ROOT2I 0.70710678
151
152 double prob = 0.0;
153 double sum, term;
154 int m;
155 int i, k;
156 double temp_i, temp_n;
157 double srty;
158
159 if ( ( n <= 0 ) || ( chi2 < 0.0 ) ) { return prob; }
160 if ( n > 60 )
161 {
162 temp_n = (double)n;
163 srty = sqrt( chi2 ) - sqrt( temp_n - 0.5 );
164 if ( srty < 12.0 )
165 {
166 prob = 0.5 * erfc( srty );
167 return prob;
168 }
169 return prob;
170 }
171 if ( chi2 > UPL ) { return prob; }
172 sum = exp( -0.5 * chi2 );
173 term = sum;
174 m = (int)floor( n / 2. );
175
176 if ( 2 * m == n )
177 {
178 if ( m == 1 )
179 {
180 prob = sum;
181 return prob;
182 }
183 else
184 {
185 for ( i = 2; i < m + 1; i++ )
186 {
187 temp_i = (double)i;
188 term = 0.5 * chi2 * term / ( temp_i - 1.0 );
189 sum = sum + term;
190 }
191 prob = sum;
192 return prob;
193 }
194 }
195 else
196 {
197 srty = sqrt( chi2 );
198 prob = erfc( ROOT2I * srty );
199 if ( n == 1 ) { return prob; }
200 if ( n == 3 )
201 {
202 prob = SRTOPI * srty * sum + prob;
203 return prob;
204 }
205 else
206 {
207 k = m - 1;
208 for ( i = 1; i < k + 1; i++ )
209 {
210 temp_i = (double)i;
211 term = term * chi2 / ( 2.0 * temp_i + 1.0 );
212 sum = sum + term;
213 }
214 prob = SRTOPI * srty * sum + prob;
215 return prob;
216 }
217 }
218}
const Int_t n
EvtComplex exp(const EvtComplex &c)
#define UPL
#define ROOT2I
#define SRTOPI

◆ intersection()

int intersection ( const HepPoint3D & c1,
double r1,
const HepPoint3D & c2,
double r2,
double eps,
HepPoint3D & x1,
HepPoint3D & x2 )

Circle utilities.

Definition at line 93 of file TMDCUtil.cxx.

94 {
95
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 );
103
104 // no intersections
105
106 if ( c0 > Radd + eps || c0 < 0.001 || c0 < Rsub - eps )
107 {
108 //-- debug
109 // std::cout << "Int2Cir return 0 " << std::endl;
110 //-- debug end
111 return 0;
112 }
113
114 // single intersection
115
116 else
117 {
118 if ( c0 > Radd - eps )
119 {
120 x1.setX( c1.x() + rr1 * c0x / c0 );
121 x1.setY( c1.y() + rr1 * c0y / c0 );
122 x2.setX( 0.0 );
123 x2.setY( 0.0 );
124 //--debug
125 // std::cout << "Int2Cir return 1" << std::endl;
126 //--debug end
127 return 1;
128 }
129 }
130
131 // two intersections
132
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 ) );
140 //-- debug
141 // std::cout << "Int2Cir return 2" << std::endl;
142 //-- debug end
143 return 2;
144}
EvtTensor3C eps(const EvtVector3R &v)

◆ sortByWireId()

int sortByWireId ( const TMDCWireHit ** a,
const TMDCWireHit ** b )

TMDCWireHit utilities.

Variable Documentation

◆ ORIGIN

const HepPoint3D ORIGIN
extern

Constants.

Definition at line 47 of file TMDCUtil.cxx.