1 |
#include "UserCode/L1RpcTriggerAnalysis/interface/L1RpcTriggerAnalysisEfficiencyUtilities.h"
|
2 |
|
3 |
#include <sstream>
|
4 |
#include <cmath>
|
5 |
|
6 |
using namespace L1RpcTriggerAnalysisEfficiencyUtilities;
|
7 |
|
8 |
std::string Key::name()
|
9 |
{
|
10 |
std::stringstream s;
|
11 |
s << "h_" << ieta << "_" << ipt;
|
12 |
return s.str();
|
13 |
}
|
14 |
|
15 |
|
16 |
// for each index return corresponding ipt code value.
|
17 |
// exception: 0 -> returns 0. instead of "no muon"
|
18 |
// 1 -> returns 0.1 instead of 0.
|
19 |
// 32 -> is outside of L1 ptscale. Returns 160.
|
20 |
double PtScale::xBins[]={0., 0.1,
|
21 |
1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5., 6., 7., 8.,
|
22 |
10., 12., 14., 16., 18., 20., 25., 30., 35., 40., 45.,
|
23 |
50., 60., 70., 80., 90., 100., 120., 140.,
|
24 |
160.};
|
25 |
|
26 |
float PtScale::ptValue(unsigned int ptCode)
|
27 |
{
|
28 |
return (ptCode < n_binspt) ? xBins[ptCode] : -1;
|
29 |
}
|
30 |
|
31 |
unsigned int PtScale::ptCode(float ptValue)
|
32 |
{
|
33 |
int result = 0;
|
34 |
for (unsigned int i = 1; i < n_binspt; i++)
|
35 |
{
|
36 |
if (ptValue >= xBins[i]) result += 1;
|
37 |
else break;
|
38 |
}
|
39 |
return result;
|
40 |
}
|
41 |
|
42 |
// for each index keep corresponding lower eta bound of a tower.
|
43 |
// works only for a positive (absolute) eta. Thus for index 0 there is exception.
|
44 |
//
|
45 |
double EtaScale::tower[]={ 0., 0.07, 0.27, 0.44, 0.58, 0.72, 0.83, //0-6 pure barrel
|
46 |
0.93, 1.04, 1.14, //7-9 barrel/endcap overlap
|
47 |
1.24, 1.36, 1.48, //10-12 endcap
|
48 |
1.61, 1.73, 1.85, 1.97, 2.1}; //13-16 high eta endcap
|
49 |
|
50 |
float EtaScale::etaValue(unsigned int etaCode)
|
51 |
{
|
52 |
return (etaCode < n_towers) ? tower[etaCode] : -1;
|
53 |
}
|
54 |
|
55 |
unsigned int EtaScale::etaCode(float etaValue)
|
56 |
{
|
57 |
float abs_Value = std::fabs(etaValue);
|
58 |
unsigned int result = 0;
|
59 |
for (unsigned int i = 1; i < n_towers; i++)
|
60 |
{
|
61 |
if (abs_Value >= tower[i]) result += 1;
|
62 |
else break;
|
63 |
}
|
64 |
return result;
|
65 |
}
|
66 |
|