/*
$Log$
+Revision 1.16 2007/05/15 16:25:44 cvetan
+Moving the alignment-related static methods from AliAlignObj to the new geometry steering class AliGeomManager (macro from Raffaele)
+
+Revision 1.15 2007/05/03 09:25:10 decaro
+Coding convention: RN13 violation -> suppression
+
+Revision 1.14 2007/04/18 14:49:54 arcelli
+Some code cleanup, added more debug info
+
+Revision 1.13 2007/04/17 16:38:36 arcelli
+Include Methods to derive TOF AlignObjs from Survey Data
+
Revision 1.12 2007/02/28 18:09:23 arcelli
Add protection against failed retrieval of the CDB cal object
const Double_t AliTOFAlignment::fgkYsizeTOF = 29.0; // y size of the TOF ext. volume, cm
const Double_t AliTOFAlignment::fgkZsizeTOF = 913.8; // z size of the TOF ext. volume, cm
const Double_t AliTOFAlignment::fgkRorigTOF = 384.5; // Mean Radius of the TOF ext. volume, cm
-const Double_t AliTOFAlignment::fgkXFM = 38.0; //x pos, cm
-const Double_t AliTOFAlignment::fgkYFM = 11.2; //y pos, cm
-const Double_t AliTOFAlignment::fgkZFM = 457.3;//z pos, cm
+const Double_t AliTOFAlignment::fgkXFM = 38.0; //x pos of FM in the LRS, cm
+const Double_t AliTOFAlignment::fgkYFM = 11.2; //y pos of FM in the LRS, cm
+const Double_t AliTOFAlignment::fgkZFM = 457.3;//z pos of FM in the LRS, cm
const Double_t AliTOFAlignment::fgkZsizeTOFSens=741.2; //z size of the TOF sensitive volume, cm
//_____________________________________________________________________________
}
//_____________________________________________________________________________
-AliTOFAlignment::~AliTOFAlignment() {delete fTOFAlignObjArray;}
+AliTOFAlignment::~AliTOFAlignment() {
+ delete fTOFAlignObjArray;
+ delete fTOFmgr;
+}
//_____________________________________________________________________________
void AliTOFAlignment::Smear( Float_t *tr, Float_t *rot)
TRandom *rnd = new TRandom(1567);
Int_t nSMTOF = 18;
- AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
+ AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
UShort_t iIndex=0; //dummy volume index
- // AliAlignObj::ELayerID iLayer = AliAlignObj::kTOF;
+ // AliGeomManager::ELayerID iLayer = AliGeomManager::kTOF;
// Int_t iIndex=1; //dummy volume index
- UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
+ UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity
Int_t i;
for (i = 0; i<nSMTOF ; i++) {
Char_t path[100];
Int_t nSMTOF = 18;
- AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
+ AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
UShort_t iIndex=0; //dummy volume index
- UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
+ UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity
Int_t i;
for (i = 0; i<nSMTOF ; i++) {
{
//Write Align Par on CDB
AliCDBManager *man = AliCDBManager::Instance();
- if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
Char_t *sel1 = "AlignPar" ;
Char_t out[100];
sprintf(out,"%s/%s",sel,sel1);
{
//Read Align Par from CDB
AliCDBManager *man = AliCDBManager::Instance();
- if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
Char_t *sel1 = "AlignPar" ;
Char_t out[100];
sprintf(out,"%s/%s",sel,sel1);
{
//Write Sim Align Par on CDB
AliCDBManager *man = AliCDBManager::Instance();
- if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
Char_t *sel1 = "AlignSimPar" ;
Char_t out[100];
sprintf(out,"%s/%s",sel,sel1);
void AliTOFAlignment::ReadSimParFromCDB(Char_t *sel, Int_t nrun){
//Read Sim Align Par from CDB
AliCDBManager *man = AliCDBManager::Instance();
- if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
Char_t *sel1 = "AlignSimPar" ;
Char_t out[100];
sprintf(out,"%s/%s",sel,sel1);
{
//Write Align Par on CDB for DC06
AliCDBManager *man = AliCDBManager::Instance();
- if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
AliCDBId idTOFAlign("TOF/Align/Data",0,0);
AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
mdTOFAlign->SetComment("Alignment objects for ideal geometry, i.e. applying them to TGeo has to leave geometry unchanged");
{
//Read Sim Align Par from CDB for DC06
AliCDBManager *man = AliCDBManager::Instance();
- if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
AliCDBEntry *entry = man->Get("TOF/Align/Data",0);
fTOFAlignObjArray=(TObjArray*)entry->GetObject();
fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
void AliTOFAlignment::BuildGeomForSurvey()
{
- //Simulates a Misalignment and generates a list of FM coordinates in the
- //global RS, to be passed to the survey-to-alignment algo.
+ //Generates the ideal TOF structure with four Fiducial Marks in each
+ //supermodule (two on each z side) in their expected position.
//Highly inspired to Raffaele's example...
fTOFmgr = new TGeoManager("Geom","survey to alignment for TOF");
TGeoVolume* fm = new TGeoVolume("FM",fmbox);
fm->SetLineColor(2);//color
- TGeoTranslation* Atr = new TGeoTranslation("Atr",-fgkXFM, fgkYFM ,fgkZFM);
- TGeoTranslation* Btr = new TGeoTranslation("Btr", fgkXFM, fgkYFM, fgkZFM);
- TGeoTranslation* Ctr = new TGeoTranslation("Ctr", fgkXFM, fgkYFM,-fgkZFM);
- TGeoTranslation* Dtr = new TGeoTranslation("Dtr",-fgkXFM, fgkYFM,-fgkZFM);
+ TGeoTranslation* mAtr = new TGeoTranslation("mAtr",-fgkXFM, fgkYFM ,fgkZFM);
+ TGeoTranslation* mBtr = new TGeoTranslation("mBtr", fgkXFM, fgkYFM, fgkZFM);
+ TGeoTranslation* mCtr = new TGeoTranslation("mCtr", fgkXFM, fgkYFM,-fgkZFM);
+ TGeoTranslation* mDtr = new TGeoTranslation("mDtr",-fgkXFM, fgkYFM,-fgkZFM);
// position all this stuff in the global ALICE frame
box0[iSM]->SetLineColor(1); //black
top->AddNode(box0[iSM],1,smTrans); //place the extended SM volume
box0[iSM]->AddNode(box1,1); //place the inner SM volume
- box0[iSM]->AddNode(fm,1,Atr);
- box0[iSM]->AddNode(fm,2,Btr);
- box0[iSM]->AddNode(fm,3,Ctr);
- box0[iSM]->AddNode(fm,4,Dtr);
+ box0[iSM]->AddNode(fm,1,mAtr);
+ box0[iSM]->AddNode(fm,2,mBtr);
+ box0[iSM]->AddNode(fm,3,mCtr);
+ box0[iSM]->AddNode(fm,4,mDtr);
}
fTOFmgr->CloseGeometry();
fTOFmgr->SetVisOption(0);
fTOFmgr->SetVisLevel(6);
- // Now Store the ideal Matrices for later use....
+ // Now Store the "Ideal" Matrices for later use....
for (Int_t iSM = 0; iSM < 18; iSM++) {
sprintf(name, "TOP_1/BTOF%d_1", iSM);
- printf("\n\n************ SuperModule N.r: ************** %s \n",name);
+ printf("\n\n***************** TOF SuperModule: %s ****************** \n",name);
TGeoPhysicalNode* pn3 = fTOFmgr->MakePhysicalNode(name);
fTOFMatrixId[iSM] = pn3->GetMatrix(); //save "ideal" global matrix
- printf("\n\n************ Ideal global matrix, 1 **************\n");
+ printf("\n\n*************** The Ideal Matrix in GRS *****************\n");
fTOFMatrixId[iSM]->Print();
}
}
//_____________________________________________________________________________
-void AliTOFAlignment::TestAlignFromSurvey( Float_t *mis)
+void AliTOFAlignment::InsertMisAlignment( Float_t *mis)
{
// Now Apply the Displacements and store the misaligned FM positions...
- Double_t A[3]={-fgkXFM,fgkYFM, fgkZFM};
- Double_t B[3]={ fgkXFM,fgkYFM, fgkZFM};
- Double_t C[3]={ fgkXFM,fgkYFM,-fgkZFM};
- Double_t D[3]={-fgkXFM,fgkYFM,-fgkZFM};
+ Double_t lA[3]={-fgkXFM,fgkYFM, fgkZFM};
+ Double_t lB[3]={ fgkXFM,fgkYFM, fgkZFM};
+ Double_t lC[3]={ fgkXFM,fgkYFM,-fgkZFM};
+ Double_t lD[3]={-fgkXFM,fgkYFM,-fgkZFM};
for(Int_t iSM=0;iSM<18;iSM++){
// ************* get ideal global matrix *******************
char name[16];
sprintf(name, "TOP_1/BTOF%d_1", iSM);
fTOFmgr->cd(name);
- printf("\n\n************ SuperModule N.r: ************** %s \n",name);
+ printf("\n\n******Misaligning TOF SuperModule ************** %s \n",name);
// ************* get ideal local matrix *******************
TGeoHMatrix g3 = *fTOFmgr->GetCurrentMatrix();
TGeoMatrix* l3 = n3->GetMatrix();
Double_t gA[3], gB[3], gC[3], gD[3]; // ideal FM point coord., global RS
- g3.LocalToMaster(A,gA);
- g3.LocalToMaster(B,gB);
- g3.LocalToMaster(C,gC);
- g3.LocalToMaster(D,gD);
+ g3.LocalToMaster(lA,gA);
+ g3.LocalToMaster(lB,gB);
+ g3.LocalToMaster(lC,gC);
+ g3.LocalToMaster(lD,gD);
+
// We apply a delta transformation to the surveyed vol to represent
// its real position, given below by ng3 nl3, which differs from its
// new local matrix, representing real position
TGeoHMatrix nlocal = *l3 * localdelta;
TGeoHMatrix* nl3 = new TGeoHMatrix(nlocal);
-
TGeoPhysicalNode* pn3 = fTOFmgr->MakePhysicalNode(name);
- TGeoHMatrix* ng2 = pn3->GetMatrix(); //"real" global matrix, what survey sees
- printf("\n\n************ Ideal global matrix, 2 **************\n");
- ng2->Print();
pn3->Align(nl3); //Align....
TGeoHMatrix* ng3 = pn3->GetMatrix(); //"real" global matrix, what survey sees
- printf("\n\n************ Misaligned global matrix **************\n");
+ printf("\n\n************* The Misaligned Matrix in GRS **************\n");
ng3->Print();
Double_t ngA[3], ngB[3], ngC[3], ngD[3];// real FM point coord., global RS
- ng3->LocalToMaster(A,ngA);
- ng3->LocalToMaster(B,ngB);
- ng3->LocalToMaster(C,ngC);
- ng3->LocalToMaster(D,ngD);
+ ng3->LocalToMaster(lA,ngA);
+ ng3->LocalToMaster(lB,ngB);
+ ng3->LocalToMaster(lC,ngC);
+ ng3->LocalToMaster(lD,ngD);
for(Int_t iFM=0;iFM<3;iFM++){
fTOFSurveyFM[iSM][0][iFM]=ngA[iFM];
//_____________________________________________________________________________
void AliTOFAlignment::AlignFromSurvey()
{
- //From survey Data, derive the needed transformations to get the
+ //From Survey data, derive the needed transformations to get the
//Alignment Objects.
//Again, highly "inspired" to Raffaele's example...
fTOFAlignObjArray = new TObjArray(kMaxAlignObj);
Int_t index=0; //let all SM modules have index=0
- AliAlignObj::ELayerID layer = AliAlignObj::kInvalidLayer;
- UShort_t dvoluid = AliAlignObj::LayerToVolUID(layer,index); //dummy vol id
+ AliGeomManager::ELayerID layer = AliGeomManager::kInvalidLayer;
+ UShort_t dvoluid = AliGeomManager::LayerToVolUID(layer,index); //dummy vol id
for(Int_t iSM=0;iSM<18;iSM++){
+
+ printf("\n\n******Survey analysis for TOF SuperModule ************** %i \n",iSM);
+
Double_t ngA[3], ngB[3], ngC[3], ngD[3];// real FM point coord., global RS
- // Get the input from the Survey Matrix
+ // Get the 'realistic' input from the Survey Matrix
for(Int_t iFM=0;iFM<3;iFM++){
ngA[iFM]= fTOFSurveyFM[iSM][0][iFM];
ngB[iFM]= fTOFSurveyFM[iSM][1][iFM];
- ngD[iFM]= fTOFSurveyFM[iSM][2][iFM];
- ngC[iFM]= fTOFSurveyFM[iSM][3][iFM];
+ ngC[iFM]= fTOFSurveyFM[iSM][2][iFM];
+ ngD[iFM]= fTOFSurveyFM[iSM][3][iFM];
}
// From the new fiducial marks coordinates derive back the
}
// The center of the box, gives the global translation
-
for(Int_t i=0;i<3;i++){
orig[i] = md[i] - plane[i]*fgkYFM;
}
// get local directions needed to write the global rotation matrix
// for the surveyed volume by normalising vectors ab and bc
-
Double_t sx = TMath::Sqrt(ab[0]*ab[0] + ab[1]*ab[1] + ab[2]*ab[2]);
if(sx>1.e-8){
for(Int_t i=0;i<3;i++){
bc[i] /= sy;
}
}
-
Double_t rot[9] = {ab[0],plane[0],bc[0],ab[1],plane[1],-bc[1],ab[2],plane[2],-bc[2]}; // the rotation matrix
+
+ // the Aligned matrix for the current TOF SMS in the Global RS, as derived from Survey:
TGeoHMatrix ng;
ng.SetTranslation(orig);
ng.SetRotation(rot);
+ printf("\n\n**** The Misaligned Matrix in GRS, as from Survey data ***\n");
ng.Print();
- // Calculate the delta transformation wrt Ideal
+
+ // Calculate the delta transformation wrt Ideal geometry
+ // (Should be gdelta.rot ==I and gdelta.tr=0 if no misalignment is applied.)
+ printf("\n\n**** The ideal matrix ***\n");
+ fTOFMatrixId[iSM]->Print();
TGeoHMatrix gdelta =fTOFMatrixId[iSM]->Inverse();
+ printf("\n\n**** The inverse of the ideal matrix ***\n");
+ gdelta.Print();
gdelta.MultiplyLeft(&ng);
-
- // Now Get the alignment Objects....
- TString symname(Form("TOF/sm%02d",iSM));
-// // if the volume is in the look-up table use something like this instead:
- AliAlignObjMatrix* o = new AliAlignObjMatrix(symname.Data(),dvoluid,gdelta,kTRUE);
- fTOFAlignObjArray->Add(o);
+ printf("\n\n**** The Delta Matrix in GRS, as from Survey data ***\n");
+ gdelta.Print();
+
+ // Now Write the Alignment Objects....
+ TString symname(Form("TOF/sm%02d",iSM));
+ AliAlignObjMatrix* o = new AliAlignObjMatrix(symname.Data(),dvoluid,gdelta,kTRUE);
+ fTOFAlignObjArray->Add(o);
}
-
// saving TOF AligObjs from survey on a file, for the moment..
fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));