// (AliAlignObjParams, AliAlignObjMatrix) are derived in separate files.
//-----------------------------------------------------------------
-#include <TClass.h>
#include <TGeoManager.h>
+#include <TGeoMatrix.h>
#include <TGeoPhysicalNode.h>
#include <TMath.h>
-#include "TObjString.h"
+#include <TMatrixDSym.h>
#include "AliAlignObj.h"
#include "AliTrackPointArray.h"
#include "AliLog.h"
-#include "AliAlignObjParams.h"
ClassImp(AliAlignObj)
{
// default constructor
for(Int_t i=0; i<6; i++) fDiag[i]=-999.;
- for(Int_t i=0; i<21; i++) fODia[i]=-999.;
+ for(Int_t i=0; i<15; i++) fODia[i]=-999.;
}
//_____________________________________________________________________________
// standard constructor
//
for(Int_t i=0; i<6; i++) fDiag[i]=-999.;
- for(Int_t i=0; i<21; i++) fODia[i]=-999.;
+ for(Int_t i=0; i<15; i++) fODia[i]=-999.;
}
//_____________________________________________________________________________
{
//copy constructor
for(Int_t i=0; i<6; i++) fDiag[i]=theAlignObj.fDiag[i];
- for(Int_t i=0; i<21; i++) fODia[i]=theAlignObj.fODia[i];
+ for(Int_t i=0; i<15; i++) fODia[i]=theAlignObj.fODia[i];
}
//_____________________________________________________________________________
fVolPath = theAlignObj.GetSymName();
fVolUID = theAlignObj.GetVolUID();
for(Int_t i=0; i<6; i++) fDiag[i]=theAlignObj.fDiag[i];
- for(Int_t i=0; i<21; i++) fODia[i]=theAlignObj.fODia[i];
+ for(Int_t i=0; i<15; i++) fODia[i]=theAlignObj.fODia[i];
return *this;
}
theAlignObj.GetMatrix(m2);
m1.MultiplyLeft(&m2);
SetMatrix(m1);
- // temporary solution: consider parameters indipendent
- for(Int_t i=0; i<6; i++) fDiag[i] = TMath::Sqrt((fDiag[i]*fDiag[i])+(theAlignObj.fDiag[i]*theAlignObj.fDiag[i]));
+ // temporary solution: the covariance matrix of the resulting combined object
+ // is set equal to the covariance matrix of the right operand
+ // (not to be used for combining alignment objects for different levels)
+ for(Int_t i=0; i<6; i++) fDiag[i] = theAlignObj.fDiag[i];
+ for(Int_t i=0; i<15; i++) fODia[i] = theAlignObj.fODia[i];
return *this;
}
// slashes in the corresponding volume path
//
if(!gGeoManager){
- AliWarning("gGeoManager doesn't exist or it is still opened: unable to return meaningful level value.");
+ AliWarning("gGeoManager doesn't exist or it is still open: unable to return meaningful level value.");
return (-1);
}
const char* symname = GetSymName();
path = symname;
}
- TString path_str = path;
- if(path_str[0]!='/') path_str.Prepend('/');
- return path_str.CountChar('/');
+ TString pathStr = path;
+ if(pathStr[0]!='/') pathStr.Prepend('/');
+ return pathStr.CountChar('/');
}
//_____________________________________________________________________________
}
//______________________________________________________________________________
-void AliAlignObj::Transform(AliTrackPoint &p) const
+void AliAlignObj::Transform(AliTrackPoint &p, Bool_t copycov) const
{
// The method transforms the space-point coordinates using the
// transformation matrix provided by the AliAlignObj
- // The covariance matrix is not affected since we assume
- // that the transformations are sufficiently small
+ // In case the copycov flag is set to kTRUE, the covariance matrix
+ // of the alignment object is copied into the space-point
//
if (fVolUID != p.GetVolumeID())
AliWarning(Form("Alignment object ID is not equal to the space-point ID (%d != %d)",fVolUID,p.GetVolumeID()));
xyzin[1]*rot[3*i+1]+
xyzin[2]*rot[3*i+2];
p.SetXYZ(xyzout);
+
+ if(copycov){
+ TMatrixDSym covmat(6);
+ GetCovMatrix(covmat);
+ p.SetAlignCovMatrix(covmat);
+ }
}
// returns false and the object parameters are not set.
//
if (!gGeoManager || !gGeoManager->IsClosed()) {
- AliError("Can't set the alignment object parameters! gGeoManager doesn't exist or it is still opened!");
+ AliError("Can't set the local alignment object parameters! gGeoManager doesn't exist or it is still open!");
return kFALSE;
}
TGeoPhysicalNode* node;
TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(symname);
if(pne){
- node = gGeoManager->MakeAlignablePN(pne);
+ if(!pne->GetPhysicalNode()){
+ node = gGeoManager->MakeAlignablePN(pne);
+ }else{
+ node = pne->GetPhysicalNode();
+ }
}else{
AliWarning(Form("The symbolic volume name %s does not correspond to a physical entry. Using it as volume path!",symname));
node = (TGeoPhysicalNode*) gGeoManager->MakePhysicalNode(symname);
// returns false and the object parameters are not set.
//
if (!gGeoManager || !gGeoManager->IsClosed()) {
- AliError("Can't set the alignment object parameters! gGeoManager doesn't exist or it is still opened!");
+ AliError("Can't get the local alignment object parameters! gGeoManager doesn't exist or it is still open!");
return kFALSE;
}
TGeoPhysicalNode* node;
TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(symname);
if(pne){
- node = gGeoManager->MakeAlignablePN(pne);
+ if(!pne->GetPhysicalNode()){
+ node = gGeoManager->MakeAlignablePN(pne);
+ }else{
+ node = pne->GetPhysicalNode();
+ }
}else{
AliWarning(Form("The symbolic volume name %s does not correspond to a physical entry. Using it as volume path!",symname));
node = (TGeoPhysicalNode*) gGeoManager->MakePhysicalNode(symname);
}
//_____________________________________________________________________________
-Bool_t AliAlignObj::ApplyToGeometry()
+Bool_t AliAlignObj::ApplyToGeometry(Bool_t ovlpcheck)
{
// Apply the current alignment object to the TGeo geometry
// This method returns FALSE if the symname of the object was not
// valid neither to get a TGeoPEntry nor as a volume path
//
if (!gGeoManager || !gGeoManager->IsClosed()) {
- AliError("Can't apply the alignment object! gGeoManager doesn't exist or it is still opened!");
+ AliError("Can't apply the alignment object! gGeoManager doesn't exist or it is still open!");
return kFALSE;
}
+ if (gGeoManager->IsLocked()){
+ AliError("Can't apply the alignment object! Geometry is locked!");
+ return kFALSE;
+ }
+
const char* symname = GetSymName();
const char* path;
TGeoPhysicalNode* node;
Int_t modId; // unique identity for volume inside layer in the alobj
GetVolUID(layerId, modId);
AliDebug(2,Form("Aligning volume %s of detector layer %d with local ID %d",symname,layerId,modId));
- node->Align(ginv);
+ node->Align(ginv,0,ovlpcheck);
+ if(ovlpcheck){
+ Int_t novex=((TObjArray*)gGeoManager->GetListOfOverlaps())->GetEntriesFast();
+ if(novex){
+ TString error(Form("The alignment of volume %s introduced %d new overlap",GetSymName(),novex));
+ if(novex>1) error+="s";
+ AliError(error.Data());
+ return kFALSE;
+ }
+ }
return kTRUE;
}