CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTSurvey Class Reference

#include <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 12 of file DTSurvey.cc.

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

                                                                           {
  
  nameOfWheelInfoFile = Wheel;
  nameOfChamberInfoFile = Chambers;
  id = n;   
  
  FillWheelInfo();
}
DTSurvey::~DTSurvey ( )

Definition at line 22 of file DTSurvey.cc.

References chambers.

                    {
  delete [] chambers;
}

Member Function Documentation

void DTSurvey::CalculateChambers ( )

Definition at line 27 of file DTSurvey.cc.

References chambers, and DTSurveyChamber::compute().

Referenced by DTSurveyConvert::analyze().

                                 {
  for(int stationCounter = 0; stationCounter < 4; stationCounter++) {
    for(int sectorCounter = 0; sectorCounter < 14; sectorCounter++) {
      if(chambers[stationCounter][sectorCounter]->getNumberPoints() > 2) {
        chambers[stationCounter][sectorCounter]->compute();
      }
    }
  }
}
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().

                             {

  std::ifstream wheeltowheel(nameOfWheelInfoFile.c_str());
  float zOffset, deltax, deltay, deltaz, alpha, beta, gamma;
  wheeltowheel >> zOffset >> deltax >> deltay >> deltaz >> alpha >> beta >> gamma;
  wheeltowheel.close();
  
  OffsetZ = zOffset;

  //Build displacement vector
  delta.ResizeTo(3,1);
  delta(0,0) = deltax/10.0;
  delta(1,0) = deltay/10.0;
  delta(2,0) = deltaz/10.0;
  
  //Build rotation matrix
  Rot.ResizeTo(3,3);
  TMatrixD alpha_m(3,3);
  TMatrixD beta_m(3,3);
  TMatrixD gamma_m(3,3);
  alpha_m.Zero();
  beta_m.Zero();
  gamma_m.Zero();
  for(int k = 0; k < 3; k++) {
    alpha_m(k,k) = 1.0;
    beta_m(k,k) = 1.0;
    gamma_m(k,k) = 1.0;
  }
  alpha /= 1000.0; //New scale: angles in radians
  beta /= 1000.0;
  gamma /= 1000.0;
  alpha_m(1,1) = cos(alpha);
  alpha_m(1,2) = sin(alpha);
  alpha_m(2,1) = -sin(alpha);
  alpha_m(2,2) = cos(alpha);
  beta_m(0,0) = cos(beta);
  beta_m(0,2) = -sin(beta);
  beta_m(2,0) = sin(beta);
  beta_m(2,2) = cos(beta);
  gamma_m(0,0) = cos(gamma);
  gamma_m(0,1) = sin(gamma);
  gamma_m(1,0) = -sin(gamma);
  gamma_m(1,1) = cos(gamma);
  Rot = alpha_m*beta_m*gamma_m;
}
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<<().

{return chambers[station][sector];}
int DTSurvey::getId ( ) const [inline]

Definition at line 36 of file DTSurvey.h.

References id.

{ return id; }
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(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by DTSurveyConvert::analyze().

                                                       {
  
  //Create the chambers
  chambers = new DTSurveyChamber ** [4];
  for (int cont_stat = 0; cont_stat < 4; cont_stat++) {
    chambers[cont_stat] = new DTSurveyChamber * [14];
    for(int cont_sect = 0; cont_sect < 14; cont_sect++) {
      DTChamberId mId(id, cont_stat+1, cont_sect+1);
      chambers[cont_stat][cont_sect] = new DTSurveyChamber(id, cont_stat+1, cont_sect+1, mId.rawId());
    }
  }

  std::cout << nameOfChamberInfoFile << std::endl;
  std::ifstream file(nameOfChamberInfoFile.c_str());
  while(!file.eof()) {
    int code, station, sector;
    double x, y, z, rms, dx, dy, dz;
    file >> code >> x >> y >> z >> rms >> dx >> dy >> dz;
    if(file.eof()) break;
    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; 
    station = code/10000 - 1;
    sector = (code-(station+1)*10000)/100 - 1;
    //De momento vamos a actuar como si no hubiera otra forma de resolver esto
    TMatrixD r(3,1);
    r(0,0) = x; r(1,0) = y;r(2,0) = z+OffsetZ;
    TMatrixD disp(3,1);
    disp(0,0) = dx; disp(1,0) = dy; disp(2,0) = dz;
    TMatrixD rp = Rot*r-delta;
    disp = disp-r+rp;
    
    GlobalPoint rg(r(0,0), r(1,0), r(2,0));
    GlobalPoint rt(r(0,0)-disp(0,0), r(1,0)-disp(1,0), r(2,0)-disp(2,0));
    DTChamberId mId(id, station+1, sector+1);
    const DTChamber *mChamber = static_cast<const DTChamber *>(pDD->idToDet(mId));
    LocalPoint rl = mChamber->toLocal(rg);
    LocalPoint rtl = mChamber->toLocal(rt);
    TMatrixD rLocal(3,1);
    rLocal(0,0) = rl.x(); rLocal(1,0) = rl.y(); rLocal(2,0) = rl.z();
    TMatrixD rTeo(3,1);
    rTeo(0,0) = rtl.x(); rTeo(1,0) = rtl.y(); rTeo(2,0) = rtl.z();
    TMatrixD diff = rLocal-rTeo;
    TMatrixD errors(3,1);
    errors(0,0) = rms; errors(1,0) = rms; errors(2,0) = rms;
    chambers[station][sector]->addPoint(code, rLocal, diff, errors);
  }
  file.close();
}

Member Data Documentation

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