ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
InDet::TRT_TrackSegmentsUtils_xk Class Reference

#include <TRT_TrackSegmentsUtils_xk.h>

Collaboration diagram for InDet::TRT_TrackSegmentsUtils_xk:

Public Member Functions

 TRT_TrackSegmentsUtils_xk ()
 
 ~TRT_TrackSegmentsUtils_xk ()
 
const int & size () const
 
void initiate (int)
 
template<class T >
void findStraightLine (int, T *, const T *, const T *)
 
template<class T >
void sort (T *, int *, int n)
 
template<class Tem >
void findStraightLine (int Np, Tem *par, const Tem *X, const Tem *Y)
 
template<class Tem >
void sort (Tem *a, int *b, int n)
 

Protected Attributes

int m_size
 
int * m_NA
 
int * m_MA
 
double * m_F
 

Detailed Description

Definition at line 24 of file TRT_TrackSegmentsUtils_xk.h.

Constructor & Destructor Documentation

◆ TRT_TrackSegmentsUtils_xk()

InDet::TRT_TrackSegmentsUtils_xk::TRT_TrackSegmentsUtils_xk ( )
inline

Definition at line 65 of file TRT_TrackSegmentsUtils_xk.h.

66  {
67  m_size = 0;
68  m_NA = 0;
69  m_MA = 0;
70  m_F = 0;
71  }

◆ ~TRT_TrackSegmentsUtils_xk()

InDet::TRT_TrackSegmentsUtils_xk::~TRT_TrackSegmentsUtils_xk ( )
inline

Definition at line 89 of file TRT_TrackSegmentsUtils_xk.h.

90  {
91  if(!m_size) return;
92  delete[] m_NA;
93  delete[] m_MA;
94  delete[] m_F ;
95  }

Member Function Documentation

◆ findStraightLine() [1/2]

template<class Tem >
void InDet::TRT_TrackSegmentsUtils_xk::findStraightLine ( int  Np,
Tem *  par,
const Tem *  X,
const Tem *  Y 
)

Definition at line 110 of file TRT_TrackSegmentsUtils_xk.h.

112  {
113  if(m_size<2 || Np<2 ) return;
114  if(Np>m_size) Np = m_size;
115 
116  Tem A = par[0];
117  Tem B = par[1];
118  Tem Amax = fabs(par[2]);
119 
120  int i=0;
121  while(i!=Np) {
122  m_NA[i]=i; m_F[i]=Y[i]; ++i;
123  m_NA[i]=i; m_F[i]=Y[i]; ++i;
124  }
125 
126  sort(m_F,m_NA,Np);
127 
128  // Search B with A = par[0];
129  //
130  i=0; int sm=0, s=0, l=0;
131  while(i!=Np) {
132  if((m_NA[i ]&1)==(m_MA[i ]=0)) {if(++s>sm) {sm=s; l= i;}} else --s;
133  if((m_NA[i+1]&1)==(m_MA[i+1]=0)) {if(++s>sm) {sm=s; l=1+i;}} else --s; i+=2;
134  }
135  B = .5*(Y[m_NA[l]]+Y[m_NA[l+1]]);
136 
137  // Search A and B
138  //
139  while(1) {
140 
141  i=(l=m_NA[l]); Tem u0=X[l], v0=Y[l];
142 
143  // Vector slopes preparation
144  //
145 
146  while(++i!=Np) {if(X[i]!=u0) break;} Tem U1=-1000., d=0.; int m=0;
147  while(i<Np-1) {
148 
149  if (X[i]==U1) {
150  if(fabs(m_F[m]=(Y[i ]-v0)*d)<Amax) m_NA[m++]=i;
151  if(fabs(m_F[m]=(Y[i+1]-v0)*d)<Amax) m_NA[m++]=i+1;
152  }
153  else {
154  d=1./((U1=X[i])-u0);
155  if(fabs(m_F[m]=(Y[i ]-v0)*d)<Amax) m_NA[m++]=i;
156  if(fabs(m_F[m]=(Y[i+1]-v0)*d)<Amax) m_NA[m++]=i+1;
157  }
158  i+=2;
159  }
160  (i=l); while(--i>0) {if(X[i]!=u0) break;} U1=-1000.;
161  while(i>0) {
162  if (X[i]==U1) {
163  if(fabs(m_F[m]=(Y[i ]-v0)*d)<Amax) m_NA[m++]=i;
164  if(fabs(m_F[m]=(Y[i-1]-v0)*d)<Amax) m_NA[m++]=i-1;
165 
166  }
167  else {
168  d=1./((U1=X[i])-u0);
169  if(fabs(m_F[m]=(Y[i ]-v0)*d)<Amax) m_NA[m++]=i;
170  if(fabs(m_F[m]=(Y[i-1]-v0)*d)<Amax) m_NA[m++]=i-1;
171  }
172  i-=2;
173  }
174 
175  if(m<=4) break;
176  sort(m_F,m_NA,m);
177 
178  int nm = 0; s = 0; sm=-1000;
179  for(int i=0; i!=m-1; ++i) {
180  int na = m_NA[i];
181  if((na&1)==0) {if(na>l) {if(++s>sm) {sm=s; nm=i;}} else --s;}
182  else {if(na<l) {if(++s>sm) {sm=s; nm=i;}} else --s;}
183  }
184  if(nm==0) break;
185  B = v0-(A=.5*(m_F[nm]+m_F[nm+1]))*u0; m_MA[l]=1;
186  if (m_MA[m_NA[nm ]]==0) l = nm;
187  else if(m_MA[m_NA[nm+1]]==0) l = nm+1;
188  else break;
189  }
190  par[0] = A;
191  par[1] = B;
192  }

