CMS 3D CMS Logo

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

#include <DTSurvey.h>

Public Member Functions

void CalculateChambers ()
 
 DTSurvey (const std::string &, const std::string &, int)
 
const DTSurveyChambergetChamber (int, int) const
 
int getId () const
 
void ReadChambers (edm::ESHandle< DTGeometry >)
 
 ~DTSurvey ()
 

Private Member Functions

void FillWheelInfo ()
 

Private Attributes

DTSurveyChamber *** chambers
 
TMatrixD delta
 
int id
 
std::string nameOfChamberInfoFile
 
std::string nameOfWheelInfoFile
 
float OffsetZ
 
TMatrixD Rot
 

Detailed Description

Implements a set of measurements given by survey, tipically a wheel.
Contains DTSurveyChambers and the displacements and rotations for each are calculated.

Date
2007/12/06 01:53:28
Revision
1.3
Author
Pablo Martinez Ruiz del Arbol

Definition at line 25 of file DTSurvey.h.

Constructor & Destructor Documentation

◆ DTSurvey()

DTSurvey::DTSurvey ( const std::string &  Wheel,
const std::string &  Chambers,
int  n 
)

Definition at line 12 of file DTSurvey.cc.

12  : chambers(nullptr) {
13  nameOfWheelInfoFile = Wheel;
14  nameOfChamberInfoFile = Chambers;
15  id = n;
16 
17  FillWheelInfo();
18 }

References FillWheelInfo(), dqmiodumpmetadata::n, nameOfChamberInfoFile, and nameOfWheelInfoFile.

◆ ~DTSurvey()

DTSurvey::~DTSurvey ( )

Definition at line 20 of file DTSurvey.cc.

20 { delete[] chambers; }

References chambers.

Member Function Documentation

◆ CalculateChambers()

void DTSurvey::CalculateChambers ( )

Definition at line 22 of file DTSurvey.cc.

22  {
23  for (int stationCounter = 0; stationCounter < 4; stationCounter++) {
24  for (int sectorCounter = 0; sectorCounter < 14; sectorCounter++) {
25  if (chambers[stationCounter][sectorCounter]->getNumberPoints() > 2) {
26  chambers[stationCounter][sectorCounter]->compute();
27  }
28  }
29  }
30 }

References chambers, and DTSurveyChamber::compute().

◆ FillWheelInfo()

void DTSurvey::FillWheelInfo ( )
private

Definition at line 120 of file DTSurvey.cc.

120  {
121  std::ifstream wheeltowheel(nameOfWheelInfoFile.c_str());
122  float zOffset, deltax, deltay, deltaz, alpha, beta, gamma;
123  wheeltowheel >> zOffset >> deltax >> deltay >> deltaz >> alpha >> beta >> gamma;
124  wheeltowheel.close();
125 
126  OffsetZ = zOffset;
127 
128  //Build displacement vector
129  delta.ResizeTo(3, 1);
130  delta(0, 0) = deltax / 10.0;
131  delta(1, 0) = deltay / 10.0;
132  delta(2, 0) = deltaz / 10.0;
133 
134  //Build rotation matrix
135  Rot.ResizeTo(3, 3);
136  TMatrixD alpha_m(3, 3);
137  TMatrixD beta_m(3, 3);
138  TMatrixD gamma_m(3, 3);
139  alpha_m.Zero();
140  beta_m.Zero();
141  gamma_m.Zero();
142  for (int k = 0; k < 3; k++) {
143  alpha_m(k, k) = 1.0;
144  beta_m(k, k) = 1.0;
145  gamma_m(k, k) = 1.0;
146  }
147  alpha /= 1000.0; //New scale: angles in radians
148  beta /= 1000.0;
149  gamma /= 1000.0;
150  alpha_m(1, 1) = cos(alpha);
151  alpha_m(1, 2) = sin(alpha);
152  alpha_m(2, 1) = -sin(alpha);
153  alpha_m(2, 2) = cos(alpha);
154  beta_m(0, 0) = cos(beta);
155  beta_m(0, 2) = -sin(beta);
156  beta_m(2, 0) = sin(beta);
157  beta_m(2, 2) = cos(beta);
158  gamma_m(0, 0) = cos(gamma);
159  gamma_m(0, 1) = sin(gamma);
160  gamma_m(1, 0) = -sin(gamma);
161  gamma_m(1, 1) = cos(gamma);
162  Rot = alpha_m * beta_m * gamma_m;
163 }

