diff --git a/DDAlign/src/AlignmentsCalib.cpp b/DDAlign/src/AlignmentsCalib.cpp
index 631975acc632a3e9591d7d47642930cea3a11389..72dc4eca37367610b8e142beac9ac5af4c58fd2a 100644
--- a/DDAlign/src/AlignmentsCalib.cpp
+++ b/DDAlign/src/AlignmentsCalib.cpp
@@ -17,7 +17,7 @@
#include "DD4hep/Memory.h"
#include "DD4hep/Printout.h"
#include "DD4hep/DetectorTools.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
using namespace std;
using namespace DD4hep;
@@ -66,7 +66,7 @@ DetElement AlignmentsCalib::detector(const string& path) const {
/// Implementation: Add a new entry to the transaction stack.
pair<key_type,AlignmentsCalib::Entry*>
-AlignmentsCalib::_set(DetElement detector, const Delta& delta) {
+AlignmentsCalib::_set(DetElement detector, const Delta& delta) {
ConditionKey tar_key(detector.key(),AlignmentsCalculator::alignment_item_key());
UsedConditions::iterator i = used.find(tar_key.hash);
if ( i != used.end() ) {
@@ -75,7 +75,7 @@ AlignmentsCalib::_set(DetElement detector, const Delta& delta) {
}
Condition src_cond = slice.get(detector,align_delta_hash);
- if ( !src_cond.isValid() ) {
+ if ( !src_cond.isValid() ) {
// Try to create a new condition and register it to the
// conditions manager from the delta value.
ConditionKey key(detector, align_delta_hash);
diff --git a/DDAlign/src/GlobalAlignmentCache.cpp b/DDAlign/src/GlobalAlignmentCache.cpp
index 7a38506109222b01cc6c978280b2edbb4a94c904..f55ffcc851da89c067703140abfb40005746e958 100644
--- a/DDAlign/src/GlobalAlignmentCache.cpp
+++ b/DDAlign/src/GlobalAlignmentCache.cpp
@@ -16,7 +16,7 @@
#include "DD4hep/Printout.h"
#include "DDAlign/GlobalAlignmentCache.h"
#include "DDAlign/GlobalAlignmentOperators.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
// ROOT include files
#include "TGeoManager.h"
diff --git a/DDAlign/src/GlobalAlignmentOperators.cpp b/DDAlign/src/GlobalAlignmentOperators.cpp
index 0f472e7b1f0a915d263ebc833fe5866c80129ab5..35aad4c8303796e84b6ae90c609dffaedc09dfc4 100644
--- a/DDAlign/src/GlobalAlignmentOperators.cpp
+++ b/DDAlign/src/GlobalAlignmentOperators.cpp
@@ -14,7 +14,7 @@
// Framework include files
#include "DD4hep/LCDD.h"
#include "DD4hep/Printout.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
#include "DDAlign/GlobalAlignmentOperators.h"
#include "DDAlign/GlobalDetectorAlignment.h"
diff --git a/DDAlign/src/GlobalAlignmentWriter.cpp b/DDAlign/src/GlobalAlignmentWriter.cpp
index 260c2518844c5fdcf244f8fe71f3daca5d3f691d..d4e840decc25f095cb01b292a57c2fbd0cc2b67b 100644
--- a/DDAlign/src/GlobalAlignmentWriter.cpp
+++ b/DDAlign/src/GlobalAlignmentWriter.cpp
@@ -20,7 +20,7 @@
#include "DD4hep/LCDD.h"
#include "DD4hep/Printout.h"
#include "DD4hep/MatrixHelpers.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
#include "XML/DocumentHandler.h"
#include "TGeoMatrix.h"
diff --git a/DDAlign/src/GlobalDetectorAlignment.cpp b/DDAlign/src/GlobalDetectorAlignment.cpp
index 887f813309513622b77cb44f1603eb9928837da2..656dd879a5afc69a6d787b3457d9f388b7e38d8e 100644
--- a/DDAlign/src/GlobalDetectorAlignment.cpp
+++ b/DDAlign/src/GlobalDetectorAlignment.cpp
@@ -17,8 +17,8 @@
#include "DD4hep/InstanceCount.h"
#include "DD4hep/MatrixHelpers.h"
#include "DD4hep/Printout.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/Handle.inl"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/DetectorInterna.h"
// ROOT include files
#include "TGeoMatrix.h"
diff --git a/DDCond/NamingConventions.txt b/DDCond/NamingConventions.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e26e2c54aba48838a97e0d24ec784c57e7aa2ed9
--- /dev/null
+++ b/DDCond/NamingConventions.txt
@@ -0,0 +1,40 @@
+
+Access mechaisms of DD4hep conditions for utilities
+===================================================
+
+Access to conditions is solely supported using the interface class DDCore/ConditionsMap.
+-- All utilities must use this interface.
+-- Any concrete implementation using conditions/alignment utilities
+ must implement this interface
+-- Basic implmentation using STL map, multimap and unordered_map are provided.
+-- A special no-op implementation of this interface shall be provided to access
+ "default" alignment conditions.
+ This implementation shall fall-back internally to the DetElement::nominal() alignment.
+ Known clients: VolumeManager (hence: DDG4, DDRec, etc.)
+
+Naming conventions for detector conditions
+==========================================
+
+-- Condition are logically attached to DetElements
+ --> Condition names are: DetElement.path()+"#"+condition-name
+ Example: /world/LHCb/DownstreamRegion/Muon/M5/M5ASide/R3ASide/Cham046#alignment
+
+-- Condition keys are a int64 compound of two int32:
+ union {
+ int64 key;
+ struct {
+ int32 det_key;
+ int32 item_key;
+ } values;
+ };
+ det_key = hash32(DetElement.path())
+ item_key = hash32(condition-name)
+ Condition keys must be unique throughout the detector description.
+
+-- Alignment conditions naming conventions:
+ --> Alignment-delta conditions are called "alignment_delta".
+ --> Fully qualified alignment conditions are called "alignment".
+ DD4hep provided alignment utilities rely on this convention.
+
+-- Other conditions can be named freely.
+
diff --git a/DDCond/include/DDCond/ConditionsPool.h b/DDCond/include/DDCond/ConditionsPool.h
index 419a5b221feac69ac1c714f60df0e6d43f170783..1fcd190c4f142acece985f896edaecaca5cc503c 100644
--- a/DDCond/include/DDCond/ConditionsPool.h
+++ b/DDCond/include/DDCond/ConditionsPool.h
@@ -134,10 +134,11 @@ namespace DD4hep {
* \author M.Frank
* \version 1.0
*/
- class UserPool {
+ class UserPool : public ConditionsMap {
public:
/// Forward definition of the key type
- typedef Condition::key_type key_type;
+ //typedef Condition::key_type key_type;
+ typedef Condition::itemkey_type itemkey_type;
typedef ConditionDependency Dependency;
typedef std::map<key_type,const Dependency*> Dependencies;
typedef ConditionsManager::Result Result;
@@ -190,10 +191,25 @@ namespace DD4hep {
virtual bool remove(const ConditionKey& key) = 0;
/// ConditionsMap overload: Add a condition directly to the slice
virtual bool insert(DetElement detector, unsigned int key, Condition condition) = 0;
- /// ConditionsMap overload: Access a condition
+
+ /// ConditionsMap overload: Access a single condition
virtual Condition get(DetElement detector, unsigned int key) const = 0;
+ /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+ virtual std::vector<Condition> get(key_type lower, key_type upper) const = 0;
+ /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+ virtual std::vector<Condition> get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const = 0;
+
/// ConditionsMap overload: Interface to scan data content of the conditions mapping
- virtual void scan(Condition::Processor& processor) const = 0;
+ virtual void scan(const Processor& processor) const = 0;
+ /// No ConditionsMap overload: Interface to scan data content of the conditions mapping
+ virtual void scan(key_type lower, key_type upper, const Processor& processor) const = 0;
+ /// No ConditionsMap overload: Interface to scan data content of the conditions mapping
+ virtual void scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const = 0;
/// Prepare user pool for usage (load, fill etc.) according to required IOV
virtual Result prepare(const IOV& required,
diff --git a/DDCond/include/DDCond/ConditionsSelectors.h b/DDCond/include/DDCond/ConditionsSelectors.h
index ccb394ec2afa20c53eb30d41200a23d270e00d28..e4ebbebe09b02ef369e655404176f746d697a2fa 100644
--- a/DDCond/include/DDCond/ConditionsSelectors.h
+++ b/DDCond/include/DDCond/ConditionsSelectors.h
@@ -16,7 +16,7 @@
// Framework include files
#include "DD4hep/Conditions.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
/// Namespace for the AIDA detector description toolkit
namespace DD4hep {
diff --git a/DDCond/include/DDCond/ConditionsSlice.h b/DDCond/include/DDCond/ConditionsSlice.h
index a520e8a4fbbb8bef1b27573f2bdd2e7481da895d..f5da5e83eb7ab20373c5fcbd399b3807ac8ff6a6 100644
--- a/DDCond/include/DDCond/ConditionsSlice.h
+++ b/DDCond/include/DDCond/ConditionsSlice.h
@@ -53,7 +53,6 @@ namespace DD4hep {
class ConditionsSlice : public ConditionsMap {
public:
typedef Condition::key_type key_type;
- typedef std::shared_ptr<ConditionsContent> Content;
enum ManageFlag {
REGISTER_MANAGER= 1<<0,
@@ -77,6 +76,11 @@ namespace DD4hep {
const IOV& iov = s.pool->validity();
iov_pool = s.manager.registerIOV(*iov.iovType,iov.key());
}
+ template <typename T> Inserter(ConditionsSlice& s, const T& data) : slice(s) {
+ const IOV& iov = s.pool->validity();
+ iov_pool = s.manager.registerIOV(*iov.iovType,iov.key());
+ std::for_each(std::begin(data), std::end(data), *this);
+ }
void operator()(Condition c) const {
slice.manager.registerUnlocked(*iov_pool,c);
slice.pool->insert(c);
@@ -98,7 +102,7 @@ namespace DD4hep {
/// Reference to the user pool managing all conditions of this slice
std::unique_ptr<UserPool> pool;
/// Container of conditions required by this slice
- Content content;
+ std::shared_ptr<ConditionsContent> content;
protected:
/// If flag conditonsManager["OutputUnloadedConditions"]=true: will contain conditions not loaded
@@ -122,7 +126,7 @@ namespace DD4hep {
/// Initializing constructor
ConditionsSlice(ConditionsManager m);
/// Initializing constructor
- ConditionsSlice(ConditionsManager m, Content c);
+ ConditionsSlice(ConditionsManager m, const std::shared_ptr<ConditionsContent>& c);
/// Copy constructor (Special, partial copy only. Hence no assignment!)
ConditionsSlice(const ConditionsSlice& copy);
/// Default destructor.
@@ -151,13 +155,25 @@ namespace DD4hep {
/** Note: The conditions already require a valid hash key */
virtual bool manage(Condition condition, ManageFlag flg);
+ /// Access all conditions from a given detector element
+ std::vector<Condition> get(DetElement detector) const;
+
/** ConditionsMap interface implementation: */
/// ConditionsMap overload: Add a condition directly to the slice
- virtual bool insert(DetElement detector, unsigned int key, Condition condition);
+ virtual bool insert(DetElement detector, unsigned int key, Condition condition) override;
/// ConditionsMap overload: Access a condition
- virtual Condition get(DetElement detector, unsigned int key) const;
+ virtual Condition get(DetElement detector, unsigned int key) const override;
+ /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+ virtual std::vector<Condition> get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const override;
/// ConditionsMap overload: Interface to scan data content of the conditions mapping
- virtual void scan(Condition::Processor& processor) const;
+ virtual void scan(const Processor& processor) const override;
+ /// ConditionsMap overload: Interface to partially scan data content of the conditions mapping
+ virtual void scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const override;
};
/// Populate the conditions slice from the conditions manager (convenience)
diff --git a/DDCond/src/ConditionsDataLoader.cpp b/DDCond/src/ConditionsDataLoader.cpp
index 49bfe6111735bf3156dc438eb131315ef1d956c2..fb0baa88a097a775f0c38102383a585c0c3fecda 100644
--- a/DDCond/src/ConditionsDataLoader.cpp
+++ b/DDCond/src/ConditionsDataLoader.cpp
@@ -14,7 +14,7 @@
// Framework include files
#include "DDCond/ConditionsDataLoader.h"
#include "DDCond/ConditionsManagerObject.h"
-#include "DD4hep/Handle.inl"
+#include "DD4hep/detail/Handle.inl"
#include "DD4hep/Printout.h"
using std::string;
diff --git a/DDCond/src/ConditionsIOVPool.cpp b/DDCond/src/ConditionsIOVPool.cpp
index a93d6fab5ff311dddb1aed8119daeb67b6f05d03..01364edaad65e2fd1c697af6f83ded01254d15cb 100644
--- a/DDCond/src/ConditionsIOVPool.cpp
+++ b/DDCond/src/ConditionsIOVPool.cpp
@@ -15,7 +15,7 @@
#include "DD4hep/Printout.h"
#include "DD4hep/InstanceCount.h"
#include "DDCond/ConditionsIOVPool.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "DDCond/ConditionsDataLoader.h"
using namespace DD4hep;
diff --git a/DDCond/src/ConditionsManager.cpp b/DDCond/src/ConditionsManager.cpp
index 778539d51bf7f26088daa339c4a22db65f9b5f6a..f5d5424e61ee6293409595446ae3c9655903c7be 100644
--- a/DDCond/src/ConditionsManager.cpp
+++ b/DDCond/src/ConditionsManager.cpp
@@ -14,9 +14,9 @@
// Framework include files
#include "DD4hep/LCDD.h"
#include "DD4hep/Errors.h"
-#include "DD4hep/Handle.inl"
#include "DD4hep/Printout.h"
#include "DD4hep/InstanceCount.h"
+#include "DD4hep/detail/Handle.inl"
#include "DD4hep/ConditionsListener.h"
#include "DDCond/ConditionsManager.h"
diff --git a/DDCond/src/ConditionsOperators.cpp b/DDCond/src/ConditionsOperators.cpp
index 47e2d6d0555f8b67a0f343618aa15ef0b69658f4..34ba3f5191fa75efa68c85029e5349cdd65a33b1 100644
--- a/DDCond/src/ConditionsOperators.cpp
+++ b/DDCond/src/ConditionsOperators.cpp
@@ -14,7 +14,7 @@
// Framework include files
#include "DD4hep/Printout.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "DDCond/ConditionsPool.h"
#include "DDCond/ConditionsIOVPool.h"
#include "DDCond/ConditionsOperators.h"
diff --git a/DDCond/src/ConditionsPool.cpp b/DDCond/src/ConditionsPool.cpp
index 893a6c0f60e821351ea0fe66e47a0950102aa0e8..93dea0aebda057630cfc5060dbcf2868bab5b01a 100644
--- a/DDCond/src/ConditionsPool.cpp
+++ b/DDCond/src/ConditionsPool.cpp
@@ -14,15 +14,16 @@
// Framework include files
#include "DDCond/ConditionsPool.h"
#include "DDCond/ConditionsManagerObject.h"
-#include "DD4hep/Handle.inl"
#include "DD4hep/Printout.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/ConditionsInterna.h"
using std::string;
using namespace DD4hep;
using namespace DD4hep::Conditions;
+DD4HEP_INSTANTIATE_HANDLE_NAMED(UpdatePool);
DD4HEP_INSTANTIATE_HANDLE_NAMED(ConditionsPool);
/// Default constructor
diff --git a/DDCond/src/ConditionsRepository.cpp b/DDCond/src/ConditionsRepository.cpp
index ccb7a6550a46a1aff6fa8836f964a3672269fbf8..9385beeb8d4c559916f05d4669836bb2d93a4f3e 100644
--- a/DDCond/src/ConditionsRepository.cpp
+++ b/DDCond/src/ConditionsRepository.cpp
@@ -16,7 +16,7 @@
#include "DDCond/ConditionsManager.h"
#include "DDCond/ConditionsIOVPool.h"
#include "DDCond/ConditionsTags.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "DD4hep/Printout.h"
#include "XML/DocumentHandler.h"
#include "XML/XMLTags.h"
diff --git a/DDCond/src/ConditionsSlice.cpp b/DDCond/src/ConditionsSlice.cpp
index d318a30cb408a16799c15ee6b28f300147c67ad0..4427db3019b313e532c16eaa7f95c4188c0429da 100644
--- a/DDCond/src/ConditionsSlice.cpp
+++ b/DDCond/src/ConditionsSlice.cpp
@@ -26,7 +26,8 @@ ConditionsSlice::ConditionsSlice(ConditionsManager m) : manager(m)
}
/// Initializing constructor
-ConditionsSlice::ConditionsSlice(ConditionsManager m, Content c) : manager(m), content(c)
+ConditionsSlice::ConditionsSlice(ConditionsManager m, const std::shared_ptr<ConditionsContent>& c)
+ : manager(m), content(c)
{
InstanceCount::increment(this);
}
@@ -86,6 +87,18 @@ bool ConditionsSlice::manage(Condition condition, ManageFlag flg) {
return manage(p, condition, flg);
}
+/// Access all conditions from a given detector element
+std::vector<Condition> ConditionsSlice::get(DetElement detector) const {
+ return pool->get(detector,FIRST_ITEM,LAST_ITEM);
+}
+
+/// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+std::vector<Condition> ConditionsSlice::get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const {
+ return pool->get(detector, lower, upper);
+}
+
/// ConditionsMap overload: Add a condition directly to the slice
bool ConditionsSlice::insert(DetElement detector, unsigned int key, Condition condition) {
if ( condition.isValid() ) {
@@ -114,10 +127,17 @@ Condition ConditionsSlice::get(DetElement detector, unsigned int key) const {
}
/// ConditionsMap overload: Interface to scan data content of the conditions mapping
-void ConditionsSlice::scan(Condition::Processor& processor) const {
+void ConditionsSlice::scan(const Processor& processor) const {
pool->scan(processor);
}
+/// ConditionsMap overload: Interface to partially scan data content of the conditions mapping
+void ConditionsSlice::scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const {
+ pool->scan(detector, lower, upper, processor);
+}
namespace {
diff --git a/DDCond/src/ConditionsTextRepository.cpp b/DDCond/src/ConditionsTextRepository.cpp
index d9369c155f39296abe4ea5a63b9836fbf77edb23..4e6b04ac3f523a2fe6e69b5b77aa680bfedfd233 100644
--- a/DDCond/src/ConditionsTextRepository.cpp
+++ b/DDCond/src/ConditionsTextRepository.cpp
@@ -16,7 +16,7 @@
#include "DDCond/ConditionsIOVPool.h"
#include "DDCond/ConditionsTags.h"
#include "DD4hep/Printout.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "XML/DocumentHandler.h"
#include "XML/XMLTags.h"
diff --git a/DDCond/src/Type1/Manager_Type1.cpp b/DDCond/src/Type1/Manager_Type1.cpp
index c1d45dee4762e8d7ccba0f660b6517e789ac1e10..4ec3c3f0152ca5d6ba2d1086257f9b772c99d637 100644
--- a/DDCond/src/Type1/Manager_Type1.cpp
+++ b/DDCond/src/Type1/Manager_Type1.cpp
@@ -19,13 +19,13 @@
#include "DD4hep/Errors.h"
#include "DD4hep/Plugins.h"
#include "DD4hep/Printout.h"
-#include "DD4hep/Handle.inl"
#include "DD4hep/Factories.h"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/PluginCreators.h"
#include "DD4hep/ConditionsListener.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "DDCond/ConditionsPool.h"
#include "DDCond/ConditionsEntry.h"
diff --git a/DDCond/src/plugins/ConditionsMappedPool.cpp b/DDCond/src/plugins/ConditionsMappedPool.cpp
index 81108b7496e24e9c1e597eba4fde98d76505c6e8..158e5384a4bcb8647a0e17d57cd14037dfa1c3c1 100644
--- a/DDCond/src/plugins/ConditionsMappedPool.cpp
+++ b/DDCond/src/plugins/ConditionsMappedPool.cpp
@@ -15,7 +15,7 @@
// Framework include files
#include "DD4hep/Printout.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "DDCond/ConditionsPool.h"
#include "DDCond/ConditionsSelectors.h"
diff --git a/DDCond/src/plugins/ConditionsPlugins.cpp b/DDCond/src/plugins/ConditionsPlugins.cpp
index 5dd6f2a6530a5113834dc0bc391a64c40ae48f03..a624cb615eb789a8f9cf7063a99d3dbba9ed638a 100644
--- a/DDCond/src/plugins/ConditionsPlugins.cpp
+++ b/DDCond/src/plugins/ConditionsPlugins.cpp
@@ -28,12 +28,15 @@
#include "DDCond/ConditionsIOVPool.h"
#include "DDCond/ConditionsRepository.h"
#include "DDCond/ConditionsManagerObject.h"
+#include <memory>
using namespace std;
using namespace DD4hep;
using namespace DD4hep::Conditions;
using Geometry::DetElement;
using Geometry::PlacedVolume;
+using Geometry::DetectorProcessor;
+using Geometry::DetectorProcessorShared;
/// Plugin function: Install the alignment manager as an extension to the central LCDD object
/**
@@ -143,15 +146,15 @@ static int ddcond_conditions_pool_processor(lcdd_t& lcdd, bool process_pool, boo
typedef std::vector<const IOVType*> _T;
typedef ConditionsIOVPool::Elements _E;
typedef RangeConditions _R;
- DetElement::Processor* p = createProcessor<DetElement::Processor>(lcdd,argc,argv);
- Condition::Processor* processor = dynamic_cast<Condition::Processor*>(p);
- dd4hep_ptr<Condition::Processor> proc(processor);
+ unique_ptr<Condition::Processor> proc(createProcessor<Condition::Processor>(lcdd,argc,argv));
ConditionsManager manager = ConditionsManager::from(lcdd);
const _T types = manager.iovTypesUsed();
- if ( p && !proc.get() ) {
- printout(WARNING,"Conditions",
- "+++ Conditions processor of type %s is invalid!",argv[0]);
+ if ( !proc.get() ) {
+ printout(WARNING,"Conditions","+++ Conditions processor of type %s is invalid!",argv[0]);
+ }
+ if ( process_conditions && !proc.get() ) {
+ except("Conditions","+++ Conditions processor of type %s is invalid!",argv[0]);
}
for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) {
const IOVType* type = *i;
@@ -241,13 +244,13 @@ static int ddcond_detelement_dump(LCDD& lcdd, int argc, char** argv) {
* \date 01/12/2016
*/
struct Actor : public Geometry::DetectorProcessor {
- ConditionsPrinter printer;
+ ConditionsPrinter& printer;
/// Standard constructor
- Actor(ConditionsMap& s) : printer(&s,"") { }
+ Actor(ConditionsPrinter& p) : printer(p) { }
/// Default destructor
virtual ~Actor() { }
/// Dump method.
- virtual int operator()(DetElement de,int level) {
+ virtual int operator()(DetElement de,int level) const {
const DetElement::Children& children = de.children();
PlacedVolume place = de.placement();
char sens = place.volume().isSensitive() ? 'S' : ' ';
@@ -257,14 +260,15 @@ static int ddcond_detelement_dump(LCDD& lcdd, int argc, char** argv) {
printout(INFO,"DetectorDump",fmt,"",de.path().c_str(),int(children.size()),
(unsigned long)de.volumeID(), sens);
printer.prefix = string(tmp)+de.name();
- printer.processElement(de);
+ (printer)(de, level);
return 1;
}
};
dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(lcdd,"run",1500,argc,argv));
+ ConditionsPrinter printer(slice.get(),"");
UserPool* pool = slice->pool.get();
pool->print("User pool");
- Actor actor(*slice);
+ Actor actor(printer);
int ret = actor.process(lcdd.world(),0,true);
slice->manager.clean(pool->validity().iovType, 20);
return ret;
@@ -311,7 +315,7 @@ static int ddcond_detelement_processor(LCDD& lcdd, int argc, char** argv) {
/// Default destructor
virtual ~Actor() { }
/// Dump method.
- virtual int operator()(DetElement de, int)
+ virtual int operator()(DetElement de, int)
{ return de.hasConditions() ? processor->processElement(de) : 1; }
};
ConditionsProcessor* processor = 0;
@@ -395,7 +399,7 @@ DECLARE_APPLY(DD4hep_ConditionsClean,ddcond_clean_conditions)
* \date 17/11/2016
*/
#include "DD4hep/PluginTester.h"
-template <typename PRINTER>
+template <typename WRAPPER,typename PRINTER>
static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) {
PrintLevel print_level = INFO;
string prefix = "", name = "";
@@ -431,23 +435,24 @@ static void* create_printer(Geometry::LCDD& lcdd, int argc,char** argv) {
}
DetElement world = lcdd.world();
printout(INFO,"Printer","World=%s [%p]",world.path().c_str(),world.ptr());
- PRINTER* p = 0;
ConditionsSlice* slice = 0;
- if ( have_pool != 0 ) {
+ if ( have_pool ) {
PluginTester* test = lcdd.extension<PluginTester>();
slice = test->extension<ConditionsSlice>("ConditionsTestSlice");
}
- p = (flags) ? new PRINTER(slice, prefix, flags) : new PRINTER(slice, prefix);
+ PRINTER* p = (flags) ? new PRINTER(slice, prefix, flags) : new PRINTER(slice, prefix);
p->printLevel = print_level;
if ( !name.empty() ) p->name = name;
- return (void*)dynamic_cast<DetElement::Processor*>(p);
+ return (void*)dynamic_cast<WRAPPER*>(createProcessorWrapper(p));
}
#include "DD4hep/ConditionsPrinter.h"
-DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsPrinter,create_printer<Conditions::ConditionsPrinter>)
#include "DD4hep/AlignmentsPrinter.h"
-DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignmentsPrinter,create_printer<Alignments::AlignmentsPrinter>)
-#include "DD4hep/AlignedVolumePrinter.h"
-DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignedVolumePrinter,create_printer<Alignments::AlignedVolumePrinter>)
+static void* create_cond_printer(Geometry::LCDD& lcdd, int argc,char** argv)
+{ return create_printer<Condition::Processor,ConditionsPrinter>(lcdd,argc,argv); }
+
+DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsPrinter,create_cond_printer)
+//DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignmentsPrinter,create_printer<Alignments::AlignmentsPrinter>)
+//DECLARE_LCDD_CONSTRUCTOR(DD4hep_AlignedVolumePrinter,create_printer<Alignments::AlignedVolumePrinter>)
// ======================================================================================
/// Plugin entry point: Create repository csv file from loaded conditions
diff --git a/DDCond/src/plugins/ConditionsRepositoryParser.cpp b/DDCond/src/plugins/ConditionsRepositoryParser.cpp
index 221fda3486afe9673b4b03fb18e51dcfa2b3304a..0b0385e735a68292472aa2388ec060f0d1a6175f 100644
--- a/DDCond/src/plugins/ConditionsRepositoryParser.cpp
+++ b/DDCond/src/plugins/ConditionsRepositoryParser.cpp
@@ -23,7 +23,7 @@
#include "DD4hep/OpaqueDataBinder.h"
//#include "DD4hep/ConditionsKeyAssign.h"
#include "DD4hep/DetFactoryHelper.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "DDCond/ConditionsTags.h"
#include "DDCond/ConditionsManager.h"
diff --git a/DDCond/src/plugins/ConditionsRepositoryWriter.cpp b/DDCond/src/plugins/ConditionsRepositoryWriter.cpp
index fa3a688295bf80ccc640ed7dad0690dfdfcb1afc..e6d1245e146963f38887b72dce07a5baa9142150 100644
--- a/DDCond/src/plugins/ConditionsRepositoryWriter.cpp
+++ b/DDCond/src/plugins/ConditionsRepositoryWriter.cpp
@@ -98,8 +98,8 @@ namespace DD4hep {
#include "DD4hep/OpaqueDataBinder.h"
#include "DD4hep/ConditionsProcessor.h"
#include "DD4hep/DetFactoryHelper.h"
-#include "DD4hep/objects/ConditionsInterna.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
#include "DDCond/ConditionsTags.h"
#include "DDCond/ConditionsSlice.h"
@@ -332,20 +332,20 @@ size_t ConditionsXMLRepositoryWriter::collect(XML::Element root,
{
size_t count = 0;
if ( detector.isValid() ) {
- DetElementConditionsCollector select(detector);
- slice.scan(select);
- if ( !select.conditions.empty() ) {
+ std::vector<Conditions::Condition> conds;
+ conditionsCollector(slice,conds)(detector);
+ if ( !conds.empty() ) {
stringstream comment;
Condition cond_align, cond_delta;
XML::Element conditions = XML::Element(root.document(),_UC(detelement));
conditions.setAttr(_U(path),detector.path());
printout(s_printLevel,"Writer","++ Conditions of DE %s [%d entries]",
- detector.path().c_str(), int(select.conditions.size()));
+ detector.path().c_str(), int(conds.size()));
comment << " DDCond conditions for DetElement " << detector.path()
- << " Total of " << int(select.conditions.size()) << " Entries. ";
+ << " Total of " << int(conds.size()) << " Entries. ";
root.addComment(comment.str());
root.append(conditions);
- for(const auto& c : select.conditions ) {
+ for(const auto& c : conds ) {
std::string nam = c.name();
std::string cn = nam.substr(nam.find('#')+1);
ReferenceBitMask<Condition::mask_type> msk(c->flags);
diff --git a/DDCond/src/plugins/ConditionsUserPool.cpp b/DDCond/src/plugins/ConditionsUserPool.cpp
index e5761608d5d085873fea76d44e2fa4fb80864b6c..46dfd1b067ff366e154f141b0d055437af716f5f 100644
--- a/DDCond/src/plugins/ConditionsUserPool.cpp
+++ b/DDCond/src/plugins/ConditionsUserPool.cpp
@@ -15,6 +15,7 @@
// Framework include files
#include "DDCond/ConditionsPool.h"
+#include "DD4hep/ConditionsMap.h"
// C/C++ include files
#include <map>
@@ -63,41 +64,57 @@ namespace DD4hep {
/// Default destructor
virtual ~ConditionsMappedUserPool();
/// Print pool content
- virtual void print(const std::string& opt) const;
+ virtual void print(const std::string& opt) const override;
/// Total entry count
- virtual size_t size() const;
+ virtual size_t size() const override;
/// Full cleanup of all managed conditions.
- virtual void clear();
+ virtual void clear() override;
/// Check a condition for existence
- virtual bool exists(key_type hash) const;
+ virtual bool exists(key_type hash) const override;
/// Check a condition for existence
- virtual bool exists(const ConditionKey& key) const;
+ virtual bool exists(const ConditionKey& key) const override;
/// Check if a condition exists in the pool and return it to the caller
- virtual Condition get(key_type hash) const;
+ virtual Condition get(key_type hash) const override;
/// Check if a condition exists in the pool and return it to the caller
- virtual Condition get(const ConditionKey& key) const;
+ virtual Condition get(const ConditionKey& key) const override;
+
/// Remove condition by key from pool.
- virtual bool remove(key_type hash_key);
+ virtual bool remove(key_type hash_key) override;
/// Remove condition by key from pool.
- virtual bool remove(const ConditionKey& key);
+ virtual bool remove(const ConditionKey& key) override;
/// Register a new condition to this pool
- virtual bool insert(Condition cond);
+ virtual bool insert(Condition cond) override;
+
/// ConditionsMap overload: Add a condition directly to the slice
- virtual bool insert(DetElement detector, unsigned int key, Condition condition);
+ virtual bool insert(DetElement detector, itemkey_type key, Condition condition) override;
/// ConditionsMap overload: Access a condition
- virtual Condition get(DetElement detector, unsigned int key) const;
+ virtual Condition get(DetElement detector, itemkey_type key) const override;
+ /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+ virtual std::vector<Condition> get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const override;
+ /// Access all conditions within the key range of a detector element
+ virtual std::vector<Condition> get(key_type lower, key_type upper) const override;
+
+ /// ConditionsMap overload: Interface to scan data content of the conditions mapping
+ virtual void scan(const Processor& processor) const override;
+ /// ConditionsMap overload: Interface to scan data content of the conditions mapping
+ virtual void scan(key_type lower, key_type upper, const Processor& processor) const override;
/// ConditionsMap overload: Interface to scan data content of the conditions mapping
- virtual void scan(Condition::Processor& processor) const;
+ virtual void scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const override;
/// Prepare user pool for usage (load, fill etc.) according to required IOV
virtual Result prepare(const IOV& required,
ConditionsSlice& slice,
- void* user_param);
+ void* user_param) override;
/// Evaluate and register all derived conditions from the dependency list
virtual size_t compute(const Dependencies& dependencies,
void* user_param,
- bool force);
+ bool force) override;
/// Prepare user pool for usage (load, fill etc.) according to required IOV
virtual Result load (const IOV& required,
@@ -147,11 +164,11 @@ namespace {
class SimplePrint : public Condition::Processor {
/// Conditions callback for object processing
- virtual int process(Condition) override { return 1; }
+ virtual int process(Condition) const override { return 1; }
/// Conditions callback for object processing
- virtual int operator()(Condition) override { return 1; }
+ virtual int operator()(Condition) const override { return 1; }
/// Conditions callback for object processing in maps
- virtual int operator()(const pair<Condition::key_type,Condition>& i) override {
+ virtual int operator()(const pair<Condition::key_type,Condition>& i) const override {
Condition c = i.second;
printout(INFO,"UserPool","++ %16llX/%16llX Val:%s %s",i.first, c->hash, c->value.c_str(), c.str().c_str());
return 1;
@@ -303,14 +320,58 @@ Condition ConditionsMappedUserPool<MAPPING>::get(DetElement detector, unsigned i
ConditionKey::KeyMaker m(detector.key(),item_key);
return get(m.hash);
}
+
+/// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+template<typename MAPPING> std::vector<Condition>
+ConditionsMappedUserPool<MAPPING>::get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const {
+ ConditionKey::detkey_type det_key = detector.key();
+ return this->get(ConditionKey::KeyMaker(det_key,lower).hash,
+ ConditionKey::KeyMaker(det_key,upper).hash);
+}
+
+/// Specialization for std::map: Access all conditions within a given key range
+template<typename MAPPING> std::vector<Condition>
+ConditionsMappedUserPool<MAPPING>::get(key_type lower, key_type upper) const {
+ vector<Condition> result;
+ typename MAPPING::const_iterator first = m_conditions.lower_bound(lower);
+ for(; first != m_conditions.end() && (*first).first <= upper; ++first )
+ result.push_back((*first).second);
+ return result;
+}
/// ConditionsMap overload: Interface to scan data content of the conditions mapping
template<typename MAPPING>
-void ConditionsMappedUserPool<MAPPING>::scan(Condition::Processor& processor) const {
+void ConditionsMappedUserPool<MAPPING>::scan(const Processor& processor) const {
for( const auto& i : m_conditions )
processor(i.second);
}
+/// ConditionsMap overload: Interface to scan data content of the conditions mapping
+template<typename MAPPING>
+void ConditionsMappedUserPool<MAPPING>::scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const
+{
+ ConditionKey::detkey_type det_key = detector.key();
+ scan(ConditionKey::KeyMaker(det_key,lower).hash,
+ ConditionKey::KeyMaker(det_key,upper).hash,
+ processor);
+}
+
+/// ConditionsMap overload: Interface to scan data content of the conditions mapping
+template<typename MAPPING>
+void ConditionsMappedUserPool<MAPPING>::scan(key_type lower,
+ key_type upper,
+ const Processor& processor) const
+{
+ typename MAPPING::const_iterator first = m_conditions.lower_bound(lower);
+ for(; first != m_conditions.end() && (*first).first <= upper; ++first )
+ processor((*first).second);
+}
+
/// Remove condition by key from pool.
template<typename MAPPING>
bool ConditionsMappedUserPool<MAPPING>::remove(const ConditionKey& key) {
@@ -647,6 +708,41 @@ ConditionsMappedUserPool<MAPPING>::compute(const IOV& required,
return result;
}
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+ /// Namespace for the geometry part of the AIDA detector description toolkit
+ namespace Conditions {
+
+ typedef unordered_map<Condition::key_type,Condition::Object*> umap_t;
+
+ /// Access all conditions within a given key range
+ /** Specialization necessary, since unordered maps have no lower bound.
+ */
+ template<> void
+ ConditionsMappedUserPool<umap_t>::scan(key_type lower,
+ key_type upper,
+ const Processor& processor) const {
+ for( const auto& e : m_conditions )
+ if ( e.second->hash >= lower && e.second->hash <= upper )
+ processor(e.second);
+ }
+ /// Access all conditions within a given key range
+ /** Specialization necessary, since unordered maps have no lower bound.
+ */
+ template<> std::vector<Condition>
+ ConditionsMappedUserPool<umap_t>::get(key_type lower, key_type upper) const {
+ vector<Condition> result;
+ for( const auto& e : m_conditions ) {
+ if ( e.second->hash >= lower && e.second->hash <= upper )
+ result.push_back(e.second);
+ }
+ return result;
+ }
+ } /* End namespace Conditions */
+} /* End namespace DD4hep */
+
namespace {
template <typename MAPPING>
void* create_pool(Geometry::LCDD&, int argc, char** argv) {
@@ -666,8 +762,7 @@ void* create_map_user_pool(Geometry::LCDD& lcdd, int argc, char** argv)
{ return create_pool<map<Condition::key_type,Condition::Object*> >(lcdd, argc, argv); }
DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsMapUserPool, create_map_user_pool)
-// Factory for the user pool using a unordered map (hash-map)
+// Factory for the user pool using a binary tree map
void* create_unordered_map_user_pool(Geometry::LCDD& lcdd, int argc, char** argv)
{ return create_pool<unordered_map<Condition::key_type,Condition::Object*> >(lcdd, argc, argv); }
-DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsUnorderedMapUserPool, create_unordered_map_user_pool)
-
+DECLARE_LCDD_CONSTRUCTOR(DD4hep_ConditionsUnorderedMapUserPool, create_map_user_pool)
diff --git a/DDCond/src/plugins/ConditionsXmlLoader.cpp b/DDCond/src/plugins/ConditionsXmlLoader.cpp
index 31b758eed96d4e5a61985fe81c6ffb584e3d7719..aafe8c640450c47d722ba9792774697bc839b31f 100644
--- a/DDCond/src/plugins/ConditionsXmlLoader.cpp
+++ b/DDCond/src/plugins/ConditionsXmlLoader.cpp
@@ -69,7 +69,7 @@ namespace DD4hep {
#include "DD4hep/Printout.h"
#include "DD4hep/Factories.h"
#include "DD4hep/PluginCreators.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
#include "XML/XMLElements.h"
#include "XML/DocumentHandler.h"
diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt
index e97409d671a54453fb512d3b9da6b8f6b3b79c5d..3538cc16934ddcea5945b2597764954b367f9167 100644
--- a/DDCore/CMakeLists.txt
+++ b/DDCore/CMakeLists.txt
@@ -19,7 +19,7 @@ dd4hep_package( DDCore
#---Generate ROOT dictionary------------------------------------------------------
dd4hep_add_dictionary( G__DD4hep
SOURCES include/DD4hep/*.h
- include/DD4hep/objects/*.h
+ include/DD4hep/detail/*.h
include/XML/*.h
${DDSegmentation_INCLUDE_DIRS}/DDSegmentation/BitField64.h
${DDSegmentation_INCLUDE_DIRS}/DDSegmentation/Segmentation.h
diff --git a/DDCore/include/DD4hep/AlignedVolumePrinter.h b/DDCore/include/DD4hep/AlignedVolumePrinter.h
deleted file mode 100644
index ce94fb05dc4107528d27ab4519720aecc94538cf..0000000000000000000000000000000000000000
--- a/DDCore/include/DD4hep/AlignedVolumePrinter.h
+++ /dev/null
@@ -1,65 +0,0 @@
-//==========================================================================
-// AIDA Detector description implementation for LCD
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see $DD4hepINSTALL/LICENSE.
-// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
-//
-// Author : M.Frank
-//
-//==========================================================================
-#ifndef DD4HEP_DDCORE_ALIGNEDVOLUMEPRINTER_H
-#define DD4HEP_DDCORE_ALIGNEDVOLUMEPRINTER_H
-
-// Framework includes
-#include "DD4hep/Printout.h"
-#include "DD4hep/AlignmentsProcessor.h"
-
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
- /// Namespace for the AIDA detector description toolkit supporting XML utilities
- namespace Alignments {
-
- /// Generic Alignments data dumper.
- /**
- * Please note that the principle of locality applies:
- * The object is designed for stack allocation and configuration.
- * It may NOT be shared across threads!
- *
- * \author M.Frank
- * \version 1.0
- * \date 31/03/2016
- * \ingroup DD4HEP_DDDB
- */
- class AlignedVolumePrinter : public AlignmentsProcessor {
- public:
- /// Printer name. Want to know who is printing what
- std::string name;
- /// Printout prefix
- std::string prefix;
- /// Printout level
- PrintLevel printLevel;
- protected:
- /// Printout processing and customization flag
- int m_flag;
-
- public:
- /// Initializing constructor
- AlignedVolumePrinter(ConditionsMap* map, const std::string& prefix="",int flags=0);
- /// Default destructor
- virtual ~AlignedVolumePrinter() = default;
- /// Set name for printouts
- void setName(const std::string& value) { name = value; }
- /// Set prefix for printouts
- void setPrefix(const std::string& value) { prefix = value; }
- /// Callback to output alignments information
- virtual int operator()(Alignment cond) override;
- /// Callback to output alignments information of an entire DetElement
- virtual int processElement(DetElement de) override;
- };
- } /* End namespace Alignments */
-} /* End namespace DD4hep */
-#endif /* DD4HEP_DDCORE_ALIGNEDVOLUMEPRINTER_H */
diff --git a/DDCore/include/DD4hep/Alignments.h b/DDCore/include/DD4hep/Alignments.h
index 15a22ae4add44b4792cb600ca2f42d356be911a1..164f702722a041615f61127da2d85d1d37f3952a 100644
--- a/DDCore/include/DD4hep/Alignments.h
+++ b/DDCore/include/DD4hep/Alignments.h
@@ -128,7 +128,7 @@ namespace DD4hep {
/// Default destructor
virtual ~Processor() = default;
/// Container callback for object processing
- virtual int operator()(Alignment container) = 0;
+ virtual int operator()(Alignment alignment) const = 0;
};
/// Forward definition of the geometry placement
diff --git a/DDCore/include/DD4hep/AlignmentsPrinter.h b/DDCore/include/DD4hep/AlignmentsPrinter.h
index 198d2df8f2ba10becbc87a0055b4d4841566e338..e3149a0ba28eeb08907d4a20f79fbd78b6cc6833 100644
--- a/DDCore/include/DD4hep/AlignmentsPrinter.h
+++ b/DDCore/include/DD4hep/AlignmentsPrinter.h
@@ -35,21 +35,23 @@ namespace DD4hep {
* \date 31/03/2016
* \ingroup DD4HEP_DDDB
*/
- class AlignmentsPrinter : public Alignment::Processor, public DetElement::Processor {
+ class AlignmentsPrinter /* : public Alignment::Processor , public DetElement::Processor */ {
public:
/// Conditionsmap to resolve things
ConditionsMap* mapping;
/// Printer name. Want to know who is printing what
- std::string name;
+ std::string name;
/// Printout prefix
- std::string prefix;
+ std::string prefix;
/// Printout level
- PrintLevel printLevel;
+ PrintLevel printLevel;
protected:
/// Printout processing and customization flag
- int m_flag;
+ int m_flag;
public:
+ /// No default constructor
+ AlignmentsPrinter() = delete;
/// Initializing constructor
AlignmentsPrinter(ConditionsMap* m, const std::string& prefix="",int flags=0);
/// Default destructor
@@ -58,10 +60,57 @@ namespace DD4hep {
void setName(const std::string& value) { name = value; }
/// Set prefix for printouts
void setPrefix(const std::string& value) { prefix = value; }
+ /// Callback to output alignments information of an entire DetElement
+ virtual int operator()(DetElement de, int level) const;
/// Callback to output alignments information
- virtual int operator()(Alignment cond) override;
+ virtual int operator()(Alignment alignment) const;
/// Processing callback to print alignments of a detector element
- virtual int processElement(DetElement de) override;
+ //virtual int processElement(DetElement de) override;
+ };
+
+
+ /// Generic Alignments data dumper.
+ /**
+ * Please note that the principle of locality applies:
+ * The object is designed for stack allocation and configuration.
+ * It may NOT be shared across threads!
+ *
+ * \author M.Frank
+ * \version 1.0
+ * \date 31/03/2016
+ * \ingroup DD4HEP_DDDB
+ */
+ class AlignedVolumePrinter : public AlignmentsPrinter {
+#if 0
+ public:
+ /// Printer name. Want to know who is printing what
+ std::string name;
+ /// Printout prefix
+ std::string prefix;
+ /// Printout level
+ PrintLevel printLevel;
+ protected:
+ /// Printout processing and customization flag
+ int m_flag;
+#endif
+ public:
+ /// No default constructor
+ AlignedVolumePrinter() = delete;
+ /// Initializing constructor
+ AlignedVolumePrinter(ConditionsMap* map, const std::string& prefix="",int flags=0);
+ /// Default destructor
+ virtual ~AlignedVolumePrinter() = default;
+ /// Set name for printouts
+ //void setName(const std::string& value) { name = value; }
+ /// Set prefix for printouts
+ //void setPrefix(const std::string& value) { prefix = value; }
+ /// Callback to output alignments information of an entire DetElement
+ virtual int operator()(DetElement de, int level) const override
+ { return this->AlignmentsPrinter::operator()(de,level); }
+ /// Callback to output alignments information
+ virtual int operator()(Alignment cond) const override;
+ /// Callback to output alignments information of an entire DetElement
+ //virtual int processElement(DetElement de) override;
};
/// Default printout of an alignment entry
diff --git a/DDCore/include/DD4hep/AlignmentsProcessor.h b/DDCore/include/DD4hep/AlignmentsProcessor.h
index 6171afe14dc8e09aea11ac73b0e2ddcc2b46d5a6..497fc0da39126b2fa0f3d2a0f0497b389efcb27d 100644
--- a/DDCore/include/DD4hep/AlignmentsProcessor.h
+++ b/DDCore/include/DD4hep/AlignmentsProcessor.h
@@ -14,109 +14,168 @@
#define DD4HEP_DDALIGN_ALIGNMENTSPROCESSOR_H
// Framework includes
-#include "DD4hep/ConditionsProcessor.h"
+#include "DD4hep/ConditionsMap.h"
#include "DD4hep/AlignmentData.h"
#include "DD4hep/Alignments.h"
+#include "DD4hep/Printout.h"
/// Namespace for the AIDA detector description toolkit
namespace DD4hep {
/// Namespace for the AIDA detector description toolkit supporting XML utilities
namespace Alignments {
-
- /// Generic Alignments processor
+
+ /// Generic alignment processor facade for the Conditons::Processor object
/**
- * Please note that the principle of locality applies:
- * The object is designed for stack allocation and configuration.
- * It may NOT be shared across threads!
- *
- * If applied to alignments container or detector elements,
- * it is the user responsibility to beforehand set a valid
- * alignments user pool containing the alignments registered
- * to the detector element(s).
- *
- * \author M.Frank
- * \version 1.0
- * \date 31/03/2016
- * \ingroup DD4HEP_ALIGNMENTS
+ * This wrapper converts any object, which has the signature
+ * int operator()(Alignment cond) const
+ * The object is automatically wrapped to a Alignment::Processor object
+ * and allows to scan trees using e.g. DetElementProcessors etc.
+ *
+ * \author M.Frank
+ * \version 1.0
+ * \date 01/04/2016
*/
- class AlignmentsProcessor
- : public Alignment::Processor, public DetElement::Processor
- {
- protected:
- /// Reference to the user pool
- ConditionsMap* mapping;
-
+ template <typename T> class AlignmentsProcessor : public Alignment::Processor {
+ T& processor;
public:
+ /// Default constructor
+ AlignmentsProcessor() = default;
/// Initializing constructor
- AlignmentsProcessor(ConditionsMap* p) : mapping(p) {}
+ AlignmentsProcessor(T& p) : processor(p) {}
+ /// Copy constructor
+ AlignmentsProcessor(const AlignmentsProcessor& copy) = default;
/// Default destructor
virtual ~AlignmentsProcessor() = default;
- /// Callback to output alignments information
- virtual int operator()(Alignment cond) override;
- /// Callback to output alignments information of an entire DetElement
- virtual int processElement(DetElement de) override;
+ /// Assignment operator
+ AlignmentsProcessor& operator=(const AlignmentsProcessor& copy) = default;
+ /// Processing callback
+ virtual int operator()(Alignment alignment) const override {
+ return (processor)(alignment);
+ }
};
+ /// Creator utility function for AlignmentsProcessor objects
+ template <typename T> inline AlignmentsProcessor<T> alignmentsProcessor(T* obj) {
+ return AlignmentsProcessor<T>(obj);
+ }
- /// Generic Alignment object collector
+ /// Generic alignment processor facade for the Conditons::Processor object
/**
- * Please see the documentation of the
- * AlignmentsProcessor base class for further information.
+ * This wrapper converts any object, which has the signature
+ * int operator()(Alignment cond) const
+ * The object is automatically wrapped to a Alignment::Processor object
+ * and allows to scan trees using e.g. DetElementProcessors etc.
*
+ *
+ * \author M.Frank
+ * \version 1.0
+ * \date 01/04/2016
*/
- class AlignmentsCollector : virtual public AlignmentsProcessor {
- public:
- /// Collection container
- std::vector<Alignment> alignments;
+ template <typename T> class AlignmentsProcessorWrapper : public Alignment::Processor {
+ std::unique_ptr<T> processor;
public:
/// Default constructor
- AlignmentsCollector(ConditionsMap* p) : AlignmentsProcessor(p) {}
+ AlignmentsProcessorWrapper() = default;
+ /// Initializing constructor
+ AlignmentsProcessorWrapper(T* p) : processor(p) {}
+ /// Copy constructor
+ AlignmentsProcessorWrapper(const AlignmentsProcessorWrapper& copy) = default;
/// Default destructor
- virtual ~AlignmentsCollector() = default;
- /// Callback to output alignments information
- virtual int operator()(Alignment cond) final {
- alignments.push_back(cond);
- return 1;
+ virtual ~AlignmentsProcessorWrapper() = default;
+ /// Assignment operator
+ AlignmentsProcessorWrapper& operator=(const AlignmentsProcessorWrapper& copy) = default;
+ /// Processing callback
+ virtual int operator()(Alignment c) const override {
+ return (*(processor.get()))(c);
}
};
+ /// Creator utility function for AlignmentsProcessorWrapper objects
+ template <typename T> inline AlignmentsProcessorWrapper<T>* createProcessorWrapper(T* obj) {
+ return new AlignmentsProcessorWrapper<T>(obj);
+ }
+ /// Creator utility function for AlignmentsProcessorWrapper objects
+ template <typename T> inline AlignmentsProcessorWrapper<T> processorWrapper(T* obj) {
+ return AlignmentsProcessorWrapper<T>(obj);
+ }
/// Generic Alignment-Delta collector keyed by detector elements
/**
* To be used with utilities like DetElementProcessor etc.
*
+ *
+ * \author M.Frank
+ * \version 1.0
+ * \date 01/04/2016
*/
- class DetElementDeltaCollector {
+ template <typename T> class DeltaCollector {
public:
/// Reference to the user pool
- ConditionsMap* mapping;
+ ConditionsMap& mapping;
/// Collection container
- std::map<DetElement,Delta> deltas;
+ T& deltas;
public:
/// Default constructor
- DetElementDeltaCollector(ConditionsMap* p) : mapping(p) {}
+ DeltaCollector(ConditionsMap& m, T& d) : mapping(m), deltas(d) {}
+ /// Copy constructor
+ DeltaCollector(const DeltaCollector& copy) = default;
/// Default destructor
- virtual ~DetElementDeltaCollector() = default;
+ ~DeltaCollector() = default;
+ /// Assignment operator
+ DeltaCollector& operator=(const DeltaCollector& copy) = default;
/// Callback to output alignments information
- virtual int operator()(DetElement de, int level) final;
+ /** Note: Valid implementations exist for the container types:
+ * std::list<Delta>
+ * std::vector<Delta>
+ * std::map<DetElement,Delta>
+ * std::multimap<DetElement,Delta>
+ * std::map<std::string,Delta> key = DetElement.path()
+ * std::multimap<std::string,Delta> key = DetElement.path()
+ */
+ virtual int operator()(DetElement de, int level=0) const final;
};
-
- /// Helper to select all alignments, which belong to a single DetElement structure
+ template <typename T> inline DeltaCollector<T> deltaCollector(ConditionsMap& m, T& deltas) {
+ return DeltaCollector<T>(m, deltas);
+ }
+
+ /// Generic alignment collector keyed by detector elements
/**
+ * To be used with utilities like DetElementProcessor etc.
+ *
+ *
* \author M.Frank
* \version 1.0
- * \ingroup DD4HEP_ALIGNMENTS
+ * \date 01/04/2016
*/
- class DetElementAlignmentsCollector : public Conditions::Condition::Processor {
+ template <typename T> class AlignmentsCollector {
public:
- Conditions::ConditionKey key;
- mutable std::vector<Alignment> alignments;
+ /// Reference to the user pool
+ ConditionsMap& mapping;
+ /// Collection container
+ T& alignments;
public:
- /// Standard constructor
- DetElementAlignmentsCollector(DetElement de) : key(de.key(),0) {}
- /// Overloadable entry: Selection callback: return true if the alignment should be selected
- virtual int process(Conditions::Condition cond) final;
+ /// Default constructor
+ AlignmentsCollector(ConditionsMap& m, T& d) : mapping(m), alignments(d) {}
+ /// Copy constructor
+ AlignmentsCollector(const AlignmentsCollector& copy) = default;
+ /// Default destructor
+ ~AlignmentsCollector() = default;
+ /// Assignment operator
+ AlignmentsCollector& operator=(const AlignmentsCollector& copy) = default;
+ /// Callback to output alignments information
+ /** Note: Valid implementations exist for the container types:
+ * std::list<Alignment>
+ * std::vector<Alignment>
+ * std::map<DetElement,Alignment>
+ * std::multimap<DetElement,Alignment>
+ * std::map<std::string,Alignment> key = DetElement.path()
+ * std::multimap<std::string,Alignment> key = DetElement.path()
+ */
+ virtual int operator()(DetElement de, int level=0) const final;
};
-
+ template <typename T> inline AlignmentsCollector<T> alignmentsCollector(ConditionsMap& m, T& alignments) {
+ return AlignmentsCollector<T>(m, alignments);
+ }
+
} /* End namespace Alignments */
} /* End namespace DD4hep */
#endif /* DD4HEP_DDALIGN_ALIGNMENTSPROCESSOR_H */
diff --git a/DDCore/include/DD4hep/ConditionDerived.h b/DDCore/include/DD4hep/ConditionDerived.h
index 3290a500a1718b2558e7caec7a526c289f0f6808..0ddc6652c0d769ba41e9fb2a76b64eeac836b936 100644
--- a/DDCore/include/DD4hep/ConditionDerived.h
+++ b/DDCore/include/DD4hep/ConditionDerived.h
@@ -16,7 +16,7 @@
// Framework include files
#include "DD4hep/Memory.h"
#include "DD4hep/Conditions.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
/// Namespace for the AIDA detector description toolkit
namespace DD4hep {
@@ -190,6 +190,8 @@ namespace DD4hep {
public:
/// Initializing constructor used by builder
ConditionDependency(Geometry::DetElement de, unsigned int item_key, ConditionUpdateCall* call);
+ /// Initializing constructor used by builder
+ ConditionDependency(Geometry::DetElement de, const std::string& item, ConditionUpdateCall* call);
/// Default constructor
ConditionDependency();
/// Access the dependency key
@@ -215,6 +217,8 @@ namespace DD4hep {
public:
/// Initializing constructor
DependencyBuilder(Geometry::DetElement de, unsigned int item_key, ConditionUpdateCall* call);
+ /// Initializing constructor
+ DependencyBuilder(Geometry::DetElement de, const std::string& item, ConditionUpdateCall* call);
/// Default destructor
virtual ~DependencyBuilder();
/// Access underlying object directly
diff --git a/DDCore/include/DD4hep/Conditions.h b/DDCore/include/DD4hep/Conditions.h
index 1661c373cb450639d4402b35c4becd023ddb5008..430335ac0294b002ad30aea93fdd3dd85e1680e2 100644
--- a/DDCore/include/DD4hep/Conditions.h
+++ b/DDCore/include/DD4hep/Conditions.h
@@ -65,11 +65,15 @@ namespace DD4hep {
class Condition: public Handle<Interna::ConditionObject> {
public:
/// Forward definition of the key type
- typedef unsigned long long int key_type;
+ typedef unsigned long long int key_type;
+ /// High part of the key identifies the detector element
+ typedef unsigned int detkey_type;
+ /// Low part of the key identifies the item identifier
+ typedef unsigned int itemkey_type;
/// Forward definition of the iov type
- typedef IOV iov_type;
+ typedef IOV iov_type;
/// Forward definition of the object properties
- typedef unsigned int mask_type;
+ typedef unsigned int mask_type;
public:
enum StringFlags {
@@ -114,13 +118,13 @@ namespace DD4hep {
/// Default destructor
virtual ~Processor() = default;
/// Processing callback
- virtual int process(Condition c) = 0;
+ virtual int process(Condition c) const = 0;
/// Conditions callback for object processing
- virtual int operator()(Condition c)
- { return this->process(c); }
+ virtual int operator()(Condition c) const
+ { return this->process(c); }
/// Conditions callback for object processing in maps
- virtual int operator()(const std::pair<Condition::key_type,Condition>& e)
- { return this->process(e.second); }
+ virtual int operator()(const std::pair<Condition::key_type,Condition>& e) const
+ { return this->process(e.second); }
};
/// Default constructor
@@ -130,7 +134,7 @@ namespace DD4hep {
/// Initializing constructor
Condition(Object* p);
/// Constructor to be used when reading the already parsed object
- template <typename Q> Condition(const Handle<Q>& e) : Handle<Object>(e) {}
+ template <typename Q> Condition(const Handle<Q>& e);
/// Initializing constructor for a pure, undecorated conditions object
Condition(const std::string& name, const std::string& type);
/// Initializing constructor for a pure, undecorated conditions object with payload buffer
@@ -171,9 +175,9 @@ namespace DD4hep {
/// Hash identifier
key_type key() const;
/// DetElement part of the identifier
- unsigned int detector_key() const;
+ detkey_type detector_key() const;
/// Item part of the identifier
- unsigned int item_key() const;
+ itemkey_type item_key() const;
/** Conditions handling */
/// Re-evaluate the conditions data according to the previous bound type definition
@@ -200,8 +204,12 @@ namespace DD4hep {
};
/// Initializing constructor
- inline Condition::Condition(Condition::Object* p) : Handle<Condition::Object>(p) {
- }
+ inline Condition::Condition(Condition::Object* p)
+ : Handle<Condition::Object>(p) {}
+
+ /// Constructor to be used when reading the already parsed object
+ template <typename Q> inline Condition::Condition(const Handle<Q>& e)
+ : Handle<Condition::Object>(e) {}
/// Key definition to optimize ans simplyfy the access to conditions entities
@@ -214,6 +222,8 @@ namespace DD4hep {
public:
/// Forward definition of the key type
typedef Condition::key_type key_type;
+ typedef Condition::detkey_type detkey_type;
+ typedef Condition::itemkey_type itemkey_type;
#ifdef DD4HEP_CONDITIONKEY_HAVE_NAME
/// Optional string identifier. Helps debugging a lot!
std::string name;
@@ -223,9 +233,13 @@ namespace DD4hep {
union KeyMaker {
key_type hash;
+ /** Note: The memory layout is important here to have properly
+ * ordered maps. The detector key MUST be on the high end
+ * of the resulting int64 'hash'.
+ */
struct {
- unsigned int det_key;
- unsigned int item_key;
+ itemkey_type item_key;
+ detkey_type det_key;
} values;
KeyMaker() {
this->hash = 0;
@@ -233,7 +247,7 @@ namespace DD4hep {
KeyMaker(key_type k) {
this->hash = k;
}
- KeyMaker(unsigned int det, unsigned int item) {
+ KeyMaker(detkey_type det, itemkey_type item) {
this->values.det_key = det;
this->values.item_key = item;
}
@@ -257,20 +271,20 @@ namespace DD4hep {
/// Constructor from string
ConditionKey(DetElement detector, const std::string& identifier);
/// Constructor from detector element key and item sub-key
- ConditionKey(unsigned int det_key, const std::string& identifier);
+ ConditionKey(detkey_type det_key, const std::string& identifier);
/// Constructor from detector element and item sub-key
- ConditionKey(DetElement detector, unsigned int item_key);
+ ConditionKey(DetElement detector, itemkey_type item_key);
/// Constructor from detector element key and item sub-key
- ConditionKey(unsigned int det_key, unsigned int item_key);
+ ConditionKey(detkey_type det_key, itemkey_type item_key);
/// Copy constructor
ConditionKey(const ConditionKey& c) = default;
/// Access the detector element part of the key
- unsigned int detector_key() const {
+ detkey_type detector_key() const {
return KeyMaker(hash).values.det_key;
}
/// Access the detector element part of the key
- unsigned int item_key() const {
+ itemkey_type item_key() const {
return KeyMaker(hash).values.item_key;
}
/// Hash code generation from input string
@@ -278,9 +292,9 @@ namespace DD4hep {
/// Hash code generation from input string
static key_type hashCode(DetElement detector, const std::string& value);
/// 32 bit hashcode of the item
- static unsigned int itemCode(const char* value);
+ static itemkey_type itemCode(const char* value);
/// 32 bit hashcode of the item
- static unsigned int itemCode(const std::string& value);
+ static itemkey_type itemCode(const std::string& value);
/// Assignment operator from object copy
ConditionKey& operator=(const ConditionKey& key) = default;
@@ -300,7 +314,7 @@ namespace DD4hep {
};
/// Constructor from detector element key and item sub-key
- inline ConditionKey::ConditionKey(unsigned int det_key, unsigned int item_key) {
+ inline ConditionKey::ConditionKey(detkey_type det_key, itemkey_type item_key) {
hash = KeyMaker(det_key,item_key).hash;
}
diff --git a/DDCore/include/DD4hep/ConditionsData.h b/DDCore/include/DD4hep/ConditionsData.h
index 48145942731f9bbb71e73a6b620e9919ebf28a81..38659a2b0371e3ee51eb2325b6e71bbcfbf0c4ec 100644
--- a/DDCore/include/DD4hep/ConditionsData.h
+++ b/DDCore/include/DD4hep/ConditionsData.h
@@ -16,7 +16,7 @@
// Framework include files
#include "DD4hep/Objects.h"
#include "DD4hep/Conditions.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
// C/C++ include files
#include <vector>
diff --git a/DDCore/include/DD4hep/ConditionsMap.h b/DDCore/include/DD4hep/ConditionsMap.h
index cc6ddb2ab01e567750fea583a4cc4c894a185d47..5db6057c148b0ea0d5a7f7527eb858da43a4c5fd 100644
--- a/DDCore/include/DD4hep/ConditionsMap.h
+++ b/DDCore/include/DD4hep/ConditionsMap.h
@@ -27,24 +27,69 @@ namespace DD4hep {
/// Namespace for the conditions part of the AIDA detector description toolkit
namespace Conditions {
- /// ConditionsMap class
+ /// ConditionsMap class.
/**
+ * The conditions map class is the basic interface to manage/access conditions
+ * in DD4hep. It's main use is to provide a common interface to utilities using
+ * DD4hep conditions, such as scanners, selectors, printers etc.
+ * Such utilities often require access to conditions sets based on individual
+ * DetElement instances.
+ *
* \author M.Frank
* \version 1.0
* \ingroup DD4HEP_CONDITIONS
*/
class ConditionsMap {
public:
- typedef Condition::key_type key_type;
+ typedef Condition::key_type key_type;
+ typedef Condition::detkey_type detkey_type;
+ typedef Condition::itemkey_type itemkey_type;
+ typedef Condition::Processor Processor;
+ enum {
+ FIRST_ITEM = 0x0,
+ LAST_ITEM = ~0x0
+ };
+ enum {
+ FIRST_KEY = 0x0ULL,
+ LAST_KEY = ~0x0ULL
+ };
+
public:
/// Standard destructor
virtual ~ConditionsMap() = default;
- /// Insert a new entry to the map
- virtual bool insert(DetElement detector, unsigned int key, Condition condition) = 0;
- /// Interface to access conditions by hash value
- virtual Condition get(DetElement detector, unsigned int key) const = 0;
+ /// Insert a new entry to the map. The detector element key and the item key make a unique global conditions key
+ virtual bool insert(DetElement detector, itemkey_type key, Condition condition) = 0;
+ /// Interface to access conditions by hash value. The detector element key and the item key make a unique global conditions key
+ virtual Condition get(DetElement detector, itemkey_type key) const = 0;
/// Interface to scan data content of the conditions mapping
- virtual void scan(Condition::Processor& processor) const = 0;
+ virtual void scan(const Processor& processor) const = 0;
+
+ /** Partial implementations for utilities accessing DetElement conditions */
+
+ /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+ /** Note: This default implementation uses
+ * std::vector<Condition> get(DetElement detector,
+ * itemkey_type lower,
+ * itemkey_type upper)
+ * The performance depends on the concrete implementation of the scan method!
+ */
+ virtual std::vector<Condition> get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const;
+
+ /// Interface to partially scan data content of the conditions mapping
+ /** Note: This default implementation assumes unordered containers and hence is
+ * not the most efficient implementation!
+ * Internally it uses "scan(Processor& processor)"
+ * the subselection hence is linearly depending of the number of elements.
+ *
+ * Using ordered maps with "lower_bound(key)" this can be greatly improved.
+ * See the concrete implementations below.
+ */
+ virtual void scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const;
};
/// Concrete ConditionsMap implementation class using externally defined containers
@@ -68,14 +113,27 @@ namespace DD4hep {
/// No assignment
ConditionsMapping& operator=(const ConditionsMapping& copy) = delete;
/// Insert a new entry to the map
- virtual bool insert(DetElement detector, unsigned int key, Condition condition);
+ virtual bool insert(DetElement detector, itemkey_type key, Condition condition) override;
/// Interface to access conditions by hash value
- virtual Condition get(DetElement detector, unsigned int key) const;
+ virtual Condition get(DetElement detector, itemkey_type key) const override;
+ /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+ virtual std::vector<Condition> get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const override {
+ return this->ConditionsMap::get(detector,lower,upper);
+ }
/// Interface to scan data content of the conditions mapping
- virtual void scan(Condition::Processor& processor) const;
+ virtual void scan(const Processor& processor) const override;
+ /// Interface to partially scan data content of the conditions mapping
+ virtual void scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const override;
};
/// Concrete implementation of the conditions map using a left-right map
- typedef ConditionsMapping<std::map<Condition::key_type,Condition> > ConditionsTreeMap;
+ typedef ConditionsMapping<std::map<Condition::key_type,Condition> > ConditionsTreeMap;
+ /// Concrete implementation of the conditions map using a multimap
+ typedef ConditionsMapping<std::multimap<Condition::key_type,Condition> > ConditionsMultiMap;
/// Concrete implementation of the conditions map using a hashmap
typedef ConditionsMapping<std::unordered_map<Condition::key_type,Condition> > ConditionsHashMap;
diff --git a/DDCore/include/DD4hep/ConditionsPrinter.h b/DDCore/include/DD4hep/ConditionsPrinter.h
index 59dcf15947c4676bd6fc62bf0357cd6634dff965..ac9f833d9250f7f1d158106033aafef8704e926c 100644
--- a/DDCore/include/DD4hep/ConditionsPrinter.h
+++ b/DDCore/include/DD4hep/ConditionsPrinter.h
@@ -35,20 +35,20 @@ namespace DD4hep {
* \date 31/03/2016
* \ingroup DD4HEP_DDDB
*/
- class ConditionsPrinter : public Condition::Processor, public DetElement::Processor {
+ class ConditionsPrinter {
public:
/// Conditionsmap to resolve things
ConditionsMap* mapping;
/// Printer name. Want to know who is printing what
- std::string name;
+ std::string name;
/// Printout prefix
- std::string prefix;
+ std::string prefix;
/// Printout level
- PrintLevel printLevel = INFO;
+ PrintLevel printLevel = INFO;
protected:
/// Printout processing and customization flag
- int m_flag;
+ int m_flag;
public:
/// Initializing constructor
@@ -61,10 +61,10 @@ namespace DD4hep {
void setName(const std::string& value) { name = value; }
/// Set prefix for printouts
void setPrefix(const std::string& value) { prefix = value; }
- /// Actual print method
- virtual int process(Condition cond) override;
- /// Processing callback to print conditions of a detector element
- virtual int processElement(DetElement de) override;
+ /// Callback to output conditions information of an entire DetElement
+ virtual int operator()(DetElement de, int level) const;
+ /// Callback to output conditions information
+ virtual int operator()(Condition condition) const;
};
} /* End namespace Conditions */
} /* End namespace DD4hep */
diff --git a/DDCore/include/DD4hep/ConditionsProcessor.h b/DDCore/include/DD4hep/ConditionsProcessor.h
index 5588a23bed74dd47c78d8b283515484b7ff55954..e7bdc8a0a383f75b3310fa922e9ce9bfcc344f00 100644
--- a/DDCore/include/DD4hep/ConditionsProcessor.h
+++ b/DDCore/include/DD4hep/ConditionsProcessor.h
@@ -19,6 +19,7 @@
#include "DD4hep/ConditionsMap.h"
// C/C++ include files
+#include <memory>
/// Namespace for the AIDA detector description toolkit
namespace DD4hep {
@@ -26,86 +27,120 @@ namespace DD4hep {
/// Namespace for the conditions part of the AIDA detector description toolkit
namespace Conditions {
-
- /// Generic Conditions processor
+
+ /// Generic condition processor facade for the Conditons::Processor object
/**
- * Please note that the principle of locality applies:
- * The object is designed for stack allocation and configuration.
- * It may NOT be shared across threads!
- *
- * If applied to conditions container or detector elements,
- * it is the user responsibility to beforehand set a valid
- * conditions user pool containing the conditions registered
- * to the detector element(s).
- *
- * \author M.Frank
- * \version 1.0
- * \date 31/03/2016
- * \ingroup DD4HEP_CONDITIONS
+ * This wrapper converts any object, which has the signature
+ * int operator()(Condition cond) const
+ * The object is automatically wrapped to a Condition::Processor object
+ * and allows to scan trees using e.g. DetElementProcessors etc.
+ *
+ * \author M.Frank
+ * \version 1.0
+ * \date 01/04/2016
*/
- class ConditionsProcessor :
- public Condition::Processor,
- public Geometry::DetElement::Processor
- {
- public:
- /// Reference to the user pool
- ConditionsMap* mapping;
+ template <typename T> class ConditionsProcessor : public Condition::Processor {
+ T& processor;
public:
+ /// Default constructor
+ ConditionsProcessor() = default;
/// Initializing constructor
- ConditionsProcessor(ConditionsMap* p) : mapping(p) {}
+ ConditionsProcessor(T& p) : processor(p) {}
+ /// Copy constructor
+ ConditionsProcessor(const ConditionsProcessor& copy) = default;
/// Default destructor
virtual ~ConditionsProcessor() = default;
- /// Callback to output conditions information
- virtual int process(Condition cond) override;
- /// Callback to output conditions information of an entire DetElement
- virtual int processElement(DetElement de) override;
+ /// Assignment operator
+ ConditionsProcessor& operator=(const ConditionsProcessor& copy) = default;
+ /// Processing callback
+ virtual int process(Condition condition) const override {
+ return (processor)(condition);
+ }
};
+ /// Creator utility function for ConditionsProcessor objects
+ template <typename T> inline ConditionsProcessor<T> conditionsProcessor(T* obj) {
+ return ConditionsProcessor<T>(obj);
+ }
- /// Generic Condition object collector
+ /// Generic condition processor facade for the Conditons::Processor object
/**
- * Please see the documentation of the
- * ConditionsProcessor base class for further information.
+ * This wrapper converts any object, which has the signature
+ * int operator()(Condition cond) const
+ * The object is automatically wrapped to a Condition::Processor object
+ * and allows to scan trees using e.g. DetElementProcessors etc.
*
+ *
* \author M.Frank
* \version 1.0
- * \ingroup DD4HEP_CONDITIONS
+ * \date 01/04/2016
*/
- class ConditionsCollector : virtual public ConditionsProcessor {
- public:
- /// Collection container
- std::vector<Condition> conditions;
+ template <typename T> class ConditionsProcessorWrapper : public Condition::Processor {
+ std::unique_ptr<T> processor;
public:
/// Default constructor
- ConditionsCollector(ConditionsMap* p) : ConditionsProcessor(p) {}
+ ConditionsProcessorWrapper() = default;
+ /// Initializing constructor
+ ConditionsProcessorWrapper(T* p) : processor(p) {}
+ /// Copy constructor
+ ConditionsProcessorWrapper(const ConditionsProcessorWrapper& copy) = default;
/// Default destructor
- virtual ~ConditionsCollector() = default;
- /// Callback to output conditions information
- virtual int process(Condition cond) final {
- conditions.push_back(cond);
- return 1;
+ virtual ~ConditionsProcessorWrapper() = default;
+ /// Assignment operator
+ ConditionsProcessorWrapper& operator=(const ConditionsProcessorWrapper& copy) = default;
+ /// Processing callback
+ virtual int process(Condition c) const override {
+ return (*(processor.get()))(c);
}
};
-
- /// Helper to select all conditions, which belong to a single DetElement structure
+ /// Creator utility function for ConditionsProcessorWrapper objects
+ template <typename T> inline ConditionsProcessorWrapper<T>* createProcessorWrapper(T* obj) {
+ return new ConditionsProcessorWrapper<T>(obj);
+ }
+ /// Creator utility function for ConditionsProcessorWrapper objects
+ template <typename T> inline ConditionsProcessorWrapper<T> processorWrapper(T* obj) {
+ return ConditionsProcessorWrapper<T>(obj);
+ }
+
+ /// Generic condition collector keyed by detector elements
/**
- * Please see the documentation of the
- * ConditionsProcessor base class for further information.
+ * To be used with utilities like DetElementProcessor etc.
*
+ *
* \author M.Frank
* \version 1.0
- * \ingroup DD4HEP_CONDITIONS
+ * \date 01/04/2016
*/
- class DetElementConditionsCollector : public Condition::Processor {
+ template <typename T> class ConditionsCollector {
public:
- ConditionKey key;
- mutable std::vector<Condition> conditions;
+ /// Reference to the user pool
+ ConditionsMap& mapping;
+ /// Collection container
+ T& conditions;
public:
- /// Standard constructor
- DetElementConditionsCollector(DetElement de) : key(de.key(),0) {}
- /// Overloadable entry: Selection callback: return true if the condition should be selected
- virtual int process(Condition cond) final;
+ /// Default constructor
+ ConditionsCollector(ConditionsMap& m, T& d) : mapping(m), conditions(d) {}
+ /// Copy constructor
+ ConditionsCollector(const ConditionsCollector& copy) = default;
+ /// Default destructor
+ ~ConditionsCollector() = default;
+ /// Assignment operator
+ ConditionsCollector& operator=(const ConditionsCollector& copy) = default;
+ /// Callback to output conditions information
+ /** Note: Valid implementations exist for the container types:
+ * std::list<Condition>
+ * std::vector<Condition>
+ * std::map<DetElement,Condition>
+ * std::multimap<DetElement,Condition>
+ * std::map<std::string,Condition> key = DetElement.path()
+ * std::multimap<std::string,Condition> key = DetElement.path()
+ */
+ virtual int operator()(DetElement de, int level=0) const final;
};
-
+ /// Creator utility function for ConditionsCollector objects
+ template <typename T> inline ConditionsCollector<T> conditionsCollector(ConditionsMap& m, T& conditions) {
+ return ConditionsCollector<T>(m, conditions);
+ }
+
} /* End namespace Conditions */
} /* End namespace DD4hep */
#endif /* DD4HEP_GEOMETRY_CONDITIONSPROCESSOR_H */
diff --git a/DDCore/include/DD4hep/DetectorProcessor.h b/DDCore/include/DD4hep/DetectorProcessor.h
index 95e40e78eaa1be538c73cc442680e1a735acf6fb..d79a686df86cc18db89b5eecd612a3375e1285c7 100644
--- a/DDCore/include/DD4hep/DetectorProcessor.h
+++ b/DDCore/include/DD4hep/DetectorProcessor.h
@@ -18,6 +18,7 @@
// C/C++ include files
#include <vector>
+#include <memory>
#include <algorithm>
/// Namespace for the AIDA detector description toolkit
@@ -42,14 +43,19 @@ namespace DD4hep {
/// Self type definition
typedef DetectorProcessor self_type;
public:
+ struct Internal {
+ virtual ~Internal() {}
+ };
/// Initializing constructor
DetectorProcessor() = default;
/// Default destructor
virtual ~DetectorProcessor() = default;
/// Callback to output detector information of an single DetElement
- virtual int operator()(DetElement de, int level);
+ virtual int operator()(DetElement de, int level) const = 0;
/// Callback to output detector information of an entire DetElement
- virtual int process(DetElement de, int level, bool recursive);
+ virtual int process(DetElement de, int level, bool recursive) const;
+ /// Pointer conversion to underlying object
+ virtual Internal* internal() const { return 0; }
};
/// Detector scanner using a Processor object
@@ -64,47 +70,108 @@ namespace DD4hep {
*/
template <typename T> class DetElementProcessor : virtual public DetectorProcessor {
public:
- /// Collection container
+ /// Reference to execution object implementing operator()(DetElement de, int level)
T& processor;
public:
/// Default constructor
DetElementProcessor() = delete;
/// Default constructor
DetElementProcessor(T& p) : processor(p) {}
+ /// Default copy constructor
+ DetElementProcessor(const DetElementProcessor& copy) = default;
/// Default destructor
virtual ~DetElementProcessor() = default;
+ /// Default assignment
+ DetElementProcessor& operator=(const DetElementProcessor& copy) = default;
/// Callback to output detector information of an single DetElement
- virtual int operator()(DetElement de, int level) {
- return processor(de, level);
- }
+ virtual int operator()(DetElement de, int level) const final
+ { return (processor)(de, level); }
+ /// Pointer conversion to underlying object
+ virtual Internal* internal() const final
+ { return (Internal*)&processor; }
};
/// Instantiation helper
- template <typename T> DetElementProcessor<T> detectorProcessor(T* proc)
+ template <typename T> DetElementProcessor<const T> detectorProcessor(const T& proc)
+ { return DetElementProcessor<const T>(proc); }
+ /// Instantiation helper
+ template <typename T> DetElementProcessor<T> detectorProcessor(T& proc)
{ return DetElementProcessor<T>(proc); }
- /// Generic Condition object collector
+ /// Wrapper to call objects in the form of a detector element processor.
/**
- * Please see the documentation of the
- * DetectorProcessor base class for further information.
- *
- * \author M.Frank
- * \version 1.0
- * \date 31/03/2016
- * \ingroup DD4HEP_GEOMETRY
+ * \author M.Frank
+ * \version 1.0
+ * \ingroup DD4HEP_GEOMETRY
*/
- class DetectorCollector : virtual public DetectorProcessor {
- public:
- /// Collection container
- std::vector<std::pair<int,DetElement> > detectors;
+ template <typename T> class DetectorProcessorShared : public DetectorProcessor {
+ /// Reference to execution object implementing operator()(DetElement de, int level)
+ std::shared_ptr<T> processor;
public:
/// Default constructor
- DetectorCollector() = default;
+ DetectorProcessorShared() = delete;
+ /// Default constructor
+ DetectorProcessorShared(std::shared_ptr<T>& p) : processor(p) {}
+ /// Default copy constructor
+ DetectorProcessorShared(const DetectorProcessorShared& copy) = default;
/// Default destructor
- virtual ~DetectorCollector() = default;
- /// Callback to output detector information of an entire DetElement
- virtual int operator()(DetElement de, int level) final;
+ virtual ~DetectorProcessorShared() = default;
+ /// Default assignment
+ DetectorProcessorShared& operator=(const DetectorProcessorShared& copy) = default;
+ /// Callback to output detector information of an single DetElement
+ virtual int operator()(DetElement de, int level) const final
+ { return (*processor)(de, level); }
+ /// Pointer conversion to underlying object
+ virtual Internal* internal() const final
+ { return (Internal*)processor.get(); }
};
+
+ /// Helper to run DetElement scans
+ /**
+ * This wrapper converts any object, which has the signature
+ * int operator()(DetElement de, int level) const
+ * The object is automatically wrapped to a DetectorProcessor
+ * and the detector tree is scanned depending on the scanning
+ * arguments.
+ *
+ * \author M.Frank
+ * \version 1.0
+ * \date 01/04/2016
+ */
+ class DetectorScanner {
+ public:
+ /// Default constructor
+ DetectorScanner() = default;
+ /// Copy constructor
+ DetectorScanner(const DetectorScanner& copy) = default;
+ /// Assignment operator
+ DetectorScanner& operator=(const DetectorScanner& copy) = default;
+
+ /// Constructor performing the scan internally
+ template <typename Q>
+ DetectorScanner(Q& proc, DetElement start, int level=0, bool recursive=true)
+ { scan(proc, start, level, recursive); }
+
+ /// Constructor performing the scan internally
+ template <typename Q>
+ DetectorScanner(const Q& proc, DetElement start, int level=0, bool recursive=true)
+ { scan(proc, start, level, recursive); }
+
+ /// Detector element tree scanner using wrapped DetectorProcessor objects
+ template <typename Q>
+ int scan(Q& p, DetElement start, int level=0, bool recursive=true) const {
+ auto proc = detectorProcessor(p);
+ return proc.process(start, level, recursive);
+ }
+
+ /// Detector element tree scanner using wrapped DetectorProcessor objects
+ template <typename Q>
+ int scan(const Q& p, DetElement start, int level=0, bool recursive=true) const {
+ auto proc = detectorProcessor(p);
+ return proc.process(start, level, recursive);
+ }
+ };
+
} /* End namespace Geometry */
} /* End namespace DD4hep */
#endif /* DD4HEP_DDCORE_DETECTORPROCESSOR_H */
diff --git a/DDCore/include/DD4hep/Dictionary.h b/DDCore/include/DD4hep/Dictionary.h
index 5f3a41eff91d59d60b66d05519fd2b66b62d50ad..0e2f89ec91123e703527ee6f69ddcf4e9446ce92 100644
--- a/DDCore/include/DD4hep/Dictionary.h
+++ b/DDCore/include/DD4hep/Dictionary.h
@@ -28,11 +28,11 @@
// Framework include files
#include "XML/Evaluator.h"
#include "DD4hep/DD4hepRootPersistency.h"
-#include "DD4hep/objects/ObjectsInterna.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/ConditionsInterna.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
-#include "DD4hep/objects/VolumeManagerInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
+#include "DD4hep/detail/VolumeManagerInterna.h"
#include "DD4hep/World.h"
#include "DD4hep/DD4hepUI.h"
diff --git a/DDCore/include/DD4hep/GridPhiEta.h b/DDCore/include/DD4hep/GridPhiEta.h
index d7c8823418d0ac3c63fcc51a72ecbccfb8fbc900..4b06a5a321914dae67a2a63016925adcd5264b53 100644
--- a/DDCore/include/DD4hep/GridPhiEta.h
+++ b/DDCore/include/DD4hep/GridPhiEta.h
@@ -4,7 +4,7 @@
// Framework includes
#include "DDSegmentation/GridPhiEta.h"
#include "DD4hep/Segmentations.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
/// Namespace for the AIDA detector description toolkit
namespace DD4hep {
diff --git a/DDCore/include/DD4hep/GridRPhiEta.h b/DDCore/include/DD4hep/GridRPhiEta.h
index 61ff8c6baa1cbcf405e40e75b62b568e3b78c946..50825258b1f210e10336423d8ec93c3854e08732 100644
--- a/DDCore/include/DD4hep/GridRPhiEta.h
+++ b/DDCore/include/DD4hep/GridRPhiEta.h
@@ -4,7 +4,7 @@
// Framework includes
#include "DDSegmentation/GridRPhiEta.h"
#include "DD4hep/Segmentations.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
/// Namespace for the AIDA detector description toolkit
namespace DD4hep {
diff --git a/DDCore/include/DD4hep/LCDDData.h b/DDCore/include/DD4hep/LCDDData.h
index 53806c01a21575bb4cc675e30292e4bf54f979cb..f85c95d906e0244fd22511ac2a8de8cadaf35eee 100644
--- a/DDCore/include/DD4hep/LCDDData.h
+++ b/DDCore/include/DD4hep/LCDDData.h
@@ -17,7 +17,7 @@
// Framework includes
#include "DD4hep/LCDD.h"
#include "DD4hep/ObjectExtensions.h"
-#include "DD4hep/objects/VolumeManagerInterna.h"
+#include "DD4hep/detail/VolumeManagerInterna.h"
// C/C++ include files
#include <stdexcept>
diff --git a/DDCore/include/DD4hep/Primitives.h b/DDCore/include/DD4hep/Primitives.h
index 5bab0f24967912276477397344b7ac8f1aaca5f8..e68ae0185e5ea99fff19b175065b34254ab0c621 100644
--- a/DDCore/include/DD4hep/Primitives.h
+++ b/DDCore/include/DD4hep/Primitives.h
@@ -15,6 +15,7 @@
// C/C++ include files
#include <map>
+#include <list>
#include <vector>
#include <string>
#include <limits>
diff --git a/DDCore/include/DD4hep/objects/AlignmentsInterna.h b/DDCore/include/DD4hep/detail/AlignmentsInterna.h
similarity index 98%
rename from DDCore/include/DD4hep/objects/AlignmentsInterna.h
rename to DDCore/include/DD4hep/detail/AlignmentsInterna.h
index 468a6aea0e2bfab9bd8b2433278d0f8b07c78340..36f4b36e48307571d134065e094a2614aded05cd 100644
--- a/DDCore/include/DD4hep/objects/AlignmentsInterna.h
+++ b/DDCore/include/DD4hep/detail/AlignmentsInterna.h
@@ -24,7 +24,7 @@
// Framework include files
#include "DD4hep/IOV.h"
#include "DD4hep/Alignments.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
// C/C++ include files
#include <map>
diff --git a/DDCore/include/DD4hep/BasicGrammar_inl.h b/DDCore/include/DD4hep/detail/BasicGrammar_inl.h
similarity index 100%
rename from DDCore/include/DD4hep/BasicGrammar_inl.h
rename to DDCore/include/DD4hep/detail/BasicGrammar_inl.h
diff --git a/DDCore/include/DD4hep/ComponentProperties_inl.h b/DDCore/include/DD4hep/detail/ComponentProperties_inl.h
similarity index 100%
rename from DDCore/include/DD4hep/ComponentProperties_inl.h
rename to DDCore/include/DD4hep/detail/ComponentProperties_inl.h
diff --git a/DDCore/include/DD4hep/objects/ConditionsInterna.h b/DDCore/include/DD4hep/detail/ConditionsInterna.h
similarity index 99%
rename from DDCore/include/DD4hep/objects/ConditionsInterna.h
rename to DDCore/include/DD4hep/detail/ConditionsInterna.h
index 376cfd31376e2569c3438c4afbf54fae6c7d4775..caab724ee5a354b6ffd5604387b768918b5928d7 100644
--- a/DDCore/include/DD4hep/objects/ConditionsInterna.h
+++ b/DDCore/include/DD4hep/detail/ConditionsInterna.h
@@ -26,7 +26,7 @@
#include "DD4hep/Conditions.h"
#include "DD4hep/BasicGrammar.h"
#include "DD4hep/NamedObject.h"
-#include "DD4hep/objects/OpaqueData_inl.h"
+#include "DD4hep/detail/OpaqueData_inl.h"
// C/C++ include files
#include <map>
diff --git a/DDCore/include/DD4hep/detail/ContainerHelpers.h b/DDCore/include/DD4hep/detail/ContainerHelpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce79ceccd0170693531b9c85d57c26b74f74852d
--- /dev/null
+++ b/DDCore/include/DD4hep/detail/ContainerHelpers.h
@@ -0,0 +1,62 @@
+//==========================================================================
+// AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author : M.Frank
+//
+//==========================================================================
+#ifndef DD4HEP_DD4HEP_CONTAINERHELPERS_H
+#define DD4HEP_DD4HEP_CONTAINERHELPERS_H
+
+// Framework include files
+#include "DD4hep/Primitives.h"
+
+// C/C++ include files
+#include <map>
+#include <list>
+#include <vector>
+#include <string>
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+ template <typename Q, typename T>
+ void insert_item(std::vector<T>& c, Q, const T& d) {
+ c.push_back(d);
+ }
+ template <typename Q, typename T>
+ void insert_item(std::list<T>& c, Q, const T& d) {
+ c.push_back(d);
+ }
+ template <typename Q, typename T>
+ void insert_item(std::map<Q,T>& c, Q de, const T& d) {
+ c.insert(std::make_pair(de,d));
+ }
+ template <typename Q, typename T>
+ void insert_item(std::vector<std::pair<Q,T> >& c, Q de, const T& d) {
+ c.push_back(std::make_pair(de,d));
+ }
+ template <typename Q, typename T>
+ void insert_item(std::vector<std::pair<std::string,T> >& c, Q de, const T& d) {
+ c.push_back(std::make_pair(de.path(),d));
+ }
+
+ template <typename Q, typename T>
+ void insert_item(std::multimap<Q,T>& c, Q de, const T& d) {
+ c.insert(std::make_pair(de,d));
+ }
+ template <typename Q, typename T>
+ void insert_item(std::map<std::string,T>& c, Q de, const T& d) {
+ c.insert(std::make_pair(de.path(),d));
+ }
+ template <typename Q, typename T>
+ void insert_item(std::multimap<std::string,T>& c, Q de, const T& d) {
+ c.insert(std::make_pair(de.path(),d));
+ }
+} // End namespace DD4hep
+#endif // DD4HEP_DD4HEP_CONTAINERHELPERS_H
diff --git a/DDCore/include/DD4hep/objects/DetectorInterna.h b/DDCore/include/DD4hep/detail/DetectorInterna.h
similarity index 100%
rename from DDCore/include/DD4hep/objects/DetectorInterna.h
rename to DDCore/include/DD4hep/detail/DetectorInterna.h
diff --git a/DDCore/include/DD4hep/Handle.inl b/DDCore/include/DD4hep/detail/Handle.inl
similarity index 100%
rename from DDCore/include/DD4hep/Handle.inl
rename to DDCore/include/DD4hep/detail/Handle.inl
diff --git a/DDCore/include/DD4hep/objects/ObjectsInterna.h b/DDCore/include/DD4hep/detail/ObjectsInterna.h
similarity index 100%
rename from DDCore/include/DD4hep/objects/ObjectsInterna.h
rename to DDCore/include/DD4hep/detail/ObjectsInterna.h
diff --git a/DDCore/include/DD4hep/objects/OpaqueData_inl.h b/DDCore/include/DD4hep/detail/OpaqueData_inl.h
similarity index 100%
rename from DDCore/include/DD4hep/objects/OpaqueData_inl.h
rename to DDCore/include/DD4hep/detail/OpaqueData_inl.h
diff --git a/DDCore/include/DD4hep/Plugins.inl b/DDCore/include/DD4hep/detail/Plugins.inl
similarity index 100%
rename from DDCore/include/DD4hep/Plugins.inl
rename to DDCore/include/DD4hep/detail/Plugins.inl
diff --git a/DDCore/include/DD4hep/objects/SegmentationsInterna.h b/DDCore/include/DD4hep/detail/SegmentationsInterna.h
similarity index 100%
rename from DDCore/include/DD4hep/objects/SegmentationsInterna.h
rename to DDCore/include/DD4hep/detail/SegmentationsInterna.h
diff --git a/DDCore/include/DD4hep/objects/VolumeManagerInterna.h b/DDCore/include/DD4hep/detail/VolumeManagerInterna.h
similarity index 100%
rename from DDCore/include/DD4hep/objects/VolumeManagerInterna.h
rename to DDCore/include/DD4hep/detail/VolumeManagerInterna.h
diff --git a/DDCore/src/AlignedVolumePrinter.cpp b/DDCore/src/AlignedVolumePrinter.cpp
deleted file mode 100644
index d4c8b885ab361293d19246055071b006afb4c00d..0000000000000000000000000000000000000000
--- a/DDCore/src/AlignedVolumePrinter.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//==========================================================================
-// AIDA Detector description implementation for LCD
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see $DD4hepINSTALL/LICENSE.
-// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
-//
-// Author : M.Frank
-//
-//==========================================================================
-
-// Framework includes
-#include "DD4hep/Printout.h"
-#include "DD4hep/AlignmentsPrinter.h"
-#include "DD4hep/AlignedVolumePrinter.h"
-
-using namespace DD4hep;
-using namespace DD4hep::Alignments;
-
-/// Initializing constructor
-AlignedVolumePrinter::AlignedVolumePrinter(ConditionsMap* m, const std::string& pref,int flg)
- : AlignmentsProcessor(m), name("Alignment"), prefix(pref), printLevel(INFO), m_flag(flg)
-{
-}
-
-/// Callback to output alignments information
-int AlignedVolumePrinter::operator()(Alignment a) {
- printAlignment(printLevel, name, a);
- return 1;
-}
-
-/// Callback to output alignments information of an entire DetElement
-int AlignedVolumePrinter::processElement(DetElement de) {
- if ( de.isValid() ) {
- if ( mapping ) {
- printElementPlacement(printLevel, name, de, *mapping);
- return 1;
- }
- except("Alignments","Failed to process alignments for DetElement:%s [No slice availible]",
- de.path().c_str());
- }
- except("Alignments","Cannot process alignments of an invalid detector element");
- return 0;
-}
diff --git a/DDCore/src/AlignmentData.cpp b/DDCore/src/AlignmentData.cpp
index e4038fba23b0fe640e6c45c57006eeb1d99e8bad..e36b341a3abee96d180ce3ee643f08136ea1e705 100644
--- a/DDCore/src/AlignmentData.cpp
+++ b/DDCore/src/AlignmentData.cpp
@@ -207,8 +207,8 @@ Alignment AlignmentData::nominal() const {
DD4HEP_DEFINE_PARSER_DUMMY(Delta)
DD4HEP_DEFINE_PARSER_DUMMY(AlignmentData)
-#include "DD4hep/BasicGrammar_inl.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/BasicGrammar_inl.h"
+#include "DD4hep/detail/ConditionsInterna.h"
DD4HEP_DEFINE_PARSER_GRAMMAR(Delta,eval_none<Delta>)
DD4HEP_DEFINE_PARSER_GRAMMAR(AlignmentData,eval_none<AlignmentData>)
diff --git a/DDCore/src/AlignmentTools.cpp b/DDCore/src/AlignmentTools.cpp
index 9b026734f74e877666592668bfd9648e95f76ffd..92a08e52c7e4112a2091945d7e0b6b6bc395f6fe 100644
--- a/DDCore/src/AlignmentTools.cpp
+++ b/DDCore/src/AlignmentTools.cpp
@@ -17,8 +17,8 @@
#include "DD4hep/MatrixHelpers.h"
#include "DD4hep/AlignmentTools.h"
#include "DD4hep/DetectorTools.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
// ROOT include files
#include "TGeoMatrix.h"
diff --git a/DDCore/src/Alignments.cpp b/DDCore/src/Alignments.cpp
index 7daf800bd312006527d666950958d86f470cdc9f..dccac8cdd98c48002032d3d37174a90862fd78d3 100644
--- a/DDCore/src/Alignments.cpp
+++ b/DDCore/src/Alignments.cpp
@@ -13,8 +13,8 @@
// Framework include files
#include "DD4hep/AlignmentData.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
// C/C++ include files
#include <sstream>
diff --git a/DDCore/src/AlignmentsCalculator.cpp b/DDCore/src/AlignmentsCalculator.cpp
index 123738b6d4c2e1b1b4bc2823ba9e036c763b3006..a8946cec9893832641e9c934da3eb080c1a33abb 100644
--- a/DDCore/src/AlignmentsCalculator.cpp
+++ b/DDCore/src/AlignmentsCalculator.cpp
@@ -18,7 +18,7 @@
#include "DD4hep/ConditionsMap.h"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/MatrixHelpers.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
using namespace DD4hep;
using namespace DD4hep::Alignments;
diff --git a/DDCore/src/AlignmentsInterna.cpp b/DDCore/src/AlignmentsInterna.cpp
index 1df7df8f13f1b05f6d58d35e9a51c1ca8eeb7bdc..f5cef0c983b9476d5d034b9d640d07d77194bc34 100644
--- a/DDCore/src/AlignmentsInterna.cpp
+++ b/DDCore/src/AlignmentsInterna.cpp
@@ -13,13 +13,12 @@
// Framework includes
#include "DD4hep/IOV.h"
-#include "DD4hep/Handle.inl"
-
#include "DD4hep/World.h"
#include "DD4hep/Printout.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
using namespace std;
using namespace DD4hep::Alignments;
diff --git a/DDCore/src/AlignmentsPrinter.cpp b/DDCore/src/AlignmentsPrinter.cpp
index e36e77f210170a81e5fe36c1cc7204e5c95d0936..8a2bd6b3bc1229cdcabd13ea29bea7fbfc7f7730 100644
--- a/DDCore/src/AlignmentsPrinter.cpp
+++ b/DDCore/src/AlignmentsPrinter.cpp
@@ -15,45 +15,57 @@
#include "DD4hep/Printout.h"
#include "DD4hep/AlignmentsPrinter.h"
#include "DD4hep/AlignmentsProcessor.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
// C/C++ include files
#include <sstream>
+#include "TClass.h"
+#include "DD4hep/ToStream.h"
-using std::string;
-using std::stringstream;
+using namespace std;
using namespace DD4hep;
using namespace DD4hep::Alignments;
/// Initializing constructor
AlignmentsPrinter::AlignmentsPrinter(ConditionsMap* m, const string& pref, int flg)
- : Alignment::Processor(), mapping(m), name("Alignment"), prefix(pref), printLevel(INFO), m_flag(flg)
+ : mapping(m), name("Alignment"), prefix(pref), printLevel(INFO), m_flag(flg)
{
}
/// Callback to output alignments information
-int AlignmentsPrinter::operator()(Alignment a) {
+int AlignmentsPrinter::operator()(Alignment a) const {
printAlignment(printLevel, name, a);
return 1;
}
-
-/// Processing callback to print alignments
-int AlignmentsPrinter::processElement(DetElement de) {
- DetElementAlignmentsCollector select(de);
+/// Callback to output alignments information of an entire DetElement
+int AlignmentsPrinter::operator()(DetElement de, int level) const {
if ( mapping ) {
- mapping->scan(select);
- printout(this->printLevel, name, "++ %s %-3ld Alignments for DE %s",
- prefix.c_str(), select.alignments.size(), de.path().c_str());
- for( auto alignment : select.alignments )
+ vector<Alignment> alignments;
+ alignmentsCollector(*mapping,alignments)(de, level);
+ printout(printLevel, name, "++ %s %-3ld Alignments for DE %s",
+ prefix.c_str(), alignments.size(), de.path().c_str());
+ for( auto alignment : alignments )
(*this)(alignment);
- return int(select.alignments.size());
+ return int(alignments.size());
}
except(name,"Failed to dump conditions for DetElement:%s [No slice availible]",
de.path().c_str());
return 0;
}
+/// Initializing constructor
+AlignedVolumePrinter::AlignedVolumePrinter(ConditionsMap* m, const string& pref,int flg)
+ : AlignmentsPrinter(m, pref, flg)
+{
+ name = "Alignmant";
+}
+
+/// Callback to output alignments information
+int AlignedVolumePrinter::operator()(Alignment a) const {
+ printAlignment(printLevel, name, a);
+ return 1;
+}
/// Default printout of an alignment entry
void DD4hep::Alignments::printAlignment(PrintLevel lvl, const string& prefix, Alignment a) {
@@ -78,9 +90,6 @@ void DD4hep::Alignments::printAlignment(PrintLevel lvl, const string& prefix, Al
}
}
-
-#include "TClass.h"
-#include "DD4hep/ToStream.h"
static string replace_all(const string& in, const string& from, const string& to) {
string res = in;
size_t idx;
@@ -186,11 +195,11 @@ void DD4hep::Alignments::printAlignment(PrintLevel lvl, const string& prefix,
void DD4hep::Alignments::printElement(PrintLevel prt_level, const string& prefix, DetElement de, ConditionsMap& pool) {
string tag = prefix+"Element";
if ( de.isValid() ) {
- DetElementAlignmentsCollector select(de);
- pool.scan(select);
+ vector<Alignment> alignments;
+ alignmentsCollector(pool,alignments)(de);
printout(prt_level,tag,"++ Alignments of DE %s [%d entries]",
- de.path().c_str(), int(select.alignments.size()));
- for(const auto& align : select.alignments )
+ de.path().c_str(), int(alignments.size()));
+ for(const auto& align : alignments )
printAlignment(prt_level, prefix, align);
return;
}
@@ -209,19 +218,19 @@ void DD4hep::Alignments::printElementPlacement(PrintLevel lvl, const string& pre
char text[132];
Alignment nominal = de.nominal();
Box bbox = de.placement().volume().solid();
- DetElementAlignmentsCollector select(de);
+ vector<Alignment> alignments;
- pool.scan(select);
+ alignmentsCollector(pool,alignments)(de);
::memset(text,'=',sizeof(text));
text[sizeof(text)-1] = 0;
printout(lvl, tag, text);
printout(lvl, tag, "++ Alignments of DE %s [%d entries]",
- de.path().c_str(), int(select.alignments.size()));
+ de.path().c_str(), int(alignments.size()));
printout(lvl, tag, "++ Volume: %s BBox: x=%7.3f y=%7.3f z=%7.3f",
bbox.type(), bbox.x(), bbox.y(), bbox.z());
printAlignment(lvl, tag, "NOMINAL", de, nominal);
- for(const auto& align : select.alignments ) {
+ for(const auto& align : alignments ) {
AlignmentCondition cond(align);
try {
printout(lvl, tag, "++ Alignment %p [%16llX]", align.ptr(), cond.key());
diff --git a/DDCore/src/AlignmentsProcessor.cpp b/DDCore/src/AlignmentsProcessor.cpp
index 8926bd6c592f37a97e9a684b11e805a6a6853720..aabf94ff71694c67327db475fa88fc5d79fd592e 100644
--- a/DDCore/src/AlignmentsProcessor.cpp
+++ b/DDCore/src/AlignmentsProcessor.cpp
@@ -15,67 +15,65 @@
#include "DD4hep/Printout.h"
#include "DD4hep/AlignmentsProcessor.h"
#include "DD4hep/ConditionsProcessor.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ContainerHelpers.h"
+#include "DD4hep/detail/ConditionsInterna.h"
+using namespace std;
using namespace DD4hep;
using namespace DD4hep::Alignments;
/// Callback to output alignments information
-int AlignmentsProcessor::operator()(Alignment /* alignment */) {
- return 1;
-}
-
-/// Callback to output alignments information of an entire DetElement
-int AlignmentsProcessor::processElement(Geometry::DetElement de) {
+template <typename T> int DeltaCollector<T>::operator()(DetElement de, int level) const {
if ( de.isValid() ) {
- if ( mapping ) {
- Conditions::DetElementConditionsCollector select(de);
- int count = 0;
- mapping->scan(select);
- for( auto cond : select.conditions ) {
- if ( cond->testFlag(Conditions::Condition::ALIGNMENT_DERIVED) ) {
- Alignment a = cond;
- count += (*this)(a);
- }
+ int count = 0;
+ vector<Conditions::Condition> conditions;
+ conditionsCollector(mapping,conditions)(de,level);
+ for( auto cond : conditions ) {
+ if ( cond->testFlag(Conditions::Condition::ALIGNMENT_DELTA) ) {
+ insert_item(deltas, de, cond.get<Delta>());
+ ++count;
}
- return count;
}
- except("Alignments","Failed to process alignments for DetElement:%s [No slice availible]",
- de.path().c_str());
+ return count;
}
except("Alignments","Cannot process alignments of an invalid detector element");
- return 0;
+ return 0;
}
+template class DeltaCollector<list<Delta> >;
+template class DeltaCollector<vector<Delta> >;
+template class DeltaCollector<map<DetElement,Delta> >;
+template class DeltaCollector<vector<pair<DetElement,Delta> > >;
+template class DeltaCollector<vector<pair<string,Delta> > >;
+template class DeltaCollector<multimap<DetElement,Delta> >;
+template class DeltaCollector<map<string,Delta> >;
+template class DeltaCollector<multimap<string,Delta> >;
/// Callback to output alignments information
-int DetElementDeltaCollector::operator()(DetElement de, int) {
+template <typename T>
+int AlignmentsCollector<T>::operator()(DetElement de, int level) const {
if ( de.isValid() ) {
- if ( mapping ) {
- Conditions::DetElementConditionsCollector select(de);
- int count = 0;
- mapping->scan(select);
- for( auto cond : select.conditions ) {
- if ( cond->testFlag(Conditions::Condition::ALIGNMENT_DELTA) ) {
- deltas.insert(std::make_pair(de,cond.get<Delta>()));
- ++count;
- }
+ int count = 0;
+ vector<Conditions::Condition> conditions;
+ conditionsCollector(mapping,conditions)(de,level);
+ for( auto cond : conditions ) {
+ if ( cond->testFlag(Conditions::Condition::ALIGNMENT_DERIVED) ) {
+ Alignment align = cond;
+ insert_item(alignments, de, align);
+ ++count;
}
- return count;
}
- except("Alignments","Failed to process alignments for DetElement:%s [No slice availible]",
- de.path().c_str());
+ return count;
}
except("Alignments","Cannot process alignments of an invalid detector element");
return 0;
}
+template class AlignmentsCollector<list<Alignment> >;
+template class AlignmentsCollector<vector<Alignment> >;
+template class AlignmentsCollector<map<DetElement,Alignment> >;
+template class AlignmentsCollector<vector<pair<DetElement,Alignment> > >;
+template class AlignmentsCollector<vector<pair<string,Alignment> > >;
-/// Overloadable entry: Selection callback: return true if the alignment should be selected
-int DetElementAlignmentsCollector::process(Conditions::Condition cond) {
- if ( cond->testFlag(Conditions::Condition::ALIGNMENT_DERIVED) ) {
- Alignment a = cond;
- alignments.push_back(a);
- return 1;
- }
- return 0;
-}
+template class AlignmentsCollector<multimap<DetElement,Alignment> >;
+template class AlignmentsCollector<map<string,Alignment> >;
+template class AlignmentsCollector<multimap<string,Alignment> >;
diff --git a/DDCore/src/BasicGrammarTypes.cpp b/DDCore/src/BasicGrammarTypes.cpp
index 4a4ec91a3c5b952f38cb9958d0f93c2cd29edfbe..63cb1863d3a42a3e83306c22958ccc972542c422 100644
--- a/DDCore/src/BasicGrammarTypes.cpp
+++ b/DDCore/src/BasicGrammarTypes.cpp
@@ -12,7 +12,7 @@
//==========================================================================
// Framework include files
-#include "DD4hep/BasicGrammar_inl.h"
+#include "DD4hep/detail/BasicGrammar_inl.h"
#ifndef DD4HEP_PARSERS_NO_ROOT
DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(ROOT::Math::XYZPoint,eval_obj)
diff --git a/DDCore/src/CartesianGridXY.cpp b/DDCore/src/CartesianGridXY.cpp
index 51aa81712a486c535c47b6bde6740dc483d53cb7..5112bec18b12add82768e68372ea17f43bca30f3 100644
--- a/DDCore/src/CartesianGridXY.cpp
+++ b/DDCore/src/CartesianGridXY.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/CartesianGridXY.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/CartesianGridXY.h"
// C/C++ include files
diff --git a/DDCore/src/CartesianGridXYZ.cpp b/DDCore/src/CartesianGridXYZ.cpp
index de16d3be9e32b7438a2efb7974961cbe273a8caf..674d080b6f6185af73a8ead30ebe0ddbdbb997e0 100644
--- a/DDCore/src/CartesianGridXYZ.cpp
+++ b/DDCore/src/CartesianGridXYZ.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/CartesianGridXYZ.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/CartesianGridXYZ.h"
// C/C++ include files
diff --git a/DDCore/src/CartesianGridXZ.cpp b/DDCore/src/CartesianGridXZ.cpp
index 765c156e6a52ce29ee7b6520e54e01cd8d243ef4..90fbcbc0dec51c2fb153dca771f2612e718c75cd 100644
--- a/DDCore/src/CartesianGridXZ.cpp
+++ b/DDCore/src/CartesianGridXZ.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/CartesianGridXZ.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/CartesianGridXZ.h"
// C/C++ include files
diff --git a/DDCore/src/CartesianGridYZ.cpp b/DDCore/src/CartesianGridYZ.cpp
index 9e3cb22ec0f481a6e722da6ec2b4c2578c2e8315..31f9df7635608e07d4a87abfe2134b362b0b2874 100644
--- a/DDCore/src/CartesianGridYZ.cpp
+++ b/DDCore/src/CartesianGridYZ.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/CartesianGridYZ.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/CartesianGridYZ.h"
// C/C++ include files
diff --git a/DDCore/src/ComponentProperties.cpp b/DDCore/src/ComponentProperties.cpp
index 55bec55c7736f9331e1352ba06021f8d576e5aa6..e32faae74dd7d31307631b5dc5bad618ce052e48 100644
--- a/DDCore/src/ComponentProperties.cpp
+++ b/DDCore/src/ComponentProperties.cpp
@@ -254,8 +254,8 @@ namespace DD4hep {
#include <set>
#include <map>
-#include "DD4hep/BasicGrammar_inl.h"
-#include "DD4hep/ComponentProperties_inl.h"
+#include "DD4hep/detail/BasicGrammar_inl.h"
+#include "DD4hep/detail/ComponentProperties_inl.h"
DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(Property)
namespace DD4hep {
diff --git a/DDCore/src/ConditionDerived.cpp b/DDCore/src/ConditionDerived.cpp
index 1cb4fe744b6425bb49c0be3cc23bf643a469ab00..998fcc541cb17e05db6539af83eb98422b678036 100644
--- a/DDCore/src/ConditionDerived.cpp
+++ b/DDCore/src/ConditionDerived.cpp
@@ -45,6 +45,16 @@ ConditionDependency::ConditionDependency(Geometry::DetElement de,
if ( callback ) callback->addRef();
}
+/// Initializing constructor
+ConditionDependency::ConditionDependency(Geometry::DetElement de,
+ const std::string& item,
+ ConditionUpdateCall* call)
+ : m_refCount(0), detector(de), target(de, item), callback(call)
+{
+ InstanceCount::increment(this);
+ if ( callback ) callback->addRef();
+}
+
/// Default constructor
ConditionDependency::ConditionDependency()
: m_refCount(0), target(0), callback(0)
@@ -66,6 +76,14 @@ DependencyBuilder::DependencyBuilder(Geometry::DetElement de,
{
}
+/// Initializing constructor
+DependencyBuilder::DependencyBuilder(Geometry::DetElement de,
+ const std::string& item,
+ ConditionUpdateCall* call)
+ : m_dependency(new ConditionDependency(de,item,call))
+{
+}
+
/// Default destructor
DependencyBuilder::~DependencyBuilder() {
releasePtr(m_dependency);
diff --git a/DDCore/src/Conditions.cpp b/DDCore/src/Conditions.cpp
index 344d170b291db01db01c2b935a675f272c3cd4f6..cd0483d423e80a1ce157f4a89a2407cb2eb6dc9e 100644
--- a/DDCore/src/Conditions.cpp
+++ b/DDCore/src/Conditions.cpp
@@ -12,9 +12,8 @@
//==========================================================================
// Framework includes
-#include "DD4hep/Handle.inl"
#include "DD4hep/Printout.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
// C/C++ include files
#include <climits>
@@ -119,12 +118,12 @@ Condition::key_type Condition::key() const {
}
/// DetElement part of the identifier
-unsigned int Condition::detector_key() const {
+Condition::detkey_type Condition::detector_key() const {
return ConditionKey::KeyMaker(access()->hash).values.det_key;
}
/// Item part of the identifier
-unsigned int Condition::item_key() const {
+Condition::itemkey_type Condition::item_key() const {
return ConditionKey::KeyMaker(access()->hash).values.item_key;
}
@@ -172,7 +171,7 @@ ConditionKey::ConditionKey(DetElement detector, const string& value) {
}
/// Constructor from detector element key and item sub-key
-ConditionKey::ConditionKey(unsigned int det_key, const string& value) {
+ConditionKey::ConditionKey(detkey_type det_key, const string& value) {
KeyMaker m(det_key, hash32(value));
hash = m.hash;
#ifdef DD4HEP_CONDITIONKEY_HAVE_NAME
@@ -183,7 +182,7 @@ ConditionKey::ConditionKey(unsigned int det_key, const string& value) {
}
/// Constructor from detector element key and item sub-key
-ConditionKey::ConditionKey(DetElement detector, unsigned int item_key) {
+ConditionKey::ConditionKey(DetElement detector, itemkey_type item_key) {
hash = KeyMaker(detector.key(),item_key).hash;
#ifdef DD4HEP_CONDITIONKEY_HAVE_NAME
char text[32];
diff --git a/DDCore/src/ConditionsData.cpp b/DDCore/src/ConditionsData.cpp
index 64e683a36034058e1845031f2598c20e35f7844d..bd4bb0aa5b28942ed39a753c2649420e0c9fa3e9 100644
--- a/DDCore/src/ConditionsData.cpp
+++ b/DDCore/src/ConditionsData.cpp
@@ -72,7 +72,7 @@ AbstractMap& AbstractMap::operator=(const AbstractMap& c) {
#include "DD4hep/Parsers.h"
#include "DD4hep/ToStream.h"
DD4HEP_DEFINE_PARSER_DUMMY(AbstractMap)
-#include "DD4hep/BasicGrammar_inl.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/BasicGrammar_inl.h"
+#include "DD4hep/detail/ConditionsInterna.h"
DD4HEP_DEFINE_PARSER_GRAMMAR(AbstractMap,eval_none<AbstractMap>)
DD4HEP_DEFINE_CONDITIONS_TYPE(AbstractMap)
diff --git a/DDCore/src/ConditionsInterna.cpp b/DDCore/src/ConditionsInterna.cpp
index a99497d8db1f3eb9c352833a98ff7e1d646e529b..aaeeff8f1e090300f89e6ddc6a3b55bdb626de15 100644
--- a/DDCore/src/ConditionsInterna.cpp
+++ b/DDCore/src/ConditionsInterna.cpp
@@ -13,12 +13,12 @@
// Framework includes
#include "DD4hep/IOV.h"
-#include "DD4hep/Handle.inl"
#include "DD4hep/Printout.h"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/ConditionsListener.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/ConditionsInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
using namespace std;
using namespace DD4hep::Conditions;
diff --git a/DDCore/src/ConditionsMap.cpp b/DDCore/src/ConditionsMap.cpp
index 8a655376e6f3d399309d6753cf3b0c6c3842f1d3..2719356ad09adddd50c2c6faa4fe8d927e02b256 100644
--- a/DDCore/src/ConditionsMap.cpp
+++ b/DDCore/src/ConditionsMap.cpp
@@ -12,34 +12,138 @@
//==========================================================================
// Framework include files
+#include "DD4hep/Printout.h"
#include "DD4hep/ConditionsMap.h"
+#include "DD4hep/detail/ConditionsInterna.h"
using namespace DD4hep::Conditions;
+/// Interface to partially scan data content of the conditions mapping
+void ConditionsMap::scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const
+{
+ /// Heklper to implement partial scans.
+ struct Scanner : public Processor {
+ key_type lower, upper;
+ const Processor& processor;
+ /// Constructor
+ Scanner(key_type low, key_type up, const Processor& p) : lower(low), upper(up), processor(p) {}
+ /// Conditions callback for object processing
+ virtual int process(Condition c) const override {
+ key_type h = c->hash;
+ if ( h >= lower && h <= upper )
+ return processor(c);
+ return 0;
+ }
+ };
+ if ( detector.isValid() ) {
+ ConditionKey::detkey_type det_key = detector.key();
+ key_type low = ConditionKey::KeyMaker(det_key,lower).hash;
+ key_type up = ConditionKey::KeyMaker(det_key,upper).hash;
+ Scanner scn(low,up,processor);
+ this->scan(scn);
+ return;
+ }
+ DD4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!");
+}
+
+/// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper]
+std::vector<Condition> ConditionsMap::get(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper) const {
+ /// Heklper to implement partial scans.
+ struct Scanner : public Processor {
+ key_type lower, upper;
+ std::vector<Condition>& result;
+ /// Constructor
+ Scanner(key_type low, key_type up, std::vector<Condition>& r) : lower(low), upper(up), result(r) {}
+ /// Conditions callback for object processing
+ virtual int process(Condition c) const override {
+ key_type h = c->hash;
+ if ( h >= lower && h <= upper ) {
+ result.push_back(c);
+ return 1;
+ }
+ return 0;
+ }
+ };
+ std::vector<Condition> result;
+ if ( detector.isValid() ) {
+ ConditionKey::detkey_type det_key = detector.key();
+ key_type low = ConditionKey::KeyMaker(det_key,lower).hash;
+ key_type up = ConditionKey::KeyMaker(det_key,upper).hash;
+ Scanner scn(low,up,result);
+ this->scan(scn);
+ return result;
+ }
+ DD4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!");
+ return result;
+}
+
/// Insert a new entry to the map
template <typename T>
bool ConditionsMapping<T>::insert(DetElement detector, unsigned int key, Condition condition) {
- ConditionKey k(detector,key);
- auto res = data.insert(std::make_pair(k.hash,condition));
+ auto res = data.insert(std::make_pair(ConditionKey(detector,key).hash,condition));
return res.second;
}
/// Interface to access conditions by hash value
template <typename T>
Condition ConditionsMapping<T>::get(DetElement detector, unsigned int key) const {
- ConditionKey k(detector,key);
- auto res = data.find(k.hash);
- if ( res == data.end() )
- return Condition();
- return res->second;
+ auto res = data.find(ConditionKey(detector,key).hash);
+ return (res == data.end()) ? Condition() : res->second;
}
/// Interface to scan data content of the conditions mapping
template <typename T>
-void ConditionsMapping<T>::scan(Condition::Processor& processor) const {
+void ConditionsMapping<T>::scan(const Processor& processor) const {
for( const auto& i : data )
processor(i);
}
+/// Interface to partially scan data content of the conditions mapping
+template <typename T>
+void ConditionsMapping<T>::scan(DetElement detector,
+ itemkey_type lower,
+ itemkey_type upper,
+ const Processor& processor) const {
+ if ( detector.isValid() ) {
+ ConditionKey::detkey_type det_key = detector.key();
+ key_type low = ConditionKey::KeyMaker(det_key,lower).hash;
+ key_type up = ConditionKey::KeyMaker(det_key,upper).hash;
+ typename T::const_iterator first = data.lower_bound(low);
+ for(; first != data.end() && (*first).first <= up; ++first )
+ processor((*first).second);
+ }
+ DD4hep::except("ConditionsMap","Cannot scan conditions map for conditions of an invalid detector element!");
+}
+
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+ /// Namespace for the conditions part of the AIDA detector description toolkit
+ namespace Conditions {
+
+ /// Specialization: Insert a new entry to the map
+ template <>
+ bool ConditionsMapping<std::multimap<Condition::key_type,Condition> >
+ ::insert(DetElement detector, unsigned int key, Condition condition) {
+ data.insert(std::make_pair(ConditionKey(detector,key).hash,condition));
+ return true;
+ }
+
+ /// Specialization: Interface to partially scan data content of the conditions mapping
+ template <>
+ void ConditionsMapping<std::unordered_map<Condition::key_type,Condition> >
+ ::scan(DetElement detector, itemkey_type lower, itemkey_type upper, const Processor& proc) const {
+ this->ConditionsMap::scan(detector, lower, upper, proc);
+ }
+
+ } /* End namespace Conditions */
+} /* End namespace DD4hep */
+
template class ConditionsMapping<std::map<Condition::key_type,Condition> >;
+template class ConditionsMapping<std::multimap<Condition::key_type,Condition> >;
template class ConditionsMapping<std::unordered_map<Condition::key_type,Condition> >;
diff --git a/DDCore/src/ConditionsPrinter.cpp b/DDCore/src/ConditionsPrinter.cpp
index ec22536c6203c3be0d29e603bfd3e9101ac954bb..14537f6befcd7a3e3043a182d7e08a37b9a60f17 100644
--- a/DDCore/src/ConditionsPrinter.cpp
+++ b/DDCore/src/ConditionsPrinter.cpp
@@ -21,12 +21,12 @@ using namespace DD4hep::Conditions;
/// Initializing constructor
ConditionsPrinter::ConditionsPrinter(ConditionsMap* m, const std::string& pref, int flg)
- : Condition::Processor(), mapping(m), name("Condition"), prefix(pref), m_flag(flg)
+ : mapping(m), name("Condition"), prefix(pref), m_flag(flg)
{
}
/// Actual print method
-int ConditionsPrinter::process(Condition cond) {
+int ConditionsPrinter::operator()(Condition cond) const {
if ( cond.isValid() ) {
std::string repr = cond.str(m_flag);
if ( repr.length() > 100 )
@@ -49,15 +49,15 @@ int ConditionsPrinter::process(Condition cond) {
}
/// Processing callback to print conditions
-int ConditionsPrinter::processElement(DetElement de) {
- DetElementConditionsCollector select(de);
+int ConditionsPrinter::operator()(DetElement de, int level) const {
if ( mapping ) {
- mapping->scan(select);
+ std::vector<Condition> conditions;
+ conditionsCollector(*mapping,conditions)(de,level);
printout(this->printLevel, name, "++ %s %-3ld Conditions for DE %s",
- prefix.c_str(), select.conditions.size(), de.path().c_str());
- for( auto cond : select.conditions )
- process(cond);
- return int(select.conditions.size());
+ prefix.c_str(), conditions.size(), de.path().c_str());
+ for( auto cond : conditions )
+ (*this)(cond);
+ return int(conditions.size());
}
except(name,"Failed to dump conditions for DetElement:%s [No slice availible]",
de.path().c_str());
diff --git a/DDCore/src/ConditionsProcessor.cpp b/DDCore/src/ConditionsProcessor.cpp
index 152894868196238ea0ab4ba11f44c785421d6a83..13db4cd0676c62d1d975c9c8f0031715373da718 100644
--- a/DDCore/src/ConditionsProcessor.cpp
+++ b/DDCore/src/ConditionsProcessor.cpp
@@ -14,38 +14,37 @@
// Framework includes
#include "DD4hep/Printout.h"
#include "DD4hep/ConditionsProcessor.h"
+#include "DD4hep/detail/ContainerHelpers.h"
+using namespace std;
using namespace DD4hep;
using namespace DD4hep::Conditions;
/// Callback to output conditions information
-int ConditionsProcessor::process(Condition /* cond */) {
- return 1;
-}
-
-/// Callback to output conditions information of an entire DetElement
-int ConditionsProcessor::processElement(DetElement de) {
+template <typename T>
+int ConditionsCollector<T>::operator()(DetElement de, int) const {
+ struct Collector : public Condition::Processor {
+ DetElement det;
+ T& container;
+ /// Constructor
+ Collector(DetElement d, T& c) : det(d), container(c) {}
+ /// Processing callback
+ virtual int process(Condition c) const override { insert_item(container, det, c); return 1; }
+ };
if ( de.isValid() ) {
- if ( mapping ) {
- int count = 0;
- DetElementConditionsCollector select(de);
- mapping->scan(select);
- for(const auto& c : select.conditions )
- count += process(c);
- return count;
- }
- except("Conditions","Failed to process alignments for DetElement:%s [No slice availible]",
- de.path().c_str());
+ mapping.scan(de, ConditionsMap::FIRST_ITEM, ConditionsMap::LAST_ITEM, Collector(de,conditions));
+ return (int)conditions.size();
}
except("Conditions","Cannot process conditions of an invalid detector element");
- return 0;
+ return 0;
}
+//template class ConditionsCollector<ConditionsMap>;
+template class ConditionsCollector<list<Condition> >;
+template class ConditionsCollector<vector<Condition> >;
+template class ConditionsCollector<map<DetElement,Condition> >;
+template class ConditionsCollector<vector<pair<DetElement,Condition> > >;
+template class ConditionsCollector<vector<pair<string,Condition> > >;
-/// Overloadable entry: Selection callback: return true if the condition should be selected
-int DetElementConditionsCollector::process(Condition cond) {
- if ( key.detector_key() == cond.detector_key() ) {
- conditions.push_back(cond);
- return 1;
- }
- return 0;
-}
+template class ConditionsCollector<multimap<DetElement,Condition> >;
+template class ConditionsCollector<map<string,Condition> >;
+template class ConditionsCollector<multimap<string,Condition> >;
diff --git a/DDCore/src/ConditonsTypes.cpp b/DDCore/src/ConditonsTypes.cpp
index 49cd23a633b7b1d20c5946b5aff7011dd6c8bdc8..7a0d1af5ff46732a853bd6652eb8aa7e8f61e5a8 100644
--- a/DDCore/src/ConditonsTypes.cpp
+++ b/DDCore/src/ConditonsTypes.cpp
@@ -13,8 +13,8 @@
// Framework include files
#include "DD4hep/Primitives.h"
-#include "DD4hep/objects/ConditionsInterna.h"
-#include "DD4hep/ComponentProperties_inl.h"
+#include "DD4hep/detail/ConditionsInterna.h"
+#include "DD4hep/detail/ComponentProperties_inl.h"
#include "Math/Point3D.h"
#include "Math/Vector3D.h"
diff --git a/DDCore/src/Detector.cpp b/DDCore/src/Detector.cpp
index f36bbb6e36af038d8d18092210cc3149ee11dcdd..b6d7c7d823471a6051d168212d9bab122ef2cd58 100644
--- a/DDCore/src/Detector.cpp
+++ b/DDCore/src/Detector.cpp
@@ -12,9 +12,9 @@
//==========================================================================
// Framework include files
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/ConditionsInterna.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
#include "DD4hep/AlignmentTools.h"
#include "DD4hep/DetectorTools.h"
#include "DD4hep/Printout.h"
diff --git a/DDCore/src/DetectorInterna.cpp b/DDCore/src/DetectorInterna.cpp
index b5e0990566a43f5d4ec7eccb678b57f992df3bdd..176e343b8338b9e320ff08b1d8b585bcfd41a8db 100644
--- a/DDCore/src/DetectorInterna.cpp
+++ b/DDCore/src/DetectorInterna.cpp
@@ -12,16 +12,16 @@
//==========================================================================
// Framework include files
-#include "DD4hep/objects/ConditionsInterna.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/ConditionsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/DetectorTools.h"
-#include "DD4hep/Handle.inl"
#include "DD4hep/Printout.h"
#include "TGeoVolume.h"
#include "TGeoMatrix.h"
#include "TGeoManager.h"
-#include "DD4hep/objects/DetectorInterna.h"
using namespace std;
using namespace DD4hep;
diff --git a/DDCore/src/DetectorProcessor.cpp b/DDCore/src/DetectorProcessor.cpp
index 8a1f98c5bb8814de9dc33b36a6eb929c7f5267d7..e3ab15e08734f0fec3e48d8a2f41aac9481f6082 100644
--- a/DDCore/src/DetectorProcessor.cpp
+++ b/DDCore/src/DetectorProcessor.cpp
@@ -18,17 +18,8 @@
using namespace DD4hep;
using namespace DD4hep::Geometry;
-/// Callback to output detector information of an single DetElement
-int DetectorProcessor::operator()(DetElement de, int /* level */) {
- if ( de.isValid() ) {
- return 1;
- }
- except("Detector","Cannot process an invalid detector element");
- return 0;
-}
-
/// Callback to output detector information of an entire DetElement
-int DetectorProcessor::process(DetElement de, int level, bool recursive) {
+int DetectorProcessor::process(DetElement de, int level, bool recursive) const {
if ( de.isValid() ) {
int ret = (*this)(de, level);
if ( recursive ) {
@@ -40,13 +31,3 @@ int DetectorProcessor::process(DetElement de, int level, bool recursive) {
except("Detector","Cannot process an invalid detector element");
return 0;
}
-
-/// Callback to output detector information of an single DetElement
-int DetectorCollector::operator()(DetElement de, int level) {
- if ( de.isValid() ) {
- detectors.push_back(std::make_pair(level,de));
- return 1;
- }
- except("Detector","Cannot process an invalid detector element");
- return 0;
-}
diff --git a/DDCore/src/DetectorTools.cpp b/DDCore/src/DetectorTools.cpp
index 20bb87df09e71ef301114ab3508e30d2f938961c..f530f165fa737969e4d34975cd53cfac224029c3 100644
--- a/DDCore/src/DetectorTools.cpp
+++ b/DDCore/src/DetectorTools.cpp
@@ -16,7 +16,7 @@
#include "DD4hep/DetectorTools.h"
#include "DD4hep/Printout.h"
#include "DD4hep/LCDD.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
// C/C++ include files
#include <stdexcept>
diff --git a/DDCore/src/FieldTypes.cpp b/DDCore/src/FieldTypes.cpp
index 34035d5c0fe80a61848c90fc3a6e0100fd86c240..af3f6b136e931b13a7a5d564d6d717871af1ec7e 100644
--- a/DDCore/src/FieldTypes.cpp
+++ b/DDCore/src/FieldTypes.cpp
@@ -11,8 +11,8 @@
//
//==========================================================================
-#include "DD4hep/Handle.inl"
#include "DD4hep/FieldTypes.h"
+#include "DD4hep/detail/Handle.inl"
#include <cmath>
using namespace std;
diff --git a/DDCore/src/Fields.cpp b/DDCore/src/Fields.cpp
index 8bf79cd875138020c823600a13fe0710ab4620fb..acd74030905d3c766fdb05ce9b0aa6f4ba6c62af 100644
--- a/DDCore/src/Fields.cpp
+++ b/DDCore/src/Fields.cpp
@@ -11,9 +11,9 @@
//
//==========================================================================
-#include "DD4hep/Handle.inl"
#include "DD4hep/Fields.h"
#include "DD4hep/InstanceCount.h"
+#include "DD4hep/detail/Handle.inl"
using namespace std;
using namespace DD4hep::Geometry;
diff --git a/DDCore/src/GeoHandler.cpp b/DDCore/src/GeoHandler.cpp
index 4f3952274794f6a11d0bf26ff3fe4ff12609b8f6..ef03eb8fe1c0c8d824a7f06bcfcbb206e0de1d0b 100644
--- a/DDCore/src/GeoHandler.cpp
+++ b/DDCore/src/GeoHandler.cpp
@@ -14,7 +14,7 @@
// Framework include files
#include "DD4hep/LCDD.h"
#include "DD4hep/GeoHandler.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
// ROOT includes
#include "TGeoManager.h"
diff --git a/DDCore/src/GridPhiEta.cpp b/DDCore/src/GridPhiEta.cpp
index 2927a5d21a311ede0e6029e0e807f47817725d13..51901f9cb0bd494a81233a083877d7bd7bfe63ad 100644
--- a/DDCore/src/GridPhiEta.cpp
+++ b/DDCore/src/GridPhiEta.cpp
@@ -1,4 +1,17 @@
+//==========================================================================
+// AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author : M.Frank
+//
+//==========================================================================
+
#include "DD4hep/GridPhiEta.h"
-#include "DD4hep/Handle.inl"
+#include "DD4hep/detail/Handle.inl"
DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridPhiEta);
diff --git a/DDCore/src/GridRPhiEta.cpp b/DDCore/src/GridRPhiEta.cpp
index beb4e9d4a308614cf471761e546d7e922de196f2..cb900893f648eae117011ff3bb60cabc6a6d1e1e 100644
--- a/DDCore/src/GridRPhiEta.cpp
+++ b/DDCore/src/GridRPhiEta.cpp
@@ -1,4 +1,17 @@
+//==========================================================================
+// AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author : M.Frank
+//
+//==========================================================================
+
#include "DD4hep/GridRPhiEta.h"
-#include "DD4hep/Handle.inl"
+#include "DD4hep/detail/Handle.inl"
DD4HEP_INSTANTIATE_HANDLE_UNNAMED(DD4hep::DDSegmentation::GridRPhiEta);
diff --git a/DDCore/src/Handle.cpp b/DDCore/src/Handle.cpp
index aed23a176515cc661c330b9663d24e0a4c46e9d0..9c676e394642d787bb11413a26ba0634db4a6567 100644
--- a/DDCore/src/Handle.cpp
+++ b/DDCore/src/Handle.cpp
@@ -13,7 +13,7 @@
#include "DD4hep/InstanceCount.h"
#include "DD4hep/Printout.h"
-#include "DD4hep/Handle.inl"
+#include "DD4hep/detail/Handle.inl"
#include "XML/Evaluator.h"
#include <iostream>
#include <iomanip>
diff --git a/DDCore/src/IDDescriptor.cpp b/DDCore/src/IDDescriptor.cpp
index 592512c81cb9218a5fb3d746a971a463d54a088f..fa500c3b89ae8a4c544427009b18412298574d73 100644
--- a/DDCore/src/IDDescriptor.cpp
+++ b/DDCore/src/IDDescriptor.cpp
@@ -11,9 +11,9 @@
//
//==========================================================================
-#include "DD4hep/Handle.inl"
#include "DD4hep/IDDescriptor.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/ObjectsInterna.h"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/Volumes.h"
#include "DD4hep/Printout.h"
diff --git a/DDCore/src/LCDDData.cpp b/DDCore/src/LCDDData.cpp
index 2d89d54c1d470f128cd431c2abe799a88b84169d..80e4a73be5ac3890d886e221a5304ca6d18d0651 100644
--- a/DDCore/src/LCDDData.cpp
+++ b/DDCore/src/LCDDData.cpp
@@ -14,8 +14,8 @@
// Framework include files
#include "DD4hep/LCDDData.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/ObjectsInterna.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
// ROOT include files
#include "TGeoManager.h"
diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/LCDDImp.cpp
index aea8bc62f01d5b557e39eab6068c4ea444cdba12..2251ddb1870138c8ac6ec6b2405678ddfe277705 100644
--- a/DDCore/src/LCDDImp.cpp
+++ b/DDCore/src/LCDDImp.cpp
@@ -17,8 +17,8 @@
#include "DD4hep/GeoHandler.h"
#include "DD4hep/LCDDHelper.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/VolumeManagerInterna.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/VolumeManagerInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
#include "LCDDImp.h"
// C/C++ include files
diff --git a/DDCore/src/MultiSegmentation.cpp b/DDCore/src/MultiSegmentation.cpp
index a856122b9593ebdb6379e703eec1e911997b5b48..ae1c1a5f77b236ecfc7292da92c0b2d3ac01f19f 100644
--- a/DDCore/src/MultiSegmentation.cpp
+++ b/DDCore/src/MultiSegmentation.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/MultiSegmentation.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/MultiSegmentation.h"
// C/C++ include files
diff --git a/DDCore/src/NamedObject.cpp b/DDCore/src/NamedObject.cpp
index 825f227e7fcf7750bbe54265ac9c5c089cb276eb..7cbe162b0dc9d83094ebabdfde1040ad8c03b68a 100644
--- a/DDCore/src/NamedObject.cpp
+++ b/DDCore/src/NamedObject.cpp
@@ -13,7 +13,7 @@
// Framework includes
#include "DD4hep/NamedObject.h"
-#include "DD4hep/Handle.inl"
+#include "DD4hep/detail/Handle.inl"
#include "TObject.h"
using namespace std;
diff --git a/DDCore/src/NoSegmentation.cpp b/DDCore/src/NoSegmentation.cpp
index 51b13eed1f67c0299bd491b3d1e8780b28871484..42af6dc9b3fb967e0d867c9add842f3e5af13656 100644
--- a/DDCore/src/NoSegmentation.cpp
+++ b/DDCore/src/NoSegmentation.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/NoSegmentation.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/NoSegmentation.h"
// C/C++ include files
diff --git a/DDCore/src/ObjectPrintout.cpp b/DDCore/src/ObjectPrintout.cpp
index a9201c711b7155eee183a140524391635f5e49ee..b9024b430f260e750352205dda2b31dc40a16d7a 100644
--- a/DDCore/src/ObjectPrintout.cpp
+++ b/DDCore/src/ObjectPrintout.cpp
@@ -15,7 +15,7 @@
#include "DD4hep/LCDD.h"
#include "DD4hep/Objects.h"
#include "DD4hep/Conditions.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
#include "DD4hep/Printout.h"
// C/C++ include files
diff --git a/DDCore/src/Objects.cpp b/DDCore/src/Objects.cpp
index 5116e26a8004e9d145a478d967d4034b885b25ce..d0accf2512daa270ad43666a863724b78c15762f 100644
--- a/DDCore/src/Objects.cpp
+++ b/DDCore/src/Objects.cpp
@@ -16,7 +16,7 @@
#include "DD4hep/Printout.h"
#include "DD4hep/IDDescriptor.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
#include "TMap.h"
#include "TROOT.h"
diff --git a/DDCore/src/ObjectsInterna.cpp b/DDCore/src/ObjectsInterna.cpp
index 4361f4216d05f1388a625034040850a9f3bafd11..b3dc81737eff5d9bd4cc1abfff8bcdbc6088c7d1 100644
--- a/DDCore/src/ObjectsInterna.cpp
+++ b/DDCore/src/ObjectsInterna.cpp
@@ -11,11 +11,11 @@
//
//==========================================================================
-#include "DD4hep/Handle.inl"
-#include "DD4hep/InstanceCount.h"
#include "DD4hep/Objects.h"
-#include "DD4hep/objects/ObjectsInterna.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/InstanceCount.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/ObjectsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
using namespace std;
using namespace DD4hep;
diff --git a/DDCore/src/OpaqueData.cpp b/DDCore/src/OpaqueData.cpp
index d5c999d094e47fde3982c4e6e83984d8d29ec49d..4070f86b6c58ffc1673f75fd2338672e95b29281 100644
--- a/DDCore/src/OpaqueData.cpp
+++ b/DDCore/src/OpaqueData.cpp
@@ -16,7 +16,7 @@
#include "DD4hep/Primitives.h"
#include "DD4hep/OpaqueData.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/OpaqueData_inl.h"
+#include "DD4hep/detail/OpaqueData_inl.h"
// C/C++ header files
#include <cstring>
diff --git a/DDCore/src/OpaqueDataBinder.cpp b/DDCore/src/OpaqueDataBinder.cpp
index 12822ec272a57fa730d84f1616f3e65424e036d5..ee1335a077d51dc12df1afbddaabea7ec86bf73b 100644
--- a/DDCore/src/OpaqueDataBinder.cpp
+++ b/DDCore/src/OpaqueDataBinder.cpp
@@ -13,9 +13,9 @@
// Framework include files
#include "DD4hep/OpaqueDataBinder.h"
-#include "DD4hep/objects/OpaqueData_inl.h"
-#include "DD4hep/objects/ConditionsInterna.h"
#include "DD4hep/Conditions.h"
+#include "DD4hep/detail/OpaqueData_inl.h"
+#include "DD4hep/detail/ConditionsInterna.h"
// C/C++ include files
#include <set>
diff --git a/DDCore/src/Plugins.cpp b/DDCore/src/Plugins.cpp
index 65fd2cb710eb6b94a3d5a2769cc62c228beb4907..65e22babc3c7a079bd0b5bc6bbb3c25af3949699 100644
--- a/DDCore/src/Plugins.cpp
+++ b/DDCore/src/Plugins.cpp
@@ -14,7 +14,7 @@
// Framework include files
#include "DD4hep/Plugins.h"
#if defined(DD4HEP_ROOT_VERSION_5)
-#include "DD4hep/Plugins.inl"
+#include "DD4hep/detail/Plugins.inl"
#endif
#include <cstdlib>
diff --git a/DDCore/src/PolarGridRPhi.cpp b/DDCore/src/PolarGridRPhi.cpp
index e7bfe7b5e6a61960fcc6add59684acffddd260bd..b47ec9e817b57205a5123c83741c0eba40c03fd4 100644
--- a/DDCore/src/PolarGridRPhi.cpp
+++ b/DDCore/src/PolarGridRPhi.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/PolarGridRPhi.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/PolarGridRPhi.h"
// C/C++ include files
diff --git a/DDCore/src/PolarGridRPhi2.cpp b/DDCore/src/PolarGridRPhi2.cpp
index 3717e530dda3966c5707dc080c835051ebc39fb0..516d749b51a2c898f701b7a8366914d50f0bd8f5 100644
--- a/DDCore/src/PolarGridRPhi2.cpp
+++ b/DDCore/src/PolarGridRPhi2.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/PolarGridRPhi2.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/PolarGridRPhi2.h"
// C/C++ include files
diff --git a/DDCore/src/Readout.cpp b/DDCore/src/Readout.cpp
index 8e8bd0668e962baba7b40e42e00c9f0c33c2dc8a..881b20c7cb271aacc20525a959128002b0edf253 100644
--- a/DDCore/src/Readout.cpp
+++ b/DDCore/src/Readout.cpp
@@ -13,12 +13,12 @@
// Framework include files
#include "DD4hep/Readout.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
+#include "DD4hep/detail/Handle.inl"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/DD4hepUnits.h"
#include "DD4hep/LCDD.h"
-#include "DD4hep/Handle.inl"
using namespace std;
using namespace DD4hep;
diff --git a/DDCore/src/Segmentations.cpp b/DDCore/src/Segmentations.cpp
index d9fd6b33e08391bbbe3d7249e6af6fab8e9cf2a8..0df7ca99627315595d273386db7e5be7891bd06d 100644
--- a/DDCore/src/Segmentations.cpp
+++ b/DDCore/src/Segmentations.cpp
@@ -16,8 +16,8 @@
#include "DD4hep/InstanceCount.h"
#include "DD4hep/Printout.h"
#include "DD4hep/Plugins.h"
-#include "DD4hep/Handle.inl"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/SegmentationsInterna.h"
// C/C++ include files
#include <iostream>
diff --git a/DDCore/src/SegmentationsInterna.cpp b/DDCore/src/SegmentationsInterna.cpp
index 1cbbef7bd681876c4d42b98916b4ab46942d4f75..860b203863cff5244899cfe3331b577e052d0a02 100644
--- a/DDCore/src/SegmentationsInterna.cpp
+++ b/DDCore/src/SegmentationsInterna.cpp
@@ -12,7 +12,7 @@
//==========================================================================
// Framework include files
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DD4hep/InstanceCount.h"
// C/C++ include files
diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp
index 52b56d461eef67e5909fe909c2a9294da767858a..c1db4c7aa3b0ece0044f4ef998a9a562abdd2fdf 100644
--- a/DDCore/src/VolumeManager.cpp
+++ b/DDCore/src/VolumeManager.cpp
@@ -15,8 +15,8 @@
#include "DD4hep/LCDD.h"
#include "DD4hep/Printout.h"
#include "DD4hep/MatrixHelpers.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/VolumeManagerInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/VolumeManagerInterna.h"
// C/C++ includes
#include <set>
diff --git a/DDCore/src/VolumeManagerInterna.cpp b/DDCore/src/VolumeManagerInterna.cpp
index 4c04513e3642c66ec275a885de43cfbc901ab049..75b8c4775b4fae22ac2702dc8527f9428cff8b72 100644
--- a/DDCore/src/VolumeManagerInterna.cpp
+++ b/DDCore/src/VolumeManagerInterna.cpp
@@ -13,8 +13,8 @@
// Framework include files
#include "DD4hep/Printout.h"
-#include "DD4hep/Handle.inl"
-#include "DD4hep/objects/VolumeManagerInterna.h"
+#include "DD4hep/detail/Handle.inl"
+#include "DD4hep/detail/VolumeManagerInterna.h"
using namespace DD4hep;
using namespace DD4hep::Geometry;
diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp
index 255e14da76ed8a502e3e45df2e50c5996361a651..69eb0cc7b4c8f410ab3910785182722c37915ca0 100644
--- a/DDCore/src/Volumes.cpp
+++ b/DDCore/src/Volumes.cpp
@@ -16,7 +16,7 @@
#include "DD4hep/Printout.h"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/MatrixHelpers.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
// ROOT include files
#include "TColor.h"
diff --git a/DDCore/src/WaferGridXY.cpp b/DDCore/src/WaferGridXY.cpp
index 8d73b711af23a81ded486c511cf289967dd9c4d4..436d2721ce813dd12ddbb74ad990034433c8ac62 100644
--- a/DDCore/src/WaferGridXY.cpp
+++ b/DDCore/src/WaferGridXY.cpp
@@ -13,7 +13,7 @@
// Framework include files
#include "DD4hep/WaferGridXY.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DDSegmentation/WaferGridXY.h"
// C/C++ include files
diff --git a/DDCore/src/World.cpp b/DDCore/src/World.cpp
index e0c86057584b4df50d9a65411d15dd17bb28fc28..4c48ef7f148ce02ac70eccdf21aca7cbb15aa546 100644
--- a/DDCore/src/World.cpp
+++ b/DDCore/src/World.cpp
@@ -14,7 +14,7 @@
// Framework include files
#include "DD4hep/World.h"
#include "DD4hep/Printout.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
using namespace DD4hep::Geometry;
diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index 3d3ec589bc00668b2e45f3ef1b5411fe6f9b3592..7fe25b46d6cbee44a7e450eac44adbf97518a04f 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -18,9 +18,9 @@
#include "DD4hep/FieldTypes.h"
#include "DD4hep/Printout.h"
#include "DD4hep/Plugins.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
#include "XML/DocumentHandler.h"
#include "XML/Utilities.h"
diff --git a/DDCore/src/plugins/JsonProcessor.cpp b/DDCore/src/plugins/JsonProcessor.cpp
index a52dbdcc4983c892e9c5ec4b4348ac9e296963a4..92d58fcf93f550dfacd7dd3954b73130effa3d5e 100644
--- a/DDCore/src/plugins/JsonProcessor.cpp
+++ b/DDCore/src/plugins/JsonProcessor.cpp
@@ -33,9 +33,9 @@
#include "DD4hep/Plugins.h"
#include "DD4hep/Printout.h"
#include "DD4hep/IDDescriptor.h"
-#include "DD4hep/objects/SegmentationsInterna.h"
-#include "DD4hep/objects/DetectorInterna.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
// C/C++ include files
#include <iostream>
diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp
index f3004766fc0d491758b6f3eeefc3bc615e2e8989..5991d6082913b21f8b90af19a82b5f3caab655d2 100644
--- a/DDCore/src/plugins/LCDDConverter.cpp
+++ b/DDCore/src/plugins/LCDDConverter.cpp
@@ -17,8 +17,8 @@
#include "DD4hep/Volumes.h"
#include "DD4hep/FieldTypes.h"
#include "DD4hep/Segmentations.h"
-#include "DD4hep/objects/ObjectsInterna.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
#include "XML/DocumentHandler.h"
#include "LCDDConverter.h"
diff --git a/DDCore/src/plugins/LCDDSegmentations.cpp b/DDCore/src/plugins/LCDDSegmentations.cpp
index 04aaf6187f7c9a9d2e4ae2ef35db85b8c9a68eb7..39498a97c1af5c316e00ae947e031715199addfc 100644
--- a/DDCore/src/plugins/LCDDSegmentations.cpp
+++ b/DDCore/src/plugins/LCDDSegmentations.cpp
@@ -12,7 +12,7 @@
//==========================================================================
// Framework includes
-#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/detail/SegmentationsInterna.h"
#include "DD4hep/Factories.h"
using namespace DD4hep::Geometry;
diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp
index 55dd26b78648c2d3733be8743727f9ebbfe557c6..72fb5b41ec2fe0962568dc0a0657970faf9613df 100644
--- a/DDCore/src/plugins/StandardPlugins.cpp
+++ b/DDCore/src/plugins/StandardPlugins.cpp
@@ -20,6 +20,7 @@
#include "DD4hep/DD4hepUnits.h"
#include "DD4hep/DetectorTools.h"
#include "DD4hep/PluginCreators.h"
+#include "DD4hep/DetectorProcessor.h"
#include "DD4hep/DD4hepRootPersistency.h"
#include "XML/DocumentHandler.h"
#include "XML/XMLElements.h"
@@ -664,41 +665,15 @@ DECLARE_APPLY(DD4hepVolumeDump,dump_volume_tree)
* \date 18/11/2016
*/
static int detelement_processor(LCDD& lcdd, int argc, char** argv) {
- struct Actor {
- DetElement::Processor* processor;
-
- /// Standard constructor
- Actor(DetElement::Processor* p) : processor(p) { }
- /// Default destructor
- ~Actor() { }
- /// Dump method.
- long process(DetElement de) {
- if ( de.isValid() ) {
- int result = 1;
- (*processor).processElement(de);
- for (const auto& c : de.children() ) {
- int ret = process(c.second);
- if ( 1 != ret ) {
- printout(ERROR,"DetectorProcessor","++ Failed to process detector element %s.",c.second.name());
- result = ret;
- }
- }
- return result;
- }
- printout(ERROR,"DetectorProcessor","++ Failed to process invalid detector element.");
- return 0;
- }
- };
DetElement det = lcdd.world();
- DetElement::Processor* proc =
- DD4hep::createProcessor<DetElement::Processor>(lcdd, argc, argv);
+ unique_ptr<DetectorProcessor> proc(DD4hep::createProcessor<DetectorProcessor>(lcdd, argc, argv));
for(int i=0, num=std::min(argc,3); i<num; ++i) {
if ( 0 == ::strncmp(argv[i],"-detector",4) ) {
det = DetectorTools::findElement(lcdd, argv[++i]);
break;
}
}
- return Actor(proc).process(det);
+ return DetectorScanner().scan(*proc,det);
}
DECLARE_APPLY(DD4hep_DetElementProcessor,detelement_processor)
diff --git a/DDCore/src/plugins/VolumeMgrTest.cpp b/DDCore/src/plugins/VolumeMgrTest.cpp
index 0619c70747a01f0f2584555d43e7bfa51c612415..b04e0fc52163c48788a1e7128bda233d9a0bdb7d 100644
--- a/DDCore/src/plugins/VolumeMgrTest.cpp
+++ b/DDCore/src/plugins/VolumeMgrTest.cpp
@@ -19,7 +19,7 @@
#include "DD4hep/VolumeManager.h"
#include "DD4hep/DetectorTools.h"
#include "DD4hep/MatrixHelpers.h"
-#include "DD4hep/objects/VolumeManagerInterna.h"
+#include "DD4hep/detail/VolumeManagerInterna.h"
// C/C++ include files
#include <stdexcept>
diff --git a/DDDB/include/DDDB/DDDBConditionPrinter.h b/DDDB/include/DDDB/DDDBConditionPrinter.h
index 7e381fc00dc78a40e0dbba23b7699f80ff7d3641..04a0d5d81ffbfec3f30e4187c6b29010cff7c8b3 100644
--- a/DDDB/include/DDDB/DDDBConditionPrinter.h
+++ b/DDDB/include/DDDB/DDDBConditionPrinter.h
@@ -56,6 +56,9 @@ namespace DD4hep {
protected:
/// Parent object
ConditionPrinter* m_parent = 0;
+ public:
+ std::string prefix;
+ PrintLevel printLevel;
public:
/// Copy constructor
ParamPrinter(const ParamPrinter& copy) = default;
@@ -71,45 +74,39 @@ namespace DD4hep {
protected:
friend class ParamPrinter;
-
+ typedef Geometry::DetElement DetElement;
/// Sub-printer
- ParamPrinter* m_print = 0;
- /// Printout prefix
- std::string m_prefix;
- /// Flags to steer output processing
- int m_flag = 0;
- /// Printout level
- PrintLevel m_printLevel = INFO;
-
+ ParamPrinter* m_print = 0;
+
+ public:
+ /// Line length
+ size_t lineLength = 80;
/// Counter: number of parameters
- size_t m_numParam = 0;
+ size_t numParam = 0;
/// Counter: number of conditions
- size_t m_numCondition = 0;
+ mutable size_t numCondition = 0;
/// Counter: number of empty conditions
- size_t m_numEmptyCondition = 0;
-
- public:
+ mutable size_t numEmptyCondition = 0;
+
typedef Conditions::Condition Condition;
/// No default constructor
ConditionPrinter() = delete;
/// No copy constructor
ConditionPrinter(const ConditionPrinter& copy) = delete;
/// Initializing constructor
- ConditionPrinter(Conditions::ConditionsMap* m,
+ ConditionPrinter(Conditions::ConditionsMap* mapping,
const std::string& prefix,
int flag=Condition::NO_NAME|Condition::WITH_IOV|Condition::WITH_ADDRESS,
ParamPrinter* prt=0);
+ /// No assignment
+ ConditionPrinter& operator=(const ConditionPrinter& copy) = delete;
/// Default destructor
virtual ~ConditionPrinter();
-
- /// Set printout level for prinouts
- void setPrintLevel(PrintLevel lvl);
- /// Access the prefix value
- const std::string& prefix() const { return m_prefix; }
- /// Set prefix for prinouts
- void setPrefix(const std::string& value) { m_prefix = value; }
/// Callback to output conditions information
- virtual int process(Condition condition);
+ virtual int operator()(Condition condition) const override;
+ /// Callback to output alignments information of an entire DetElement
+ virtual int operator()(DetElement de, int level) const
+ { return this->Conditions::ConditionsPrinter::operator()(de,level); }
};
} /* End namespace DDDB */
diff --git a/DDDB/include/DDDB/DDDBConversion.h b/DDDB/include/DDDB/DDDBConversion.h
index ac8b94bad8df70e5edc4cf966c3db3f05bf5106e..e2017f0b68962e98b30810af521dd37c0b318ccf 100644
--- a/DDDB/include/DDDB/DDDBConversion.h
+++ b/DDDB/include/DDDB/DDDBConversion.h
@@ -580,7 +580,8 @@ namespace DD4hep {
typedef std::map<std::string,Material*> Materials;
typedef std::map<std::string,Shape*> Shapes;
typedef std::map<std::string,TabProperty*> TabProperties;
- typedef std::map<std::string,Conditions::Condition::Object*> Conditions;
+ typedef std::map<std::string,Conditions::Condition::Object*> Conditions;
+ typedef std::map<std::string,std::pair<DetElement,std::string> > Det_Conditions;
/// Default constructor
dddb();
@@ -611,6 +612,7 @@ namespace DD4hep {
Catalogs catalogs, catalogPaths;
/// Detector element hierarchy
Catalog *top, *structure, *geometry;
+ Det_Conditions detCond;
};
class dddb_conditions {};
diff --git a/DDDB/src/DDDBConditionPrinter.cpp b/DDDB/src/DDDBConditionPrinter.cpp
index 6477308e82bd3bdb19eb45307e9ee53f6b6d8a9d..d93f0af01217eed0419f4f384e1fd83a7526c71d 100644
--- a/DDDB/src/DDDBConditionPrinter.cpp
+++ b/DDDB/src/DDDBConditionPrinter.cpp
@@ -41,24 +41,24 @@ ConditionPrinter::ParamPrinter::ParamPrinter(ConditionPrinter* p) : m_parent(p)
/// Callback to output conditions information
void ConditionPrinter::ParamPrinter::operator()(const AbstractMap::Params::value_type& obj) const {
const std::type_info& type = obj.second.typeInfo();
- ++m_parent->m_numParam;
+ ++m_parent->numParam;
if ( type == typeid(string) ) {
string value = obj.second.get<string>().c_str();
size_t len = value.length();
- if ( len > 100 ) {
- value.erase(100);
+ if ( len > m_parent->lineLength ) {
+ value.erase(m_parent->lineLength);
value += "...";
}
- printout(m_parent->m_printLevel,"Condition","++ %s\t-> Param: %-16s %-8s -> %s",
- m_parent->m_prefix.c_str(),
+ printout(m_parent->printLevel,m_parent->name,"++ %s\t-> Param: %-16s %-8s -> %s",
+ prefix.c_str(),
obj.first.c_str(),
obj.second.dataType().c_str(),
value.c_str());
}
else if ( type == typeid(AbstractMap) ) {
const AbstractMap& d= obj.second.get<AbstractMap>();
- printout(m_parent->m_printLevel,"Condition","++ %s\t-> [%s] CL:%d %-8s -> %s",
- m_parent->m_prefix.c_str(),
+ printout(m_parent->printLevel,m_parent->name,"++ %s\t-> [%s] CL:%d %-8s -> %s",
+ prefix.c_str(),
obj.first.c_str(), d.classID,
obj.second.dataType().c_str(),
obj.second.str().c_str());
@@ -66,12 +66,12 @@ void ConditionPrinter::ParamPrinter::operator()(const AbstractMap::Params::value
else {
string value = obj.second.str();
size_t len = value.length();
- if ( len > 100 ) {
- value.erase(100);
+ if ( len > m_parent->lineLength ) {
+ value.erase(m_parent->lineLength);
value += "...";
}
- printout(m_parent->m_printLevel,"Condition","++ %s\t-> [%s] %-8s -> %s",
- m_parent->m_prefix.c_str(),
+ printout(m_parent->printLevel,m_parent->name,"++ %s\t-> [%s] %-8s -> %s",
+ prefix.c_str(),
obj.first.c_str(),
obj.second.dataType().c_str(),
value.c_str());
@@ -79,45 +79,41 @@ void ConditionPrinter::ParamPrinter::operator()(const AbstractMap::Params::value
}
/// Initializing constructor
-ConditionPrinter::ConditionPrinter(ConditionsMap* m, const string& prefix, int flg, ParamPrinter* prt)
- : ConditionsPrinter(m), m_print(prt), m_prefix(prefix), m_flag(flg)
+ConditionPrinter::ConditionPrinter(ConditionsMap* m, const string& p, int f, ParamPrinter* prt)
+ : ConditionsPrinter(m,p,f), m_print(prt)
{
+ m_print = new ParamPrinter(this);
+ m_print->printLevel = printLevel;
}
/// Default destructor
ConditionPrinter::~ConditionPrinter() {
- printout(INFO,"Condition","++ %s +++++++++++++ Printout summary:", m_prefix.c_str());
- printout(INFO,"Condition","++ %s Number of conditions: %8ld [ dto. empty:%ld]",
- m_prefix.c_str(), m_numCondition, m_numEmptyCondition);
- printout(INFO,"Condition","++ %s Total Number of parameters: %8ld [%7.3f Parameters/Condition]",
- m_prefix.c_str(), m_numParam, double(m_numParam)/std::max(double(m_numCondition),1e0));
-}
-
-/// Set printout level for prinouts
-void ConditionPrinter::setPrintLevel(PrintLevel lvl) {
- m_printLevel = lvl;
+ printout(INFO,name,"++ %s +++++++++++++ Printout summary:", prefix.c_str());
+ printout(INFO,name,"++ %s Number of conditions: %8ld [ dto. empty:%ld]",
+ prefix.c_str(), numCondition, numEmptyCondition);
+ printout(INFO,name,"++ %s Total Number of parameters: %8ld [%7.3f Parameters/Condition]",
+ prefix.c_str(), numParam, double(numParam)/std::max(double(numCondition),1e0));
+ deletePtr(m_print);
}
/// Callback to output conditions information
-int ConditionPrinter::process(Condition cond) {
+int ConditionPrinter::operator()(Condition cond) const {
if ( cond.isValid() ) {
- printout(m_printLevel,"Condition","++ %s%s",m_prefix.c_str(),cond.str(m_flag).c_str());
+ printout(printLevel,name,"++ %s%s",prefix.c_str(),cond.str(m_flag).c_str());
const AbstractMap& data = cond.get<AbstractMap>();
- printout(m_printLevel,"Condition","++ %s Path:%s Class:%d [%s]",
- m_prefix.c_str(),
+ printout(printLevel,name,"++ %s Path:%s Class:%d [%s]",
+ prefix.c_str(),
cond.name(),
data.classID,
cond.data().dataType().c_str());
- ++m_numCondition;
+ ++numCondition;
if ( !data.params.empty() ) {
- const string tmp = m_prefix;
- m_prefix.assign(tmp.length(),' ');
- if ( !m_print ) m_print = new ParamPrinter(this);
+ m_print->printLevel = printLevel;
+ m_print->prefix.assign(prefix.length(),' ');
for_each(data.params.begin(), data.params.end(),*m_print);
- m_prefix = tmp;
}
else {
- ++m_numEmptyCondition;
+ ++numEmptyCondition;
}
}
return 1;
diff --git a/DDDB/src/DDDBConditionsLoader.cpp b/DDDB/src/DDDBConditionsLoader.cpp
index ea8fea7164a6799d88952c3a9409cfb75250e423..f76a3d118d0ae5bab24367b776ad8840c05c3271 100644
--- a/DDDB/src/DDDBConditionsLoader.cpp
+++ b/DDDB/src/DDDBConditionsLoader.cpp
@@ -27,8 +27,8 @@
// Other DD4hep includes
#include "DD4hep/Printout.h"
#include "DD4hep/Operators.h"
-#include "DD4hep/objects/ConditionsInterna.h"
#include "DDCond/ConditionsManagerObject.h"
+#include "DD4hep/detail/ConditionsInterna.h"
// Forward declartions
using namespace std;
diff --git a/DDDB/src/plugins/CondDB2DDDB.cpp b/DDDB/src/plugins/CondDB2DDDB.cpp
index 954f0865e826ba395c9eb9da2fb33bd44db93cef..c9c451b6f906ee4d26b1fec87dbce208fd265ba6 100644
--- a/DDDB/src/plugins/CondDB2DDDB.cpp
+++ b/DDDB/src/plugins/CondDB2DDDB.cpp
@@ -43,7 +43,6 @@ namespace DD4hep {
namespace {
using Conditions::Condition;
- using Conditions::ConditionKey;
using Conditions::AbstractMap;
typedef Alignments::Delta AlignmentDelta;
@@ -597,12 +596,11 @@ namespace DD4hep {
Document* doc = context->locals.xml_doc;
string path = object_path(context,name);
static int num_param=0, num_vector=0, num_map=0, num_spec=0, num_align=0;
- ConditionKey::KeyMaker mk(hash32(path),hash32(path));
Condition cond(path,"DDDB");
cond->address = doc->name+"@"+id;
cond->value = path; // doc->name;
cond->validity = "";
- cond->hash = mk.hash;
+ cond->hash = hash64(path);
if ( element.hasAttr(_U(comment)) ) {
cond->comment = element.attr<string>(_U(comment));
}
diff --git a/DDDB/src/plugins/DDDB2Objects.cpp b/DDDB/src/plugins/DDDB2Objects.cpp
index 2a9dc3b67593d1f88045d0723b9935aa30cacd9d..cf879a5892444e04a62252a9bc550e90238800b0 100644
--- a/DDDB/src/plugins/DDDB2Objects.cpp
+++ b/DDDB/src/plugins/DDDB2Objects.cpp
@@ -67,20 +67,7 @@ namespace DD4hep {
typedef set<string> StringSet;
- Context(LCDD& l, dddb* g)
- : lcdd(l), geo(g), helper(0), epoch(0),
- max_volume_depth(9999),
- print_materials(false),
- print_volumes(false),
- print_logvol(false),
- print_shapes(false),
- print_physvol(false),
- print_params(false),
- print_detelem(false),
- print_conditions(false),
- print_vis(false),
- conditions_only(false)
- {
+ Context(LCDD& l, dddb* g) : lcdd(l), geo(g) {
}
~Context() {
//printout(INFO,"Context","Destructor calling....");
@@ -93,8 +80,8 @@ namespace DD4hep {
template <typename T> void collect(const string& id, T* s);
template <typename T,typename Q> void collect(const string& id, T* s, Q* c);
LCDD& lcdd;
- DDDB::dddb* geo;
- DDDB::DDDBHelper* helper;
+ DDDB::dddb* geo = 0;
+ DDDB::DDDBHelper* helper = 0;
typedef std::map<Isotope*, TGeoIsotope*> Isotopes;
typedef std::map<Element*, TGeoElement*> Elements;
typedef std::map<Material*, TGeoMedium*> Materials;
@@ -117,18 +104,20 @@ namespace DD4hep {
DetectorElements detelements;
GeoVolume lvDummy;
ConditionsManager manager;
- const IOVType* epoch;
- int max_volume_depth;
- bool print_materials;
- bool print_volumes;
- bool print_logvol;
- bool print_shapes;
- bool print_physvol;
- bool print_params;
- bool print_detelem;
- bool print_conditions;
- bool print_vis;
- bool conditions_only;
+ const IOVType* epoch = 0;
+ int max_volume_depth = 9999;
+ int matched_conditions = 0;
+ int unmatched_conditions = 0;
+ bool print_materials = false;
+ bool print_volumes = false;
+ bool print_logvol = false;
+ bool print_shapes = false;
+ bool print_physvol = false;
+ bool print_params = false;
+ bool print_detelem = false;
+ bool print_conditions = false;
+ bool print_vis = false;
+ bool conditions_only = false;
static GeoPlacement placement(DetElement de) {
if ( de.isValid() ) {
@@ -222,15 +211,32 @@ namespace DD4hep {
/// Convert single condition objects
template <> void* CNV<GeoCondition>::convert(GeoCondition *obj) const {
- Context* context = _param<Context>();
- if ( obj ) {
+ if ( obj ) {
typedef IOV::Key _K;
+ Context* context = _param<Context>();
+ dddb* geo = context->geo;
Conditions::Condition cond = obj;
AbstractMap& d = cond.get<AbstractMap>();
Document* doc = d.option<Document>();
_K::first_type since = doc->context.valid_since;
_K::second_type until = doc->context.valid_until;
_K iov_key(since,until);
+ auto it = geo->detCond.find(obj->value);
+ bool resolved = false;
+ if ( it != geo->detCond.end() ) {
+ DetElement det((*it).second.first);
+ cond->SetName((*it).second.second.c_str());
+ obj->hash = Conditions::ConditionKey::KeyMaker(det.key(),hash32(cond.name())).hash;
+ ++context->matched_conditions;
+ resolved = true;
+ }
+ else if ( obj->value.find("/dd/Conditions/Alignment/") == 0 ) {
+ //printout(WARNING,"DDDB","Cannot match alignment %s to detector element!",cond.name());
+ }
+ if ( !resolved ) {
+ //printout(WARNING,"DDDB","Cannot match condition %s to detector element!",cond.name());
+ ++context->unmatched_conditions;
+ }
ConditionsPool* pool = context->manager.registerIOV(*(context->epoch), iov_key);
context->manager.registerUnlocked(*pool, cond);
//context->manager.registerKey(cond->hash, cond->name);
@@ -870,22 +876,17 @@ namespace DD4hep {
context->volumePaths[lp] = gv.ptr();
}
#endif
-#if 0
/// Attach conditions keys to the detector element if present
if ( !object->condition.empty() ) {
- Conditions::Container::Object* conditions = Conditions::DetConditions(det).conditions().ptr();
- conditions->addKey(object->condition);
- conditions->addKey("Alignment", object->condition);
+ printout(DEBUG,"DDDB","+ Match Align %s -> %s",object->condition.c_str(), object->path.c_str());
+ geo->detCond[object->condition] = make_pair(det,"alignment_delta");
}
if ( !object->conditioninfo.empty() ) {
- Conditions::Container::Object* conditions = Conditions::DetConditions(det).conditions().ptr();
- for(Catalog::StringMap::const_iterator i=object->conditioninfo.begin(); i!=object->conditioninfo.end(); ++i) {
- const string& cond_name = (*i).second;
- conditions->addKey(cond_name);
- conditions->addKey((*i).first, cond_name);
+ for( const auto& i : object->conditioninfo ) {
+ printout(DEBUG,"DDDB","+ Match Cond %s -> %s",i.second.c_str(), object->path.c_str());
+ geo->detCond[i.second] = make_pair(det,i.first);
}
}
-#endif
if ( context->print_detelem ) {
printout(INFO,"CNV<Catalog>","++ Converting catalog %p -> %p [cref:%d/%d lref:%d/%d lv:%s [%p] sup:%s np:%s] %s ",
(void*)object, det.ptr(),
@@ -898,19 +899,17 @@ namespace DD4hep {
object->support.empty() ? "--" : object->support.c_str(),
object->npath.empty() ? "--" : object->npath.c_str(),
object->path.c_str());
- int cnt;
- cnt = 0;
- for(Catalog::CatRefs::const_iterator i=object->catalogrefs.begin(); i!=object->catalogrefs.end(); ++i,++cnt) {
- const Catalog::CatRefs::value_type& v = *i;
+ int cnt = 0;
+ for( const auto& v : object->catalogrefs ) {
if ( v.second )
printout(INFO,"CNV<DE>:cref","++ DE:%s ref[%2d]: %p -> %s",
object->path.c_str(), cnt, v.second, v.second->c_name());
else
printout(INFO,"CNV<DE>:cref","++ DE:%s ref[%2d]: ??????", object->path.c_str(), cnt);
+ ++cnt;
}
cnt = 0;
- for(Catalog::LvRefs::const_iterator i=object->logvolrefs.begin(); i!=object->logvolrefs.end(); ++i,++cnt) {
- const Catalog::LvRefs::value_type& v = *i;
+ for( const auto& v : object->logvolrefs ) {
LogVol* lv = v.second;
GeoVolume geoVol = Context::find(context->volumes, lv);
if ( lv )
@@ -919,10 +918,10 @@ namespace DD4hep {
(void*)geoVol.ptr(), geoVol.isValid() ? geoVol->GetName() : "????");
else
printout(INFO,"CNV<DE>:lref","++ DE:%s ref[%2d]: ??????", object->path.c_str(), cnt);
+ ++cnt;
}
cnt = 0;
- for(Catalog::LvRefs::const_iterator i=object->logvols.begin(); i!=object->logvols.end(); ++i,++cnt) {
- const Catalog::LvRefs::value_type& v = *i;
+ for( const auto& v : object->logvols ) {
LogVol* lv = v.second;
if ( lv ) {
GeoVolume geoVol = Context::find(context->volumes, lv);
@@ -932,6 +931,7 @@ namespace DD4hep {
}
else
printout(INFO,"CNV<DE>:lvol","++ DE:%s ref[%2d]: ??????", object->path.c_str(), cnt);
+ ++cnt;
}
if ( vol && !object->npath.empty() ) {
for(int i=0; i<vol->GetNdaughters(); ++i) {
@@ -1041,6 +1041,8 @@ namespace DD4hep {
printout(INFO,"DDDB","++ Converted %8d detector elements.",int(context.detelements.size()));
printout(INFO,"DDDB","++ Converted %8d conditions.",
context.geo ? int(context.geo->conditions.size()) : 0);
+ printout(INFO,"DDDB","++ MATCHED %8d conditions.", context.matched_conditions);
+ printout(INFO,"DDDB","++ UNMATCHED %8d conditions.", context.unmatched_conditions);
helper->setDetectorDescription(0);
return 1;
}
diff --git a/DDDB/src/plugins/DDDBAlignmentTest.cpp b/DDDB/src/plugins/DDDBAlignmentTest.cpp
index 8da6faa3b80da464c21aeeba7efe8ec95af2e1aa..347d20e4d61a172e5d4b89f26fbe8fcfc030aa2e 100644
--- a/DDDB/src/plugins/DDDBAlignmentTest.cpp
+++ b/DDDB/src/plugins/DDDBAlignmentTest.cpp
@@ -24,7 +24,7 @@
#include "DD4hep/Factories.h"
#include "DD4hep/InstanceCount.h"
#include "DD4hep/AlignmentsCalculator.h"
-#include "DD4hep/objects/AlignmentsInterna.h"
+#include "DD4hep/detail/AlignmentsInterna.h"
#include "DDCond/ConditionsSlice.h"
#include "DDDB/DDDBConversion.h"
diff --git a/DDDB/src/plugins/DDDBDerivedCondTest.cpp b/DDDB/src/plugins/DDDBDerivedCondTest.cpp
index d40dba02fdff1f46545cd193fe7b1b9896c1d5cc..999ca7d8083674b442f7e468b4e7944659df0a9f 100644
--- a/DDDB/src/plugins/DDDBDerivedCondTest.cpp
+++ b/DDDB/src/plugins/DDDBDerivedCondTest.cpp
@@ -83,7 +83,7 @@ namespace {
long numNoCatalogs = 0;
PrintLevel level = INFO;
DDDB::ConditionPrinter printer;
- CallContext() : printer(0,"") {}
+ CallContext() : printer(0,"Conditions") {}
};
/// Specialized conditions update callback for alignments
@@ -285,7 +285,7 @@ namespace {
long collectDependencies(DetElement de, int level) {
char fmt[64], text[256];
DDDB::Catalog* cat = 0;
- string pref = m_context.printer.prefix();
+ string pref = m_context.printer.prefix;
const DetElement::Children& c = de.children();
::snprintf(fmt,sizeof(fmt),"%%-%ds-> ",2*level+5);
@@ -297,21 +297,24 @@ namespace {
printout(m_level,m_name,fmt,"",de.path().c_str(),int(c.size()),(void*)de.volumeID());
cat = de.extension<DDDB::Catalog>();
::sprintf(fmt,"%03d %%-%ds %%-20s -> %%s", level+1, 2*level+3);
+ //
+ // We use here the alignment entry from the DDDB catalog:
+ // This ensures, that we are only bound by the name and not by any other means!
+ //
if ( !cat->condition.empty() ) {
RangeConditions rc = findCond(cat->condition);
printout(m_level,m_name,fmt,"","Alignment: ",
rc.empty() ? (cat->condition+" !!!UNRESOLVED!!!").c_str() : cat->condition.c_str());
if ( !rc.empty() ) {
- ConditionKey target1(de,cat->condition+"/derived_1");
- ConditionKey target2(de,cat->condition+"/derived_2");
- ConditionKey target3(de,cat->condition+"/derived_3");
- DependencyBuilder build_1(de, target1.item_key(), new ConditionUpdate1(m_context));
- DependencyBuilder build_2(de, target2.item_key(), new ConditionUpdate2(m_context));
- DependencyBuilder build_3(de, target3.item_key(), new ConditionUpdate3(m_context));
-
for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic) {
Condition cond = *ic;
- ConditionKey key(de, cond->value);
+ ConditionKey key(de, cond->name);
+ ConditionKey target1(de,cond->name+"/derived_1");
+ ConditionKey target2(de,cond->name+"/derived_2");
+ ConditionKey target3(de,cond->name+"/derived_3");
+ DependencyBuilder build_1(de, cond->name+"/derived_1", new ConditionUpdate1(m_context));
+ DependencyBuilder build_2(de, cond->name+"/derived_2", new ConditionUpdate2(m_context));
+ DependencyBuilder build_3(de, cond->name+"/derived_3", new ConditionUpdate3(m_context));
build_1.add(key);
build_2.add(key);
@@ -320,10 +323,12 @@ namespace {
build_3.add(key);
build_3.add(target1);
build_3.add(target2);
+ printout(INFO,m_name,"Building [%ld] condition dependencies for: %s [%s # %s] -> %lld [%016llX]",
+ rc.size(), cat->condition.c_str(), de.path().c_str(), cond.name(), cond->hash, cond->hash);
+ content->insertDependency(build_1.release());
+ content->insertDependency(build_2.release());
+ content->insertDependency(build_3.release());
}
- content->insertDependency(build_1.release());
- content->insertDependency(build_2.release());
- content->insertDependency(build_3.release());
}
++m_context.numAlignments;
}
diff --git a/DDDB/src/plugins/DDDBDetectorDumps.cpp b/DDDB/src/plugins/DDDBDetectorDumps.cpp
index cc1878619154d99a4f9ba5a54269abdbda806a29..68979b2fd0ab84c52dac413cdeb647ae7eb9bb31 100644
--- a/DDDB/src/plugins/DDDBDetectorDumps.cpp
+++ b/DDDB/src/plugins/DDDBDetectorDumps.cpp
@@ -23,15 +23,20 @@
#include "DD4hep/Printout.h"
#include "DD4hep/Factories.h"
#include "DD4hep/ConditionsData.h"
-#include "DD4hep/objects/DetectorInterna.h"
-
+#include "DD4hep/ConditionsProcessor.h"
+#include "DD4hep/detail/DetectorInterna.h"
+#include "DD4hep/AlignmentsProcessor.h"
#include "DDCond/ConditionsOperators.h"
+#include "DDCond/ConditionsManager.h"
#include "DDDB/DDDBConversion.h"
#include "DDDB/DDDBConditionPrinter.h"
+// C/C++ include files
+#include <memory>
+
using namespace std;
using namespace DD4hep;
-using DD4hep::Geometry::LCDD;
+using Geometry::LCDD;
/// Anonymous namespace for plugins
namespace {
@@ -56,28 +61,27 @@ DECLARE_APPLY(DDDB_PluginLevel,dddb_plugin_print_level)
/// Anonymous namespace for plugins
namespace {
+ using namespace Conditions;
+
/// Basic entry point to print out the detector element hierarchy
/**
- * @author M.Frank
- * @version 1.0
- * @date 01/04/2014
+ * \author M.Frank
+ * \version 1.0
+ * \date 01/04/2014
*/
long dump_det_tree(LCDD& lcdd, int flag, int argc, char** argv) {
- using Conditions::RangeConditions;
- using Conditions::AbstractMap;
- using Conditions::Condition;
- using Geometry::DetElement;
-
+ using Alignments::deltaCollector;
+ using Alignments::Delta;
using DDDB::ConditionPrinter;
using DDDB::Catalog;
/// Callback object to print selective information
/**
- * @author M.Frank
- * @version 1.0
- * @date 01/04/2014
+ * \author M.Frank
+ * \version 1.0
+ * \date 01/04/2014
*/
struct DumpActor {
struct Counters final {
@@ -99,26 +103,34 @@ namespace {
};
/// Container with all known conditions
- vector<pair<int,Condition> > m_allConditions;
- ConditionPrinter m_printer;
- ConditionPrinter m_condPrinter;
- ConditionPrinter m_alignPrinter;
- Counters m_counters;
- int m_flag;
- bool m_sensitivesOnly;
- bool m_dumpConditions;
- string m_name;
- LCDD& m_lcdd;
- IOV m_iov;
+ vector<pair<int,Condition> > m_allConditions;
+ shared_ptr<ConditionsSlice> m_slice;
+ ConditionsManager m_manager;
+ ConditionPrinter m_detElementPrinter;
+ ConditionPrinter m_catalogPrinter;
+ ConditionPrinter m_alignPrinter;
+ Counters m_counters;
+ int m_flag;
+ bool m_sensitivesOnly;
+ bool m_dumpConditions;
+ string m_name;
+ LCDD& m_lcdd;
/// Standard constructor
DumpActor(LCDD& l, int flg, bool sens, bool dmp)
- : m_printer(0,"DDDBDetectors"), m_condPrinter(0,"DDDBConditions"), m_alignPrinter(0,"DDDBAlignments"),
- m_flag(flg), m_sensitivesOnly(sens), m_dumpConditions(dmp), m_lcdd(l), m_iov(0)
+ : m_detElementPrinter(0,"DDDBDetectors"), m_catalogPrinter(0,"DDDBConditions"),
+ m_alignPrinter(0,"DDDBAlignments"),
+ m_flag(flg), m_sensitivesOnly(sens), m_dumpConditions(dmp), m_lcdd(l)
{
- m_printer.setPrintLevel(s_PrintLevel);
- m_condPrinter.setPrintLevel(s_PrintLevel);
- m_alignPrinter.setPrintLevel(s_PrintLevel);
+ m_manager = ConditionsManager::from(m_lcdd);
+ m_slice.reset(new ConditionsSlice(m_manager,shared_ptr<ConditionsContent>(new ConditionsContent())));
+ m_detElementPrinter.printLevel = s_PrintLevel;
+ m_detElementPrinter.name = "DetElement-Info";
+ m_catalogPrinter.printLevel = s_PrintLevel;
+ m_catalogPrinter.name = "Cat.condition";
+ m_alignPrinter.printLevel = s_PrintLevel;
+ m_alignPrinter.name = "Cat.alignment";
+ m_alignPrinter.lineLength = 80;
}
/// Standard destructor
@@ -132,6 +144,9 @@ namespace {
printout(INFO,m_name,"++ DDDB: Number of attached conditions: %8ld",m_counters.numConditions);
printout(INFO,m_name,"++ DDDB: Number of attached alignments: %8ld",m_counters.numAlignments);
if ( m_flag > 2 ) {
+ printout(INFO,m_name,"++ DDDB: Total number of parameters: %8ld",
+ m_catalogPrinter.numParam+m_alignPrinter.numParam);
+ printout(INFO,m_name,"++ DDDB: Total number of DetElement parameters: %8ld",m_detElementPrinter.numParam);
printout(INFO,m_name,"++ DDDB: Total number of conditions: %8ld",m_counters.totConditions);
}
}
@@ -140,25 +155,37 @@ namespace {
/// Initialization
DumpActor& init() {
+ RangeConditions rc;
+ const IOVType* iov_typ = m_manager.registerIOVType(0,"epoch").second;
+ IOV iov(iov_typ);
+ if ( 0 == iov_typ ) {
+ except(m_name,"++ Unknown IOV type 'epoch' supplied.");
+ }
m_counters.reset();
m_allConditions.clear();
+ Operators::collectAllConditions(m_lcdd, rc);
+ iov.reset().invert();
+ iov.iovType = 0;
+ for ( Condition cond : rc ) {
+ m_allConditions.push_back(make_pair(0,cond));
+ if ( !iov.iovType ) iov = cond.iov();
+ else iov.iov_intersection(cond.iov());
+ }
+ iov.set(iov.keyData.first);
- if ( m_flag >= 3 ) {
- RangeConditions rc;
- Conditions::Operators::collectAllConditions(m_lcdd, rc);
- m_iov.reset().invert();
- m_iov.iovType = 0;
- for ( Condition cond : rc ) {
- m_allConditions.push_back(make_pair(0,cond));
- if ( !m_iov.iovType ) m_iov = cond.iov();
- else m_iov.iov_intersection(cond.iov());
- }
- m_iov.set(m_iov.keyData.first);
- if ( m_dumpConditions ) {
- printout(INFO,m_name,"**************** DDDB Detector dump: ALL Conditions *****************************");
- for(Condition cond : rc ) m_printer(cond);
- printout(INFO,m_name,"*********************************************************************************");
- }
+ IOV req_iov(iov.iovType, iov.keyData.first);
+
+ Conditions::fill_content(m_manager,*m_slice->content,*iov_typ);
+ ConditionsManager::Result r = m_manager.prepare(req_iov,*m_slice);
+ // Now compute the tranformation matrices
+ printout(INFO,m_name,"Prepare: Total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) of IOV %s",
+ r.total(), r.selected, r.loaded, r.computed, r.missing,
+ req_iov.str().c_str());
+
+ if ( m_dumpConditions ) {
+ printout(INFO,m_name,"**************** DDDB Detector dump: ALL Conditions *****************************");
+ for(Condition cond : rc ) m_detElementPrinter(cond);
+ printout(INFO,m_name,"*********************************************************************************");
}
return *this;
}
@@ -191,50 +218,43 @@ namespace {
void printDetElement(int level, DetElement de,
bool with_placement = false,
bool with_keys = false,
- bool with_values =false)
+ bool with_values = false)
{
char fmt[128];
const DetElement::Children& c = de.children();
++m_counters.numDetElements;
::sprintf(fmt,"%03d %%-%ds Detector: %%s #Dau:%%d VolID:%%p Place:%%p",level+1,2*level+1);
- printout(s_PrintLevel, m_name, fmt, "", de.path().c_str(), int(c.size()),
+ printout(s_PrintLevel, m_detElementPrinter.name, fmt, "", de.path().c_str(), int(c.size()),
(void*)de.volumeID(), (void*)de.placement().ptr());
if ( de.placement().isValid() ) {
++m_counters.numDetPlacements;
}
- throw runtime_error("Fix-me:"+de.path());
-#if 0
- if ( de.hasConditions() ) {
- Conditions::DetConditions dc(de);
- m_counters.numDetConditionKeys += dc.conditions().numKeys();
- }
- if ( de.hasAlignments() ) {
- Alignments::DetAlign da(de);
- m_counters.numDetAlignmentKeys += da.alignments().numKeys();
- }
+ std::vector<Condition> conditions;
+ conditionsCollector(*m_slice,conditions)(de);
+ m_counters.numDetConditionKeys += conditions.size();
+
+ std::vector<Delta> deltas;
+ deltaCollector(*m_slice,deltas)(de);
+ m_counters.numDetAlignmentKeys += deltas.size();
if ( with_placement ) {
::sprintf(fmt,"%03d %%-%ds Placement: %%s",level+1,2*level+3);
- printout(s_PrintLevel,m_name,fmt,"",de.placementPath().c_str());
+ printout(s_PrintLevel,m_detElementPrinter.name,fmt,"",de.placementPath().c_str());
}
- if ( (with_keys || with_values) && de.hasConditions() ) {
- Conditions::DetConditions dc(de);
- Conditions::Container cont = dc.conditions();
- ::sprintf(fmt,"%03d %%-%ds Key: %%16llX -> %%16llX -> %%s",level+1,2*level+3);
- for(const auto& i : cont->keys ) {
+ if ( (with_keys || with_values) && !conditions.empty() ) {
+ ::sprintf(fmt,"%03d %%-%ds Key: %%16llX -> %%s # %%s",level+1,2*level+3);
+ for(const auto cond : conditions ) {
if ( with_keys ) {
- printout(s_PrintLevel,m_name,fmt,"",i.first,i.second.first, i.second.second.c_str());
+ printout(s_PrintLevel,m_detElementPrinter.name,fmt,"",cond->hash, de.path().c_str(), cond->name.c_str());
}
if ( with_values ) {
- Condition::key_type key = i.second.first;
- Condition cond = dc.get(key, m_iov);
- m_printer(cond);
+ m_detElementPrinter(cond);
}
}
}
-#endif
}
/// __________________________________________________________________________________
- void printConditionInfo(int level, Catalog* cat, bool with_elements=false) {
+ void printCatalog_ConditionInfo(int level, DetElement de, bool with_elements=false) {
+ Catalog* cat = de.extension<Catalog>();
if ( cat && !cat->conditioninfo.empty() ) {
char fmt[128];
++m_counters.numConditions;
@@ -243,30 +263,29 @@ namespace {
const string& cond_name = i.second;
if ( with_elements ) {
RangeConditions rc = findCond(cond_name);
- printout(s_PrintLevel,m_name,fmt,"",i.first.c_str(),
+ printout(s_PrintLevel,m_catalogPrinter.name,fmt,"",i.first.c_str(),
rc.empty() ? (cond_name+" !!!UNRESOLVED!!!").c_str() : cond_name.c_str());
- for(Condition cond : rc ) m_condPrinter(cond);
+ for(Condition cond : rc ) m_catalogPrinter(cond);
continue;
}
- printout(s_PrintLevel,m_name,fmt,"",i.first.c_str(),cond_name.c_str());
+ printout(s_PrintLevel,m_catalogPrinter.name,fmt,"",i.first.c_str(),cond_name.c_str());
}
}
}
/// __________________________________________________________________________________
- void printAlignment(int level, Catalog* cat, bool with_values=false) {
+ void printCatalog_Alignment(int level, Catalog* cat, bool with_values=false) {
if ( cat && !cat->condition.empty() ) {
char fmt[128];
::sprintf(fmt,"%03d %%-%ds %%-20s -> %%s",level+1,2*level+3);
++m_counters.numAlignments;
if ( with_values ) {
RangeConditions rc = findCond(cat->condition);
- printout(s_PrintLevel,m_name,fmt,"","Alignment:",
+ printout(s_PrintLevel,m_alignPrinter.name,fmt,"","Alignment:",
rc.empty() ? (cat->condition+" !!!UNRESOLVED!!!").c_str() : cat->condition.c_str());
- for(const auto& i : rc)
- m_printer(i);
+ for(const auto& cond : rc) m_alignPrinter(cond);
return;
}
- printout(s_PrintLevel,m_name,fmt,"","Alignment:",cat->condition.c_str());
+ printout(s_PrintLevel,m_alignPrinter.name,fmt,"","Alignment:",cat->condition.c_str());
}
}
/// __________________________________________________________________________________
@@ -276,7 +295,7 @@ namespace {
const DetElement::Children& c = de.children();
::snprintf(fmt,sizeof(fmt),"%%-%ds-> ",2*level+5);
::snprintf(text,sizeof(text),fmt,"");
- m_printer.setPrefix(text);
+ m_detElementPrinter.setPrefix(text);
try {
if ( !m_sensitivesOnly || 0 != de.volumeID() ) {
switch(m_flag) {
@@ -286,41 +305,47 @@ namespace {
case 1:
printDetElement(level, de, false, false);
cat = de.extension<Catalog>();
- printAlignment(level, cat, false);
- printConditionInfo(level, cat, false);
+ printCatalog_Alignment(level, cat, false);
+ printCatalog_ConditionInfo(level, de, false);
break;
case 2:
printDetElement(level, de, true, true);
cat = de.extension<Catalog>();
- printAlignment(level, cat, false);
- printConditionInfo(level, cat, false);
+ printCatalog_Alignment(level, cat, false);
+ printCatalog_ConditionInfo(level, de, false);
break;
case 3:
printDetElement(level, de, false, false);
cat = de.extension<Catalog>();
- printAlignment(level, cat, true);
+ printCatalog_Alignment(level, cat, true);
break;
case 4:
printDetElement(level, de, true, true);
cat = de.extension<Catalog>();
- printAlignment(level, cat, true);
- printConditionInfo(level, cat, true);
+ printCatalog_Alignment(level, cat, true);
+ printCatalog_ConditionInfo(level, de, true);
break;
case 5:
printDetElement(level, de, true, true, true);
break;
+ case 6:
+ printDetElement(level, de, true, true, true);
+ cat = de.extension<Catalog>();
+ printCatalog_Alignment(level, cat, true);
+ printCatalog_ConditionInfo(level, de, true);
+ break;
default:
break;
}
}
}
catch(const exception& e) {
- ::sprintf(fmt,"%03d %%-%ds Exception from: %%s %%-20s %%s",level+1,2*level+3);
+ ::sprintf(fmt,"%03d %%-%ds WARNING from: %%s %%-20s %%s",level+1,2*level+3);
printout(INFO, m_name, fmt, "", de.path().c_str(), "[NO CATALOG availible]",e.what());
++m_counters.numNoCatalogs;
}
catch(...) {
- ::sprintf(fmt,"%03d %%-%ds Exception from: %%s %%-20s",level+1,2*level+3);
+ ::sprintf(fmt,"%03d %%-%ds WARNING from: %%s %%-20s",level+1,2*level+3);
printout(INFO, m_name, fmt, "", de.path().c_str(), "[NO CATALOG availible]");
++m_counters.numNoCatalogs;
}
@@ -358,6 +383,8 @@ namespace {
actor.m_name = "DDDBDetectorDump";
else if ( flag == 5 )
actor.m_name = "DetElementConditionDump";
+ else if ( flag == 5 )
+ actor.m_name = "DDDBDetectorDumpAll";
printout(INFO,actor.m_name,"**************** DDDB Detector dump *****************************");
return actor.init().dump(lcdd.world(), 0);
}
@@ -372,4 +399,5 @@ DECLARE_APPLY(DDDB_DetectorConditionKeysDump,dump_detelement_tree<2>)
DECLARE_APPLY(DDDB_DetectorAlignmentDump,dump_detelement_tree<3>)
DECLARE_APPLY(DDDB_DetectorConditionDump,dump_detelement_tree<4>)
DECLARE_APPLY(DDDB_DetElementConditionDump,dump_detelement_tree<5>)
+DECLARE_APPLY(DDDB_DetectorDumpAll,dump_detelement_tree<6>)
//==========================================================================
diff --git a/DDDB/src/plugins/DDDBLogVolumeDump.cpp b/DDDB/src/plugins/DDDBLogVolumeDump.cpp
index 2ab12cc96eadb27e5fc90bec20cbf57b4076184a..de7c7c0ef3ebe7cbe00df90d51fce8cc4fab7c36 100644
--- a/DDDB/src/plugins/DDDBLogVolumeDump.cpp
+++ b/DDDB/src/plugins/DDDBLogVolumeDump.cpp
@@ -22,7 +22,7 @@
#include "DD4hep/Plugins.h"
#include "DD4hep/Printout.h"
#include "DD4hep/Factories.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
using namespace std;
using namespace DD4hep;
diff --git a/DDDB/src/plugins/DDDBPlugins.cpp b/DDDB/src/plugins/DDDBPlugins.cpp
index 7ed2c98caa3de2baa8aa297df3c0bbd1c08856a5..502966430ba7b3463615a8a511453ce99925c6e0 100644
--- a/DDDB/src/plugins/DDDBPlugins.cpp
+++ b/DDDB/src/plugins/DDDBPlugins.cpp
@@ -21,6 +21,7 @@
#include "DD4hep/LCDD.h"
#include "DD4hep/Printout.h"
#include "DD4hep/Factories.h"
+#include "DD4hep/ConditionsProcessor.h"
#include "DDDB/DDDBConditionPrinter.h"
#include "DDDB/DDDBConditionsLoader.h"
#include "DD4hep/PluginTester.h"
@@ -54,6 +55,8 @@ DECLARE_APPLY(DDDB_ConditionsSummary,dddb_dump_conditions_summary)
//==========================================================================
/// Plugin function
static void* create_dddb_conditions_printer(Geometry::LCDD& lcdd, int argc, char** argv) {
+ using namespace Conditions;
+ typedef ConditionsProcessorWrapper<DDDB::ConditionPrinter> Wrapper;
int flags = 0, have_pool = 0;
string prefix = "";
PrintLevel prtLevel = INFO;
@@ -67,27 +70,26 @@ static void* create_dddb_conditions_printer(Geometry::LCDD& lcdd, int argc, char
else if ( 0 == ::strncmp("-printlevel",argv[i],6) )
prtLevel = DD4hep::printLevel(argv[++i]);
}
- Conditions::ConditionsSlice* slice = 0;
- if ( have_pool != 0 ) {
+ ConditionsSlice* slice = 0;
+ if ( have_pool ) {
PluginTester* test = lcdd.extension<PluginTester>();
- slice = test->extension<Conditions::ConditionsSlice>("ConditionsTestSlice");
+ slice = test->extension<ConditionsSlice>("ConditionsTestSlice");
}
- DDDB::ConditionPrinter* printer = flags
- ? new DDDB::ConditionPrinter(slice,prefix,flags)
- : new DDDB::ConditionPrinter(slice,prefix);
- printer->setPrintLevel(prtLevel);
- Geometry::DetElement::Processor* proc = printer;
- return proc;
+ DDDB::ConditionPrinter* p(flags
+ ? new DDDB::ConditionPrinter(slice,prefix,flags)
+ : new DDDB::ConditionPrinter(slice,prefix));
+ p->printLevel = prtLevel;
+ Wrapper* wrap = createProcessorWrapper(p);
+ return (void*)dynamic_cast<Condition::Processor*>(wrap);
}
DECLARE_LCDD_CONSTRUCTOR(DDDB_ConditionsPrinter,create_dddb_conditions_printer)
//==========================================================================
/// Plugin function
static void* create_dddb_loader(Geometry::LCDD& lcdd, int argc, char** argv) {
- using Conditions::ConditionsManager;
using Conditions::ConditionsManagerObject;
const char* name = argc>0 ? argv[0] : "DDDBLoader";
- Conditions::ConditionsManagerObject* m = (Conditions::ConditionsManagerObject*)(argc>0 ? argv[1] : 0);
- return new DDDB::DDDBConditionsLoader(lcdd,ConditionsManager(m),name);
+ ConditionsManagerObject* m = (ConditionsManagerObject*)(argc>0 ? argv[1] : 0);
+ return new DDDB::DDDBConditionsLoader(lcdd,m,name);
}
DECLARE_LCDD_CONSTRUCTOR(DD4hep_Conditions_dddb_Loader,create_dddb_loader)
diff --git a/DDEve/src/DDEvePlugins.cpp b/DDEve/src/DDEvePlugins.cpp
index f35bf2cd3082b5c339f224ac766c8962551e6224..bbbb155e3891c748124e25d187e169352fe6f027 100644
--- a/DDEve/src/DDEvePlugins.cpp
+++ b/DDEve/src/DDEvePlugins.cpp
@@ -14,7 +14,7 @@
// Framework include files
-#include "DD4hep/Plugins.inl"
+#include "DD4hep/detail/Plugins.inl"
#include "DDEve/Factories.h"
DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::View*, (DD4hep::Display*, const char*))
diff --git a/DDG4/include/DDG4/Geant4SensDetAction.inl b/DDG4/include/DDG4/Geant4SensDetAction.inl
index 57c9d516c076c92e85882431624a69862e4eb1d8..66b38fe950df03b8fffba932021bb0540d68fcb2 100644
--- a/DDG4/include/DDG4/Geant4SensDetAction.inl
+++ b/DDG4/include/DDG4/Geant4SensDetAction.inl
@@ -15,7 +15,7 @@
#ifndef DD4HEP_DDG4_GEANT4SENSDETACTION_H
#include "DDG4/Geant4SensDetAction.h"
#endif
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
#include "DD4hep/InstanceCount.h"
#include "DDG4/Geant4ReadoutVolumeFilter.h"
diff --git a/DDG4/python/DDG4Dict.C b/DDG4/python/DDG4Dict.C
index ebc076d3b22546075a4b562761e714db430b2614..4a0eed727d4f0535c189f6047e7aef50ef9d7125 100644
--- a/DDG4/python/DDG4Dict.C
+++ b/DDG4/python/DDG4Dict.C
@@ -214,7 +214,7 @@ namespace DD4hep {
typedef DD4hep::Simulation::Geant4ActionCreation Geant4ActionCreation;
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
using namespace std;
using namespace DD4hep;
diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp
index 6901cb250288a44e3fc74ad321a87fa966f71844..050a1a48dbda13b4e00d212134433d29b5b53e23 100644
--- a/DDG4/src/Geant4Converter.cpp
+++ b/DDG4/src/Geant4Converter.cpp
@@ -17,8 +17,8 @@
#include "DD4hep/Volumes.h"
#include "DD4hep/Printout.h"
#include "DD4hep/DD4hepUnits.h"
-#include "DD4hep/objects/ObjectsInterna.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
#include "DDG4/Geant4Field.h"
#include "DDG4/Geant4Converter.h"
diff --git a/DDG4/src/Geant4Plugins.cpp b/DDG4/src/Geant4Plugins.cpp
index 26828acbebae11e0dea5df7cc88abb34415b6b80..947acf3700eff3cb302ead615252a0aa1937189e 100644
--- a/DDG4/src/Geant4Plugins.cpp
+++ b/DDG4/src/Geant4Plugins.cpp
@@ -12,7 +12,7 @@
//==========================================================================
// Framework include files
-#include "DD4hep/Plugins.inl"
+#include "DD4hep/detail/Plugins.inl"
#include "DDG4/Factories.h"
#include "DDG4/Geant4SensDetAction.h"
#include "DDG4/Geant4PhysicsList.h"
diff --git a/DDG4/src/Geant4ReadoutVolumeFilter.cpp b/DDG4/src/Geant4ReadoutVolumeFilter.cpp
index f6aff8b1bc2ce42878155ae89ae41594bbe58ee4..f5a4943585eaab61e3aefde9cf6a415c132e97a6 100644
--- a/DDG4/src/Geant4ReadoutVolumeFilter.cpp
+++ b/DDG4/src/Geant4ReadoutVolumeFilter.cpp
@@ -15,7 +15,7 @@
// Framework include files
#include "DD4hep/Readout.h"
#include "DD4hep/InstanceCount.h"
-#include "DD4hep/objects/ObjectsInterna.h"
+#include "DD4hep/detail/ObjectsInterna.h"
#include "DDG4/Geant4Mapping.h"
#include "DDG4/Geant4StepHandler.h"
#include "DDG4/Geant4VolumeManager.h"
diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp
index 98bad389f93c178252ead15d8fc3deab6b49cf62..43d9e8b9effd13e79d59f931198b1ee85e581069 100644
--- a/DDRec/src/Surface.cpp
+++ b/DDRec/src/Surface.cpp
@@ -1,5 +1,5 @@
#include "DDRec/Surface.h"
-#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/detail/DetectorInterna.h"
#include "DD4hep/Memory.h"
#include "DDRec/MaterialManager.h"
diff --git a/examples/AlignDet/CMakeLists.txt b/examples/AlignDet/CMakeLists.txt
index 58c588ef703fa09b7ded6eaf0417e2fff80bbb5e..72a1a3df09330ae7bc986e7275464e78294057e1 100644
--- a/examples/AlignDet/CMakeLists.txt
+++ b/examples/AlignDet/CMakeLists.txt
@@ -40,7 +40,7 @@ dd4hep_add_test_reg( AlignDet_Telescope_populate
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_AlignDet.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_AlignmentExample_populate
-input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml -iovs 10
- REGEX_PASS "Summary INFO Processed a total 171 conditions \\(S:171,L:0,C:0,M:0\\) and \\(C:171,M:0\\) alignments"
+ REGEX_PASS "Summary INFO Processed a total 190 conditions \\(S:190,L:0,C:0,M:0\\) and \\(C:190,M:0\\) alignments. Created:200"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -50,7 +50,7 @@ dd4hep_add_test_reg( AlignDet_Telescope_read_xml
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_AlignmentExample_read_xml
-input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml
-deltas file:${DD4hep_DIR}/examples/Conditions/data/repository.xml
- REGEX_PASS "Setup 20/20 conditions \\(S:20,L:0,C:0,M:0\\) \\(A:19,M:0\\) for IOV:run\\(1\\)"
+ REGEX_PASS "20 conditions in slice. \\(T:20,S:20,L:0,C:0,M:0\\) Alignments accessed: 20 \\(A:19,M:0\\) for IOV:run\\(1\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -82,7 +82,7 @@ dd4hep_add_test_reg( AlignDet_Telescope_readback_xml
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_AlignmentExample_read_xml
-input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml
-deltas file:./new_cond.xml
- REGEX_PASS "Setup 33/33 conditions \\(S:33,L:0,C:0,M:0\\) \\(A:19,M:0\\) for IOV:run\\(1\\)"
+ REGEX_PASS "33 conditions in slice. \\(T:33,S:33,L:0,C:0,M:0\\) Alignments accessed: 20 \\(A:19,M:0\\) for IOV:run\\(1\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
diff --git a/examples/AlignDet/src/AlignmentExampleObjects.cpp b/examples/AlignDet/src/AlignmentExampleObjects.cpp
index 8019058dd153c1c2bb84729a9a3acf948e20be27..6da9458ecaac8965f475a72e287944d5e41cd6d2 100644
--- a/examples/AlignDet/src/AlignmentExampleObjects.cpp
+++ b/examples/AlignDet/src/AlignmentExampleObjects.cpp
@@ -22,29 +22,35 @@ using namespace DD4hep;
using namespace DD4hep::AlignmentExamples;
/// Install the consitions and the alignment manager
-void DD4hep::AlignmentExamples::installManagers(LCDD& lcdd) {
+ConditionsManager DD4hep::AlignmentExamples::installManager(LCDD& lcdd) {
// Now we instantiate the conditions manager
lcdd.apply("DD4hep_ConditionsManagerInstaller",0,(char**)0);
+ ConditionsManager manager = ConditionsManager::from(lcdd);
+ manager["PoolType"] = "DD4hep_ConditionsLinearPool";
+ manager["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
+ manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
+ manager.initialize();
+ return manager;
}
/// Callback to process a single detector element
-int AlignmentDataAccess::processElement(DetElement de) {
- DetElementAlignmentsCollector select(de);
- mapping->scan(select);
+int AlignmentDataAccess::operator()(DetElement de, int) const {
+ vector<Alignment> alignments;
+ alignmentsCollector(mapping,alignments)(de);
// Let's go for the deltas....
- for(const auto& align : select.alignments ) {
+ for(const auto& align : alignments ) {
const Delta& delta = align.data().delta;
if ( delta.hasTranslation() || delta.hasPivot() || delta.hasRotation() ) {}
}
// Keep it simple. To know how to access stuff,
// simply look in DDDCore/src/AlignmentsPrinter.cpp...
- Alignments::printElementPlacement(printLevel,"Example",de,*mapping);
+ Alignments::printElementPlacement(printLevel,"Example",de,mapping);
return 1;
}
/// Callback to process a single detector element
-int AlignmentCreator::operator()(DetElement de, int) {
+int AlignmentCreator::operator()(DetElement de, int) const {
if ( de.ptr() != de.world().ptr() ) {
Condition cond(de.path()+"#alignment_delta", "alignment_delta");
Delta& delta = cond.bind<Delta>();
diff --git a/examples/AlignDet/src/AlignmentExampleObjects.h b/examples/AlignDet/src/AlignmentExampleObjects.h
index 5c4cdf61695c59f0d7a02978f4075a7a47f19a1c..70689150c83a1eb7d828687d65c7d86f39463ee2 100644
--- a/examples/AlignDet/src/AlignmentExampleObjects.h
+++ b/examples/AlignDet/src/AlignmentExampleObjects.h
@@ -21,7 +21,7 @@
#include "DD4hep/DetectorProcessor.h"
#include "DD4hep/ConditionsProcessor.h"
#include "DD4hep/AlignmentsProcessor.h"
-#include "DD4hep/AlignedVolumePrinter.h"
+#include "DD4hep/AlignmentsPrinter.h"
#include "DD4hep/AlignmentsCalculator.h"
#include "DDCond/ConditionsSlice.h"
@@ -35,8 +35,7 @@ namespace DD4hep {
using Geometry::LCDD;
using Geometry::RotationZYX;
using Geometry::DetElement;
- using Geometry::DetectorProcessor;
- using Geometry::DetElementProcessor;
+ using Geometry::detectorProcessor;
using Conditions::Condition;
using Conditions::ConditionKey;
@@ -45,14 +44,16 @@ namespace DD4hep {
using Conditions::ConditionsSlice;
using Conditions::ConditionsContent;
using Conditions::ConditionsManager;
- using Conditions::DetElementConditionsCollector;
+ using Conditions::conditionsCollector;
using Alignments::Delta;
using Alignments::Alignment;
using Alignments::AlignmentData;
using Alignments::AlignmentsCalculator;
- using Alignments::DetElementDeltaCollector;
- using Alignments::DetElementAlignmentsCollector;
+ using Alignments::AlignedVolumePrinter;
+ using Alignments::DeltaCollector;
+ using Alignments::deltaCollector;
+ using Alignments::alignmentsCollector;
/// Example how to populate the detector description with alignment constants
/**
@@ -62,7 +63,8 @@ namespace DD4hep {
* \version 1.0
* \date 01/04/2016
*/
- struct AlignmentCreator : public DetectorProcessor {
+ class AlignmentCreator {
+ public:
/// Reference to the conditions manager
ConditionsManager manager;
/// Reference to the used conditions pool
@@ -70,10 +72,10 @@ namespace DD4hep {
/// Print level
PrintLevel printLevel;
/// Constructor
- AlignmentCreator(ConditionsManager m,ConditionsPool& p)
+ AlignmentCreator(ConditionsManager m, ConditionsPool& p)
: manager(m), pool(p), printLevel(DEBUG) {}
/// Callback to process a single detector element
- virtual int operator()(DetElement de, int level);
+ int operator()(DetElement de, int level) const;
};
/// Example how to access the alignment constants from a detector element
@@ -82,43 +84,22 @@ namespace DD4hep {
* \version 1.0
* \date 01/04/2016
*/
- struct AlignmentDataAccess : public Alignments::AlignmentsProcessor {
+ class AlignmentDataAccess {
+ public:
+ ConditionsMap& mapping;
/// Print level
PrintLevel printLevel;
/// Constructor
- AlignmentDataAccess(ConditionsMap& p) : AlignmentsProcessor(&p), printLevel(DEBUG) {}
+ AlignmentDataAccess(ConditionsMap& m) : mapping(m), printLevel(DEBUG) {}
/// Callback to process a single detector element
- int processElement(DetElement de);
+ int operator()(DetElement de, int level) const;
};
/// Helper to run DetElement scans
- /**
- * \author M.Frank
- * \version 1.0
- * \date 01/04/2016
- */
- struct Scanner : public DetectorProcessor {
- DetElement::Processor* proc;
- /// Callback to process a single detector element
- virtual int operator()(DetElement de, int) {
- return proc->processElement(de);
- }
- template <typename Q> Scanner& scan(Q& p, DetElement start) {
- Scanner obj;
- obj.proc = &p;
- obj.process(start, 0, true);
- return *this;
- }
- template <typename Q> Scanner& scan(const Q& p, DetElement start) {
- Scanner obj;
- Q* q = const_cast<Q*>(&p);
- obj.proc = q;
- obj.process(start, 0, true); return *this;
- }
- };
+ typedef Geometry::DetectorScanner Scanner;
/// Install the consitions and the alignment manager
- void installManagers(LCDD& lcdd);
+ ConditionsManager installManager(LCDD& lcdd);
} /* End namespace AlignmentExamples */
} /* End namespace DD4hep */
#endif /* DD4HEP_ALIGNDET_ALIGNMENTEXAMPLEOBJECTS_H */
diff --git a/examples/AlignDet/src/AlignmentExample_align_telescope.cpp b/examples/AlignDet/src/AlignmentExample_align_telescope.cpp
index 51d655a7fd0c98bf61d4af00dcd8fe290c96dc17..d59da2543f4ee1ac0c775e22a4948a074b2fd79b 100644
--- a/examples/AlignDet/src/AlignmentExample_align_telescope.cpp
+++ b/examples/AlignDet/src/AlignmentExample_align_telescope.cpp
@@ -95,33 +95,30 @@ static int AlignmentExample_align_telescope (Geometry::LCDD& lcdd, int argc, cha
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
-
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- const void* setup_args[] = {setup.c_str(), 0}; // Better zero-terminate
+ ConditionsManager manager = installManager(lcdd);
+ const void* setup_args[] = {setup.c_str(), 0}; // Better zero-terminate
lcdd.apply("DD4hep_ConditionsXMLRepositoryParser",1,(char**)setup_args);
// Now the deltas are stored in the conditions manager in the proper IOV pools
- const IOVType* iov_typ = condMgr.iovType("run");
+ const IOVType* iov_typ = manager.iovType("run");
if ( 0 == iov_typ ) {
except("ConditionsPrepare","++ Unknown IOV type supplied.");
}
IOV req_iov(iov_typ,1500); // IOV goes from run 1000 ... 2000
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- ConditionsManager::Result cres = condMgr.prepare(req_iov,*slice);
- Conditions::fill_content(condMgr,*content,*iov_typ);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ ConditionsManager::Result cres = manager.prepare(req_iov,*slice);
+ Conditions::fill_content(manager,*content,*iov_typ);
// Collect all the delta conditions and make proper alignment conditions out of them
- DetElementDeltaCollector delta_collector(slice.get());
- DetElementProcessor<DetElementDeltaCollector> proc(delta_collector);
+ AlignmentsCalculator::Deltas deltas;
+ auto proc = detectorProcessor(deltaCollector(*slice,deltas));
proc.process(lcdd.world(),0,true);
- printout(INFO,"Prepare","Got a total of %ld deltas for processing alignments.",
- delta_collector.deltas.size());
+ printout(INFO,"Prepare","Got a total of %ld deltas for processing alignments.",deltas.size());
// ++++++++++++++++++++++++ Compute the tranformation matrices
AlignmentsCalculator alignCalc;
- AlignmentsCalculator::Result ares = alignCalc.compute(delta_collector.deltas,*slice);
+ AlignmentsCalculator::Result ares = alignCalc.compute(deltas,*slice);
printout(INFO,"Example",
"Setup %ld/%ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) (A:%ld,M:%ld) for IOV:%-12s",
slice->conditions().size(),
diff --git a/examples/AlignDet/src/AlignmentExample_populate.cpp b/examples/AlignDet/src/AlignmentExample_populate.cpp
index 24a4cc20cdb2f50990a9b46b442b433bc308b05d..204f867ed7af343c8c962537a71c219abc6ef445 100644
--- a/examples/AlignDet/src/AlignmentExample_populate.cpp
+++ b/examples/AlignDet/src/AlignmentExample_populate.cpp
@@ -65,33 +65,27 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
/******************** Initialize the conditions manager *****************/
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- condMgr["PoolType"] = "DD4hep_ConditionsLinearPool";
- condMgr["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
- condMgr["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
- condMgr.initialize();
-
- const IOVType* iov_typ = condMgr.registerIOVType(0,"run").second;
- if ( 0 == iov_typ ) {
+ ConditionsManager manager = installManager(lcdd);
+ const IOVType* iov_typ = manager.registerIOVType(0,"run").second;
+ if ( 0 == iov_typ )
except("ConditionsPrepare","++ Unknown IOV type supplied.");
- }
/******************** Populate the conditions store *********************/
// Have 10 run-slices [1001,2000] .... [9001,10000]
+ size_t total_created = 0;
for(int i=0; i<num_iov; ++i) {
IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10));
- ConditionsPool* iov_pool = condMgr.registerIOV(*iov.iovType, iov.key());
- AlignmentCreator creator(condMgr, *iov_pool); // Use a generic creator
- creator.process(lcdd.world(),0,true); // Create conditions with all deltas
+ ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key());
+ // Create conditions with all deltas. Use a generic creator
+ total_created += Scanner().scan(AlignmentCreator(manager, *iov_pool),lcdd.world());
}
/******************** Now as usual: create the slice ********************/
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- Conditions::fill_content(condMgr,*content,*iov_typ);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ Conditions::fill_content(manager,*content,*iov_typ);
/******************** Register alignments *******************************/
// Note: We have to load one set of conditions in order to auto-populate
@@ -100,28 +94,27 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// Unfortunate, but unavoidable.
//
IOV iov(iov_typ,10+5);
- condMgr.prepare(iov,*slice);
+ manager.prepare(iov,*slice);
slice->pool->flags |= Conditions::UserPool::PRINT_INSERT;
// Collect all the delta conditions and make proper alignment conditions out of them
- DetElementDeltaCollector delta_collector(slice.get());
- DetElementProcessor<DetElementDeltaCollector> proc(delta_collector);
- proc.process(lcdd.world(),0,true);
- printout(INFO,"Prepare","Got a total of %ld Deltas",delta_collector.deltas.size());
+ AlignmentsCalculator::Deltas deltas;
+ Scanner(deltaCollector(*slice,deltas),lcdd.world());
+ printout(INFO,"Prepare","Got a total of %ld Deltas",deltas.size());
// ++++++++++++++++++++++++ Now compute the alignments for each of these IOVs
ConditionsManager::Result cond_total;
AlignmentsCalculator::Result align_total;
- for(int i=1; i<num_iov; ++i) {
+ for(int i=0; i<num_iov; ++i) {
IOV req_iov(iov_typ,i*10+5);
- shared_ptr<ConditionsSlice> sl(new ConditionsSlice(condMgr,content));
+ shared_ptr<ConditionsSlice> sl(new ConditionsSlice(manager,content));
// Attach the proper set of conditions to the user pool
- ConditionsManager::Result cres = condMgr.prepare(req_iov,*sl);
+ ConditionsManager::Result cres = manager.prepare(req_iov,*sl);
sl->pool->flags |= Conditions::UserPool::PRINT_INSERT;
cond_total += cres;
// Now compute the tranformation matrices
AlignmentsCalculator calculator;
- AlignmentsCalculator::Result ares = calculator.compute(delta_collector.deltas,*sl);
+ AlignmentsCalculator::Result ares = calculator.compute(deltas,*sl);
printout(INFO,"Prepare","Total %ld/%ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) of type %s. Alignments:(C:%ld,M:%ld)",
slice->conditions().size(), cres.total(), cres.selected, cres.loaded,
cres.computed, cres.missing, iov_typ->str().c_str(), ares.computed, ares.missing);
@@ -132,11 +125,10 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
}
}
// What else ? let's access/print the current selection
- Alignments::AlignedVolumePrinter printer(slice.get(),"Example");
- Scanner().scan(printer,lcdd.world());
- printout(INFO,"Summary","Processed a total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) and (C:%ld,M:%ld) alignments",
- cond_total.total(), cond_total.selected, cond_total.loaded,
- cond_total.computed, cond_total.missing, align_total.computed, align_total.missing);
+ Scanner(AlignedVolumePrinter(slice.get(),"Example"),lcdd.world());
+ printout(INFO,"Summary","Processed a total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) and (C:%ld,M:%ld) alignments. Created:%ld.",
+ cond_total.total(), cond_total.selected, cond_total.loaded, cond_total.computed, cond_total.missing,
+ align_total.computed, align_total.missing, total_created);
// All done.
return 1;
diff --git a/examples/AlignDet/src/AlignmentExample_read_xml.cpp b/examples/AlignDet/src/AlignmentExample_read_xml.cpp
index 58a048b426c9cde04a8fcb1ab45dae748bb4f779..1869ef027a089a285a84e7522da10fa614ec411f 100644
--- a/examples/AlignDet/src/AlignmentExample_read_xml.cpp
+++ b/examples/AlignDet/src/AlignmentExample_read_xml.cpp
@@ -62,49 +62,46 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- const void* delta_args[] = {delta.c_str(), 0}; // Better zero-terminate
+ ConditionsManager manager = installManager(lcdd);
+ const void* delta_args[] = {delta.c_str(), 0}; // Better zero-terminate
lcdd.apply("DD4hep_ConditionsXMLRepositoryParser",1,(char**)delta_args);
// Now the deltas are stored in the conditions manager in the proper IOV pools
- const IOVType* iov_typ = condMgr.iovType("run");
- if ( 0 == iov_typ ) {
+ const IOVType* iov_typ = manager.iovType("run");
+ if ( 0 == iov_typ )
except("ConditionsPrepare","++ Unknown IOV type supplied.");
- }
+
IOV req_iov(iov_typ,1500); // IOV goes from run 1000 ... 2000
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- Conditions::fill_content(condMgr,*content,*iov_typ);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ Conditions::fill_content(manager,*content,*iov_typ);
- ConditionsManager::Result cres = condMgr.prepare(req_iov,*slice);
-
+ ConditionsManager::Result cres = manager.prepare(req_iov,*slice);
// ++++++++++++++++++++++++ Compute the tranformation matrices
AlignmentsCalculator calc;
Conditions::ConditionsHashMap alignments;
- DetElementDeltaCollector delta_collector(slice.get());
- DetElementProcessor<DetElementDeltaCollector> proc(delta_collector);
- proc.process(lcdd.world(),0,true);
- printout(INFO,"Prepare","Got a total of %ld Deltas",delta_collector.deltas.size());
+ AlignmentsCalculator::Deltas deltas;
+ Scanner(deltaCollector(*slice, deltas),lcdd.world());
+ printout(INFO,"Prepare","Got a total of %ld Deltas",deltas.size());
slice->pool->flags |= Conditions::UserPool::PRINT_INSERT;
- AlignmentsCalculator::Result ares = calc.compute(delta_collector.deltas, alignments);
- ConditionsSlice::Inserter(*slice).process(alignments.data);
+ AlignmentsCalculator::Result ares = calc.compute(deltas, alignments);
+ ConditionsSlice::Inserter(*slice,alignments.data);
// What else ? let's access the data
- Scanner().scan(AlignmentDataAccess(*slice),lcdd.world());
+ size_t total_accessed = Scanner().scan(AlignmentDataAccess(*slice),lcdd.world());
// What else ? let's print the current selection
- Alignments::AlignedVolumePrinter printer(slice.get(),"Example");
- Scanner().scan(printer,lcdd.world());
+ Scanner(AlignedVolumePrinter(slice.get(),"Example"),lcdd.world());
printout(INFO,"Example",
- "Setup %ld/%ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) (A:%ld,M:%ld) for IOV:%-12s",
+ "%ld conditions in slice. (T:%ld,S:%ld,L:%ld,C:%ld,M:%ld) "
+ "Alignments accessed: %ld (A:%ld,M:%ld) for IOV:%-12s",
slice->conditions().size(),
cres.total(), cres.selected, cres.loaded, cres.computed, cres.missing,
- ares.computed, ares.missing, iov_typ->str().c_str());
+ total_accessed, ares.computed, ares.missing, iov_typ->str().c_str());
// ++++++++++++++++++++++++ All done.
return 1;
diff --git a/examples/AlignDet/src/AlignmentExample_recompute.cpp b/examples/AlignDet/src/AlignmentExample_recompute.cpp
deleted file mode 100644
index 987deb4feb1956b79adf6a6df0cd9e4178aef1b8..0000000000000000000000000000000000000000
--- a/examples/AlignDet/src/AlignmentExample_recompute.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-//==========================================================================
-// AIDA Detector description implementation for LCD
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see $DD4hepINSTALL/LICENSE.
-// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
-//
-// Author : M.Frank
-//
-//==========================================================================
-/*
- Plugin invocation:
- ==================
- This plugin behaves like a main program.
- Invoke the plugin with something like this:
-
- geoPluginRun -volmgr -destroy -plugin DD4hep_AlignmentExample_recompute \
- -input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml \
- -delta file:${DD4hep_DIR}/examples/Conditions/data/repository.xml
-
-*/
-// Framework include files
-#include "AlignmentExampleObjects.h"
-#include "DD4hep/Factories.h"
-
-using namespace std;
-using namespace DD4hep;
-using namespace DD4hep::AlignmentExamples;
-#if 0
-/// Plugin function: Alignment program example
-/**
- * Factory: DD4hep_AlignmentExample_recompute
- *
- * \author M.Frank
- * \version 1.0
- * \date 01/12/2016
- */
-static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
-
- string input, delta;
- bool arg_error = false;
- for(int i=0; i<argc && argv[i]; ++i) {
- if ( 0 == ::strncmp("-input",argv[i],4) )
- input = argv[++i];
- else if ( 0 == ::strncmp("-deltas",argv[i],5) )
- delta = argv[++i];
- else
- arg_error = true;
- }
- if ( arg_error || input.empty() || delta.empty() ) {
- /// Help printout describing the basic command line interface
- cout <<
- "Usage: -plugin <name> -arg [-arg] \n"
- " name: factory name DD4hep_AlignmentExample_recompute \n"
- " -input <string> Geometry file \n"
- " -deltas <string> Alignment deltas (Conditions \n"
- "\tArguments given: " << arguments(argc,argv) << endl << flush;
- ::exit(EINVAL);
- }
-
- // First we load the geometry
- lcdd.fromXML(input);
- installManagers(lcdd);
-
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- const void* delta_args[] = {delta.c_str(), 0}; // Better zero-terminate
-
- lcdd.apply("DD4hep_ConditionsXMLRepositoryParser",1,(char**)delta_args);
- // Now the deltas are stored in the conditions manager in the proper IOV pools
- const IOVType* iov_typ = condMgr.iovType("run");
- if ( 0 == iov_typ ) {
- except("ConditionsPrepare","++ Unknown IOV type supplied.");
- }
- IOV req_iov(iov_typ,1500); // IOV goes from run 1000 ... 2000
- shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- Conditions::fill_content(condMgr,*content,*iov_typ);
- ConditionsManager::Result cres_align = condMgr.prepare(req_iov,*slice_align);
-
-
- // ++++++++++++++++++++++++ Compute the tranformation matrices
- AlignmentsCalculator calc;
- AlignmentsCalculator::Deltas deltas;
- Conditions::ConditionsHashMap alignments;
- AlignmentsCalculator::Result ares = calc.compute(deltas, alignments);
- ConditionsSlice::Inserter(*slice).process(alignments.data);
-
- // What else ? let's access the data
- Scanner().scan(AlignmentDataAccess(*slice_align),lcdd.world());
-
- // What else ? let's print the current selection
- Alignments::AlignedVolumePrinter print_align(*slice_align,"Example");
- Scanner().scan(print_align,lcdd.world());
-
- // What else ? let's access the data
- //Scanner().scan(AlignmentReset(*slice_align->pool,INFO),lcdd.world());
- // Print again the changed values
-
- // ++++++++++++++++++++++++ Compute the tranformation matrices
- shared_ptr<ConditionsSlice> slice_reset(new ConditionsSlice(condMgr,content));
-
- ConditionsManager::Result cres_reset = condMgr.prepare(req_iov,*slice_reset);
-
-
- AlignmentsManager::Result ares_reset = alignMgr.compute(*slice_reset);
- Alignments::AlignedVolumePrinter print_reset(slice_reset->pool.get(),"Example");
- Scanner().scan(print_reset,lcdd.world());
-
- printout(INFO,"Example",
- "Setup %ld/%ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) (A:%ld,M:%ld) for IOV:%-12s",
- slice_align->conditions().size(),
- cres_align.total(), cres_align.selected, cres_align.loaded, cres_align.computed, cres_align.missing,
- ares_align.computed, ares_align.missing, iov_typ->str().c_str());
- printout(INFO,"Example",
- "Setup %ld/%ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) (A:%ld,M:%ld) for IOV:%-12s",
- slice_reset->conditions().size(),
- cres_reset.total(), cres_reset.selected, cres_reset.loaded, cres_reset.computed, cres_reset.missing,
- ares_reset.computed, ares_reset.missing, iov_typ->str().c_str());
-
- // ++++++++++++++++++++++++ All done.
- return 1;
-}
-
-// first argument is the type from the xml file
-DECLARE_APPLY(DD4hep_AlignmentExample_recompute,alignment_example)
-#endif
diff --git a/examples/AlignDet/src/AlignmentExample_stress.cpp b/examples/AlignDet/src/AlignmentExample_stress.cpp
index 732157be4fa1c4afb69f3fc53d16d3466a9b2b48..018064d7f0663a7b42f72a38f3a36e753a436399 100644
--- a/examples/AlignDet/src/AlignmentExample_stress.cpp
+++ b/examples/AlignDet/src/AlignmentExample_stress.cpp
@@ -71,37 +71,31 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
/******************** Initialize the conditions manager *****************/
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- condMgr["PoolType"] = "DD4hep_ConditionsLinearPool";
- condMgr["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
- condMgr["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
- condMgr.initialize();
-
- const IOVType* iov_typ = condMgr.registerIOVType(0,"run").second;
- if ( 0 == iov_typ ) {
+ ConditionsManager manager = installManager(lcdd);
+ const IOVType* iov_typ = manager.registerIOVType(0,"run").second;
+ if ( 0 == iov_typ )
except("ConditionsPrepare","++ Unknown IOV type supplied.");
- }
- TStatistic cr_stat("Creation"), comp_stat("Computation"), access_stat("Access");
+ TStatistic cr_stat("Creation"), comp_stat("Computation"), access_stat("Access");
+ size_t total_created = 0;
/******************** Populate the conditions store *********************/
// Have num_iov possible run-slices [11,20] .... [n*10+1,(n+1)*10]
for(int i=0; i<num_iov; ++i) {
TTimeStamp start;
IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10));
- ConditionsPool* iov_pool = condMgr.registerIOV(*iov.iovType, iov.key());
- AlignmentCreator creator(condMgr, *iov_pool); // Use a generic creator
- creator.process(lcdd.world(),0,true); // Create conditions with all deltas
+ ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key());
+ // Create conditions with all deltas. Use a generic creator
+ total_created += Scanner().scan(AlignmentCreator(manager, *iov_pool),lcdd.world());
TTimeStamp stop;
cr_stat.Fill(stop.AsDouble()-start.AsDouble());
}
/******************** Now as usual: create the slice ********************/
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- Conditions::fill_content(condMgr,*content,*iov_typ);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ Conditions::fill_content(manager,*content,*iov_typ);
/******************** Register alignments *******************************/
// Note: We have to load one set of conditions in order to auto-populate
@@ -110,15 +104,13 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// Unfortunate, but unavoidable.
//
IOV iov(iov_typ,15);
- condMgr.prepare(iov,*slice);
+ manager.prepare(iov,*slice);
slice->pool->flags |= Conditions::UserPool::PRINT_INSERT;
// Collect all the delta conditions and make proper alignment conditions out of them
- DetElementDeltaCollector delta_collector(slice.get());
- DetElementProcessor<DetElementDeltaCollector> proc(delta_collector);
- proc.process(lcdd.world(),0,true);
- printout(INFO,"Prepare","Got a total of %ld deltas for processing alignments.",
- delta_collector.deltas.size());
+ AlignmentsCalculator::Deltas deltas;
+ Scanner(deltaCollector(*slice,deltas),lcdd.world());
+ printout(INFO,"Prepare","Got a total of %ld deltas for processing alignments.",deltas.size());
ConditionsManager::Result total_cres;
AlignmentsCalculator::Result total_ares;
@@ -126,11 +118,11 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
for(int i=0; i<num_iov; ++i) {
TTimeStamp start;
IOV req_iov(iov_typ,1+i*10);
- shared_ptr<ConditionsSlice> sl(new ConditionsSlice(condMgr,content));
- ConditionsManager::Result cres = condMgr.prepare(req_iov,*sl);
+ shared_ptr<ConditionsSlice> sl(new ConditionsSlice(manager,content));
+ ConditionsManager::Result cres = manager.prepare(req_iov,*sl);
// Now compute the tranformation matrices
AlignmentsCalculator calculator;
- AlignmentsCalculator::Result ares = calculator.compute(delta_collector.deltas,*sl);
+ AlignmentsCalculator::Result ares = calculator.compute(deltas,*sl);
TTimeStamp stop;
total_cres += cres;
total_ares += ares;
@@ -139,7 +131,8 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
printout(INFO,"ComputedDerived",
"Setup %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) (D:%ld,A:%ld,M:%ld) for IOV:%-12s [%8.3f sec]",
cres.total(), cres.selected, cres.loaded, cres.computed, cres.missing,
- delta_collector.deltas.size(),ares.computed, ares.missing, req_iov.str().c_str(), stop.AsDouble()-start.AsDouble());
+ deltas.size(),ares.computed, ares.missing, req_iov.str().c_str(),
+ stop.AsDouble()-start.AsDouble());
}
// ++++++++++++++++++++++++ Now access the conditions for every IOV....
@@ -149,7 +142,7 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
unsigned int rndm = 1+random.Integer(num_iov*10);
IOV req_iov(iov_typ,rndm);
// Attach the proper set of conditions to the user pool
- ConditionsManager::Result res = condMgr.prepare(req_iov,*slice);
+ ConditionsManager::Result res = manager.prepare(req_iov,*slice);
TTimeStamp stop;
total_cres += res;
access_stat.Fill(stop.AsDouble()-start.AsDouble());
@@ -165,11 +158,10 @@ static int alignment_example (Geometry::LCDD& lcdd, int argc, char** argv) {
comp_stat.GetName(), comp_stat.GetMean(), comp_stat.GetMeanErr(), comp_stat.GetRMS(), comp_stat.GetN());
printout(INFO,"Statistics","+ %-12s: %11.5g +- %11.4g RMS = %11.5g N = %lld",
access_stat.GetName(), access_stat.GetMean(), access_stat.GetMeanErr(), access_stat.GetRMS(), access_stat.GetN());
- printout(INFO,"Statistics",
- "+ Summary: Total %ld conditions used (S:%ld,L:%ld,C:%ld,M:%ld) (A:%ld,M:%ld).",
- total_cres.total(), total_cres.selected, total_cres.loaded,
- total_cres.computed, total_cres.missing,
- total_ares.computed, total_ares.missing);
+ printout(INFO,"Statistics",
+ "+ Summary: Total %ld conditions used (S:%ld,L:%ld,C:%ld,M:%ld) (A:%ld,M:%ld). Created:%ld",
+ total_cres.total(), total_cres.selected, total_cres.loaded, total_cres.computed, total_cres.missing,
+ total_ares.computed, total_ares.missing, total_created);
printout(INFO,"Statistics","+==========================================================================");
// All done.
diff --git a/examples/Conditions/CMakeLists.txt b/examples/Conditions/CMakeLists.txt
index 43e381e74174c47d4ac34287c53850c12f863644..dd7f6d247a7bf34ae72b0d25ccb5f9a4a1e3e0a9 100644
--- a/examples/Conditions/CMakeLists.txt
+++ b/examples/Conditions/CMakeLists.txt
@@ -52,7 +52,7 @@ dd4hep_add_test_reg( Conditions_Telescope_populate
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_ConditionExample_populate
-input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml -iovs 5
- REGEX_PASS "Total 160 conditions \\(S:100,L:0,C:60,M:0\\) of IOV run\\(0\\):\\[45-45\\]"
+ REGEX_PASS "Accessed Total 800 conditions \\(S: 500,L: 0,C: 300,M:0\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -61,7 +61,7 @@ dd4hep_add_test_reg( Conditions_Telescope_stress
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_ConditionExample_stress
-input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml -iovs 10 -runs 20
- REGEX_PASS "Summary: # of IOV: 10 # of Runs: 20"
+ REGEX_PASS "\\+ Accessed Total 3200 conditions \\(S: 2660,L: 0,C: 540,M:0\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -70,7 +70,7 @@ dd4hep_add_test_reg( Conditions_Telescope_stress2
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_ConditionExample_stress2
-input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml -iovs 10
- REGEX_PASS "Summary: # of IOV: 10"
+ REGEX_PASS "\\+ Accessed Total 1600 conditions \\(S: 1000,L: 0,C: 600,M:0\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -79,7 +79,7 @@ dd4hep_add_test_reg( Conditions_Telescope_MT_LONGTEST
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_ConditionExample_MT
-input file:${DD4hep_DIR}/examples/AlignDet/compact/Telescope.xml -iovs 30 -runs 10 -threads 1
- REGEX_PASS "Accessed a total of 286400 conditions \\(S:268400,L: 0,C: 18000,M:0\\) during the test"
+ REGEX_PASS "\\+ Accessed a total of 286400 conditions \\(S:268400,L: 0,C: 18000,M:0\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -88,7 +88,7 @@ dd4hep_add_test_reg( Conditions_CLICSiD_stress_LONGTEST
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_ConditionExample_stress
-input file:${DD4hep_DIR}/examples/CLICSiD/compact/compact.xml -iovs 10 -runs 100
- REGEX_PASS "Summary: # of IOV: 10 # of Runs: 100"
+ REGEX_PASS "\\+ Accessed Total 28008800 conditions \\(S:26958470,L: 0,C:1050330,M:0\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -97,7 +97,7 @@ dd4hep_add_test_reg( Conditions_CLICSiD_stress2_LONGTEST
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_ConditionExample_stress2
-input file:${DD4hep_DIR}/examples/CLICSiD/compact/compact.xml -iovs 20
- REGEX_PASS "Summary: # of IOV: 20"
+ REGEX_PASS "\\+ Accessed Total 5601760 conditions \\(S:3501100,L: 0,C:2100660,M:0\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
#
@@ -106,6 +106,6 @@ dd4hep_add_test_reg( Conditions_CLICSiD_MT_LONGTEST
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Conditions.sh"
EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_ConditionExample_MT
-input file:${DD4hep_DIR}/examples/CLICSiD/compact/compact.xml -iovs 3 -runs 2 -threads 1
- REGEX_PASS "Accessed a total of 9522992 conditions \\(S:8892794,L: 0,C:630198,M:0\\) during the test"
+ REGEX_PASS "\\+ Accessed a total of 9522992 conditions \\(S:8892794,L: 0,C:630198,M:0\\)"
REGEX_FAIL " ERROR ;EXCEPTION;Exception"
)
diff --git a/examples/Conditions/src/ConditionExampleObjects.cpp b/examples/Conditions/src/ConditionExampleObjects.cpp
index f11594dcdf374d9420a0d09df6027095dcbbd4d3..c34c219a3596219998fb6e9a3fa831fdcc8e99af 100644
--- a/examples/Conditions/src/ConditionExampleObjects.cpp
+++ b/examples/Conditions/src/ConditionExampleObjects.cpp
@@ -22,14 +22,17 @@ using namespace DD4hep::ConditionExamples;
using Conditions::ConditionsSlice;
using Conditions::DependencyBuilder;
using Conditions::ConditionsLoadInfo;
-using Conditions::ConditionsCollector;
-using Conditions::DetElementConditionsCollector;
-
/// Install the consitions and the alignment manager
-void DD4hep::ConditionExamples::installManagers(LCDD& lcdd) {
+ConditionsManager DD4hep::ConditionExamples::installManager(LCDD& lcdd) {
// Now we instantiate the conditions manager
lcdd.apply("DD4hep_ConditionsManagerInstaller",0,(char**)0);
+ ConditionsManager manager = ConditionsManager::from(lcdd);
+ manager["PoolType"] = "DD4hep_ConditionsLinearPool";
+ manager["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
+ manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
+ manager.initialize();
+ return manager;
}
/// Interface to client Callback in order to update the condition
@@ -91,7 +94,7 @@ Condition ConditionUpdate3::operator()(const ConditionKey& key, const Context& c
/// Initializing constructor
ConditionsDependencyCreator::ConditionsDependencyCreator(ConditionsContent& c, PrintLevel p)
- : content(c), printLevel(p)
+ : OutputLevel(p), content(c)
{
call1 = new ConditionUpdate1(printLevel);
call2 = new ConditionUpdate2(printLevel);
@@ -106,7 +109,7 @@ ConditionsDependencyCreator::~ConditionsDependencyCreator() {
}
/// Callback to process a single detector element
-int ConditionsDependencyCreator::operator()(DetElement de, int) {
+int ConditionsDependencyCreator::operator()(DetElement de, int) const {
ConditionKey key(de,"derived_data");
ConditionKey target1(de,"derived_1");
ConditionKey target2(de,"derived_2");
@@ -132,19 +135,15 @@ int ConditionsDependencyCreator::operator()(DetElement de, int) {
return 1;
}
-/// Destructor
-ConditionsDataAccess::~ConditionsDataAccess() {
-}
-
/// Callback to process a single detector element
-int ConditionsDataAccess::operator()(DetElement de, int /* level */) {
- ConditionsCollector select(0);
- map.scan(select);
- return accessConditions(de, select.conditions);
+int ConditionsDataAccess::operator()(DetElement de, int level) const {
+ vector<Condition> conditions;
+ conditionsCollector(map,conditions)(de, level);
+ return accessConditions(de, conditions);
}
/// Common call to access selected conditions
-int ConditionsDataAccess::accessConditions(DetElement de, const std::vector<Condition>& conditions) {
+int ConditionsDataAccess::accessConditions(DetElement de, const std::vector<Condition>& conditions) const {
ConditionKey key_temperature (de,"temperature");
ConditionKey key_pressure (de,"pressure");
ConditionKey key_double_table(de,"double_table");
@@ -190,17 +189,9 @@ int ConditionsDataAccess::accessConditions(DetElement de, const std::vector<Cond
}
return count;
}
-
-/// Callback to process a single detector element
-int DetectorConditionsAccess::operator()(DetElement de, int) {
- DetElementConditionsCollector select(de);
- map.scan(select);
- return accessConditions(de, select.conditions);
-}
-
/// Callback to process a single detector element
-int ConditionsKeys::operator()(DetElement de, int) {
+int ConditionsKeys::operator()(DetElement de, int) const {
content.insertKey(ConditionKey(de,"temperature").hash);
content.insertKey(ConditionKey(de,"pressure").hash);
content.insertKey(ConditionKey(de,"double_table").hash);
@@ -209,7 +200,7 @@ int ConditionsKeys::operator()(DetElement de, int) {
return 1;
}
-template<typename T> Condition ConditionsCreator::make_condition(DetElement de, const string& name, T val) {
+template<typename T> Condition ConditionsCreator::make_condition(DetElement de, const string& name, T val) const {
Condition cond(de.path()+"#"+name, name);
T& value = cond.bind<T>();
value = val;
@@ -217,20 +208,8 @@ template<typename T> Condition ConditionsCreator::make_condition(DetElement de,
return cond;
}
-/// Constructor
-ConditionsCreator::ConditionsCreator(ConditionsSlice& s, ConditionsPool& p, PrintLevel l)
- : slice(s), pool(p), conditionCount(0), printLevel(l)
-{
-}
-
-
-/// Destructor
-ConditionsCreator::~ConditionsCreator() {
- printout(printLevel,"Creator","++ Added a total of %d conditions",conditionCount);
-}
-
/// Callback to process a single detector element
-int ConditionsCreator::operator()(DetElement de, int) {
+int ConditionsCreator::operator()(DetElement de, int) const {
Condition temperature = make_condition<double>(de,"temperature",1.222);
Condition pressure = make_condition<double>(de,"pressure",888.88);
Condition derived = make_condition<int> (de,"derived_data",100);
@@ -243,6 +222,5 @@ int ConditionsCreator::operator()(DetElement de, int) {
slice.manager.registerUnlocked(pool, dbl_table);
slice.manager.registerUnlocked(pool, int_table);
printout(printLevel,"Creator","++ Adding manually conditions for %s",de.path().c_str());
- conditionCount += 5;
- return 1;
+ return 5;
}
diff --git a/examples/Conditions/src/ConditionExampleObjects.h b/examples/Conditions/src/ConditionExampleObjects.h
index 53d6948f1ba0a5375b9ba444bc6f7fbd87e3723b..0d83fa7cce7a8e9201810027ab0899d411f5b83c 100644
--- a/examples/Conditions/src/ConditionExampleObjects.h
+++ b/examples/Conditions/src/ConditionExampleObjects.h
@@ -36,7 +36,7 @@ namespace DD4hep {
using Geometry::RotationZYX;
using Geometry::DetElement;
using Geometry::DetectorProcessor;
-
+
using Conditions::UserPool;
using Conditions::Condition;
using Conditions::ConditionKey;
@@ -47,6 +47,24 @@ namespace DD4hep {
using Conditions::ConditionsPrinter;
using Conditions::ConditionsManager;
using Conditions::ConditionUpdateCall;
+
+ /// Helper to reduce the number of lines of code
+ /**
+ * \author M.Frank
+ * \version 1.0
+ * \ingroup DD4HEP_CONDITIONS
+ */
+ class OutputLevel {
+ public:
+ /// Output level
+ PrintLevel printLevel = DEBUG;
+ /// Default constructor
+ OutputLevel() = default;
+ /// Initializing constructor
+ OutputLevel(PrintLevel p) : printLevel(p) {}
+ /// Default destructor
+ virtual ~OutputLevel() = default;
+ };
/// Specialized conditions update callback
/**
@@ -56,14 +74,12 @@ namespace DD4hep {
* \version 1.0
* \ingroup DD4HEP_CONDITIONS
*/
- class ConditionUpdate1 : public ConditionUpdateCall {
- /// Output level
- PrintLevel printLevel;
+ class ConditionUpdate1 : public ConditionUpdateCall, public OutputLevel {
public:
/// Initializing constructor
- ConditionUpdate1(PrintLevel p) : printLevel(p) { }
+ ConditionUpdate1(PrintLevel p) : OutputLevel(p) { }
/// Default destructor
- virtual ~ConditionUpdate1() { }
+ virtual ~ConditionUpdate1() = default;
/// Interface to client Callback in order to update the condition
virtual Condition operator()(const ConditionKey& key, const Context& context) final;
};
@@ -76,14 +92,12 @@ namespace DD4hep {
* \version 1.0
* \ingroup DD4HEP_CONDITIONS
*/
- class ConditionUpdate2 : public ConditionUpdateCall {
- /// Output level
- PrintLevel printLevel;
+ class ConditionUpdate2 : public ConditionUpdateCall, public OutputLevel {
public:
/// Initializing constructor
- ConditionUpdate2(PrintLevel p) : printLevel(p) { }
+ ConditionUpdate2(PrintLevel p) : OutputLevel(p) { }
/// Default destructor
- virtual ~ConditionUpdate2() { }
+ virtual ~ConditionUpdate2() = default;
/// Interface to client Callback in order to update the condition
virtual Condition operator()(const ConditionKey& key, const Context& context) final;
};
@@ -96,14 +110,12 @@ namespace DD4hep {
* \version 1.0
* \ingroup DD4HEP_CONDITIONS
*/
- class ConditionUpdate3 : public ConditionUpdateCall {
- /// Output level
- PrintLevel printLevel;
+ class ConditionUpdate3 : public ConditionUpdateCall, public OutputLevel {
public:
/// Initializing constructor
- ConditionUpdate3(PrintLevel p) : printLevel(p) { }
+ ConditionUpdate3(PrintLevel p) : OutputLevel(p) { }
/// Default destructor
- virtual ~ConditionUpdate3() { }
+ virtual ~ConditionUpdate3() = default;
/// Interface to client Callback in order to update the condition
virtual Condition operator()(const ConditionKey& key, const Context& context) final;
};
@@ -114,15 +126,14 @@ namespace DD4hep {
* \version 1.02
* \date 01/04/2016
*/
- struct ConditionsKeys : public DetectorProcessor {
+ class ConditionsKeys : public OutputLevel {
+ public:
/// Content object to be filled
ConditionsContent& content;
- /// Print level
- PrintLevel printLevel;
/// Constructor
- ConditionsKeys(ConditionsContent& c, PrintLevel p) : content(c), printLevel(p) {}
+ ConditionsKeys(ConditionsContent& c, PrintLevel p) : OutputLevel(p), content(c) {}
/// Callback to process a single detector element
- virtual int operator()(DetElement de, int level) final;
+ virtual int operator()(DetElement de, int level) const final;
};
/// Example how to populate the detector description with derived conditions
@@ -133,11 +144,9 @@ namespace DD4hep {
* \version 1.0
* \date 01/04/2016
*/
- struct ConditionsDependencyCreator : public DetectorProcessor {
+ struct ConditionsDependencyCreator : public OutputLevel {
/// Content object to be filled
- ConditionsContent& content;
- /// Print level
- PrintLevel printLevel;
+ ConditionsContent& content;
/// Three different update call types
ConditionUpdateCall *call1, *call2, *call3;
/// Constructor
@@ -145,7 +154,7 @@ namespace DD4hep {
/// Destructor
virtual ~ConditionsDependencyCreator();
/// Callback to process a single detector element
- virtual int operator()(DetElement de, int level) final;
+ virtual int operator()(DetElement de, int level) const final;
};
/// Example how to populate the detector description with conditions constants
@@ -156,23 +165,21 @@ namespace DD4hep {
* \version 1.0
* \date 01/04/2016
*/
- struct ConditionsCreator : public DetectorProcessor {
+ struct ConditionsCreator : public OutputLevel {
/// Content object for which conditions are supposedly created
- ConditionsSlice& slice;
+ ConditionsSlice& slice;
/// Conditions pool the created conditions are inserted to (not equals user pool!)
- ConditionsPool& pool;
- /// Counter
- unsigned int conditionCount = 0;
- /// Print level
- PrintLevel printLevel = DEBUG;
-
+ ConditionsPool& pool;
/// Constructor
- ConditionsCreator(ConditionsSlice& s, ConditionsPool& p, PrintLevel l);
+ ConditionsCreator(ConditionsSlice& s, ConditionsPool& p, PrintLevel l=DEBUG)
+ : OutputLevel(l), slice(s), pool(p) {}
/// Destructor
- virtual ~ConditionsCreator();
+ virtual ~ConditionsCreator() = default;
/// Callback to process a single detector element
- virtual int operator()(DetElement de, int level) final;
- template<typename T> Condition make_condition(DetElement de, const std::string& name, T val);
+ virtual int operator()(DetElement de, int level) const final;
+ template<typename T> Condition make_condition(DetElement de,
+ const std::string& name,
+ T val) const;
};
/// Example how to access the conditions constants from a detector element
@@ -181,57 +188,28 @@ namespace DD4hep {
* \version 1.0
* \date 01/04/2016
*/
- struct ConditionsDataAccess : public DetectorProcessor {
+ struct ConditionsDataAccess : public OutputLevel {
/// Reference to the IOV to be checked
const IOV& iov;
/// Reference to the conditions map to access conditions
ConditionsMap& map;
- /// Print level
- PrintLevel printLevel = DEBUG;
/// Constructor
- ConditionsDataAccess(const IOV& i, ConditionsMap& m) : iov(i), map(m), printLevel(DEBUG) {}
+ ConditionsDataAccess(const IOV& i, ConditionsMap& m, PrintLevel l=DEBUG)
+ : OutputLevel(l), iov(i), map(m) {}
/// Destructor
- virtual ~ConditionsDataAccess();
+ virtual ~ConditionsDataAccess() = default;
/// Callback to process a single detector element
- virtual int operator()(DetElement de, int level);
+ virtual int operator()(DetElement de, int level) const;
/// Common call to access selected conditions
- virtual int accessConditions(DetElement de, const std::vector<Condition>& conditions);
- };
-
- /// Example how to access the conditions constants from a detector element
- /**
- * \author M.Frank
- * \version 1.0
- * \date 01/04/2016
- */
- struct DetectorConditionsAccess : public ConditionsDataAccess {
- /// Constructor
- DetectorConditionsAccess(const IOV& i, ConditionsMap& m) : ConditionsDataAccess(i,m) {}
- /// Destructor
- virtual ~DetectorConditionsAccess() {}
- /// Callback to process a single detector element
- virtual int operator()(DetElement de, int level) final;
+ virtual int accessConditions(DetElement de,
+ const std::vector<Condition>& conditions) const;
};
/// Helper to run DetElement scans
- /**
- * \author M.Frank
- * \version 1.0
- * \date 01/04/2016
- */
- struct Scanner : public DetectorProcessor {
- DetElement::Processor* proc;
- /// Callback to process a single detector element
- virtual int operator()(DetElement de, int) final
- { return proc->processElement(de); }
- template <typename Q> Scanner& scan(Q& p, DetElement start)
- { Scanner obj; obj.proc = &p; obj.process(start, 0, true); return *this; }
- template <typename Q> Scanner& scan2(const Q& p, DetElement start)
- { Scanner obj; obj.proc = const_cast<Q*>(&p); obj.process(start, 0, true); return *this; }
- };
-
+ typedef Geometry::DetectorScanner Scanner;
+
/// Install the consitions and the conditions manager
- void installManagers(LCDD& lcdd);
+ ConditionsManager installManager(LCDD& lcdd);
} /* End namespace ConditionsExamples */
} /* End namespace DD4hep */
#endif /* DD4HEP_CONDITIONS_CONDITIONSEXAMPLEOBJECTS_H */
diff --git a/examples/Conditions/src/ConditionExample_MT.cpp b/examples/Conditions/src/ConditionExample_MT.cpp
index 619f3605716f1fdc43e0b78f7111a232c8f50184..8b5bb5a48d1558aa707fbcf2ffca19d1271d451f 100644
--- a/examples/Conditions/src/ConditionExample_MT.cpp
+++ b/examples/Conditions/src/ConditionExample_MT.cpp
@@ -41,15 +41,11 @@ using namespace DD4hep::ConditionExamples;
namespace {
mutex printout_lock;
- mutex total_guard;
- /// Total number of accesses
- long total_accesses;
- ConditionsManager::Result totals;
/// Helper class to simuilate evetn queue
class EventQueue {
vector<std::pair<long,long> > events;
- mutex guard;
+ mutex guard;
public:
EventQueue() = default;
~EventQueue() = default;
@@ -75,6 +71,13 @@ namespace {
/// Helper to collect statistics
class Statistics {
public:
+ /// Protection mutex for thread safe updates.
+ mutex total_guard;
+ /// Total number of accesses
+ long total_accesses = 0;
+ /// Total number of conditions created
+ long total_created = 0;
+ ConditionsManager::Result totals;
TStatistic create, prepare, access;
Statistics() : create("Creation"), prepare("Prepare"), access("Access") { }
void print() const {
@@ -87,8 +90,8 @@ namespace {
printout(INFO,"Statistics","+ %-12s: %11.5g +- %11.4g RMS = %11.5g N = %lld",
access.GetName(), access.GetMean(), access.GetMeanErr(),
access.GetRMS(), access.GetN());
- printout(INFO,"Statistics","+ Accessed a total of %ld conditions (S:%6ld,L:%6ld,C:%6ld,M:%ld) during the test.",
- total_accesses, totals.selected, totals.loaded, totals.computed, totals.missing);
+ printout(INFO,"Statistics","+ Accessed a total of %ld conditions (S:%6ld,L:%6ld,C:%6ld,M:%ld) during the test. Created:%ld",
+ total_accesses, totals.selected, totals.loaded, totals.computed, totals.missing, total_created);
printout(INFO,"Statistics","+=========================================================================");
}
};
@@ -111,12 +114,11 @@ namespace {
}
int accessConditions(const IOV& iov) {
TTimeStamp start;
- ConditionsDataAccess access(iov, *slice);
- int count = access.process(manager->lcdd().world(),0,false);
+ int count = Scanner().scan(ConditionsDataAccess(iov,*slice),manager->lcdd().world());
TTimeStamp stop;
stats.access.Fill(stop.AsDouble()-start.AsDouble());
- lock_guard<mutex> lock(total_guard);
- total_accesses += count;
+ lock_guard<mutex> lock(stats.total_guard);
+ stats.total_accesses += count;
return count;
}
void run() {
@@ -144,17 +146,17 @@ namespace {
}
num_access = accessConditions(iov);
num_reuse = 0;
- total_guard.lock();
- totals += res;
- total_guard.unlock();
+ stats.total_guard.lock();
+ stats.totals += res;
+ stats.total_guard.unlock();
continue;
}
++num_reuse;
::usleep(10000);
num_access += accessConditions(iov);
- total_guard.lock();
- totals += res;
- total_guard.unlock();
+ stats.total_guard.lock();
+ stats.totals += res;
+ stats.total_guard.unlock();
}
}
};
@@ -199,25 +201,18 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
/******************** Initialize the conditions manager *****************/
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- condMgr["PoolType"] = "DD4hep_ConditionsLinearPool";
- condMgr["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
- condMgr["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
- condMgr.initialize();
-
- const IOVType* iov_typ = condMgr.registerIOVType(0,"run").second;
- if ( 0 == iov_typ ) {
+ ConditionsManager manager = installManager(lcdd);
+ const IOVType* iov_typ = manager.registerIOVType(0,"run").second;
+ if ( 0 == iov_typ )
except("ConditionsPrepare","++ Unknown IOV type supplied.");
- }
/******************** Now as usual: create the slice ********************/
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- ConditionsKeys(*content,INFO).process(lcdd.world(),0,true);
- ConditionsDependencyCreator(*content,DEBUG).process(lcdd.world(),0,true);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ Scanner(ConditionsKeys(*content,INFO),lcdd.world());
+ Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world());
Statistics stats;
EventQueue events;
@@ -226,14 +221,14 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
for(int i=0; i<num_iov; ++i) {
TTimeStamp start;
IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10));
- ConditionsPool* pool = condMgr.registerIOV(*iov.iovType, iov.key());
- ConditionsCreator creator(*slice, *pool, DEBUG); // Use a generic creator
- creator.process(lcdd.world(),0,true); // Create conditions with all deltas
+ ConditionsPool* pool = manager.registerIOV(*iov.iovType, iov.key());
+ // Create conditions with all deltas using a generic conditions creator
+ int count = Scanner().scan(ConditionsCreator(*slice, *pool, DEBUG),lcdd.world());
TTimeStamp stop;
stats.create.Fill(stop.AsDouble()-start.AsDouble());
printout(INFO,"Example", "Setup %ld conditions for IOV:%s [%8.3f sec]",
- creator.conditionCount, iov.str().c_str(),
- stop.AsDouble()-start.AsDouble());
+ count, iov.str().c_str(),stop.AsDouble()-start.AsDouble());
+ stats.total_created += count;
// Fill the event queue with 10 evt per run
for(int j=0; j<6; ++j) {
events.push(make_pair((i*10)+j,num_run));
@@ -243,7 +238,7 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// ++++++++++++++++++++++++ Now compute the conditions for each of these IOVs
vector<thread*> threads;
for(int i=0; i<num_threads; ++i) {
- Executor* exec = new Executor(condMgr, iov_typ, i, events, stats);
+ Executor* exec = new Executor(manager, iov_typ, i, events, stats);
exec->slice = new ConditionsSlice(*slice);
thread* t = new thread( [exec]{ exec->run(); delete exec; });
threads.push_back(t);
diff --git a/examples/Conditions/src/ConditionExample_populate.cpp b/examples/Conditions/src/ConditionExample_populate.cpp
index c345f03f2a901d3bf7ecc6635ea5d5f1ebee91fc..fee2731c653685544aff6068b90cd095b0c1f3cd 100644
--- a/examples/Conditions/src/ConditionExample_populate.cpp
+++ b/examples/Conditions/src/ConditionExample_populate.cpp
@@ -65,49 +65,46 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
/******************** Initialize the conditions manager *****************/
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- condMgr["PoolType"] = "DD4hep_ConditionsLinearPool";
- condMgr["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
- condMgr["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
- condMgr.initialize();
-
- const IOVType* iov_typ = condMgr.registerIOVType(0,"run").second;
- if ( 0 == iov_typ ) {
+ ConditionsManager manager = installManager(lcdd);
+ const IOVType* iov_typ = manager.registerIOVType(0,"run").second;
+ if ( 0 == iov_typ )
except("ConditionsPrepare","++ Unknown IOV type supplied.");
- }
/******************** Now as usual: create the slice ********************/
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- slice->pool = condMgr.createUserPool(iov_typ);
- ConditionsKeys(*content,INFO).process(lcdd.world(),0,true);
- ConditionsDependencyCreator(*content,DEBUG).process(lcdd.world(),0,true);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ Scanner(ConditionsKeys(*content,INFO),lcdd.world());
+ Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world());
/******************** Populate the conditions store *********************/
// Have 10 run-slices [11,20] .... [91,100]
for(int i=0; i<num_iov; ++i) {
IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10));
- ConditionsPool* iov_pool = condMgr.registerIOV(*iov.iovType, iov.key());
- ConditionsCreator creator(*slice, *iov_pool, INFO); // Use a generic creator
- creator.process(lcdd.world(),0,true); // Create conditions with all deltas
+ ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key());
+ // Create conditions with all deltas. Use a generic creator
+ Scanner(ConditionsCreator(*slice, *iov_pool, INFO),lcdd.world(),0,true);
}
// ++++++++++++++++++++++++ Now compute the conditions for each of these IOVs
+ ConditionsManager::Result total;
for(int i=0; i<num_iov; ++i) {
IOV req_iov(iov_typ,i*10+5);
- // Attach the proper set of conditions to the user pool
- ConditionsManager::Result r = condMgr.prepare(req_iov,*slice);
+ // Select the proper set of conditions and attach them to the user pool
+ ConditionsManager::Result r = manager.prepare(req_iov,*slice);
+ total += r;
if ( 0 == i ) { // First one we print...
- ConditionsPrinter printer(slice.get(),"Example");
- Scanner().scan(printer,lcdd.world());
+ Scanner(ConditionsPrinter(slice.get(),"Example"),lcdd.world());
}
// Now compute the tranformation matrices
printout(INFO,"Prepare","Total %ld conditions (S:%ld,L:%ld,C:%ld,M:%ld) of IOV %s",
r.total(), r.selected, r.loaded, r.computed, r.missing, req_iov.str().c_str());
}
+ printout(INFO,"Statistics","+=========================================================================");
+ printout(INFO,"Statistics","+ Accessed Total %ld conditions (S:%6ld,L:%6ld,C:%6ld,M:%ld)",
+ total.total(), total.selected, total.loaded, total.computed, total.missing);
+ printout(INFO,"Statistics","+=========================================================================");
// All done.
return 1;
}
diff --git a/examples/Conditions/src/ConditionExample_stress.cpp b/examples/Conditions/src/ConditionExample_stress.cpp
index d1df184ed99f8b4d17ebaee050df92034704ee88..74a21efe522df500540620139822a3eb8359d0a6 100644
--- a/examples/Conditions/src/ConditionExample_stress.cpp
+++ b/examples/Conditions/src/ConditionExample_stress.cpp
@@ -70,51 +70,48 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
/******************** Initialize the conditions manager *****************/
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- condMgr["PoolType"] = "DD4hep_ConditionsLinearPool";
- condMgr["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
- condMgr["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
- condMgr.initialize();
-
- const IOVType* iov_typ = condMgr.registerIOVType(0,"run").second;
+ ConditionsManager manager = installManager(lcdd);
+ const IOVType* iov_typ = manager.registerIOVType(0,"run").second;
if ( 0 == iov_typ ) {
except("ConditionsPrepare","++ Unknown IOV type supplied.");
}
/******************** Now as usual: create the slice ********************/
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- ConditionsKeys(*content,INFO).process(lcdd.world(),0,true);
- ConditionsDependencyCreator(*content,DEBUG).process(lcdd.world(),0,true);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ Scanner(ConditionsKeys(*content,INFO),lcdd.world());
+ Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world());
TStatistic cr_stat("Creation"), acc_stat("Access");
/******************** Populate the conditions store *********************/
// Have 10 run-slices [11,20] .... [91,100]
+ size_t total_created = 0;
for(int i=0; i<num_iov; ++i) {
TTimeStamp start;
IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10));
- ConditionsPool* iov_pool = condMgr.registerIOV(*iov.iovType, iov.key());
- ConditionsCreator creator(*slice, *iov_pool, DEBUG); // Use a generic creator
- creator.process(lcdd.world(),0,true); // Create conditions with all deltas
+ ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key());
+ // Create conditions with all deltas. Use a generic creator
+ int count = Scanner().scan(ConditionsCreator(*slice, *iov_pool, DEBUG), lcdd.world());
TTimeStamp stop;
cr_stat.Fill(stop.AsDouble()-start.AsDouble());
printout(INFO,"Example", "Setup %ld conditions for IOV:%s [%8.3f sec]",
- creator.conditionCount, iov.str().c_str(),
- stop.AsDouble()-start.AsDouble());
+ count, iov.str().c_str(), stop.AsDouble()-start.AsDouble());
+ total_created += count;
}
// ++++++++++++++++++++++++ Now compute the conditions for each of these IOVs
TRandom3 random;
+ ConditionsManager::Result total;
for(int i=0; i<num_runs; ++i) {
TTimeStamp start;
unsigned int rndm = 1+random.Integer(num_iov*10);
IOV req_iov(iov_typ,rndm);
// Attach the proper set of conditions to the user pool
- ConditionsManager::Result res = condMgr.prepare(req_iov,*slice);
+ ConditionsManager::Result res = manager.prepare(req_iov,*slice);
TTimeStamp stop;
+ total += res;
acc_stat.Fill(stop.AsDouble()-start.AsDouble());
// Now compute the tranformation matrices
printout(INFO,"Prepare","Total %ld conditions (S:%6ld,L:%6ld,C:%6ld,M:%ld) of type %s [%8.3f sec]",
@@ -126,6 +123,8 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
cr_stat.GetName(), cr_stat.GetMean(), cr_stat.GetMeanErr(), cr_stat.GetRMS(), cr_stat.GetN());
printout(INFO,"Statistics","+ %-12s: %11.5g +- %11.4g RMS = %11.5g N = %lld",
acc_stat.GetName(), acc_stat.GetMean(), acc_stat.GetMeanErr(), acc_stat.GetRMS(), acc_stat.GetN());
+ printout(INFO,"Statistics","+ Accessed Total %ld conditions (S:%6ld,L:%6ld,C:%6ld,M:%ld). Created:%ld",
+ total.total(), total.selected, total.loaded, total.computed, total.missing, total_created);
printout(INFO,"Statistics","+=========================================================================");
// All done.
return 1;
diff --git a/examples/Conditions/src/ConditionExample_stress2.cpp b/examples/Conditions/src/ConditionExample_stress2.cpp
index 4fa1dd9c734d9bf8bed0f4a45a948a5e5dc2a503..2b79dcb4827ebeb0e223e79b57c9df5d39ae4e6d 100644
--- a/examples/Conditions/src/ConditionExample_stress2.cpp
+++ b/examples/Conditions/src/ConditionExample_stress2.cpp
@@ -66,46 +66,42 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
// First we load the geometry
lcdd.fromXML(input);
- installManagers(lcdd);
/******************** Initialize the conditions manager *****************/
- ConditionsManager condMgr = ConditionsManager::from(lcdd);
- condMgr["PoolType"] = "DD4hep_ConditionsMappedPool";
- condMgr["UserPoolType"] = "DD4hep_ConditionsMapUserPool";
- condMgr["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool";
- condMgr.initialize();
-
- const IOVType* iov_typ = condMgr.registerIOVType(0,"run").second;
- if ( 0 == iov_typ ) {
+ ConditionsManager manager = installManager(lcdd);
+ const IOVType* iov_typ = manager.registerIOVType(0,"run").second;
+ if ( 0 == iov_typ )
except("ConditionsPrepare","++ Unknown IOV type supplied.");
- }
/******************** Now as usual: create the slice ********************/
shared_ptr<ConditionsContent> content(new ConditionsContent());
- shared_ptr<ConditionsSlice> slice(new ConditionsSlice(condMgr,content));
- ConditionsKeys(*content,INFO).process(lcdd.world(),0,true);
- ConditionsDependencyCreator(*content,DEBUG).process(lcdd.world(),0,true);
+ shared_ptr<ConditionsSlice> slice(new ConditionsSlice(manager,content));
+ Scanner(ConditionsKeys(*content,INFO),lcdd.world());
+ Scanner(ConditionsDependencyCreator(*content,DEBUG),lcdd.world());
+ size_t total_created = 0;
+ ConditionsManager::Result total;
TStatistic cr_stat("Creation"), acc_stat("Access");
// ++++++++++++++++++++++++ Now compute the conditions for each of these IOVs
for(int i=0; i<num_iov; ++i) {
{
TTimeStamp start;
IOV iov(iov_typ, IOV::Key(1+i*10,(i+1)*10));
- ConditionsPool* iov_pool = condMgr.registerIOV(*iov.iovType, iov.key());
- ConditionsCreator creator(*slice, *iov_pool, DEBUG); // Use a generic creator
- creator.process(lcdd.world(),0,true); // Create conditions with all deltas
+ ConditionsPool* iov_pool = manager.registerIOV(*iov.iovType, iov.key());
+ // Create conditions with all deltas. Use a generic creator
+ int count = Scanner().scan(ConditionsCreator(*slice, *iov_pool, DEBUG),lcdd.world());
TTimeStamp stop;
+ total_created += count;
cr_stat.Fill(stop.AsDouble()-start.AsDouble());
printout(INFO,"Creating", "Setup %-6ld conditions for IOV:%-60s [%8.3f sec]",
- creator.conditionCount, iov.str().c_str(),
- stop.AsDouble()-start.AsDouble());
+ count, iov.str().c_str(), stop.AsDouble()-start.AsDouble());
} {
TTimeStamp start;
IOV req_iov(iov_typ,i*10+5);
// Attach the proper set of conditions to the user pool
- ConditionsManager::Result res = condMgr.prepare(req_iov,*slice);
+ ConditionsManager::Result res = manager.prepare(req_iov,*slice);
TTimeStamp stop;
+ total += res;
acc_stat.Fill(stop.AsDouble()-start.AsDouble());
// Now compute the tranformation matrices
printout(INFO,"Compute","Total %-6ld conditions (S:%6ld,L:%6ld,C:%6ld,M:%4ld) of type %-25s [%8.3f sec]",
@@ -118,6 +114,8 @@ static int condition_example (Geometry::LCDD& lcdd, int argc, char** argv) {
cr_stat.GetName(), cr_stat.GetMean(), cr_stat.GetMeanErr(), cr_stat.GetRMS(), cr_stat.GetN());
printout(INFO,"Statistics","+ %-12s: %11.5g +- %11.4g RMS = %11.5g N = %lld",
acc_stat.GetName(), acc_stat.GetMean(), acc_stat.GetMeanErr(), acc_stat.GetRMS(), acc_stat.GetN());
+ printout(INFO,"Statistics","+ Accessed Total %ld conditions (S:%6ld,L:%6ld,C:%6ld,M:%ld)",
+ total.total(), total.selected, total.loaded, total.computed, total.missing, total_created);
printout(INFO,"Statistics","+=========================================================================");
// All done.
return 1;
diff --git a/examples/Conditions/src/ConditionsTest.cpp b/examples/Conditions/src/ConditionsTest.cpp
index aa895f9310a241b62d3f0c5870fe9770e6f47842..b0d390707ee6baab53366e6bc06ea10431dbfc9a 100644
--- a/examples/Conditions/src/ConditionsTest.cpp
+++ b/examples/Conditions/src/ConditionsTest.cpp
@@ -204,14 +204,14 @@ void TestEnv::add_xml_data_source(const string& file, const string& iov_str) {
/// Dump the conditions of one detectpr element
void TestEnv::dump_detector_element(DetElement elt, ConditionsMap& map)
{
- DetElementConditionsCollector scanner(elt);
- map.scan(scanner);
- if ( scanner.conditions.empty() ) {
+ vector<Conditions::Condition> conditions;
+ conditionsCollector(map,conditions)(elt);
+ if ( conditions.empty() ) {
printout(INFO,"conditions_tree","DetElement:%s NO CONDITIONS present",elt.path().c_str());
}
else {
- printout(INFO,"conditions","DetElement:%s # of conditons:%ld",elt.path().c_str(),scanner.conditions.size());
- for(const auto& c : scanner.conditions )
+ printout(INFO,"conditions","DetElement:%s # of conditons:%ld",elt.path().c_str(),conditions.size());
+ for(const auto& c : conditions )
print_condition<void>(c);
}
}
diff --git a/examples/DDDB/CMakeLists.txt b/examples/DDDB/CMakeLists.txt
index 597fda83a1814515d24b062b7b03b80cb6895146..18e1edb512fdfb788a1cf9e4c091aaf418368d08 100644
--- a/examples/DDDB/CMakeLists.txt
+++ b/examples/DDDB/CMakeLists.txt
@@ -48,7 +48,7 @@ if (DD4HEP_USE_XERCESC)
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh"
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
- REGEX_PASS "Converted 12852 placements"
+ REGEX_PASS "\\+ Converted 12852 placements"
REGEX_FAIL "Exception"
)
#
@@ -57,7 +57,7 @@ if (DD4HEP_USE_XERCESC)
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh"
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
- REGEX_PASS "Converted 9353 conditions"
+ REGEX_PASS "\\+ Converted 9353 conditions"
REGEX_FAIL "Exception"
)
#
@@ -67,7 +67,7 @@ if (DD4HEP_USE_XERCESC)
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
-exec DDDB_ConditionsSummary
- REGEX_PASS "DDDB Total Number of parameters: 19057 "
+ REGEX_PASS "\\+ DDDB Total Number of parameters: 19057 "
REGEX_FAIL "Exception"
)
#
@@ -77,7 +77,7 @@ if (DD4HEP_USE_XERCESC)
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller -end-plugin
-plugin DDDB_DetectorDump -print DEBUG -end-plugin
- REGEX_PASS "DDDB: Number of DetElements in the geometry: 3060"
+ REGEX_PASS "\\+ DDDB: Number of DetElements in the geometry: 3060"
REGEX_FAIL "Exception"
)
#
@@ -87,7 +87,7 @@ if (DD4HEP_USE_XERCESC)
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
-plugin DDDB_DetectorVolumeDump -print DEBUG
- REGEX_PASS "DDDB: Number of DetElement placements: 3056"
+ REGEX_PASS "\\+ DDDB: Number of DetElement placements: 3056"
REGEX_FAIL "Exception"
)
#
@@ -97,27 +97,27 @@ if (DD4HEP_USE_XERCESC)
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
-plugin DDDB_DetectorConditionKeysDump -print DEBUG
- REGEX_PASS "DDDB: Number of DetElement condition keys: 14042"
+ REGEX_PASS "\\+ DDDB: Number of DetElement condition keys: 4267"
REGEX_FAIL "Exception"
)
#
#---Testing: Load the geometry + dump condition keys --------------------------
- dd4hep_add_test_reg( DDDB_det_conditions_data_LONGTEST
+ dd4hep_add_test_reg( DDDB_det_catalog_data_LONGTEST
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh"
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
-plugin DDDB_DetectorConditionDump -print DEBUG
- REGEX_PASS "DDDB: Number of attached conditions: 2261"
+ REGEX_PASS "\\+ DDDBConditions Total Number of parameters: 14408"
REGEX_FAIL "Exception"
)
#
#---Testing: Load the geometry + dump condition keys --------------------------
- dd4hep_add_test_reg( DDDB_det_conditions_align_LONGTEST
+ dd4hep_add_test_reg( DDDB_det_catalog_align_LONGTEST
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh"
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
-plugin DDDB_DetectorAlignmentDump -print DEBUG
- REGEX_PASS "Number of attached alignments: 2496"
+ REGEX_PASS "\\+ DDDBAlignments Total Number of parameters: 2502"
REGEX_FAIL "Exception"
)
#
@@ -127,15 +127,19 @@ if (DD4HEP_USE_XERCESC)
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
-plugin DDDB_DetElementConditionDump -print DEBUG
- REGEX_PASS "Total Number of parameters: 18383" )
- #
+ REGEX_PASS "\\+ DDDB: Total number of DetElement parameters: 8709"
+ )
+
+
+# MSF: Up to here all OK
+
#---Testing: Load the geometry + conditions + conditions derives
dd4hep_add_test_reg( DDDB_derived_conditions_LONGTEST
COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh"
EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh
-config DD4hep_ConditionsManagerInstaller
-plugin DDDB_DerivedCondTest -print DEBUG
- REGEX_PASS "Total Number of callbacks: 7479"
+ REGEX_PASS "DDDB: Total number of parameters: 7479"
REGEX_FAIL "Exception"
)
#