+//_____________________________________________________________________________
+void AliTRDalignment::ReadSurveyReport(AliSurveyObj *so)
+{
+ //
+ // Read survey report and store the numbers in fSurveyX, fSurveyY, fSurveyZ,
+ // and fSurveyE. Store the survey info in the fComment.
+ // Each supermodule has 8 survey points. The point names look like
+ // TRD_sm08ah0 and have the following meaning.
+ //
+ // sm00..17 mean supermodule 0 through 17, following the phi.
+ // Supermodule 00 is between phi=0 and phi=20 degrees.
+ //
+ // a or c denotes the anticlockwise and clockwise end of the supermodule
+ // in z. Clockwise end is where z is negative and where the muon arm sits.
+ //
+ // l or h denote low radius and high radius holes
+ //
+ // 0 or 1 denote the hole at smaller and at larger phi, respectively.
+ //
+
+ // read and process the data from the survey object
+
+ Int_t size = so->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 .........."<<title<<std::endl;
+ std::cout<<"date ..........."<<date<<std::endl;
+ std::cout<<"subdetector ...."<<subdetector<<std::endl;
+ std::cout<<"url ............"<<url<<std::endl;
+ std::cout<<"version ........"<<version<<std::endl;
+ std::cout<<"observations ..."<<observations<<std::endl;
+ std::cout<<"system ........."<<system<<std::endl;
+ std::cout<<"units .........."<<units<<std::endl;
+
+ if (!subdetector.Contains("TRD")) {
+ AliWarning(Form("Not a TRD survey file, subdetector = %s",subdetector.Data()));
+ return;
+ }
+ double tocm = 0; // we want to have it in cm
+ if (units.Contains("mm")) tocm = 0.1;
+ else if (units.Contains("cm")) tocm = 1.0;
+ else if (units.Contains("m")) tocm = 100.0;
+ else if (units.Contains("pc")) tocm = 3.24078e-15;
+ else {
+ AliError(Form("unexpected units: %s",units.Data()));
+ return;
+ }
+ if (!system.Contains("ALICEPH")) {
+ AliError(Form("wrong system: %s, should be ALICEPH",system.Data()));
+ return;
+ }
+
+ // for every survey point, decode the point name and store the numbers in
+ // the right place in the arrays fSurveyX etc.
+
+ TObjArray *points = so->GetData();
+ for (int i = 0; i<points->GetEntries(); 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 "<<pna<<" "
+ <<fSurveyX[i][j][k][l]<<" "
+ <<fSurveyY[i][j][k][l]<<" "
+ <<fSurveyZ[i][j][k][l]<<" "
+ <<fSurveyEX[i][j][k][l]<<" "
+ <<fSurveyEY[i][j][k][l]<<" "
+ <<fSurveyEZ[i][j][k][l]<<" "<<std::endl;
+ } else AliError(Form("cannot decode point name: %s",pna.Data()));
+ }
+
+ TString info = "Survey "+title+" "+date+" "+url+" "+report+" "+version+" "+observations;
+ info.ReplaceAll("\r","");
+ fComment.SetString(info.Data());
+}
+