Merging the VirtualMC branch to the main development branch (HEAD)
[u/mrichter/AliRoot.git] / AliGeant4 / AliModulesComposition.h
1 // $Id$
2 // Category: geometry
3 //
4 // Author: I. Hrivnacova
5 //
6 // Class AliModulesComposition
7 // ---------------------------
8 // Detector construction base class for building geometry
9 // composed from modules.
10
11 #ifndef ALI_MODULES_COMPOSITION_H
12 #define ALI_MODULES_COMPOSITION_H
13
14 #include "AliModulesCompositionMessenger.h"
15 #include "AliModuleType.h"
16 #include "AliVerbose.h"
17
18 #include <TG4MagneticFieldType.h>
19
20 #include <G4VUserDetectorConstruction.hh>
21 #include <globals.hh>
22 #include <g4std/vector>
23
24 class AliModuleConstruction;
25 class G4MagneticField;
26
27 class G4VPhysicalVolume;
28
29 class AliModulesComposition : public G4VUserDetectorConstruction,
30                               public AliVerbose
31 {
32   typedef G4std::vector<AliModuleConstruction*> AliModuleConstructionVector;
33   
34   public:
35     AliModulesComposition();
36     // --> protected
37     // AliModulesComposition(const AliModulesComposition& right);
38     virtual ~AliModulesComposition();
39
40     // methods
41     virtual G4VPhysicalVolume* Construct() = 0;
42     virtual void GenerateXMLGeometry() const = 0;
43     virtual void PrintMaterials() const;
44
45     // set methods
46     void SetFieldType(TG4MagneticFieldType fieldType);
47     void SetUniformFieldValue(G4double fieldValue);
48     void SetReadGeometry(G4bool readGeometry);
49     void SetWriteGeometry(G4bool writeGeometry);
50     
51   protected:
52     AliModulesComposition(const AliModulesComposition& right);
53
54     // operators
55     AliModulesComposition& operator=(const AliModulesComposition& right);
56
57     // methods  
58     void AddModule(const G4String& name, 
59                    G4int version,
60                    AliModuleType moduleType = kDetector);
61     void ConstructModules();
62     void SetProcessConfigToModules(G4bool processConfig);
63     
64   private:    
65     // methods
66     void CreateMagneticField();
67     void Configure();
68     void CreateG4Geometry();
69     void SetReadGeometryToModules(G4bool readGeometry);
70     void SetWriteGeometryToModules(G4bool writeGeometry);
71
72     // data members
73     AliModulesCompositionMessenger  fMessenger;      //messenger
74     AliModuleConstructionVector     fModuleConstructionVector; //..
75                                         //vector of AliModuleConstruction
76     TG4MagneticFieldType            fMagneticFieldType;//magnetic field type
77     G4MagneticField*   fMagneticField;  //magnetic field
78     G4bool             fReadGeometry;   //option applied to all modules
79     G4bool             fWriteGeometry;  //option applied to all modules     
80 };
81
82 // inline methods
83
84 inline void AliModulesComposition::SetReadGeometry(G4bool readGeometry)
85 { fReadGeometry = readGeometry; }
86
87 inline void AliModulesComposition::SetWriteGeometry(G4bool writeGeometry)
88 { fWriteGeometry = writeGeometry; }
89
90 #endif //ALI_MODULES_COMPOSITION_H
91