CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTTrigGeomUtils Class Reference

#include <DTTrigGeomUtils.h>

Public Member Functions

void computeSCCoordinates (const DTRecSegment4D *track, int &scsec, float &x, float &xdir, float &y, float &ydir)
 Compute track coordinates with SC sector numbering. More...
 
 DTTrigGeomUtils (edm::ESHandle< DTGeometry > muonGeom, bool dirInDeg=true)
 Constructor. More...
 
bool hasPosRF (int wh, int sec)
 Checks id the chamber has positive RF;. More...
 
void phiRange (const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
 Compute phi range in local chamber coordinates. More...
 
void thetaRange (const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
 Compute theta range in local chamber coordinates. More...
 
float trigDir (const L1MuDTChambPhDigi *trig)
 Return local direction (trigger RF) for a given trigger primitive. More...
 
float trigPos (const L1MuDTChambPhDigi *trig)
 Return local position (trigger RF) for a given trigger primitive. More...
 
void trigToSeg (int st, float &x, float dir)
 Compute Trigger x coordinate in chamber RF. More...
 
virtual ~DTTrigGeomUtils ()
 Destructor. More...
 

Private Attributes

edm::ESHandle< DTGeometrymuonGeom_
 
float radToDeg_
 
float xCenter_ [2]
 
float zcn_ [4]
 

Detailed Description

Definition at line 21 of file DTTrigGeomUtils.h.

Constructor & Destructor Documentation

◆ DTTrigGeomUtils()

DTTrigGeomUtils::DTTrigGeomUtils ( edm::ESHandle< DTGeometry muonGeom,
bool  dirInDeg = true 
)

Constructor.

Definition at line 30 of file DTTrigGeomUtils.cc.

References DTGeometry::chamber(), muonGeom_, Geom::pi(), GeomDet::position(), radToDeg_, DTChamber::superLayer(), GeomDet::surface(), GeomDet::toLocal(), GloballyPositioned< T >::toLocal(), x, xCenter_, z, and zcn_.

30  : muonGeom_(muonGeom) {
31  radToDeg_ = dirInDeg ? 180. / Geom::pi() : 1;
32 
33  for (int ist = 1; ist <= 4; ++ist) {
34  const DTChamberId chId(-2, ist, 4);
35  const DTChamber* chamb = muonGeom_->chamber(chId);
36  const DTSuperLayer* sl1 = chamb->superLayer(DTSuperLayerId(chId, 1));
37  const DTSuperLayer* sl3 = chamb->superLayer(DTSuperLayerId(chId, 3));
38  zcn_[ist - 1] =
39  .5 * (chamb->surface().toLocal(sl1->position()).z() + chamb->surface().toLocal(sl3->position()).z());
40  }
41 
42  const DTChamber* chamb = muonGeom_->chamber(DTChamberId(-2, 4, 13));
43  const DTChamber* scchamb = muonGeom_->chamber(DTChamberId(-2, 4, 4));
44  xCenter_[0] = scchamb->toLocal(chamb->position()).x() * .5;
45  chamb = muonGeom_->chamber(DTChamberId(-2, 4, 14));
46  scchamb = muonGeom_->chamber(DTChamberId(-2, 4, 10));
47  xCenter_[1] = scchamb->toLocal(chamb->position()).x() * .5;
48 }
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
LocalPoint toLocal(const GlobalPoint &gp) const
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:53
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
edm::ESHandle< DTGeometry > muonGeom_
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
constexpr double pi()
Definition: Pi.h:31
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

◆ ~DTTrigGeomUtils()

DTTrigGeomUtils::~DTTrigGeomUtils ( )
virtual

Destructor.

Definition at line 50 of file DTTrigGeomUtils.cc.

50 {}

Member Function Documentation

◆ computeSCCoordinates()

void DTTrigGeomUtils::computeSCCoordinates ( const DTRecSegment4D track,
int &  scsec,
float &  x,
float &  xdir,
float &  y,
float &  ydir 
)

Compute track coordinates with SC sector numbering.

Definition at line 52 of file DTTrigGeomUtils.cc.

References funct::abs(), radToDeg_, nano_mu_digi_cff::sector, relativeConstraints::station, HLT_2024v14_cff::track, x, xCenter_, xdir, y, and ydir.

Referenced by DTLocalTriggerLutTask::analyze(), DTTriggerEfficiencyTask::analyze(), and DTLocalTriggerTask::runSegmentAnalysis().

53  {
54  int sector = track->chamberId().sector();
55  int station = track->chamberId().station();
56  xdir = atan(track->localDirection().x() / track->localDirection().z()) * radToDeg_;
57  ydir = atan(track->localDirection().y() / track->localDirection().z()) * radToDeg_;
58 
59  scsec = sector > 12 ? sector == 13 ? 4 : 10 : sector;
60  float xcenter = (scsec == 4 || scsec == 10)
61  ? (sector - 12.9) / abs(sector - 12.9) * xCenter_[(sector == 10 || sector == 14)]
62  : 0.;
63  x = track->localPosition().x() + xcenter * (station == 4);
64  y = track->localPosition().y();
65 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ hasPosRF()

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

Checks id the chamber has positive RF;.

Definition at line 48 of file DTTrigGeomUtils.h.

Referenced by trigDir(), and trigPos().

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

◆ phiRange()

void DTTrigGeomUtils::phiRange ( const DTChamberId id,
float &  min,
float &  max,
int &  nbins,
float  step = 15 
)

Compute phi range in local chamber coordinates.

Definition at line 67 of file DTTrigGeomUtils.cc.

References DTTopology::cellWidth(), DTTopology::channels(), nano_mu_digi_cff::layer, DTGeometry::layer(), SiStripPI::max, SiStripPI::min, muonGeom_, LaserClient_cfi::nbins, FastTimerService_cff::range, nano_mu_digi_cff::sector, and relativeConstraints::station.

Referenced by DTTriggerEfficiencyTask::bookChamberHistos(), DTLocalTriggerEfficiencyTest::bookChambHistos(), DTLocalTriggerTask::bookHistos(), and DTLocalTriggerBaseTask::bookHistos().

67  {
68  int station = id.station();
69  int sector = id.sector();
70 
71  const DTLayer* layer = muonGeom_->layer(DTLayerId(id, 1, 1));
72  const DTTopology& topo = layer->specificTopology();
73  double range = topo.channels() * topo.cellWidth();
74  min = -range * .5;
75  max = range * .5;
76 
77  if (station == 4 && (sector == 4 || sector == 10)) {
78  min = -range - 10;
79  max = range + 10;
80  }
81  nbins = static_cast<int>((max - min) / step);
82 
83  return;
84 }
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:69
edm::ESHandle< DTGeometry > muonGeom_
step
Definition: StallMonitor.cc:83
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

◆ thetaRange()

void DTTrigGeomUtils::thetaRange ( const DTChamberId id,
float &  min,
float &  max,
int &  nbins,
float  step = 15 
)

Compute theta range in local chamber coordinates.

Definition at line 86 of file DTTrigGeomUtils.cc.

References DTTopology::cellWidth(), DTTopology::channels(), nano_mu_digi_cff::layer, DTGeometry::layer(), SiStripPI::max, SiStripPI::min, muonGeom_, LaserClient_cfi::nbins, and FastTimerService_cff::range.

Referenced by DTLocalTriggerEfficiencyTest::bookChambHistos(), and DTLocalTriggerTask::bookHistos().

86  {
87  const DTLayer* layer = muonGeom_->layer(DTLayerId(id, 2, 1));
88  const DTTopology& topo = layer->specificTopology();
89  double range = topo.channels() * topo.cellWidth();
90  min = -range * .5;
91  max = range * .5;
92 
93  nbins = static_cast<int>((max - min) / step);
94 
95  return;
96 }
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:69
edm::ESHandle< DTGeometry > muonGeom_
step
Definition: StallMonitor.cc:83
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

◆ trigDir()

float DTTrigGeomUtils::trigDir ( const L1MuDTChambPhDigi trig)

Return local direction (trigger RF) for a given trigger primitive.

Definition at line 138 of file DTTrigGeomUtils.cc.

References DeadROC_duringRun::dir, hasPosRF(), phi, radToDeg_, fileinputsource_cfi::sec, and ClusterTask_cfi::trig.

Referenced by DTLocalTriggerLutTask::analyze(), DTLocalTriggerTask::runSegmentAnalysis(), DTLocalTriggerBaseTask::runTMAnalysis(), and DTLocalTriggerTask::runTMAnalysis().

138  {
139  int wh = trig->whNum();
140  int sec = trig->scNum() + 1;
141  int phi = trig->phi();
142  int phib = trig->phiB();
143 
144  float dir = (phib / 512. + phi / 4096.) * radToDeg_;
145 
146  // change sign in case of negative wheels
147  if (!hasPosRF(wh, sec)) {
148  dir = -dir;
149  }
150 
151  return dir;
152 }
bool hasPosRF(int wh, int sec)
Checks id the chamber has positive RF;.

◆ trigPos()

float DTTrigGeomUtils::trigPos ( const L1MuDTChambPhDigi trig)

Return local position (trigger RF) for a given trigger primitive.

Definition at line 98 of file DTTrigGeomUtils.cc.

References DTGeometry::chamber(), funct::cos(), hasPosRF(), muonGeom_, PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), Geom::pi(), GeomDet::position(), alignCSCRings::r, fileinputsource_cfi::sec, funct::tan(), ClusterTask_cfi::trig, x, xCenter_, and zcn_.

Referenced by DTLocalTriggerLutTask::analyze(), DTLocalTriggerTask::runSegmentAnalysis(), DTLocalTriggerBaseTask::runTMAnalysis(), and DTLocalTriggerTask::runTMAnalysis().

98  {
99  int wh = trig->whNum();
100  int sec = trig->scNum() + 1;
101  int st = trig->stNum();
102  int phi = trig->phi();
103 
104  float phin = (sec - 1) * Geom::pi() / 6;
105  float phicenter = 0;
106  float r = 0;
107  float xcenter = 0;
108 
109  if (sec == 4 && st == 4) {
110  GlobalPoint gpos = phi > 0 ? muonGeom_->chamber(DTChamberId(wh, st, 13))->position()
111  : muonGeom_->chamber(DTChamberId(wh, st, 4))->position();
112  xcenter = phi > 0 ? xCenter_[0] : -xCenter_[0];
113  phicenter = gpos.phi();
114  r = gpos.perp();
115  } else if (sec == 10 && st == 4) {
116  GlobalPoint gpos = phi > 0 ? muonGeom_->chamber(DTChamberId(wh, st, 14))->position()
117  : muonGeom_->chamber(DTChamberId(wh, st, 10))->position();
118  xcenter = phi > 0 ? xCenter_[1] : -xCenter_[1];
119  phicenter = gpos.phi();
120  r = gpos.perp();
121  } else {
122  GlobalPoint gpos = muonGeom_->chamber(DTChamberId(wh, st, sec))->position();
123  phicenter = gpos.phi();
124  r = gpos.perp();
125  }
126 
127  float deltaphi = phicenter - phin;
128  float x = (tan(phi / 4096.) - tan(deltaphi)) *
129  (r * cos(deltaphi) - zcn_[st - 1]); //zcn is in local coordinates -> z invreases approching to vertex
130  if (hasPosRF(wh, sec)) {
131  x = -x;
132  } // change sign in case of positive wheels
133  x += xcenter;
134 
135  return x;
136 }
T perp() const
Definition: PV3DBase.h:69
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
bool hasPosRF(int wh, int sec)
Checks id the chamber has positive RF;.
edm::ESHandle< DTGeometry > muonGeom_
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
constexpr double pi()
Definition: Pi.h:31
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

◆ trigToSeg()

void DTTrigGeomUtils::trigToSeg ( int  st,
float &  x,
float  dir 
)
inline

Compute Trigger x coordinate in chamber RF.

Definition at line 45 of file DTTrigGeomUtils.h.

References DeadROC_duringRun::dir, radToDeg_, funct::tan(), x, and zcn_.

Referenced by DTLocalTriggerLutTask::analyze(), and DTLocalTriggerTask::runSegmentAnalysis().

45 { x -= tan(dir / radToDeg_) * zcn_[st - 1]; };
Tan< T >::type tan(const T &t)
Definition: Tan.h:22

Member Data Documentation

◆ muonGeom_

edm::ESHandle<DTGeometry> DTTrigGeomUtils::muonGeom_
private

Definition at line 48 of file DTTrigGeomUtils.h.

Referenced by DTTrigGeomUtils(), phiRange(), thetaRange(), and trigPos().

◆ radToDeg_

float DTTrigGeomUtils::radToDeg_
private

Definition at line 53 of file DTTrigGeomUtils.h.

Referenced by computeSCCoordinates(), DTTrigGeomUtils(), trigDir(), and trigToSeg().

◆ xCenter_

float DTTrigGeomUtils::xCenter_[2]
private

Definition at line 54 of file DTTrigGeomUtils.h.

Referenced by computeSCCoordinates(), DTTrigGeomUtils(), and trigPos().

◆ zcn_

float DTTrigGeomUtils::zcn_[4]
private

Definition at line 52 of file DTTrigGeomUtils.h.

Referenced by DTTrigGeomUtils(), trigPos(), and trigToSeg().