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