Skip to content
Snippets Groups Projects
Commit dd79cca4 authored by Tadej Novak's avatar Tadej Novak
Browse files

Merge branch 'del.TileG4DetDescr-20221203' into 'master'

TileG4DetDescr: Remove package.

See merge request atlas/athena!58966
parents cdd85bc4 130ffbf5
No related branches found
No related tags found
No related merge requests found
...@@ -351,7 +351,6 @@ ...@@ -351,7 +351,6 @@
+ TileCalorimeter/TileDetDescr + TileCalorimeter/TileDetDescr
+ TileCalorimeter/TileG4/TileAncillary/DeadMaterial + TileCalorimeter/TileG4/TileAncillary/DeadMaterial
+ TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator + TileCalorimeter/TileG4/TileAncillary/MinBiasScintillator
+ TileCalorimeter/TileG4/TileAncillary/TileG4DetDescr
+ TileCalorimeter/TileG4/TileG4Interfaces + TileCalorimeter/TileG4/TileG4Interfaces
+ TileCalorimeter/TileG4/TileGeoG4Calib + TileCalorimeter/TileG4/TileGeoG4Calib
+ TileCalorimeter/TileG4/TileGeoG4SD + TileCalorimeter/TileG4/TileGeoG4SD
......
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( TileG4DetDescr )
# Component(s) in the package:
atlas_add_library( TileG4DetDescr
src/*.cxx
PUBLIC_HEADERS TileG4DetDescr
LINK_LIBRARIES CxxUtils )
TileCalorimeter/TileG4/TileAncillary/TileG4DetDescr
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TILEG4DETDESCR_DETECTORDESCRIPTION_H
#define TILEG4DETDESCR_DETECTORDESCRIPTION_H
#include <string>
#include <vector>
#include "CxxUtils/checker_macros.h"
namespace FADS {
class DetectorDescription {
protected:
std::string m_name;
bool m_isPointed;
public:
DetectorDescription(std::string n) ATLAS_CTORDTOR_NOT_THREAD_SAFE;
DetectorDescription(const DetectorDescription&) ATLAS_CTORDTOR_NOT_THREAD_SAFE;
virtual ~DetectorDescription() {}
bool IsPointed() const {
return m_isPointed;
}
void SetPointed() {
m_isPointed = true;
}
virtual void print() const {;}
std::string GetName() const;
private:
// Avoid coverity warning.
DetectorDescription& operator=(const DetectorDescription&);
};
} // end namespace
#endif // TILEG4DETDESCR_DETECTORDESCRIPTION_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TILEG4DETDESCR_DETECTORDESCRIPTIONFACADE_H
#define TILEG4DETDESCR_DETECTORDESCRIPTIONFACADE_H
#include "TileG4DetDescr/DetectorDescription.h"
namespace FADS {
class DetectorDescriptionFacade: public DetectorDescription {
public:
DetectorDescriptionFacade(const DetectorDescription& d):
DetectorDescription(d) {}
};
} // end namespace
#endif // TILEG4DETDESCR_DETECTORDESCRIPTIONFACADE_H
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TILEG4DETDESCR_DETECTORDESCRIPTIONSTORE_H
#define TILEG4DETDESCR_DETECTORDESCRIPTIONSTORE_H
#include <string>
#include <map>
#include "CxxUtils/checker_macros.h"
namespace FADS {
class DetectorDescription;
//class DescriptionMessenger;
typedef std::map<std::string, const DetectorDescription*, std::less<std::string> > DetDescMap;
typedef std::map<std::string, DetDescMap*, std::less<std::string> > NameSpaces;
typedef DetDescMap::const_iterator DetDescIterator;
class DetectorDescriptionStore {
private:
DetectorDescriptionStore();
DetDescMap* m_detDescMap;
NameSpaces m_nameSpaces;
// DescriptionMessenger *theMessenger;
std::string m_oldNameSpace;
std::string m_currentNameSpace;
public:
void UseNameSpace(std::string s);
void ResetNameSpace();
bool FindDetectorDescription(std::string s);
static DetectorDescriptionStore& GetDetectorDescriptionStore ATLAS_NOT_THREAD_SAFE ();
void AddDetectorDescription(DetectorDescription *d);
void RemoveDetectorDescription(std::string nam);
void ReplaceDetectorDescription(std::string nam, const DetectorDescription *d);
void PrintDetectorDescription(std::string nam);
const DetectorDescription* GetDetectorDescription(std::string name);
DetDescIterator DetDescBegin();
DetDescIterator DetDescEnd();
void PrintAll();
};
} // end namespace
#endif // TILEG4DETDESCR_DETECTORDESCRIPTIONSTORE_H
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "TileG4DetDescr/DetectorDescription.h"
#include "TileG4DetDescr/DetectorDescriptionStore.h"
namespace FADS {
DetectorDescription::DetectorDescription(std::string n)
: m_name(n) {
DetectorDescriptionStore& dd = DetectorDescriptionStore::GetDetectorDescriptionStore();
dd.AddDetectorDescription(this);
m_isPointed = false;
}
DetectorDescription::DetectorDescription(const DetectorDescription& d) {
DetectorDescriptionStore& dd = DetectorDescriptionStore::GetDetectorDescriptionStore();
dd.ReplaceDetectorDescription(d.GetName(), this);
m_isPointed = false;
}
std::string DetectorDescription::GetName() const {
return m_name;
}
} // end namespace
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "TileG4DetDescr/DetectorDescriptionStore.h"
#include "TileG4DetDescr/DetectorDescription.h"
//#include "FadsDetDescription/DescriptionMessenger.h"
#include <iostream>
namespace FADS {
DetectorDescriptionStore::DetectorDescriptionStore() {
// theMessenger=new DescriptionMessenger(this);
m_detDescMap = new DetDescMap();
m_nameSpaces["std"] = m_detDescMap;
m_oldNameSpace = m_currentNameSpace = "std";
}
DetectorDescriptionStore& DetectorDescriptionStore::GetDetectorDescriptionStore ATLAS_NOT_THREAD_SAFE () {
static DetectorDescriptionStore instance;
return instance;
}
void DetectorDescriptionStore::UseNameSpace(std::string s) {
if (s == m_currentNameSpace) return;
m_oldNameSpace = m_currentNameSpace;
if (m_nameSpaces.find(s) != m_nameSpaces.end()) {
m_currentNameSpace = s;
m_detDescMap = m_nameSpaces[s];
} else {
m_detDescMap = new DetDescMap();
m_nameSpaces[s] = m_detDescMap;
m_currentNameSpace = s;
}
}
void DetectorDescriptionStore::ResetNameSpace() {
m_currentNameSpace = m_oldNameSpace;
m_detDescMap = m_nameSpaces[m_currentNameSpace];
std::cout << " NameSpace reset to be " << m_currentNameSpace << std::endl;
}
void DetectorDescriptionStore::AddDetectorDescription(DetectorDescription *d) {
std::string name = d->GetName();
std::string::size_type i = name.find("::");
std::string nspace;
if (i != std::string::npos) {
nspace = name.substr(0, i);
name = name.substr(i + 2, name.size() - i + 2);
}
if (!nspace.empty()) UseNameSpace(nspace);
if (m_detDescMap->find(name) != m_detDescMap->end()) std::cout << "Detector Description name " << name
<< " already exists in namespace "
<< m_currentNameSpace << ": nothing done"
<< std::endl;
else (*m_detDescMap)[name] = d;
if (!nspace.empty()) ResetNameSpace();
}
void DetectorDescriptionStore::RemoveDetectorDescription(std::string nam) {
std::string::size_type i = nam.find("::");
std::string nspace;
if (i != std::string::npos) {
nspace = nam.substr(0, i);
nam = nam.substr(i + 2, nam.size() - i + 2);
}
if (!nspace.empty()) UseNameSpace(nspace);
if (m_detDescMap->find(nam) != m_detDescMap->end()) m_detDescMap->erase(nam);
if (!nspace.empty()) ResetNameSpace();
}
void DetectorDescriptionStore::ReplaceDetectorDescription(std::string nam, const DetectorDescription *d) {
std::string::size_type i = nam.find("::");
std::string nspace;
if (i != std::string::npos) {
nspace = nam.substr(0, i);
nam = nam.substr(i + 2, nam.size() - i + 2);
}
if (!nspace.empty()) UseNameSpace(nspace);
DetDescMap::iterator it;
if ( (it = m_detDescMap->find(nam)) != m_detDescMap->end()) (*it).second = d;
if (!nspace.empty()) ResetNameSpace();
}
bool DetectorDescriptionStore::FindDetectorDescription(std::string name) {
return (m_detDescMap->find(name) != m_detDescMap->end());
}
const DetectorDescription* DetectorDescriptionStore::GetDetectorDescription(std::string name) {
std::string::size_type i = name.find("::");
std::string nspace;
if (i != std::string::npos) {
nspace = name.substr(0, i);
name = name.substr(i + 2, name.size() - i + 2);
}
if (!nspace.empty()) UseNameSpace(nspace);
const DetectorDescription *dd = 0;
if (m_detDescMap->find(name) == m_detDescMap->end()) dd = 0;
// std::cout<<"Detector Description name "<<name<<
// "not found! return 0"<<std::endl;
else dd = (*m_detDescMap)[name];
if (!nspace.empty()) ResetNameSpace();
return dd;
}
void DetectorDescriptionStore::PrintDetectorDescription(std::string name) {
std::string::size_type i = name.find("::");
std::string nspace;
if (i != std::string::npos) {
nspace = name.substr(0, i);
name = name.substr(i + 2, name.size() - i + 2);
}
if (!nspace.empty()) UseNameSpace(nspace);
if (m_detDescMap->find(name) == m_detDescMap->end()) std::cout << "Detector Description name " << name
<< "not found! " << std::endl;
else (*m_detDescMap)[name]->print();
if (!nspace.empty()) ResetNameSpace();
}
DetDescIterator DetectorDescriptionStore::DetDescBegin() {
return m_detDescMap->begin();
}
DetDescIterator DetectorDescriptionStore::DetDescEnd() {
return m_detDescMap->end();
}
void DetectorDescriptionStore::PrintAll() {
DetDescIterator it;
NameSpaces::const_iterator ns;
std::cout << std::endl;
std::cout << " Listing all detector description objects currently defined" << std::endl;
for (ns = m_nameSpaces.begin(); ns != m_nameSpaces.end(); ++ns) {
std::cout << std::endl << "- NameSpace " << (*ns).first << std::endl << std::endl;
for (it = ( (*ns).second)->begin(); it != ( (*ns).second)->end(); ++it) {
std::cout << "---> ";
if ( (*it).second->IsPointed()) std::cout << "\t\t";
else std::cout << " * ";
std::cout << (*it).first << std::endl;
}
}
}
} // end namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment