CMS 3D CMS Logo

DTTrigGeomUtils.cc
Go to the documentation of this file.
1 /*
2  * \file DTTrigGeomUtils.cc
3  *
4  * \author C. Battilana - CIEMAT
5  *
6 */
7 
9 
10 // Framework
12 
13 // Trigger
15 
16 // Geometry & Segment
24 
25 #include <iostream>
26 
27 using namespace edm;
28 using namespace std;
29 
30 DTTrigGeomUtils::DTTrigGeomUtils(ESHandle<DTGeometry> muonGeom, bool dirInDeg) : 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 }
49 
51 
53  const DTRecSegment4D* track, int& scsec, float& x, float& xdir, float& y, float& ydir) {
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 }
66 
67 void DTTrigGeomUtils::phiRange(const DTChamberId& id, float& min, float& max, int& nbins, float step) {
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 }
85 
86 void DTTrigGeomUtils::thetaRange(const DTChamberId& id, float& min, float& max, int& nbins, float step) {
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 }
97 
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 }
137 
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 }
153 
154 // Local Variables:
155 // show-trailing-whitespace: t
156 // truncate-lines: t
157 // End:
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
DTSuperLayerId
Definition: DTSuperLayerId.h:12
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
DDAxes::y
DTRecSegment4D
Definition: DTRecSegment4D.h:23
DTTrigGeomUtils.h
DTTrigGeomUtils::trigDir
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
Definition: DTTrigGeomUtils.cc:138
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
DTTrigGeomUtils::xCenter_
float xCenter_[2]
Definition: DTTrigGeomUtils.h:54
L1MuDTChambPhDigi.h
step
step
Definition: StallMonitor.cc:94
min
T min(T a, T b)
Definition: MathUtil.h:58
relativeConstraints.station
station
Definition: relativeConstraints.py:67
edm
HLT enums.
Definition: AlignableModifier.h:19
DTTrigGeomUtils::radToDeg_
float radToDeg_
Definition: DTTrigGeomUtils.h:53
DTChamber
Definition: DTChamber.h:24
DTTrigGeomUtils::muonGeom_
edm::ESHandle< DTGeometry > muonGeom_
Definition: DTTrigGeomUtils.h:48
DTTopology::channels
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
DTTrigGeomUtils::trigPos
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
Definition: DTTrigGeomUtils.cc:98
DTTrigGeomUtils::zcn_
float zcn_[4]
Definition: DTTrigGeomUtils.h:52
DDAxes::x
DTSuperLayer
Definition: DTSuperLayer.h:24
DTTopology::cellWidth
float cellWidth() const
Returns the cell width.
Definition: DTTopology.h:69
DTGeometry::chamber
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
ydir
Definition: DeviationsFromFileSensor2D.cc:15
DTTopology
Definition: DTTopology.h:28
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DDAxes::z
edm::ESHandle< DTGeometry >
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
Geom::pi
constexpr double pi()
Definition: Pi.h:31
Point3DBase< float, GlobalTag >
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
DTLayerId
Definition: DTLayerId.h:12
DTLayer.h
DTTrigGeomUtils::phiRange
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
Definition: DTTrigGeomUtils.cc:67
DTGeometry.h
DTGeometry::layer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
DTTrigGeomUtils::thetaRange
void thetaRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute theta range in local chamber coordinates.
Definition: DTTrigGeomUtils.cc:86
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
DTTrigGeomUtils::computeSCCoordinates
void computeSCCoordinates(const DTRecSegment4D *track, int &scsec, float &x, float &xdir, float &y, float &ydir)
Compute track coordinates with SC sector numbering.
Definition: DTTrigGeomUtils.cc:52
xdir
Definition: DeviationsFromFileSensor2D.cc:15
ClusterTask_cfi.trig
trig
Definition: ClusterTask_cfi.py:398
DTLayer
Definition: DTLayer.h:25
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
DTTrigGeomUtils::DTTrigGeomUtils
DTTrigGeomUtils(edm::ESHandle< DTGeometry > muonGeom, bool dirInDeg=true)
Constructor.
Definition: DTTrigGeomUtils.cc:30
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
std
Definition: JetResolutionObject.h:76
GloballyPositioned::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: GloballyPositioned.h:98
genVertex_cff.x
x
Definition: genVertex_cff.py:12
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
EventSetup.h
DTLayer::specificTopology
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
DTChamber.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
MuonGeometryRecord.h
DTChamber::superLayer
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:53
DTTopology.h
DTSuperLayer.h
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
L1MuDTChambPhDigi
Definition: L1MuDTChambPhDigi.h:31
DTTrigGeomUtils::~DTTrigGeomUtils
virtual ~DTTrigGeomUtils()
Destructor.
Definition: DTTrigGeomUtils.cc:50
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
DTRecSegment4DCollection.h
DTTrigGeomUtils::hasPosRF
bool hasPosRF(int wh, int sec)
Checks id the chamber has positive RF;.
Definition: DTTrigGeomUtils.h:48