er  dev
ERTelescopeSetup.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 ERTelescopeSetup_H
10 #define ERTelescopeSetup_H
11 
12 #include "ERSetup.h"
13 
14 #include "TString.h"
15 #include <TXMLNode.h>
16 #include "Rtypes.h"
17 #include "TVector3.h"
18 #include "TGeoMatrix.h"
19 
21  Double_t fGlobalX = -1.;
22  Double_t fGlobalY = -1.;
23  Double_t fGlobalZ = -1.;
24  Double_t fLocalX = -1.;
25  Double_t fLocalY = -1.;
26  Double_t fLocalZ = -1.;
27  Double_t fWidth = -1.;
28  ERTelescopeStrip() = default;
29  ERTelescopeStrip(Double_t globalX, Double_t globalY, Double_t globalZ,
30  Double_t localX, Double_t localY, Double_t localZ,
31  Double_t width);
32  ERTelescopeStrip(Double_t* globTrans, Double_t* localTrans, Double_t width);
33 };
34 
36  Double_t fPhi = -1.;
37  Double_t fR = -1.;
38  ERRTelescopeStrip() = default;
39  ERRTelescopeStrip(const Double_t phi, const Double_t r) : fPhi(phi), fR(r) {}
40 };
41 
42 class ERTelescopeSetup : public ERSetup {
43 public:
44  enum StationType {QStation, RStation};
45  virtual ~ERTelescopeSetup() = default;
46  static ERTelescopeSetup* Instance();
47  /* Modifiers */
48  /* Accessors */
49  Double_t GetStripGlobalX(const TString& componentBranchName, Int_t stripNb) const;
50  Double_t GetStripGlobalY(const TString& componentBranchName, Int_t stripNb) const;
51  Double_t GetStripGlobalZ(const TString& componentBranchName, Int_t stripNb) const;
52  Double_t GetStripLocalX(const TString& componentBranchName, Int_t stripNb) const;
53  Double_t GetStripLocalY(const TString& componentBranchName, Int_t stripNb) const;
54  Double_t GetStripLocalZ(const TString& componentBranchName, Int_t stripNb) const;
55  Double_t GetStripPhi(const TString& componentBranchName, Int_t stripNb) const;
56  Double_t GetStripR(const TString& componentBranchName, Int_t stripNb) const;
57  TVector3 GetStationTranslation(const TString& componentBranchName) const;
58  Double_t GetStripWidth(TString componentBranchName, Int_t stripNb) const;
59  TVector3 GetStripLocalPosition(const TString& componentBranchName,
60  unsigned int stripNb) const;
61  TVector3 ToStationCoordinateSystem(const TString& componentBranchName,
62  const TVector3& vectorInGlobalCS) const;
63  TVector3 ToGlobalCoordinateSystem(const TString& componentBranchName,
64  const TVector3& vectorInStationCS) const;
65  StationType GetStationType(const TString& componentBranchName) const;
66 
67 public:
68  virtual void ReadGeoParamsFromParContainer();
69  // static void PrintDetectorParameters(void);
70  // static void PrintDetectorParametersToFile(TString fileName);
71 private:
72  ERTelescopeSetup() = default;
73  void GetTransInMotherNode (TGeoNode const* node, Double_t b[3]);
74  void FillRStrips(TGeoNode* r_station, const TString& branch_name);
75  std::map<TString, std::vector<ERTelescopeStrip>> fStrips;
76  std::map<TString, std::vector<ERRTelescopeStrip>> fRStrips;
77  std::map<TString, TGeoHMatrix> fStationGlobalToLocalMatrixies;
78  std::map<TString, StationType> fStationTypes;
79  static ERTelescopeSetup* fInstance;
80  bool fGeometryInited = false;
81  ClassDef(ERTelescopeSetup,1)
82 };
83 #endif