+
+
+ //fTempAlignObj->Print("");
+
+ return fTempAlignObj;
+}
+//-------------------------------------------------------------
+
+// //-------------------------------------------------------------
+// AliAlignObjParams *AliITSAlignMilleModule::GetSensitiveVolumeTotalMisalignment(UShort_t voluid, Double_t *deltalocal)
+// {
+// // calculate misalignment of sens.vol. 'voluid' according with a displacement 'deltalocal'
+// // of the mother volume. The misalignment is returned as AliAlignObjParams object including
+// // the (evenctual) prealignment => no merging needed
+
+// if (!IsIn(voluid)) return NULL;
+// if (!gGeoManager) return NULL;
+
+// // prepare the TGeoHMatrix
+// Double_t tr[3],ang[3];
+// tr[0]=deltalocal[0]; // in centimeter
+// tr[1]=deltalocal[1];
+// tr[2]=deltalocal[2];
+// ang[0]=deltalocal[3]; // psi (X) in deg
+// ang[1]=deltalocal[4]; // theta (Y)
+// ang[2]=deltalocal[5]; // phi (Z)
+
+// // reset align object (may not be needed...)
+// fTempAlignObj->SetVolUID(0);
+// fTempAlignObj->SetSymName("");
+// fTempAlignObj->SetRotation(ang[0],ang[1],ang[2]);
+// fTempAlignObj->SetTranslation(tr[0],tr[1],tr[2]);
+// AliDebug(3,Form("Delta angles: psi=%f theta=%f phi=%f",ang[0],ang[1],ang[2]));
+
+// // Gsv = Gg * Gg-1 * Gsv -> Lsv,g = Gg-1 * Gsv
+// // G'sv = Gg * Dg * Lsv,g === DGsv * Gsv
+// //
+// // => Dsv = (G0sv-1 * Gg * Dg * Gg-1 * GMsv) //
+// //
+
+// // prepare the Delta matrix Dg
+// TGeoHMatrix dg;
+// fTempAlignObj->GetMatrix(dg);
+// //dg.Print();
+
+// // 1) start setting fSensVolModif = Gsv
+// if (SensVolMatrix(voluid, fSensVolModifMatrix)) return NULL;
+// //printf("\n1: modif=orig del sensvol\n");fSensVolModifMatrix->Print();
+
+// // 2) set dg = Gg * Dg * Gg-1
+// dg.Multiply( &fMatrix->Inverse() );
+// dg.MultiplyLeft( fMatrix );
+
+// // 3) set dg = Gsv-1 * dg * Gsv locale nel sistema del SV preallineato
+// dg.Multiply( fSensVolModifMatrix );
+// dg.MultiplyLeft( &fSensVolModifMatrix->Inverse() );
+
+// // calcola la deltaPre
+// TGeoHMatrix hp;
+// if (SensVolOrigGlobalMatrix(voluid, &hp)) return NULL;
+// fSensVolModifMatrix->MultiplyLeft( &hp.Inverse() );
+
+// // mo' fSensVolModifMatrix e' la deltapre ideale
+// // col dg diventa la deltatot ideale
+// fSensVolModifMatrix->Multiply( &dg );
+// //fSensVolModifMatrix->MultiplyLeft( &dg );
+
+// // reset align object (may not be needed...)
+// fTempAlignObj->SetVolUID(0);
+// fTempAlignObj->SetSymName("");
+// fTempAlignObj->SetTranslation(0,0,0);
+// fTempAlignObj->SetRotation(0,0,0);
+
+// // correction for SPD y-shift
+// if (voluid>=2048 && voluid<4256) {
+// TGeoHMatrix deltay;
+// double dy[3]={0.,0.0081,0.};
+// deltay.SetTranslation(dy);
+// fSensVolModifMatrix->MultiplyLeft( &deltay );
+// fSensVolModifMatrix->Multiply( &deltay.Inverse() );
+// }
+// if (!fTempAlignObj->SetMatrix(*fSensVolModifMatrix)) return NULL;
+// fTempAlignObj->SetVolUID(voluid);
+// fTempAlignObj->SetSymName(AliGeomManager::SymName(voluid));
+
+
+// //fTempAlignObj->Print("");
+
+// return fTempAlignObj;
+// }
+// //-------------------------------------------------------------
+
+
+//-------------------------------------------------------------
+AliAlignObjParams *AliITSAlignMilleModule::GetSensitiveVolumeGlobalMisalignment(UShort_t voluid, const Double_t * const deltalocal)
+{
+ // calculate misalignment of sens.vol. 'voluid' according with a displacement 'deltalocal'
+ // of the mother volume. The misalignment is returned as AliAlignObjParams object
+
+ if (!IsIn(voluid)) return NULL;
+ if (!gGeoManager) return NULL;
+
+ // prepare the TGeoHMatrix
+ Double_t tr[3],ang[3];
+ tr[0]=deltalocal[0]; // in centimeter
+ tr[1]=deltalocal[1];
+ tr[2]=deltalocal[2];
+ ang[0]=deltalocal[3]; // psi (X) in deg
+ ang[1]=deltalocal[4]; // theta (Y)
+ ang[2]=deltalocal[5]; // phi (Z)
+
+ // reset align object (may not be needed...)
+ fTempAlignObj->SetTranslation(0,0,0);
+ fTempAlignObj->SetRotation(0,0,0);
+
+ fTempAlignObj->SetRotation(ang[0],ang[1],ang[2]);
+ fTempAlignObj->SetTranslation(tr[0],tr[1],tr[2]);
+ AliDebug(3,Form("Delta angles: psi=%f theta=%f phi=%f",ang[0],ang[1],ang[2]));
+
+ // Gsv = Gg * Gg-1 * Gsv -> Lsv,g = Gg-1 * Gsv
+ // G'sv = Gg * Dg * Lsv,g === DGsv * Gsv
+ //
+ // => DGsv = (Gg * Dg * Gg-1)
+ //
+
+ // prepare the Delta matrix Dg
+ TGeoHMatrix dg;
+ fTempAlignObj->GetMatrix(dg);
+ //dg.Print();
+
+ dg.MultiplyLeft( fMatrix );
+ dg.Multiply( &fMatrix->Inverse() );
+
+ // reset align object (may not be needed...)
+ fTempAlignObj->SetTranslation(0,0,0);
+ fTempAlignObj->SetRotation(0,0,0);
+
+ fTempAlignObj->SetVolUID(voluid);
+ fTempAlignObj->SetSymName(AliGeomManager::SymName(voluid));
+
+ if (!fTempAlignObj->SetMatrix(dg)) return NULL;