|
ATLAS Offline Software
|
#include <DNNCaloSimSvc.h>
|
| DNNCaloSimSvc (const std::string &name, ISvcLocator *pSvcLocator) |
| Constructor with parameters. More...
|
|
virtual | ~DNNCaloSimSvc () final |
| Destructor. More...
|
|
virtual StatusCode | initialize () override final |
| Athena algorithm's interface methods. More...
|
|
virtual StatusCode | finalize () override final |
| framework methods More...
|
|
StatusCode | initializeNetwork () |
| helper for initialize More...
|
|
virtual StatusCode | simulate (ISFParticle &isp, McEventCollection *) override final |
| Simulation Call. More...
|
|
StatusCode | fillNetworkInputs (const ISF::ISFParticle &isfp, NetworkInputs &inputs, double &trueEnergy) |
|
StatusCode | fillWindowCells (const double etaExtrap, const double phiExtrap, const CaloDetDescrElement *&impactCellDDE) |
|
virtual StatusCode | setupEvent () override final |
| Setup Event chain - in case of a begin-of event action is needed. More...
|
|
virtual StatusCode | releaseEvent () override final |
| Release Event chain - in case of an end-of event action is needed. More...
|
|
virtual StatusCode | sysInitialize () override |
| Gaudi sysInitialize() methods. More...
|
|
const std::string & | simSvcDescriptor () override |
| Return the simulation service descriptor. More...
|
|
virtual StatusCode | setParticleBroker (IParticleBroker *broker) override |
| Inform the SimulationSvc about the ParticleBroker svc. More...
|
|
virtual StatusCode | simulateVector (const ISFParticleVector &particles, McEventCollection *mcEventCollection, McEventCollection *) override |
| Simulation call for vectors of particles. More...
|
|
const ChronoEntity * | chronoStart (const IChronoSvc::ChronoTag &tag) |
| wrapper call to start chrono with given tag More...
|
|
const ChronoEntity * | chronoStop (const IChronoSvc::ChronoTag &tag) |
| wrapper call to stop chrono with given tag More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
ServiceHandle< StoreGateSvc > & | detStore () |
|
template<class T > |
StatusCode | retrieveTool (ToolHandle< T > &thandle) |
| templated Tool retrieval - gives unique handling & look and feel More...
|
|
template<class T > |
StatusCode | retrieveTools (ToolHandleArray< T > &thandleArray) |
| templated Tool retrieval - gives unique handling & look and feel More...
|
|
template<class T > |
StatusCode | recordCollection (T *&coll, const std::string &collName) const |
| templated record collection method, will create a new one if not existing More...
|
|
template<class T > |
StatusCode | retrieveCollection (T *&coll, const std::string &collName, bool forceBreak=true) const |
| templated retrieve collection method, boolean steers that force break More...
|
|
- Author
- Aishik.Ghosh -at- cern.ch, David Rousseau -at- cern.ch,
Definition at line 56 of file DNNCaloSimSvc.h.
◆ NetworkInputs
◆ NetworkOutputs
◆ DNNCaloSimSvc()
ISF::DNNCaloSimSvc::DNNCaloSimSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
Constructor with parameters.
Constructor.
Definition at line 55 of file DNNCaloSimSvc.cxx.
64 declareProperty(
"ParamsInputFilename" ,
m_paramsFilename=
"DNNCaloSim/DNNCaloSim_GAN_nn_v0.json",
" lwtnn json output describing the trained network");
65 declareProperty(
"ParamsInputArchitecture" ,
m_paramsInputArchitecture=
"GANv0",
"tag describing additional parameters necessary for the network");
◆ ~DNNCaloSimSvc()
ISF::DNNCaloSimSvc::~DNNCaloSimSvc |
( |
| ) |
|
|
finalvirtualdefault |
◆ chronoStart()
const ChronoEntity* ISF::BaseSimulationSvc::chronoStart |
( |
const IChronoSvc::ChronoTag & |
tag | ) |
|
|
inlineinherited |
◆ chronoStop()
const ChronoEntity* ISF::BaseSimulationSvc::chronoStop |
( |
const IChronoSvc::ChronoTag & |
tag | ) |
|
|
inlineinherited |
◆ detStore() [1/2]
◆ detStore() [2/2]
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ fillNetworkInputs()
Definition at line 381 of file DNNCaloSimSvc.cxx.
388 truth.set_vertex(particle_position[
Amg::x], particle_position[
Amg::y], particle_position[
Amg::z]);
390 trueEnergy = isfp.
ekin();
405 for (
int isubpos=0; isubpos< 3 ; isubpos++){
408 " isubpos=" << isubpos <<
409 " OK=" <<
extrapol.OK(isam,isubpos) <<
410 " eta=" <<
extrapol.eta(isam,isubpos) <<
411 " phi=" <<
extrapol.phi(isam,isubpos) <<
412 " r=" <<
extrapol.r(isam,isubpos) );
421 double etaExtrap=-999.;
422 double phiExtrap=-999.;
424 etaExtrap=
extrapol.eta(isam,isubpos);
425 phiExtrap=
extrapol.phi(isam,isubpos);
429 " isubpos=" << isubpos <<
430 " eta=" << etaExtrap <<
431 " phi=" << phiExtrap );
439 return StatusCode::FAILURE;
448 double randGaussz = 0.;
453 double etaRawImpactCell=impactCellDDE->
eta_raw();
454 double phiRawImpactCell=impactCellDDE->
phi_raw();
457 <<
" phi_index " << impactPhiIndex
460 int pconf = impactPhiIndex % 4 ;
461 int econf = (impactEtaIndex + 1) % 2 ;
463 double riImpactEta = (etaExtrap - etaRawImpactCell);
480 randGaussz = CLHEP::RandGaussZiggurat::shoot(simulstate.randomEngine(), 0., 1.);
488 for (
int i = 0;
i< 4;
i ++)
497 for (
int i = 0;
i< 2;
i ++){
506 inputs[
"ripos"].insert ( std::pair<std::string,double>(
"0", riImpactEta) );
507 inputs[
"ripos"].insert ( std::pair<std::string,double>(
"1", riImpactPhi ) );
509 return StatusCode::SUCCESS;
◆ fillWindowCells()
Definition at line 513 of file DNNCaloSimSvc.cxx.
519 if (impactCellDDE==
nullptr){
520 ATH_MSG_WARNING(
"No cell found for this eta " << etaExtrap <<
" phi " << phiExtrap);
521 return StatusCode::FAILURE;
527 const int caloHashImpactCell=impactCellDDE->
calo_hash();
528 const double etaImpactCell=impactCellDDE->
eta();
529 const double phiImpactCell=impactCellDDE->
phi();
530 const double etaRawImpactCell=impactCellDDE->
eta_raw();
531 const double phiRawImpactCell=impactCellDDE->
phi_raw();
535 " eta=" << etaImpactCell <<
536 " phi=" << phiImpactCell <<
537 " eta raw=" << etaRawImpactCell <<
538 " phi raw=" << phiRawImpactCell );
553 sampling = theCell->caloDDE()->getSampling();
554 eta_raw = theCell->caloDDE()->eta_raw();
555 phi_raw = theCell->caloDDE()->phi_raw();
568 if ((sampling == 0) || (sampling == 1) ){
576 else if(sampling == 2) {
585 else if(sampling == 3){
597 return StatusCode::FAILURE;
602 if (etaRawImpactCell < 0){
609 return StatusCode::SUCCESS;
◆ finalize()
StatusCode ISF::DNNCaloSimSvc::finalize |
( |
| ) |
|
|
finaloverridevirtual |
◆ initialize()
StatusCode ISF::DNNCaloSimSvc::initialize |
( |
| ) |
|
|
finaloverridevirtual |
Athena algorithm's interface methods.
framework methods
Definition at line 79 of file DNNCaloSimSvc.cxx.
88 ATH_MSG_ERROR(
"Could not get random number engine from RandomNumberService. Abort.");
89 return StatusCode::FAILURE;
107 m_caloGeo = std::make_unique<CaloGeometryFromCaloDDM>();
109 if(!
m_caloGeo->LoadFCalChannelMapFromFCalDDM(fcalManager) )
ATH_MSG_FATAL(
"Found inconsistency between FCal_Channel map and GEO file. Please, check if they are configured properly.");
116 return StatusCode::FAILURE;
125 return StatusCode::FAILURE;
132 return StatusCode::SUCCESS;
◆ initializeNetwork()
StatusCode ISF::DNNCaloSimSvc::initializeNetwork |
( |
| ) |
|
helper for initialize
Definition at line 136 of file DNNCaloSimSvc.cxx.
145 return StatusCode::FAILURE;
156 return StatusCode::FAILURE;
178 return StatusCode::FAILURE;
181 return StatusCode::SUCCESS;
◆ recordCollection()
template<class T >
StatusCode ISF::BaseSimulationSvc::recordCollection |
( |
T *& |
coll, |
|
|
const std::string & |
collName |
|
) |
| const |
|
inlineinherited |
templated record collection method, will create a new one if not existing
Definition at line 150 of file BaseSimulationSvc.h.
152 coll = coll ? coll :
new T;
154 if (
evtStore()->record( coll, collName).isFailure()){
156 return StatusCode::FAILURE;
159 return StatusCode::SUCCESS;
◆ releaseEvent()
StatusCode ISF::DNNCaloSimSvc::releaseEvent |
( |
| ) |
|
|
finaloverridevirtual |
Release Event chain - in case of an end-of event action is needed.
Reimplemented from ISF::BaseSimulationSvc.
Definition at line 256 of file DNNCaloSimSvc.cxx.
258 const EventContext& ctx = Gaudi::Hive::currentContext();
266 for (; itrTool != endTool; ++itrTool)
278 return StatusCode::SUCCESS;
◆ retrieveCollection()
template<class T >
StatusCode ISF::BaseSimulationSvc::retrieveCollection |
( |
T *& |
coll, |
|
|
const std::string & |
collName, |
|
|
bool |
forceBreak = true |
|
) |
| const |
|
inlineinherited |
templated retrieve collection method, boolean steers that force break
Definition at line 164 of file BaseSimulationSvc.h.
166 if (!forceBreak && !
evtStore()->contains<T>(collName)) {
169 return StatusCode::SUCCESS;
173 return StatusCode::FAILURE;
176 return StatusCode::SUCCESS;
◆ retrieveTool()
template<class T >
StatusCode ISF::BaseSimulationSvc::retrieveTool |
( |
ToolHandle< T > & |
thandle | ) |
|
|
inlineinherited |
templated Tool retrieval - gives unique handling & look and feel
Definition at line 128 of file BaseSimulationSvc.h.
129 if (!thandle.empty() && thandle.retrieve().isFailure()){
131 return StatusCode::FAILURE;
134 return StatusCode::SUCCESS;
◆ retrieveTools()
template<class T >
StatusCode ISF::BaseSimulationSvc::retrieveTools |
( |
ToolHandleArray< T > & |
thandleArray | ) |
|
|
inlineinherited |
templated Tool retrieval - gives unique handling & look and feel
Definition at line 139 of file BaseSimulationSvc.h.
140 if (!thandleArray.empty() && thandleArray.retrieve().isFailure()){
142 return StatusCode::FAILURE;
145 return StatusCode::SUCCESS;
◆ setParticleBroker()
virtual StatusCode ISF::BaseSimulationSvc::setParticleBroker |
( |
IParticleBroker * |
broker | ) |
|
|
inlineoverridevirtualinherited |
Inform the SimulationSvc about the ParticleBroker svc.
Definition at line 77 of file BaseSimulationSvc.h.
79 return StatusCode::SUCCESS;
◆ setupEvent()
StatusCode ISF::DNNCaloSimSvc::setupEvent |
( |
| ) |
|
|
finaloverridevirtual |
Setup Event chain - in case of a begin-of event action is needed.
Reimplemented from ISF::BaseSimulationSvc.
Definition at line 191 of file DNNCaloSimSvc.cxx.
193 const EventContext& ctx = Gaudi::Hive::currentContext();
202 return StatusCode::FAILURE;
210 for (; itrTool != endTool; ++itrTool)
212 std::string chronoName=this->
name()+
"_"+ itrTool->name();
223 return StatusCode::FAILURE;
235 const int ntrial=100;
236 ATH_MSG_INFO (
"Trial window building on " << ntrial <<
" dummy eta phi " );
237 for (
int i=0 ;
i< ntrial ;
i++){
238 const double eta = CLHEP::RandFlat::shoot(testsimulstate.randomEngine(), 0.2, 0.25);
243 ATH_MSG_WARNING(
"Could not build trial window cells vector with eta " << eta <<
" phi " << phi);
246 ATH_MSG_INFO (
"End of trial window building on " << ntrial <<
" dummy eta phi " );
253 return StatusCode::SUCCESS;
◆ simSvcDescriptor()
const std::string& ISF::BaseSimulationSvc::simSvcDescriptor |
( |
| ) |
|
|
inlineoverrideinherited |
◆ simulate()
Simulation Call.
Reimplemented from ISF::BaseSimulationSvc.
Definition at line 330 of file DNNCaloSimSvc.cxx.
333 ATH_MSG_VERBOSE(
"NEW PARTICLE! DNNCaloSimSvc called with ISFParticle: " << isfp);
337 if(isfp.
ekin() < 10) {
338 ATH_MSG_VERBOSE(
"Skipping particle with Ekin: " << isfp.
ekin() <<
" MeV. Below the 10 MeV threshold.");
339 return StatusCode::SUCCESS;
349 return StatusCode::SUCCESS;
366 <<
" phi_raw " << windowCell->caloDDE()->phi_raw()
367 <<
" sampling " << windowCell->caloDDE()->getSampling()
368 <<
" energy " << windowCell->energy());
375 return StatusCode::SUCCESS;
◆ simulateVector()
|
inlineoverridevirtualinherited |
◆ sysInitialize()
virtual StatusCode ISF::BaseSimulationSvc::sysInitialize |
( |
| ) |
|
|
inlineoverridevirtualinherited |
Gaudi sysInitialize() methods.
Definition at line 51 of file BaseSimulationSvc.h.
53 if ( AthService::sysInitialize().isFailure() ) {
55 return StatusCode::FAILURE;
57 if (
m_chrono.retrieve().isFailure()){
59 return StatusCode::FAILURE;
62 return StatusCode::SUCCESS;
◆ m_caloCellMakerToolsRelease
◆ m_caloCellMakerToolsSetup
◆ m_caloCellsOutputName
std::string ISF::DNNCaloSimSvc::m_caloCellsOutputName |
◆ m_caloDetDescrManager
◆ m_caloGeo
◆ m_chrono
ServiceHandle<IChronoStatSvc> ISF::BaseSimulationSvc::m_chrono {this, "ChronoStatService", "ChronoStatSvc"} |
|
protectedinherited |
◆ m_detStore
Initial value:{this, "DetStore", "StoreGateSvc/DetectorStore",
"Handle to a StoreGateSvc/DetectorStore instance: it will be used to retrieve data during the course of the job"}
Handle to StoreGate (detector store by default)
Definition at line 188 of file BaseSimulationSvc.h.
◆ m_emID
◆ m_etaRawBackCut
◆ m_etaRawMiddleCut
◆ m_evtStore
Initial value:{this, "EvtStore", "StoreGateSvc/StoreGateSvc",
"Handle to a StoreGateSvc instance: it will be used to retrieve data during the course of the job"}
Handle to StoreGate (event store by default)
Definition at line 184 of file BaseSimulationSvc.h.
◆ m_extrapolator
◆ m_FastCaloSimCaloExtrapolation
◆ m_GANLatentSize
int ISF::DNNCaloSimSvc::m_GANLatentSize = 0 |
◆ m_graph
std::unique_ptr<lwt::LightweightGraph> ISF::DNNCaloSimSvc::m_graph |
◆ m_logTrueEnergyMean
double ISF::DNNCaloSimSvc::m_logTrueEnergyMean = 0. |
◆ m_logTrueEnergyScale
double ISF::DNNCaloSimSvc::m_logTrueEnergyScale = 0. |
◆ m_middleCellWidthEta
const double ISF::DNNCaloSimSvc::m_middleCellWidthEta = 0.025 |
◆ m_middleCellWidthPhi
const double ISF::DNNCaloSimSvc::m_middleCellWidthPhi = CLHEP::pi / std::pow(2,7) |
◆ m_numberOfCellsForDNN
const int ISF::DNNCaloSimSvc::m_numberOfCellsForDNN = 266 |
◆ m_paramsFilename
std::string ISF::DNNCaloSimSvc::m_paramsFilename |
◆ m_paramsInputArchitecture
std::string ISF::DNNCaloSimSvc::m_paramsInputArchitecture |
◆ m_particleBroker
The particle service used to push particles into the simulation.
Definition at line 205 of file BaseSimulationSvc.h.
◆ m_phiRawMiddleCut
◆ m_phiRawStripCut
◆ m_randomEngine
CLHEP::HepRandomEngine* ISF::DNNCaloSimSvc::m_randomEngine |
◆ m_randomEngineName
std::string ISF::DNNCaloSimSvc::m_randomEngineName |
◆ m_riImpactEtaMean
double ISF::DNNCaloSimSvc::m_riImpactEtaMean = 0. |
◆ m_riImpactEtaScale
double ISF::DNNCaloSimSvc::m_riImpactEtaScale = 0. |
◆ m_riImpactPhiMean
double ISF::DNNCaloSimSvc::m_riImpactPhiMean = 0. |
◆ m_riImpactPhiScale
double ISF::DNNCaloSimSvc::m_riImpactPhiScale = 0. |
◆ m_rndGenSvc
◆ m_screenOutputPrefix
Gaudi::Property<std::string> ISF::BaseSimulationSvc::m_screenOutputPrefix |
|
protectedinherited |
Initial value:{this, "ScreenOutputPrefix", "isf >> ",
"Prefix for log output"}
Screen output refinement.
Definition at line 198 of file BaseSimulationSvc.h.
◆ m_simDescr
Gaudi::Property<std::string> ISF::BaseSimulationSvc::m_simDescr |
|
protectedinherited |
Initial value:{this, "Identifier", {},
"A unique string to identify the simulator."}
The simulator service descriptor.
Definition at line 194 of file BaseSimulationSvc.h.
◆ m_theContainer
◆ m_windowCells
std::vector<CaloCell*> ISF::DNNCaloSimSvc::m_windowCells |
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
double ekin() const
Kinetic energy.
std::map< std::string, double > NetworkOutputs
int phi(const Identifier id) const
return phi according to :
Gaudi::Property< std::string > m_simDescr
The simulator service descriptor.
ServiceHandle< IChronoStatSvc > m_chrono
The timing service for general usage.
std::string m_paramsInputArchitecture
A manager class providing access to readout geometry information for the forward calorimeter.
const double m_etaRawBackCut
double m_riImpactEtaScale
BaseSimulationSvc()
Default constructor.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
const int m_numberOfCellsForDNN
std::unique_ptr< CaloGeometryFromCaloDDM > m_caloGeo
const double m_etaRawMiddleCut
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
const LArEM_ID * getEM_ID(void) const
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
bool compCellsForDNNSortMirror(const CaloCell *a, const CaloCell *b)
int pdgCode() const
PDG value.
const double m_phiRawStripCut
int sampling(const Identifier id) const
return sampling according to :
CLHEP::HepRandomEngine * m_randomEngine
#define ATH_MSG_VERBOSE(x)
virtual StatusCode simulate(ISFParticle &isp, McEventCollection *mcEventCollection) override
Simulation call for individual particles.
IMessageSvc * getMessageSvc(bool quiet=false)
int eta(const Identifier id) const
return eta according to :
StatusCode fillWindowCells(const double etaExtrap, const double phiExtrap, const CaloDetDescrElement *&impactCellDDE)
float eta_raw() const
cell eta_raw
CaloCellContainer * m_theContainer
ToolHandleArray< ICaloCellMakerTool > m_caloCellMakerToolsSetup
const Amg::Vector3D & position() const
The current position of the ISFParticle.
Identifier identify() const override final
cell identifier
std::map< std::string, std::map< std::string, double > > NetworkInputs
IdentifierHash calo_hash() const
cell calo hash
This class initializes the Calo (LAr and Tile) offline identifiers.
ToolHandle< IFastCaloSimCaloExtrapolation > m_FastCaloSimCaloExtrapolation
std::string m_paramsFilename
::StatusCode StatusCode
StatusCode definition for legacy code.
const ServiceHandle< StoreGateSvc > & evtStore() const
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
std::string m_caloCellsOutputName
Gaudi::Property< std::string > m_screenOutputPrefix
Screen output refinement.
#define CHECK(...)
Evaluate an expression and check for errors.
AthROOTErrorHandlerSvc * svc
const CaloIdManager * getCalo_Mgr() const
get calo ID manager
const double m_phiRawMiddleCut
ServiceHandle< StoreGateSvc > m_detStore
Handle to StoreGate (detector store by default)
const CaloDetDescrManager * m_caloDetDescrManager
StatusCode fillNetworkInputs(const ISF::ISFParticle &isfp, NetworkInputs &inputs, double &trueEnergy)
bool compCellsForDNNSort(const CaloCell *a, const CaloCell *b)
ServiceHandle< IAtRndmGenSvc > m_rndGenSvc
std::string to_string(const DetectorType &type)
const Amg::Vector3D & momentum() const
The current momentum vector of the ISFParticle.
ToolHandleArray< ICaloCellMakerTool > m_caloCellMakerToolsRelease
const std::string & simSvcDescriptor() override
Return the simulation service descriptor.
StatusCode initializeNetwork()
helper for initialize
double m_logTrueEnergyScale
Eigen::Matrix< double, 3, 1 > Vector3D
std::string m_randomEngineName
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
GraphConfig parse_json_graph(std::istream &json)
This class provides the client interface for accessing the detector description information common to...
Data object for each calorimeter readout cell.
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
std::vector< CaloCell * > m_windowCells
ServiceHandle< StoreGateSvc > m_evtStore
Handle to StoreGate (event store by default)
float eta() const
cell eta
float phi() const
cell phi
IParticleBroker * m_particleBroker
The particle service used to push particles into the simulation.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
std::unique_ptr< lwt::LightweightGraph > m_graph
double m_logTrueEnergyMean
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescrNoAlign(ISvcLocator *svcLocator, IMessageSvc *msgSvc)
double m_riImpactPhiScale
float phi_raw() const
cell phi_raw
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
double mass() const
mass of the particle