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 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 24 of file DTSurvey.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file DTSurvey.cc.

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

12  {
13 
14  nameOfWheelInfoFile = Wheel;
15  nameOfChamberInfoFile = Chambers;
16  id = n;
17 
18  FillWheelInfo();
19 }
std::string nameOfWheelInfoFile
Definition: DTSurvey.h:43
std::string nameOfChamberInfoFile
Definition: DTSurvey.h:43
void FillWheelInfo()
Definition: DTSurvey.cc:110
DTSurvey::~DTSurvey ( )

Definition at line 22 of file DTSurvey.cc.

References chambers.

22  {
23  delete [] chambers;
24 }
DTSurveyChamber *** chambers
Definition: DTSurvey.h:51

Member Function Documentation

void DTSurvey::CalculateChambers ( )

Definition at line 27 of file DTSurvey.cc.

References chambers, and DTSurveyChamber::compute().

Referenced by DTSurveyConvert::analyze().

27  {
28  for(int stationCounter = 0; stationCounter < 4; stationCounter++) {
29  for(int sectorCounter = 0; sectorCounter < 14; sectorCounter++) {
30  if(chambers[stationCounter][sectorCounter]->getNumberPoints() > 2) {
31  chambers[stationCounter][sectorCounter]->compute();
32  }
33  }
34  }
35 }
DTSurveyChamber *** chambers
Definition: DTSurvey.h:51
void DTSurvey::FillWheelInfo ( )
private

Definition at line 110 of file DTSurvey.cc.

References alpha, beta, funct::cos(), delta, gen::k, nameOfWheelInfoFile, OffsetZ, Rot, and funct::sin().

Referenced by DTSurvey().

110  {
111 
112  std::ifstream wheeltowheel(nameOfWheelInfoFile.c_str());
113  float zOffset, deltax, deltay, deltaz, alpha, beta, gamma;
114  wheeltowheel >> zOffset >> deltax >> deltay >> deltaz >> alpha >> beta >> gamma;
115  wheeltowheel.close();
116 
117  OffsetZ = zOffset;
118 
119  //Build displacement vector
120  delta.ResizeTo(3,1);
121  delta(0,0) = deltax/10.0;
122  delta(1,0) = deltay/10.0;
123  delta(2,0) = deltaz/10.0;
124 
125  //Build rotation matrix
126  Rot.ResizeTo(3,3);
127  TMatrixD alpha_m(3,3);
128  TMatrixD beta_m(3,3);
129  TMatrixD gamma_m(3,3);
130  alpha_m.Zero();
131  beta_m.Zero();
132  gamma_m.Zero();
133  for(int k = 0; k < 3; k++) {
134  alpha_m(k,k) = 1.0;
135  beta_m(k,k) = 1.0;
136  gamma_m(k,k) = 1.0;
137  }
138  alpha /= 1000.0; //New scale: angles in radians
139  beta /= 1000.0;
140  gamma /= 1000.0;
141  alpha_m(1,1) = cos(alpha);
142  alpha_m(1,2) = sin(alpha);
143  alpha_m(2,1) = -sin(alpha);
144  alpha_m(2,2) = cos(alpha);
145  beta_m(0,0) = cos(beta);
146  beta_m(0,2) = -sin(beta);
147  beta_m(2,0) = sin(beta);
148  beta_m(2,2) = cos(beta);
149  gamma_m(0,0) = cos(gamma);
150  gamma_m(0,1) = sin(gamma);
151  gamma_m(1,0) = -sin(gamma);
152  gamma_m(1,1) = cos(gamma);
153  Rot = alpha_m*beta_m*gamma_m;
154 }
const double beta
float alpha
Definition: AMPTWrapper.h:95
TMatrixD Rot
Definition: DTSurvey.h:49
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::string nameOfWheelInfoFile
Definition: DTSurvey.h:43
TMatrixD delta
Definition: DTSurvey.h:48
float OffsetZ
Definition: DTSurvey.h:47
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int k[5][pyjets_maxn]
const DTSurveyChamber * DTSurvey::getChamber ( int  station,
int  sector 
) const

Definition at line 38 of file DTSurvey.cc.

References chambers, and relativeConstraints::station.

Referenced by operator<<().

38 {return chambers[station][sector];}
DTSurveyChamber *** chambers
Definition: DTSurvey.h:51
int DTSurvey::getId ( ) const
inline

Definition at line 36 of file DTSurvey.h.

References id.

36 { return id; }
int id
Definition: DTSurvey.h:44
void DTSurvey::ReadChambers ( edm::ESHandle< DTGeometry pDD)

Definition at line 40 of file DTSurvey.cc.

