BOSS 7.0.7
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 HEP_SHORT_NAMES
 
#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

◆ HEP_SHORT_NAMES

#define HEP_SHORT_NAMES

Definition at line 24 of file TMDCUtil.h.

◆ TMDCUtil_INLINE_DEFINE_HERE

#define TMDCUtil_INLINE_DEFINE_HERE

Definition at line 86 of file TMDCUtil.h.

Typedef Documentation

◆ HepPoint3D

typedef HepGeom::Point3D<double> HepPoint3D

Definition at line 29 of file TMDCUtil.h.

Function Documentation

◆ bitDisplay() [1/2]

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

Definition at line 90 of file TMDCUtil.cxx.

90 {
91 unsigned i;
92 for (i = 0; i < f - l; i++) {
93 if ((i % 8) == 0) std::cout << " ";
94 std::cout << (val >> (f - i)) % 2;
95 }
96}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")

◆ bitDisplay() [2/2]

void bitDisplay ( unsigned  val)

Definition at line 85 of file TMDCUtil.cxx.

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

Referenced by bitDisplay(), TMDCWireHit::dump(), and TTrackMC::dump().

◆ CathodeSectorId()

float CathodeSectorId ( unsigned  id)

geocdc utilities

Definition at line 60 of file TMDCUtil.cxx.

60 {
61
62 unsigned layer = id/64;
63
64 if ( layer == 0 ){
65 return int(id/8);
66 }
67
68 if( layer == 1 ){
69 if( id >= 127 ) id -= 64;
70 if( (id-6)%8 == 0 ) return (id-6)/8 + 0.5;
71 else return int((id+1)/8);
72 }
73
74 if ( layer == 2 ) {
75 if( id <= 129 ) id += 64;
76 return int((id-2)/8);
77 }
78
79 return 9999;
80
81}

◆ chisq2confLevel()

double chisq2confLevel ( int  n,
double  chi2 
)

ALPHA = 10000. / 2.99792458 / 15.

Converter

Definition at line 156 of file TMDCUtil.cxx.

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

Referenced by TTrack::confidenceLevel().

◆ intersection()

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

Circle utilities.

Definition at line 99 of file TMDCUtil.cxx.

105 {
106
107 double c0x = c2.x() - c1.x() ;
108 double c0y = c2.y() - c1.y() ;
109 double c0 = sqrt ( c0x*c0x + c0y*c0y ) ;
110 double rr1 = abs(r1) ;
111 double rr2 = abs(r2) ;
112 double Radd = rr1 + rr2 ;
113 double Rsub = abs( rr1 - rr2 ) ;
114
115 // no intersections
116
117 if ( c0 > Radd + eps || c0 < 0.001 || c0 < Rsub - eps ) {
118 //-- debug
119 //std::cout << "Int2Cir return 0 " << std::endl;
120 //-- debug end
121 return 0 ;
122 }
123
124 // single intersection
125
126 else {
127 if ( c0 > Radd - eps ) {
128 x1.setX(c1.x() + rr1*c0x/c0);
129 x1.setY(c1.y() + rr1*c0y/c0);
130 x2.setX(0.0);
131 x2.setY(0.0);
132 //--debug
133 //std::cout << "Int2Cir return 1" << std::endl;
134 //--debug end
135 return 1 ;
136 }
137 }
138
139 // two intersections
140
141 double chg = abs(r1) / r1 ;
142 double cosPsi = ( c0*c0 + rr1*rr1 - rr2*rr2 ) / (2.*c0*rr1 ) ;
143 double sinPsi = - ( chg/abs(chg) ) * sqrt(1.0 - cosPsi*cosPsi) ;
144 x1.setX(c1.x() + ( rr1/c0 )*( cosPsi*c0x - sinPsi*c0y ));
145 x1.setY(c1.y() + ( rr1/c0 )*( cosPsi*c0y + sinPsi*c0x ));
146 x2.setX(c1.x() + ( rr1/c0 )*( cosPsi*c0x + sinPsi*c0y ));
147 x2.setY(c1.y() + ( rr1/c0 )*( cosPsi*c0y - sinPsi*c0x ));
148 //-- debug
149 //std::cout << "Int2Cir return 2" << std::endl;
150 //-- debug end
151 return 2 ;
152
153}
EvtTensor3C eps(const EvtVector3R &v)
Definition: EvtTensor3C.cc:307

Referenced by MucGeoGeneral::FindIntersectGaps(), MucGeoGeneral::FindIntersections(), MucGeoGeneral::FindIntersectStrips(), TTrack::HelCyl(), main(), and RecMucTrack::Project().

◆ sortByWireId()

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

TMDCWireHit utilities.

Variable Documentation

◆ ORIGIN