|
| 1 | +#ifndef WCSimDetectorConstruction_H |
| 2 | +#define WCSimDetectorConstruction_H 1 |
| 3 | + |
| 4 | +#include "G4Transform3D.hh" |
| 5 | +#include "G4VUserDetectorConstruction.hh" |
| 6 | +#include "G4LogicalVolume.hh" |
| 7 | +#include "G4VPhysicalVolume.hh" |
| 8 | +#include "G4OpticalSurface.hh" |
| 9 | +#include "globals.hh" |
| 10 | + |
| 11 | +#include <fstream> |
| 12 | +#include <map> |
| 13 | +//#include <hash_map.h> |
| 14 | +// warning : hash_map is not part of the standard |
| 15 | +#include <ext/hash_map> |
| 16 | + |
| 17 | + |
| 18 | +using __gnu_cxx::hash; |
| 19 | +using __gnu_cxx::hashtable; |
| 20 | +using __gnu_cxx::hash_map; |
| 21 | +using __gnu_cxx::hash_multimap; |
| 22 | + |
| 23 | +// (JF) We don't need this distinction for DUSEL |
| 24 | +//enum cyl_location {endcap1,wall,endcap2}; |
| 25 | + |
| 26 | +class G4Box; |
| 27 | +class G4Tubs; |
| 28 | +class G4Material; |
| 29 | +class G4LogicalVolume; |
| 30 | +class G4AssemblyVolume; |
| 31 | +class G4VPhysicalVolume; |
| 32 | +class WCSimTuningParameters; |
| 33 | +class WCSimDetectorMessenger; |
| 34 | +class WCSimWCSD; |
| 35 | + |
| 36 | +namespace __gnu_cxx { |
| 37 | + template<> struct hash< std::string > |
| 38 | + { |
| 39 | + size_t operator()( const std::string& x ) const |
| 40 | + { |
| 41 | + return hash< const char* >()( x.c_str() ); |
| 42 | + } |
| 43 | + }; |
| 44 | +} |
| 45 | + |
| 46 | +class WCSimDetectorConstruction : public G4VUserDetectorConstruction |
| 47 | +{ |
| 48 | +public: |
| 49 | + |
| 50 | + WCSimDetectorConstruction(G4int DetConfig,WCSimTuningParameters* WCSimTuningPars); |
| 51 | + ~WCSimDetectorConstruction(); |
| 52 | + |
| 53 | + G4VPhysicalVolume* Construct(); |
| 54 | + |
| 55 | + // Related to the WC geometry |
| 56 | + void SetSuperKGeometry(); |
| 57 | + void DUSEL_100kton_10inch_40perCent(); |
| 58 | + void DUSEL_100kton_10inch_HQE_30perCent(); |
| 59 | + void DUSEL_100kton_10inch_HQE_30perCent_Gd(); |
| 60 | + void DUSEL_150kton_10inch_HQE_30perCent(); |
| 61 | + void UpdateGeometry(); |
| 62 | + |
| 63 | + //Related to MailBox Geometry aah |
| 64 | + void SetMailBox100kTGeometry(); |
| 65 | + void SetMailBox150kTGeometry_10inch_HQE_30perCent(); |
| 66 | + void SetMailBox150kTGeometry_10inch_40perCent(); |
| 67 | + void SetMailBox300kTGeometry(); |
| 68 | + G4double WC_MB_Fid_Length,WC_MB_Fid_Width,WC_MB_Fid_Depth; //Fiducial Volume sizes--note, this "fiducial" should probably be called the "active volume". The PMT's are just outside. |
| 69 | + G4double WC_MB_Tank_Airgap, WC_MB_Dome_Height_fraction,WC_MB_Veto_Thickness,WC_MB_Buffer_Thickness;// Dimensions to determine WaterTank and Cavern Sizes (Veto may or may not be actual veto detector),WC_MB_Buffer_Thickness is distance between wall to PMT top |
| 70 | + //End of Mailbox Variables |
| 71 | + |
| 72 | + |
| 73 | + G4double GetWaterTubeLength() {return WCLength;} |
| 74 | + G4double GetWaterTubePosition() {return WCPosition;} |
| 75 | + G4double GetPMTSize() {return WCPMTRadius;} |
| 76 | + G4String GetPMTName() {return WCPMTName;} |
| 77 | + G4int GetMyConfiguration() {return myConfiguration;} |
| 78 | + |
| 79 | + // Related to the WC tube IDs |
| 80 | + static G4int GetTubeID(std::string tubeTag){return tubeLocationMap[tubeTag];} |
| 81 | + static G4Transform3D GetTubeTransform(int tubeNo){return tubeIDMap[tubeNo];} |
| 82 | + |
| 83 | + // Related to Pi0 analysis |
| 84 | + G4bool SavePi0Info() {return pi0Info_isSaved;} |
| 85 | + void SavePi0Info(G4bool choice) {pi0Info_isSaved=choice;} |
| 86 | + |
| 87 | + // Geometry options |
| 88 | + void SetIsUpright(G4bool choice) {isUpright = choice;} |
| 89 | + void SetIsMailbox(G4bool choice) {isMailbox = choice;} |
| 90 | + G4bool GetIsMailbox() {return isMailbox;} |
| 91 | + |
| 92 | +private: |
| 93 | + |
| 94 | + // Tuning parameters |
| 95 | + |
| 96 | + WCSimTuningParameters* WCSimTuningParams; |
| 97 | + |
| 98 | + // Sensitive Detectors. We declare the pointers here because we need |
| 99 | + // to check their state if we change the geometry. |
| 100 | + |
| 101 | + WCSimWCSD* aWCPMT; |
| 102 | + |
| 103 | + //Water, Blacksheet surface |
| 104 | + G4OpticalSurface * OpWaterBSSurface; |
| 105 | + |
| 106 | + //Glass, Cathode surface in PMTs |
| 107 | + |
| 108 | + G4OpticalSurface * OpGlassCathodeSurface; |
| 109 | + |
| 110 | + |
| 111 | + // The messenger we use to change the geometry. |
| 112 | + |
| 113 | + WCSimDetectorMessenger* messenger; |
| 114 | + |
| 115 | + // The Construction routines |
| 116 | + G4LogicalVolume* ConstructMailboxWC(); |
| 117 | + G4LogicalVolume* ConstructWC(); |
| 118 | + void ConstructPMT(); |
| 119 | + |
| 120 | + void ConstructMaterials(); |
| 121 | + |
| 122 | + G4bool WCAddGd; |
| 123 | + |
| 124 | + // Code for traversing the geometry and assigning tubeIDs. |
| 125 | + |
| 126 | + // First make a typedef for the pointer to the member fcn. The |
| 127 | + // syntax is too wacked out to be using all over. |
| 128 | + |
| 129 | + typedef void (WCSimDetectorConstruction::*DescriptionFcnPtr) |
| 130 | + (G4VPhysicalVolume*, int, int, const G4Transform3D&); |
| 131 | + |
| 132 | + // Now Funcs for traversing the geometry |
| 133 | + void TraverseReplicas(G4VPhysicalVolume*, int, const G4Transform3D&, |
| 134 | + DescriptionFcnPtr); |
| 135 | + |
| 136 | + void DescribeAndDescendGeometry(G4VPhysicalVolume*, int, int, |
| 137 | + const G4Transform3D&, DescriptionFcnPtr); |
| 138 | + |
| 139 | + // Functions that the traversal routines call or we use to manipulate the |
| 140 | + // data we accumulate. |
| 141 | + void DumpGeometryTableToFile(); |
| 142 | + |
| 143 | + void PrintGeometryTree(G4VPhysicalVolume*, int, int, const G4Transform3D&); |
| 144 | + void DescribeAndRegisterPMT(G4VPhysicalVolume*, int, int, |
| 145 | + const G4Transform3D&); |
| 146 | + void DescribeAndRegisterPMT_1KT(G4VPhysicalVolume*, int, int, |
| 147 | + const G4Transform3D&); |
| 148 | + void GetWCGeom(G4VPhysicalVolume*, int, int, |
| 149 | + const G4Transform3D&); |
| 150 | + |
| 151 | + //---Volume lengths |
| 152 | + |
| 153 | + // These are shared between the different member functions |
| 154 | + // constructWC, constructFGD, constructlArD, constuctMRD |
| 155 | + // toggle between FGD(0) and lArD(1) |
| 156 | + // toggle between lArD readout types |
| 157 | + // toggle between MRDScint and MRDk2k |
| 158 | + |
| 159 | + G4bool pi0Info_isSaved; |
| 160 | + |
| 161 | + G4double WCLength; |
| 162 | + |
| 163 | + G4double WCPosition; |
| 164 | + |
| 165 | + // WC PMT parameters |
| 166 | + G4String WCPMTName; |
| 167 | + G4double sphereRadius; |
| 168 | + G4double PMTOffset; |
| 169 | + G4LogicalVolume* logicWCPMT; |
| 170 | + G4LogicalVolume* logicGlassFaceWCPMT; |
| 171 | + |
| 172 | + // WC geometry parameters |
| 173 | + |
| 174 | + G4double WCPMTRadius; |
| 175 | + G4double WCPMTExposeHeight; |
| 176 | + G4double WCPMTGlassThickness; |
| 177 | + G4double WCBarrelPMTOffset; |
| 178 | + |
| 179 | + G4double WCIDDiameter; |
| 180 | + |
| 181 | + G4double WCCapLength; |
| 182 | + G4double WCBackODLength; |
| 183 | + G4double WCFrontODLength; |
| 184 | + G4double WCIDHeight; |
| 185 | + |
| 186 | + G4double WCBarrelRingRadius; |
| 187 | + |
| 188 | + G4double WCBarrelRingNPhi; |
| 189 | + G4double WCBarrelNRings; |
| 190 | + G4double WCPMTperCellHorizontal; |
| 191 | + G4double WCPMTperCellVertical; |
| 192 | + |
| 193 | + G4double WCPMTPercentCoverage; |
| 194 | + |
| 195 | + G4double WCBarrelNumPMTHorizontal; |
| 196 | + G4double WCCapPMTSpacing; |
| 197 | + G4double WCCapEdgeWidth;//jh TODO: not used |
| 198 | + |
| 199 | + G4double WCCapEdgeLimit; |
| 200 | + G4double WCBlackSheetThickness; |
| 201 | + |
| 202 | + //for 1kt |
| 203 | + G4double WCDiameter; |
| 204 | + G4double WCRadius; |
| 205 | + G4double WCBarrelPMTRadius; |
| 206 | + G4double WCBarrelRingdPhi; |
| 207 | + G4double WCBarrelCellLength; |
| 208 | + G4double WCCapNCell; |
| 209 | + G4double WCBarrelLength; |
| 210 | + |
| 211 | + // amb79: to universally make changes in structure and geometry |
| 212 | + bool isUpright, isMailbox; |
| 213 | + |
| 214 | + |
| 215 | + // amb79: debug to display all parts |
| 216 | + bool debugMode; |
| 217 | + |
| 218 | + // Variables related to the geometry |
| 219 | + |
| 220 | + std::ofstream geoFile; // File for text output |
| 221 | + |
| 222 | + G4int totalNumPMTs; // The number of PMTs for this configuration |
| 223 | + G4double WCCylInfo[2]; // Info for the geometry tree: radius & length |
| 224 | + G4double WCPMTSize; // Info for the geometry tree: pmt size |
| 225 | + G4ThreeVector WCOffset; // Info for the geometry tree: WC center offset |
| 226 | + |
| 227 | + // Tube map information |
| 228 | + |
| 229 | + static std::map<int, G4Transform3D> tubeIDMap; |
| 230 | +// static std::map<int, cyl_location> tubeCylLocation; |
| 231 | + static hash_map<std::string, int, hash<std::string> > tubeLocationMap; |
| 232 | + |
| 233 | + // Variables related to configuration |
| 234 | + |
| 235 | + G4int myConfiguration; // Detector Config Parameter |
| 236 | + |
| 237 | +}; |
| 238 | + |
| 239 | +#endif |
| 240 | + |
0 commit comments