00001 // BLWindowShape.hh 00002 /* 00003 This source file is part of G4beamline, http://g4beamline.muonsinc.com 00004 Copyright (C) 2003,2004,2005,2006 by Tom Roberts, all rights reserved. 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 http://www.gnu.org/copyleft/gpl.html 00017 */ 00018 00019 #ifndef BLWINDOWSHAPE_HH 00020 #define BLWINDOWSHAPE_HH 00021 00022 #include <vector> 00023 #include "globals.hh" 00024 00025 /** struct BLWindowShape describes the shape of a window. 00026 * This is intended to be used to create a G4PolyCone for the window, 00027 * a G4PolyCone for its contents, and a G4Tubs for the flange and 00028 * possibly the pipe to which the flange is bolted (bolts are not 00029 * modeled). 00030 * 00031 * This class may be subclassed to implement other methods of 00032 * constructing a window shape. 00033 * 00034 * The standard constructor reads data from filename. 00035 * The file format is a series of lines: 00036 * First character # means comment, * means printed comment. 00037 * Comment and blank lines are ignored. Units are mm. 00038 * The first line contains the 4 flange variables: 00039 * innerR outerR insideZ outsideZ 00040 * The remaining lines contain 3 values for a given radius: 00041 * r z t 00042 * The first line must have r=0.0 and have the largest z value 00043 * and the largest z+t value. z is the inside of the window, 00044 * z+t is the outside of the window. All values must be positive. 00045 * Successive r values must increase by at least 0.010 mm. 00046 * Successive z values and z+t values must decrease by at least 00047 * 0.010 mm. 00048 * flangeInnerRadius should equal the last r value. 00049 * Any z origin may be used (it will be subtracted away). 00050 * This is intended to be easy to interface to window design 00051 * spreadsheets (export a list of 3 columns delimited by spaces, then 00052 * add the appropriate comments and flange values at the top). 00053 **/ 00054 struct BLWindowShape { 00055 G4double flangeInnerRadius; // should be same as last r[] value 00056 G4double flangeOuterRadius; // must be larger than flangeInnerRadius 00057 G4double flangeInsideZ; // in same Z coords as the window 00058 G4double flangeOutsideZ; // in same Z coords as the window 00059 std::vector<G4double> r; // first must be 0.0 00060 std::vector<G4double> z; // Z coord of inside, first must be 00061 // largest, and they must decrease 00062 // monotonically by at least 0.010 mm 00063 std::vector<G4double> t; // thickness along z 00064 public: 00065 /// default constructor. 00066 BLWindowShape() : r(), z(), t() { flangeInnerRadius=0.0; 00067 flangeOuterRadius=0.0; flangeOutsideZ=0.0; flangeInsideZ=0.0; } 00068 00069 /// Constructor. Reads directory/filename for the data. 00070 BLWindowShape(G4String filename); 00071 00072 /// destructor. 00073 virtual ~BLWindowShape() { } 00074 }; 00075 00076 #endif // BLWINDOWSHAPE_HH