1 | #ifndef _CAL_TOWER_HH_
|
---|
2 | #define _CAL_TOWER_HH_
|
---|
3 |
|
---|
4 | #include <cmath>
|
---|
5 |
|
---|
6 | #ifndef M_PI
|
---|
7 | #define M_PI 3.141592653589793238462643383279502884197
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | const double TOWER_THETA[23] = { 3.000, 5.700, 8.400, 11.100, 13.800, 16.500, 19.200, 21.900, 24.600, 27.300, 30.000, 33.524,
|
---|
11 | 36.822, 40.261, 43.614, 47.436, 51.790, 56.735, 62.310, 68.516, 75.297, 82.526, 90.000 };
|
---|
12 |
|
---|
13 | class CalTower
|
---|
14 | {
|
---|
15 | public:
|
---|
16 |
|
---|
17 | double Et,eta,phi;
|
---|
18 | int iEta,iPhi;
|
---|
19 |
|
---|
20 | CalTower(): Et(0), eta(0), phi(0), iEta(-1), iPhi(-1) {}
|
---|
21 | CalTower(double Et0, double eta0, double phi0): Et(Et0), eta(eta0), phi(phi0)
|
---|
22 | {
|
---|
23 | if(fabs(eta) < -log(tan(TOWER_THETA[0]*M_PI/180/2))){
|
---|
24 | if(eta <= 0){
|
---|
25 | for(int i = 0; i < 22; i++)
|
---|
26 | if(eta < -log(tan((180 - TOWER_THETA[i + 1])*M_PI/180/2))){
|
---|
27 | iEta = 4 + i;
|
---|
28 | break;
|
---|
29 | }
|
---|
30 | }
|
---|
31 | else{
|
---|
32 | for(int i = 0; i < 22; i++)
|
---|
33 | if(-eta < -log(tan((180 - TOWER_THETA[i + 1])*M_PI/180/2))){
|
---|
34 | iEta = 47 - i;
|
---|
35 | break;
|
---|
36 | }
|
---|
37 | }
|
---|
38 | if(iEta >= 8 && iEta < 14 || iEta >= 38 && iEta < 44)
|
---|
39 | iPhi = int(phi/2/M_PI*48)%48;
|
---|
40 | else
|
---|
41 | iPhi = int(phi/2/M_PI*24)%24;
|
---|
42 | }
|
---|
43 | else{
|
---|
44 | iEta = -1;
|
---|
45 | iPhi = -1;
|
---|
46 | }
|
---|
47 | }
|
---|
48 | CalTower(double Et0, double eta0, double phi0, int iEta0, int iPhi0): Et(Et0), eta(eta0), phi(phi0), iEta(iEta0), iPhi(iPhi0) {}
|
---|
49 | CalTower(const CalTower& c): Et(c.Et), eta(c.eta), phi(c.phi), iEta(c.iEta), iPhi(c.iPhi) {}
|
---|
50 | bool isEqual(CalTower c)
|
---|
51 | {
|
---|
52 | return Et == c.Et && eta == c.eta && phi == c.phi && iEta == c.iEta && iPhi == c.iPhi;
|
---|
53 | }
|
---|
54 | };
|
---|
55 |
|
---|
56 | #endif
|
---|