16 #include "GeoModelKernel/GeoMaterial.h"
17 #include "GeoModelKernel/GeoBox.h"
18 #include "GeoModelKernel/GeoTube.h"
19 #include "GeoModelKernel/GeoLogVol.h"
20 #include "GeoModelKernel/GeoNameTag.h"
21 #include "GeoModelKernel/GeoPhysVol.h"
22 #include "GeoModelKernel/GeoFullPhysVol.h"
23 #include "GeoModelKernel/GeoTransform.h"
24 #include "GeoModelKernel/GeoXF.h"
25 #include "GeoModelKernel/GeoSerialDenominator.h"
26 #include "GeoModelKernel/GeoAlignableTransform.h"
27 #include "GeoModelKernel/GeoSerialTransformer.h"
28 #include "GeoModelKernel/GeoDefinitions.h"
29 #include "GeoGenericFunctions/AbsFunction.h"
30 #include "GeoGenericFunctions/Variable.h"
31 #include "GeoGenericFunctions/Sin.h"
32 #include "GeoGenericFunctions/Cos.h"
44 #include "GaudiKernel/MsgStream.h"
45 #include "GaudiKernel/Bootstrap.h"
46 #include "GaudiKernel/SystemOfUnits.h"
56 #include "GeoModelKernel/CellBinning.h"
63 #include "LArReadoutGeometry/FCAL_ChannelMap.h"
73 using namespace GeoXF;
80 m_detectorManager(nullptr),
108 status = m_detectorStore->retrieve(largeoTB2004Options,
"LArGeoTB2004Options");
109 if ( !
status.isFailure() ) {
114 std::cout <<
"LArDectorFactoryH62004:\tCan't access LArGeoTB2004Options, using default values\n";
119 std::cout <<
" Use cryo X : " << m_cryoXpos <<
" Gaudi::Units::mm" << std::endl;
120 std::cout <<
" Use table Y : " << m_tableYpos <<
" Gaudi::Units::mm" << std::endl;
121 largeoTB2004Options->
printMe();
132 if (StatusCode::SUCCESS != m_detectorStore->retrieve(materialManager, std::string(
"MATERIALS"))) {
142 std::cout <<
MSG::FATAL <<
"Could not get CaloCell_ID helper !" << std::endl;
145 std::cout <<
MSG::DEBUG <<
" Found the CaloCell_ID helper. " << std::endl;
148 getSimulationParameters();
154 const GeoMaterial *air = materialManager->
getMaterial(
"std::Air");
163 const GeoBox *expHallShape =
new GeoBox(expHallX, expHallY, expHallZ);
167 const GeoLogVol *expHallLog =
new GeoLogVol(
"ExpHallLog", expHallShape, air);
171 GeoPhysVol *expHallPhys =
new GeoPhysVol(expHallLog);
176 if (expHallPhys ==
nullptr){
178 std::cout <<
"The expHallPhys pointer is NULL in LArGeo::LArDetectorFactoryH62004::create"<<std::endl;
196 PVLink CryoEnvelope =
nullptr;
198 expHallPhys->add(
new GeoNameTag(
"LAr"));
200 expHallPhys->add(
new GeoTransform(pos3Vector*Mrot));
201 expHallPhys->add(CryoEnvelope);
205 GeoIntrusivePtr<GeoPhysVol> LArPhysical =
nullptr;
214 PVLink front =
nullptr;
217 expHallPhys->add(
new GeoNameTag(
"H62004::Front"));
218 expHallPhys->add(
new GeoTransform( GeoTrf::TranslateZ3D(z_bard) ) );
219 expHallPhys->add(front);
227 PVLink middle =
nullptr;
231 expHallPhys->add(
new GeoNameTag(
"H62004::Middle"));
232 expHallPhys->add(
new GeoTransform( GeoTrf::TranslateY3D(ym_pos) * GeoTrf::TranslateZ3D(z_bardm) ) );
233 expHallPhys->add(middle);
239 PVLink mov =
nullptr;
242 expHallPhys->add(
new GeoNameTag(
"H62004::Movable"));
243 expHallPhys->add(
new GeoTransform( GeoTrf::TranslateY3D(m_tableYpos) * GeoTrf::TranslateZ3D(bttb_pos) ) );
244 expHallPhys->add(mov);
264 std::cout<<
"WTC constructed: "<<std::endl;
265 PVLink wtc =
nullptr;
267 std::cout<<
"WTC envelope: "<<wtc.get()<<
"/"<<expHallPhys<<std::endl;
269 expHallPhys->add(
new GeoNameTag(
"LAr"));
270 GeoTrf::RotateX3D rotTC(WTC_tild);
271 expHallPhys->add(
new GeoTransform(
GeoTrf::Translation3D(WTC_x, WTC_y, bcry_zpos + bcry_rwarm + WTC_z +
z_m) * rotTC));
272 expHallPhys->add(wtc);
279 std::cout<<
"Module constructed: "<<std::endl;
282 std::cout<<
"Module envelope: "<<
module.get()<<
"/"<<LArPhysical.get()<<std::endl;
283 if(
module && LArPhysical){
284 LArPhysical->add(
new GeoNameTag(
"LAr::H6::Cryostat::Modules"));
294 if (StatusCode::SUCCESS==m_detectorStore->retrieve(sEmecInnerWheel,
"EMEC_INNER_WHEEL_POS" )) {
296 GeoIntrusivePtr<GeoFullPhysVol>emecEnvelope= sEmecInnerWheel->
getPhysVol();
321 if (StatusCode::SUCCESS==m_detectorStore->retrieve(vol,
"HEC_POS")) {
324 for (
unsigned int s=0;
s<3;
s++) {
325 for (
unsigned int r=0;
r<2;
r++) {
326 unsigned int nPhi =
r==0? 2:1;
329 unsigned int width = 8;
332 double startPhi =
M_PI/2. - 1.e-9;
333 double endPhi =
M_PI - 1.e-9;
335 CellBinning phiBinning(startPhi, endPhi,
width*
nPhi, 8*
nPhi);
347 std::cout <<
"Unable to build HEC detector manager. " << ex.what() << std::endl;
351 std::cout <<
" No Stored PV for HEC_POS in Detector Store" << std::endl;
357 if (StatusCode::SUCCESS==m_detectorStore->retrieve(fcal1,
"FCAL1")) {
361 fcalDetectorManager->
addModule(detDescr);
364 std::cout <<
"Unable to build FCAL1 detector manager. " << ex.what() << std::endl;
367 std::cout <<
" No Stored PV for FCAL1 in Detector Store" << std::endl;
373 if (StatusCode::SUCCESS==m_detectorStore->retrieve(fcal2,
"FCAL2")) {
377 fcalDetectorManager->
addModule(detDescr);
380 std::cout <<
"Unable to build FCAL2 detector manager. " << ex.what() << std::endl;
383 std::cout <<
" No Stored PV for FCAL2 in Detector Store" << std::endl;
389 if (StatusCode::SUCCESS==m_detectorStore->retrieve(fcal3,
"ColdTC")) {
392 std::cout <<
" No Stored PV for ColdTC in Detector Store" << std::endl;
396 if (fcalDetectorManager) {
397 std::cout<<
"Added "<<fcalDetectorManager->
getNumTreeTops()<<
" modules in FCAL"<<std::endl;
398 StatusCode sc = m_detectorStore->record(fcalDetectorManager, fcalDetectorManager->getName());
401 std::cout <<
"Unable to record fcalDetectorManager" << std::endl;
404 if (emecDetectorManager)
406 StatusCode sc = m_detectorStore->record(emecDetectorManager, emecDetectorManager->getName());
409 std::cout <<
"Unable to record emecDetectorManager" << std::endl;
414 StatusCode sc = m_detectorStore->record(hecDetManager, hecDetManager->getName());
417 std::cout <<
"Unable to record hecDetectorManager" << std::endl;
421 m_detectorManager =
new LArDetectorManager(
nullptr,emecDetectorManager,hecDetManager,fcalDetectorManager);
422 m_detectorManager->isTestBeam(
true);
424 m_detectorManager->addTreeTop(expHallPhys);
429 GeoNameTag *
tag =
new GeoNameTag(
"LAr");
431 world->add(expHallPhys);
439 return m_detectorManager;
449 const float ctcpar[][6] = {
451 {990530560, 3.37, 1.67, -37.93, 385.12, 386.98},
452 {990530816, 3.37, 1.87, -112.33, 370.32, 386.98},
453 {990531072, 3.37, 2.06, -182.42, 341.29, 386.98},
454 {990531328, 3.37, 2.26, -245.5, 299.14, 386.98},
455 {990543616, 3.37, 2.45, -299.14, 245.5, 386.98},
456 {990543360, 3.37, 2.65, -341.29, 182.42, 386.98},
457 {990543104, 3.37, 2.85, -370.32, 112.33, 386.98},
458 {990542848, 3.37, 3.04, -385.12, 37.93, 386.98},
459 {990528256, 4, 1.67, -20.09, 203.99, 204.98},
460 {990528000, 4, 1.87, -59.5, 196.15, 204.98},
461 {990527744, 4, 2.06, -96.63, 180.78, 204.99},
462 {990527488, 4, 2.26, -130.04, 158.45, 204.98},
463 {990540032, 4, 2.45, -158.45, 130.04, 204.98},
464 {990539776, 4, 2.65, -180.78, 96.63, 204.99},
465 {990540288, 4, 2.85, -196.15, 59.5, 204.98},
466 {990540544, 4, 3.04, -203.99, 20.09, 204.98},
467 {990530304, 3.25, 1.96, -166.86, 402.83, 436.02},
468 {990530048, 3.32, 1.96, -155.77, 376.07, 407.05},
469 {990529792, 3.4, 1.96, -143.83, 347.24, 375.85},
470 {990529536, 3.49, 1.96, -130.8, 315.78, 341.8},
471 {990529280, 3.61, 1.96, -116.3, 280.76, 303.9},
472 {990529024, 3.76, 1.96, -99.66, 240.6, 260.42},
473 {990528768, 3.99, 1.96, -79.46, 191.84, 207.65},
474 {990528512, 4.44, 1.96, -50.57, 122.08, 132.14},
475 {990542592, 3.25, 2.75, -402.83, 166.86, 436.02},
476 {990542336, 3.32, 2.75, -376.07, 155.77, 407.05},
477 {990542080, 3.4, 2.75, -347.24, 143.83, 375.85},
478 {990541824, 3.49, 2.75, -315.78, 130.8, 341.8},
479 {990541568, 3.61, 2.75, -280.76, 116.3, 303.9},
480 {990541312, 3.76, 2.75, -240.6, 99.66, 260.42},
481 {990541056, 3.99, 2.75, -191.84, 79.46, 207.65},
482 {990540800, 4.44, 2.75, -122.08, 50.57, 132.14},
495 Identifier reg_id = m_cell_id->region_id(m_cell_id->cell_id((
int)
CaloCell_ID::LARFCAL, 2, 3, 0, 0, 0));
498 for(
int i=0;
i<nctc; ++
i) {
510 IdentifierHash sub_hash = m_cell_id->subcalo_cell_hash(cellid, subcalo);
514 el->set_cylindric(ctcpar[
i][1],ctcpar[
i][2],ctcpar[
i][5]);
515 el->set_cylindric_raw(ctcpar[
i][1],ctcpar[
i][2],ctcpar[
i][5]);
517 el->set_cylindric_size(0.42,0.2,180.);
519 el->set_cylindric_size(0.12,0.8,30.);
524 StatusCode sc = m_detectorStore->record(cDDEvec,
"ColdTCDDE");
525 std::cout<<
"Recording: "<<
sc<<std::endl;
526 if(
sc != StatusCode::SUCCESS) {
527 std::cout<<
"LArDetectorFactoryH62004::storeDDE could not record the ColdTC caloDDE !!!"<<std::endl;