◆ findStraightLine() [2/2]

template<class T >
void InDet::TRT_TrackSegmentsUtils_xk::findStraightLine ( int  ,
T *  ,
const T *  ,
const T *   
)

◆ initiate()

void InDet::TRT_TrackSegmentsUtils_xk::initiate ( int  n)
inline

Definition at line 73 of file TRT_TrackSegmentsUtils_xk.h.

74  {
75  if(n<=0) return;
76 
77  if(m_size) {
78 
79  delete[] m_NA;
80  delete[] m_MA;
81  delete[] m_F ;
82  }
83  m_size = n;
84  m_NA = new int [n];
85  m_MA = new int [n];
86  m_F = new double[n];
87  }

◆ size()

const int& InDet::TRT_TrackSegmentsUtils_xk::size ( ) const
inline

Definition at line 39 of file TRT_TrackSegmentsUtils_xk.h.

39 {return m_size;}

◆ sort() [1/2]

template<class T >
void InDet::TRT_TrackSegmentsUtils_xk::sort ( T *  ,
int *  ,
int  n 
)

◆ sort() [2/2]

template<class Tem >
void InDet::TRT_TrackSegmentsUtils_xk::sort ( Tem *  a,
int *  b,
int  n 
)

Definition at line 205 of file TRT_TrackSegmentsUtils_xk.h.

205  {
206 
207  if(n<=1) return;
208  int mt[50],lt[50], j=n-1, i=0, m=0;
209  while (1) {
210  if(j-i>1) {
211  int ip=(j+i)>>1, q=j; Tem ta=a[ip]; a[ip]=a[i]; int tb=b[ip]; b[ip]=b[i];
212  for(int k =i+1; k<=q; ++k) {
213  if(a[k]<=ta) continue;
214  int l=q;
215  while(1) {
216  if(a[l]<ta) {
217  Tem x=a[k]; a[k]=a[l]; a[l]=x;
218  int y=b[k]; b[k]=b[l]; b[l]=y; q=l-1; break;
219  }
220  if(--l< k) {q=k-1; break;}
221  }
222  }
223  a[i]=a[q]; a[q]=ta; b[i]=b[q]; b[q]=tb;
224  if((q<<1)>i+j) {lt[m]=i; mt[m++]=q-1; i=q+1;}
225  else {lt[m]=q+1; mt[m++]=j; j=q-1;}
226  }
227  else {
228  if(i<j && a[i]>a[j]) {
229  Tem x=a[i]; a[i]=a[j]; a[j]=x;
230  int y=b[i]; b[i]=b[j]; b[j]=y;
231  }
232  if(--m<0) return;
233  i=lt[m]; j=mt[m];
234  }
235  }
236  }

Member Data Documentation

◆ m_F

double* InDet::TRT_TrackSegmentsUtils_xk::m_F
protected

Definition at line 53 of file TRT_TrackSegmentsUtils_xk.h.

◆ m_MA

int* InDet::TRT_TrackSegmentsUtils_xk::m_MA
protected

Definition at line 52 of file TRT_TrackSegmentsUtils_xk.h.

◆ m_NA

int* InDet::TRT_TrackSegmentsUtils_xk::m_NA
protected

Definition at line 51 of file TRT_TrackSegmentsUtils_xk.h.

◆ m_size

int InDet::TRT_TrackSegmentsUtils_xk::m_size
protected

Definition at line 50 of file TRT_TrackSegmentsUtils_xk.h.


The documentation for this class was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
InDet::TRT_TrackSegmentsUtils_xk::m_MA
int * m_MA
Definition: TRT_TrackSegmentsUtils_xk.h:52
hist_file_dump.d
d
Definition: hist_file_dump.py:137
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
x
#define x
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
dqt_zlumi_alleff_HIST.A
A
Definition: dqt_zlumi_alleff_HIST.py:110
Execution.tb
tb
Definition: Execution.py:15
A
parseMapping.v0
def v0
Definition: parseMapping.py:149
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
InDet::TRT_TrackSegmentsUtils_xk::m_F
double * m_F
Definition: TRT_TrackSegmentsUtils_xk.h:53
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
a
TList * a
Definition: liststreamerinfos.cxx:10
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
y
#define y
extractSporadic.q
list q
Definition: extractSporadic.py:98
InDet::TRT_TrackSegmentsUtils_xk::sort
void sort(T *, int *, int n)
InDet::TRT_TrackSegmentsUtils_xk::m_size
int m_size
Definition: TRT_TrackSegmentsUtils_xk.h:50
fitman.k
k
Definition: fitman.py:528
InDet::TRT_TrackSegmentsUtils_xk::m_NA
int * m_NA
Definition: TRT_TrackSegmentsUtils_xk.h:51