TVector3 fFM[28]; //array of global coordinates for 28 fiducial marks Int_t sNch, oNch; // survey and offline chamber's number TGeoHMatrix GetResSurvAlign(Int_t survNch, Int_t& offNch); void SurveyToAlignHmpid(const char* filename="Survey_781282_HMPID.txt"){ // Open file with AliSurveyPoints for the 7 HMPID chambers // Produce the corresponding alignment objects AliSurveyObj *so = new AliSurveyObj(); Int_t size = so->GetEntries(); printf("-> %d\n", size); so->FillFromLocalFile(filename); size = so->GetEntries(); printf("--> %d\n", size); TObjArray *points = so->GetData(); // We retrieve and open the ideal geometry AliCDBManager* cdbman = AliCDBManager::Instance(); if(!cdbman->IsDefaultStorageSet()){ cdbman->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); }else{ cdbman->SetSpecificStorage("GRP/Geometry/*","local://$ALICE_ROOT/OCDB"); } cdbman->SetRun(0); AliCDBEntry* cdbe = (AliCDBEntry*) cdbman->Get("GRP/Geometry/Data"); for (Int_t i = 0; i < points->GetEntries(); ++i) { AliSurveyPoint *p=(AliSurveyPoint *) points->At(i); fFM[i].SetXYZ(p->GetX()*100.,p->GetY()*100.,p->GetZ()*100.); } TString chbasename("/HMPID/Chamber"); for(Int_t sNch=0; sNch<7; sNch++){ TGeoHMatrix mtx = GetResSurvAlign(sNch,oNch); //get global matrix from survey points TString chsymname = chbasename; chsymname += oNch; printf("getting global matrix for the alignable volume %s\n",chsymname.Data()); TGeoHMatrix *gm = AliGeomManager::GetMatrix(chsymname.Data()); if(!gm){ printf("unable to get global matrix for the alignable volume %s\n",chsymname.Data()); continue; } TGeoHMatrix gdelta = gm->Inverse(); gdelta.MultiplyLeft(&mtx); //gdelta.Print(); AliAlignObjMatrix* mobj = new AliAlignObjMatrix(AliGeomManager::SymName(AliGeomManager::LayerToVolUID(AliGeomManager::kHMPID,oNch)), AliGeomManager::LayerToVolUID(AliGeomManager::kHMPID,oNch),gdelta,kTRUE); /* cout<<"\n************* obtained AliAlignObjMatrix************\n"; mobj->Print(); cout<<""<4) { // first vector on the plane of the fiducial marks for(Int_t i=0;i<3;i++){ ab[i] = ngB[i] - ngA[i]; } // second vector on the plane of the fiducial marks for(Int_t i=0;i<3;i++){ bc[i] = ngC[i] - ngB[i]; } } else{ // first vector on the plane of the fiducial marks for(Int_t i=0;i<3;i++){ ab[i] = ngB[i] - ngA[i]; } // second vector on the plane of the fiducial marks for(Int_t i=0;i<3;i++){ bc[i] = ngD[i] - ngB[i]; } } // vector normal to the plane of the fiducial marks obtained // as cross product of the two vectors on the plane d0^d1 n[0] = ab[1] * bc[2] - ab[2] * bc[1]; n[1] = ab[2] * bc[0] - ab[0] * bc[2]; n[2] = ab[0] * bc[1] - ab[1] * bc[0]; Double_t sizen = TMath::Sqrt( n[0]*n[0] + n[1]*n[1] + n[2]*n[2] ); if(sizen>1.e-8){ s = Double_t(1.)/sizen ; //normalization factor }else{ return 0; } // plane expressed in the hessian normal form, see: // http://mathworld.wolfram.com/HessianNormalForm.html // the first three are the coordinates of the orthonormal vector // the fourth coordinate is equal to the distance from the origin for(i=0;i<3;i++){ plane[i] = n[i] * s; } plane[3] = -( plane[0] * ngA[0] + plane[1] * ngA[1] + plane[2] * ngA[2] ); cout<<"normal to plane and distance from IP: "<4){ for(i=0;i<3;i++){ md[i] = (ngA[i] + ngC[i]) * 0.5;//modified!!!!!!!!! } } else { for(i=0;i<3;i++){ md[i] = (ngA[i] + ngD[i]) * 0.5;//modified!!!!!!!!! } } cout<<"The center of the box from Survey data: "<1.e-8){ for(i=0;i<3;i++){ ab[i] /= sx; } cout<<"x "<1.e-8){ for(i=0;i<3;i++){ bc[i] /= sy; } cout<<"y "<