CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 23 of file DTTrigGeomUtils.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 33 of file DTTrigGeomUtils.cc.

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

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

Destructor.

Definition at line 56 of file DTTrigGeomUtils.cc.

56  {
57 
58 }

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 61 of file DTTrigGeomUtils.cc.

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

61  {
62 
63  int sector = track->chamberId().sector();
64  int station = track->chamberId().station();
65  xdir = atan(track->localDirection().x()/ track->localDirection().z())*radToDeg_;
66  ydir = atan(track->localDirection().y()/ track->localDirection().z())*radToDeg_;
67 
68 
69  scsec = sector>12 ? sector==13 ? 4 : 10 : sector;
70  float xcenter = (scsec==4||scsec==10) ? (sector-12.9)/abs(sector-12.9)*xCenter_[(sector==10||sector==14)] : 0.;
71  x = track->localPosition().x()+xcenter*(station==4);
72  y = track->localPosition().y();
73 
74 }
T y() const
Definition: PV3DBase.h:63
#define abs(x)
Definition: mlp_lapack.h:159
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
virtual LocalPoint localPosition() const
Local position in Chamber frame.
int sector() const
Definition: DTChamberId.h:63
Definition: DDAxes.h:10
int station() const
Return the station number.
Definition: DTChamberId.h:53
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 52 of file DTTrigGeomUtils.h.

Referenced by trigDir(), and trigPos().

52 { 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 77 of file DTTrigGeomUtils.cc.

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

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

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

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

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

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

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

Definition at line 153 of file DTTrigGeomUtils.cc.

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

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

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

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

Definition at line 114 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(), DTLocalTriggerBaseTask::runDCCAnalysis(), DTLocalTriggerTask::runDCCAnalysis(), and DTLocalTriggerTask::runSegmentAnalysis().

114  {
115 
116 
117  int wh = trig->whNum();
118  int sec = trig->scNum()+1;
119  int st = trig->stNum();
120  int phi = trig->phi();
121 
122  float phin = (sec-1)*Geom::pi()/6;
123  float phicenter = 0;
124  float r = 0;
125  float xcenter = 0;
126 
127  if (sec==4 && st==4) {
128  GlobalPoint gpos = phi>0 ? muonGeom_->chamber(DTChamberId(wh,st,13))->position() : muonGeom_->chamber(DTChamberId(wh,st,4))->position();
129  xcenter = phi>0 ? xCenter_[0] : -xCenter_[0];
130  phicenter = gpos.phi();
131  r = gpos.perp();
132  } else if (sec==10 && st==4) {
133  GlobalPoint gpos = phi>0 ? muonGeom_->chamber(DTChamberId(wh,st,14))->position() : muonGeom_->chamber(DTChamberId(wh,st,10))->position();
134  xcenter = phi>0 ? xCenter_[1] : -xCenter_[1];
135  phicenter = gpos.phi();
136  r = gpos.perp();
137  } else {
138  GlobalPoint gpos = muonGeom_->chamber(DTChamberId(wh,st,sec))->position();
139  phicenter = gpos.phi();
140  r = gpos.perp();
141  }
142 
143  float deltaphi = phicenter-phin;
144  float x = (tan(phi/4096.)-tan(deltaphi))*(r*cos(deltaphi) - zcn_[st-1]); //zcn is in local coordinates -> z invreases approching to vertex
145  if (hasPosRF(wh,sec)){ x = -x; } // change sign in case of positive wheels
146  x+=xcenter;
147 
148  return x;
149 
150 }
T perp() const
Definition: PV3DBase.h:72
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
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_
double pi()
Definition: Pi.h:31
Definition: DDAxes.h:10
Definition: DDAxes.h:10
void DTTrigGeomUtils::trigToSeg ( int  st,
float &  x,
float  dir 
)
inline

Compute Trigger x coordinate in chamber RF.

Definition at line 49 of file DTTrigGeomUtils.h.

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

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

49 { 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
Definition: DDAxes.h:10

Member Data Documentation

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

Definition at line 52 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::radToDeg_
private

Definition at line 58 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::xCenter_[2]
private

Definition at line 59 of file DTTrigGeomUtils.h.

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

float DTTrigGeomUtils::zcn_[4]
private

Definition at line 57 of file DTTrigGeomUtils.h.

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