From afba1460e79990c60a0ff584928869181d3bab31 Mon Sep 17 00:00:00 2001 From: cblume Date: Tue, 15 Jan 2008 17:38:10 +0000 Subject: [PATCH] Introduction of AliSurveyObj --- TRD/AliTRDalignment.cxx | 169 ++++++++++++++++++++++++++++++++++------ TRD/AliTRDalignment.h | 8 +- 2 files changed, 152 insertions(+), 25 deletions(-) diff --git a/TRD/AliTRDalignment.cxx b/TRD/AliTRDalignment.cxx index 6b86afe9a2e..a3820e5061b 100644 --- a/TRD/AliTRDalignment.cxx +++ b/TRD/AliTRDalignment.cxx @@ -67,7 +67,7 @@ #include #include -#include +//#include #include "TMath.h" #include "TFile.h" @@ -86,6 +86,8 @@ #include "AliCDBMetaData.h" #include "AliCDBEntry.h" #include "AliCDBId.h" +#include "AliSurveyObj.h" +#include "AliSurveyPoint.h" #include "AliTRDalignment.h" @@ -109,7 +111,9 @@ AliTRDalignment::AliTRDalignment() fSurveyX[i][j][k][l] = 0.0; fSurveyY[i][j][k][l] = 0.0; fSurveyZ[i][j][k][l] = 0.0; - fSurveyE[i][j][k][l] = 0.0; + fSurveyEX[i][j][k][l] = 0.0; + fSurveyEY[i][j][k][l] = 0.0; + fSurveyEZ[i][j][k][l] = 0.0; } // Initialize the nominal positions of the survey points @@ -162,7 +166,9 @@ AliTRDalignment::AliTRDalignment(const AliTRDalignment& source) fSurveyX[i][j][k][l] = source.fSurveyX[i][j][k][l]; fSurveyY[i][j][k][l] = source.fSurveyY[i][j][k][l]; fSurveyZ[i][j][k][l] = source.fSurveyZ[i][j][k][l]; - fSurveyE[i][j][k][l] = source.fSurveyE[i][j][k][l]; + fSurveyEX[i][j][k][l] = source.fSurveyEX[i][j][k][l]; + fSurveyEY[i][j][k][l] = source.fSurveyEY[i][j][k][l]; + fSurveyEZ[i][j][k][l] = source.fSurveyEZ[i][j][k][l]; } for (int j=0; j<2; j++) for (int k=0; k<2; k++) for (int l=0; l<2; l++) { fSurveyX0[j][k][l] = source.fSurveyX0[j][k][l]; @@ -186,7 +192,9 @@ AliTRDalignment& AliTRDalignment::operator=(const AliTRDalignment &source) fSurveyX[i][j][k][l] = source.fSurveyX[i][j][k][l]; fSurveyY[i][j][k][l] = source.fSurveyY[i][j][k][l]; fSurveyZ[i][j][k][l] = source.fSurveyZ[i][j][k][l]; - fSurveyE[i][j][k][l] = source.fSurveyE[i][j][k][l]; + fSurveyEX[i][j][k][l] = source.fSurveyEX[i][j][k][l]; + fSurveyEY[i][j][k][l] = source.fSurveyEY[i][j][k][l]; + fSurveyEZ[i][j][k][l] = source.fSurveyEZ[i][j][k][l]; } for (int j=0; j<2; j++) for (int k=0; k<2; k++) for (int l=0; l<2; l++) { fSurveyX0[j][k][l] = source.fSurveyX0[j][k][l]; @@ -621,6 +629,27 @@ void AliTRDalignment::ReadDB(char *db, char *path, int run } } +//_____________________________________________________________________________ +Bool_t AliTRDalignment::DecodeSurveyPointName(TString pna, Int_t &sm, Int_t &iz, + Int_t &ir, Int_t &iphi) { + // decode the survey point name and extract the sm, z, r and phi indices + + if (pna(0,6)!="TRD_sm") { + AliError(Form("unexpected point name: %s",pna.Data())); + return kFALSE; + } + sm = atoi(pna(6,2).Data()); // supermodule number + iz = -1; + if (pna(8) == 'a') iz=0; // anticlockwise, positive z + if (pna(8) == 'c') iz=1; // clockwise, negative z + ir = -1; + if (pna(9) == 'l') ir=0; // low radius + if (pna(9) == 'h') ir=1; // high radius + iphi = atoi(pna(10,0).Data()); // phi within supermodule + if (sm>=0 && sm<18 && iz>=0 && iz<2 && ir>=0 && ir<2 && iphi>=0 && iphi<2) return kTRUE; + AliError(Form("cannot decode point name: %s",pna.Data())); + return kFALSE; +} //_____________________________________________________________________________ void AliTRDalignment::ReadSurveyReport(char *filename) { @@ -703,32 +732,28 @@ void AliTRDalignment::ReadSurveyReport(char *filename) while (1) { TString pna; // point name - char type; + char type, target; double x,y,z,precision; - in >> pna >> x >> y >> z >> type >> precision; + + in >> pna >> x >> y >> z >> type >> target >> precision; if (in.fail()) break; - if (pna(0,6)!="TRD_sm") { - AliError(Form("unexpected point name: %s",pna.Data())); - break; - } - int i = atoi(pna(6,0).Data()); // supermodule number - int j = -1; - if (pna(8) == 'a') j=0; // anticlockwise, positive z - if (pna(8) == 'c') j=1; // clockwise, negative z - int k = -1; - if (pna(9) == 'l') k=0; // low radius - if (pna(9) == 'h') k=1; // high radius - int l = atoi(pna(10,0).Data()); // phi within supermodule - if (i>=0 && i<18 && j>=0 && j<2 && k>=0 && k<2 && l>=0 && l<2) { + Int_t i,j,k,l; + if (DecodeSurveyPointName(pna,i,j,k,l)) { fSurveyX[i][j][k][l] = tocm*x; fSurveyY[i][j][k][l] = tocm*y; fSurveyZ[i][j][k][l] = tocm*z; - fSurveyE[i][j][k][l] = precision/10; // "precision" is supposed to be in mm + fSurveyEX[i][j][k][l] = precision/10; // "precision" is supposed to be in mm + fSurveyEY[i][j][k][l] = precision/10; // "precision" is supposed to be in mm + fSurveyEZ[i][j][k][l] = precision/10; // "precision" is supposed to be in mm + // if, at some point, separate precision numbers for x,y,z show up in the + // survey reports the function will fail here std::cout << "decoded "<GetEntries(); + printf("-> %d\n", size); + + TString title = so->GetReportTitle(); + TString date = so->GetReportDate(); + TString subdetector = so->GetDetector(); + TString url = so->GetURL(); + TString report = so->GetReportNumber(); + TString version = so->GetReportVersion(); + TString observations = so->GetObservations(); + TString system = so->GetCoordSys(); + TString units = so->GetUnits(); + + // check what we found so far (watch out, they have \r at the end) + + std::cout<<"title .........."<GetData(); + for (int i = 0; iGetEntries(); i++) { + AliSurveyPoint *po = (AliSurveyPoint *) points->At(i); + TString pna = po->GetPointName(); + Int_t i,j,k,l; + if (DecodeSurveyPointName(pna,i,j,k,l)) { + fSurveyX[i][j][k][l] = tocm*po->GetX(); + fSurveyY[i][j][k][l] = tocm*po->GetY(); + fSurveyZ[i][j][k][l] = tocm*po->GetZ(); + fSurveyEX[i][j][k][l] = po->GetPrecisionX()/10; // "precision" is supposed to be in mm + fSurveyEY[i][j][k][l] = po->GetPrecisionY()/10; + fSurveyEZ[i][j][k][l] = po->GetPrecisionZ()/10; + std::cout << "decoded "<MasterToLocal(master,local); double dx = local[0]-fSurveyX0[j][k][l]; double dy = local[1]-fSurveyY0[j][k][l]; double dz = local[2]-fSurveyZ0[j][k][l]; - chi2 += (dx*dx+dy*dy+dz*dz)/fSurveyE[i][j][k][l]/fSurveyE[i][j][k][l]; + chi2 += dx*dx/fSurveyEX[i][j][k][l]/fSurveyEX[i][j][k][l]; + chi2 += dy*dy/fSurveyEY[i][j][k][l]/fSurveyEY[i][j][k][l]; + chi2 += dz*dz/fSurveyEZ[i][j][k][l]/fSurveyEZ[i][j][k][l]; printf("local survey %3d %3d %3d %3d %12.3f %12.3f %12.3f\n",i,j,k,l,local[0],local[1],local[2]); printf("local ideal %12.3f %12.3f %12.3f\n",fSurveyX0[j][k][l], fSurveyY0[j][k][l],fSurveyZ0[j][k][l]); diff --git a/TRD/AliTRDalignment.h b/TRD/AliTRDalignment.h index 4b04994b939..05ea8495281 100644 --- a/TRD/AliTRDalignment.h +++ b/TRD/AliTRDalignment.h @@ -16,8 +16,8 @@ #include #include #include -#include #include +class AliSurveyObj; class AliTRDalignment : public TObject { @@ -66,7 +66,9 @@ class AliTRDalignment : public TObject { void ReadRoot(char *filename); // read from root file void ReadDB(char *filename); // read from DB file void ReadDB(char *db, char *path, int run, int version=-1, int subversion=-1); + Bool_t DecodeSurveyPointName(TString pna, Int_t &sm, Int_t &iz,Int_t &ir, Int_t &iphi); void ReadSurveyReport(char *filename); // read from survey report + void ReadSurveyReport(AliSurveyObj *so); // read from survey object void ReadAny(char *filename); // read from any kind of file // writing on file @@ -134,7 +136,9 @@ class AliTRDalignment : public TObject { double fSurveyX[18][2][2][2]; // supermodule survey point X double fSurveyY[18][2][2][2]; // supermodule survey point Y double fSurveyZ[18][2][2][2]; // supermodule survey point Z - double fSurveyE[18][2][2][2]; // supermodule survey point error + double fSurveyEX[18][2][2][2]; // supermodule survey point X error + double fSurveyEY[18][2][2][2]; // supermodule survey point Y error + double fSurveyEZ[18][2][2][2]; // supermodule survey point Z error double fSurveyX0[2][2][2]; // ideal X position of the survey marks double fSurveyY0[2][2][2]; // ideal Y position of the survey marks double fSurveyZ0[2][2][2]; // ideal Z position of the survey marks -- 2.39.3