From 96cde2919035a19e3eafcf3ab5eb616460a08486 Mon Sep 17 00:00:00 2001 From: Rene Brun <Rene.Brun@cern.ch> Date: Tue, 11 Mar 2003 09:58:38 +0000 Subject: [PATCH] - Main containers of TGeoManager changed from TList to TObjArray to fix geometry building/IO speed problems for very large geometries - stressgeom.cxx fixed to cope with this change git-svn-id: http://root.cern.ch/svn/root/trunk@6294 27541ba8-7e3a-0410-8455-c3a389f83636 --- geom/inc/TGeoManager.h | 22 +++++++++++----------- geom/src/TGeoManager.cxx | 34 +++++++++++++++++----------------- geom/src/TGeoMatrix.cxx | 6 +++--- geom/src/TGeoVolume.cxx | 5 +++-- test/stressgeom.cxx | 4 ++-- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/geom/inc/TGeoManager.h b/geom/inc/TGeoManager.h index b0bdfa43614..2b6d050e744 100644 --- a/geom/inc/TGeoManager.h +++ b/geom/inc/TGeoManager.h @@ -1,4 +1,4 @@ -// @(#)root/geom:$Name: $:$Id: TGeoManager.h,v 1.28 2003/02/11 08:48:20 brun Exp $ +// @(#)root/geom:$Name: $:$Id: TGeoManager.h,v 1.29 2003/02/17 11:57:30 brun Exp $ // Author: Andrei Gheata 25/10/01 /************************************************************************* @@ -73,11 +73,11 @@ private : Bool_t fPhiCut; // flag for phi cuts TGeoNodeCache *fCache; //! cache for physical nodes TVirtualGeoPainter *fPainter; //! current painter - TList *fMatrices; //-> list of local transformations - TList *fShapes; //-> list of shapes - TList *fVolumes; //-> list of volumes - TList *fGShapes; //! list of runtime shapes - TList *fGVolumes; //! list of runtime volumes + TObjArray *fMatrices; //-> list of local transformations + TObjArray *fShapes; //-> list of shapes + TObjArray *fVolumes; //-> list of volumes + TObjArray *fGShapes; //! list of runtime shapes + TObjArray *fGVolumes; //! list of runtime volumes TList *fMaterials; //-> list of materials TList *fMedia; //-> list of tracking media TObjArray *fNodes; //-> current branch of nodes @@ -294,12 +294,12 @@ public: //--- list getters TObjArray *GetListOfNodes() {return fNodes;} TObjArray *GetListOfOverlaps() {return fOverlaps;} - TList *GetListOfMatrices() const {return fMatrices;} + TObjArray *GetListOfMatrices() const {return fMatrices;} TList *GetListOfMaterials() const {return fMaterials;} TList *GetListOfMedia() const {return fMedia;} - TList *GetListOfVolumes() const {return fVolumes;} - TList *GetListOfGVolumes() const {return fGVolumes;} - TList *GetListOfShapes() const {return fShapes;} + TObjArray *GetListOfVolumes() const {return fVolumes;} + TObjArray *GetListOfGVolumes() const {return fGVolumes;} + TObjArray *GetListOfShapes() const {return fShapes;} //--- modeler state getters/setters TGeoNode *GetNode(Int_t level) const {return (TGeoNode*)fNodes->UncheckedAt(level);} @@ -372,7 +372,7 @@ public: fLevel=fCache->GetLevel(); return fCurrentOverlapping;} void PopDummy(Int_t ipop=9999) {fCache->PopDummy(ipop);} - ClassDef(TGeoManager, 3) // geometry manager + ClassDef(TGeoManager, 4) // geometry manager }; R__EXTERN TGeoManager *gGeoManager; diff --git a/geom/src/TGeoManager.cxx b/geom/src/TGeoManager.cxx index d97dd22a78d..59c805b0beb 100644 --- a/geom/src/TGeoManager.cxx +++ b/geom/src/TGeoManager.cxx @@ -1,4 +1,4 @@ -// @(#)root/geom:$Name: $:$Id: TGeoManager.cxx,v 1.46 2003/02/17 11:57:31 brun Exp $ +// @(#)root/geom:$Name: $:$Id: TGeoManager.cxx,v 1.47 2003/02/18 15:37:36 brun Exp $ // Author: Andrei Gheata 25/10/01 /************************************************************************* @@ -484,9 +484,9 @@ void TGeoManager::Init() fStep = 0; fBits = new UChar_t[50000]; // max 25000 nodes per volume fMaterials = new THashList(200,3); - fMatrices = new TList(); + fMatrices = new TObjArray(256); fNodes = new TObjArray(30); - fOverlaps = new TObjArray(); + fOverlaps = new TObjArray(256); fNNodes = 0; fLevel = 0; fPoint = new Double_t[3]; @@ -495,10 +495,10 @@ void TGeoManager::Init() fCldirChecked = new Double_t[3]; fNormal = 0; fCldir = new Double_t[3]; - fVolumes = new THashList(200,3); - fShapes = new THashList(200,3); - fGVolumes = new THashList(200,3); - fGShapes = new THashList(200,3); + fVolumes = new TObjArray(256); + fShapes = new TObjArray(256); + fGVolumes = new TObjArray(256); + fGShapes = new TObjArray(256); fMedia = new THashList(200,3); fTopVolume = 0; fTopNode = 0; @@ -595,8 +595,8 @@ Int_t TGeoManager::AddTransformation(const TGeoMatrix *matrix) Error("AddMatrix", "invalid matrix"); return -1; } - Int_t index = fMatrices->GetSize(); - fMatrices->Add((TGeoMatrix*)matrix); + Int_t index = fMatrices->GetEntriesFast(); + fMatrices->AddAtAndExpand((TGeoMatrix*)matrix,index); return index; } //_____________________________________________________________________________ @@ -607,10 +607,10 @@ Int_t TGeoManager::AddShape(const TGeoShape *shape) Error("AddShape", "invalid shape"); return -1; } - TList *list = fShapes; + TObjArray *list = fShapes; if (shape->IsRunTimeShape()) list = fGShapes;; - Int_t index = list->GetSize(); - list->Add((TGeoShape*)shape); + Int_t index = list->GetEntriesFast(); + list->AddAtAndExpand((TGeoShape*)shape,index); return index; } //_____________________________________________________________________________ @@ -621,10 +621,10 @@ Int_t TGeoManager::AddVolume(TGeoVolume *volume) Error("AddVolume", "invalid volume"); return -1; } - TList *list = fVolumes; + TObjArray *list = fVolumes; if (volume->IsRunTime()) list = fGVolumes; - Int_t index = list->GetSize(); - list->Add((TGeoVolume*)volume); + Int_t index = list->GetEntriesFast(); + list->AddAtAndExpand((TGeoVolume*)volume,index); volume->SetNumber(index); return index; } @@ -2539,7 +2539,7 @@ void TGeoManager::Voxelize(Option_t *option) TGeoVoxelFinder *vox = 0; if (!fStreamVoxels) printf("Voxelizing...\n"); // Int_t nentries = fVolumes->GetSize(); - for (Int_t i=0; i<fVolumes->GetSize(); i++) { + for (Int_t i=0; i<fVolumes->GetEntriesFast(); i++) { vol = (TGeoVolume*)fVolumes->At(i); if (!fIsGeomReading) vol->SortNodes(); if (!fStreamVoxels) { @@ -2911,7 +2911,7 @@ void TGeoManager::CheckOverlaps(Double_t ovlp, Option_t * option) // Check all geometry for illegal overlaps within a limit OVLP. printf("==== Checking overlaps for %s within a limit of %g ====\n", GetName(),ovlp); fSearchOverlaps = kTRUE; - Int_t nvol = fVolumes->GetSize(); + Int_t nvol = fVolumes->GetEntriesFast(); Int_t i10 = nvol/10; Int_t iv=0; TIter next(fVolumes); diff --git a/geom/src/TGeoMatrix.cxx b/geom/src/TGeoMatrix.cxx index ed02f919a7f..02b1085c936 100644 --- a/geom/src/TGeoMatrix.cxx +++ b/geom/src/TGeoMatrix.cxx @@ -1,4 +1,4 @@ -// @(#)root/geom:$Name: $:$Id: TGeoMatrix.cxx,v 1.3 2002/07/10 19:24:16 brun Exp $ +// @(#)root/geom:$Name: $:$Id: TGeoMatrix.cxx,v 1.5 2002/09/27 16:16:06 brun Exp $ // Author: Andrei Gheata 25/10/01 /************************************************************************* @@ -215,9 +215,9 @@ void TGeoMatrix::SetDefaultName() if (IsScale()) type = 's'; if (IsCombi()) type = 'c'; if (IsGeneral()) type = 'g'; - TList *matrices = gGeoManager->GetListOfMatrices(); + TObjArray *matrices = gGeoManager->GetListOfMatrices(); Int_t index = 0; - if (matrices) index =matrices->GetSize() - 1; + if (matrices) index =matrices->GetEntriesFast() - 1; Int_t digits = 1; Int_t num = 10; while ((Int_t)(index/num)) { diff --git a/geom/src/TGeoVolume.cxx b/geom/src/TGeoVolume.cxx index 5d0716c2377..e63d9262383 100644 --- a/geom/src/TGeoVolume.cxx +++ b/geom/src/TGeoVolume.cxx @@ -1,4 +1,4 @@ -// @(#)root/geom:$Name: $:$Id: TGeoVolume.cxx,v 1.27 2003/02/12 14:49:37 brun Exp $ +// @(#)root/geom:$Name: $:$Id: TGeoVolume.cxx,v 1.28 2003/02/17 11:57:31 brun Exp $ // Author: Andrei Gheata 30/05/02 // Divide(), CheckOverlaps() implemented by Mihaela Gheata @@ -1055,7 +1055,8 @@ void TGeoVolumeMulti::AddVolume(TGeoVolume *vol) { // Add a volume with valid shape to the list of volumes. Copy all existing nodes // to this volume - fVolumes->Add(vol); + Int_t idx = fVolumes->GetEntriesFast(); + fVolumes->AddAtAndExpand(vol,idx); TGeoVolumeMulti *div; TGeoVolume *cell; if (fDivision) { diff --git a/test/stressgeom.cxx b/test/stressgeom.cxx index 244be50794a..d6c701a4f45 100644 --- a/test/stressgeom.cxx +++ b/test/stressgeom.cxx @@ -79,9 +79,9 @@ void length() const Double_t mean[16] = {19.3138, 22.7942, 17.975, 21.9554, 23.4203, 16.5027, 14.8842, 9.43152, 12.1661, 8.99384, 9.47465, 7.59458, 8.69, 6.70654, 28.1409, 25.7952}; - TList *vlist = gGeoManager->GetListOfVolumes(); + TObjArray *vlist = gGeoManager->GetListOfVolumes(); TGeoVolume *volume; - Int_t nvolumes = vlist->GetSize(); + Int_t nvolumes = vlist->GetEntriesFast(); Double_t len[17]; TList *hlist = new TList(); TH1F *hist; -- GitLab