]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - AliGeant4/AliDetConstruction.cxx
added tcsh UI
[u/mrichter/AliRoot.git] / AliGeant4 / AliDetConstruction.cxx
index a949ae92fb3532c828f34673c8ef4397c6f2066e..69554a88d4d13e576209b7f91c400e0ff889a2ab 100644 (file)
@@ -1,6 +1,10 @@
 // $Id$
 // Category: geometry
 //
+// Author: I. Hrivnacova
+//
+// Class AliDetConstruction
+// ------------------------
 // See the class description in the header file.
 
 #include "AliDetConstruction.h"
@@ -10,6 +14,7 @@
 #include "AliRun.h"
 #include "AliModule.h"
 
+//_____________________________________________________________________________
 AliDetConstruction::AliDetConstruction()
   : fTopVolumeName("ALIC")
 {
@@ -23,13 +28,13 @@ AliDetConstruction::AliDetConstruction()
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("DIPO",   3, 2, 2, kStructure, false);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("FRAME",  2, 1, 1, kStructure, false);
+  detSwitch = new AliDetSwitch("FRAME",  3, 2, 2, kStructure, false);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("HALL",   1, 0, 0, kStructure);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("MAG",    1, 0, 0, kStructure);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("PIPE",   4, 0, 0, kStructure);
+  detSwitch = new AliDetSwitch("PIPE",   5, 0, 0, kStructure);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("SHIL",   1, 0, 0, kStructure);
   AddDetSwitch(detSwitch); 
@@ -37,9 +42,9 @@ AliDetConstruction::AliDetConstruction()
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("FMD",    2, 0, 0);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("ITS",   10, 7, 7);
+  detSwitch = new AliDetSwitch("ITS",    7, 5, 5);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("MUON",   2, 0, 0);
+  detSwitch = new AliDetSwitch("MUON",   2, 1, 1);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("PHOS",   5, 1, 1);
   AddDetSwitch(detSwitch); 
@@ -59,18 +64,21 @@ AliDetConstruction::AliDetConstruction()
   AddDetSwitch(detSwitch);  
 }
 
+//_____________________________________________________________________________
 AliDetConstruction::AliDetConstruction(const AliDetConstruction& right)
   : AliModulesComposition(right)
 {
   // AliModuleComposition is protected from copying
 }  
 
+//_____________________________________________________________________________
 AliDetConstruction::~AliDetConstruction() {
 //
 }
 
 // operators
 
