CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes | Static Private Attributes
nano_mu::DTTrigGeomUtils Class Reference

#include <MuNtupleUtils.h>

Classes

struct  chambCoord
 

Public Member Functions

 DTTrigGeomUtils (edm::ConsumesCollector &&collector, bool dirInDeg=true)
 Constructor. More...
 
void getFromES (const edm::Run &run, const edm::EventSetup &environment)
 Update EventSetup information. More...
 
bool hasPosRF (int wh, int sec)
 Checks id the chamber has positive RF;. More...
 
chambCoord trigToReco (const L1MuDTChambPhDigi *trig)
 Return local position and direction in chamber RF - legacy. More...
 
chambCoord trigToReco (const L1Phase2MuDTPhDigi *trig)
 Return local position and direction in chamber RF - analytical method. More...
 

Private Attributes

ESTokenHandle< DTGeometry, MuonGeometryRecord, edm::Transition::BeginRunm_dtGeom
 
std::array< double, 4 > m_zcn
 
std::array< double, 4 > m_zsl1
 
std::array< double, 4 > m_zsl3
 

Static Private Attributes

static constexpr double PH1_PHI_R = 4096.
 
static constexpr double PH1_PHIB_R = 512.
 
static constexpr double PH2_PHI_R = 65536. / 0.8
 
static constexpr double PH2_PHIB_R = 2048. / 1.4
 

Detailed Description

Definition at line 86 of file MuNtupleUtils.h.

Constructor & Destructor Documentation

◆ DTTrigGeomUtils()

DTTrigGeomUtils::DTTrigGeomUtils ( edm::ConsumesCollector &&  collector,
bool  dirInDeg = true 
)

Constructor.

Definition at line 19 of file MuNtupleUtils.cc.

References eostools::move().

20  : m_dtGeom{std::move(collector), "idealForDigi"} {}
ESTokenHandle< DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun > m_dtGeom
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ getFromES()

void nano_mu::DTTrigGeomUtils::getFromES ( const edm::Run run,
const edm::EventSetup environment 
)
inline

Update EventSetup information.

Definition at line 106 of file MuNtupleUtils.h.

References DTGeometry::chamber(), reco_calib_source_client_cfg::environment, nano_mu::ESTokenHandle< T, R, TR >::getFromES(), m_dtGeom, m_zcn, m_zsl1, m_zsl3, GeomDet::position(), DTChamber::superLayer(), GeomDet::surface(), and GloballyPositioned< T >::toLocal().

Referenced by MuDTTPGPhiFlatTableProducer::getFromES().

106  {
108  for (int i_st = 0; i_st != 4; ++i_st) {
109  const DTChamberId chId(-2, i_st + 1, 4);
110  const DTChamber* chamb = m_dtGeom->chamber(chId);
111  const DTSuperLayer* sl1 = chamb->superLayer(DTSuperLayerId(chId, 1));
112  const DTSuperLayer* sl3 = chamb->superLayer(DTSuperLayerId(chId, 3));
113  m_zsl1[i_st] = chamb->surface().toLocal(sl1->position()).z();
114  m_zsl3[i_st] = chamb->surface().toLocal(sl3->position()).z();
115  m_zcn[i_st] = 0.5 * (m_zsl1[i_st] + m_zsl3[i_st]);
116  }
117  };
LocalPoint toLocal(const GlobalPoint &gp) const
float float float z
std::array< double, 4 > m_zsl3
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:53
std::array< double, 4 > m_zcn
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
void getFromES(const edm::EventSetup &environment)
Get Handle from ES.
Definition: MuNtupleUtils.h:73
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
std::array< double, 4 > m_zsl1
ESTokenHandle< DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun > m_dtGeom
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

◆ hasPosRF()

bool nano_mu::DTTrigGeomUtils::hasPosRF ( int  wh,
int  sec 
)
inline

Checks id the chamber has positive RF;.

