ATLAS Offline Software
windows.cxx
Go to the documentation of this file.
1 /* // -*- C++ -*- */
2 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
9 
10 #include "TrigT1RPClogic/large.h"
11 #include "TrigT1RPClogic/small.h"
12 #include "TrigT1RPClogic/foot.h"
13 
14 int windows(float distance,float eta_pivot,int thr,int sector)
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 }
64 
65 int give_nearest_bin(const float (*window)[NBINS][BOUND],int thr,int bin,int bound,
66  int step)
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 }
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
foot.h
small.h
NBINS
#define NBINS
Definition: windows.h:9
bin
Definition: BinsDiffFromStripMedian.h:43
bound
@ bound
Definition: L1CaloPprPlotManager.h:74
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
large.h
give_nearest_bin
int give_nearest_bin(const float(*window)[NBINS][BOUND], int thr, int bin, int bound, int step)
Definition: windows.cxx:65
windows.h
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
windows
int windows(float distance, float eta_pivot, int thr, int sector)
Definition: windows.cxx:14