ATLAS Offline Software
Functions
windows.cxx File Reference
#include "TrigT1RPClogic/windows.h"
#include "TrigT1RPClogic/large.h"
#include "TrigT1RPClogic/small.h"
#include "TrigT1RPClogic/foot.h"
Include dependency graph for windows.cxx:

Go to the source code of this file.

Functions

int windows (float distance, float eta_pivot, int thr, int sector)
 
int give_nearest_bin (const float(*window)[NBINS][BOUND], int thr, int bin, int bound, int step)
 

Function Documentation

◆ give_nearest_bin()

int give_nearest_bin ( const float(*)  window[NBINS][BOUND],
int  thr,
int  bin,
int  bound,
int  step 
)

Definition at line 65 of file windows.cxx.

67 {
68  int previous = (bin <= NBINS/2)? bin + step : bin - step;
69  int next = (bin <= NBINS/2)? bin - step : bin + step;
70 
71  if (window[thr][previous-1][bound]) return previous;
72  if (window[thr][next-1][bound]) return next;
73 
74  if (next == 1 || next == NBINS) return next;
75 
76  return give_nearest_bin(window,thr,bin,bound,step+1);
77 }

◆ windows()

int windows ( float  distance,
float  eta_pivot,
int  thr,
int  sector 
)

Definition at line 14 of file windows.cxx.

15 {
16 
17  int bin=0,s=0;
18 
19  for (int j=1;j<=50;j++)
20  {
21  if ((eta_pivot>=-1.1+(j-1)*0.044)&&(eta_pivot<-1.1+j*0.044)) bin = j;
22  }
23 
24  int sector_type=((sector + 1)/2)%2;
25 
26  const float (*window)[NBINS][BOUND] = 0;
27 
28 
29  if (sector_type == 0)
30  {
31  window = Large_win;
32  }
33  else if (sector_type == 1 &&
34  !( sector==21 || sector==22 || sector==25 || sector==26 ))
35  {
36  window = Small_win;
37  }
38  else
39  {
40  window = Foot_win;
41  }
42 
43  if(distance <= 0)
44  {
45  if (!window[thr][bin-1][0])
46  {
47  bin = give_nearest_bin(window,thr,bin,0,1);
48  }
49 
50  if(distance>=window[thr][bin-1][0]) s = 1;
51  }
52  else
53  {
54  if (!window[thr][bin-1][1])
55  {
56  bin = give_nearest_bin(window,thr,bin,1,1);
57  }
58 
59  if(distance<=window[thr][bin-1][1]) s = 1;
60  }
61 
62  return s;
63 }
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
NBINS
#define NBINS
Definition: windows.h:9
bin
Definition: BinsDiffFromStripMedian.h:43
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
give_nearest_bin
int give_nearest_bin(const float(*window)[NBINS][BOUND], int thr, int bin, int bound, int step)
Definition: windows.cxx:65
LArCellBinning.step
step
Definition: LArCellBinning.py:158
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
readCCLHist.float
float
Definition: readCCLHist.py:83
Trk::previous
@ previous
Definition: BinningData.h:32
BOUND
#define BOUND
Definition: windows.h:10