CMS 3D CMS Logo

DTSurvey Class Reference

Implements a set of measurements given by survey, tipically a wheel. More...

#include <Alignment/SurveyAnalysis/interface/DTSurvey.h>

List of all members.

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
2008/04/11 05:08:01
Revision
1.4
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 11 of file DTSurvey.cc.

References FillWheelInfo(), nameOfChamberInfoFile, and nameOfWheelInfoFile.

00011                                                                            {
00012   
00013   nameOfWheelInfoFile = Wheel;
00014   nameOfChamberInfoFile = Chambers;
00015   id = n;   
00016   
00017   FillWheelInfo();
00018 }

DTSurvey::~DTSurvey (  ) 

Definition at line 21 of file DTSurvey.cc.

References chambers.

00021                     {
00022   delete [] chambers;
00023 }


Member Function Documentation

void DTSurvey::CalculateChambers (  ) 

Definition at line 26 of file DTSurvey.cc.

References chambers, and DTSurveyChamber::compute().

Referenced by DTSurveyConvert::analyze().

00026                                  {
00027   for(int stationCounter = 0; stationCounter < 4; stationCounter++) {
00028     for(int sectorCounter = 0; sectorCounter < 14; sectorCounter++) {
00029       if(chambers[stationCounter][sectorCounter]->getNumberPoints() > 2) {
00030         chambers[stationCounter][sectorCounter]->compute();
00031       }
00032     }
00033   }
00034 }

void DTSurvey::FillWheelInfo (  )  [private]

Definition at line 109 of file DTSurvey.cc.

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

Referenced by DTSurvey().

00109                              {
00110 
00111   std::ifstream wheeltowheel(nameOfWheelInfoFile.c_str());
00112   float zOffset, deltax, deltay, deltaz, alpha, beta, gamma;
00113   wheeltowheel >> zOffset >> deltax >> deltay >> deltaz >> alpha >> beta >> gamma;
00114   wheeltowheel.close();
00115   
00116   OffsetZ = zOffset;
00117 
00118   //Build displacement vector
00119   delta.ResizeTo(3,1);
00120   delta(0,0) = deltax/10.0;
00121   delta(1,0) = deltay/10.0;
00122   delta(2,0) = deltaz/10.0;
00123   
00124   //Build rotation matrix
00125   Rot.ResizeTo(3,3);
00126   TMatrixD alpha_m(3,3);
00127   TMatrixD beta_m(3,3);
00128   TMatrixD gamma_m(3,3);
00129   alpha_m.Zero();
00130   beta_m.Zero();
00131   gamma_m.Zero();
00132   for(int k = 0; k < 3; k++) {
00133     alpha_m(k,k) = 1.0;
00134     beta_m(k,k) = 1.0;
00135     gamma_m(k,k) = 1.0;
00136   }
00137   alpha /= 1000.0; //New scale: angles in radians
00138   beta /= 1000.0;
00139   gamma /= 1000.0;
00140   alpha_m(1,1) = cos(alpha);
00141   alpha_m(1,2) = sin(alpha);
00142   alpha_m(2,1) = -sin(alpha);
00143   alpha_m(2,2) = cos(alpha);
00144   beta_m(0,0) = cos(beta);
00145   beta_m(0,2) = -sin(beta);
00146   beta_m(2,0) = sin(beta);
00147   beta_m(2,2) = cos(beta);
00148   gamma_m(0,0) = cos(gamma);
00149   gamma_m(0,1) = sin(gamma);
00150   gamma_m(1,0) = -sin(gamma);
00151   gamma_m(1,1) = cos(gamma);
00152   Rot = alpha_m*beta_m*gamma_m;
00153 }

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

Definition at line 37 of file DTSurvey.cc.

References chambers.

Referenced by operator<<().

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

int DTSurvey::getId (  )  const [inline]

Definition at line 36 of file DTSurvey.h.

References id.

00036 { return id; }

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

Definition at line 39 of file DTSurvey.cc.

References DTSurveyChamber::addPoint(), chambers, code, GenMuonPlsPt100GeV_cfg::cout, delta, diff, lat::endl(), HLT_VtxMuL3::errors, file, nameOfChamberInfoFile, OffsetZ, r, DetId::rawId(), Rot, GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by DTSurveyConvert::analyze().

00039                                                        {
00040   
00041   //Create the chambers
00042   chambers = new DTSurveyChamber ** [4];
00043   for (int cont_stat = 0; cont_stat < 4; cont_stat++) {
00044     chambers[cont_stat] = new DTSurveyChamber * [14];
00045     for(int cont_sect = 0; cont_sect < 14; cont_sect++) {
00046       DTChamberId mId(id, cont_stat+1, cont_sect+1);
00047       chambers[cont_stat][cont_sect] = new DTSurveyChamber(id, cont_stat+1, cont_sect+1, mId.rawId());
00048     }
00049   }
00050 
00051   std::cout << nameOfChamberInfoFile << std::endl;
00052   std::ifstream file(nameOfChamberInfoFile.c_str());
00053   while(!file.eof()) {
00054     int code, station, sector;
00055     double x, y, z, rms, dx, dy, dz;
00056     file >> code >> x >> y >> z >> rms >> dx >> dy >> dz;
00057     if(file.eof()) break;
00058     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; 
00059     station = code/10000 - 1;
00060     sector = (code-(station+1)*10000)/100 - 1;
00061     //De momento vamos a actuar como si no hubiera otra forma de resolver esto
00062     TMatrixD r(3,1);
00063     r(0,0) = x; r(1,0) = y;r(2,0) = z+OffsetZ;
00064     TMatrixD disp(3,1);
00065     disp(0,0) = dx; disp(1,0) = dy; disp(2,0) = dz;
00066     TMatrixD rp = Rot*r-delta;
00067     disp = disp-r+rp;
00068     
00069     GlobalPoint rg(r(0,0), r(1,0), r(2,0));
00070     GlobalPoint rt(r(0,0)-disp(0,0), r(1,0)-disp(1,0), r(2,0)-disp(2,0));
00071     DTChamberId mId(id, station+1, sector+1);
00072     const DTChamber *mChamber = static_cast<const DTChamber *>(pDD->idToDet(mId));
00073     LocalPoint rl = mChamber->toLocal(rg);
00074     LocalPoint rtl = mChamber->toLocal(rt);
00075     TMatrixD rLocal(3,1);
00076     rLocal(0,0) = rl.x(); rLocal(1,0) = rl.y(); rLocal(2,0) = rl.z();
00077     TMatrixD rTeo(3,1);
00078     rTeo(0,0) = rtl.x(); rTeo(1,0) = rtl.y(); rTeo(2,0) = rtl.z();
00079     TMatrixD diff = rLocal-rTeo;
00080     TMatrixD errors(3,1);
00081     errors(0,0) = rms; errors(1,0) = rms; errors(2,0) = rms;
00082     chambers[station][sector]->addPoint(code, rLocal, diff, errors);
00083   }
00084   file.close();
00085 }


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

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:19:07 2009 for CMSSW by  doxygen 1.5.4