43 MsgStream
log(
msgSvc,
"buildLArReadoutGeometry");
52 std::string fcalModName[2][3]={{
"FCAL1_NEG",
"FCAL2_NEG",
"FCAL3_NEG"},
53 {
"FCAL1_POS",
"FCAL2_POS",
"FCAL3_POS"}};
54 for (
int e=0;
e<2;
e++) {
55 for (
int m=0;
m<3;
m++) {
58 if (
detStore->retrieve(vol,fcalModName[
e][
m])==StatusCode::SUCCESS) {
60 fcalDetectorManager->addModule(
module);
72 for (
unsigned int s=0;
s<4;
s++) {
73 for (
unsigned int r=0;
r<2;
r++) {
74 unsigned int nPhi =
r==0? 2:1;
75 for (
unsigned int endcap=0;endcap<2;endcap++) {
77 std::string nameTag= endcap==0 ? (
s<2 ?
"HEC1_NEG":
"HEC2_NEG") : (
s<2 ?
"HEC1_POS":
"HEC2_POS");
79 if (StatusCode::SUCCESS==
detStore->retrieve(vol, nameTag)) {
80 unsigned int width = 32;
81 double startPhi = endcap==0?
M_PI : 0;
82 double endPhi = endcap==0? -
M_PI : 2*
M_PI ;
84 CellBinning phiBinning(startPhi, endPhi,
width*
nPhi);
89 hecDetectorManager->addDetectorRegion(region);
94 <<
" in Detector Store" <<
endmsg;
107 for (
int e=0;
e<2;
e++) {
116 if (
detStore->retrieve(sPhys,
e==0 ?
"EMEC_OUTER_WHEEL_NEG" :
"EMEC_OUTER_WHEEL_POS")==StatusCode::SUCCESS) {
117 GeoIntrusivePtr<GeoFullPhysVol>emecEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
120 CellBinning phiBinning(startPhi,endPhi,64);
123 emecDetectorManager->addDetectorRegion(region);
128 CellBinning phiBinning(startPhi,endPhi,64);
131 emecDetectorManager->addDetectorRegion(region);
135 CellBinning phiBinning(startPhi,endPhi,64);
138 emecDetectorManager->addDetectorRegion(region);
142 CellBinning phiBinning(startPhi,endPhi,64);
145 emecDetectorManager->addDetectorRegion(region);
149 CellBinning phiBinning(startPhi,endPhi,64);
152 emecDetectorManager->addDetectorRegion(region);
156 CellBinning phiBinning(startPhi,endPhi,64);
159 emecDetectorManager->addDetectorRegion(region);
163 CellBinning phiBinning(startPhi,endPhi,256);
166 emecDetectorManager->addDetectorRegion(region);
170 CellBinning phiBinning(startPhi,endPhi,256);
173 emecDetectorManager->addDetectorRegion(region);
177 CellBinning phiBinning(startPhi,endPhi,256);
180 emecDetectorManager->addDetectorRegion(region);
185 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMEC_OUTER_WHEEL_NEG" :
"EMEC_OUTER_WHEEL_POS")
186 <<
" in Detector Store" <<
endmsg;
190 if (
detStore->retrieve(sPhys,
e==0 ?
"EMEC_INNER_WHEEL_NEG" :
"EMEC_INNER_WHEEL_POS")==StatusCode::SUCCESS) {
192 GeoIntrusivePtr<GeoFullPhysVol>emecEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
196 CellBinning phiBinning(startPhi,endPhi,64);
199 emecDetectorManager->addDetectorRegion(region);
204 CellBinning phiBinning(startPhi,endPhi,64);
207 emecDetectorManager->addDetectorRegion(region);
213 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMEC_INNER_WHEEL_NEG" :
"EMEC_INNER_WHEEL_POS")
214 <<
" in Detector Store" <<
endmsg;
220 if (StatusCode::SUCCESS==
detStore->retrieve(sPresamplerEnvelope,
e==0 ?
"PRESAMPLER_EC_NEG":
"PRESAMPLER_EC_POS" )) {
221 GeoIntrusivePtr<GeoFullPhysVol> PresamplerEnvelope=sPresamplerEnvelope->
getPhysVol();
222 CellBinning presamplerPhiBinning(startPhi,endPhi,64);
225 emecDetectorManager->addDetectorRegion(presamplerRegion);
229 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"PRESAMPLER_EC_NEG":
"PRESAMPLER_EC_POS")
230 <<
" in Detector Store" <<
endmsg;
237 int firstEndcap= testbeam==0 ? 0:1;
240 for (
int e= firstEndcap ;
e<endEndcap;
e++) {
247 endPhi =22.5*
M_PI/180;
255 if (
detStore->retrieve(sPhys,
e==0 ?
"EMB_NEG" :
"EMB_POS")==StatusCode::SUCCESS) {
256 CellBinning phiBinning(startPhi,endPhi,256/NDIV);
258 GeoIntrusivePtr<GeoFullPhysVol>embEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
260 embDetectorManager->addDetectorRegion(region);
264 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMB_NEG" :
"EMB_POS" )<<
" in Detector Store" <<
endmsg;
271 if (
detStore->retrieve(sPhys,
e==0 ?
"EMB_NEG" :
"EMB_POS")==StatusCode::SUCCESS) {
272 CellBinning phiBinning(startPhi,endPhi,256/NDIV);
274 GeoIntrusivePtr<GeoFullPhysVol>embEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
276 embDetectorManager->addDetectorRegion(region);
280 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMB_NEG" :
"EMB_POS" )<<
" in Detector Store" <<
endmsg;
287 if (
detStore->retrieve(sPhys,
e==0 ?
"EMB_NEG" :
"EMB_POS")==StatusCode::SUCCESS) {
288 CellBinning phiBinning(startPhi,endPhi,256/NDIV);
290 GeoIntrusivePtr<GeoFullPhysVol>embEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
292 embDetectorManager->addDetectorRegion(region);
296 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMB_NEG" :
"EMB_POS") <<
" in Detector Store" <<
endmsg;
303 if (
detStore->retrieve(sPhys,
e==0 ?
"EMB_NEG" :
"EMB_POS")==StatusCode::SUCCESS) {
304 CellBinning phiBinning(startPhi,endPhi,64/NDIV);
306 GeoIntrusivePtr<GeoFullPhysVol>embEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
308 embDetectorManager->addDetectorRegion(region);
312 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMB_NEG" :
"EMB_POS") <<
" in Detector Store" <<
endmsg;
319 if (
detStore->retrieve(sPhys,
e==0 ?
"EMB_NEG" :
"EMB_POS")==StatusCode::SUCCESS) {
320 CellBinning phiBinning(startPhi,endPhi,256/NDIV);
322 GeoIntrusivePtr<GeoFullPhysVol>embEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
324 embDetectorManager->addDetectorRegion(region);
328 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMB_NEG" :
"EMB_POS") <<
" in Detector Store" <<
endmsg;
335 if (
detStore->retrieve(sPhys,
e==0 ?
"EMB_NEG" :
"EMB_POS")==StatusCode::SUCCESS) {
336 CellBinning phiBinning(startPhi,endPhi,64/NDIV);
338 GeoIntrusivePtr<GeoFullPhysVol>embEnvelope=(GeoIntrusivePtr<GeoFullPhysVol>) sPhys->
getPhysVol();
340 embDetectorManager->addDetectorRegion(region);
344 log <<
MSG::DEBUG <<
" No Stored PV for " << (
e==0 ?
"EMB_NEG" :
"EMB_POS") <<
" in Detector Store" <<
endmsg;
353 log << MSG::ERROR <<
"Unable to record embDetectorManager" <<
endmsg;
357 sc =
detStore->record(emecDetectorManager, emecDetectorManager->getName());
359 log << MSG::ERROR <<
"Unable to record emecDetectorManager" <<
endmsg;
363 sc =
detStore->record(hecDetectorManager, hecDetectorManager->getName());
365 log << MSG::ERROR <<
"Unable to record hecDetectorManager" <<
endmsg;
369 sc =
detStore->record(fcalDetectorManager, fcalDetectorManager->getName());
371 log << MSG::ERROR <<
"Unable to record fcalDetectorManager" <<
endmsg;
376 delete embDetectorManager;
377 delete emecDetectorManager;
378 delete hecDetectorManager;
379 delete fcalDetectorManager;
381 embDetectorManager=
nullptr;
382 emecDetectorManager=
nullptr;
383 hecDetectorManager=
nullptr;
384 fcalDetectorManager=
nullptr;
387 return std::make_tuple(embDetectorManager,emecDetectorManager,hecDetectorManager,fcalDetectorManager);