er  dev
ERGeoComponent.h
1 /********************************************************************************
2  * Copyright (C) Joint Institute for Nuclear Research *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence version 3 (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef ERGeoComponent_H
10 #define ERGeoComponent_H
11 
12 #include <list>
13 
14 #include "TString.h"
15 #include "TVector3.h"
16 #include "TGeoMatrix.h"
17 #include "TGeoVolume.h"
18 #include "TGeoMedium.h"
19 
20 #include "ERSupport.h"
21 
22 class ERGeoComponent : public TNamed {
23 public:
24  ERGeoComponent() = default;
25  ERGeoComponent(const TString& name) : TNamed(name, name) {}
26  ERGeoComponent(const TString& name, const TVector3& position, const TVector3& rotation);
27  ERGeoComponent(const TString& typeFromXML, const TString& id);
28  ERGeoComponent(const TString& typeFromXML, const TString& id,
29  const TVector3& position, const TVector3& rotation);
30  /* Modifiers */
31  void SetVolumeNamePrefix(const TString& prefix) {fVolumeName = prefix + fVolumeName;}
32  void SetPosition(const TVector3& position) {fPosition = position; }
33  void SetRotation(const TVector3& rotation);
34  /* Accessors */
35  TGeoVolume* GetVolume() {return fVolume;}
36  const TVector3* GetPosition() const {return &fPosition;}
37  const TGeoRotation* GetRotation() const {return &fRotation;}
38  const TString& GetID() const {return fComponentId;}
39  const TString& GetType() const {return fType;}
40  const TString& GetVolumeName() const {return fVolumeName;}
41  virtual std::list<TString> GetBranchNames(ERDataObjectType object) const = 0;
42  virtual void ConstructGeometryVolume(void) = 0;
43 protected:
44  virtual void ParseXmlParameters() = 0;
45  TGeoMedium* CreateMaterial(const TString& name);
46  TGeoVolume* fVolume = nullptr;
47  TVector3 fPosition;
48  TGeoRotation fRotation;
49  TString fType;
50  TString fComponentId;
51  TString fVolumeName;
52  ClassDef(ERGeoComponent,1)
53 };
54 #endif