+//_____________________________________________________________________________
 AliDetConstruction& 
 AliDetConstruction::operator=(const AliDetConstruction& right)
 {
@@ -86,6 +94,7 @@ AliDetConstruction::operator=(const AliDetConstruction& right)
           
 // private methods
 
+//_____________________________________________________________________________
 void AliDetConstruction::BuildDetectors()
 {
 // Create module constructions for AliModules 
@@ -129,6 +138,7 @@ void AliDetConstruction::BuildDetectors()
   SetProcessConfigToModules(false);    
 }
 
+//_____________________________________________________________________________
 void AliDetConstruction::CreateDetectors()
 {
 // Creates AliModules and their module constructions 
@@ -139,14 +149,12 @@ void AliDetConstruction::CreateDetectors()
   AddSingleModuleConstruction("BODY", 0, kStructure);
 
   // add modules constructions
-  const G4RWTPtrOrderedVector<AliDetSwitch>& krDetSwitchVector 
-    = GetDetSwitchVector();
-  for (G4int id=0; id<krDetSwitchVector.entries(); id++)
+  for (G4int id=0; id<fDetSwitchVector.size(); id++)
   {
-    G4String detName = krDetSwitchVector[id]->GetDetName();
-    G4int version = krDetSwitchVector[id]->GetSwitchedVersion();
-    G4bool isStandalone = krDetSwitchVector[id]->IsStandalone();
-    AliModuleType type = krDetSwitchVector[id]->GetType();
+    G4String detName = fDetSwitchVector[id]->GetDetName();
+    G4int version = fDetSwitchVector[id]->GetSwitchedVersion();
+    G4bool isStandalone = fDetSwitchVector[id]->IsStandalone();
+    AliModuleType type = fDetSwitchVector[id]->GetType();
     
     if (version > -1)
       if (isStandalone)
@@ -156,6 +164,7 @@ void AliDetConstruction::CreateDetectors()
   }    
 }
 
+//_____________________________________________________________________________
 void AliDetConstruction::CheckDetDependencies()
 {
 // Checks modules dependencies.
@@ -165,78 +174,67 @@ void AliDetConstruction::CheckDetDependencies()
 // ZDC requires DIPO
 // ---
 
-  const G4RWTPtrOrderedVector<AliDetSwitch>& krDetSwitchVector 
-    = GetDetSwitchVector();
-
   // get switched versions of dependent modules
-  G4int nofDets = krDetSwitchVector.entries();
-  G4int verFRAME = -1; 
-  G4int verDIPO = -1; 
-  G4int verTOF = -1; 
-  G4int verTRD = -1; 
-  G4int verZDC = -1; 
-  AliDetSwitch* detSwitchFRAME = 0;
-  AliDetSwitch* detSwitchDIPO = 0;
-  for (G4int id=0; id<nofDets; id++) {  
-    G4String detName = krDetSwitchVector[id]->GetDetName();
-    if (detName == "FRAME") { 
-      verFRAME = krDetSwitchVector[id]->GetSwitchedVersion();  
-      detSwitchFRAME = krDetSwitchVector[id];
-    }  
-    if (detName == "DIPO") { 
-      verDIPO = krDetSwitchVector[id]->GetSwitchedVersion();  
-      detSwitchDIPO = krDetSwitchVector[id];
-    }  
-    if (detName == "TOF")  
-      verTOF = krDetSwitchVector[id]->GetSwitchedVersion();  
-    if (detName == "TRD")  
-      verTRD = krDetSwitchVector[id]->GetSwitchedVersion();  
-    if (detName == "ZDC")  
-      verZDC = krDetSwitchVector[id]->GetSwitchedVersion();  
-  }
+  G4int verTOF = GetDetSwitch("TOF")->GetSwitchedVersion(); 
+  G4int verTRD = GetDetSwitch("TRD")->GetSwitchedVersion(); 
+  G4int verZDC = GetDetSwitch("ZDC")->GetSwitchedVersion(); 
+  G4int verFRAME = GetDetSwitch("FRAME")->GetSwitchedVersion(); 
   
   // check dependencies  
-  if (verTRD > -1 && verTOF > -1) {
-    // both TRD and TOF 
-    if (verFRAME != 1) {
-      detSwitchFRAME->SwitchOn(1);
+  if (verTOF > -1) {
+    // TOF requires FRAMEv1 - obsolete? 
+    if (verFRAME != 2) {
+      GetDetSwitch("FRAME")->SwitchOn(2);
       G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TOF and TRD require FRAME v1.\n"; 
+      text = text + "    Switched TOF requires FRAME v1.\n"; 
       text = text + "    The det switch for FRAME has been changed."; 
       AliGlobals::Warning(text);
     }  
   }
-  else if (verTRD > -1 && verTOF == -1)   {
-    // only TRD
+  if (verTRD > -1) {
+    // TRD requires FRAME
+    verFRAME = GetDetSwitch("FRAME")->GetSwitchedVersion(); 
     if (verFRAME < 0) {
-      detSwitchFRAME->SwitchOn(1);
+      GetDetSwitch("FRAME")->SwitchOnDefault();
       G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TRD require FRAME.\n"; 
+      text = text + "    Switched TRD requires FRAME.\n"; 
       text = text + "    The det switch for FRAME has been changed."; 
       AliGlobals::Warning(text);
     }  
   }  
-  else if (verTRD == -1 && verTOF > -1)   {
-    // only TOF
-    if (verFRAME != 1) {
-      detSwitchFRAME->SwitchOn(1);
+  if (verZDC > 0) {
+    // ZDC requires PIPE, ABSO, DIPO, SHIL 
+    G4int verPIPE = GetDetSwitch("PIPE")->GetSwitchedVersion(); 
+    G4int verABSO = GetDetSwitch("ABSO")->GetSwitchedVersion(); 
+    G4int verDIPO = GetDetSwitch("DIPO")->GetSwitchedVersion(); 
+    G4int verSHIL = GetDetSwitch("SHIL")->GetSwitchedVersion(); 
+    if ( verPIPE != 1 || verABSO !=0 || verDIPO == -1 || verSHIL == -1) {
       G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TOF requires FRAME v1.\n"; 
-      text = text + "    The det switch for FRAME has been changed."; 
+      text = text + "    Switched ZDC requires PIPE, ABSO, DIPO and SHIL.\n"; 
+      if (verPIPE == -1) {
+        GetDetSwitch("PIPE")->SwitchOnDefault();
+        text = text + "    The det switch for PIPE has been changed.\n"; 
+      }  
+      if (verABSO == -1) {
+        GetDetSwitch("ABSO")->SwitchOnDefault();
+        text = text + "    The det switch for ABSO has been changed.\n"; 
+      }  
+      if (verDIPO == -1) {
+        GetDetSwitch("DIPO")->SwitchOnDefault();
+        text = text + "    The det switch for DIPO has been changed.\n"; 
+      }  
+      if (verSHIL == -1) {
+        GetDetSwitch("SHIL")->SwitchOnDefault();
+        text = text + "    The det switch for SHIL has been changed."; 
+      }  
       AliGlobals::Warning(text);
     }  
-  }
-  if (verZDC > 0 && verDIPO == -1) {
-      detSwitchDIPO->SwitchOnDefault();
-      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched ZDC requires DIPO.\n"; 
-      text = text + "    The det switch for DIPO has been changed."; 
-      AliGlobals::Warning(text);
   }    
 }  
 
 // public methods
 
+//_____________________________________________________________________________
 G4VPhysicalVolume* AliDetConstruction::Construct()
 {
 // Constructs geometry.