001
002 #include "MuonGeoModel/SpacerBeam.h"
003 #include "MuonGeoModel/MYSQL.h"
004 #include "MuonGeoModel/Technology.h"
005 #include "MuonGeoModel/StandardComponent.h"
006 #include "MuonGeoModel/LbiComponent.h"
007 #include "MuonGeoModel/CbmComponent.h"
008 #include "GeoModelKernel/GeoBox.h"
009 #include "GeoModelKernel/GeoVPhysVol.h"
010 #include "GeoModelKernel/GeoPhysVol.h"
011 #include "GeoModelKernel/GeoLogVol.h"
012 #include "GeoModelKernel/GeoMaterial.h"
013 #include "GeoModelKernel/GeoTransform.h"
014 #include "GeoModelKernel/GeoShapeUnion.h"
015 #include "GeoModelKernel/GeoShapeSubtraction.h"
016 #include "GeoModelKernel/GeoShapeShift.h"
017 #include "CLHEP/Geometry/Transform3D.h"
018 #include "MuonGeoModel/CHV_Technology.h"
019 #include "MuonGeoModel/CRO_Technology.h"
020 #include "MuonGeoModel/CMI_Technology.h"
021 #include "MuonGeoModel/LBI_Technology.h"
022
023 namespace MuonGM
024 {
025
026 SpacerBeam::SpacerBeam(Component *ss): DetectorElement(ss->name),
027 hole_pos1(0), hole_pos2(0), lb_height(0), lb_width(0), cross_excent(0)
028 {
029 StandardComponent* s = (StandardComponent*)ss;
030 std::string componentType = (s->name).substr(0,3);
031
032 double tol = 1.e-4;
033
034 width = s->dx1;
035 longWidth = s->dx2;
036 length = s->dy - tol;
037 excent = s->excent;
038
039 cy = s->posy;
040 if (componentType == "CRO" || componentType == "CMI" || componentType == "CHV") {
041 CbmComponent* ccbm = (CbmComponent*)s;
042 hole_pos1 = ccbm->hole_pos1 - length/2. - cy - tol/2.;
043 hole_pos2 = ccbm->hole_pos2 - length/2. - cy - tol/2.;
044 lb_height = ccbm->lb_height;
045 lb_width = ccbm->lb_width;
046 }
047
048 MYSQL* mysql = MYSQL::GetPointer();
049 if (componentType == "CHV") {
050 CHV* ch = (CHV*)mysql->GetTechnology(s->name);
051 thickness = ch->thickness;
052 largeness = ch->largeness;
053 height = ch->height - tol;
054
055 } else if (componentType == "CRO") {
056 CRO* cr = (CRO*)mysql->GetTechnology(s->name);
057 thickness = cr->thickness;
058 largeness = cr->largeness;
059 height = cr->height - tol;
060
061 } else if (componentType == "CMI") {
062 CMI* cn = (CMI*)mysql->GetTechnology(s->name);
063 thickness = cn->thickness;
064 largeness = cn->largeness;
065 height = cn->height - tol;
066
067 } else if (componentType.substr(0,2) == "LB") {
068 LBI* lb = (LBI*) mysql->GetTechnology(s->name);
069 thickness = lb->thickness;
070 largeness = thickness;
071 height = lb->height;
072 cross_excent = 0;
073 }
074 }
075
076
077 GeoVPhysVol* SpacerBeam::build(bool is_barrel)
078 {
079 int cutoutson = 0;
080 return build(cutoutson, is_barrel);
081 }
082
083
084 GeoVPhysVol*
085 SpacerBeam::build(int , bool is_barrel)
086 {
087 GeoPhysVol* pvol = 0;
088 GeoLogVol* lvol = 0;
089 const GeoMaterial* mat = matManager->getMaterial("std::Aluminium");
090 if (name.substr(0,3)=="CHV" ||name.substr(0,3)=="CRO" ||name.substr(0,3)=="CMI" ) {
091 double sinexc = 0.;
092 double cosexc = 1.;
093 double volumelargeness = largeness;
094 if ((name.substr(0,3)=="CHV" || name.substr(0,3)=="CRO") && !is_barrel) {
095 double ltemp = std::sqrt(length*length+excent*excent);
096 sinexc = std::abs(excent)/ltemp;
097 cosexc = length/ltemp;
098 length = ltemp - largeness*std::abs(excent)/length;
099 }
100
101 if (thickness > 0.) {
102
103 volumelargeness = largeness;
104 const GeoShape* IBeamShape = new GeoBox(height/2, volumelargeness/2, length/2);
105 GeoBox* sideBox = new GeoBox(height/2. - thickness, volumelargeness/4., length/2 + 1.);
106 double yshift = volumelargeness/4. + thickness/2.;
107 IBeamShape = &(IBeamShape->subtract( (*sideBox) << HepTranslateY3D(yshift) ) );
108 IBeamShape = &(IBeamShape->subtract( (*sideBox) << HepTranslateY3D(-yshift) ) );
109
110
111 GeoBox* holeBox = new GeoBox(lb_height/2.+1.,
112 thickness/2.+1.,
113 lb_width/cosexc/2.+thickness*sinexc/cosexc+6.);
114 IBeamShape = &(IBeamShape->subtract( (*holeBox) << HepTranslateZ3D(hole_pos1/cosexc) ) );
115 IBeamShape = &(IBeamShape->subtract( (*holeBox) << HepTranslateZ3D(hole_pos2/cosexc) ) );
116 lvol = new GeoLogVol(name, IBeamShape, mat);
117 pvol = new GeoPhysVol(lvol);
118
119 } else {
120
121
122 volumelargeness = width;
123 const GeoBox* Cbox = new GeoBox(height/2, volumelargeness/2, length/2);
124 lvol = new GeoLogVol(name, Cbox, mat);
125 pvol = new GeoPhysVol(lvol);
126 }
127 return pvol;
128
129 } else if (name.substr(0,2)=="LB" ) {
130 const GeoShape* LBbox = new GeoBox(height/2., (width-length/4.)/2., length/2.);
131
132 GeoBox* innerBox = new GeoBox(height/2.-thickness, width/2.+1., length/2.-thickness);
133 LBbox = &(LBbox->subtract((*innerBox) ) );
134 lvol = new GeoLogVol(name, LBbox, mat);
135 pvol = new GeoPhysVol(lvol);
136 return pvol;
137
138 } else {
139 return NULL;
140 }
141 }
142
143
144 void SpacerBeam::print()
145 {
146 std::cout << " SpacerBeam " << name << " :" << std::endl;
147 }
148
149 }
150
| 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.
|
|