ATLAS Offline Software
Loading...
Searching...
No Matches
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
12#include "TrigT1RPClogic/foot.h"
13
14int 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
65int 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}
static const float Foot_win[THRES][NBINS][BOUND]
Definition foot.h:14
static const float Large_win[THRES][NBINS][BOUND]
Definition large.h:12
static const float Small_win[THRES][NBINS][BOUND]
Definition small.h:14
int give_nearest_bin(const float(*window)[NBINS][BOUND], int thr, int bin, int bound, int step)
Definition windows.cxx:65
int windows(float distance, float eta_pivot, int thr, int sector)
Definition windows.cxx:14
#define BOUND
Definition windows.h:10
#define NBINS
Definition windows.h:9