75{
77
79
80
81 ISvcLocator *svcLocator = Gaudi::svcLocator();
82
84
85
86 log << MSG::DEBUG <<
"+++++++++++++++++++++++++++++++++++++++++++++++++++++" <<
endmsg;
88 log << MSG::DEBUG <<
"+ Start of HEC2Wheel GeoModel definition +" <<
endmsg;
90 log << MSG::DEBUG <<
"+++++++++++++++++++++++++++++++++++++++++++++++++++++" <<
endmsg;
91
92
93 SmartIF<StoreGateSvc>
detStore{svcLocator->service(
"DetectorStore")};
95 throw std::runtime_error("Error in HEC2WheelConstruction, cannot access DetectorStore");
96 }
97
98 StoredMaterialManager* materialManager = nullptr;
99 if (StatusCode::SUCCESS !=
detStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
100 throw std::runtime_error("Error in HEC2WheelConstruction, cannot access Material Manager");
101 }
102
103 SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service("RDBAccessSvc")};
104 if(!pAccessSvc.isValid()) {
105 throw std::runtime_error ("Cannot locate RDBAccessSvc!!");
106 }
107
108 SmartIF<IGeoModelSvc> geoModel{svcLocator->service("GeoModelSvc")};
109 if(!geoModel.isValid()) {
110 throw std::runtime_error ("Cannot locate GeoModelSvc!!");
111 }
112
114 std::string LArVersion = geoModel->LAr_VersionOverride();
115 std::string detectorKey = LArVersion.empty() ?
AtlasVersion : LArVersion;
116 std::string detectorNode = LArVersion.empty() ? "ATLAS" : "LAr";
117
118 IRDBRecordset_ptr hadronicEndcap = pAccessSvc->getRecordsetPtr(
"HadronicEndcap",detectorKey, detectorNode);
119 if(hadronicEndcap->
size()>0)
120 log << MSG::ALWAYS <<
"Using numbers from HadronicEndcap tag: " << hadronicEndcap->
tagName() <<
endmsg;
121 else
122 throw std::runtime_error("Error in HECConstruction: hadronicEendcap not found");
123
124 IRDBRecordset_ptr hecLongitudinalBlock = pAccessSvc->getRecordsetPtr(
"HecLongitudinalBlock",detectorKey, detectorNode);
125 if(hecLongitudinalBlock->
size()>0)
126 log << MSG::ALWAYS <<
"Using numbers from HecLongitudinalBlock tag: " << hecLongitudinalBlock->
tagName() <<
endmsg;
127 else
128 throw std::runtime_error("Error in HECConstruction: hecLongitudinalBlock not found");
129
130 IRDBRecordset_ptr larPosition = pAccessSvc->getRecordsetPtr(
"LArPosition",detectorKey, detectorNode);
131 if (larPosition->
size()==0 ) {
132 larPosition = pAccessSvc->getRecordsetPtr("LArPosition", "LArPosition-00");
133 if (larPosition->
size()==0 ) {
134 throw std::runtime_error("Error, no lar position table in database!");
135 }
136 }
137
138
139 double shrinkCold = 1.0 ;
140
141 double rInner1 = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble(
"BLRMN")*
cm;
142 double rInner2 = shrinkCold * (*hecLongitudinalBlock)[1]->getDouble(
"BLRMN")*
cm;
143 double rOuter = shrinkCold * (*hecLongitudinalBlock)[0]->getDouble(
"BLRMX")*
cm;
144 double wheelGap = shrinkCold * (*hadronicEndcap)[0]->getDouble(
"GAPWHL")*
cm;
145
146
147 const GeoMaterial *LAr = materialManager->
getMaterial(
"std::LiquidArgon");
148 if (!LAr) throw std::runtime_error("Error in HEC2WheelConstruction, std::LiquidArgon is not found.");
149
150 GeoPcon* solidHEC;
151 const GeoLogVol* logicHEC;
152 GeoIntrusivePtr<GeoFullPhysVol> physiHEC;
153
154
155
156
157
158 if (rOuter<2100.*mm) rOuter = shrinkCold *2130*
mm;
159
160
161 double HEC1length = shrinkCold * 816.5*
mm;
162 double HEC2length = shrinkCold * 961.0*
mm;
163 double TotalWarmHEC = HEC1length + wheelGap + HEC2length ;
164 double TotalHECLength = TotalWarmHEC;
165
166 double zCoordinate[4];
167 zCoordinate[0]=shrinkCold * 0.0*
cm;
168 zCoordinate[1]=shrinkCold * 28.05*
cm;
169 zCoordinate[2]=shrinkCold * 28.051*
cm;
170 zCoordinate[3]=shrinkCold * (181.9*
cm+4.0*
mm);
171
172
173 solidHEC =
new GeoPcon(0., 2.*
M_PI);
174 for (
int i=0;
i< 4;
i++)
175 {
176 if (i<2) solidHEC->addPlane(zCoordinate[i],rInner1 - shrinkCold*1.*mm,rOuter);
177 else solidHEC->addPlane(zCoordinate[i],rInner2 - shrinkCold*1.*mm,rOuter);
178 }
179
180 std::string hecName = "LAr::HEC::Mother";
181 logicHEC = new GeoLogVol(hecName, solidHEC , LAr);
182 physiHEC = new GeoFullPhysVol(logicHEC);
183
184
185
188 GeoAlignableTransform *xfHec1 = new GeoAlignableTransform(xfPosHec1);
189
190 std::string
tag1 =
m_posZSide? std::string(
"HEC1_POS") : std::string(
"HEC1_NEG");
191
192 HECWheelConstruction theFrontHEC(fullGeo,
"front",
false,
m_posZSide) ;
193 GeoIntrusivePtr<GeoFullPhysVol> EnvelopeF = theFrontHEC.GetEnvelope();
194
195 StoredPhysVol *sPhysVolHec1 = new StoredPhysVol(EnvelopeF);
197 if(!
sc.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+tag1).c_str());
198
199 StoredAlignX *sAlignX1 = new StoredAlignX(xfHec1);
201 if(!
sc.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+tag1).c_str());
202
203 physiHEC->add(xfHec1);
204 physiHEC->add(new GeoIdentifierTag(0));
205 physiHEC->add(EnvelopeF);
206
207
208
209 double Zpos = TotalHECLength - HEC2length ;
212
213
214 GeoAlignableTransform *xfHec2 = new GeoAlignableTransform(xfPosHec2);
215
216 std::string
tag2 =
m_posZSide? std::string(
"HEC2_POS") : std::string(
"HEC2_NEG");
217
218 HECWheelConstruction theRearHEC(fullGeo,
"rear",
false,
m_posZSide);
219 GeoIntrusivePtr<GeoFullPhysVol> EnvelopeR = theRearHEC.GetEnvelope();
220
221 StoredPhysVol *sPhysVolHec2 = new StoredPhysVol(EnvelopeR);
223 if(!
sc.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+tag2).c_str());
224
225 StoredAlignX *sAlignX2 = new StoredAlignX(xfHec2);
227 if(!
sc.isSuccess())
throw std::runtime_error ((std::string(
"Cannot store")+tag2).c_str());
228
229 physiHEC->add(xfHec2);
230 physiHEC->add(new GeoIdentifierTag(1));
231 physiHEC->add(EnvelopeR);
232
233 return physiHEC;
234}
Eigen::Affine3d Transform3D
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
static const IRDBRecord * getTransformRecord(IRDBRecordset_ptr positionRecSet, const std::string &key)
static GeoTrf::Transform3D getTransform(const IRDBRecord *currentRec)
virtual std::string tagName() const =0
virtual unsigned int size() const =0
GeoIntrusivePtr< GeoFullPhysVol > m_physiHEC
virtual const GeoMaterial * getMaterial(const std::string &name)=0
IMessageSvc * getMessageSvc(bool quiet=false)
::StatusCode StatusCode
StatusCode definition for legacy code.