CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( edm::ESHandle< DTGeometry muonGeom,
bool  dirInDeg = true 
)

Constructor.

Definition at line 30 of file DTTrigGeomUtils.cc.

References DTChamberId, DTSuperLayerId, 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 }
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:53
DTSuperLayerId
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
LocalPoint toLocal(const GlobalPoint &gp) const
edm::ESHandle< DTGeometry > muonGeom_
constexpr double pi()
Definition: Pi.h:31
DTTrigGeomUtils::~DTTrigGeomUtils ( )
virtual

Destructor.

Definition at line 50 of file DTTrigGeomUtils.cc.

50 {}

Member Function Documentation

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(), DTRecSegment4D::chamberId(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), radToDeg_, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, PV3DBase< T, PVType, FrameType >::x(), xCenter_, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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 }
LocalVector localDirection() const override
Local direction in Chamber frame.
T y() const
Definition: PV3DBase.h:60
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
LocalPoint localPosition() const override
Local position in Chamber frame.
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int sector() const
Definition: DTChamberId.h:49
int station() const
Return the station number.
Definition: DTChamberId.h:42
T x() const
Definition: PV3DBase.h:59
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); };
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(), DTLayerId, phase1PixelTopology::layer, SiStripPI::min, muonGeom_, sistrip::SpyUtilities::range(), DTLayer::specificTopology(), 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
constexpr std::array< uint8_t, layerIndexSize > layer
const uint16_t range(const Frame &aFrame)
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
edm::ESHandle< DTGeometry > muonGeom_
step
Definition: StallMonitor.cc:98
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(), DTLayerId, phase1PixelTopology::layer, SiStripPI::min, muonGeom_, sistrip::SpyUtilities::range(), and DTLayer::specificTopology().

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
constexpr std::array< uint8_t, layerIndexSize > layer
const uint16_t range(const Frame &aFrame)
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
edm::ESHandle< DTGeometry > muonGeom_
step
Definition: StallMonitor.cc:98
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, L1MuDTChambPhDigi::phi(), L1MuDTChambPhDigi::phiB(), radToDeg_, L1MuDTChambPhDigi::scNum(), and L1MuDTChambPhDigi::whNum().

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;.
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 funct::cos(), DTChamberId, hasPosRF(), muonGeom_, PV3DBase< T, PVType, FrameType >::perp(), phi, L1MuDTChambPhDigi::phi(), PV3DBase< T, PVType, FrameType >::phi(), Geom::pi(), alignCSCRings::r, L1MuDTChambPhDigi::scNum(), L1MuDTChambPhDigi::stNum(), funct::tan(), L1MuDTChambPhDigi::whNum(), 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_
constexpr double pi()
Definition: Pi.h:31
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 radToDeg_, funct::tan(), 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

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

Definition at line 48 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::radToDeg_
private

Definition at line 53 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::xCenter_[2]
private

Definition at line 54 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::zcn_[4]
private

Definition at line 52 of file DTTrigGeomUtils.h.

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