er  dev
ERBeamDetSetup.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 #ifndef ERBeamDetSETUP_H
9 #define ERBeamDetSETUP_H
10 
11 #include <map>
12 #include <vector>
13 
14 #include "TString.h"
15 #include <TXMLNode.h>
16 #include "Rtypes.h"
17 #include <TGeoNode.h>
18 
19 using namespace std;
20 
21 #include "ERBeamDetTrack.h"
22 
23 #include "ERSupport.h"
24 
26  float fGlobX;
27  float fGlobY;
28  float fGlobZ;
29  ERBeamDetWire(float xGlob, float yGlob, float zGlob) :
30  fGlobX(xGlob), fGlobY(yGlob), fGlobZ(zGlob) {}
31 };
32 
34 public:
36  ~ERBeamDetSetup();
37  static ERBeamDetSetup* Instance();
38  /* Accessors */
39  static Double_t GetWireGlobX(const TString& digi_branch_name, ERChannel channel);
40  static Double_t GetWireGlobY(const TString& digi_branch_name, ERChannel channel);
41  static Double_t GetWireGlobZ(const TString& digi_branch_name, ERChannel channel);
42  static Bool_t CheckIfTargetIsSet(void) {return fSensitiveTargetIsSet;}
43  static Double_t DistanceBetweenMWPC() {return fDistanceBetweenMWPC;}
44  static Double_t TargetR() {return fTargetR;}
45  static void PrintDetectorParameters(void);
46  static void PrintDetectorParametersToFile(TString fileName);
47  static TString GetToFType(Int_t number);
49  static std::pair<unsigned short, unsigned short> GetMwpcAndPlaneNumbers(const TString& digi_branch_name);
50  /* Modifiers */
51  static void SetXmlParametersFile(TString xmlFileName) {fParamsXmlFileName = xmlFileName;}
52  static void SetSensitiveTarget(void) {fSensitiveTargetIsSet = true;}
53  static void AddMWPC(TString type, Double_t position);
54  static void AddToF(TString type, Double_t position);
58  static void SetMWPCnumberingInvOrderX();
62  static void SetMWPCnumberingInvOrderY();
63  static Int_t GetToFCount() {return fToFCount;}
64  static Double_t GetToFThickness(Int_t tofInd) {return fPlasticZ[tofInd - 1];}
65  static void GetGeoParamsFromParContainer();
66  static Double_t GetDistanceBetweenToF(Int_t tof1Ind, Int_t tof2Ind);
67  static void ConstructGeometry();
68  static Int_t SetParContainers();
69 protected:
73  static void GetTransInMotherNode(TGeoNode const* node, Double_t trans[3]);
74 private:
75  static void ParseXmlParameters();
76  static void GetToFParameters(TXMLNode *node);
77  static void GetMWPCParameters(TXMLNode *node);
78  static Double_t GetWireGlobCoord(const TString& digi_branch_name, ERChannel channel,
79  float ERBeamDetWire::* coord);
80  static ERBeamDetSetup* fInstance;
81  static Bool_t fIsGettingGeoPar;
82  static Int_t fMWPCCount;
83  static Int_t fToFCount;
84  static Double_t fTargetR;
85  static Double_t fDistanceBetweenMWPC;
86  static Double_t fDistanceBetweenToF;
87  static map<Int_t, map<Int_t, map<Int_t, ERBeamDetWire*>>> fWires;
88  // ----- ToF parameters -----------------------------------------------------
89  static vector<Double_t> fPlasticX;
90  static vector<Double_t> fPlasticY;
91  static vector<Double_t> fPlasticZ;
92  static vector<TString> fPlasticMedia;
93  // ----- MWPC parameters ----------------------------------------------------
94  static vector<Double_t> fGasVolX;
95  static vector<Double_t> fGasVolY;
96  static vector<Double_t> fGasVolZ;
97  static vector<Double_t> fGasStripX;
98  static vector<Double_t> fGasStripY;
99  static vector<Double_t> fGasStripZ; //cm
100  static vector<Double_t> fGasPlaneXOffset;
101  static vector<Double_t> fGasPlaneYOffset;
102  static vector<Double_t> fDistBetweenXandY;
103  static vector<Double_t> fCathodeThickness;
104  static vector<Double_t> fKaptonWindowThickness;
105  static vector<Double_t> fAnodeWireDiameter;
106  static vector<TString> fKaptonWindowMedia;
107  static vector<TString> fCathodeMedia;
108  static vector<TString> fAnodeWireMedia;
109  static vector<TString> fGasMedia;
110  static vector<Bool_t> fMWPCInvNumberingOrderX;
111  static vector<Bool_t> fMWPCInvNumberingOrderY;
112  // ------ fPosition of detector's parts relative to zero ---------------------
113  static vector<Double_t> fPositionToF;
114  static vector<Double_t> fPositionMWPC;
115  // -------- Target parameters -----------------------------------------------
116  static Double_t fTargetH2R; //cm
117  static Double_t fTargetH2Z; //cm
118  static Double_t fTargetShellThicknessSide;
119  static Double_t fTargetShellThicknessZ;
120  static Bool_t fSensitiveTargetIsSet;
121  static TString fParamsXmlFileName;
122  static vector<TString> fToFType;
123  static vector<TString> fMWPCType;
124  static Bool_t fGeoFromContainerIsRead;
125  ClassDef(ERBeamDetSetup,1)
126 };
127 #endif
128