CMS 3D CMS Logo

MuNtupleUtils.cc
Go to the documentation of this file.
1 /*
2  * \file MuNtupleUtils.cc
3  *
4  * \author C. Battilana - INFN (BO)
5  * \author L. Giuducci - INFN (BO)
6 */
7 
9 
12 
14 
15 // CB
16 // formulas to be re-checked
17 // can use template is_same, static_assert, enable_if ...
18 
20  : m_dtGeom{std::move(collector), "idealForDigi"} {}
21 
23  auto wh{trig->whNum()};
24  auto sec{trig->scNum() + 1};
25  auto st{trig->stNum()};
26  auto phi{trig->phi()};
27  auto phib{trig->phiB()};
28 
29  auto recoChamb = [&]() {
30  if (st != 4) {
31  return DTChamberId(wh, st, sec);
32  }
33  int reco_sec{(sec == 4 && phi > 0) ? 13 : (sec == 10 && phi > 0) ? 14 : sec};
34  return DTChamberId(wh, st, reco_sec);
35  };
36 
37  auto gpos{m_dtGeom->chamber(recoChamb())->position()};
38  auto r{gpos.perp()};
39 
40  auto delta_phi{gpos.phi() - (sec - 1) * Geom::pi() / 6};
41 
42  // zcn is in local coordinates -> z invreases approching to vertex
43  // LG: zcn offset was removed <- CB do we need to fix this?
44  float x = r * tan((phi - (phi < 0 ? 1 : 0)) / PH1_PHI_R) * cos(delta_phi) - r * sin(delta_phi);
45  float dir = (phib / PH1_PHIB_R + phi / PH1_PHI_R);
46 
47  // change sign in case of positive wheels
48  if (hasPosRF(wh, sec)) {
49  x = -x;
50  } else {
51  dir = -dir;
52  }
53 
54  return {x, dir};
55 }
56 
58  auto wh{trig->whNum()};
59  auto sec{trig->scNum() + 1};
60  auto st{trig->stNum()};
61  auto phi{trig->phi()};
62  auto phib{trig->phiBend()};
63  auto quality{trig->quality()};
64  auto sl{trig->slNum()};
65 
66  auto recoChamb = [&]() {
67  if (st != 4) {
68  return DTChamberId(wh, st, sec);
69  }
70  int reco_sec{(sec == 4 && phi > 0) ? 13 : (sec == 10 && phi > 0) ? 14 : sec};
71  return DTChamberId(wh, st, reco_sec);
72  };
73 
74  auto gpos{m_dtGeom->chamber(recoChamb())->position()};
75  auto r{gpos.perp()};
76 
77  auto delta_phi{gpos.phi() - (sec - 1) * Geom::pi() / 6};
78 
79  // CB to be potentially updated based on Silvia's results
80  double zRF = 0;
81  if (quality >= 6 && quality != 7)
82  zRF = m_zcn[st - 1];
83  if ((quality < 6 || quality == 7) && sl == 1)
84  zRF = m_zsl1[st - 1];
85  if ((quality < 6 || quality == 7) && sl == 3)
86  zRF = m_zsl3[st - 1];
87 
88  // zcn is in local coordinates -> z invreases approching to vertex
89  // LG: zcn offset was removed <- CB Mist confirm it is tryly accurate?
90  float x = r * tan((phi - (phi < 0 ? 1 : 0)) / PH1_PHI_R) * (cos(delta_phi) - zRF) - r * sin(delta_phi);
91  float dir = (phib / PH2_PHIB_R + phi / PH2_PHI_R);
92 
93  // change sign in case of positive wheels
94  if (hasPosRF(wh, sec)) {
95  x = -x;
96  } else {
97  dir = -dir;
98  }
99 
100  return {x, dir};
101 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DTTrigGeomUtils(edm::ConsumesCollector &&collector, bool dirInDeg=true)
Constructor.
string quality
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float x
constexpr double pi()
Definition: Pi.h:31
def move(src, dest)
Definition: eostools.py:511
chambCoord trigToReco(const L1MuDTChambPhDigi *trig)
Return local position and direction in chamber RF - legacy.