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 ( edm::ESHandle< DTGeometry muonGeom,
bool  dirInDeg = true 
)

Constructor.

Definition at line 31 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_.

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

Destructor.

Definition at line 54 of file DTTrigGeomUtils.cc.

54  {
55 
56 }

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 59 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().

59  {
60 
61  int sector = track->chamberId().sector();
62  int station = track->chamberId().station();
63  xdir = atan(track->localDirection().x()/ track->localDirection().z())*radToDeg_;
64  ydir = atan(track->localDirection().y()/ track->localDirection().z())*radToDeg_;
65 
66 
67  scsec = sector>12 ? sector==13 ? 4 : 10 : sector;
68  float xcenter = (scsec==4||scsec==10) ? (sector-12.9)/abs(sector-12.9)*xCenter_[(sector==10||sector==14)] : 0.;
69  x = track->localPosition().x()+xcenter*(station==4);
70  y = track->localPosition().y();
71 
72 }
T y() const
Definition: PV3DBase.h:63
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
virtual LocalVector localDirection() const
Local direction in Chamber frame.
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual LocalPoint localPosition() const
Local position in Chamber frame.
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
T x() const
Definition: PV3DBase.h:62
bool DTTrigGeomUtils::hasPosRF ( int  wh,
int  sec 
)
inline

Checks id the chamber has positive RF;.

Definition at line 50 of file DTTrigGeomUtils.h.

Referenced by trigDir(), and trigPos().

50 { 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 75 of file DTTrigGeomUtils.cc.

References DTTopology::cellWidth(), DTTopology::channels(), DTGeometry::layer(), min(), muonGeom_, DTLayer::specificTopology(), and relativeConstraints::station.

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

75  {
76 
77  int station = id.station();
78  int sector = id.sector();
79 
80  const DTLayer *layer = muonGeom_->layer(DTLayerId(id,1,1));
81  DTTopology topo = layer->specificTopology();
82  double range = topo.channels()*topo.cellWidth();
83  min = -range*.5;
84  max = range*.5;
85 
86  if (station==4 && (sector==4 || sector == 10)){
87  min = -range-10;
88  max = range+10;
89  }
90  nbins = static_cast<int>((max-min)/step);
91 
92  return;
93 
94 }
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:68
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
T min(T a, T b)
Definition: MathUtil.h:58
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:75
edm::ESHandle< DTGeometry > muonGeom_
step
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 97 of file DTTrigGeomUtils.cc.

References DTTopology::cellWidth(), DTTopology::channels(), DTGeometry::layer(), min(), muonGeom_, and DTLayer::specificTopology().

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

97  {
98 
99  const DTLayer *layer = muonGeom_->layer(DTLayerId(id,2,1));
100  DTTopology topo = layer->specificTopology();
101  double range = topo.channels()*topo.cellWidth();
102  min = -range*.5;
103  max = range*.5;
104 
105  nbins = static_cast<int>((max-min)/step);
106 
107  return;
108 
109 }
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:68
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:110
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
T min(T a, T b)
Definition: MathUtil.h:58
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:75
edm::ESHandle< DTGeometry > muonGeom_
step
float DTTrigGeomUtils::trigDir ( const L1MuDTChambPhDigi trig)

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

Definition at line 151 of file DTTrigGeomUtils.cc.

References dir, hasPosRF(), phi, L1MuDTChambPhDigi::phi(), L1MuDTChambPhDigi::phiB(), radToDeg_, L1MuDTChambPhDigi::scNum(), and L1MuDTChambPhDigi::whNum().

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

151  {
152 
153 
154  int wh = trig->whNum();
155  int sec = trig->scNum()+1;
156  int phi = trig->phi();
157  int phib = trig->phiB();
158 
159  float dir = (phib/512.+phi/4096.)*radToDeg_;
160 
161  // change sign in case of negative wheels
162  if (!hasPosRF(wh,sec)) { dir = -dir; }
163 
164  return dir;
165 
166 }
bool hasPosRF(int wh, int sec)
Checks id the chamber has positive RF;.
dbl *** dir
Definition: mlp_gen.cc:35
float DTTrigGeomUtils::trigPos ( const L1MuDTChambPhDigi trig)

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

Definition at line 112 of file DTTrigGeomUtils.cc.

References DTGeometry::chamber(), funct::cos(), hasPosRF(), muonGeom_, PV3DBase< T, PVType, FrameType >::perp(), phi, L1MuDTChambPhDigi::phi(), PV3DBase< T, PVType, FrameType >::phi(), Geom::pi(), GeomDet::position(), 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().

112  {
113 
114 
115  int wh = trig->whNum();
116  int sec = trig->scNum()+1;
117  int st = trig->stNum();
118  int phi = trig->phi();
119 
120  float phin = (sec-1)*Geom::pi()/6;
121  float phicenter = 0;
122  float r = 0;
123  float xcenter = 0;
124 
125  if (sec==4 && st==4) {
126  GlobalPoint gpos = phi>0 ? muonGeom_->chamber(DTChamberId(wh,st,13))->position() : muonGeom_->chamber(DTChamberId(wh,st,4))->position();
127  xcenter = phi>0 ? xCenter_[0] : -xCenter_[0];
128  phicenter = gpos.phi();
129  r = gpos.perp();
130  } else if (sec==10 && st==4) {
131  GlobalPoint gpos = phi>0 ? muonGeom_->chamber(DTChamberId(wh,st,14))->position() : muonGeom_->chamber(DTChamberId(wh,st,10))->position();
132  xcenter = phi>0 ? xCenter_[1] : -xCenter_[1];
133  phicenter = gpos.phi();
134  r = gpos.perp();
135  } else {
136  GlobalPoint gpos = muonGeom_->chamber(DTChamberId(wh,st,sec))->position();
137  phicenter = gpos.phi();
138  r = gpos.perp();
139  }
140 
141  float deltaphi = phicenter-phin;
142  float x = (tan(phi/4096.)-tan(deltaphi))*(r*cos(deltaphi) - zcn_[st-1]); //zcn is in local coordinates -> z invreases approching to vertex
143  if (hasPosRF(wh,sec)){ x = -x; } // change sign in case of positive wheels
144  x+=xcenter;
145 
146  return x;
147 
148 }
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
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 DTChamber * chamber(DTChamberId id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:100
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 47 of file DTTrigGeomUtils.h.

References radToDeg_, funct::tan(), and zcn_.

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

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

Member Data Documentation

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

Definition at line 50 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::radToDeg_
private

Definition at line 56 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::xCenter_[2]
private

Definition at line 57 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::zcn_[4]
private

Definition at line 55 of file DTTrigGeomUtils.h.

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