From 0717eed2d58e558d2c56c55730e74ee8716e0587 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 29 May 2007 14:36:21 +0000 Subject: [PATCH] Corrected treatment of the misalignment (Andrei, Raffaele) --- STEER/AliMC.cxx | 6 ++++-- STEER/AliSimulation.cxx | 35 ++++++++++++++++------------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/STEER/AliMC.cxx b/STEER/AliMC.cxx index bd7b9f1cb4e..933b21824e1 100644 --- a/STEER/AliMC.cxx +++ b/STEER/AliMC.cxx @@ -183,6 +183,10 @@ void AliMC::ConstructGeometry() Bool_t AliMC::MisalignGeometry() { // Call misalignment code if AliSimulation object was defined. + + //Set alignable volumes for the whole geometry + SetAllAlignableVolumes(); + // Misalign geometry via AliSimulation instance if (!AliSimulation::GetInstance()) return kFALSE; return AliSimulation::GetInstance()->MisalignGeometry(gAlice->GetRunLoader()); } @@ -664,8 +668,6 @@ void AliMC::Init() //=================Create Materials and geometry gMC->Init(); - //Set alignable volumes for the whole geometry - SetAllAlignableVolumes(); //Read the cuts for all materials ReadTransPar(); //Build the special IMEDIA table diff --git a/STEER/AliSimulation.cxx b/STEER/AliSimulation.cxx index f7a3a0cc27c..8accf2583c5 100644 --- a/STEER/AliSimulation.cxx +++ b/STEER/AliSimulation.cxx @@ -369,6 +369,10 @@ Bool_t AliSimulation::MisalignGeometry(AliRunLoader *runLoader) // then applied to the TGeo geometry. // Finally an overlaps check is performed. + if (!gGeoManager || !gGeoManager->IsClosed()) { + AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!"); + return kFALSE; + } Bool_t delRunLoader = kFALSE; if (!runLoader) { runLoader = LoadRun("READ"); @@ -377,7 +381,7 @@ Bool_t AliSimulation::MisalignGeometry(AliRunLoader *runLoader) } // Export ideal geometry - if (gGeoManager) gGeoManager->Export("geometry.root"); + gGeoManager->Export("geometry.root"); // Load alignment data from CDB and apply to geometry through AliGeomManager if(fLoadAlignFromCDB){ @@ -390,9 +394,9 @@ Bool_t AliSimulation::MisalignGeometry(AliRunLoader *runLoader) AliModule* det = (AliModule*) detArray->At(iDet); if (!det || !det->IsActive()) continue; if (IsSelected(det->GetName(), detStr)) { - //add det to list of dets to be aligned from CDB - loadAlObjsListOfDets += det->GetName(); - loadAlObjsListOfDets += " "; + //add det to list of dets to be aligned from CDB + loadAlObjsListOfDets += det->GetName(); + loadAlObjsListOfDets += " "; } } // end loop over detectors (AliGeomManager::Instance())->ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data()); @@ -401,18 +405,11 @@ Bool_t AliSimulation::MisalignGeometry(AliRunLoader *runLoader) // provided by the user. If yes, apply the objects // to the present TGeo geometry if (fAlignObjArray) { - if (gGeoManager && gGeoManager->IsClosed()) { - if ((AliGeomManager::Instance())->ApplyAlignObjsToGeom(fAlignObjArray) == kFALSE) { - AliError("The misalignment of one or more volumes failed!" - "Compare the list of simulated detectors and the list of detector alignment data!"); - if (delRunLoader) delete runLoader; - return kFALSE; - } - } - else { - AliError("Can't apply the misalignment! gGeoManager doesn't exist or it is still opened!"); - if (delRunLoader) delete runLoader; - return kFALSE; + if ((AliGeomManager::Instance())->ApplyAlignObjsToGeom(fAlignObjArray) == kFALSE) { + AliError("The misalignment of one or more volumes failed!" + "Compare the list of simulated detectors and the list of detector alignment data!"); + if (delRunLoader) delete runLoader; + return kFALSE; } } } @@ -435,6 +432,9 @@ Bool_t AliSimulation::MisalignGeometry(AliRunLoader *runLoader) // Update the TGeoPhysicalNodes gGeoManager->RefreshPhysicalNodes(); + // Export (mis)aligned geometry + gGeoManager->Export("misaligned_geometry.root"); + return kTRUE; } @@ -646,9 +646,6 @@ Bool_t AliSimulation::RunSimulation(Int_t nEvents) MisalignGeometry(runLoader); #endif - // Export (mis)aligned geometry - if (gGeoManager) gGeoManager->Export("misaligned_geometry.root"); - // AliRunLoader* runLoader = gAlice->GetRunLoader(); // if (!runLoader) { // AliError(Form("gAlice has no run loader object. " -- 2.43.0