001
002 #include "MuonGeoModel/Rpc.h"
003 #include "MuonGeoModel/RPC_Technology.h"
004 #include "MuonGeoModel/RpcLayer.h"
005 #include "MuonGeoModel/Cutout.h"
006 #include "MuonGeoModel/MYSQL.h"
007 #include "GeoModelKernel/GeoCutVolAction.h"
008 #include "GeoModelKernel/GeoTrd.h"
009 #include "GeoModelKernel/GeoPhysVol.h"
010 #include "GeoModelKernel/GeoLogVol.h"
011 #include "GeoModelKernel/GeoMaterial.h"
012 #include "GeoModelKernel/GeoNameTag.h"
013 #include "GeoModelKernel/GeoTransform.h"
014 #include "GeoModelKernel/GeoIdentifierTag.h"
015 #include "MuonReadoutGeometry/GlobalUtilities.h"
016 #include <iomanip>
017
018 #include "GeoModelKernel/GeoShapeSubtraction.h"
019
020 namespace MuonGM {
021
022
023 RpcLayer::RpcLayer(std::string s, Rpc* t): DetectorElement(s)
024 {
025 m = t;
026 }
027
028
029 GeoVPhysVol *RpcLayer::build()
030 {
031 std::vector<Cutout*> vcutdef;
032 int cutoutson = 0;
033 return build(cutoutson, vcutdef);
034 }
035
036
037 GeoVPhysVol*
038 RpcLayer::build(int cutoutson, std::vector<Cutout*> vcutdef)
039 {
040 std::cout << std::setiosflags(std::ios::fixed);
041 std::cout << std::setprecision(4);
042
043 double eps = 0.000001;
044 double tol = 1.e-6;
045
046 MYSQL* mysql = MYSQL::GetPointer();
047 RPC* r = (RPC*)mysql->GetTechnology(name);
048
049 double thickness = r->rpcLayerThickness - tol;
050 double length = m->length;
051 double width = m->width;
052
053 if (RPCprint) std::cout << " RpcLayer: building an RPC layer with width = " << width
054 << " length = " << length << " and thickness = " << thickness
055 << std::endl;
056
057 const GeoShape* srpcl = new GeoTrd(thickness/2, thickness/2, width/2,
058 width/2, length/2);
059 const GeoMaterial* mrpcl = matManager->getMaterial("std::Air");
060 GeoLogVol* lrpcl = new GeoLogVol("Rpclayer", srpcl, mrpcl);
061 GeoPhysVol* prpcl = new GeoPhysVol(lrpcl);
062
063 double newpos = -thickness/2.;
064
065
066 double strpanThickness = r->stripPanelThickness - tol;
067 double strpanLength = length/r->NstripPanels_in_z;
068 double strpanWidth = width /r->NstripPanels_in_s - eps;
069 if (RPCprint) std::cout << " RpcLayer:: Building a strip panel:: div_s, div_z = "
070 << r->NstripPanels_in_s << " "
071 << r->NstripPanels_in_z << std::endl;
072 if (RPCprint) std::cout << " RpcLayer:: Building a strip panel:: w,l,t = "
073 << strpanWidth << " " << strpanLength << " "
074 << strpanThickness << std::endl;
075 GeoTrd* sstrpan = new GeoTrd (strpanThickness/2., strpanThickness/2.,
076 strpanWidth/2., strpanWidth/2., strpanLength/2.);
077
078 GeoTrd* sfoamstrpan = new GeoTrd (strpanThickness/2.-r->stripPanelCopperSkinThickness,
079 strpanThickness/2.-r->stripPanelCopperSkinThickness,
080 strpanWidth/2.-r->stripPanelCopperSkinThickness,
081 strpanWidth/2.-r->stripPanelCopperSkinThickness,
082 strpanLength/2.-r->stripPanelCopperSkinThickness);
083 const GeoShape* scustrpan = sstrpan;
084 GeoLogVol* lcustrpan = new GeoLogVol("RPC_StripPanelCuSkin", scustrpan,
085 matManager->getMaterial("std::Copper"));
086 GeoLogVol* lfoamstrpan = new GeoLogVol("RPC_StripPanelFoam", sfoamstrpan,
087 matManager->getMaterial("muo::RpcFoam"));
088
089 newpos += strpanThickness/2. + tol/2.;
090 GeoPhysVol* pcustrpan11 = new GeoPhysVol(lcustrpan);
091 GeoPhysVol* pfoamstrpan11 = new GeoPhysVol(lfoamstrpan);
092 GeoTransform* tx = new GeoTransform(HepTranslateX3D(newpos) );
093 GeoTransform* ty1;
094 GeoTransform* ty2;
095
096 if (r->NstripPanels_in_s == 2) {
097 if (RPCprint) std::cout << " RpcLayer::NstripPanels_in_s == 2 " << std::endl;
098 GeoPhysVol* pcustrpan12 = new GeoPhysVol(lcustrpan);
099 GeoPhysVol* pfoamstrpan12 = new GeoPhysVol(lfoamstrpan);
100 ty1 = new GeoTransform(HepTranslateY3D(-width/4.));
101 ty2 = new GeoTransform(HepTranslateY3D( width/4.));
102 prpcl->add(tx);
103 prpcl->add(ty1);
104 if (RPCprint) std::cout<<"RpcLayer:: Locating the 1st phi strip panel at x, y "
105 <<newpos<<" "
106 <<-width/4.<<" of width ="
107 <<strpanWidth<<" in a box of width ="<<width<<std::endl;
108 prpcl->add(pcustrpan11);
109 pcustrpan11->add(pfoamstrpan11);
110 prpcl->add(tx);
111 prpcl->add(ty2);
112 if (RPCprint) std::cout<<"RpcLayer:: Locating the 2nd phi strip panel at x, y "
113 <<newpos<<" "
114 <<width/4.<<" of width ="
115 <<strpanWidth<<" in a box of width ="<<width<<std::endl;
116 prpcl->add(pcustrpan12);
117 pcustrpan12->add(pfoamstrpan12);
118
119 } else if (r->NstripPanels_in_s == 1) {
120 if (RPCprint) std::cout << " RpcLayer::NstripPanels_in_s == 1 " << std::endl;
121 prpcl->add(tx);
122 prpcl->add(pcustrpan11);
123 pcustrpan11->add(pfoamstrpan11);
124 if (RPCprint) std::cout << " RpcLayer:: Locating a single phi strip panel at x, y "
125 << newpos << " 0 " << " of width = "
126 << strpanWidth << " in a box of width = " << width << std::endl;
127 }
128
129 newpos += strpanThickness/2.;
130 double ggThickness = 2.*r->bakeliteThickness + r->gasThickness + r->totalAirThickness;
131 newpos += ggThickness/2.;
132
133
134 double ggLength = length;
135 double ggWidth = width/r->NGasGaps_in_s-eps;
136 double gasLength = ggLength - 2.*r->bakeliteframesize;
137 double gasWidth = ggWidth- 2.*r->bakeliteframesize;
138 if (RPCprint) {
139 std::cout<<"RpcLayer:: Building the gasgap:: "<<r->NGasGaps_in_s<<" in s direction"<<std::endl;
140 std::cout<<"RpcLayer:: Building the gasgap:: w,l,t "<<ggWidth<<" "<<ggLength<<" "<<ggThickness<<std::endl;
141 std::cout<<"RpcLayer:: Building the gas:: w,l,t "<<gasWidth<<" "
142 <<gasLength<<" "<<r->gasThickness<<std::endl;
143 }
144 GeoTrd *sgg = new GeoTrd (ggThickness/2., ggThickness/2.,
145 ggWidth/2., ggWidth/2.,
146 ggLength/2.);
147 GeoTrd *sgas = new GeoTrd (r->gasThickness/2., r->gasThickness/2.,
148 gasWidth/2., gasWidth/2.,
149 gasLength/2.);
150 const GeoShape *sbak = sgg;
151 GeoLogVol *lbak = new GeoLogVol("gas volume:"
152 +MuonGM::buildString(r->NGasGaps_in_s,0)+"gg_in_s_"
153 +MuonGM::buildString(r->NstripPanels_in_s,0)+"sp_in_s", sbak,
154 matManager->getMaterial("std::Bakelite"));
155 GeoLogVol *lgas = new GeoLogVol("gazGap", sgas,
156 matManager->getMaterial("muo::RPCgas"));
157 GeoPhysVol *pbak1 = new GeoPhysVol (lbak);
158 GeoPhysVol *pgas1 = new GeoPhysVol (lgas);
159 tx = new GeoTransform(HepTranslateX3D(newpos));
160 if (r->NGasGaps_in_s == 2)
161 {
162 GeoPhysVol *pbak2 = new GeoPhysVol (lbak);
163 GeoPhysVol *pgas2 = new GeoPhysVol (lgas);
164 ty1 = new GeoTransform(HepTranslateY3D(-width/4.));
165 ty2 = new GeoTransform(HepTranslateY3D(width/4.));
166 prpcl->add(tx);
167 prpcl->add(ty1);
168 if (RPCprint) std::cout<<"RpcLayer:: put 1st gas gap centre at depth, s "<<newpos<<" "<<-width/4.<<std::endl;
169 prpcl->add(new GeoIdentifierTag(0));
170 prpcl->add(pbak1);
171 pbak1->add(new GeoIdentifierTag(1));
172 pbak1->add(pgas1);
173 prpcl->add(tx);
174 prpcl->add(ty2);
175 if (RPCprint) std::cout<<"RpcLayer:: put 2nd gas gap centre at depth, s "<<newpos<<" "<<width/4.<<std::endl;
176 prpcl->add(new GeoIdentifierTag(10));
177 prpcl->add(pbak2);
178 pbak2->add(new GeoIdentifierTag(1));
179 pbak2->add(pgas2);
180 }
181 else if (r->NGasGaps_in_s == 1)
182 {
183 prpcl->add(tx);
184 prpcl->add(new GeoIdentifierTag(0));
185 prpcl->add(pbak1);
186 if (RPCprint) std::cout<<"RpcLayer:: put a single gas gap at depth, s "<<newpos<<" 0 "<<std::endl;
187 pbak1->add(new GeoIdentifierTag(1));
188 pbak1->add(pgas1);
189 }
190
191 newpos += ggThickness/2.;
192
193
194 newpos += strpanThickness/2.;
195
196 GeoPhysVol *pcustrpan21 = new GeoPhysVol(lcustrpan);
197 GeoPhysVol *pfoamstrpan21 = new GeoPhysVol(lfoamstrpan);
198 tx = new GeoTransform(HepTranslateX3D(newpos));
199 if (r->NstripPanels_in_s == 2)
200 {
201 GeoPhysVol *pcustrpan22 = new GeoPhysVol(lcustrpan);
202 GeoPhysVol *pfoamstrpan22 = new GeoPhysVol(lfoamstrpan);
203 ty1 = new GeoTransform(HepTranslateY3D(-width/4.));
204 ty2 = new GeoTransform(HepTranslateY3D( width/4.));
205 prpcl->add(tx);
206 prpcl->add(ty1);
207 if (RPCprint) std::cout<<"RpcLayer:: Locating the 1st eta panel at x, y "
208 <<newpos<<" "
209 <<-width/4.<<" of width ="
210 <<strpanWidth<<" in a box of width ="<<width<<std::endl;
211 prpcl->add(pcustrpan21);
212 pcustrpan21->add(pfoamstrpan21);
213 prpcl->add(tx);
214 prpcl->add(ty2);
215 if (RPCprint) std::cout<<"RpcLayer:: Locating the 2nd eta panel at x, y "
216 <<newpos<<" "
217 <<width/4.<<" of width ="
218 <<strpanWidth<<" in a box of width ="<<width<<std::endl;
219 prpcl->add(pcustrpan22);
220 pcustrpan22->add(pfoamstrpan22);
221 }
222 else if (r->NstripPanels_in_s == 1)
223 {
224 prpcl->add(tx);
225 if (RPCprint) std::cout<<"RpcLayer:: Locating a single eta panel at x, y "
226 <<newpos<<" 0 "
227 <<std::endl;
228 prpcl->add(pcustrpan21);
229 pcustrpan21->add(pfoamstrpan21);
230 }
231
232
233 if (cutoutson && vcutdef.size() > 0) {
234 GeoPhysVol* tempPhys = 0;
235 Cutout* cut = 0;
236 GeoShape* cutoutShape = 0;
237 HepTransform3D cutTrans;
238 for (unsigned i = 0; i < vcutdef.size(); i++) {
239 cut = vcutdef[i];
240 cutoutShape = new GeoTrd(thickness/2.+1., thickness/2.+1.,
241 cut->widthXs/2.+0.5, cut->widthXl/2.+0.5, cut->lengthY/2.+tol);
242 cutTrans = HepTranslate3D(0.0, cut->dx, -length/2 + cut->dy + cut->lengthY/2.);
243
244 GeoCutVolAction cutAction(*cutoutShape, cutTrans);
245 prpcl->apply(&cutAction);
246 tempPhys = cutAction.getPV();
247 prpcl->ref(); prpcl->unref();
248 prpcl = tempPhys;
249 }
250 }
251
252 return prpcl;
253 }
254
255
256 void RpcLayer::print()
257 {
258 std::cout << " Rpc Layer " << name+"Layer" << " :" << std::endl;
259
260 }
261 }
262
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|