References DTSurveyChamber::addPoint(), chambers, gather_cfg::cout, delta, diffTreeTool::diff, benchmark_cfg::errors, mergeVDriftHistosByStation::file, nameOfChamberInfoFile, OffsetZ, csvReporter::r, DetId::rawId(), plotscripts::rms(), Rot, relativeConstraints::station, GeomDet::toLocal(), x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by DTSurveyConvert::analyze().

40  {
41 
42  //Create the chambers
43  chambers = new DTSurveyChamber ** [4];
44  for (int cont_stat = 0; cont_stat < 4; cont_stat++) {
45  chambers[cont_stat] = new DTSurveyChamber * [14];
46  for(int cont_sect = 0; cont_sect < 14; cont_sect++) {
47  DTChamberId mId(id, cont_stat+1, cont_sect+1);
48  chambers[cont_stat][cont_sect] = new DTSurveyChamber(id, cont_stat+1, cont_sect+1, mId.rawId());
49  }
50  }
51 
52  std::cout << nameOfChamberInfoFile << std::endl;
53  std::ifstream file(nameOfChamberInfoFile.c_str());
54  while(!file.eof()) {
55  int code, station, sector;
56  double x, y, z, rms, dx, dy, dz;
57  file >> code >> x >> y >> z >> rms >> dx >> dy >> dz;
58  if(file.eof()) break;
59  x = x/10.0; y=y/10.0; z=z/10.0; dx=dx/10.0; dy=dy/10.0; dz=dz/10.0;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; r(1,0) = y;r(2,0) = z+OffsetZ;
65  TMatrixD disp(3,1);
66  disp(0,0) = dx; disp(1,0) = dy; disp(2,0) = dz;
67  TMatrixD rp = Rot*r-delta;
68  disp = disp-r+rp;
69 
70  GlobalPoint rg(r(0,0), r(1,0), r(2,0));
71  GlobalPoint rt(r(0,0)-disp(0,0), r(1,0)-disp(1,0), r(2,0)-disp(2,0));
72  DTChamberId mId(id, station+1, sector+1);
73  const DTChamber *mChamber = static_cast<const DTChamber *>(pDD->idToDet(mId));
74  LocalPoint rl = mChamber->toLocal(rg);
75  LocalPoint rtl = mChamber->toLocal(rt);
76  TMatrixD rLocal(3,1);
77  rLocal(0,0) = rl.x(); rLocal(1,0) = rl.y(); rLocal(2,0) = rl.z();
78  TMatrixD rTeo(3,1);
79  rTeo(0,0) = rtl.x(); rTeo(1,0) = rtl.y(); rTeo(2,0) = rtl.z();
80  TMatrixD diff = rLocal-rTeo;
81  TMatrixD errors(3,1);
82  errors(0,0) = rms; errors(1,0) = rms; errors(2,0) = rms;
83  chambers[station][sector]->addPoint(code, rLocal, diff, errors);
84  }
85  file.close();
86 }
TMatrixD Rot
Definition: DTSurvey.h:49
T y() const
Definition: PV3DBase.h:57
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:64
double double double z
TMatrixD delta
Definition: DTSurvey.h:48
float OffsetZ
Definition: DTSurvey.h:47
T z() const
Definition: PV3DBase.h:58
DTSurveyChamber *** chambers
Definition: DTSurvey.h:51
void addPoint(int, const TMatrixD &, const TMatrixD &, const TMatrixD &)
std::string nameOfChamberInfoFile
Definition: DTSurvey.h:43
tuple cout
Definition: gather_cfg.py:41
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:56

Member Data Documentation

DTSurveyChamber*** DTSurvey::chambers
private

Definition at line 51 of file DTSurvey.h.

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

TMatrixD DTSurvey::delta
private

Definition at line 48 of file DTSurvey.h.

Referenced by FillWheelInfo(), and ReadChambers().

int DTSurvey::id
private

Definition at line 44 of file DTSurvey.h.

Referenced by getId(), and NodeCut.MatchId::match().

std::string DTSurvey::nameOfChamberInfoFile
private

Definition at line 43 of file DTSurvey.h.

Referenced by DTSurvey(), and ReadChambers().

std::string DTSurvey::nameOfWheelInfoFile
private

Definition at line 43 of file DTSurvey.h.

Referenced by DTSurvey(), and FillWheelInfo().

float DTSurvey::OffsetZ
private

Definition at line 47 of file DTSurvey.h.

Referenced by FillWheelInfo(), and ReadChambers().

TMatrixD DTSurvey::Rot
private

Definition at line 49 of file DTSurvey.h.

Referenced by FillWheelInfo(), and ReadChambers().