References zMuMuMuonUserData::alpha, zMuMuMuonUserData::beta, funct::cos(), delta, CustomPhysics_cfi::gamma, dqmdumpme::k, nameOfWheelInfoFile, OffsetZ, Rot, and funct::sin().

Referenced by DTSurvey().

◆ getChamber()

const DTSurveyChamber * DTSurvey::getChamber ( int  station,
int  sector 
) const

Definition at line 32 of file DTSurvey.cc.

32 { return chambers[station][sector]; }

References chambers, and relativeConstraints::station.

◆ getId()

int DTSurvey::getId ( ) const
inline

Definition at line 35 of file DTSurvey.h.

35 { return id; }

References id.

◆ ReadChambers()

void DTSurvey::ReadChambers ( edm::ESHandle< DTGeometry pDD)

Definition at line 34 of file DTSurvey.cc.

34  {
35  //Create the chambers
36  chambers = new DTSurveyChamber **[4];
37  for (int cont_stat = 0; cont_stat < 4; cont_stat++) {
38  chambers[cont_stat] = new DTSurveyChamber *[14];
39  for (int cont_sect = 0; cont_sect < 14; cont_sect++) {
40  DTChamberId mId(id, cont_stat + 1, cont_sect + 1);
41  chambers[cont_stat][cont_sect] = new DTSurveyChamber(id, cont_stat + 1, cont_sect + 1, mId.rawId());
42  }
43  }
44 
45  std::cout << nameOfChamberInfoFile << std::endl;
46  std::ifstream file(nameOfChamberInfoFile.c_str());
47  while (!file.eof()) {
48  int code, station, sector;
49  double x, y, z, rms, dx, dy, dz;
50  file >> code >> x >> y >> z >> rms >> dx >> dy >> dz;
51  if (file.eof())
52  break;
53  x = x / 10.0;
54  y = y / 10.0;
55  z = z / 10.0;
56  dx = dx / 10.0;
57  dy = dy / 10.0;
58  dz = dz / 10.0;
59  rms = rms / 10.0;
60  station = code / 10000 - 1;
61  sector = (code - (station + 1) * 10000) / 100 - 1;
62  //De momento vamos a actuar como si no hubiera otra forma de resolver esto
63  TMatrixD r(3, 1);
64  r(0, 0) = x;
65  r(1, 0) = y;
66  r(2, 0) = z + OffsetZ;
67  TMatrixD disp(3, 1);
68  disp(0, 0) = dx;
69  disp(1, 0) = dy;
70  disp(2, 0) = dz;
71  TMatrixD rp = Rot * r - delta;
72  disp = disp - r + rp;
73 
74  GlobalPoint rg(r(0, 0), r(1, 0), r(2, 0));
75  GlobalPoint rt(r(0, 0) - disp(0, 0), r(1, 0) - disp(1, 0), r(2, 0) - disp(2, 0));
76  DTChamberId mId(id, station + 1, sector + 1);
77  const DTChamber *mChamber = static_cast<const DTChamber *>(pDD->idToDet(mId));
78  LocalPoint rl = mChamber->toLocal(rg);
79  LocalPoint rtl = mChamber->toLocal(rt);
80  TMatrixD rLocal(3, 1);
81  rLocal(0, 0) = rl.x();
82  rLocal(1, 0) = rl.y();
83  rLocal(2, 0) = rl.z();
84  TMatrixD rTeo(3, 1);
85  rTeo(0, 0) = rtl.x();
86  rTeo(1, 0) = rtl.y();
87  rTeo(2, 0) = rtl.z();
88  TMatrixD diff = rLocal - rTeo;
89  TMatrixD errors(3, 1);
90  errors(0, 0) = rms;
91  errors(1, 0) = rms;
92  errors(2, 0) = rms;
93  chambers[station][sector]->addPoint(code, rLocal, diff, errors);
94  }
95  file.close();
96 }

