]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - AliGeant4/AliDetConstruction.cxx
updated commands description
[u/mrichter/AliRoot.git] / AliGeant4 / AliDetConstruction.cxx
index c1b303e6eb7951ed7c94b3e519567628d27998e2..a561d6d30e4705783507677d1ba24b68a42aa906 100644 (file)
@@ -1,32 +1,40 @@
 // $Id$
 // Category: geometry
 //
+// Author: I. Hrivnacova
+//
+// Class AliDetConstruction
+// ------------------------
 // See the class description in the header file.
 
 #include "AliDetConstruction.h"
 #include "AliSingleModuleConstruction.h"
+#include "AliDetSwitch.h"
 #include "AliGlobals.h"
 #include "AliRun.h"
 #include "AliModule.h"
 
+//_____________________________________________________________________________
 AliDetConstruction::AliDetConstruction()
   : fTopVolumeName("ALIC")
 {
   // initialize det switch vector: 
-  // moduleName nofVersions defaultVersion [type isStandalone] 
+  // moduleName nofVersions defaultVersion [type isStandalone]     
+        // det switch objects are deleted in
+       // the base class (AliModulesCompositions) destructor
 
   AliDetSwitch* detSwitch;
   detSwitch = new AliDetSwitch("ABSO",   1, 0, kStructure);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("DIPO",   3, 2, kStructure);
+  detSwitch = new AliDetSwitch("DIPO",   3, 2, kStructure, false);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("FRAME",  2, 1, kStructure, false);
+  detSwitch = new AliDetSwitch("FRAME",  3, 2, kStructure, false);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("HALL",   1, 0, kStructure);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("MAG",    1, 0, kStructure);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("PIPE",   4, 0, kStructure);
+  detSwitch = new AliDetSwitch("PIPE",   5, 0, kStructure);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("SHIL",   1, 0, kStructure);
   AddDetSwitch(detSwitch); 
@@ -34,40 +42,43 @@ AliDetConstruction::AliDetConstruction()
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("FMD",    2, 1);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("ITS",    6, 5);
+  detSwitch = new AliDetSwitch("ITS",    7, 5);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("MUON",   2, 0);
+  detSwitch = new AliDetSwitch("MUON",   2, 1);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("PHOS",   5, 1);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("PMD",    3, 0);
+  detSwitch = new AliDetSwitch("PMD",    3, 1);
   AddDetSwitch(detSwitch); 
   detSwitch = new AliDetSwitch("RICH",   3, 1);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("START",  2, 0);
+  detSwitch = new AliDetSwitch("START",  2, 1);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("TOF",    5, 1, kDetector, false);
+  detSwitch = new AliDetSwitch("TOF",    5, 2, kDetector, false);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("TPC",    4, 1);
+  detSwitch = new AliDetSwitch("TPC",    4, 2);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("TRD",    2, 0, kDetector, false);
+  detSwitch = new AliDetSwitch("TRD",    2, 1, kDetector, false);
   AddDetSwitch(detSwitch); 
-  detSwitch = new AliDetSwitch("ZDC",    2, 1);
+  detSwitch = new AliDetSwitch("ZDC",    2, 1, kDetector, false);
   AddDetSwitch(detSwitch);  
 }
 
+//_____________________________________________________________________________
 AliDetConstruction::AliDetConstruction(const AliDetConstruction& right)
   : AliModulesComposition(right)
 {
   // AliModuleComposition is protected from copying
 }  
 
+//_____________________________________________________________________________
 AliDetConstruction::~AliDetConstruction() {
 //
 }
 
 // operators
 
+//_____________________________________________________________________________
 AliDetConstruction& 
 AliDetConstruction::operator=(const AliDetConstruction& right)
 {
@@ -83,6 +94,7 @@ AliDetConstruction::operator=(const AliDetConstruction& right)
           
 // private methods
 
+//_____________________________________________________________________________
 void AliDetConstruction::BuildDetectors()
 {
 // Create module constructions for AliModules 
@@ -126,6 +138,7 @@ void AliDetConstruction::BuildDetectors()
   SetProcessConfigToModules(false);    
 }
 
+//_____________________________________________________________________________
 void AliDetConstruction::CreateDetectors()
 {
 // Creates AliModules and their module constructions 
@@ -136,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)
@@ -153,115 +164,77 @@ void AliDetConstruction::CreateDetectors()
   }    
 }
 
+//_____________________________________________________________________________
 void AliDetConstruction::CheckDetDependencies()
 {
 // Checks modules dependencies.
 // Dependent modules FRAME, TOF, TRD 
 // TOF always requires FRAMEv1
 // TRD can be built with both (??)
+// ZDC requires DIPO
 // ---
 
-  const G4RWTPtrOrderedVector<AliDetSwitch>& krDetSwitchVector 
-    = GetDetSwitchVector();
-
   // get switched versions of dependent modules
-  G4int nofDets = krDetSwitchVector.entries();
-  G4int verFRAME = -1; 
-  G4int verTOF = -1; 
-  G4int verTRD = -1; 
-  AliDetSwitch* detSwitchFRAME = 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 == "TOF")  
-      verTOF = krDetSwitchVector[id]->GetSwitchedVersion();  
-    if (detName == "TRD")  
-      verTRD = 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);
-      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TOF requires FRAME v1.\n"; 
-      text = text + "    The det switch for FRAME has been changed."; 
-      AliGlobals::Warning(text);
-    }  
-  }
-/*  
-  if (verTRD > -1 && verTOF > -1) {
-    // both TRD and TOF 
-    if (verTOF == 2 || verTOF == 3 || verTOF == 5 || verTOF == 6) {
+  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 and TRD require different FRAME versions."; 
-      AliGlobals::Exception(text);
-    }  
-    if (verFRAME != 0) {
-      detSwitchFRAME->SwitchOn(0);
-      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TOF and TRD require FRAME v0.\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);
     }  
-  }
-  else if (verTRD > -1 && verTOF == -1)   {
-    // only TRD
-    if (verFRAME != 0) {
-      detSwitchFRAME->SwitchOn(0);
-      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TRD requires FRAME v0.\n"; 
-      text = text + "    The det switch for FRAME has been changed."; 
-      AliGlobals::Warning(text);
-    }          
-  }  
-  else if (verTRD == -1 && verTOF > -1)   {
-    // only TOF
-    if ((verTOF == 0 || verTOF == 1 || verTOF == 4) && (verFRAME !=0)) {
-      detSwitchFRAME->SwitchOn(0);
-      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TOF requires FRAME v0.\n"; 
-      text = text + "    The det switch for FRAME has been changed."; 
-      AliGlobals::Warning(text);
-    }
-    if ((verTOF == 2 || verTOF == 3 || verTOF == 5 || verTOF == 6) &&
-        (verFRAME != 1)) {
-      detSwitchFRAME->SwitchOn(1);
-      G4String text = "AliDetConstruction::CheckDetDependencies: \n";
-      text = text + "    Switched TOF requires FRAME v1.\n"; 
-      text = text + "    The det switch for FRAME has been changed."; 
-      AliGlobals::Warning(text);
-    }
-  }
-*/    
+  }    
 }  
 
 // public methods
 
+//_____________________________________________________________________________
 G4VPhysicalVolume* AliDetConstruction::Construct()
 {
 // Constructs geometry.