Skip to content

Commit df6fa2a

Browse files
MichaelLettrichshahor02
authored andcommitted
[ALIGN] port AliAlgVol
1 parent 4114e65 commit df6fa2a

4 files changed

Lines changed: 114 additions & 108 deletions

File tree

Detectors/Align/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ o2_add_library(Align
3030
#src/AliAlgSensTRD.cxx
3131
#src/AliAlgSteer.cxx
3232
#src/AliAlgTrack.cxx
33-
#src/AliAlgVol.cxx
33+
src/AliAlgVol.cxx
3434
#src/AliAlgVtx.cxx
3535
#src/Mille.cxx
3636
PUBLIC_LINK_LIBRARIES O2::FrameworkLogger
@@ -62,7 +62,7 @@ o2_target_root_dictionary(
6262
#include/Align/AliAlgSensHMPID.h
6363
#include/Align/AliAlgSteer.h
6464
#include/Align/AliAlgTrack.h
65-
#include/Align/AliAlgVol.h
65+
include/Align/AliAlgVol.h
6666
#include/Align/AliAlgVtx.h
6767
#include/Align/AliAlgRes.h
6868
#include/Align/AliAlgResFast.h

Detectors/Align/include/Align/AliAlgVol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
#include <TNamed.h>
2727
#include <TObjArray.h>
2828
#include <TGeoMatrix.h>
29-
#include <stdio.h>
29+
#include <cstdio>
30+
#include "Align/AliAlgDOFStat.h"
3031

3132
class TObjArray;
3233
class TClonesArray;
33-
class AliAlgDOFStat;
3434
class TH1;
3535

3636
namespace o2

Detectors/Align/src/AliAlgVol.cxx

Lines changed: 109 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797

9898
#include "Align/AliAlgVol.h"
9999
#include "Align/AliAlgDOFStat.h"
100-
#include "Align/AliAlgConstraint.h"
100+
//#include "Align/AliAlgConstraint.h" FIXME(milettri): needs AliAlgsConstraint
101101
//#include "AliAlignObjParams.h"
102102
//#include "AliGeomManager.h"
103103
#include "Align/AliAlgAux.h"
@@ -110,9 +110,9 @@
110110
#include <TAxis.h>
111111
#include <stdio.h>
112112

113-
ClassImp(o2::align::AliAlgVol)
113+
ClassImp(o2::align::AliAlgVol);
114114

115-
using namespace TMath;
115+
using namespace TMath;
116116
using namespace o2::align::AliAlgAux;
117117

118118
namespace o2
@@ -166,14 +166,16 @@ AliAlgVol::~AliAlgVol()
166166
//_________________________________________________________
167167
void AliAlgVol::Delta2Matrix(TGeoHMatrix& deltaM, const Double_t* delta) const
168168
{
169-
// prepare delta matrix for the volume from its
170-
// local delta vector (AliAlignObj convension): dx,dy,dz,,theta,psi,phi
171-
const double *tr = &delta[0], *rt = &delta[3]; // translation(cm) and rotation(degree)
172-
AliAlignObjParams tempAlignObj;
173-
tempAlignObj.SetRotation(rt[0], rt[1], rt[2]);
174-
tempAlignObj.SetTranslation(tr[0], tr[1], tr[2]);
175-
tempAlignObj.GetMatrix(deltaM);
169+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
170+
//FIXME(milettri): needs AliAlignObj
171+
// // prepare delta matrix for the volume from its
172+
// // local delta vector (AliAlignObj convension): dx,dy,dz,,theta,psi,phi
173+
// const double *tr = &delta[0], *rt = &delta[3]; // translation(cm) and rotation(degree)
176174
//
175+
// AliAlignObjParams tempAlignObj;
176+
// tempAlignObj.SetRotation(rt[0], rt[1], rt[2]);
177+
// tempAlignObj.SetTranslation(tr[0], tr[1], tr[2]);
178+
// tempAlignObj.GetMatrix(deltaM);
177179
}
178180

179181
//__________________________________________________________________
@@ -295,41 +297,43 @@ void AliAlgVol::Print(const Option_t* opt) const
295297
//____________________________________________
296298
void AliAlgVol::PrepareMatrixL2G(Bool_t reco)
297299
{
298-
// extract from geometry L2G matrix, depending on reco flag, set it as a reco-time
299-
// or current alignment matrix
300-
const char* path = GetSymName();
301-
if (gGeoManager->GetAlignableEntry(path)) {
302-
const TGeoHMatrix* l2g = AliGeomManager::GetMatrix(path);
303-
if (!l2g)
304-
AliFatalF("Failed to find L2G matrix for alignable %s", path);
305-
reco ? SetMatrixL2GReco(*l2g) : SetMatrixL2G(*l2g);
306-
} else { // extract from path
307-
if (!gGeoManager->CheckPath(path))
308-
AliFatalF("Volume path %s not valid!", path);
309-
TGeoPhysicalNode* node = (TGeoPhysicalNode*)gGeoManager->GetListOfPhysicalNodes()->FindObject(path);
310-
TGeoHMatrix l2g;
311-
if (!node) {
312-
AliWarningF("Attention: volume %s was not misaligned, extracting original matrix", path);
313-
if (!AliGeomManager::GetOrigGlobalMatrix(path, l2g)) {
314-
AliFatalF("Failed to find ideal L2G matrix for %s", path);
315-
}
316-
} else {
317-
l2g = *node->GetMatrix();
318-
}
319-
reco ? SetMatrixL2GReco(l2g) : SetMatrixL2G(l2g);
320-
}
321-
//
300+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
301+
// FIXME(milettri): needs AliGeomManager
302+
// // extract from geometry L2G matrix, depending on reco flag, set it as a reco-time
303+
// // or current alignment matrix
304+
// const char* path = GetSymName();
305+
// if (gGeoManager->GetAlignableEntry(path)) {
306+
// const TGeoHMatrix* l2g = AliGeomManager::GetMatrix(path);
307+
// if (!l2g)
308+
// LOG(FATAL) << "Failed to find L2G matrix for alignable " << path;
309+
// reco ? SetMatrixL2GReco(*l2g) : SetMatrixL2G(*l2g);
310+
// } else { // extract from path
311+
// if (!gGeoManager->CheckPath(path))
312+
// LOG(FATAL) << "Volume path " << path << " is not valid!";
313+
// TGeoPhysicalNode* node = (TGeoPhysicalNode*)gGeoManager->GetListOfPhysicalNodes()->FindObject(path);
314+
// TGeoHMatrix l2g;
315+
// if (!node) {
316+
// LOG(WARNING) << "volume " << path << " was not misaligned, extracting original matrix";
317+
// if (!AliGeomManager::GetOrigGlobalMatrix(path, l2g)) {
318+
// LOG(FATAL) << "Failed to find ideal L2G matrix for " << path;
319+
// }
320+
// } else {
321+
// l2g = *node->GetMatrix();
322+
// }
323+
// reco ? SetMatrixL2GReco(l2g) : SetMatrixL2G(l2g);
324+
// }
322325
}
323326

324327
//____________________________________________
325328
void AliAlgVol::PrepareMatrixL2GIdeal()
326329
{
327-
// extract from geometry ideal L2G matrix
328-
TGeoHMatrix mtmp;
329-
if (!AliGeomManager::GetOrigGlobalMatrix(GetSymName(), mtmp))
330-
AliFatalF("Failed to find ideal L2G matrix for %s", GetSymName());
331-
SetMatrixL2GIdeal(mtmp);
332-
//
330+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
331+
// FIXME(milettri): needs AliGeomManager
332+
// // extract from geometry ideal L2G matrix
333+
// TGeoHMatrix mtmp;
334+
// if (!AliGeomManager::GetOrigGlobalMatrix(GetSymName(), mtmp))
335+
// LOG(FATAL) << "Failed to find ideal L2G matrix for " << GetSymName();
336+
// SetMatrixL2GIdeal(mtmp);
333337
}
334338

335339
//____________________________________________
@@ -382,7 +386,7 @@ void AliAlgVol::SetTrackingFrame()
382386
// Define tracking frame of the sensor
383387
// This method should be implemented for sensors, which receive the T2L
384388
// matrix from the geometry
385-
AliErrorF("Volume %s was supposed to implement its own method", GetName());
389+
LOG(ERROR) << "Volume " << GetName() << " was supposed to implement its own method";
386390
}
387391

388392
//__________________________________________________________________
@@ -412,14 +416,12 @@ void AliAlgVol::InitDOFs()
412416
//
413417
// Do we need this strict condition?
414418
if (GetInitDOFsDone())
415-
AliFatalF("Something is wrong, DOFs are already initialized for %s", GetName());
419+
LOG(FATAL) << "DOFs are already initialized for " << GetName();
416420
for (int i = 0; i < fNDOFs; i++)
417421
if (fParErrs[i] < -9999 && IsZeroAbs(fParVals[i]))
418422
FixDOF(i);
419423
CalcFree(kTRUE);
420-
//
421424
SetInitDOFsDone();
422-
//
423425
}
424426

