001
002 #include "MuonGeoModel/RPC_Technology.h"
003 #include "MuonGeoModel/Rpc.h"
004 #include "MuonGeoModel/RpcLayer.h"
005 #include "MuonGeoModel/MYSQL.h"
006 #include "GeoModelKernel/GeoCutVolAction.h"
007 #include "GeoModelKernel/GeoTrd.h"
008 #include "GeoModelKernel/GeoPhysVol.h"
009 #include "GeoModelKernel/GeoVFullPhysVol.h"
010 #include "GeoModelKernel/GeoLogVol.h"
011 #include "GeoModelKernel/GeoMaterial.h"
012 #include "GeoModelKernel/GeoNameTag.h"
013 #include "GeoModelKernel/GeoTransform.h"
014 #include "GeoModelKernel/GeoShapeShift.h"
015 #include "GeoModelKernel/GeoIdentifierTag.h"
016 #include <iomanip>
017 #include <cassert>
018 #include "GeoModelKernel/GeoShapeSubtraction.h"
019 #include "GeoModelKernel/GeoShapeIntersection.h"
020
021 #define skip_rpc false
022
023 namespace MuonGM {
024
025
026 Rpc::Rpc(Component* ss): DetectorElement(ss->name)
027 {
028 double tol = 1.e-3;
029 RpcComponent* s = (RpcComponent*)ss;
030 width = s->dx1;
031 longWidth = s->dx2;
032 thickness = s->GetThickness();
033 length = s->dy - tol;
034 component = s;
035 idiv = s->ndivy;
036 jdiv = s->ndivz;
037 }
038
039
040 GeoFullPhysVol* Rpc::build(int minimalgeo)
041 {
042 std::vector<Cutout*> vcutdef;
043 int cutoutson = 0;
044 return build(minimalgeo, cutoutson, vcutdef);
045 }
046
047
048 GeoFullPhysVol* Rpc::build(int minimalgeo, int cutoutson,
049 std::vector<Cutout*> vcutdef)
050 {
051 MYSQL* mysql = MYSQL::GetPointer();
052 std::string geometry_version = mysql->getGeometryVersion();
053 RPC* r = (RPC*)mysql->GetTechnology(name);
054
055
056
057 double thickness = r->maxThickness;
058 width = width/idiv;
059 longWidth = longWidth/idiv;
060 length = length/jdiv;
061
062 if (RPCprint) std::cout << " RPC build: " << name << " has thickness = "
063 << thickness << " long width = " << longWidth
064 << " width = " << width << " length = " << length
065 << std::endl;
066
067 const GeoShape* srpc = new GeoTrd(thickness/2, thickness/2,
068 width/2, longWidth/2, length/2);
069
070
071 if (cutoutson && vcutdef.size() > 0) {
072 Cutout* cut = 0;
073 GeoShape* cutoutShape = 0;
074 HepTransform3D cutTrans;
075 for (unsigned i = 0; i < vcutdef.size(); i++) {
076 cut = vcutdef[i];
077 cutoutShape = new GeoTrd(thickness/2.+1., thickness/2.+1.,
078 cut->widthXs/2., cut->widthXl/2., cut->lengthY/2.);
079 cutTrans = HepTranslate3D(0.0, cut->dx, -length/2 + cut->dy + cut->lengthY/2.);
080 srpc = &(srpc->subtract( (*cutoutShape) << cutTrans) );
081 }
082
083
084
085
086
087 }
088
089 const GeoMaterial* mrpc = matManager->getMaterial("std::Air");
090 GeoLogVol* lrpc = new GeoLogVol(logVolName, srpc, mrpc);
091 GeoFullPhysVol* prpc = new GeoFullPhysVol(lrpc);
092
093 if (minimalgeo == 1) return prpc;
094
095 if (geometry_version.substr(0,1) != "M") {
096
097 if (idiv * jdiv != 1) assert(0);
098
099
100
101
102
103 double newpos = -thickness/2.;
104
105
106
107 double extSupThick = r->externalSupPanelThickness;
108 GeoTrd* slpan = new GeoTrd(extSupThick/2, extSupThick/2,
109 width/2, longWidth/2, length/2);
110 double extAlSupThick = r->externalAlSupPanelThickness;
111 GeoTrd* sholpan = new GeoTrd(extSupThick/2 - extAlSupThick,
112 extSupThick/2 - extAlSupThick,
113 width/2 - extAlSupThick,
114 longWidth/2 - extAlSupThick,
115 length/2 - extAlSupThick);
116 const GeoShape* sallpan = slpan;
117 const GeoShape* sholpan2 = sholpan;
118 const GeoMaterial* mallpan = matManager->getMaterial("std::Aluminium");
119 GeoLogVol* lallpan = new GeoLogVol("RPC_AL_extsuppanel", sallpan, mallpan);
120 GeoPhysVol* pallpan = new GeoPhysVol(lallpan);
121 const GeoMaterial* mholpan = matManager->getMaterial("muo::RpcAlHonC");
122 GeoLogVol* lholpan = new GeoLogVol("RPC_honeyc_extsuppanel", sholpan2, mholpan);
123 GeoPhysVol* pholpan = new GeoPhysVol (lholpan);
124 pallpan->add(pholpan);
125
126
127 if (cutoutson && vcutdef.size() > 0) {
128 GeoPhysVol* tempPhys = 0;
129 Cutout* cut = 0;
130 GeoShape* cutoutShape = 0;
131 HepTransform3D cutTrans;
132 for (unsigned i = 0; i < vcutdef.size(); i++) {
133 cut = vcutdef[i];
134 cutoutShape = new GeoTrd(thickness/2.+1., thickness/2.+1.,
135 cut->widthXs/2., cut->widthXl/2., cut->lengthY/2.);
136 cutTrans = HepTranslate3D(0.0, cut->dx, -length/2 + cut->dy + cut->lengthY/2.);
137
138 GeoCutVolAction cutAction(*cutoutShape, cutTrans);
139 pallpan->apply(&cutAction);
140 tempPhys = cutAction.getPV();
141 pallpan->ref(); pallpan->unref();
142 pallpan = tempPhys;
143 }
144 }
145
146 newpos += r->externalSupPanelThickness/2.;
147 GeoTransform* tlpan = new GeoTransform(HepTranslateX3D( newpos ));
148 if (RPCprint) std::cout << " Rpc:: put ext.sup panel at " << newpos
149 << " from centre" << std::endl;
150 if (!skip_rpc) {
151 prpc->add(tlpan);
152 prpc->add(pallpan);
153 }
154
155
156 newpos += r->externalSupPanelThickness/2.;
157 RpcLayer* rl = new RpcLayer(name,this);
158 GeoVPhysVol* plowergg;
159 if (cutoutson && vcutdef.size() > 0) {
160 plowergg = rl->build(cutoutson, vcutdef);
161 } else {
162 plowergg = rl->build();
163 }
164
165 newpos += r->rpcLayerThickness/2.;
166 GeoTransform* tlgg = new GeoTransform(HepTranslateX3D( newpos ));
167 if (RPCprint) std::cout << " Rpc:: put lower RPC layer at " << newpos
168 << " from centre " << std::endl;
169 if (!skip_rpc) {
170 prpc->add(new GeoIdentifierTag(1));
171 prpc->add(tlgg);
172 prpc->add(plowergg);
173 }
174
175
176 newpos += r->rpcLayerThickness/2.;
177 double centSupThick = r->centralSupPanelThickness;
178 GeoTrd* scpan = new GeoTrd(centSupThick/2, centSupThick/2,
179 width/2, longWidth/2, length/2);
180 double centAlSupThick = r->centralAlSupPanelThickness;
181 GeoTrd* shocpan = new GeoTrd(centSupThick/2 - centAlSupThick,
182 centSupThick/2 - centAlSupThick,
183 width/2 - centAlSupThick,
184 longWidth/2 - centAlSupThick,
185 length/2 - centAlSupThick);
186
187 const GeoShape* salcpan = scpan;
188 const GeoShape* shocpan2 = shocpan;
189 GeoLogVol* lalcpan = new GeoLogVol("RPC_AL_midsuppanel", salcpan, mallpan);
190 GeoPhysVol* palcpan = new GeoPhysVol(lalcpan);
191 const GeoMaterial* mhocpan = matManager->getMaterial("muo::RpcPapHonC");
192 GeoLogVol* lhocpan = new GeoLogVol("RPC_honeyc_midsuppanel", shocpan2, mhocpan);
193 GeoPhysVol* phocpan = new GeoPhysVol (lhocpan);
194 palcpan->add(phocpan);
195
196
197 if (cutoutson && vcutdef.size() > 0) {
198 GeoPhysVol* tempPhys = 0;
199 Cutout* cut = 0;
200 GeoShape* cutoutShape = 0;
201 HepTransform3D cutTrans;
202 for (unsigned i = 0; i < vcutdef.size(); i++) {
203 cut = vcutdef[i];
204 cutoutShape = new GeoTrd(thickness/2.+1., thickness/2.+1.,
205 cut->widthXs/2., cut->widthXl/2., cut->lengthY/2.);
206 cutTrans = HepTranslate3D(0.0, cut->dx, -length/2 + cut->dy + cut->lengthY/2.);
207
208 GeoCutVolAction cutAction(*cutoutShape, cutTrans);
209 palcpan->apply(&cutAction);
210 tempPhys = cutAction.getPV();
211 palcpan->ref(); palcpan->unref();
212 palcpan = tempPhys;
213 }
214 }
215
216 newpos += r->centralSupPanelThickness/2.;
217 GeoTransform* tcpan = new GeoTransform(HepTranslateX3D( newpos ));
218 if (RPCprint) std::cout << " Rpc:: put central sup panel at " << newpos
219 << " from centre" << std::endl;
220 if (!skip_rpc) {
221 prpc->add(tcpan);
222 prpc->add(palcpan);
223 }
224
225
226 newpos += r->centralSupPanelThickness/2.;
227 RpcLayer* ru = new RpcLayer(name,this);
228 GeoVPhysVol* puppergg;
229 if (cutoutson && vcutdef.size() > 0) {
230
231
232 int subtype = 0;
233 int ijob = 0;
234 for (unsigned int i = 0; i < vcutdef.size(); i++) {
235 subtype = vcutdef[i]->subtype;
236 ijob = vcutdef[i]->ijob;
237
238
239 if (name == "RPC06" && ijob == 3) {
240 if (subtype == 2) {
241 vcutdef[i]->dy = 0;
242 } else if (subtype == 13) {
243 vcutdef[i]->dy = this->length - vcutdef[i]->lengthY;
244 }
245 }
246
247
248 if (name == "RPC07") {
249 if (subtype == 5) {
250 if (ijob == 24) vcutdef[i]->dy = this->length - vcutdef[i]->lengthY;
251 if (ijob == 32) vcutdef[i]->dy = 0.;
252 } else if (subtype == 9) {
253 if (ijob == 32) vcutdef[i]->dy = this->length - vcutdef[i]->lengthY;
254 if (ijob == 24) vcutdef[i]->dy = 0.;
255 }
256 }
257
258
259 if (subtype == 6) {
260 if (ijob == 29 && name == "RPC07") vcutdef[i]->dy = this->length - vcutdef[i]->lengthY;
261 if (ijob == 21 && name == "RPC08") vcutdef[i]->dy = 0;
262 } else if (subtype == 11) {
263 if (ijob == 29 && name == "RPC07") vcutdef[i]->dy = 0;
264 if (ijob == 21 && name == "RPC08") vcutdef[i]->dy = this->length - vcutdef[i]->lengthY - vcutdef[i]->dy;
265 }
266 }
267
268 puppergg = ru->build(cutoutson, vcutdef);
269 } else {
270 puppergg = ru->build();
271 }
272
273 newpos += r->rpcLayerThickness/2.;
274 GeoTransform* tugg = new GeoTransform(HepTranslateX3D(newpos) );
275 if (RPCprint) std::cout<< " Rpc:: put upper RPC layer at " << newpos
276 << " from centre " << std::endl;
277 GeoTransform* rugg = new GeoTransform(HepRotateY3D(180*deg) );
278 if (!skip_rpc) {
279 prpc->add(new GeoIdentifierTag(2));
280 prpc->add(tugg);
281 prpc->add(rugg);
282 prpc->add(puppergg);
283 }
284
285
286 delete ru;
287 delete rl;
288 ru = 0;
289 rl = 0;
290 }
291
292 return prpc;
293 }
294
295 void Rpc::print()
296 {
297 std::cout <<"Rpc " << name.c_str() <<" :"<<std::endl;
298 }
299 }
300
| 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.
|
|