LBNEDetectorConstruction.hh
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // $Id: LBNEDetectorConstruction.hh,v 1.5.2.22 2013/12/24 20:30:22 lebrun Exp $
3 //---------------------------------------------------------------------------//
4 
5 #ifndef LBNEDetectorConstruction_H
6 #define LBNEDetectorConstruction_H 1
7 
8 #include <vector>
9 
10 #include "G4VUserDetectorConstruction.hh"
11 #include "globals.hh"
12 #include "G4ThreeVector.hh"
13 #include "G4RotationMatrix.hh"
14 #include "G4UImessenger.hh"
15 #include "G4UIdirectory.hh"
16 #include "G4UIcmdWithABool.hh"
17 #include "G4UIcmdWithADoubleAndUnit.hh"
18 #include "LBNEVolumePlacements.hh"
19 #include "G4Element.hh"
20 
21 class G4VSolid;
22 class G4LogicalVolume;
23 class G4VPhysicalVolume;
24 class G4Material;
25 class G4VisAttributes;
26 
27 class LBNEMagneticField;
28 class LBNEMagneticFieldIC;
29 class LBNEMagneticFieldOC;
30 // After discussing how to support LBNFnano, we might uncomment the line with "LBNFNano" variables.
31 // Actually, having declared should not cuase problems
32 class LBNFNanoMagneticField;
33 
34 class LBNEDetectorConstruction : public G4VUserDetectorConstruction
35 {
36 public:
37 
40 
41  // We will construct the conventional HEP LBNF nano detector using
42  // standard G4 Hits.. Hence, this.
43  // For LBNF Nano..
44  // virtual void ConstructSDandField();
45 
46  void Initialize();
47 
48  G4VPhysicalVolume* Construct();
49 
50  void CheckOverlaps();
51 
52  void InitializeSubVolumes();
53  void InitializeMaterials();
55  void SetSimulationType(G4String val) { fSimulationType = val; }
56  void SetBeamlineAngle(G4double angle) { fBeamlineAngle = angle; }
57  inline G4double GetBeamlineAngle() const { return fBeamlineAngle; }
59  G4LogicalVolume* GetMuonDetectorLogical(){ return TrackingPlaneLogical; }
62  G4LogicalVolume* GetHadronMonitorLogical(){ return hadronMonitorLogical; }
63  G4LogicalVolume* GetHorn1PlaneLogical(){ return TrackingPlaneH1Logical;} //Amit Bashyal
64  G4LogicalVolume* GetHorn2PlaneLogical(){return TrackingPlaneH2Logical;} //Amit Bashyal
65  G4LogicalVolume* GetDecayPipePlaneLogical(){return TrackingPlaneDPLogical;} //Amit Bashyal
66  bool HasBeenConstructed() const {return fHasBeenConstructed; }
67 
68  //Set boolean for simple geometry of Absorber
69  void SetConstructSimpAbsorber(G4bool aBool) { fConstructSimpAbsorber = aBool; }
70  //Set boolean for simple geometry of Absorber
72  //Disable construction of the spoiler
73  void SetDisableSpoiler(G4bool aBool){ fDisableSpoiler = aBool;}
74  //Disable scalloping on aluminum layers
75  void SetDisableSculptedLayers(G4bool aBool){ fDisableSculptedLayers = aBool;}
76  //Disable adding the mask layers
77  void SetDisableMask(G4bool aBool){ fDisableMask = aBool;}
78  //Expand the Al core layers to 2.5x2.5 m
79  void SetExpandAlLayers(G4bool aBool){ fExpandAlLayers = aBool;}
80  //Remove layers from the downstream end of the absorber
81  void SetRemoveLayers(G4int anInt){ fRemoveLayers = anInt;}
82 
83 private:
84 
85  bool fHasBeenConstructed; // The construct method has been called (only once per run...)
86 
87  // Geometric instantiations
89 
90  // Horn current value
91  G4double fHornCurrent;
92  G4double fSkinDepthInnerRad; // For systematic uncertainties on the Horn1 current
93  std::vector<double> fDeltaEccentricityIO; // For systematic transverse shift of the Inner vs Outer Conductor.
94  std::vector<double> fDeltaEllipticityI; // For systematic due to deformation of Inner conductor.
95  std::vector<double> fCurrentEqualizerLongAbsLength; // For systematic studies of imperfect current equaliztion sections.
96  std::vector<double> fCurrentEqualizerQuadAmpl; //
97  std::vector<double> fCurrentEqualizerOctAmpl; //
98  std::vector<double> fCurrentMultiplier; //
99  std::vector<std::string> fFileNameFieldMapForCE; // file name from pre-build maps.
100 
101  // Dimensions of (world-volume) pertinent features
102  G4double fRockRadius;
103  G4double fRockLength;
104  G4double fRockX;
105  G4double fRockY;
106  G4double fRockZ;
107  G4double fBeamlineAngle;
109  G4double fTargetHallX;
110  G4double fTargetHallY;
111  G4double fTargetHallZ;
115  G4double fDecayHallZ;
116  G4double fAbsorberHallX;
117  G4double fAbsorberHallY;
118  G4double fAbsorberHallZ;
119  // Flags that can be set by messenger
121  G4String fSimulationType;
128  int fRemoveLayers;//remove DS layers in the sculpted absorber
129  // Define steel, concrete downstream width of absorber and simple geometry variables
132 
133  void PrintDetectorGeometry();
134  void PrintDetectorGeometry(const G4String &desc,
135  const G4String &name);
136  void GetWorldTransformation(G4VPhysicalVolume *physvol,
137  G4RotationMatrix &WorldRotation,
138  G4ThreeVector &WorldTranslation);
139  void PrintSolidDescription(const G4VSolid *solidvol,
140  const G4LogicalVolume *logvol,
141  G4RotationMatrix &WorldRotation,
142  G4ThreeVector &WorldTranslation);
143 //
144 // New v3.x construction.
145 //
146  void ConstructUpstreamTarget(G4PVPlacement *phys);
147 
148 //
149 //LBNE stuff
150 
151  void ConstructLBNEHadronAbsorberSimple(G4VPhysicalVolume* vPhys); //simpler absorber
152  void ConstructLBNEHadronAbsorberSculpted(G4VPhysicalVolume* vPhys); //simpler absorber
153  void ConstructLBNEHadronAbsorber(G4VPhysicalVolume* vPhys);
154  void ConstructLBNEShieldingHorn1(G4VPhysicalVolume* vPhys); // And target
155  void ConstructLBNEShieldingHorn2(G4PVPlacement* vPhys);
156  void ConstructLBNEShieldingBetweenHorns(G4VPhysicalVolume* tunnel);
157  void ConstructLBNFShielding(G4VPhysicalVolume* vPhys); // And target
159  void ConstructLBNEHorn1TrackingPlane(G4VPhysicalVolume* tunnel); //Amit Bashyal
160  void ConstructLBNEHorn2TrackingPlane(G4VPhysicalVolume* tunnel); //Amit Bashyal
161  void ConstructLBNEDecayPipeTrackingPlane(G4VPhysicalVolume* tunnel); //Amit Bashyal
166 
167  G4RotationMatrix fRotBeamlineAngle;
168 
170  void ConstructLBNETarget();
171 
172  void ConstructLBNEHorns();
177  void ConstructLBNEHorn(G4int nhorn, G4int nparts, G4int jstart);
178  G4double LBNEphornRgivenZ(G4double a, G4double b, G4double c, G4double z);
179 
180  void DropMarsTargetHorns(G4VPhysicalVolume *mother);
181 //
182 //
183 
184 
185 //
186 //Specifically Exact Numi Target
187 //This automatically constructs the NUMI baffle and budal monitor
188  void ConstructNUMITarget(); //budal mon is constructed in this function
189  void ConstructNUMIBaffle();
190 //
191 //
192 
193  ///use for testing gometry stuff
194  void ConstructTesting();
195 
196 
198 
199 
200 //
201  G4int GetMaterialCode(const G4String &matName);
202  G4Material* GetMaterial(G4String matName);
203  G4VisAttributes* GetMaterialVisAttrib(G4String matName);
204  void DestroyMaterials();
205 
206  // Messenger
207  G4UImessenger *fDetectorMessenger;
208  // elements pointers
209  G4Element *elC;
210  G4Element *elN;
211  G4Element *elO;
212  G4Element *elFe;
213 
214  // Materials
215  G4Material* Vacuum;
216  G4Material* DecayPipeVacuum;
217  G4Material* NumiDecayPipeHelium;
218  G4Material* Air;
219  G4Material* Water;
220  G4Material* He;
221  G4Material* Beryllium;
222  G4Material* C;
223  G4Material* Al;
224  G4Material* Ar;
225  G4Material* Pb;
226  G4Material* Fe;
227  G4Material* CT852;
228  G4Material* Steel316;
229  G4Material* TitaniumG5;
230  G4Material* Titanium;
231  G4Material* Concrete;
232  G4Material* Shotcrete;
233  G4Material* Rebar_Concrete;
234  G4Material* Target;
235  G4Material* HeliumTarget;
236  G4Material* DolomiteRock;
237  G4Material* DoloStone;
238  G4Material* MaqShale;
239  G4Material* Chert;
240  G4Material* Pyrite;
241  G4Material* MaqSiltstone;
242  G4Material* var_Al;
243  G4Material* var_Stl;
244  G4Material* Slab_Stl;
245  G4Material* Blu_Stl;
246  G4Material* n1018_Stl;
247  G4Material* A500_Stl;
248  G4Material* M1018_Stl;
249  G4Material* Alumina;
250  G4Material* HeGas;
251  G4Material* Drywall;
252  G4Material* Paraffin;
253  G4Material* graphiteBaffle;
254  G4Material* DefaultMaterial;
255 
256 
257 
258  // Logical volumes
259  //
260  G4LogicalVolume* ROCK_log;
261  G4LogicalVolume* TRGT_lv;
262  // G4LogicalVolume* lvTUNE;
263  G4LogicalVolume* BLK_log[100];
264  G4LogicalVolume* CShld_log[16];
265  G4LogicalVolume* TGAR_log;
266  G4LogicalVolume* Horn_PM_lv[8];
267  G4LogicalVolume* LVCPipe[20];
268  G4LogicalVolume* LVCPipeW[20];
269  G4LogicalVolume* HadrBox_log;
270  G4LogicalVolume* ShldBox_log;
271  G4LogicalVolume* PreTrackingPlaneLogical;
272  G4LogicalVolume* TrackingPlaneLogical;
273  //second tracking plane logical volume
274  G4LogicalVolume* SecondTrackingPlaneLogical;
275  //for Stopped Muon Detection
276  G4LogicalVolume* StoppedMuonDetectorLogical;
277  G4LogicalVolume* hadronMonitorLogical;
278  G4LogicalVolume* TrackingPlaneH1Logical;
279  G4LogicalVolume* TrackingPlaneH2Logical;
280  G4LogicalVolume* TrackingPlaneDPLogical;
281  // Physical volumes
282  //
283  G4VPhysicalVolume* fRock;
284  G4VPhysicalVolume* fRvTUNE;
285  G4VPhysicalVolume* TGAR;
286  G4VPhysicalVolume* TRGT;
287  G4VPhysicalVolume* PHORN[8];
288  G4VPhysicalVolume* PVCPipe[20];
289  G4VPhysicalVolume* CNT[20];
290  G4VPhysicalVolume* HadrBox;
291  G4VPhysicalVolume* ShldBox;
292 
293  //Solids
294  //
295  G4VSolid* BLK_solid[100];
296  G4VSolid* CShld_solid[16];
297  G4VSolid* Horn_PM[8];
298 
299  //
300  // For the implementation of perfect focusing. : The z coord where it is applied.
301  // Default value is very large (but a valid double precision)
302  //
304  mutable double fRCoordOutOfTarget; // Mutable, because set as we are building the geometry..
305  //
306  // August, Sept 2016. Start constructing the propose LBNFNano Spectrometer.
307  //
316  double fLengthUpstrLBNFNanoMagnet; // Needed to establish the 1rst order field map.
322  G4LogicalVolume *fLBNFNanoLogVol;
323  // To be transfered to the output file....
324  std::vector<std::pair<char, double> > fSiliconPlaneDataLBNFNano;
325  LBNFNanoMagneticField *fLBNFNanoMagneticField;
326 
327  public:
328 
329  inline void SetHornCurrent(G4double val) { fHornCurrent = val; }
330  inline double GetHornCurrent() const {return fHornCurrent; }
331  inline void SetSkinDepthInnerRad(G4double val) { fSkinDepthInnerRad = val; }
332  inline void SetDeltaEccentricityIO(size_t kH, G4double val) { if (kH < 3) fDeltaEccentricityIO[kH] = val;}
333  inline void SetDeltaEllipticityI(size_t kH, G4double val) { if (kH < 3) fDeltaEllipticityI[kH] = val;}
334 
335  inline void SetZCoordForPerfectFocusing(double z) {fZCoordForPerfectFocusing = z;}
337  inline void SetRCoordOutOfTarget(double r) const {fRCoordOutOfTarget = r;} // Pseudo Const, G4User inheritance too strict..
338  inline double GetRCoordOutOfTarget() const {return fRCoordOutOfTarget;}
339  inline LBNFNanoMagneticField* GetLBNFNanoMagneticField () const { return fLBNFNanoMagneticField;}
340 
341  // Define downstream width of concrete and steel for simple geometry of absorber
342  inline void SetDwStrAbsConcreteWidth(G4double l) { fDwStrAbsConcreteWidth = l;}
343  inline void SetDwStrAbsSteelWidth(G4double l) { fDwStrAbsSteelWidth = l;}
344 
345  inline double GetDwStrAbsConcreteWidth() const { return fDwStrAbsConcreteWidth;}
346  inline double GetDwStrAbsSteelWidth() const { return fDwStrAbsSteelWidth;}
347 
348  inline void SetCurrentEqualizerLongAbsLength(size_t kH, double v) {if (kH < 3) fCurrentEqualizerLongAbsLength[kH] = v;}
349  inline void SetCurrentEqualizerQuadAmpl(size_t kH, double v) {if (kH < 3) fCurrentEqualizerQuadAmpl[kH] = v;}
350  inline void SetFileNameFieldMapForCE(size_t kH, std::string s)
351  {if (kH < 3) fFileNameFieldMapForCE[kH] = s;}
352  inline void SetCurrentEqualizerOctAmpl(size_t kH, double v) {if (kH < 3) fCurrentEqualizerOctAmpl[kH] = v;}
353  inline void SetCurrentMultipiler(size_t kH, double v) {if (kH < 3) fCurrentMultiplier[kH] = v;}
354  //
355  // August, Sept/Oct 2016. Start constructing the propose LBNFNano Spectrometer.
356  // Not ready for prime time, unless we plane the entire LBNFNano code
357  //
358  /*
359  inline void SetConstructLBNFNano(bool t) {
360  fConstructLBNFNano = t;
361  if (t) {
362  fInstallLBNFNanoUpstreamMicroStrip = true;
363  fInstallLBNFNanoMiddleMicroStrip = true;
364  fInstallLBNFNanoDownstreamMicroStrip = true;
365  fInstallLBNFNanoMagnetUpstr = true;
366  fInstallLBNFNanoMagnetDwnstr = true;
367  fInstallLBNFNanoCerenkov = false;
368  fInstallLBNFNanoCalorimeter = false;
369  }
370  }
371  inline bool GetConstructLBNFNano() const { return fConstructLBNFNano; }
372  inline double GetZEndofLBNFNano() const {
373  LBNEVolumePlacements* volP=LBNEVolumePlacements::Instance();
374  return (100.0 + volP->GetLBNFNanoPosition()[2] + 0.5*fLengthUpstrLBNFNanoMagnet);
375  } // Approximate.. This is the end of the chase.
376 
377  inline size_t GetNumSiliconPlane() const { return fSiliconPlaneDataLBNFNano.size(); }
378  inline char GetSilPlaneOrientLBNFNano(size_t k) const {
379  if (k >= fSiliconPlaneDataLBNFNano.size()) return '?';
380  return fSiliconPlaneDataLBNFNano[k].first;
381  }
382  inline double GetSilPlaneZPosLBNFNano(size_t k) const {
383  if (k >= fSiliconPlaneDataLBNFNano.size()) return '?';
384  return fSiliconPlaneDataLBNFNano[k].second;
385  }
386  //
387  // To be used to digitize.. Possibly, fiducial cuts. Takes the largest, assumed to be the Downstream one.
388  inline double GetXWidthDwnstrLBNFNanoField() const { return fXWidthDwnstrLBNFNanoField; }
389  inline double GetYWidthDwnstrLBNFNanoField() const { return fYWidthDwnstrLBNFNanoField; }
390  */
391  private:
392  void checkMaterialInHAGDML(const G4LogicalVolume *lVol) const;
393  void DoConstructLBNFNano();
394 };
395 #endif
396 
static QCString name
Definition: declinfo.cpp:673
void SetRCoordOutOfTarget(double r) const
G4int GetMaterialCode(const G4String &matName)
void SetConstructSimpAbsorber(G4bool aBool)
void ConstructLBNEShieldingHorn2(G4PVPlacement *vPhys)
void LBNEDetermineTargetHallShieldingClosestApproach(G4int ii)
std::string string
Definition: nybbler.cc:12
std::vector< double > fCurrentEqualizerLongAbsLength
void SetCurrentEqualizerOctAmpl(size_t kH, double v)
void SetCurrentEqualizerQuadAmpl(size_t kH, double v)
G4LogicalVolume * GetHorn1PlaneLogical()
void ConstructLBNEShieldingBetweenHorns(G4VPhysicalVolume *tunnel)
void ConstructLBNEHadronAbsorberSimple(G4VPhysicalVolume *vPhys)
G4LogicalVolume * GetDecayPipePlaneLogical()
void DropMarsTargetHorns(G4VPhysicalVolume *mother)
void SetBeamlineAngle(G4double angle)
G4LogicalVolume * StoppedMuonDetectorLogical
void ConstructLBNEHadronAbsorberSculpted(G4VPhysicalVolume *vPhys)
void SetDeltaEccentricityIO(size_t kH, G4double val)
static QStrList * l
Definition: config.cpp:1044
void ConstructLBNEShieldingHorn1(G4VPhysicalVolume *vPhys)
G4LogicalVolume * SecondTrackingPlaneLogical
G4VPhysicalVolume * PVCPipe[20]
void ConstructLBNEHadronAbsorber(G4VPhysicalVolume *vPhys)
std::vector< double > fDeltaEccentricityIO
void ConstructLBNEHorn2TrackingPlane(G4VPhysicalVolume *tunnel)
void PrintSolidDescription(const G4VSolid *solidvol, const G4LogicalVolume *logvol, G4RotationMatrix &WorldRotation, G4ThreeVector &WorldTranslation)
std::vector< std::pair< char, double > > fSiliconPlaneDataLBNFNano
std::vector< double > fCurrentEqualizerOctAmpl
LBNEVolumePlacements * fPlacementHandler
void GetWorldTransformation(G4VPhysicalVolume *physvol, G4RotationMatrix &WorldRotation, G4ThreeVector &WorldTranslation)
G4LogicalVolume * GetSecondMuonDetectorLogical()
void ConstructLBNEHorn(G4int nhorn, G4int nparts, G4int jstart)
double z
G4LogicalVolume * GetMuonDetectorLogical()
std::vector< double > fCurrentEqualizerQuadAmpl
void ConstructLBNFShielding(G4VPhysicalVolume *vPhys)
void SetDisableSculptedLayers(G4bool aBool)
void SetConstructSculptedAbsorber(G4bool aBool)
std::vector< double > fCurrentMultiplier
G4Material * GetMaterial(G4String matName)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
void ConstructUpstreamTarget(G4PVPlacement *phys)
G4VisAttributes * GetMaterialVisAttrib(G4String matName)
G4LogicalVolume * GetHorn2PlaneLogical()
G4LogicalVolume * GetHadronMonitorLogical()
void SetCurrentEqualizerLongAbsLength(size_t kH, double v)
LBNFNanoMagneticField * GetLBNFNanoMagneticField() const
G4double LBNEphornRgivenZ(G4double a, G4double b, G4double c, G4double z)
void SetFileNameFieldMapForCE(size_t kH, std::string s)
void SetDeltaEllipticityI(size_t kH, G4double val)
LBNFNanoMagneticField * fLBNFNanoMagneticField
std::vector< double > fDeltaEllipticityI
static bool * b
Definition: config.cpp:1043
void ConstructTesting()
use for testing gometry stuff
void checkMaterialInHAGDML(const G4LogicalVolume *lVol) const
G4LogicalVolume * GetStoppedMuonDetector()
void SetCurrentMultipiler(size_t kH, double v)
void ConstructLBNEHorn1TrackingPlane(G4VPhysicalVolume *tunnel)
void ConstructLBNEDecayPipeTrackingPlane(G4VPhysicalVolume *tunnel)
static QCString * s
Definition: config.cpp:1042
std::vector< std::string > fFileNameFieldMapForCE
G4LogicalVolume * GetPreMuonDetectorLogical()