Definition at line 103 of file MuNtupleUtils.h.

References fileinputsource_cfi::sec.

103 { return wh > 0 || (wh == 0 && sec % 4 > 1); };

◆ trigToReco() [1/2]

nano_mu::DTTrigGeomUtils::chambCoord DTTrigGeomUtils::trigToReco ( const L1MuDTChambPhDigi trig)

Return local position and direction in chamber RF - legacy.

Definition at line 22 of file MuNtupleUtils.cc.

References funct::cos(), HLT_2024v14_cff::delta_phi, DeadROC_duringRun::dir, Geom::pi(), fileinputsource_cfi::sec, funct::sin(), funct::tan(), ClusterTask_cfi::trig, and x.

Referenced by MuDTTPGPhiFlatTableProducer::fillTable().

22  {
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 }
static constexpr double PH1_PHI_R
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool hasPosRF(int wh, int sec)
Checks id the chamber has positive RF;.
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static constexpr double PH1_PHIB_R
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
ESTokenHandle< DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun > m_dtGeom
float x
constexpr double pi()
Definition: Pi.h:31
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

◆ trigToReco() [2/2]

nano_mu::DTTrigGeomUtils::chambCoord DTTrigGeomUtils::trigToReco ( const L1Phase2MuDTPhDigi trig)

Return local position and direction in chamber RF - analytical method.

Definition at line 57 of file MuNtupleUtils.cc.

References funct::cos(), HLT_2024v14_cff::delta_phi, DeadROC_duringRun::dir, Geom::pi(), quality, fileinputsource_cfi::sec, funct::sin(), funct::tan(), ClusterTask_cfi::trig, and x.

57  {
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 }
static constexpr double PH1_PHI_R
static constexpr double PH2_PHI_R
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::array< double, 4 > m_zsl3
string quality
std::array< double, 4 > m_zcn
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool hasPosRF(int wh, int sec)
Checks id the chamber has positive RF;.
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
std::array< double, 4 > m_zsl1
ESTokenHandle< DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun > m_dtGeom
static constexpr double PH2_PHIB_R
float x
constexpr double pi()
Definition: Pi.h:31
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

Member Data Documentation

◆ m_dtGeom

ESTokenHandle<DTGeometry, MuonGeometryRecord, edm::Transition::BeginRun> nano_mu::DTTrigGeomUtils::m_dtGeom
private

Definition at line 117 of file MuNtupleUtils.h.

Referenced by getFromES().

◆ m_zcn

std::array<double, 4> nano_mu::DTTrigGeomUtils::m_zcn
private

Definition at line 122 of file MuNtupleUtils.h.

Referenced by getFromES().

◆ m_zsl1

std::array<double, 4> nano_mu::DTTrigGeomUtils::m_zsl1
private

Definition at line 123 of file MuNtupleUtils.h.

Referenced by getFromES().

◆ m_zsl3

std::array<double, 4> nano_mu::DTTrigGeomUtils::m_zsl3
private

Definition at line 124 of file MuNtupleUtils.h.

Referenced by getFromES().

◆ PH1_PHI_R

constexpr double nano_mu::DTTrigGeomUtils::PH1_PHI_R = 4096.
staticprivate

Definition at line 126 of file MuNtupleUtils.h.

◆ PH1_PHIB_R

constexpr double nano_mu::DTTrigGeomUtils::PH1_PHIB_R = 512.
staticprivate

Definition at line 127 of file MuNtupleUtils.h.

◆ PH2_PHI_R

constexpr double nano_mu::DTTrigGeomUtils::PH2_PHI_R = 65536. / 0.8
staticprivate

Definition at line 129 of file MuNtupleUtils.h.

◆ PH2_PHIB_R

constexpr double nano_mu::DTTrigGeomUtils::PH2_PHIB_R = 2048. / 1.4
staticprivate

Definition at line 130 of file MuNtupleUtils.h.