34 #include "CaloDetDescr/CaloDetDescrElement.h"
46 , m_detStore(
"StoreGateSvc/DetectorStore",
name )
49 declareProperty(
"DetStore",
51 "Handle to a StoreGateSvc/DetectorStore instance: it will be used to "
52 "retrieve data during the course of the job" );
66 m_caloGeo = std::make_unique<CaloGeometryFromCaloDDM>();
70 m_caloGeo->LoadGeometryFromCaloDDM(caloMgr);
75 m_caloGeo->LoadGeometryFromCaloDDM(caloMgrPtr.get());
79 if (!m_caloGeo->LoadFCalChannelMapFromFCalDDM(fcalManager)) {
80 ATH_MSG_FATAL(
"Found inconsistency between FCal_Channel map and GEO file. Please, check if they are configured properly.");
81 return StatusCode::FAILURE;
84 const std::string
fileName = m_paramsFilename;
89 return StatusCode::FAILURE;
91 ATH_MSG_INFO(
"Opened parametrization file = "<<m_paramsFilename);
95 ATH_MSG_WARNING(
"file = "<<m_paramsFilename<<
", object "<< m_paramsObject<<
" not found");
96 return StatusCode::FAILURE;
101 if(m_CompressMemory) m_param->RemoveDuplicates();
102 m_param->set_geometry(m_caloGeo.get());
104 if (m_printParametrization) {
105 m_param->Print(
"short");
107 if(m_CompressMemory) m_param->RemoveNameTitle();
113 return StatusCode::SUCCESS;
115 ATH_MSG_WARNING(
"no GPU device is found, will run everything on the CPU." );
117 return StatusCode::SUCCESS;
122 ATH_MSG_INFO(
"start copying all parametrization files to GPU");
125 unsigned long long seed=23424352;
131 m_gl->set_ncells( calogeo->get_cells()->size() );
133 if(calogeo->get_cells()->size() ==0 )
return StatusCode::SUCCESS;
136 int nrgns= calogeo->get_tot_regions();
137 m_gl->set_nregions( nrgns);
140 if(!convert_cellmap(calogeo->get_cells(),&m_cellmap_gpu)){
141 ATH_MSG_ERROR(
"can not convert the CaloDetDescrElement to CaloDetDescrElement_GPU ");
143 m_gl->set_cellmap( &m_cellmap_gpu);
145 m_gl->set_regions( GR_ptr );
149 m_gl->set_sample_index_h( si );
154 int nr = calogeo->get_n_regions( is );
156 for (
int ir = 0;
ir < nr; ++
ir ) region_data_cpy( calogeo->get_region( is,
ir), &GR_ptr[
i++] );
160 ATH_MSG_INFO(
"calo geometry loaded successfully in GPU");
165 return StatusCode::SUCCESS;
173 simulstate.set_gpu_rand (m_rd4h );
174 simulstate.set_geold( m_gl );
177 simulstate.set_geold(
nullptr );
182 return StatusCode::FAILURE;
185 return StatusCode::SUCCESS;
214 newcellmap->insert(std::make_pair(
Identifier_Gpu(
cell->identify().get_compact()),newcell));
216 if(cellmap->size()!=newcellmap->size())
return false;
223 gr->set_xy_grid_adjustment_factor( glkup->xy_grid_adjustment_factor() );
224 gr->set_index( glkup->
index() );
228 ATH_MSG_DEBUG(
" copy region " << glkup->
index() <<
"neta= " << neta<<
", nphi= "<<nphi) ;
230 gr->set_cell_grid_eta( neta );
231 gr->set_cell_grid_phi( nphi );
243 gr->set_mineta_correction( glkup->mineta_correction() );
244 gr->set_minphi_correction( glkup->minphi_correction() );
245 gr->set_maxeta_correction( glkup->maxeta_correction() );
246 gr->set_maxphi_correction( glkup->maxphi_correction() );
250 gr->set_deta( glkup->
deta() );
251 gr->set_dphi( glkup->
dphi() );
252 gr->set_deta_double( glkup->deta_double() );
253 gr->set_dphi_double( glkup->dphi_double() );
257 long long*
cells = (
long long*)
malloc(
sizeof(
long long ) * neta* nphi );
260 if ( neta != (
int)( *( glkup->cell_grid() ) ).size() )
261 ATH_MSG_INFO(
"neta " << neta <<
", vector eta size " << ( *( glkup->cell_grid() ) ).size() );
263 for (
int ie = 0;
ie < neta; ++
ie ) {
265 for (
int ip = 0;
ip < nphi; ++
ip ) {
267 auto c = ( *( glkup->cell_grid() ) )[
ie][
ip];