]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updated class description: added class name title, author;
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Aug 2001 19:48:31 +0000 (19:48 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Aug 2001 19:48:31 +0000 (19:48 +0000)
method FindLogicalVolume() moved to TG4GeometryServices.

AliGeant4/AliModuleConstruction.cxx
AliGeant4/AliModuleConstruction.h

index 88ef3af144321151b7be73f842ffe7d6734f0613..919ccdb96eb1cd79ca4cff01fb973d3813c12735 100644 (file)
@@ -1,45 +1,47 @@
 // $Id$
 // Category: geometry
 //
+// Author: I. Hrivnacova
+//
+// Class AliModuleConstruction
+// ---------------------------
 // See the class description in the header file.
 
 #include "AliModuleConstruction.h"
-#include "AliModuleConstructionMessenger.h"
 #include "AliGlobals.h"
 #include "AliLVStructure.h"
 #include "AliModule.h"
-
 #ifdef ALICE_VISUALIZE
 #include "AliColourStore.h"
+#endif
+
+#include "TG4GeometryServices.h"
 
-#include <G4Colour.hh>
-#include <G4VisAttributes.hh>
-#endif //ALICE_VISUALIZE
 #include <G4LogicalVolumeStore.hh>
 #include <G4LogicalVolume.hh>
+#ifdef ALICE_VISUALIZE
+#include <G4Colour.hh>
+#include <G4VisAttributes.hh>
+#endif
 
 //_____________________________________________________________________________
-AliModuleConstruction::AliModuleConstruction(G4String moduleName) 
+AliModuleConstruction::AliModuleConstruction(const G4String& moduleName) 
   : fModuleName(moduleName), 
     fModuleFrameName(moduleName),
     fModuleFrameLV(0),
     fAliModule(0),
     fReadGeometry(false),
     fWriteGeometry(false),
-    fDataFilePath("")    
-{
+    fDataFilePath(""),    
+    fMessenger(this, moduleName) {
 //
-  moduleName.toLower();
-  fMessenger = new AliModuleConstructionMessenger(this, moduleName);
 }
 
 //_____________________________________________________________________________
 AliModuleConstruction::AliModuleConstruction(const AliModuleConstruction& right)
+  : fMessenger(this, right.fModuleName)
 {
 //
-  // allocation in assignement operator
-  fMessenger = 0;
-  
   // copy stuff
   *this = right;
 }
@@ -49,12 +51,11 @@ AliModuleConstruction::AliModuleConstruction()
   : fModuleName(""), 
     fModuleFrameName(""),
     fModuleFrameLV(0),
-    fMessenger(0),
     fAliModule(0),
     fReadGeometry(false),
     fWriteGeometry(false),
-    fDataFilePath("")    
-{
+    fDataFilePath(""),    
+    fMessenger(this, "") {
 //
 }
 
@@ -62,7 +63,6 @@ AliModuleConstruction::AliModuleConstruction()
 AliModuleConstruction::~AliModuleConstruction()
 {
 //
-  delete fMessenger;
   delete fAliModule;
 }
 
@@ -82,12 +82,7 @@ AliModuleConstruction::operator=(const AliModuleConstruction& right)
   fReadGeometry = right.fReadGeometry;
   fWriteGeometry = right.fWriteGeometry;
   fDataFilePath = right.fDataFilePath;
-
-  // new messenger
-  if (fMessenger) delete fMessenger;
-  G4String moduleName = fModuleName;
-  moduleName.toLower();
-  fMessenger = new AliModuleConstructionMessenger(this, moduleName);
+  //fMessenger = right.fMessenger;
 
   return *this;
 }
@@ -148,7 +143,8 @@ void AliModuleConstruction::SetDetFrame(G4bool warn)
 // fModuleName is retrieved from G4LogicalVolumeStore.
 // ---
 
-  fModuleFrameLV = FindLogicalVolume(fModuleFrameName, true);
+  fModuleFrameLV 
+    = TG4GeometryServices::Instance()->FindLogicalVolume(fModuleFrameName, true);
   
   if (fModuleFrameLV == 0 && warn) {
     G4String text = "AliModuleConstruction: Detector frame for ";
@@ -207,7 +203,9 @@ void AliModuleConstruction::ListLVTree(G4String lvName)
 // with specified lvName.
 // ---- 
 
-  G4LogicalVolume* lv = FindLogicalVolume(lvName);
+  G4LogicalVolume* lv 
+    = TG4GeometryServices::Instance()->FindLogicalVolume(lvName);
+
   if (lv)
   {
     G4String path = "";
@@ -224,7 +222,9 @@ void AliModuleConstruction::ListLVTreeLong(G4String lvName)
 // with specified lvName with numbers of daughters (physical volumes).
 // ---- 
 
-  G4LogicalVolume* lv = FindLogicalVolume(lvName);
+  G4LogicalVolume* lv 
+    = TG4GeometryServices::Instance()->FindLogicalVolume(lvName);
+
   if (lv) {
     G4String path = "";
     AliLVStructure lvStructure(path);
@@ -233,29 +233,6 @@ void AliModuleConstruction::ListLVTreeLong(G4String lvName)
   }
 }
 
-//_____________________________________________________________________________
-G4LogicalVolume* AliModuleConstruction::FindLogicalVolume(
-                                          G4String name, G4bool silent) const
-{
-// Finds logical volume with specified name in G4LogicalVolumeStore.
-// (To do: use this method only for retrieving detector frame;
-//  add method FindLogicalVolumeInDet - that will search only
-//  in the detector frame LVTree.)
-// ---
-
-  G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
-  
-  for (G4int i=0; i<pLVStore->size(); i++) {
-    G4LogicalVolume* lv = (*pLVStore)[i];
-    if (lv->GetName() == name) return lv;
-  }
-  
-  G4String text = "AliModuleConstruction: Logical volume "; 
-  text = text + name + " does not exist.";
-  if (!silent) AliGlobals::Warning(text);
-  return 0;                     
-}  
-
 #ifdef ALICE_VISUALIZE
 
 //_____________________________________________________________________________
index 668201fd3177f02889127d190cb6f0a316299336..f827b864c95a0849193ee10b2da074f4d9e2bcd9 100644 (file)
@@ -1,6 +1,10 @@
 // $Id$
 // Category: geometry
 //
+// Author: I. Hrivnacova
+//
+// Class AliModuleConstruction
+// ---------------------------
 // Abstract base class for modular construction of geometry,
 // providing methods for browsing geometry (list volumes trees, 
 // visualization).
 #ifndef ALI_MODULE_CONSTRUCTION_H
 #define ALI_MODULE_CONSTRUCTION_H
 
+#include "AliModuleConstructionMessenger.h"
+
 #include <globals.hh>
 
 class AliLVStructure;
-class AliModuleConstructionMessenger;
 class AliModule;
 
 class G4VPhysicalVolume;
@@ -23,7 +28,7 @@ class G4Colour;
 class AliModuleConstruction
 {
   public:
-    AliModuleConstruction(G4String moduleName);
+    AliModuleConstruction(const G4String& moduleName);
     AliModuleConstruction(const AliModuleConstruction& right);
     // --> protected
     // AliModuleConstruction();
@@ -40,8 +45,6 @@ class AliModuleConstruction
     void ListAllLVTreeLong();
     void ListLVTree(G4String lvName);
     void ListLVTreeLong(G4String lvName);
-    G4LogicalVolume* FindLogicalVolume(G4String name, 
-                                       G4bool silent = false) const;
 
     // set methods
     void SetDetFrame(G4bool warn = true);
@@ -88,7 +91,7 @@ class AliModuleConstruction
            AliLVStructure& lvStructure);
 
     // data members
-    AliModuleConstructionMessenger*  fMessenger; //messenger     
+    AliModuleConstructionMessenger  fMessenger; //messenger     
 };
 
 // inline methods