References DTSurveyChamber::addPoint(), chambers, gather_cfg::cout, delta, change_name::diff, PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, debug_messages_cfi::errors, FrontierConditions_GlobalTag_cff::file, DTGeometry::idToDet(), nameOfChamberInfoFile, OffsetZ, alignCSCRings::r, DetId::rawId(), SiStripPI::rms, Rot, hcal_runs::rt, relativeConstraints::station, GeomDet::toLocal(), x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Member Data Documentation

◆ chambers

DTSurveyChamber*** DTSurvey::chambers
private

Definition at line 50 of file DTSurvey.h.

Referenced by CalculateChambers(), getChamber(), ReadChambers(), and ~DTSurvey().

◆ delta

TMatrixD DTSurvey::delta
private

◆ id

int DTSurvey::id
private

Definition at line 43 of file DTSurvey.h.

Referenced by getId().

◆ nameOfChamberInfoFile

std::string DTSurvey::nameOfChamberInfoFile
private

Definition at line 42 of file DTSurvey.h.

Referenced by DTSurvey(), and ReadChambers().

◆ nameOfWheelInfoFile

std::string DTSurvey::nameOfWheelInfoFile
private

Definition at line 42 of file DTSurvey.h.

Referenced by DTSurvey(), and FillWheelInfo().

◆ OffsetZ

float DTSurvey::OffsetZ
private

Definition at line 46 of file DTSurvey.h.

Referenced by FillWheelInfo(), and ReadChambers().

◆ Rot

TMatrixD DTSurvey::Rot
private

Definition at line 48 of file DTSurvey.h.

Referenced by FillWheelInfo(), and ReadChambers().

change_name.diff
diff
Definition: change_name.py:13
DDAxes::y
DTSurveyChamber
Definition: DTSurveyChamber.h:19
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
relativeConstraints.station
station
Definition: relativeConstraints.py:67
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hcal_runs.rt
rt
Definition: hcal_runs.py:76
DTChamber
Definition: DTChamber.h:24
CustomPhysics_cfi.gamma
gamma
Definition: CustomPhysics_cfi.py:17
DDAxes::x
DTSurvey::OffsetZ
float OffsetZ
Definition: DTSurvey.h:46
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
errors
Definition: errors.py:1
DTSurvey::chambers
DTSurveyChamber *** chambers
Definition: DTSurvey.h:50
DDAxes::z
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
DTSurvey::nameOfChamberInfoFile
std::string nameOfChamberInfoFile
Definition: DTSurvey.h:42
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
DTSurvey::nameOfWheelInfoFile
std::string nameOfWheelInfoFile
Definition: DTSurvey.h:42
DTSurvey::delta
TMatrixD delta
Definition: DTSurvey.h:47
PVValHelper::dy
Definition: PVValidationHelpers.h:49
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DTSurvey::Rot
TMatrixD Rot
Definition: DTSurvey.h:48
DTSurvey::id
int id
Definition: DTSurvey.h:43
PVValHelper::dz
Definition: PVValidationHelpers.h:50
DTSurveyChamber::addPoint
void addPoint(int, const TMatrixD &, const TMatrixD &, const TMatrixD &)
Definition: DTSurveyChamber.cc:28
DTChamberId
Definition: DTChamberId.h:14
DTGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:77
DTSurveyChamber::compute
void compute()
Definition: DTSurveyChamber.cc:15
PVValHelper::dx
Definition: PVValidationHelpers.h:48
DTSurvey::FillWheelInfo
void FillWheelInfo()
Definition: DTSurvey.cc:120
debug_messages_cfi.errors
errors
Definition: debug_messages_cfi.py:54