425427
//__________________________________________________________________
@@ -465,7 +467,7 @@ void AliAlgVol::SetParVals(Int_t npar, Double_t* vl, Double_t* er)
465467
{
466468
// set parameters
467469
if (npar > fNDOFs)
468-
AliFatalF("Volume %s has %d dofs", GetName(), fNDOFs);
470+
LOG(FATAL) << "Volume " << GetName() << " has " << fNDOFs << " dofs";
469471
for (int i = 0; i < npar; i++) {
470472
fParVals[i] = vl[i];
471473
fParErrs[i] = er ? er[i] : 0;
@@ -728,7 +730,6 @@ void AliAlgVol::CreateAlignmenMatrix(TGeoHMatrix& alg) const
728730
alg.MultiplyLeft(&par->GetMatrixL2GIdeal());
729731
}
730732
*/
731-
//
732733
}
733734

734735
/*
@@ -763,48 +764,52 @@ void AliAlgVol::CreateAlignmenMatrix(TGeoHMatrix& alg) const
763764
//_________________________________________________________________
764765
void AliAlgVol::CreateAlignmentObjects(TClonesArray* arr) const
765766
{
767+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
768+
// FIXME(milettri): needs AliAlignObjParams
766769
// add to supplied array alignment object for itself and children
767-
TClonesArray& parr = *arr;
768-
TGeoHMatrix algM;
769-
CreateAlignmenMatrix(algM);
770-
new (parr[parr.GetEntriesFast()]) AliAlignObjParams(GetName(), GetVolID(), algM, kTRUE);
771-
int nch = GetNChildren();
772-
for (int ich = 0; ich < nch; ich++)
773-
GetChild(ich)->CreateAlignmentObjects(arr);
770+
// TClonesArray& parr = *arr;
771+
// TGeoHMatrix algM;
772+
// CreateAlignmenMatrix(algM);
773+
// new (parr[parr.GetEntriesFast()]) AliAlignObjParams(GetName(), GetVolID(), algM, kTRUE);
774+
// int nch = GetNChildren();
775+
// for (int ich = 0; ich < nch; ich++)
776+
// GetChild(ich)->CreateAlignmentObjects(arr);
774777
//
775778
}
776779

777780
//_________________________________________________________________
778781
void AliAlgVol::UpdateL2GRecoMatrices(const TClonesArray* algArr, const TGeoHMatrix* cumulDelta)
779782
{
780-
// recreate fMatL2GReco matrices from ideal L2G matrix and alignment objects
781-
// used during data reconstruction. For the volume at level J we have
782-
// L2G' = Delta_J * Delta_{J-1} *...* Delta_0 * L2GIdeal
783-
// cumulDelta is Delta_{J-1} * ... * Delta_0, supplied by the parent
784-
//
785-
fMatL2GReco = fMatL2GIdeal;
786-
// find alignment object for this volume
787-
int nalg = algArr->GetEntriesFast();
788-
const AliAlignObjParams* par = 0;
789-
for (int i = 0; i < nalg; i++) {
790-
par = (AliAlignObjParams*)algArr->At(i);
791-
if (!strcmp(par->GetSymName(), GetSymName()))
792-
break;
793-
par = 0;
794-
}
795-
TGeoHMatrix delta;
796-
if (!par)
797-
AliInfoF("Alignment for %s is absent in Reco-Time alignment object", GetSymName());
798-
else
799-
par->GetMatrix(delta);
800-
if (cumulDelta)
801-
delta *= *cumulDelta;
802-
//
803-
fMatL2GReco.MultiplyLeft(&delta);
804-
// propagate to children
805-
for (int ich = GetNChildren(); ich--;)
806-
GetChild(ich)->UpdateL2GRecoMatrices(algArr, &delta);
807-
//
783+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
784+
// FIXME(milettri): needs AliAlignObjParams
785+
// // recreate fMatL2GReco matrices from ideal L2G matrix and alignment objects
786+
// // used during data reconstruction. For the volume at level J we have
787+
// // L2G' = Delta_J * Delta_{J-1} *...* Delta_0 * L2GIdeal
788+
// // cumulDelta is Delta_{J-1} * ... * Delta_0, supplied by the parent
789+
// //
790+
// fMatL2GReco = fMatL2GIdeal;
791+
// // find alignment object for this volume
792+
// int nalg = algArr->GetEntriesFast();
793+
// const AliAlignObjParams* par = 0;
794+
// for (int i = 0; i < nalg; i++) {
795+
// par = (AliAlignObjParams*)algArr->At(i);
796+
// if (!strcmp(par->GetSymName(), GetSymName()))
797+
// break;
798+
// par = 0;
799+
// }
800+
// TGeoHMatrix delta;
801+
// if (!par)
802+
// LOG(INFO) << "Alignment for " << GetSymName() << " is absent in Reco-Time alignment object";
803+
// else
804+
// par->GetMatrix(delta);
805+
// if (cumulDelta)
806+
// delta *= *cumulDelta;
807+
// //
808+
// fMatL2GReco.MultiplyLeft(&delta);
809+
// // propagate to children
810+
// for (int ich = GetNChildren(); ich--;)
811+
// GetChild(ich)->UpdateL2GRecoMatrices(algArr, &delta);
812+
// //
808813
}
809814

810815
//______________________________________________________
@@ -862,28 +867,29 @@ void AliAlgVol::FillDOFStat(AliAlgDOFStat* h) const
862867
//________________________________________
863868
void AliAlgVol::AddAutoConstraints(TObjArray* constrArr)
864869
{
865-
// adds automatic constraints
866-
int nch = GetNChildren();
867-
//
868-
if (HasChildrenConstraint()) {
869-
AliAlgConstraint* constr = new AliAlgConstraint();
870-
constr->SetConstrainPattern(fConstrChild);
871-
constr->SetParent(this);
872-
for (int ich = nch; ich--;) {
873-
AliAlgVol* child = GetChild(ich);
874-
if (child->GetExcludeFromParentConstraint())
875-
continue;
876-
constr->AddChild(child);
877-
}
878-
if (constr->GetNChildren())
879-
constrArr->Add(constr);
880-
else
881-
delete constr;
882-
}
883-
//
884-
for (int ich = 0; ich < nch; ich++)
885-
GetChild(ich)->AddAutoConstraints(constrArr);
886-
//
870+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
871+
// FIXME(milettri): needs AliAlgConstraint
872+
// // adds automatic constraints
873+
// int nch = GetNChildren();
874+
// //
875+
// if (HasChildrenConstraint()) {
876+
// AliAlgConstraint* constr = new AliAlgConstraint();
877+
// constr->SetConstrainPattern(fConstrChild);
878+
// constr->SetParent(this);
879+
// for (int ich = nch; ich--;) {
880+
// AliAlgVol* child = GetChild(ich);
881+
// if (child->GetExcludeFromParentConstraint())
882+
// continue;
883+
// constr->AddChild(child);
884+
// }
885+
// if (constr->GetNChildren())
886+
// constrArr->Add(constr);
887+
// else
888+
// delete constr;
889+
// }
890+
// for (int ich = 0; ich < nch; ich++) {
891+
// GetChild(ich)->AddAutoConstraints(constrArr);
892+
// }
887893
}
888894

889895
} // namespace align

Detectors/Align/src/AlignLinkDef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//#pragma link C++ class o2::align::AliAlgSensHMPID + ;
2222
//#pragma link C++ class o2::align::AliAlgSteer + ;
2323
//#pragma link C++ class o2::align::AliAlgTrack + ;
24-
//#pragma link C++ class o2::align::AliAlgVol + ;
24+
#pragma link C++ class o2::align::AliAlgVol + ;
2525
//#pragma link C++ class o2::align::AliAlgVtx + ;
2626
//#pragma link C++ class o2::align::AliAlgRes + ;
2727
//#pragma link C++ class o2::align::AliAlgResFast + ;

0 commit comments

Comments
 (0)