34#include "CaloDetDescr/CaloDetDescrElement.h"
45 : base_class(name, svc)
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;
86 std::unique_ptr<TFile> paramsFile(TFile::Open( inputFile.c_str(),
"READ" ));
87 if (paramsFile ==
nullptr) {
89 return StatusCode::FAILURE;
96 return StatusCode::FAILURE;
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;
191 for(t_cellmap::iterator ic=cellmap->begin();ic!=cellmap->end();++ic) {
214 newcellmap->insert(std::make_pair(
Identifier_Gpu(cell->identify().get_compact()),newcell));
216 if(cellmap->size()!=newcellmap->size())
return false;
220void ISF::FastCaloSimV2ParamSvc::region_data_cpy( CaloGeometryLookup* glkup, GeoRegion*
gr ) {
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 );
258 gr->set_cell_grid( cells );
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];
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescrNoAlign(ISvcLocator *svcLocator, IMessageSvc *msgSvc)
Definition of CaloDetDescrManager.
static constexpr const char * caloMgrStaticKey
std::map< Identifier, const CaloDetDescrElement * > t_cellmap
std::map< Identifier_Gpu, const CaloDetDescrElement_Gpu * > t_cellmap_Gpu
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
static const Info & instance()
Singleton accessor function.
This class groups all DetDescr information related to a CaloCell.
This class provides the client interface for accessing the detector description information common to...
int cell_grid_eta() const
const MeanAndRMS & deta()
const MeanAndRMS & dphi()
const MeanAndRMS & eta_correction()
const MeanAndRMS & phi_correction()
int cell_grid_phi() const
static const int MAX_SAMPLING
A manager class providing access to readout geometry information for the forward calorimeter.
bool m_printParametrization
std::unique_ptr< CaloGeometryFromCaloDDM > m_caloGeo
ServiceHandle< StoreGateSvc > m_detStore
Pointer to StoreGate (detector store by default)
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
FastCaloSimV2ParamSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters.
virtual StatusCode initialize() override final
Athena algorithm's interface methods.
virtual StatusCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) const override final
Simulation Call.
TFCSParametrizationBase * m_param
std::string m_paramsFilename
std::string m_paramsObject
int ir
counter of the current depth
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
void * Rand4Hits_init(long long, unsigned short, unsigned long long, bool)