diff --git a/DDAlign/CMakeLists.txt b/DDAlign/CMakeLists.txt index c959b647a0c841e43d32caa7f8dbe091fe8c7b9b..20a3b52e3e04b11551bad828a658efac8f3a6d8e 100644 --- a/DDAlign/CMakeLists.txt +++ b/DDAlign/CMakeLists.txt @@ -1,3 +1,15 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) #--------------------------- set( PackageName DDAlign ) diff --git a/DDAlign/include/DDAlign/AlignmentCache.h b/DDAlign/include/DDAlign/AlignmentCache.h index e83bb7490b9dad49af5249652f6c0736137729c6..d816c62ede15bc7ca23d4b065fd539ff0c4c390e 100644 --- a/DDAlign/include/DDAlign/AlignmentCache.h +++ b/DDAlign/include/DDAlign/AlignmentCache.h @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_ALIGNMENT_ALIGNMENTCACHE_H #define DD4HEP_ALIGNMENT_ALIGNMENTCACHE_H diff --git a/DDAlign/include/DDAlign/AlignmentOperators.h b/DDAlign/include/DDAlign/AlignmentOperators.h index ff31b8b177a76635539c79730373c3ed732bab4f..ca0f52e0e45d4eb0e9a2606133c49313bb60c103 100644 --- a/DDAlign/include/DDAlign/AlignmentOperators.h +++ b/DDAlign/include/DDAlign/AlignmentOperators.h @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_ALIGNMENT_ALIGNMENTOPERATORS_H #define DD4HEP_ALIGNMENT_ALIGNMENTOPERATORS_H @@ -39,7 +44,7 @@ namespace DD4hep { Nodes& nodes; public: /// Initializing functor constructor - AlignmentOperator(AlignmentCache& c, Nodes& n) : cache(c), nodes(n) {} + AlignmentOperator(AlignmentCache& c, Nodes& n) : cache(c), nodes(n) {} /// Insert alignment entry void insert(Alignment alignment) const; }; @@ -54,7 +59,7 @@ namespace DD4hep { public: const Entries& entries; /// Initializing functor constructor - AlignmentSelector(AlignmentCache& c, Nodes& n, const Entries& e) : AlignmentOperator(c,n), entries(e) {} + AlignmentSelector(AlignmentCache& c, Nodes& n, const Entries& e) : AlignmentOperator(c,n), entries(e) {} ~AlignmentSelector() { } const AlignmentSelector& reset() const { nodes.clear(); return *this; } /// Function callback for cache entries @@ -72,7 +77,7 @@ namespace DD4hep { template <typename T> class AlignmentActor : public AlignmentOperator { public: /// Initializing functor constructor - AlignmentActor(AlignmentCache& c, Nodes& n) : AlignmentOperator(c,n) { init(); } + AlignmentActor(AlignmentCache& c, Nodes& n) : AlignmentOperator(c,n) { init(); } void init() {} /// Function callback for entries void operator()(Nodes::value_type& e) const; diff --git a/DDAlign/include/DDAlign/AlignmentStack.h b/DDAlign/include/DDAlign/AlignmentStack.h index f4933a293ff0d3e3da9b1e3f74a5cb5ac11b44a3..d7b6db2d215b7ee6e78eedb4ea3d1091ab193fd7 100644 --- a/DDAlign/include/DDAlign/AlignmentStack.h +++ b/DDAlign/include/DDAlign/AlignmentStack.h @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_ALIGNMENT_ALIGNMENTSTACK_H #define DD4HEP_ALIGNMENT_ALIGNMENTSTACK_H diff --git a/DDAlign/include/DDAlign/AlignmentTags.h b/DDAlign/include/DDAlign/AlignmentTags.h index c93c38535a5f799d55e583fdfc0965f40fb4e9d4..62415d9753b60dae74f6bb807f7612b371115b4b 100644 --- a/DDAlign/include/DDAlign/AlignmentTags.h +++ b/DDAlign/include/DDAlign/AlignmentTags.h @@ -1,11 +1,16 @@ -// $Id: XMLTags.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_ALIGNMENT_ALIGNMENT_TAGS_H #define DD4HEP_ALIGNMENT_ALIGNMENT_TAGS_H diff --git a/DDAlign/include/DDAlign/AlignmentTransaction.h b/DDAlign/include/DDAlign/AlignmentTransaction.h index 6a18b7e1c8e51188275c852a0ea78c85309dc5dd..61a270b9288517a825df8801c4ccf97c1dbab0c7 100644 --- a/DDAlign/include/DDAlign/AlignmentTransaction.h +++ b/DDAlign/include/DDAlign/AlignmentTransaction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_ALIGNMENT_ALIGNMENTTRANSACTION_H #define DD4HEP_ALIGNMENT_ALIGNMENTTRANSACTION_H diff --git a/DDAlign/include/DDAlign/AlignmentWriter.h b/DDAlign/include/DDAlign/AlignmentWriter.h index abe2e758d55b2609fbafcdf6f167901ea6e4f379..d0dbe35aa4271d29b12c8c978a23dd21401ecc7f 100644 --- a/DDAlign/include/DDAlign/AlignmentWriter.h +++ b/DDAlign/include/DDAlign/AlignmentWriter.h @@ -1,11 +1,16 @@ -// $Id: LCDDConverter.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDALIGN_ALIGNMENTWRITER_H #define DD4HEP_DDALIGN_ALIGNMENTWRITER_H diff --git a/DDAlign/include/DDAlign/DetectorAlignment.h b/DDAlign/include/DDAlign/DetectorAlignment.h index e0ba76a9b02187e313ad66c5885f11164d5b2067..9efb03d0f8a3362fd2409f34a7a0d6b2c120b35e 100644 --- a/DDAlign/include/DDAlign/DetectorAlignment.h +++ b/DDAlign/include/DDAlign/DetectorAlignment.h @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_DETECTORALIGNMENT_H #define DD4HEP_GEOMETRY_DETECTORALIGNMENT_H diff --git a/DDAlign/src/AlignmentCache.cpp b/DDAlign/src/AlignmentCache.cpp index 0ab6c9cddcc6d8ff7e99566211fdb7cf08251b7c..972b06b47e2055e396dc98693e72cd169de03082 100644 --- a/DDAlign/src/AlignmentCache.cpp +++ b/DDAlign/src/AlignmentCache.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" diff --git a/DDAlign/src/AlignmentOperators.cpp b/DDAlign/src/AlignmentOperators.cpp index df865b0c8d27cd9be753b8d866cce177a5f4c90c..78670ff4cb28a197c00779fc59e62716147cebd8 100644 --- a/DDAlign/src/AlignmentOperators.cpp +++ b/DDAlign/src/AlignmentOperators.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" diff --git a/DDAlign/src/AlignmentParser.cpp b/DDAlign/src/AlignmentParser.cpp index 4aa7d00f9c752aef91da78054b0c3d7ab776160c..2a5682b8c0bc7ff195a2fcdc2700488d15b243a9 100644 --- a/DDAlign/src/AlignmentParser.cpp +++ b/DDAlign/src/AlignmentParser.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDAlign/src/AlignmentStack.cpp b/DDAlign/src/AlignmentStack.cpp index 11c0ca791b8044e02691b848bfc385ea6ae7f0c5..e93d8c20c14f77f5d584e6288e0e684ec20845c5 100644 --- a/DDAlign/src/AlignmentStack.cpp +++ b/DDAlign/src/AlignmentStack.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Objects.h" @@ -78,7 +84,11 @@ AlignmentStack::StackEntry::StackEntry(DetElement element, const RotationZYX& ro } /// Constructor with partial initialization -AlignmentStack::StackEntry::StackEntry(DetElement element, const Position& translation, const RotationZYX& rot, bool rst, bool rst_children) +AlignmentStack::StackEntry::StackEntry(DetElement element, + const Position& translation, + const RotationZYX& rot, + bool rst, + bool rst_children) : detector(element), transform(rot,translation), overlap(0.001), flag(0) { InstanceCount::increment(this); diff --git a/DDAlign/src/AlignmentTags.cpp b/DDAlign/src/AlignmentTags.cpp index 6278743ab71ea9256f88f61326101a2788b17630..b7d3426780a35c0bb501039d534a843f2b8291f9 100644 --- a/DDAlign/src/AlignmentTags.cpp +++ b/DDAlign/src/AlignmentTags.cpp @@ -1,11 +1,16 @@ -// $Id: XMLTags.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "XML/XMLTags.h" diff --git a/DDAlign/src/AlignmentTransaction.cpp b/DDAlign/src/AlignmentTransaction.cpp index 8796af6d0fa44711ca651c277c570f85f35d949b..db1a19edfcd9d79960c34338f20aa1c7a0350a2d 100644 --- a/DDAlign/src/AlignmentTransaction.cpp +++ b/DDAlign/src/AlignmentTransaction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDAlign/src/AlignmentWriter.cpp b/DDAlign/src/AlignmentWriter.cpp index 85afe6d4522069df9d343bc76c07d6c1a2a14ad8..67ff0bb35745f9bc2f906795c14d1fe8db94691d 100644 --- a/DDAlign/src/AlignmentWriter.cpp +++ b/DDAlign/src/AlignmentWriter.cpp @@ -1,11 +1,16 @@ -// $Id: LCDDConverter.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DDAlign/AlignmentWriter.h" diff --git a/DDAlign/src/DetectorAlignment.cpp b/DDAlign/src/DetectorAlignment.cpp index 1e50e0a4395edad1760e6c2e9917d3f18d4c3561..4c69d95eb895b174b84db21d0f44dd3df114ab43 100644 --- a/DDAlign/src/DetectorAlignment.cpp +++ b/DDAlign/src/DetectorAlignment.cpp @@ -1,11 +1,18 @@ -// $Id: Readout.cpp 985 2014-01-30 13:50:10Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDAlign/DetectorAlignment.h" #include "DD4hep/DetectorTools.h" #include "DD4hep/InstanceCount.h" diff --git a/DDCond/CMakeLists.txt b/DDCond/CMakeLists.txt index d8272786775237640304fe2fe82fc0135fe59698..216c7df57083d619cb0bfb959c2a0d8651c314a2 100644 --- a/DDCond/CMakeLists.txt +++ b/DDCond/CMakeLists.txt @@ -1,3 +1,15 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) #--------------------------- set( PackageName DDCond ) diff --git a/DDCond/include/DDCond/ConditionValidator.h b/DDCond/include/DDCond/ConditionValidator.h index 796c876efe9573c645c8727e8a2c1ce96989a542..bb496551f835aa283262cdb8321b2188b0a90720 100644 --- a/DDCond/include/DDCond/ConditionValidator.h +++ b/DDCond/include/DDCond/ConditionValidator.h @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_CONDITIONVALIDATOR_H #define DD4HEP_GEOMETRY_CONDITIONVALIDATOR_H diff --git a/DDCond/include/DDCond/ConditionsHandler.h b/DDCond/include/DDCond/ConditionsHandler.h index 329252e1853da82e35c9200f919d89d6707063a1..2fee1c8d3194268a1afd7e6dc455c685e752eba6 100644 --- a/DDCond/include/DDCond/ConditionsHandler.h +++ b/DDCond/include/DDCond/ConditionsHandler.h @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_CONDITIONS_CONDITIONSHANDLER_H #define DD4HEP_CONDITIONS_CONDITIONSHANDLER_H diff --git a/DDCond/include/DDCond/ConditionsOperators.h b/DDCond/include/DDCond/ConditionsOperators.h index a06a1485fda0e959b1f2983b3fcae0087a10bd47..6ff70d542a99f462506cc72b41d58928c389c0d1 100644 --- a/DDCond/include/DDCond/ConditionsOperators.h +++ b/DDCond/include/DDCond/ConditionsOperators.h @@ -1,11 +1,16 @@ -// $Id: XMLStack.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_CONDITIONS_CONDITIONSOPERATORS_H #define DD4HEP_CONDITIONS_CONDITIONSOPERATORS_H diff --git a/DDCond/include/DDCond/ConditionsStack.h b/DDCond/include/DDCond/ConditionsStack.h index 7f7b0d2caf5c1c21978fa528825765d1781ca66c..343a82298f054e50bdafd445b9e7a25a16b5c49f 100644 --- a/DDCond/include/DDCond/ConditionsStack.h +++ b/DDCond/include/DDCond/ConditionsStack.h @@ -1,11 +1,16 @@ -// $Id: XMLStack.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_CONDITIONS_CONDITIONSSTACK_H #define DD4HEP_CONDITIONS_CONDITIONSSTACK_H @@ -59,7 +64,7 @@ namespace DD4hep { void release(); /// Access size of the conditions stack size_t size() const { return m_stack.size(); } - /// Retrieve an conditions entry of the current stack + /// Retrieve an conditions entry of the current stack dd4hep_ptr<Entry> pop(); /// Get all path entries to be aligned. Note: transient! std::vector<const Entry*> entries() const; diff --git a/DDCond/include/DDCond/ConditionsTags.h b/DDCond/include/DDCond/ConditionsTags.h index 4353739b8550e1a67cd5dec2c3e737523e80a99c..52176ce76d326aa86f9a14e8878b5bfea38082a5 100644 --- a/DDCond/include/DDCond/ConditionsTags.h +++ b/DDCond/include/DDCond/ConditionsTags.h @@ -1,11 +1,16 @@ -// $Id: XMLTags.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_CONDITIONS_CONDITIONSTAGS_H #define DD4HEP_CONDITIONS_CONDITIONSTAGS_H diff --git a/DDCond/include/DDCond/ConditionsTransaction.h b/DDCond/include/DDCond/ConditionsTransaction.h index 2498c481f7e72ca284c665c6532299967525e6fd..1ee2468a281a1193489661d45fcf31e1dd840b56 100644 --- a/DDCond/include/DDCond/ConditionsTransaction.h +++ b/DDCond/include/DDCond/ConditionsTransaction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_CONDITIONS_CONDITIONSTRANSACTION_H #define DD4HEP_CONDITIONS_CONDITIONSTRANSACTION_H diff --git a/DDCond/src/ConditionTest.cpp b/DDCond/src/ConditionTest.cpp index b3a56fd43e2526a22922ecc55c8edf6afac1f5ad..8b922df3effcb95e42087ab15ac6c6d813c86933 100644 --- a/DDCond/src/ConditionTest.cpp +++ b/DDCond/src/ConditionTest.cpp @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" @@ -29,28 +34,28 @@ namespace { Condition c((*i).second); string type = c.type(); printout(INFO,test," %s Condition[%s]: %s [%s] Validity:%s", - c.detector().path().c_str(), type.c_str(), c.name().c_str(), - c.value().c_str(), c.validity().c_str()); + c.detector().path().c_str(), type.c_str(), c.name().c_str(), + c.value().c_str(), c.validity().c_str()); if ( type == "alignment" ) { - c.bind<string>(); + c.bind<string>(); } else if ( type == "temperature" ) { - c.bind<double>(); - printout(INFO,test," %s : double value:%g ", - c.name().c_str(), c.get<double>()); + c.bind<double>(); + printout(INFO,test," %s : double value:%g ", + c.name().c_str(), c.get<double>()); } else if ( type == "pressure" ) { - c.bind<double>(); - printout(INFO,test," %s : double value:%g [%g hPa]", - c.name().c_str(), c.get<double>(), - _multiply(c.get<double>(),"1.0/hPa")); + c.bind<double>(); + printout(INFO,test," %s : double value:%g [%g hPa]", + c.name().c_str(), c.get<double>(), + _multiply(c.get<double>(),"1.0/hPa")); } else if ( type == "whatever" ) { - c.bind<vector<double> >(); - const vector<double>& v = c.get<vector<double> >(); - printout(INFO,test," %s : vector<double> size:%d = %s", - c.name().c_str(), int(v.size()), c.block().str().c_str()); + c.bind<vector<double> >(); + const vector<double>& v = c.get<vector<double> >(); + printout(INFO,test," %s : vector<double> size:%d = %s", + c.name().c_str(), int(v.size()), c.block().str().c_str()); } printout(INFO,test, " Type: %s",typeName(c.typeInfo()).c_str()); } @@ -87,9 +92,9 @@ namespace { struct Callee { void call(unsigned long tags, DetElement& det, void* param) { if ( DetElement::CONDITIONS_CHANGED == (tags&DetElement::CONDITIONS_CHANGED) ) - printout(INFO,"Callee","+++ Conditions update %s param:%p",det.path().c_str(),param); + printout(INFO,"Callee","+++ Conditions update %s param:%p",det.path().c_str(),param); if ( DetElement::PLACEMENT_CHANGED == (tags&DetElement::PLACEMENT_CHANGED) ) - printout(INFO,"Callee","+++ Alignment update %s param:%p",det.path().c_str(),param); + printout(INFO,"Callee","+++ Alignment update %s param:%p",det.path().c_str(),param); } }; diff --git a/DDCond/src/ConditionValidator.cpp b/DDCond/src/ConditionValidator.cpp index 8ecbee67cdb28da2b5fb7c0c9303dbfb7aef52e2..df4f8c5c6cbe8274c8a10a43baad3fa658eba59b 100644 --- a/DDCond/src/ConditionValidator.cpp +++ b/DDCond/src/ConditionValidator.cpp @@ -1,11 +1,17 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #if 0 // Framework include files #include "DDCond/ConditionValidator.h" diff --git a/DDCond/src/ConditionsHandler.cpp b/DDCond/src/ConditionsHandler.cpp index 98ec435218dacccd078467acbe8b3998159ebd39..a7fa9e51378127faab2a179f8d4b225670f89ede 100644 --- a/DDCond/src/ConditionsHandler.cpp +++ b/DDCond/src/ConditionsHandler.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" @@ -71,7 +77,7 @@ void ConditionsHandler::closeTransaction() { return; } printout(WARNING,"Conditions<conditions>", - "Request to close a non-existing conditons transaction."); + "Request to close a non-existing conditons transaction."); } /// Create and install a new instance tree @@ -105,8 +111,8 @@ void ConditionsHandler::apply(ConditionsStack& stack) { DetElement det = data->detector; /// Do something! printout(DEBUG,"ConditionsHandler","+++ %s name:%s type:%s value:%s Validity:%s", - det.path().c_str(), data->name.c_str(), data->type.c_str(), - data->value.c_str(), data->validity.c_str()); + det.path().c_str(), data->name.c_str(), data->type.c_str(), + data->value.c_str(), data->validity.c_str()); det.conditions().set(data); updates.insert(det); } diff --git a/DDCond/src/ConditionsParser.cpp b/DDCond/src/ConditionsParser.cpp index a088e4b3288e91f0f9c821f523a7da8bf264a81d..3067ecb0597b34aed12a614d8f6699dffe190d9f 100644 --- a/DDCond/src/ConditionsParser.cpp +++ b/DDCond/src/ConditionsParser.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDCond/src/ConditionsStack.cpp b/DDCond/src/ConditionsStack.cpp index 5f25ce1563e60be29ffffd2350ea10560bfda42c..5628914e49d92a00f1e8f9d71dbbd38b0ffbd4a7 100644 --- a/DDCond/src/ConditionsStack.cpp +++ b/DDCond/src/ConditionsStack.cpp @@ -1,11 +1,16 @@ -// $Id: XMLStack.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -97,14 +102,14 @@ void ConditionsStack::insert(dd4hep_ptr<Entry>& data) { string path = det.path()+'!'+data->name; Stack::const_iterator i = m_stack.find(path); printout(DEBUG,"ConditionsStack","+++ %s name:%s type:%s value:%s Validity:%s", - det.path().c_str(), data->name.c_str(), data->type.c_str(), - data->value.c_str(), data->validity.c_str()); + det.path().c_str(), data->name.c_str(), data->type.c_str(), + data->value.c_str(), data->validity.c_str()); if ( i == m_stack.end() ) { m_stack.insert(make_pair(path,data.release())); return; } throw runtime_error("ConditionsStack> The data with path "+path+ - " cannot be set twice in one transaction. [Intended inhibit]"); + " cannot be set twice in one transaction. [Intended inhibit]"); } throw runtime_error("ConditionsStack> Attempt to apply an invalid conditions data."); } diff --git a/DDCond/src/ConditionsTags.cpp b/DDCond/src/ConditionsTags.cpp index e7ddea4ad3676a5fb5dfc7884d64040e86e323b2..b42448478e34f260722e302f2d2b148835b8a966 100644 --- a/DDCond/src/ConditionsTags.cpp +++ b/DDCond/src/ConditionsTags.cpp @@ -1,11 +1,16 @@ -// $Id: XMLTags.h 889 2013-11-14 15:55:39Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "XML/XMLTags.h" diff --git a/DDCond/src/ConditionsTransaction.cpp b/DDCond/src/ConditionsTransaction.cpp index aaf60d9ca2241e61723e0b42d5e625f49874e45b..1f671f5dbda84c41b8363a2330769791959700eb 100644 --- a/DDCond/src/ConditionsTransaction.cpp +++ b/DDCond/src/ConditionsTransaction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index caa31297b445247d12b8f9b71948fdfe3a274def..daafd4d5fdc405efafc241105f426a6e88e52e21 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -1,8 +1,22 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) project(DDCore) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${DDSegmentation_INCLUDE_DIRS}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include + ${DDSegmentation_INCLUDE_DIRS} + ${DDPluginManager_INCLUDE_DIRS}) file(GLOB sources src/*.cpp src/Evaluator/*.cpp src/XML/*.cpp) file(GLOB plugin_sources src/plugins/*.cpp) @@ -32,13 +46,10 @@ if(DD4HEP_USE_PYROOT) add_definitions(-DDD4HEP_USE_PYROOT) set(libraries ${libraries} PyROOT) endif() -if(NOT DD4HEP_NO_REFLEX) - set(libraries ${libraries} Reflex) -endif() add_library(DDCore SHARED ${sources} ${parser_sources} ) -target_link_libraries(DDCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} ${DDSegmentation_LIBRARIES} Geom ${libraries}) +target_link_libraries(DDCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} ${DDPluginManager_LIBRARIES} ${DDSegmentation_LIBRARIES} Geom ${libraries}) ## generates rootmap and installs the library add_dd4hep_plugin(DDCorePlugins SHARED ${plugin_sources}) diff --git a/DDCore/include/DD4hep/Alignment.h b/DDCore/include/DD4hep/Alignment.h index 1117bfacf0f5b1b2bdc322f5700a41bc206d2594..0b6a36f610ad78eb3e6bf4f90bbfe290deaa2bb9 100644 --- a/DDCore/include/DD4hep/Alignment.h +++ b/DDCore/include/DD4hep/Alignment.h @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_ALIGNMENT_H #define DD4HEP_GEOMETRY_ALIGNMENT_H @@ -38,8 +43,8 @@ namespace DD4hep { /// Default constructor Alignment(); /// Default constructor - Alignment(TGeoPhysicalNode* p) - : Handle<TGeoPhysicalNode>(p) { + Alignment(TGeoPhysicalNode* p) + : Handle<TGeoPhysicalNode>(p) { } /// Copy constructor Alignment(const Alignment& c); diff --git a/DDCore/include/DD4hep/BasicGrammar.h b/DDCore/include/DD4hep/BasicGrammar.h index 3af523591a2167c5bd806fdb5c7cb43f3e375786..322f910b440274380e46a30a2030bee4ad7829e0 100644 --- a/DDCore/include/DD4hep/BasicGrammar.h +++ b/DDCore/include/DD4hep/BasicGrammar.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_BASICGRAMMAR_H #define DD4HEP_DDG4_BASICGRAMMAR_H diff --git a/DDCore/include/DD4hep/Callback.h b/DDCore/include/DD4hep/Callback.h index 71f55c3ffe4b2e168a70df77be5c8a8bfecb6cd8..099c7a1bf84e53ee6304d36dfb67733220123274 100644 --- a/DDCore/include/DD4hep/Callback.h +++ b/DDCore/include/DD4hep/Callback.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDCORE_CALLBACK_H #define DD4HEP_DDCORE_CALLBACK_H @@ -47,18 +52,18 @@ namespace DD4hep { mfunc_t func; /// Default constructor - Callback() - : par(0), call(0) { + Callback() + : par(0), call(0) { func.first = func.second = 0; } /// Constructor with object initialization - Callback(void* p) - : par(p), call(0) { + Callback(void* p) + : par(p), call(0) { func.first = func.second = 0; } /// Initializing constructor - Callback(void* p, void* mf, func_t c) - : par(p), call(c) { + Callback(void* p, void* mf, func_t c) + : par(p), call(c) { func = *(mfunc_t*) mf; } /// Check validity of the callback object @@ -338,9 +343,9 @@ namespace DD4hep { CallbackSequence() { } /// Copy constructor - CallbackSequence(const CallbackSequence& c) - : callbacks(c.callbacks) { - } + CallbackSequence(const CallbackSequence& c) + : callbacks(c.callbacks) { + } /// Assignment operator CallbackSequence& operator=(const CallbackSequence& c) { if ( this != & c ) callbacks = c.callbacks; @@ -350,9 +355,9 @@ namespace DD4hep { //template <typename TYPE, typename R, typename OBJECT> // CallbackSequence(const std::vector<TYPE*>& objects, R (TYPE::value_type::*pmf)()) { //} - bool empty() const { - return callbacks.empty(); - } + bool empty() const { + return callbacks.empty(); + } /// Clear the sequence and remove all callbacks void clear() { callbacks.clear(); @@ -378,25 +383,25 @@ namespace DD4hep { /** Callback setup for callbacks with no arguments */ /// Add a new callback to a member function with explicit return type and no arguments template <typename TYPE, typename R, typename OBJECT> - void add(TYPE* pointer, R (OBJECT::*pmf)(),Location where=CallbackSequence::END) { + void add(TYPE* pointer, R (OBJECT::*pmf)(),Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a const member function with explicit return type and no arguments template <typename TYPE, typename R, typename OBJECT> - void add(TYPE* pointer, R (OBJECT::*pmf)() const,Location where=CallbackSequence::END) { + void add(TYPE* pointer, R (OBJECT::*pmf)() const,Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a void member function with no arguments template <typename TYPE, typename OBJECT> - void add(TYPE* pointer, void (OBJECT::*pmf)(),Location where=CallbackSequence::END) { + void add(TYPE* pointer, void (OBJECT::*pmf)(),Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a const void member function and no arguments template <typename TYPE, typename OBJECT> - void add(TYPE* pointer, void (OBJECT::*pmf)() const,Location where=CallbackSequence::END) { + void add(TYPE* pointer, void (OBJECT::*pmf)() const,Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } @@ -404,25 +409,25 @@ namespace DD4hep { /** Callback setup for callbacks with 1 argument */ /// Add a new callback to a member function with explicit return type and 1 argument template <typename TYPE, typename R, typename OBJECT, typename A> - void add(TYPE* pointer, R (OBJECT::*pmf)(A),Location where=CallbackSequence::END) { + void add(TYPE* pointer, R (OBJECT::*pmf)(A),Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a void member function and 1 argument template <typename TYPE, typename OBJECT, typename A> - void add(TYPE* pointer, void (OBJECT::*pmf)(A),Location where=CallbackSequence::END) { + void add(TYPE* pointer, void (OBJECT::*pmf)(A),Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a const member function with explicit return type and 1 argument template <typename TYPE, typename R, typename OBJECT, typename A> - void add(TYPE* pointer, R (OBJECT::*pmf)(A) const,Location where=CallbackSequence::END) { + void add(TYPE* pointer, R (OBJECT::*pmf)(A) const,Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a const void member function and 1 argument template <typename TYPE, typename OBJECT, typename A> - void add(TYPE* pointer, void (OBJECT::*pmf)(A) const,Location where=CallbackSequence::END) { + void add(TYPE* pointer, void (OBJECT::*pmf)(A) const,Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } @@ -431,25 +436,25 @@ namespace DD4hep { /** Callback setup for callbacks with 2 arguments */ /// Add a new callback to a member function with explicit return type and 2 arguments template <typename TYPE, typename R, typename OBJECT, typename A1, typename A2> - void add(TYPE* pointer, R (OBJECT::*pmf)(A1, A2),Location where=CallbackSequence::END) { + void add(TYPE* pointer, R (OBJECT::*pmf)(A1, A2),Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a const member function with explicit return type and 2 arguments template <typename TYPE, typename R, typename OBJECT, typename A1, typename A2> - void add(TYPE* pointer, R (OBJECT::*pmf)(A1, A2) const,Location where=CallbackSequence::END) { + void add(TYPE* pointer, R (OBJECT::*pmf)(A1, A2) const,Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a void member function with 2 arguments template <typename TYPE, typename OBJECT, typename A1, typename A2> - void add(TYPE* pointer, void (OBJECT::*pmf)(A1, A2),Location where=CallbackSequence::END) { + void add(TYPE* pointer, void (OBJECT::*pmf)(A1, A2),Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } /// Add a new callback to a const void member function with 2 arguments template <typename TYPE, typename OBJECT, typename A1, typename A2> - void add(TYPE* pointer, void (OBJECT::*pmf)(A1, A2) const,Location where=CallbackSequence::END) { + void add(TYPE* pointer, void (OBJECT::*pmf)(A1, A2) const,Location where=CallbackSequence::END) { checkTypes(typeid(TYPE), typeid(OBJECT), dynamic_cast<OBJECT*>(pointer)); add(Callback(pointer).make(pmf),where); } @@ -465,7 +470,7 @@ namespace DD4hep { } /// Execution overload for callbacks with 1 argument template <typename A0> inline - void CallbackSequence::operator()(A0 a0) const { + void CallbackSequence::operator()(A0 a0) const { if (!callbacks.empty()) { const void* args[1] = { a0 }; for (Callbacks::const_iterator i = callbacks.begin(); i != callbacks.end(); ++i) @@ -474,7 +479,7 @@ namespace DD4hep { } /// Execution overload for callbacks with 2 arguments template <typename A0, typename A1> inline - void CallbackSequence::operator()(A0 a0, A1 a1) const { + void CallbackSequence::operator()(A0 a0, A1 a1) const { if (!callbacks.empty()) { const void* args[2] = { a0, a1 }; for (Callbacks::const_iterator i = callbacks.begin(); i != callbacks.end(); ++i) @@ -483,7 +488,7 @@ namespace DD4hep { } /// Execution overload for callbacks with 3 arguments template <typename A0, typename A1, typename A2> inline - void CallbackSequence::operator()(A0 a0, A1 a1, A2 a2) const { + void CallbackSequence::operator()(A0 a0, A1 a1, A2 a2) const { if (!callbacks.empty()) { const void* args[3] = { a0, a1, a2 }; for (Callbacks::const_iterator i = callbacks.begin(); i != callbacks.end(); ++i) diff --git a/DDCore/include/DD4hep/ConditionTypes.h b/DDCore/include/DD4hep/ConditionTypes.h index 879432e2d48600d2933ebdedbf6d35c8d0c7d766..45de0fff0d23e829b522f0d0c77ae2df711f18ed 100644 --- a/DDCore/include/DD4hep/ConditionTypes.h +++ b/DDCore/include/DD4hep/ConditionTypes.h @@ -1,3 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== -#define DD4HEP_INSTANTIATE_GRAMMAR_TYPE(x) namespace DD4hep { \ - template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> s; return s;}} +#define DD4HEP_INSTANTIATE_GRAMMAR_TYPE(x) \ +namespace DD4hep {template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> s; return s;}} diff --git a/DDCore/include/DD4hep/Conditions.h b/DDCore/include/DD4hep/Conditions.h index aa3a738d9a33d5984a6caab7b615f15f2e26ae62..5df198dbdbe66193a9f756ef4fba80be52ec8416 100644 --- a/DDCore/include/DD4hep/Conditions.h +++ b/DDCore/include/DD4hep/Conditions.h @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_CONDITION_H #define DD4HEP_GEOMETRY_CONDITION_H diff --git a/DDCore/include/DD4hep/DD4hepRootPersistency.h b/DDCore/include/DD4hep/DD4hepRootPersistency.h index 33592496de27509244c8dee2a2fd2c6075abbb53..2b4d01e1dbd5c818e2ee03b254b8e2fdd98c8247 100644 --- a/DDCore/include/DD4hep/DD4hepRootPersistency.h +++ b/DDCore/include/DD4hep/DD4hepRootPersistency.h @@ -1,12 +1,16 @@ // $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DD4HEPROOTPERSISTENCY_H #define DD4HEP_DD4HEPROOTPERSISTENCY_H @@ -15,9 +19,9 @@ /// Helper class to support ROOT persistency of LCDD objects class DD4hepRootPersistency : public TNamed, public DD4hep::Geometry::LCDDData { - public: +public: /// Default constructor - DD4hepRootPersistency() : TNamed() {} + DD4hepRootPersistency() : TNamed() {} /// Default destructor virtual ~DD4hepRootPersistency() {} diff --git a/DDCore/include/DD4hep/DD4hepUnits.h b/DDCore/include/DD4hep/DD4hepUnits.h index 49dc41cdd369b7bc4b09b2cb9bcc35d7ff8984b8..d87e962b7d2dbdbfd62da09b3bb08972e34d01db 100644 --- a/DDCore/include/DD4hep/DD4hepUnits.h +++ b/DDCore/include/DD4hep/DD4hepUnits.h @@ -1,3 +1,17 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + // // System of Units for DD4hep - similar to Geant3 and TGeo/ROOT // diff --git a/DDCore/include/DD4hep/DetFactoryHelper.h b/DDCore/include/DD4hep/DetFactoryHelper.h index bb56089c7116c8e869afc47fc6e8b60c5a777179..e7cd3f90e2b84424d59013a7e06ac9d1d0970810 100644 --- a/DDCore/include/DD4hep/DetFactoryHelper.h +++ b/DDCore/include/DD4hep/DetFactoryHelper.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4hep_DETECTOR_DETFACTORYHELPER_H #define DD4hep_DETECTOR_DETFACTORYHELPER_H diff --git a/DDCore/include/DD4hep/Detector.h b/DDCore/include/DD4hep/Detector.h index 09e7af733da83760e670d423ef35dbf676eb520c..1a4d6aa1e496e97c8d8065c11c880578b289834a 100644 --- a/DDCore/include/DD4hep/Detector.h +++ b/DDCore/include/DD4hep/Detector.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DETECTOR_H #define DD4HEP_DETECTOR_H @@ -64,28 +70,28 @@ namespace DD4hep { public: /// Default constructor - SensitiveDetector() - : RefObject() { + SensitiveDetector() + : RefObject() { } /// Constructor to copy handled object - SensitiveDetector(Object* obj_pointer) - : RefObject(obj_pointer) { + SensitiveDetector(Object* obj_pointer) + : RefObject(obj_pointer) { } /// Copy from named handle - SensitiveDetector(const RefObject& sd) - : RefObject(sd) { + SensitiveDetector(const RefObject& sd) + : RefObject(sd) { } /// Copy from handle - SensitiveDetector(const SensitiveDetector& sd) - : RefObject(sd) { + SensitiveDetector(const SensitiveDetector& sd) + : RefObject(sd) { } /// Templated constructor for handle conversions template <typename Q> - SensitiveDetector(const Handle<Q>& e) + SensitiveDetector(const Handle<Q>& e) : RefObject(e) { } @@ -231,13 +237,13 @@ namespace DD4hep { public: /// Default constructor - DetElement() - : RefObject() { + DetElement() + : RefObject() { } /// Constructor to hold handled object - DetElement(Object* object_ptr) - : RefObject(object_ptr) { + DetElement(Object* object_ptr) + : RefObject(object_ptr) { } /// Clone constructor @@ -249,14 +255,14 @@ namespace DD4hep { } /// Constructor to copy handle - DetElement(const DetElement& e) - : RefObject(e) { + DetElement(const DetElement& e) + : RefObject(e) { } #ifdef __MAKECINT__ /// Constructor to copy handle - DetElement(const Ref_t& e) - : RefObject(e) { + DetElement(const Ref_t& e) + : RefObject(e) { } #endif /// Constructor for a new subdetector element @@ -306,8 +312,8 @@ namespace DD4hep { } /// Extend the detector element with an arbitrary callback template <typename Q, typename T> - void callAtUpdate(unsigned int typ, Q* pointer, - void (T::*pmf)(unsigned long typ, DetElement& det, void* opt_par)) const + void callAtUpdate(unsigned int typ, Q* pointer, + void (T::*pmf)(unsigned long typ, DetElement& det, void* opt_par)) const { CallbackSequence::checkTypes(typeid(T), typeid(Q), dynamic_cast<T*>(pointer)); i_addUpdateCall(typ, Callback(pointer).make(pmf)); diff --git a/DDCore/include/DD4hep/DetectorTools.h b/DDCore/include/DD4hep/DetectorTools.h index 92c88433ece9d9ce17befa54f76661ae857d3694..9fe9b0534f5176e8443b117f24ec49e911fb1486 100644 --- a/DDCore/include/DD4hep/DetectorTools.h +++ b/DDCore/include/DD4hep/DetectorTools.h @@ -1,11 +1,17 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEOMETRY_DETECTORTOOLS_H #define DD4HEP_GEOMETRY_DETECTORTOOLS_H diff --git a/DDCore/include/DD4hep/Dictionary.h b/DDCore/include/DD4hep/Dictionary.h index 083e661f7fc3f265de3c3c3d329299d13a6082d0..82761a173c4d8cc7ea6a2f6a67ddd8d2a8daef55 100644 --- a/DDCore/include/DD4hep/Dictionary.h +++ b/DDCore/include/DD4hep/Dictionary.h @@ -1,9 +1,19 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // // LinkDef.h // // // Created by Pere Mato on 22/1/12. -// Copyright 2012 __MyCompanyName__. All rights reserved. +// +//========================================================================== // #ifndef DD4HEP_GEOMETRY_DICTIONARY_H diff --git a/DDCore/include/DD4hep/Exceptions.h b/DDCore/include/DD4hep/Exceptions.h index 5e9c5389df10551e15bbc85b5c41e6c0e48f1230..a1e9464cbf1d846d87bce4926106b8afd222a907 100644 --- a/DDCore/include/DD4hep/Exceptions.h +++ b/DDCore/include/DD4hep/Exceptions.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDCORE_EXCEPTIONS_H #define DD4HEP_DDCORE_EXCEPTIONS_H @@ -25,8 +31,8 @@ namespace DD4hep { */ struct unrelated_type_error : public std::runtime_error { static std::string msg(const std::type_info& typ1, const std::type_info& typ2, const std::string& text); - unrelated_type_error(const std::type_info& typ1, const std::type_info& typ2, const std::string& text = "") - : std::runtime_error(msg(typ1, typ2, text)) { + unrelated_type_error(const std::type_info& typ1, const std::type_info& typ2, const std::string& text = "") + : std::runtime_error(msg(typ1, typ2, text)) { } }; @@ -38,8 +44,8 @@ namespace DD4hep { */ struct unrelated_value_error : public std::runtime_error { static std::string msg(const std::type_info& typ, const std::string& text); - unrelated_value_error(const std::type_info& typ, const std::string& text = "") - : std::runtime_error(msg(typ, text)) { + unrelated_value_error(const std::type_info& typ, const std::string& text = "") + : std::runtime_error(msg(typ, text)) { } }; diff --git a/DDCore/include/DD4hep/Factories.h b/DDCore/include/DD4hep/Factories.h index 04a372779a22a5fd13fa1882b56c68e83e983b67..6b9ec9b84b29c0644aba43362925a4b7aad9846d 100644 --- a/DDCore/include/DD4hep/Factories.h +++ b/DDCore/include/DD4hep/Factories.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_FACTORIES_H #define DD4HEP_FACTORIES_H @@ -32,220 +37,165 @@ namespace DD4hep { class LCDD; class SensitiveDetector; class DetElement; - - /// Template class with a generic constructor signature - /** - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class ConstructionFactory { - public: - static void* create(const char* arg); - }; - - /// Template class with a generic signature to apply LCDD plugins - /** - * Specialized factory to translate objects, which can be retrieved from LCDD - * Example: Translate DD4hep geometry to Geant4 - * - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class ApplyFactory { - public: - static long create(LCDD& lcdd, int argc, char** argv); - }; - - /// Specialized factory to translate objects, which can be retrieved from LCDD - /** - * Example: Translate DD4hep geometry to Geant4 - * - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class TranslationFactory { - public: - static Ref_t create(LCDD& lcdd); - }; - - /// Create an arbitrary object from it's XML representation. - /** - * - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class XMLElementFactory { - public: - static Ref_t create(LCDD& lcdd, XML::Handle_t e); - }; - - /// Read an arbitrary XML document and analyze it's content - /** - * - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class XMLDocumentReaderFactory { - public: - static long create(LCDD& lcdd, XML::Handle_t e); - }; - - /// Read an arbitrary XML document and analyze it's content - /** - * - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class XMLConversionFactory { - public: - static long create(LCDD& lcdd, Ref_t& handle, XML::Handle_t element); - }; - - /// Standard factory to create Detector elements from the compact XML representation. - /** - * - * \author M.Frank - * \version 1.0 - * \date 2012/07/31 - * \ingroup DD4HEP_GEOMETRY - */ - template <typename T> class DetElementFactory { - public: - static Ref_t create(LCDD& lcdd, XML::Handle_t e, Ref_t sens); - }; } -} - -namespace { - /// Base factory template - template <typename P, typename S> class Factory; + + /// Template class with a generic constructor signature + /** + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class ConstructionFactory { + public: + static void* create(const char* arg); + }; - template <typename P> class Factory<P, void*(const char*)> { + /// Template class with a generic signature to apply LCDD plugins + /** + * Specialized factory to translate objects, which can be retrieved from LCDD + * Example: Translate DD4hep geometry to Geant4 + * + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class ApplyFactory : public PluginFactoryBase { public: - static void Func(void *ret, void*, const std::vector<void*>& arg, void*) { - *(void**) ret = DD4hep::Geometry::ConstructionFactory<P>::create((const char*) arg[0]); - } + static long create(lcdd_t& lcdd, int argc, char** argv); }; - template <typename P> class Factory<P, DD4hep::NamedObject*(DD4hep::Geometry::LCDD*)> { + /// Specialized factory to translate objects, which can be retrieved from LCDD + /** + * Example: Translate DD4hep geometry to Geant4 + * + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class TranslationFactory : public PluginFactoryBase { public: - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::Geometry::Ref_t Ref_t; - static void Func(void *retaddr, void*, const std::vector<void*>& arg, void*) { - LCDD* lcdd = (LCDD*) arg[0]; - Ref_t handle = DD4hep::Geometry::TranslationFactory<P>::create(*lcdd); - *(void**) retaddr = handle.ptr(); - } + static ref_t create(lcdd_t& lcdd); }; - template <typename P> class Factory<P, long(DD4hep::Geometry::LCDD*, int, char**)> { + /// Create an arbitrary object from it's XML representation. + /** + * + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class XMLElementFactory : public PluginFactoryBase { public: - typedef DD4hep::Geometry::LCDD LCDD; - static void Func(void *retaddr, void*, const std::vector<void*>& arg, void*) { - LCDD* lcdd = (LCDD*) arg[0]; - long handle = DD4hep::Geometry::ApplyFactory<P>::create(*lcdd, *(int*) arg[1], (char**) arg[2]); - new (retaddr) (long)(handle); - } + static ref_t create(lcdd_t& lcdd, xml_h e); }; - template <typename P> class Factory<P, DD4hep::NamedObject*(DD4hep::Geometry::LCDD*, DD4hep::XML::Handle_t*)> { + /// Read an arbitrary XML document and analyze it's content + /** + * + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class XMLDocumentReaderFactory : public PluginFactoryBase { public: - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::XML::Handle_t xml_h; - typedef DD4hep::Geometry::Ref_t Ref_t; - static void Func(void *retaddr, void*, const std::vector<void*>& arg, void*) { - LCDD* lcdd = (LCDD*) arg[0]; - xml_h* elt = (xml_h*) arg[1]; - Ref_t handle = DD4hep::Geometry::XMLElementFactory<P>::create(*lcdd, *elt); - *(void**) retaddr = handle.ptr(); - } + static long create(lcdd_t& lcdd, xml_h e); }; - template <typename P> class Factory<P, long(DD4hep::Geometry::LCDD*, DD4hep::XML::Handle_t*)> { + /// Read an arbitrary XML document and analyze it's content + /** + * + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class XMLConversionFactory : public PluginFactoryBase { public: - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::XML::Handle_t xml_h; - static void Func(void *retaddr, void*, const std::vector<void*>& arg, void*) { - LCDD* lcdd = (LCDD*) arg[0]; - xml_h* elt = (xml_h*) arg[1]; - long ret = DD4hep::Geometry::XMLDocumentReaderFactory<P>::create(*lcdd, *elt); - new (retaddr) (long)(ret); - } + static long create(lcdd_t& lcdd, ref_t& handle, xml_h element); }; - template <typename P> class Factory<P, DD4hep::NamedObject*(DD4hep::Geometry::LCDD*, DD4hep::XML::Handle_t*, DD4hep::Geometry::Ref_t*)> { + /// Standard factory to create Detector elements from the compact XML representation. + /** + * + * \author M.Frank + * \version 1.0 + * \date 2012/07/31 + * \ingroup DD4HEP_GEOMETRY + */ + template <typename T> class DetElementFactory : public PluginFactoryBase { public: - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::XML::Handle_t xml_h; - typedef DD4hep::Geometry::Ref_t Ref_t; - static void Func(void *retaddr, void*, const std::vector<void*>& arg, void*) { - LCDD* lcdd = (LCDD*) arg[0]; - xml_h* elt = (xml_h*) arg[1]; - Ref_t* sens = (Ref_t*) arg[2]; - Ref_t handle = DD4hep::Geometry::DetElementFactory<P>::create(*lcdd, *elt, *sens); - *(void**) retaddr = handle.ptr(); - } + static Geometry::Ref_t create(Geometry::LCDD& lcdd, XML::Handle_t e, Geometry::Ref_t sens); }; } -#define DECLARE_DETELEMENT_FACTORY(x) \ - DD4HEP_PLUGINSVC_FACTORY(x,x,DD4hep::NamedObject*(DD4hep::Geometry::LCDD*,DD4hep::XML::Handle_t*,DD4hep::Geometry::Ref_t*),__LINE__) -#define DECLARE_NAMESPACE_DETELEMENT_FACTORY(n,x) \ - DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(DD4hep::Geometry::LCDD*,DD4hep::XML::Handle_t*,DD4hep::Geometry::Ref_t*),__LINE__) -#define DECLARE_NAMED_APPLY_FACTORY(n,x) \ - DD4HEP_PLUGINSVC_FACTORY(n::x,x,long(DD4hep::Geometry::LCDD*,int, char**),__LINE__) -#define DECLARE_NAMED_TRANSLATION_FACTORY(n,x) \ - DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(DD4hep::Geometry::LCDD*),__LINE__) -#define DECLARE_NAMED_XMLELEMENT_FACTORY(n,x) \ - DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(DD4hep::Geometry::LCDD*,DD4hep::XML::Handle_t*),__LINE__) -#define DECLARE_NAMED_DETELEMENT_FACTORY(n,x) \ - DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(DD4hep::Geometry::LCDD*,DD4hep::XML::Handle_t*,DD4hep::Geometry::Ref_t*),__LINE__) - -#define DECLARE_APPLY(name,func) \ - namespace DD4hep { namespace Geometry { namespace { struct name {}; } \ - template <> long ApplyFactory<name>::create(DD4hep::Geometry::LCDD& l,int n,char** a) {return func(l,n,a);} }} \ - DD4HEP_PLUGINSVC_FACTORY(DD4hep::Geometry::name,name,long(DD4hep::Geometry::LCDD*,int,char**),__LINE__) - -#define DECLARE_CONSTRUCTOR(name,func) \ - namespace DD4hep { namespace Geometry { namespace { struct name {}; } \ - template <> void* ConstructionFactory<name>::create(const char* n) { return func(n);}}} \ - DD4HEP_PLUGINSVC_FACTORY(DD4hep::Geometry::name,name,void*(const char*),__LINE__) - -#define DECLARE_TRANSLATION(name,func) \ - namespace DD4hep { namespace Geometry { namespace { struct name {}; } \ - template <> DD4hep::Geometry::Ref_t TranslationFactory<name>::create(DD4hep::Geometry::LCDD& l) {return func(l);} }} \ - using DD4hep::Geometry::name; \ - DECLARE_NAMED_TRANSLATION_FACTORY(DD4hep::Geometry,name) - -#define DECLARE_XMLELEMENT(name,func) \ - namespace DD4hep { namespace Geometry { namespace { struct xml_element_##name {}; } \ - template <> DD4hep::Geometry::Ref_t XMLElementFactory<DD4hep::Geometry::xml_element_##name>::create(DD4hep::Geometry::LCDD& l,DD4hep::XML::Handle_t e) {return func(l,e);} }} \ - using DD4hep::Geometry::xml_element_##name; \ - DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,DD4hep::NamedObject*(DD4hep::Geometry::LCDD*,DD4hep::XML::Handle_t*),__LINE__) - -#define DECLARE_XML_DOC_READER(name,func) \ - namespace DD4hep { namespace Geometry { namespace { struct xml_document_##name {}; } \ - template <> long XMLDocumentReaderFactory<DD4hep::Geometry::xml_document_##name>::create(DD4hep::Geometry::LCDD& l,DD4hep::XML::Handle_t e) {return func(l,e);} }} \ - using DD4hep::Geometry::xml_document_##name; \ - DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(DD4hep::Geometry::LCDD*,DD4hep::XML::Handle_t*),__LINE__) - -#define DECLARE_XML_PROCESSOR_BASIC(name,func,deprecated) \ - namespace DD4hep { namespace Geometry { struct det_element_##name {}; \ - template <> DD4hep::Geometry::Ref_t DetElementFactory< DD4hep::Geometry::det_element_##name >::create(DD4hep::Geometry::LCDD& l,DD4hep::XML::Handle_t e,DD4hep::Geometry::Ref_t h){ if (deprecated) warning_deprecated_xml_factory(#name); return func(l,e,h);}} } \ - using DD4hep::Geometry::det_element_##name; \ - DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,DD4hep::NamedObject*(DD4hep::Geometry::LCDD*,DD4hep::XML::Handle_t*,DD4hep::Geometry::Ref_t*),__LINE__) +namespace { + + /// Forward declartion of the base factory template + template <typename P, typename S> class Factory; + + struct ns { + typedef DD4hep::NamedObject Named; + typedef DD4hep::Geometry::LCDD LCDD; + typedef DD4hep::XML::Handle_t xml_h; + typedef DD4hep::Geometry::Ref_t ref_t; + }; + + DD4HEP_PLUGIN_FACTORY_ARGS_1(void*,const char*) + { return DD4hep::ConstructionFactory<P>::create(a0); } + DD4HEP_PLUGIN_FACTORY_ARGS_1(ns::Named*,ns::LCDD*) + { return DD4hep::TranslationFactory<P>::create(*a0).ptr(); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(long,ns::LCDD*,int,char**) + { return make_return<long>(DD4hep::ApplyFactory<P>::create(*a0,a1,a2)); } + DD4HEP_PLUGIN_FACTORY_ARGS_2(ns::Named*,ns::LCDD*,ns::xml_h*) + { return DD4hep::XMLElementFactory<P>::create(*a0,*a1).ptr(); } + DD4HEP_PLUGIN_FACTORY_ARGS_2(long,ns::LCDD*,ns::xml_h*) + { return make_return<long>(DD4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1)); } + DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,ns::LCDD*,ns::xml_h*,ns::ref_t*) + { return DD4hep::DetElementFactory<P>::create(*a0,*a1,*a2).ptr(); } +} + +#define DECLARE_DETELEMENT_FACTORY(x) namespace DD4hep \ + { DD4HEP_PLUGINSVC_FACTORY(x,x,DD4hep::NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } +#define DECLARE_NAMESPACE_DETELEMENT_FACTORY(n,x) namespace DD4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } +#define DECLARE_NAMED_APPLY_FACTORY(n,x) namespace DD4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,long(Geometry::LCDD*,int, char**),__LINE__) } +#define DECLARE_NAMED_TRANSLATION_FACTORY(n,x) namespace DD4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(Geometry::LCDD*),__LINE__) } +#define DECLARE_NAMED_XMLELEMENT_FACTORY(n,x) namespace DD4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(Geometry::LCDD*,XML::Handle_t*),__LINE__) } +#define DECLARE_NAMED_DETELEMENT_FACTORY(n,x) namespace DD4hep \ + { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } + +#define DECLARE_APPLY(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ + template <> long ApplyFactory<name>::create(lcdd_t& l,int n,char** a) {return func(l,n,a);} \ + DD4HEP_PLUGINSVC_FACTORY(name,name,long(Geometry::LCDD*,int,char**),__LINE__)} + +#define DECLARE_CONSTRUCTOR(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ + template <> void* ConstructionFactory<name>::create(const char* n) { return func(n);} \ + DD4HEP_PLUGINSVC_FACTORY(name,name,void*(const char*),__LINE__) } + +#define DECLARE_TRANSLATION(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,name) { \ + template <> Geometry::Ref_t TranslationFactory<name>::create(lcdd_t& l) {return func(l);} \ + DECLARE_NAMED_TRANSLATION_FACTORY(Geometry,name) } + +#define DECLARE_XMLELEMENT(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_element_##name) {\ + template <> Geometry::Ref_t XMLElementFactory<xml_element_##name>::create(lcdd_t& l,xml_h e) {return func(l,e);} \ + DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,NamedObject*(Geometry::LCDD*,XML::Handle_t*),__LINE__) } + +#define DECLARE_XML_DOC_READER(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_document_##name) { \ + template <> long XMLDocumentReaderFactory<xml_document_##name>::create(lcdd_t& l,xml_h e) {return func(l,e);} \ + DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(Geometry::LCDD*,XML::Handle_t*),__LINE__) } + +#define DECLARE_XML_PROCESSOR_BASIC(name,func,deprecated) DD4HEP_OPEN_PLUGIN(DD4hep,det_element_##name) {\ + template <> Geometry::Ref_t DetElementFactory< det_element_##name >::create(lcdd_t& l,xml_h e,ref_t h) \ + { if (deprecated) warning_deprecated_xml_factory(#name); return func(l,e,h);} \ + DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) } #define DECLARE_XML_PROCESSOR(name,func) DECLARE_XML_PROCESSOR_BASIC(name,func,0) #define DECLARE_SUBDETECTOR(name,func) DECLARE_XML_PROCESSOR_BASIC(name,func,0) @@ -253,3 +203,4 @@ namespace { #define DECLARE_DEPRECATED_DETELEMENT(name,func) DECLARE_XML_PROCESSOR_BASIC(name,func,1) #endif // DD4HEP_FACTORIES_H + diff --git a/DDCore/include/DD4hep/FieldTypes.h b/DDCore/include/DD4hep/FieldTypes.h index 7934938feb53c576c119c63cfb570132a10c6ca3..0439f7272cbf507a18d0b0efe7ab2c93c146c5cf 100644 --- a/DDCore/include/DD4hep/FieldTypes.h +++ b/DDCore/include/DD4hep/FieldTypes.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_FIELDTYPES_H #define DD4HEP_GEOMETRY_FIELDTYPES_H @@ -36,8 +41,8 @@ namespace DD4hep { Direction direction; public: /// Initializing constructor - ConstantField() - : direction() { + ConstantField() + : direction() { } /// Call to access the field components at a given location virtual void fieldComponents(const double* /* pos */, double* field); diff --git a/DDCore/include/DD4hep/Fields.h b/DDCore/include/DD4hep/Fields.h index a8a200160f008802cfd4c6718378620edf3aa16b..5a0962462c190c449e2bc6efc404f578262b8b47 100644 --- a/DDCore/include/DD4hep/Fields.h +++ b/DDCore/include/DD4hep/Fields.h @@ -1,12 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_FIELDS_H #define DD4HEP_GEOMETRY_FIELDS_H @@ -69,13 +73,13 @@ namespace DD4hep { }; /// Default constructor - CartesianField() - : Ref_t() { + CartesianField() + : Ref_t() { } /// Constructor to be used when reading the already parsed DOM tree - CartesianField(const CartesianField& e) - : Ref_t(e) { + CartesianField(const CartesianField& e) + : Ref_t(e) { } /// Constructor to be used when reading the already parsed DOM tree @@ -162,13 +166,13 @@ namespace DD4hep { }; /// Default constructor - OverlayedField() - : Ref_t() { + OverlayedField() + : Ref_t() { } /// Constructor to be used when reading the already parsed DOM tree template <typename Q> - OverlayedField(const Handle<Q>& e) + OverlayedField(const Handle<Q>& e) : Ref_t(e) { } diff --git a/DDCore/include/DD4hep/GeoHandler.h b/DDCore/include/DD4hep/GeoHandler.h index 161e24c72f4129ae318f5455fb7fe6d947d7f074..4dcbd01a83461a49040299bc3e4fd9d3f169d3c2 100644 --- a/DDCore/include/DD4hep/GeoHandler.h +++ b/DDCore/include/DD4hep/GeoHandler.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOHANDLER_H #define DD4HEP_GEOHANDLER_H diff --git a/DDCore/include/DD4hep/Handle.h b/DDCore/include/DD4hep/Handle.h index 361045121e5f94033c0fc2d8f7ea3160549d0f82..7f0015e7ccbf411e5f65f36368f5a53589505044 100644 --- a/DDCore/include/DD4hep/Handle.h +++ b/DDCore/include/DD4hep/Handle.h @@ -1,12 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_ELEMENTS_H #define DD4HEP_ELEMENTS_H #include "DD4hep/config.h" @@ -58,7 +62,7 @@ namespace DD4hep { std::string _ptrToString(const void* p, const char* fmt = "%p"); /// Format any pointer (64 bits) to string \ingroup DD4HEP_XML template <typename T> std::string _toString(const T* p, const char* fmt = "%p") - { return _ptrToString((void*)p, fmt); } + { return _ptrToString((void*)p, fmt); } /// String conversions: string to boolean value \ingroup DD4HEP_GEOMETRY bool _toBool(const std::string& value); @@ -197,16 +201,16 @@ namespace DD4hep { /// Single and only data member: Reference to the actual element. T* m_element; /// Defaulot constructor - Handle() - : m_element(0) { + Handle() + : m_element(0) { } /// Initializing constructor from pointer - Handle(T* e) - : m_element(e) { + Handle(T* e) + : m_element(e) { } /// Copy constructor - Handle(const Handle<T>& e) - : m_element(e.m_element) { + Handle(const Handle<T>& e) + : m_element(e.m_element) { } /// Initializing constructor from unrelated pointer with type checking template <typename Q> Handle(Q* e) @@ -316,8 +320,8 @@ namespace DD4hep { template <typename M> class DestroyHandles { public: M& object; - DestroyHandles(M& m) - : object(m) { + DestroyHandles(M& m) + : object(m) { } ~DestroyHandles() { object.clear(); diff --git a/DDCore/include/DD4hep/Handle.inl b/DDCore/include/DD4hep/Handle.inl index f924506e300d30c7719d75afaa9e0debd5303a0c..1d9ef3c7023116a66919777a65d9aef361665610 100644 --- a/DDCore/include/DD4hep/Handle.inl +++ b/DDCore/include/DD4hep/Handle.inl @@ -1,11 +1,16 @@ -// $Id: Handle.h 1059 2014-04-04 20:24:53Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Handle.h" diff --git a/DDCore/include/DD4hep/IDDescriptor.h b/DDCore/include/DD4hep/IDDescriptor.h index 9c18c039f718da15c0c9a25380be8c97838b00ff..d1b5e42b710b7736d51dec19cbf50132e0c30d6f 100644 --- a/DDCore/include/DD4hep/IDDescriptor.h +++ b/DDCore/include/DD4hep/IDDescriptor.h @@ -1,12 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - +// Author : M.Frank +// +//========================================================================== #ifndef DD4hep_IDDESCRIPTOR_H #define DD4hep_IDDESCRIPTOR_H @@ -49,8 +53,8 @@ namespace DD4hep { public: /// Default constructor - IDDescriptor() - : Handle<Object>() { + IDDescriptor() + : Handle<Object>() { } /// Constructor to be used when reading the already parsed object template <typename Q> IDDescriptor(const Handle<Q>& e) diff --git a/DDCore/include/DD4hep/InstanceCount.h b/DDCore/include/DD4hep/InstanceCount.h index 6b200b641a4e5ab04094f3e683fbb25d9bc61051..970898557e881d14a835ef90484e4f2cbf33eb9e 100644 --- a/DDCore/include/DD4hep/InstanceCount.h +++ b/DDCore/include/DD4hep/InstanceCount.h @@ -1,11 +1,16 @@ -// $Id: InstanceCount.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_INSTANCECOUNT_H #define DD4HEP_GEOMETRY_INSTANCECOUNT_H @@ -50,12 +55,12 @@ namespace DD4hep { counter_t m_max; public: /// Default constructor - Counter() - : m_count(0), m_tot(0), m_max(0) { + Counter() + : m_count(0), m_tot(0), m_max(0) { } /// Copy constructor - Counter(const Counter& c) - : m_count(c.m_count), m_tot(c.m_tot), m_max(c.m_max) { + Counter(const Counter& c) + : m_count(c.m_count), m_tot(c.m_tot), m_max(c.m_max) { } /// Destructor ~Counter() { diff --git a/DDCore/include/DD4hep/LCDD.h b/DDCore/include/DD4hep/LCDD.h index 59a26183036f34d517187236e8280b0f04b365e1..7ab6a0a61d43723ae6967c30f790f3cb1adc1244 100644 --- a/DDCore/include/DD4hep/LCDD.h +++ b/DDCore/include/DD4hep/LCDD.h @@ -1,12 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_LCDD_LCDD_H #define DD4HEP_LCDD_LCDD_H @@ -134,27 +138,27 @@ namespace DD4hep { /// Accessor to the map of ID specifications virtual const HandleMap& idSpecifications() const = 0; - #ifndef __MAKECINT__ +#ifndef __MAKECINT__ /** Access to predefined caches of subdetectors according to the sensitive type */ /// Access a set of subdetectors according to the sensitive type. /** - Please note: - - The sensitive type of a detector is set in the 'detector constructor'. - - Not sensitive detector structures have the name 'passive' - - Compounds (ie. nested detectors) are of type 'compound' - */ + Please note: + - The sensitive type of a detector is set in the 'detector constructor'. + - Not sensitive detector structures have the name 'passive' + - Compounds (ie. nested detectors) are of type 'compound' + */ virtual const std::vector<DetElement>& detectors(const std::string& type) = 0; /// Access a set of subdetectors according to several sensitive types. virtual std::vector<DetElement> detectors(const std::string& type1, - const std::string& type2, - const std::string& type3="", - const std::string& type4="", - const std::string& type5="" ) = 0; + const std::string& type2, + const std::string& type3="", + const std::string& type4="", + const std::string& type5="" ) = 0; /// Access the availible detector types virtual std::vector<std::string> detectorTypes() const = 0; - #endif +#endif /** Miscaneleous accessors to the detexctor description */ diff --git a/DDCore/include/DD4hep/LCDDData.h b/DDCore/include/DD4hep/LCDDData.h index 081c1705dcca38f19ddc21eb0a46079652b5cec1..24b1766e325a3ba8102254e0a399dcb7ed25f786 100644 --- a/DDCore/include/DD4hep/LCDDData.h +++ b/DDCore/include/DD4hep/LCDDData.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDCORE_LCDDDATA_H #define DD4HEP_DDCORE_LCDDDATA_H @@ -43,8 +48,8 @@ namespace DD4hep { * \ingroup DD4HEP_GEOMETRY */ struct InvalidObjectError: public std::runtime_error { - InvalidObjectError(const std::string& msg) - : std::runtime_error("DD4hep: " + msg) { + InvalidObjectError(const std::string& msg) + : std::runtime_error("DD4hep: " + msg) { } }; diff --git a/DDCore/include/DD4hep/LCDDHelper.h b/DDCore/include/DD4hep/LCDDHelper.h index 4c538981f607d7233f8ff245475fb72904dda2e1..ad1d2de4c1da68154ca94c9203e0ed871b6143c6 100644 --- a/DDCore/include/DD4hep/LCDDHelper.h +++ b/DDCore/include/DD4hep/LCDDHelper.h @@ -1,11 +1,16 @@ -// $Id: Handle.h 1679 2015-03-27 15:24:39Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_LCDDHELPER_H #define DD4HEP_LCDDHELPER_H diff --git a/DDCore/include/DD4hep/LCDDLoad.h b/DDCore/include/DD4hep/LCDDLoad.h index 2d5051880bf697de1dde42a97b526082d3e6a98f..d229168265d43561b9b26f1badd61ebb4d53fcbd 100644 --- a/DDCore/include/DD4hep/LCDDLoad.h +++ b/DDCore/include/DD4hep/LCDDLoad.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDCORE_LCDDLOAD_H #define DD4HEP_DDCORE_LCDDLOAD_H diff --git a/DDCore/include/DD4hep/MatrixHelpers.h b/DDCore/include/DD4hep/MatrixHelpers.h index 564bdfbf539f736622d2126075ad75e4648d1931..efe916b9719e46016dd79014c92c3437e39b7f20 100644 --- a/DDCore/include/DD4hep/MatrixHelpers.h +++ b/DDCore/include/DD4hep/MatrixHelpers.h @@ -1,11 +1,16 @@ -// $Id: Handle.cpp 575 2013-05-17 20:41:52Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_IMP_MATRIXHELPERS_H #define DD4HEP_IMP_MATRIXHELPERS_H diff --git a/DDCore/include/DD4hep/Memory.h b/DDCore/include/DD4hep/Memory.h index 175cee294f5976bf8c573dd641f184e4780060b1..f26da6727de91e7130c4a55730bc466f4b22e1a0 100644 --- a/DDCore/include/DD4hep/Memory.h +++ b/DDCore/include/DD4hep/Memory.h @@ -1,11 +1,17 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_MEMORY_H #define DD4HEP_MEMORY_H @@ -28,32 +34,32 @@ namespace DD4hep { * \ingroup DD4HEP_GEOMETRY */ template <typename T> class dd4hep_ptr -#if __cplusplus >= 201103L && ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) +#if defined(DD4HEP_NEVER) && __cplusplus >= 201103L && ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) : public std::unique_ptr<T> { - public: - typedef std::unique_ptr<T> base_t; + public: + typedef std::unique_ptr<T> base_t; #else - : public std::auto_ptr<T> { - public: - typedef std::auto_ptr<T> base_t; - void swap(base_t& c) { - this->base_t::operator=(base_t(c.release())); - } + : public std::auto_ptr<T> { + public: + typedef std::auto_ptr<T> base_t; + void swap(base_t& c) { + this->base_t::operator=(base_t(c.release())); + } #endif - /// Default Constructor. - dd4hep_ptr() : base_t() {} - /// Constructor from pointer - dd4hep_ptr(T* p) : base_t(p) {} - /// Constructor from copy - dd4hep_ptr(base_t& c) : base_t(c) {} - /// Assignment operator - dd4hep_ptr& operator=(base_t& c) { - if ( this != &c ) { - this->swap(c); - } - return *this; - } - }; -} + /// Default Constructor. + dd4hep_ptr() : base_t() {} + /// Constructor from pointer + dd4hep_ptr(T* p) : base_t(p) {} + /// Constructor from copy + dd4hep_ptr(base_t& c) : base_t(c) {} + /// Assignment operator + dd4hep_ptr& operator=(base_t& c) { + if ( this != &c ) { + this->swap(c); + } + return *this; + } + }; + } #endif // DD4HEP_MEMORY_H diff --git a/DDCore/include/DD4hep/NamedObject.h b/DDCore/include/DD4hep/NamedObject.h index c798f76e2d7506cc70df6ce1ea3a322b65661401..22e525c07cd96f4a13826d3814e8c217718ecffe 100644 --- a/DDCore/include/DD4hep/NamedObject.h +++ b/DDCore/include/DD4hep/NamedObject.h @@ -1,11 +1,17 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEOMETRY_INTERNAL_NAMEDOBJECT_H #define DD4HEP_GEOMETRY_INTERNAL_NAMEDOBJECT_H diff --git a/DDCore/include/DD4hep/ObjectExtensions.h b/DDCore/include/DD4hep/ObjectExtensions.h index b40b3af5a6e7e41cac5c6cd16c7167b4771eaebf..0f24fbd05f20500d996a5a835c1f238b28512867 100644 --- a/DDCore/include/DD4hep/ObjectExtensions.h +++ b/DDCore/include/DD4hep/ObjectExtensions.h @@ -1,11 +1,16 @@ -// $Id: Detector.h 1087 2014-04-09 12:25:51Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_OBJECTEXTENSIONS_H #define DD4HEP_GEOMETRY_OBJECTEXTENSIONS_H diff --git a/DDCore/include/DD4hep/Objects.h b/DDCore/include/DD4hep/Objects.h index 83d4bb3e7812285f809aae2592c2743e55e5f3b4..4bd2ae6ae8c6ddd4266f0948bb404e9406bfa732 100644 --- a/DDCore/include/DD4hep/Objects.h +++ b/DDCore/include/DD4hep/Objects.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_OBJECTS_H #define DD4HEP_GEOMETRY_OBJECTS_H @@ -78,16 +83,16 @@ namespace DD4hep { /// Definition of the implementation type typedef NamedObject Object; /// Default constructor - Author() - : Ref_t() { + Author() + : Ref_t() { } /// Constructorto be used for assignment from a handle - Author(const Author& e) - : Ref_t(e) { + Author(const Author& e) + : Ref_t(e) { } /// Constructor to be used when assigning already valid handle template <typename Q> - Author(const Handle<Q>& e) + Author(const Handle<Q>& e) : Ref_t(e) { } /// Constructor to be used when creating a new object @@ -121,12 +126,12 @@ namespace DD4hep { public: typedef HeaderObject Object; /// Default constructor - Header() - : Handle<HeaderObject>() { + Header() + : Handle<HeaderObject>() { } /// Constructorto be used for assignment from a handle - Header(const Header& e) - : Handle<HeaderObject>(e) { + Header(const Header& e) + : Handle<HeaderObject>(e) { } /// Constructor to be used when reading the already parsed DOM tree template <typename Q> Header(const Handle<Q>& e) @@ -185,16 +190,16 @@ namespace DD4hep { /// Definition of the implementation type typedef ConstantObject Object; /// Default constructor - Constant() - : Handle<ConstantObject> () { + Constant() + : Handle<ConstantObject> () { } /// Constructorto be used for assignment from a handle - Constant(const Constant& e) - : Handle<ConstantObject> (e) { + Constant(const Constant& e) + : Handle<ConstantObject> (e) { } /// Constructor to be used when reading the already parsed DOM tree template <typename Q> - Constant(const Handle<Q>& e) + Constant(const Handle<Q>& e) : Handle<ConstantObject> (e) { } /// Constructor to be used when creating a new DOM tree @@ -258,18 +263,18 @@ namespace DD4hep { /// Definition of the implementation type typedef TGeoElement Object; /// Default constructor - Atom() - : Handle<Object>() { + Atom() + : Handle<Object>() { } #ifndef __CINT__ /// Constructorto be used for assignment from a handle - Atom(const Handle<Object>& e) - : Handle<Object>(e) { + Atom(const Handle<Object>& e) + : Handle<Object>(e) { } #endif /// Constructor to be used when creating from a object handle template <typename Q> - Atom(const Handle<Q>& e) + Atom(const Handle<Q>& e) : Handle<Object>(e) { } /// Constructor to be used when reading the already parsed DOM tree @@ -292,18 +297,18 @@ namespace DD4hep { typedef TGeoMedium Object; /// Default constructor - Material() - : Handle<Object>() { + Material() + : Handle<Object>() { } #ifndef __CINT__ /// Constructorto be used for assignment from material handle - Material(const Handle<Object>& e) - : Handle<Object>(e) { + Material(const Handle<Object>& e) + : Handle<Object>(e) { } #endif /// Constructorto be used for assignment from object handle template <typename Q> - Material(const Handle<Q>& e) + Material(const Handle<Q>& e) : Handle<Object>(e) { } /// proton number of the underlying material @@ -334,22 +339,22 @@ namespace DD4hep { }; typedef VisAttrObject Object; /// Default constructor - VisAttr() - : Handle<Object>() { + VisAttr() + : Handle<Object>() { } /// Copy constructor for handle - VisAttr(const VisAttr& e) - : Handle<Object>(e) { + VisAttr(const VisAttr& e) + : Handle<Object>(e) { } #ifndef __CINT__ /// Copy constructor for handle - VisAttr(const Handle<Object>& e) - : Handle<Object>(e) { + VisAttr(const Handle<Object>& e) + : Handle<Object>(e) { } #endif /// Constructor to be used for assignment from object handle template <typename Q> - VisAttr(const Handle<Q>& e) + VisAttr(const Handle<Q>& e) : Handle<Object>(e) { } /// Constructor to be used when creating a new registered visualization object @@ -411,7 +416,7 @@ namespace DD4hep { typedef Handle<TGeoPhysicalNode> Base; /// Constructor to be used when reading the already parsed DOM tree template <typename Q> - AlignmentEntry(const Handle<Q>& h) + AlignmentEntry(const Handle<Q>& h) : Base(h) { } /// Constructor to be used when creating a new aligment entry @@ -438,12 +443,12 @@ namespace DD4hep { std::string content; double value; /// Default constructor - Limit() - : particles(), name(), unit(), content(), value(0.0) { + Limit() + : particles(), name(), unit(), content(), value(0.0) { } /// Copy constructor - Limit(const Limit& c) - : particles(c.particles), name(c.name), unit(c.unit), content(c.content), value(c.value) { + Limit(const Limit& c) + : particles(c.particles), name(c.name), unit(c.unit), content(c.content), value(c.value) { } /// Assignment operator Limit& operator=(const Limit& c); @@ -465,22 +470,22 @@ namespace DD4hep { public: typedef LimitSetObject Object; /// Constructor to be used when reading the already parsed DOM tree - LimitSet() - : Handle<LimitSetObject>() { + LimitSet() + : Handle<LimitSetObject>() { } /// Copy constructor for handle - LimitSet(const LimitSet& e) - : Handle<LimitSetObject>(e) { + LimitSet(const LimitSet& e) + : Handle<LimitSetObject>(e) { } #ifndef __CINT__ /// Copy constructor for handle - LimitSet(const Handle<LimitSetObject>& e) - : Handle<LimitSetObject>(e) { + LimitSet(const Handle<LimitSetObject>& e) + : Handle<LimitSetObject>(e) { } #endif /// Constructor to be used when reading the already parsed DOM tree template <typename Q> - LimitSet(const Handle<Q>& e) + LimitSet(const Handle<Q>& e) : Handle<LimitSetObject>(e) { } /// Constructor to be used when creating a new object @@ -502,22 +507,22 @@ namespace DD4hep { /// Implemeting class typedef RegionObject Object; /// Default constructor - Region() - : Handle<Object>() { + Region() + : Handle<Object>() { } /// Copy Constructor - Region(const Region& e) - : Handle<Object>(e) { + Region(const Region& e) + : Handle<Object>(e) { } #ifndef __CINT__ /// Copy Constructor - Region(const Handle<RegionObject>& e) - : Handle<Object>(e) { + Region(const Handle<RegionObject>& e) + : Handle<Object>(e) { } #endif /// Constructor to be used when assigning handle template <typename Q> - Region(const Handle<Q>& e) + Region(const Handle<Q>& e) : Handle<Object>(e) { } /// Constructor to be used when creating a new object diff --git a/DDCore/include/DD4hep/Parsers.h b/DDCore/include/DD4hep/Parsers.h index b1f46e5bfdf3db3bcddd4613d57428f572a092db..6e031813be4bf8ec45cb42be39875178acc2e8ce 100644 --- a/DDCore/include/DD4hep/Parsers.h +++ b/DDCore/include/DD4hep/Parsers.h @@ -1,4 +1,16 @@ -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (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_PARSERS_H #define DD4HEP_PARSERS_H 1 // ============================================================================ @@ -16,15 +28,15 @@ #include "Math/Vector4D.h" // ============================================================================ -#define PARSERS_DECL_FOR_SINGLE(Type) \ +#define PARSERS_DECL_FOR_SINGLE(Type) \ int parse(Type& result, const std::string& input); #define PARSERS_DECL_FOR_PAIR(FirstType, SecondType) \ int parse(std::pair<FirstType, SecondType >& result,const std::string& input); -#define PARSERS_DECL_FOR_LIST(InnerType) \ - int parse(std::vector<InnerType>& result,const std::string& input); \ - int parse(std::list<InnerType>& result,const std::string& input); \ +#define PARSERS_DECL_FOR_LIST(InnerType) \ + int parse(std::vector<InnerType>& result,const std::string& input); \ + int parse(std::list<InnerType>& result,const std::string& input); \ int parse(std::set<InnerType>& result,const std::string& input); // ============================================================================ /** @file @@ -77,147 +89,147 @@ namespace DD4hep { * @date 2006-05-12 */ PARSERS_DECL_FOR_SINGLE(bool) - // ======================================================================== - /// parse the <c>char</c> value - /** - * @see DD4hep::Parsers::CharGrammar - * @param result (output) boolean result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-12 - */ - PARSERS_DECL_FOR_SINGLE(char) - /// @see DD4hep::Parsers::parser(char&,std::string&) - PARSERS_DECL_FOR_SINGLE(unsigned char) - /// @see DD4hep::Parsers::parser(char&,std::string&) - PARSERS_DECL_FOR_SINGLE(signed char) - // ======================================================================== - /// parse the <c>int</c> value - /** - * @see DD4hep::Parsers::IntGrammar - * @param result (output) integer result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_SINGLE(int) - /// @see DD4hep::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(short) - /// @see DD4hep::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(unsigned short) - /// @see DD4hep::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(unsigned int) - /// @see DD4hep::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(long) - /// @see DD4hep::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(unsigned long) - /// @see DD4hep::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(long long) - /// @see DD4hep::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(unsigned long long) - // ======================================================================== - /// parse the <c>double</c> value - /** - * @see DD4hep::Parsers::RealGrammar - * @param result (output) double result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_SINGLE(double) - /// @see DD4hep::Parsers::parser( double&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(float) - /// @see DD4hep::Parsers::parser( double&, const std::string& ) - PARSERS_DECL_FOR_SINGLE(long double) - // ======================================================================== - /** parse the <c>std::string</c> value - * - * @see DD4hep::Parsers::StringGrammar - * @param result (output) string result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_SINGLE(std::string) - // ======================================================================== + // ======================================================================== + /// parse the <c>char</c> value + /** + * @see DD4hep::Parsers::CharGrammar + * @param result (output) boolean result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-12 + */ + PARSERS_DECL_FOR_SINGLE(char) + /// @see DD4hep::Parsers::parser(char&,std::string&) + PARSERS_DECL_FOR_SINGLE(unsigned char) + /// @see DD4hep::Parsers::parser(char&,std::string&) + PARSERS_DECL_FOR_SINGLE(signed char) + // ======================================================================== + /// parse the <c>int</c> value + /** + * @see DD4hep::Parsers::IntGrammar + * @param result (output) integer result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_SINGLE(int) + /// @see DD4hep::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(short) + /// @see DD4hep::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(unsigned short) + /// @see DD4hep::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(unsigned int) + /// @see DD4hep::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(long) + /// @see DD4hep::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(unsigned long) + /// @see DD4hep::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(long long) + /// @see DD4hep::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(unsigned long long) + // ======================================================================== + /// parse the <c>double</c> value + /** + * @see DD4hep::Parsers::RealGrammar + * @param result (output) double result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_SINGLE(double) + /// @see DD4hep::Parsers::parser( double&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(float) + /// @see DD4hep::Parsers::parser( double&, const std::string& ) + PARSERS_DECL_FOR_SINGLE(long double) + // ======================================================================== + /** parse the <c>std::string</c> value + * + * @see DD4hep::Parsers::StringGrammar + * @param result (output) string result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_SINGLE(std::string) + // ======================================================================== - PARSERS_DECL_FOR_LIST(bool) - PARSERS_DECL_FOR_LIST(char) - PARSERS_DECL_FOR_LIST(unsigned char) - PARSERS_DECL_FOR_LIST(signed char) + PARSERS_DECL_FOR_LIST(bool) + PARSERS_DECL_FOR_LIST(char) + PARSERS_DECL_FOR_LIST(unsigned char) + PARSERS_DECL_FOR_LIST(signed char) - PARSERS_DECL_FOR_LIST(int) - PARSERS_DECL_FOR_LIST(short) - PARSERS_DECL_FOR_LIST(unsigned short) - PARSERS_DECL_FOR_LIST(unsigned int) - PARSERS_DECL_FOR_LIST(long) - PARSERS_DECL_FOR_LIST(unsigned long) - PARSERS_DECL_FOR_LIST(long long) - PARSERS_DECL_FOR_LIST(unsigned long long) + PARSERS_DECL_FOR_LIST(int) + PARSERS_DECL_FOR_LIST(short) + PARSERS_DECL_FOR_LIST(unsigned short) + PARSERS_DECL_FOR_LIST(unsigned int) + PARSERS_DECL_FOR_LIST(long) + PARSERS_DECL_FOR_LIST(unsigned long) + PARSERS_DECL_FOR_LIST(long long) + PARSERS_DECL_FOR_LIST(unsigned long long) - PARSERS_DECL_FOR_LIST(double) - PARSERS_DECL_FOR_LIST(float) - PARSERS_DECL_FOR_LIST(long double) + PARSERS_DECL_FOR_LIST(double) + PARSERS_DECL_FOR_LIST(float) + PARSERS_DECL_FOR_LIST(long double) - PARSERS_DECL_FOR_LIST(std::string) - // ======================================================================== - // Advanced parses - // ======================================================================== - /// parse the <c>std::pair\<double,double\></c> value - /** - * @see DD4hep::Parsers::PairGrammar - * @see DD4hep::Parsers::RealGrammar - * @param result (output) pair of doubles - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_PAIR(double, double) - // ======================================================================== - /** parse the <c>std::pair\<int,int\></c> value - * - * @see DD4hep::Parsers::PairGrammar - * @see DD4hep::Parsers::IntGrammar - * @param result (output) pair of integers - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_PAIR(int, int) - // ======================================================================== + PARSERS_DECL_FOR_LIST(std::string) + // ======================================================================== + // Advanced parses + // ======================================================================== + /// parse the <c>std::pair\<double,double\></c> value + /** + * @see DD4hep::Parsers::PairGrammar + * @see DD4hep::Parsers::RealGrammar + * @param result (output) pair of doubles + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_PAIR(double, double) + // ======================================================================== + /** parse the <c>std::pair\<int,int\></c> value + * + * @see DD4hep::Parsers::PairGrammar + * @see DD4hep::Parsers::IntGrammar + * @param result (output) pair of integers + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_PAIR(int, int) + // ======================================================================== - /// parse the <c>std::vector\<std::pair\<double,double\> \></c> value - /** - * @see DD4hep::Parsers::VectorGrammar - * @see DD4hep::Parsers::PairGrammar - * @see DD4hep::Parsers::RealGrammar - * @param result (output) vector with pairs of doubles - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - int parse(std::vector<std::pair<double, double> >& result, const std::string& input); + /// parse the <c>std::vector\<std::pair\<double,double\> \></c> value + /** + * @see DD4hep::Parsers::VectorGrammar + * @see DD4hep::Parsers::PairGrammar + * @see DD4hep::Parsers::RealGrammar + * @param result (output) vector with pairs of doubles + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + int parse(std::vector<std::pair<double, double> >& result, const std::string& input); // ======================================================================== /// parse the <c>std::vector\<std::pair\<int,int\> \></c> value /** @@ -465,7 +477,7 @@ namespace DD4hep { * @date 2009-09-15 */ template <class T, unsigned int N> - int parse(T (&result)[N], const std::string& input) { + int parse(T (&result)[N], const std::string& input) { typedef std::vector<T> _Vct; // create the temporary vector _Vct tmp; @@ -490,7 +502,7 @@ namespace DD4hep { * @date 2009-09-15 */ template <unsigned int N> - int parse(char (&result)[N], const std::string& input) { + int parse(char (&result)[N], const std::string& input) { // clear the string std::fill_n(result, N, ' '); // create the temporary string diff --git a/DDCore/include/DD4hep/Plugins.h b/DDCore/include/DD4hep/Plugins.h index 8e291cfd21bd54b49a5909c328ccb8222e9db98c..0ba91b1627a7914243fe8da930d8357d9faf08b8 100644 --- a/DDCore/include/DD4hep/Plugins.h +++ b/DDCore/include/DD4hep/Plugins.h @@ -1,11 +1,16 @@ // $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_PLUGINS_H #define DD4HEP_PLUGINS_H @@ -13,10 +18,47 @@ #ifndef __CINT__ #include <string> #include <vector> +#include <typeinfo> +#include "RVersion.h" /// Namespace for the AIDA detector description toolkit namespace DD4hep { + class NamedObject; + + /// Namespace for the geometry part of the AIDA detector description toolkit + namespace Geometry { + template <typename T> class Handle; + class LCDD; + } + /// Namespace for the AIDA detector description toolkit supporting XML utilities + namespace XML { + class Handle_t; + class Collection_t; + class Document; + class Element; + } + + /// Factory base class implementing some utilities + struct PluginFactoryBase { + typedef Geometry::LCDD lcdd_t; + typedef Geometry::Handle<NamedObject> ref_t; + typedef XML::Handle_t xml_h; + typedef XML::Element xml_e; + typedef std::string str_t; + + template <typename T> static T* ptr(const T* p) { return (T*)p; } + template <typename T> static T& ref(const T* p) { return *(T*)p; } + template <typename T> static T val(const T* p) { return T(*p); } + template <typename T> static T value(const void* p) { return (T)p; } + static const char* value(const void* p) { return (const char*)(p); } + template <typename T> static T make_return(const T& p) { return p; } + }; + template <> inline int PluginFactoryBase::value<int>(const void* p) { return *(int*)(p); } + template <> inline long PluginFactoryBase::value<long>(const void* p) { return *(long*)(p); } + template <> inline std::string PluginFactoryBase::value<std::string>(const void* p) { return *(std::string*)(p); } + template <> inline const std::string& PluginFactoryBase::value<const std::string&>(const void* p) { return *(std::string*)(p); } + /// Helper to debug plugin manager calls /** * Small helper class to adjust the plugin service debug level @@ -37,54 +79,167 @@ namespace DD4hep { std::string missingFactory(const std::string& name) const; }; - template <typename SIGNATURE> class PluginRegistry { - public: - typedef void (*stub_t)(void *retaddr, void*, const std::vector<void*>& arg, void*); - typedef SIGNATURE signature_t; - static void add(const char* name, stub_t stub); - }; - + /// Factory template for the plugin mechanism class PluginService { private: public: - typedef void (*stub_t)(void *retaddr, void*, const std::vector<void*>& arg, void*); + typedef void* stub_t; + + template <typename FUNCTION> struct FuncPointer { + union { void* ptr; FUNCTION fcn; } fptr; + FuncPointer() { fptr.ptr = 0; } + FuncPointer(const FuncPointer& c) { fptr.ptr = c.fptr.ptr; } + FuncPointer(FUNCTION func) { fptr.fcn = func; } + FuncPointer(void* p) { fptr.ptr = p; } + void* ptr() const { return fptr.ptr; } + FUNCTION function() const { return fptr.func; } + FuncPointer& operator=(const FuncPointer& c) { + fptr.ptr = c.fptr.ptr; return *this; + } + }; + template <typename FUNCTION> static FuncPointer<FUNCTION> function(FUNCTION func) { + return FuncPointer<FUNCTION>(func); + } static bool debug(); static bool setDebug(bool new_value); + static void* getCreator(const std::string& id, const std::type_info& info); + static void addFactory(const std::string& id, stub_t func, + const std::type_info& signature_type, + const std::type_info& return_type); + +#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) template <typename R> static R Create(const std::string& name); template <typename R, typename A0> - static R Create(const std::string& name,A0 a0); + static R Create(const std::string& name,A0 a0); template <typename R, typename A0, typename A1> - static R Create(const std::string& name, A0 a0, A1 a1); + static R Create(const std::string& name, A0 a0, A1 a1); template <typename R, typename A0, typename A1, typename A2> - static R Create(const std::string& name, A0 a0, A1 a1, A2 a2); + static R Create(const std::string& name, A0 a0, A1 a1, A2 a2); template <typename R, typename A0, typename A1, typename A2, typename A3> - static R Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3); + static R Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3); template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> - static R Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4); + static R Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4); template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> - static R Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5); + static R Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5); +#else + template <typename R, typename... Args> static R Create(const std::string& id, Args... args) { + FuncPointer<R(*)(Args...)> f(getCreator(id,typeid(R(Args...)))); + return f.fptr.ptr ? (*f.fptr.fcn)(std::forward<Args>(args)...) : 0; + } +#endif }; + /// Factory template for the plugin mechanism + template <typename SIGNATURE> class PluginRegistry { + public: + typedef PluginService svc_t; + typedef SIGNATURE signature_t; +#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) + typedef void (*stub_t)(void *retaddr, void*, const std::vector<void*>& arg, void*); + static void add(const char* name, stub_t stub); +#else + template <typename R, typename... Args> static void add(const std::string& id, R(*func)(Args...)) { + svc_t::addFactory(id,svc_t::function(func).ptr(),typeid(R(Args...)),typeid(R)); + } +#endif + }; } /* End namespace DD4hep */ -#define DD4HEP_PLUGINSVC_CNAME(name, serial) name##_dict_##serial +#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) +#define DD4HEP_FACTORY_CALL(type,name,signature) DD4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::wrapper); +#else +namespace DD4hep { + template <> inline long PluginFactoryBase::make_return(const long& p) { static long s=p; return (long)&s; } +} +#define DD4HEP_FACTORY_CALL(type,name,signature) DD4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::call) +#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(X,Y) +#endif -#define DD4HEP_FACTORY_CALL(type,name,signature) DD4hep::PluginRegistry<signature>::add(name,Factory<type,signature>::Func); +#define DD4HEP_OPEN_PLUGIN(ns,name) namespace ns { namespace { struct name {}; } } namespace DD4hep +#define DD4HEP_PLUGINSVC_CNAME(name, serial) name##_dict_##serial +#define DD4HEP_PLUGINSVC_FACTORY(type,name,signature,serial) \ + namespace { \ + struct DD4HEP_PLUGINSVC_CNAME(__typeFactory__,serial) { \ + DD4HEP_PLUGINSVC_CNAME(__typeFactory__,serial)() { DD4HEP_FACTORY_CALL(type,#name,signature); } \ + } DD4HEP_PLUGINSVC_CNAME(s____typeFactory__,serial); \ + } + + +#define DD4HEP_PLUGIN_FACTORY_ARGS_0(R) \ + template <typename P> class Factory<P, R()> \ + : public DD4hep::PluginFactoryBase { \ + public: \ + static void wrapper(void *ret,void*,const std::vector<void*>& ,void*) { \ + *(void**)ret = (void*)call(); \ + } \ + static R call(); \ + }; \ + template <typename P> inline R Factory<P,R()>::call() + +#define DD4HEP_PLUGIN_FACTORY_ARGS_1(R,A0) \ + template <typename P> class Factory<P, R(A0)> \ + : public DD4hep::PluginFactoryBase { \ + public: \ + static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ + *(void**)ret = (void*)call(value<A0>(a[0])); \ + } \ + static R call(A0 a0); \ + }; \ + template <typename P> inline R Factory<P,R(A0)>::call(A0 a0) + +#define DD4HEP_PLUGIN_FACTORY_ARGS_2(R,A0,A1) \ + template <typename P> class Factory<P, R(A0,A1)> \ + : public DD4hep::PluginFactoryBase { \ + public: \ + static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ + *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1])); \ + } \ + static R call(A0 a0,A1 a1); \ + }; \ + template <typename P> inline R Factory<P,R(A0,A1)>::call(A0 a0, A1 a1) + +#define DD4HEP_PLUGIN_FACTORY_ARGS_3(R,A0,A1,A2) \ + template <typename P> class Factory<P, R(A0,A1,A2)> \ + : public DD4hep::PluginFactoryBase { \ + public: \ + static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ + *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1]),value<A2>(a[2])); \ + } \ + static R call(A0 a0,A1 a1,A2 a2); \ + }; \ + template <typename P> inline R Factory<P,R(A0,A1,A2)>::call(A0 a0, A1 a1, A2 a2) + +#define DD4HEP_PLUGIN_FACTORY_ARGS_4(R,A0,A1,A2,A3) \ + template <typename P> class Factory<P, R(A0,A1,A2,A3)> \ + : public DD4hep::PluginFactoryBase { \ + public: \ + static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ + *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1]),value<A2>(a[2]),value<A3>(a[3])); \ + } \ + static R call(A0 a0,A1 a1,A2 a2, A3 a3); \ + }; \ + template <typename P> inline R Factory<P,R(A0,A1,A2,A3)>::call(A0 a0, A1 a1, A2 a2, A3 a3) + +#define DD4HEP_PLUGIN_FACTORY_ARGS_5(R,A0,A1,A2,A3,A4) \ + template <typename P> class Factory<P, R(A0,A1,A2,A3,A4)> \ + : public DD4hep::PluginFactoryBase { \ + public: \ + static void wrapper(void *ret,void*,const std::vector<void*>& a,void*) { \ + *(void**)ret = (void*)call(value<A0>(a[0]),value<A1>(a[1]),value<A2>(a[2]),value<A3>(a[3]),value<A4>(a[4])); \ + } \ + static R call(A0 a0,A1 a1,A2 a2, A3 a3, A4 a4); \ + }; \ + template <typename P> inline R Factory<P,R(A0,A1,A2,A3,A4)>::call(A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) + -#define DD4HEP_PLUGINSVC_FACTORY(type,name,signature,serial) \ - namespace {\ - struct DD4HEP_PLUGINSVC_CNAME(__typeFactory__,serial) { \ - DD4HEP_PLUGINSVC_CNAME(__typeFactory__,serial)() { DD4HEP_FACTORY_CALL(type,#name,signature); } \ - } DD4HEP_PLUGINSVC_CNAME(s____typeFactory__,serial);\ -} #endif /* __CINT__ */ diff --git a/DDCore/include/DD4hep/Plugins.inl b/DDCore/include/DD4hep/Plugins.inl index dc2b44e7debae4e199b387086b14626a99a84128..b389af524a1a034872194915c4a3463b2727931c 100644 --- a/DDCore/include/DD4hep/Plugins.inl +++ b/DDCore/include/DD4hep/Plugins.inl @@ -1,23 +1,153 @@ -// $Id: Readout.cpp 590 2013-06-03 17:02:43Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_PLUGINS_INL #define DD4HEP_PLUGINS_INL #include "DD4hep/Plugins.h" -#include "RVersion.h" #if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) -#include "DD4hep/Plugins_ROOT5.inl" -#elif ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) and ROOT_VERSION_CODE < ROOT_VERSION(7,0,0) -#include "DD4hep/Plugins_ROOT6.inl" -#else -#pragma error "Unsupported ROOT version required." +#include <set> +#include <map> +#include <list> +#include <vector> + +#ifdef __APPLE__ +#define Reflex_CollectionProxy 1 +#endif + +#include "DD4hep/Printout.h" +#include "Reflex/PluginService.h" +#include "Reflex/Reflex.h" +#include "Reflex/Builder/ReflexBuilder.h" + +/// The DD4hep namespace declaration +namespace DD4hep { + + /** Declaration and implementation of all templated Create methods. + * Concrete instances must be created using the instantiators below. + * + * \author M.Frank + * \date 10/03/2015 + */ + template <typename R> R PluginService::Create(const std::string& name) + { return ROOT::Reflex::PluginService::Create<R>(name); } + + template <typename R, typename A0> R PluginService::Create(const std::string& name, A0 a0) + { return ROOT::Reflex::PluginService::Create<R>(name,a0); } + + template <typename R, typename A0, typename A1> + R PluginService::Create(const std::string& name, A0 a0, A1 a1) + { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1); } + + template <typename R, typename A0, typename A1, typename A2> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2) + { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2); } + + template <typename R, typename A0, typename A1, typename A2, typename A3> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3) + { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3); } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) + { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4); } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) + { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4, a5); } + + + /** Internal namespace -- should under no circumstances be used directly. + * The named namespace is necessary to trick the linker. Entries in an anonymous + * namespace would be oiptimized away..... + * + * \author M.Frank + * \date 10/03/2015 + */ + namespace plugin_signatures_namespace { + + namespace { + + /// Helper to convert function pointer to void pointer. + /** + * \author M.Frank + * \date 10/03/2015 + */ + template <typename T> union FuncPtr { + FuncPtr(T t) { fcn = t; } + void* ptr; + T fcn; + }; + /// Helper to convert function pointer to helper union + template <typename T> FuncPtr<T> __func(T t) { return FuncPtr<T>(t); } + } + + /// Defined required creator functions to instantiate the "Create" signatures. + /** The Create signatures are instantiated from a macro only containing + * the arguments. Otherwise these functions are + * pretty useless. + * + * \author M.Frank + * \date 10/03/2015 + */ + template <typename R> void* instantiate_creator () + { return __func(PluginService::Create<R>).ptr; } + + template <typename R, typename A0> void* instantiate_creator(A0) + { return __func(PluginService::Create<R,A0>).ptr; } + + template <typename R, typename A0, typename A1> void* instantiate_creator(A0,A1) + { return __func(PluginService::Create<R,A0,A1>).ptr; } + + template <typename R, typename A0, typename A1, typename A2> + void* instantiate_creator(A0,A1,A2) + { return __func(PluginService::Create<R,A0,A1,A2>).ptr; } + + template <typename R, typename A0, typename A1, typename A2, typename A3> + void* instantiate_creator(A0,A1,A2,A3) + { return __func(PluginService::Create<R,A0,A1,A2,A3>).ptr; } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> + void* instantiate_creator(A0,A1,A2,A3,A4) + { return __func(PluginService::Create<R,A0,A1,A2,A3,A4>).ptr; } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> + void* instantiate_creator(A0,A1,A2,A3,A4,A5) + { return __func(PluginService::Create<R,A0,A1,A2,A3,A4,A5>).ptr; } + + namespace { + template <typename SIGNATURE> static void reflex_plugin(const std::string& name, typename DD4hep::PluginRegistry<SIGNATURE>::stub_t stub) { + ROOT::Reflex::Type typ = ROOT::Reflex::TypeBuilder(name.c_str(),ROOT::Reflex::PUBLIC); + ROOT::Reflex::Type sig = ROOT::Reflex::FunctionDistiller < SIGNATURE > ::Get(); + std::string fname = (std::string(PLUGINSVC_FACTORY_NS "::") + ROOT::Reflex::PluginService::FactoryName(name)); + ROOT::Reflex::FunctionBuilder func(sig, fname.c_str(), stub, 0, "", ROOT::Reflex::PUBLIC); + func.AddProperty("name", name).AddProperty("id", name); + if ( PluginService::debug() ) { + std::string sig_name = sig.Name(); + printout(INFO,"PluginService","+++ Declared factory for id %s with signature %s.",fname.c_str(),sig_name.c_str()); + } + } + } + + } +} + +#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(R, ARGS) namespace DD4hep { \ + template <> void PluginRegistry< R ARGS >::add(const char* n, stub_t f) \ + { plugin_signatures_namespace::reflex_plugin< R ARGS >(n,f); } \ + namespace plugin_signatures_namespace { template void* instantiate_creator<R> ARGS ; }} + #endif #endif // DD4HEP_PLUGINS_INL diff --git a/DDCore/include/DD4hep/Plugins_ROOT5.inl b/DDCore/include/DD4hep/Plugins_ROOT5.inl deleted file mode 100644 index 8c387fdaba80ddb3943d7a86bd4bb5cec70a2c2f..0000000000000000000000000000000000000000 --- a/DDCore/include/DD4hep/Plugins_ROOT5.inl +++ /dev/null @@ -1,143 +0,0 @@ -// $Id: Readout.cpp 590 2013-06-03 17:02:43Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#ifndef DD4HEP_PLUGINS_ROOT5_INL -#define DD4HEP_PLUGINS_ROOT5_INL - -#include <set> -#include <map> -#include <list> -#include <vector> - -#ifdef __APPLE__ -#define Reflex_CollectionProxy 1 -#endif - -#include "DD4hep/Printout.h" -#include "Reflex/PluginService.h" -#include "Reflex/Reflex.h" -#include "Reflex/Builder/ReflexBuilder.h" - -/// The DD4hep namespace declaration -namespace DD4hep { - - /** Declaration and implementation of all templated Create methods. - * Concrete instances must be created using the instantiators below. - * - * \author M.Frank - * \date 10/03/2015 - */ - template <typename R> R PluginService::Create(const std::string& name) - { return ROOT::Reflex::PluginService::Create<R>(name); } - - template <typename R, typename A0> R PluginService::Create(const std::string& name, A0 a0) - { return ROOT::Reflex::PluginService::Create<R>(name,a0); } - - template <typename R, typename A0, typename A1> - R PluginService::Create(const std::string& name, A0 a0, A1 a1) - { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1); } - - template <typename R, typename A0, typename A1, typename A2> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2) - { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2); } - - template <typename R, typename A0, typename A1, typename A2, typename A3> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3) - { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3); } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4); } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - { return ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4, a5); } - - - /** Internal namespace -- should under no circumstances be used directly. - * The named namespace is necessary to trick the linker. Entries in an anonymous - * namespace would be oiptimized away..... - * - * \author M.Frank - * \date 10/03/2015 - */ - namespace plugin_signatures_namespace { - - namespace { - - /// Helper to convert function pointer to void pointer. - /** - * \author M.Frank - * \date 10/03/2015 - */ - template <typename T> union FuncPtr { - FuncPtr(T t) { fcn = t; } - void* ptr; - T fcn; - }; - /// Helper to convert function pointer to helper union - template <typename T> FuncPtr<T> __func(T t) { return FuncPtr<T>(t); } - } - - /// Defined required creator functions to instantiate the "Create" signatures. - /** The Create signatures are instantiated from a macro only containing - * the arguments. Otherwise these functions are - * pretty useless. - * - * \author M.Frank - * \date 10/03/2015 - */ - template <typename R> void* instantiate_creator () - { return __func(PluginService::Create<R>).ptr; } - - template <typename R, typename A0> void* instantiate_creator(A0) - { return __func(PluginService::Create<R,A0>).ptr; } - - template <typename R, typename A0, typename A1> void* instantiate_creator(A0,A1) - { return __func(PluginService::Create<R,A0,A1>).ptr; } - - template <typename R, typename A0, typename A1, typename A2> - void* instantiate_creator(A0,A1,A2) - { return __func(PluginService::Create<R,A0,A1,A2>).ptr; } - - template <typename R, typename A0, typename A1, typename A2, typename A3> - void* instantiate_creator(A0,A1,A2,A3) - { return __func(PluginService::Create<R,A0,A1,A2,A3>).ptr; } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> - void* instantiate_creator(A0,A1,A2,A3,A4) - { return __func(PluginService::Create<R,A0,A1,A2,A3,A4>).ptr; } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> - void* instantiate_creator(A0,A1,A2,A3,A4,A5) - { return __func(PluginService::Create<R,A0,A1,A2,A3,A4,A5>).ptr; } - - namespace { - template <typename SIGNATURE> static void reflex_plugin(const std::string& name, DD4hep::PluginService::stub_t stub) { - ROOT::Reflex::Type typ = ROOT::Reflex::TypeBuilder(name.c_str(),ROOT::Reflex::PUBLIC); - ROOT::Reflex::Type sig = ROOT::Reflex::FunctionDistiller < SIGNATURE > ::Get(); - std::string fname = (std::string(PLUGINSVC_FACTORY_NS "::") + ROOT::Reflex::PluginService::FactoryName(name)); - ROOT::Reflex::FunctionBuilder func(sig, fname.c_str(), stub, 0, "", ROOT::Reflex::PUBLIC); - func.AddProperty("name", name).AddProperty("id", name); - if ( PluginService::debug() ) { - std::string sig_name = sig.Name(); - printout(INFO,"PluginService","+++ Declared factory for id %s with signature %s.",fname.c_str(),sig_name.c_str()); - } - } - } - - } -} - -#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(R, ARGS) namespace DD4hep { \ - template <> void PluginRegistry< R ARGS >::add(const char* n, DD4hep::PluginService::stub_t f) \ - { plugin_signatures_namespace::reflex_plugin< R ARGS >(n,f); } \ - namespace plugin_signatures_namespace { template void* instantiate_creator<R> ARGS ; }} - -#endif // DD4HEP_PLUGINS_ROOT5_INL - diff --git a/DDCore/include/DD4hep/Plugins_ROOT6.inl b/DDCore/include/DD4hep/Plugins_ROOT6.inl deleted file mode 100644 index 054febc81ab1384d5a998617e0cc9b376579f551..0000000000000000000000000000000000000000 --- a/DDCore/include/DD4hep/Plugins_ROOT6.inl +++ /dev/null @@ -1,133 +0,0 @@ -// $Id: Readout.cpp 590 2013-06-03 17:02:43Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== -#ifndef DD4HEP_PLUGINS_ROOT6_INL -#define DD4HEP_PLUGINS_ROOT6_INL - -#include "DD4hep/Printout.h" - -/// The DD4hep namespace declaration -namespace DD4hep { - - /** Declaration and implementation of all templated Create methods. - * Concrete instances must be created using the instantiators below. - * - * \author M.Frank - * \date 10/03/2015 - */ - template <typename R> R PluginService::Create(const std::string& name) - { return 0; } // ROOT::Reflex::PluginService::Create<R>(name); } - - template <typename R, typename A0> R PluginService::Create(const std::string& name, A0 a0) - { return 0; } // ROOT::Reflex::PluginService::Create<R>(name,a0); } - - template <typename R, typename A0, typename A1> - R PluginService::Create(const std::string& name, A0 a0, A1 a1) - { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1); } - - template <typename R, typename A0, typename A1, typename A2> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2) - { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2); } - - template <typename R, typename A0, typename A1, typename A2, typename A3> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3) - { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3); } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) - { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4); } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> - R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4, a5); } - - - /** Internal namespace -- should under no circumstances be used directly. - * The named namespace is necessary to trick the linker. Entries in an anonymous - * namespace would be oiptimized away..... - * - * \author M.Frank - * \date 10/03/2015 - */ - namespace plugin_signatures_namespace { - - namespace { - - /// Helper to convert function pointer to void pointer. - /** - * \author M.Frank - * \date 10/03/2015 - */ - template <typename T> union FuncPtr { - FuncPtr(T t) { fcn = t; } - void* ptr; - T fcn; - }; - /// Helper to convert function pointer to helper union - template <typename T> FuncPtr<T> __func(T t) { return FuncPtr<T>(t); } - } - - /// Defined required creator functions to instantiate the "Create" signatures. - /** The Create signatures are instantiated from a macro only containing - * the arguments. Otherwise these functions are - * pretty useless. - * - * \author M.Frank - * \date 10/03/2015 - */ - template <typename R> void* instantiate_creator () - { return __func(PluginService::Create<R>).ptr; } - - template <typename R, typename A0> void* instantiate_creator(A0) - { return __func(PluginService::Create<R,A0>).ptr; } - - template <typename R, typename A0, typename A1> void* instantiate_creator(A0,A1) - { return __func(PluginService::Create<R,A0,A1>).ptr; } - - template <typename R, typename A0, typename A1, typename A2> - void* instantiate_creator(A0,A1,A2) - { return __func(PluginService::Create<R,A0,A1,A2>).ptr; } - - template <typename R, typename A0, typename A1, typename A2, typename A3> - void* instantiate_creator(A0,A1,A2,A3) - { return __func(PluginService::Create<R,A0,A1,A2,A3>).ptr; } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> - void* instantiate_creator(A0,A1,A2,A3,A4) - { return __func(PluginService::Create<R,A0,A1,A2,A3,A4>).ptr; } - - template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> - void* instantiate_creator(A0,A1,A2,A3,A4,A5) - { return __func(PluginService::Create<R,A0,A1,A2,A3,A4,A5>).ptr; } - - - namespace { - template <typename SIGNATURE> static void reflex_plugin(const std::string& name, DD4hep::PluginService::stub_t /* stub */) { - if ( PluginService::debug() ) { - std::string sig_name = "?????"; -/* - sig_name = "long (*)(const char*, Object*)"; - plugin->register(name, sig_name, stub); -DD4hep::PluginService::Create<R>(name,a0,a1); -*/ - printout(INFO,"PluginService","+++ Declared factory for id %s with signature %s.",name.c_str(),sig_name.c_str()); - } - } - } - } -} - - - -#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(R, ARGS) namespace DD4hep { \ - template <> void PluginRegistry< R ARGS >::add(const char* n, DD4hep::PluginService::stub_t f) \ - { plugin_signatures_namespace::reflex_plugin< R ARGS >(n,f); } \ - namespace plugin_signatures_namespace { template void* instantiate_creator<R> ARGS ; }} - -#endif // DD4HEP_PLUGINS_ROOT6_INL - diff --git a/DDCore/include/DD4hep/Primitives.h b/DDCore/include/DD4hep/Primitives.h index 8debffde35e767a954dac92d82972b602e057eb1..3ab23162860fc9fa4a9469dfcfde42358b027910 100644 --- a/DDCore/include/DD4hep/Primitives.h +++ b/DDCore/include/DD4hep/Primitives.h @@ -1,11 +1,17 @@ -// $Id: Primitives.h 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DD4HEP_PRIMITIVES_H #define DD4HEP_DD4HEP_PRIMITIVES_H @@ -160,7 +166,7 @@ namespace DD4hep { }; /// Generator to create Operator to select value elements of a map template <typename T> Select2nd<typename T::value_type> select2nd(const T&) - { return Select2nd<typename T::value_type>(); } + { return Select2nd<typename T::value_type>(); } /// Operator to select the first element of a pair template <typename T> class Select1st { @@ -172,15 +178,15 @@ namespace DD4hep { }; /// Generator to create Operator to select key values of a map template <typename T> Select1st<typename T::value_type> select1st(const T&) - { return Select1st<typename T::value_type>(); } + { return Select1st<typename T::value_type>(); } /// map Functor to delete objects from heap template <typename M> class DestroyObjects { public: M& object; - DestroyObjects(M& m) - : object(m) { + DestroyObjects(M& m) + : object(m) { } ~DestroyObjects() { object.clear(); @@ -203,8 +209,8 @@ namespace DD4hep { template <typename M> class DestroyFirst { public: M& object; - DestroyFirst(M& m) - : object(m) { + DestroyFirst(M& m) + : object(m) { } ~DestroyFirst() { object.clear(); @@ -241,8 +247,8 @@ namespace DD4hep { template <typename M> class ReleaseObjects { public: M& object; - ReleaseObjects(M& m) - : object(m) { + ReleaseObjects(M& m) + : object(m) { } ~ReleaseObjects() { object.clear(); diff --git a/DDCore/include/DD4hep/Printout.h b/DDCore/include/DD4hep/Printout.h index d979d2c1e43229d177194eef48bb7c575e63461c..40e07a4039d1c6eb0d584652e356bba44440162a 100644 --- a/DDCore/include/DD4hep/Printout.h +++ b/DDCore/include/DD4hep/Printout.h @@ -1,11 +1,16 @@ // $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_PRINTOUT_H #define DD4HEP_PRINTOUT_H @@ -202,9 +207,9 @@ namespace DD4hep { /// Optional text prefix when formatting the output std::string prefix; /// Initializing constructor of the functor - Printer(const Geometry::LCDD* l, std::ostream& stream, const std::string& p = "") - : lcdd(l), os(stream), prefix(p) { - } + Printer(const Geometry::LCDD* l, std::ostream& stream, const std::string& p = "") + : lcdd(l), os(stream), prefix(p) { + } /// Callback operator to be specialized depending on the element type void operator()(const T& value) const; }; @@ -236,9 +241,9 @@ namespace DD4hep { /// Reference to the container data of the map. cont_type& cont; /// Initializing constructor of the functor - PrintMap(const Geometry::LCDD* l, std::ostream& stream, cont_type& c, const std::string& t = "") - : lcdd(l), os(stream), text(t), cont(c) { - } + PrintMap(const Geometry::LCDD* l, std::ostream& stream, cont_type& c, const std::string& t = "") + : lcdd(l), os(stream), text(t), cont(c) { + } /// Callback operator to be specialized depending on the element type void operator()() const; }; diff --git a/DDCore/include/DD4hep/Readout.h b/DDCore/include/DD4hep/Readout.h index c1353e21adbdf43f1c4f2d3c1523cdb3e1729c80..88b8a66b560b076c35c65e239246674ed3c7ce52 100644 --- a/DDCore/include/DD4hep/Readout.h +++ b/DDCore/include/DD4hep/Readout.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4hep_GEOMETRY_READOUT_H #define DD4hep_GEOMETRY_READOUT_H @@ -41,17 +46,17 @@ namespace DD4hep { typedef ReadoutObject Object; public: /// Default constructor - Readout() - : Handle<Object>() { + Readout() + : Handle<Object>() { } /// Copy Constructor from object - Readout(const Readout& e) - : Handle<Object>(e) { + Readout(const Readout& e) + : Handle<Object>(e) { } #ifndef __CINT__ /// Copy Constructor from handle - Readout(const Handle<ReadoutObject>& e) - : Handle<Object>(e) { + Readout(const Handle<ReadoutObject>& e) + : Handle<Object>(e) { } #endif /// Constructor to be used when reading the already parsed object diff --git a/DDCore/include/DD4hep/Segmentations.h b/DDCore/include/DD4hep/Segmentations.h index b43cbe2863ebaf0eec5bd72946f31f4f2a385806..39e93b0ccb072d9d1e56a7ad11887b2a39f8c3dc 100644 --- a/DDCore/include/DD4hep/Segmentations.h +++ b/DDCore/include/DD4hep/Segmentations.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_SEGMENTATIONS_H #define DD4HEP_GEOMETRY_SEGMENTATIONS_H @@ -93,17 +98,17 @@ namespace DD4hep { /// Initializing constructor creating a new object of the given DDSegmentation type Segmentation(const std::string& type, const std::string& name); /// Default constructor - Segmentation() - : Handle<Implementation>() { + Segmentation() + : Handle<Implementation>() { } /// Copy Constructor from object - Segmentation(const Segmentation& e) - : Handle<Object>(e) { + Segmentation(const Segmentation& e) + : Handle<Object>(e) { } #ifndef __CINT__ /// Copy Constructor from handle - Segmentation(const Handle<SegmentationObject>& e) - : Handle<Object>(e) { + Segmentation(const Handle<SegmentationObject>& e) + : Handle<Object>(e) { } #endif /// Constructor to be used when reading the already parsed object diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h index 99b863128de7bf5a5682900983f6a650b470eafe..612f48ca2d15bb63e422640cd09ff0b0e3ad206f 100644 --- a/DDCore/include/DD4hep/Shapes.h +++ b/DDCore/include/DD4hep/Shapes.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_SOLIDS_H #define DD4HEP_GEOMETRY_SOLIDS_H @@ -64,18 +69,18 @@ namespace DD4hep { public: /// Default constructor for uninitialized object - Solid_type() - : Handle<T>() { + Solid_type() + : Handle<T>() { } /// Direct assignment using the implementation pointer - Solid_type(T* p) - : Handle<T>(p) { + Solid_type(T* p) + : Handle<T>(p) { } /// Constructor to be used when passing an already created object - Solid_type(const Handle<T>& e) - : Handle<T>(e) { + Solid_type(const Handle<T>& e) + : Handle<T>(e) { } /// Constructor to be used when passing an already created object: need to check pointers @@ -136,7 +141,7 @@ namespace DD4hep { /// Constructor to create an anonymous new box object (retrieves name from volume) template <typename X, typename Y, typename Z> - Box(const X& x_val, const Y& y_val, const Z& z_val) { + Box(const X& x_val, const Y& y_val, const Z& z_val) { make(_toDouble(x_val), _toDouble(y_val), _toDouble(z_val)); } @@ -262,8 +267,8 @@ namespace DD4hep { /// Intermediate class to overcome drawing probles with the TGeoTubeSeg class MyConeSeg: public TGeoConeSeg { public: - MyConeSeg() - : TGeoConeSeg() { + MyConeSeg() + : TGeoConeSeg() { } virtual ~MyConeSeg() { } @@ -329,7 +334,7 @@ namespace DD4hep { /// Constructor to create a new anonymous tube object with attribute initialization template <typename RMIN, typename RMAX, typename Z, typename DELTAPHI> - Tube(const RMIN& rmin, const RMAX& rmax, const Z& z, const DELTAPHI& deltaPhi) { + Tube(const RMIN& rmin, const RMAX& rmax, const Z& z, const DELTAPHI& deltaPhi) { make("", _toDouble(rmin), _toDouble(rmax), _toDouble(z), 0, _toDouble(deltaPhi)); } @@ -366,7 +371,7 @@ namespace DD4hep { /// Constructor to create a new anonymous tube object with attribute initialization template <typename A, typename B, typename DZ> - EllipticalTube(const A& a, const B& b, const DZ& dz) { + EllipticalTube(const A& a, const B& b, const DZ& dz) { make(_toDouble(a), _toDouble(b), _toDouble(dz)); } @@ -405,7 +410,7 @@ namespace DD4hep { } template <typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2> - Cone(const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2) { + Cone(const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2) { make(_toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); } @@ -434,8 +439,8 @@ namespace DD4hep { } /// Constructor to be used when passing an already created object - Trap(const Trap& e) - : Solid_type<TGeoTrap>(e) { + Trap(const Trap& e) + : Solid_type<TGeoTrap>(e) { } /// Constructor to be used when passing an already created object template <typename Q> Trap(const Handle<Q>& e) @@ -478,7 +483,7 @@ namespace DD4hep { template <typename Q> Trapezoid(const Q* p) : Solid_type<TGeoTrd2>(p) { } /// Constructor to be used when passing an already created object - Trapezoid(const Trapezoid& e) : Solid_type<TGeoTrd2>(e) { } + Trapezoid(const Trapezoid& e) : Solid_type<TGeoTrd2>(e) { } /// Constructor to be used when passing an already created object template <typename Q> Trapezoid(const Handle<Q>& e) @@ -490,7 +495,7 @@ namespace DD4hep { /// Constructor to create a new anonymous object with attribute initialization template <typename X1,typename X2,typename Y1,typename Y2,typename Z> - Trapezoid(X1 x1, X2 x2, Y1 y1, Y2 y2, Z z) + Trapezoid(X1 x1, X2 x2, Y1 y1, Y2 y2, Z z) { make(_toDouble(x1),_toDouble(x2),_toDouble(y1),_toDouble(y2),_toDouble(z)); } /// Set the Trapezoid dimensions @@ -517,8 +522,8 @@ namespace DD4hep { } /// Constructor to be used when passing an already created object - Torus(const Torus& e) - : Solid_type<TGeoTorus>(e) { + Torus(const Torus& e) + : Solid_type<TGeoTorus>(e) { } /// Constructor to be used when passing an already created object @@ -528,12 +533,12 @@ namespace DD4hep { /// Constructor to create a new anonymous object with attribute initialization template<typename R, typename RMIN, typename RMAX, typename PHI, typename DELTA_PHI> - Torus(R r, RMIN rmin, RMAX rmax, PHI phi=M_PI, DELTA_PHI delta_phi = 2.*M_PI) + Torus(R r, RMIN rmin, RMAX rmax, PHI phi=M_PI, DELTA_PHI delta_phi = 2.*M_PI) { make(_toDouble(r),_toDouble(rmin),_toDouble(rmax),_toDouble(phi),_toDouble(delta_phi)); } /// Constructor to create a new anonymous object with attribute initialization Torus(double r, double rmin, double rmax, double phi=M_PI, double delta_phi = 2.*M_PI) - { make(r,rmin,rmax,phi,delta_phi); } + { make(r,rmin,rmax,phi,delta_phi); } /// Set the Torus dimensions Torus& setDimensions(double r, double rmin, double rmax, double phi, double delta_phi); @@ -558,7 +563,7 @@ namespace DD4hep { /// Constructor to be used when passing an already created object Sphere(const Sphere& e) - : Solid_type<TGeoSphere>(e) { + : Solid_type<TGeoSphere>(e) { } /// Constructor to be used when passing an already created object @@ -592,7 +597,7 @@ namespace DD4hep { /// Constructor to be used when passing an already created object Paraboloid(const Paraboloid& e) - : Solid_type<TGeoParaboloid>(e) { + : Solid_type<TGeoParaboloid>(e) { } /// Constructor to be used when passing an already created object @@ -656,12 +661,12 @@ namespace DD4hep { /// Constructor to be used when passing an already created object PolyhedraRegular(const PolyhedraRegular& e) - : Solid_type<TGeoPgon>(e) { + : Solid_type<TGeoPgon>(e) { } /// Constructor to be used when passing an already created object template <typename Q> - PolyhedraRegular(const Handle<Q>& e) + PolyhedraRegular(const Handle<Q>& e) : Solid_type<TGeoPgon>(e) { } @@ -694,8 +699,8 @@ namespace DD4hep { } /// Constructor to be used when passing an already created object - EightPointSolid(const EightPointSolid& e) - : Solid_type<TGeoArb8>(e) { + EightPointSolid(const EightPointSolid& e) + : Solid_type<TGeoArb8>(e) { } /// Constructor to be used when passing an already created object @@ -719,14 +724,14 @@ namespace DD4hep { class BooleanSolid: public Solid_type<TGeoCompositeShape> { protected: /// Constructor to be used when passing an already created object - BooleanSolid() - : Solid_type<TGeoCompositeShape>() { + BooleanSolid() + : Solid_type<TGeoCompositeShape>() { } public: /// Constructor to be used when passing an already created object template <typename Q> - BooleanSolid(const Handle<Q>& e) + BooleanSolid(const Handle<Q>& e) : Solid_type<TGeoCompositeShape>(e) { } }; @@ -744,12 +749,12 @@ namespace DD4hep { class SubtractionSolid: public BooleanSolid { public: /// Default constructor - SubtractionSolid() - : BooleanSolid() { + SubtractionSolid() + : BooleanSolid() { } /// Constructor to be used when passing an already created object - SubtractionSolid(const SubtractionSolid& e) - : BooleanSolid(e) { + SubtractionSolid(const SubtractionSolid& e) + : BooleanSolid(e) { } /// Constructor to be used when passing an already created object template <typename Q> SubtractionSolid(const Handle<Q>& e) @@ -780,12 +785,12 @@ namespace DD4hep { class UnionSolid: public BooleanSolid { public: /// Default constructor - UnionSolid() - : BooleanSolid() { + UnionSolid() + : BooleanSolid() { } /// Constructor to be used when passing an already created object - UnionSolid(const UnionSolid& e) - : BooleanSolid(e) { + UnionSolid(const UnionSolid& e) + : BooleanSolid(e) { } /// Constructor to be used when passing an already created object template <typename Q> UnionSolid(const Handle<Q>& e) @@ -816,12 +821,12 @@ namespace DD4hep { class IntersectionSolid: public BooleanSolid { public: /// Default constructor - IntersectionSolid() - : BooleanSolid() { + IntersectionSolid() + : BooleanSolid() { } /// Constructor to be used when passing an already created object - IntersectionSolid(const IntersectionSolid& e) - : BooleanSolid(e) { + IntersectionSolid(const IntersectionSolid& e) + : BooleanSolid(e) { } /// Constructor to be used when passing an already created object template <typename Q> IntersectionSolid(const Handle<Q>& e) diff --git a/DDCore/include/DD4hep/SurfaceInstaller.h b/DDCore/include/DD4hep/SurfaceInstaller.h index 69b53a10aa5be974bbf8663bc6f0ee26d1b317af..cf3b8d292ece60e9374dea23432e8cb9caa7ab2e 100644 --- a/DDCore/include/DD4hep/SurfaceInstaller.h +++ b/DDCore/include/DD4hep/SurfaceInstaller.h @@ -1,11 +1,16 @@ -// $Id: SiTrackerBarrel_geo.cpp 1360 2014-10-27 16:32:06Z Nikiforos.Nikiforou@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDREC_SURFACEINSTALLER_H #define DD4HEP_DDREC_SURFACEINSTALLER_H 1 @@ -164,13 +169,13 @@ namespace { template <typename UserData> Installer<UserData>::Installer(LCDD& lcdd, int argc, char** argv) : DD4hep::SurfaceInstaller(lcdd, argc, argv) - { - handle_arguments(argc, argv); - } + { + handle_arguments(argc, argv); + } /// Handle surface installation using cached surfaces. template <typename UserData> - bool Installer<UserData>::handleUsingCache(DetElement comp, Volume vol) const { + bool Installer<UserData>::handleUsingCache(DetElement comp, Volume vol) const { Surfaces::const_iterator is = m_surfaces.find(vol.ptr()); if ( is != m_surfaces.end() ) { VolSurface surf((*is).second); @@ -182,7 +187,7 @@ namespace { /// Add a new surface to the surface manager and the local cache template <typename UserData> - void Installer<UserData>::addSurface(DetElement component, const DD4hep::DDRec::VolSurface& surf) { + void Installer<UserData>::addSurface(DetElement component, const DD4hep::DDRec::VolSurface& surf) { m_surfaces.insert(std::make_pair(surf.volume().ptr(),surf.ptr())); DD4hep::DDRec::volSurfaceList(component)->push_back(surf); } diff --git a/DDCore/include/DD4hep/ToStream.h b/DDCore/include/DD4hep/ToStream.h index 3537cfded0b047c487cbead2da46a3677dd8d298..63743a4c16adf2d7283bf13a4c0a808428522c8d 100644 --- a/DDCore/include/DD4hep/ToStream.h +++ b/DDCore/include/DD4hep/ToStream.h @@ -1,7 +1,16 @@ -// $Id: ToStream.h,v 1.8 2008/10/30 23:38:46 marcocle Exp $ -// ============================================================================ -// CVS tag $Name: $, version $Revision: 1.8 $ -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEPPROPERTYPARSERS_PARSERVALUETOSTREAM_H #define DD4HEPPROPERTYPARSERS_PARSERVALUETOSTREAM_H 1 // ============================================================================ @@ -45,7 +54,7 @@ namespace DD4hep { * @date 2006-05-12 */ template <class TYPE> - std::ostream& toStream(const TYPE& obj, std::ostream& s); + std::ostream& toStream(const TYPE& obj, std::ostream& s); // ======================================================================== /// the helper function to print the sequence /** @param first (INPUT) begin-iterator for the sequence @@ -59,12 +68,12 @@ namespace DD4hep { * @date 2009-09-15 */ template <class ITERATOR> - inline std::ostream& toStream(ITERATOR first, // begin of the sequence - ITERATOR last, // end of the sequence - std::ostream& s, // the stream - const std::string& open, // opening - const std::string& close, // closing - const std::string& delim); // delimiter + inline std::ostream& toStream(ITERATOR first, // begin of the sequence + ITERATOR last, // end of the sequence + std::ostream& s, // the stream + const std::string& open, // opening + const std::string& close, // closing + const std::string& delim); // delimiter // ======================================================================== /// the printtout of the strings. /** the string is printed a'la Python using the quotes @@ -121,7 +130,7 @@ namespace DD4hep { * @date 2006-05-12 */ template <class KTYPE, class VTYPE> - inline std::ostream& toStream(const std::pair<KTYPE, VTYPE>& obj, std::ostream& s) { + inline std::ostream& toStream(const std::pair<KTYPE, VTYPE>& obj, std::ostream& s) { s << "( "; toStream(obj.first, s); s << " , "; @@ -136,7 +145,7 @@ namespace DD4hep { * @date 2006-05-12 */ template <class TYPE, class ALLOCATOR> - inline std::ostream& toStream(const std::vector<TYPE, ALLOCATOR>& obj, std::ostream& s) { + inline std::ostream& toStream(const std::vector<TYPE, ALLOCATOR>& obj, std::ostream& s) { return toStream(obj.begin(), obj.end(), s, "[ ", " ]", " , "); } // ======================================================================== @@ -147,7 +156,7 @@ namespace DD4hep { * @date 2007-04-08 */ template <class TYPE, class ALLOCATOR> - inline std::ostream& toStream(const std::list<TYPE, ALLOCATOR>& obj, std::ostream& s) { + inline std::ostream& toStream(const std::list<TYPE, ALLOCATOR>& obj, std::ostream& s) { return toStream(obj.begin(), obj.end(), s, "[ ", " ]", " , "); } // ======================================================================== @@ -158,7 +167,7 @@ namespace DD4hep { * @date 2006-05-12 */ template <class TYPE, class CMP, class ALLOCATOR> - inline std::ostream& toStream(const std::set<TYPE, CMP, ALLOCATOR>& obj, std::ostream& s) { + inline std::ostream& toStream(const std::set<TYPE, CMP, ALLOCATOR>& obj, std::ostream& s) { return toStream(obj.begin(), obj.end(), s, "[ ", " ]", " , "); } // ======================================================================== @@ -170,7 +179,7 @@ namespace DD4hep { * @date 2006-05-12 */ template <class KTYPE, class VTYPE, class CMP, class ALLOCATOR> - inline std::ostream& toStream(const std::map<KTYPE, VTYPE, CMP, ALLOCATOR>& obj, std::ostream& s) { + inline std::ostream& toStream(const std::map<KTYPE, VTYPE, CMP, ALLOCATOR>& obj, std::ostream& s) { s << "{ "; for (typename std::map<KTYPE, VTYPE, CMP, ALLOCATOR>::const_iterator cur = obj.begin(); obj.end() != cur; ++cur) { if (obj.begin() != cur) { @@ -189,7 +198,7 @@ namespace DD4hep { * @date 2009-10-05 */ template <class TYPE, unsigned int N> - std::ostream& toStream(TYPE (&obj)[N], std::ostream& s) { + std::ostream& toStream(TYPE (&obj)[N], std::ostream& s) { return toStream(obj, obj + N, s, "( ", " )", " , "); } // ======================================================================== @@ -198,7 +207,7 @@ namespace DD4hep { * @date 2009-10-05 */ template <class TYPE, unsigned int N> - std::ostream& toStream(const TYPE (&obj)[N], std::ostream& s) { + std::ostream& toStream(const TYPE (&obj)[N], std::ostream& s) { return toStream(obj, obj + N, s, "( ", " )", " , "); } // ======================================================================== @@ -207,7 +216,7 @@ namespace DD4hep { * @date 2009-10-05 */ template <unsigned int N> - std::ostream& toStream(char (&obj)[N], std::ostream& s) { + std::ostream& toStream(char (&obj)[N], std::ostream& s) { return toStream(std::string(obj, obj + N), s); } // ======================================================================== @@ -216,7 +225,7 @@ namespace DD4hep { * @date 2009-10-05 */ template <unsigned int N> - std::ostream& toStream(const char (&obj)[N], std::ostream& s) { + std::ostream& toStream(const char (&obj)[N], std::ostream& s) { return toStream(std::string(obj, obj + N), s); } // ======================================================================== @@ -234,7 +243,7 @@ namespace DD4hep { * @date 2006-05-12 */ template <class TYPE> - inline std::ostream& toStream(const TYPE& obj, std::ostream& s) { + inline std::ostream& toStream(const TYPE& obj, std::ostream& s) { return s << obj; } // ======================================================================== @@ -250,24 +259,24 @@ namespace DD4hep { * @date 2009-09-15 */ template <class ITERATOR> - inline std::ostream& toStream(ITERATOR first, // begin of the sequence - ITERATOR last, // end of the sequence - std::ostream& s, // the stream - const std::string& open, // opening - const std::string& close, // closing - const std::string& delim) // delimiter - { - s << open; - for (ITERATOR curr = first; curr != last; ++curr) { - if (first != curr) { - s << delim; - } - toStream(*curr, s); + inline std::ostream& toStream(ITERATOR first, // begin of the sequence + ITERATOR last, // end of the sequence + std::ostream& s, // the stream + const std::string& open, // opening + const std::string& close, // closing + const std::string& delim) // delimiter + { + s << open; + for (ITERATOR curr = first; curr != last; ++curr) { + if (first != curr) { + s << delim; } - s << close; - // - return s; + toStream(*curr, s); } + s << close; + // + return s; + } // ======================================================================== /** the generic implementation of the type conversion to the string * @author Alexander MAZUROV Alexander.Mazurov@gmail.com @@ -277,7 +286,7 @@ namespace DD4hep { * @todo need to be compared with boost::lexical_cast */ template <class TYPE> - inline std::string toString(const TYPE& obj) { + inline std::string toString(const TYPE& obj) { std::ostringstream s; std::ios::fmtflags orig_flags = s.flags(); s.setf(std::ios::showpoint); // to display correctly floats diff --git a/DDCore/include/DD4hep/VolumeManager.h b/DDCore/include/DD4hep/VolumeManager.h index 1e29667c4592a7678ce77abba5daf263ed8bb429..a63be26f56d83fa2ce842c385cf542e77ed4425c 100644 --- a/DDCore/include/DD4hep/VolumeManager.h +++ b/DDCore/include/DD4hep/VolumeManager.h @@ -1,11 +1,17 @@ -// $Id: VolumeManager.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4hep_GEOMETRY_VOLUMEMANAGER_H #define DD4hep_GEOMETRY_VOLUMEMANAGER_H @@ -92,17 +98,17 @@ namespace DD4hep { public: /// Default constructor - VolumeManager() - : Handle<VolumeManagerObject>() { + VolumeManager() + : Handle<VolumeManagerObject>() { } /// Constructor to be used when reading the already parsed object - VolumeManager(const VolumeManager& e) - : Handle<VolumeManagerObject>(e) { + VolumeManager(const VolumeManager& e) + : Handle<VolumeManagerObject>(e) { } #ifndef __CINT__ /// Constructor to be used when reading the already parsed object - VolumeManager(const Handle<VolumeManagerObject>& e) - : Handle<VolumeManagerObject>(e) { + VolumeManager(const Handle<VolumeManagerObject>& e) + : Handle<VolumeManagerObject>(e) { } #endif /// Constructor to be used when reading the already parsed object diff --git a/DDCore/include/DD4hep/Volumes.h b/DDCore/include/DD4hep/Volumes.h index 68cd2c13a428848ac8ab9f67b04707ace28ce306..1975f13c270ad952f9c8215a47fdf481d81db1e6 100644 --- a/DDCore/include/DD4hep/Volumes.h +++ b/DDCore/include/DD4hep/Volumes.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEOMETRY_VOLUMES_H #define DD4HEP_GEOMETRY_VOLUMES_H @@ -29,7 +35,7 @@ // Older ROOT version #define DD4HEP_EMULATE_TGEOEXTENSIONS class TGeoExtension : public TObject { - public: +public: virtual ~TGeoExtension() {} /// TGeoExtension overload: Method called whenever requiring a pointer to the extension virtual TGeoExtension *Grab() = 0; @@ -76,7 +82,7 @@ namespace DD4hep { class VolIDs: public std::vector<VolID> { public: typedef std::vector<VolID> Base; - VolIDs() : std::vector<VolID>() { + VolIDs() : std::vector<VolID>() { } ~VolIDs() { } @@ -125,16 +131,16 @@ namespace DD4hep { typedef Object::VolID VolID; /// Constructor to be used when reading the already parsed DOM tree - PlacedVolume(const TGeoNode* e) - : Handle<TGeoNode>(e) { + PlacedVolume(const TGeoNode* e) + : Handle<TGeoNode>(e) { } /// Default constructor - PlacedVolume() - : Handle<TGeoNode>() { + PlacedVolume() + : Handle<TGeoNode>() { } /// Copy assignment - PlacedVolume(const PlacedVolume& e) - : Handle<TGeoNode>(e) { + PlacedVolume(const PlacedVolume& e) + : Handle<TGeoNode>(e) { } /// Copy assignment from other handle type template <typename T> PlacedVolume(const Handle<T>& e) @@ -223,18 +229,18 @@ namespace DD4hep { public: /// Default constructor - Volume() - : Base(0) { + Volume() + : Base(0) { } /// Copy from handle - Volume(const TGeoVolume* v) - : Base(v) { + Volume(const TGeoVolume* v) + : Base(v) { } /// Copy from handle - Volume(const Volume& v) - : Base(v) { + Volume(const Volume& v) + : Base(v) { } /// Copy from arbitrary Element @@ -329,13 +335,13 @@ namespace DD4hep { class Assembly: public Volume { public: /// Default constructor - Assembly() - : Volume() { + Assembly() + : Volume() { } /// Copy from handle - Assembly(const Assembly& v) - : Volume(v) { + Assembly(const Assembly& v) + : Volume(v) { } /// Copy from arbitrary Element diff --git a/DDCore/include/DD4hep/config.h b/DDCore/include/DD4hep/config.h index 6ea04ce4ed922d36377bae9370290048d71ad9f3..c8b451275732e633d54b80646b279e4a3bb471ba 100644 --- a/DDCore/include/DD4hep/config.h +++ b/DDCore/include/DD4hep/config.h @@ -1,12 +1,16 @@ // $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_CONFIG_H #define DD4HEP_CONFIG_H diff --git a/DDCore/include/DD4hep/objects/BasicGrammar_inl.h b/DDCore/include/DD4hep/objects/BasicGrammar_inl.h index d73aa130877704cf4564e66d9655f93c86279af4..e7aeb72040e20889efe4949b731b97ac63803db7 100644 --- a/DDCore/include/DD4hep/objects/BasicGrammar_inl.h +++ b/DDCore/include/DD4hep/objects/BasicGrammar_inl.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GRAMMAR_INL_H #define DD4HEP_DDG4_GRAMMAR_INL_H @@ -91,8 +97,8 @@ namespace DD4hep { if ( !sc ) sc = evaluate(&temp,string_val); #if 0 std::cout << "Sc=" << sc << " Converting value: " << string_val - << " to type " << typeid(TYPE).name() - << std::endl; + << " to type " << typeid(TYPE).name() + << std::endl; #endif if ( sc ) { *(TYPE*)ptr = temp; @@ -100,8 +106,8 @@ namespace DD4hep { } #ifndef DD4HEP_USE_BOOST throw std::runtime_error("This version of DD4HEP is not compiled to use boost::spirit.\n" - "To enable elaborated property handling set DD4HEP_USE_BOOST=ON\n" - "and BOOST_INCLUDE_DIR=<boost include path>"); + "To enable elaborated property handling set DD4HEP_USE_BOOST=ON\n" + "and BOOST_INCLUDE_DIR=<boost include path>"); #else BasicGrammar::invalidConversion(string_val, typeid(TYPE)); return false; @@ -118,8 +124,8 @@ namespace DD4hep { if (ptr) { } throw std::runtime_error("This version of DD4HEP is not compiled to use boost::spirit.\n" - "To enable elaborated property handling set DD4HEP_USE_BOOST=ON\n" - "and BOOST_INCLUDE_DIR=<boost include path>"); + "To enable elaborated property handling set DD4HEP_USE_BOOST=ON\n" + "and BOOST_INCLUDE_DIR=<boost include path>"); #endif } @@ -130,21 +136,21 @@ namespace DD4hep { for(const char* c = in.c_str(); *c; ++c) { switch(*c) { case '\'': - return "Bad object representation"; + return "Bad object representation"; case ',': - res += "','"; - break; + res += "','"; + break; case '(': case '[': - res += "['"; - break; + res += "['"; + break; case ')': case ']': - res += "']"; - break; + res += "']"; + break; default: - res += *c; - break; + res += *c; + break; } } //cout << "Pre-parsed:" << res << endl; @@ -157,7 +163,7 @@ namespace DD4hep { TYPE val; for(std::vector<std::string>::const_iterator i=temp.begin(); i != temp.end(); ++i) { if ( !g.fromString(&val,*i) ) - return 0; + return 0; p->push_back(val); } return 1; @@ -169,7 +175,7 @@ namespace DD4hep { TYPE val; for(std::vector<std::string>::const_iterator i=temp.begin(); i != temp.end(); ++i) { if ( !g.fromString(&val,*i) ) - return 0; + return 0; p->push_back(val); } return 1; @@ -181,7 +187,7 @@ namespace DD4hep { TYPE val; for(std::vector<std::string>::const_iterator i=temp.begin(); i != temp.end(); ++i) { if ( !g.fromString(&val,*i) ) - return 0; + return 0; p->insert(val); } return 1; @@ -200,13 +206,13 @@ namespace DD4hep { std::string temp_str = pre_parse_obj(str); sc = Parsers::parse(temp,temp_str); if ( sc ) { - *p = temp; - return 1; + *p = temp; + return 1; } buff.clear(); sc = Parsers::parse(buff,temp_str); if ( sc ) { - return fill_data(p,buff); + return fill_data(p,buff); } } #else @@ -239,29 +245,29 @@ namespace DD4hep { } // End namespace DD4hep -#define DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x) namespace DD4hep { \ - template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> s; return s;}} +#define DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x) namespace DD4hep { \ + template<> const BasicGrammar& BasicGrammar::instance<x>() { static Grammar<x> s; return s;}} -#define DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(x,func) namespace DD4hep { \ - template<> int Grammar<x >::evaluate(void* p, const std::string& v) const { return func ((x*)p,v); }} +#define DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(x,func) namespace DD4hep { \ + template<> int Grammar<x >::evaluate(void* p, const std::string& v) const { return func ((x*)p,v); }} -#define DD4HEP_DEFINE_PARSER_GRAMMAR(x,func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR(x,func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(x) \ DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(x,func) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(x,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(x,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(std::vector<x>,eval_container) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(std::list<x>,eval_container) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(x,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(x,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(std::vector<x>,eval_container) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(std::list<x>,eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR(std::set<x>,eval_container) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL(x,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(x,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR(std::vector<x>,eval_container) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL(x,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(x,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR(std::vector<x>,eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR(std::list<x>,eval_container) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(x) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(x,eval_item) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(x) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(x,eval_item) \ DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(unsigned x,eval_item) #endif /* DD4HEP_DDG4_GRAMMAR_INL_H */ diff --git a/DDCore/include/DD4hep/objects/ConditionsInterna.h b/DDCore/include/DD4hep/objects/ConditionsInterna.h index 19c742f982e79faf546eaf5acd98238c65d1cdd6..41bf3fed4b69dd425b6792e881d775d510f67e6a 100644 --- a/DDCore/include/DD4hep/objects/ConditionsInterna.h +++ b/DDCore/include/DD4hep/objects/ConditionsInterna.h @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_CONDITIONINTERNA_H #define DD4HEP_GEOMETRY_CONDITIONINTERNA_H @@ -230,11 +235,11 @@ namespace DD4hep { } /* End namespace Geometry */ } /* End namespace DD4hep */ -#define DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ - namespace DD4hep { namespace Geometry { \ - template Condition& Condition::bind<x>(); \ - template x& Condition::get<x>(); \ - template const x& Condition::get<x>() const; \ +#define DD4HEP_DEFINE_CONDITIONS_TYPE(x) \ + namespace DD4hep { namespace Geometry { \ + template Condition& Condition::bind<x>(); \ + template x& Condition::get<x>(); \ + template const x& Condition::get<x>() const; \ }} #define DD4HEP_DEFINE_CONDITIONS_CONT(x) \ diff --git a/DDCore/include/DD4hep/objects/DetectorInterna.h b/DDCore/include/DD4hep/objects/DetectorInterna.h index 4e38457f72e2e26cebac043d85ef9587dc31a7f3..9a77cc2b3631f3213fde8193da423b90f08d9915 100644 --- a/DDCore/include/DD4hep/objects/DetectorInterna.h +++ b/DDCore/include/DD4hep/objects/DetectorInterna.h @@ -1,11 +1,16 @@ -// $Id: Detector.h 1087 2014-04-09 12:25:51Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEOMETRY_DETECTORINTERNA_H #define DD4HEP_GEOMETRY_DETECTORINTERNA_H diff --git a/DDCore/include/DD4hep/objects/ObjectsInterna.h b/DDCore/include/DD4hep/objects/ObjectsInterna.h index e9bed4f8afef5890bff14e4b721c3afcb54dc418..a2ed62884a828ab68bf0c5ad317eec343f93fba6 100644 --- a/DDCore/include/DD4hep/objects/ObjectsInterna.h +++ b/DDCore/include/DD4hep/objects/ObjectsInterna.h @@ -1,11 +1,17 @@ -// $Id: Detector.h 1087 2014-04-09 12:25:51Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEOMETRY_OBJECTSINTERNA_H #define DD4HEP_GEOMETRY_OBJECTSINTERNA_H @@ -47,7 +53,7 @@ namespace DD4hep { virtual ~HeaderObject(); private: /// Private copy constructor - HeaderObject(const HeaderObject&) : NamedObject() {} + HeaderObject(const HeaderObject&) : NamedObject() {} /// Private assignment operator HeaderObject& operator=(const HeaderObject&) { return *this; } }; @@ -69,7 +75,7 @@ namespace DD4hep { virtual ~ConstantObject(); private: /// Private copy constructor - ConstantObject(const ConstantObject&) : NamedObject() {} + ConstantObject(const ConstantObject&) : NamedObject() {} /// Private assignment operator ConstantObject& operator=(const ConstantObject&) { return *this; } }; diff --git a/DDCore/include/DD4hep/objects/VolumeManagerInterna.h b/DDCore/include/DD4hep/objects/VolumeManagerInterna.h index b34425e2f922dd2e3e3f70611b35065c08bf6265..e8e8f826d0f2e35ffcd9c135ae5af560639fe473 100644 --- a/DDCore/include/DD4hep/objects/VolumeManagerInterna.h +++ b/DDCore/include/DD4hep/objects/VolumeManagerInterna.h @@ -1,11 +1,17 @@ -// $Id: VolumeManager.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEOMETRY_VOLUMEMANAGERINTERNA_H #define DD4HEP_GEOMETRY_VOLUMEMANAGERINTERNA_H diff --git a/DDCore/include/ROOT/LinkDef.h b/DDCore/include/ROOT/LinkDef.h index cea2a4e8bb0cbec9cfcccd5200664993a265580b..ab9e1001635b38a4f7c4840fffe1cdf649a34b0b 100644 --- a/DDCore/include/ROOT/LinkDef.h +++ b/DDCore/include/ROOT/LinkDef.h @@ -1,9 +1,18 @@ +// $Id$ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// LinkDef.h +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== // +// LinkDef.h // // Created by Pere Mato on 22/1/12. -// Copyright 2012 __MyCompanyName__. All rights reserved. // // Keep this file EMPTY. All CINT statements can be put in header files preceeding this one..... // diff --git a/DDCore/include/XML/Conversions.h b/DDCore/include/XML/Conversions.h index 613db4cc26d81192f946cd078848377ecb6ca603..119e7f1b09ead3437fc3e1f6fce2c070c100af73 100644 --- a/DDCore/include/XML/Conversions.h +++ b/DDCore/include/XML/Conversions.h @@ -1,17 +1,24 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4hep_COMPACT_CONVERSION_H #define DD4hep_COMPACT_CONVERSION_H // C/C++ include files #include <map> #include <iostream> + +// Framework include files #include "DD4hep/LCDD.h" /// Namespace for the AIDA detector description toolkit @@ -36,13 +43,13 @@ namespace DD4hep { /// Reference to optional user defined parameter user_param param; /// Initializing constructor of the functor - Converter(Geometry::LCDD& l) - : lcdd(l), param(0) { - } + Converter(Geometry::LCDD& l) + : lcdd(l), param(0) { + } /// Initializing constructor of the functor with initialization of the user parameter - Converter(Geometry::LCDD& l, user_param p) - : lcdd(l), param(p) { - } + Converter(Geometry::LCDD& l, user_param p) + : lcdd(l), param(p) { + } /// Callback operator to be specialized depending on the element type void operator()(XML::Handle_t xml) const; /// Typed access to the user parameter (unchecked) diff --git a/DDCore/include/XML/DocumentHandler.h b/DDCore/include/XML/DocumentHandler.h index 02b217030033d91db2a31f6e77824996112e1fcc..ac1dd7f7dccfaf5afa0ccb2024f2db7226b57ef3 100644 --- a/DDCore/include/XML/DocumentHandler.h +++ b/DDCore/include/XML/DocumentHandler.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_XML_DOCUMENTHANDLER_H #define DD4HEP_XML_DOCUMENTHANDLER_H diff --git a/DDCore/include/XML/Evaluator.h b/DDCore/include/XML/Evaluator.h index 8e611de9eff0e1039342e5aa98c664f8d5b01ad6..c542ddf42c1362fee0b1b9a11d7cebaffcacb189 100644 --- a/DDCore/include/XML/Evaluator.h +++ b/DDCore/include/XML/Evaluator.h @@ -1,3 +1,14 @@ +// $Id$ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== // -*- C++ -*- // $Id$ // --------------------------------------------------------------------------- diff --git a/DDCore/include/XML/Layering.h b/DDCore/include/XML/Layering.h index 544074a386e9c338d784bcfb722498fcb389cdfd..1ba9231f2c6d52f64af15ebe2300ad2a804f6427 100644 --- a/DDCore/include/XML/Layering.h +++ b/DDCore/include/XML/Layering.h @@ -1,16 +1,24 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4hep_LAYERING_H #define DD4hep_LAYERING_H + +// Framework include files #include "XML/XMLElements.h" +// C/C++ include files #include <vector> /// Namespace for the AIDA detector description toolkit diff --git a/DDCore/include/XML/UnicodeValues.h b/DDCore/include/XML/UnicodeValues.h index 8a8bfc4c7dffc0944b3116fbb17a8482cae5fda0..8b3a93a3bc6edf864d89ff2bae234a94fb4d6afe 100644 --- a/DDCore/include/XML/UnicodeValues.h +++ b/DDCore/include/XML/UnicodeValues.h @@ -1,3 +1,18 @@ +// $Id$ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + + /// Namespace for the AIDA detector description toolkit namespace DD4hep { diff --git a/DDCore/include/XML/Utilities.h b/DDCore/include/XML/Utilities.h index fc3b164d73bd89b910e410b85c17f12dcbba718c..f74284f6c06db2c489617ef79fb13c36156366d2 100644 --- a/DDCore/include/XML/Utilities.h +++ b/DDCore/include/XML/Utilities.h @@ -1,14 +1,21 @@ -// $Id: Conversions.h 1479 2014-12-18 16:00:45Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4hep_XML_XMLUTILITIES_H #define DD4hep_XML_XMLUTILITIES_H +// Framework include files #include "XML/Conversions.h" #include "XML/XMLElements.h" #include "DD4hep/LCDD.h" @@ -29,16 +36,16 @@ namespace DD4hep { * Example: <br> @verbatim <envelope vis="ILD_ECALVis"> - <shape type="PolyhedraRegular" numsides="8" rmin="TPC_outer_radius+Ecal_Tpc_gap" rmax="Ecal_outer_radius" - dz="2.*TPC_Ecal_Hcal_barrel_halfZ" material = "Air" /> - <rotation x="0*deg" y="0*deg" z="90*deg-180*deg/8"/> + <shape type="PolyhedraRegular" numsides="8" rmin="TPC_outer_radius+Ecal_Tpc_gap" rmax="Ecal_outer_radius" + dz="2.*TPC_Ecal_Hcal_barrel_halfZ" material = "Air" /> + <rotation x="0*deg" y="0*deg" z="90*deg-180*deg/8"/> </envelope> @endverbatim * @author S.Lu DESY, F. Gaede CERN/DESY * @version $Id:$ */ Geometry::Volume createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd, DD4hep::XML::Handle_t e , - DD4hep::Geometry::DetElement sdet ) ; + DD4hep::Geometry::DetElement sdet ) ; } /* End namespace XML */ } /* End namespace DD4hep */ diff --git a/DDCore/include/XML/XMLChildValue.h b/DDCore/include/XML/XMLChildValue.h index 339aa3f7541179220a3e377adc542e9e92334e16..8f8c635d8298b27d2c37fa2c532e3d66f4162179 100644 --- a/DDCore/include/XML/XMLChildValue.h +++ b/DDCore/include/XML/XMLChildValue.h @@ -1,11 +1,17 @@ -// $Id: XMLDetector.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_XMLCHILDVALUE_H #define DD4HEP_XMLCHILDVALUE_H @@ -53,16 +59,16 @@ namespace DD4hep { */ struct ChildValue: public Element { /// Default constructor - ChildValue() - : Element(Handle_t(0)) { + ChildValue() + : Element(Handle_t(0)) { } /// Constructor from Handle - ChildValue(Handle_t e) - : Element(e) { + ChildValue(Handle_t e) + : Element(e) { } /// Constructor from Element - ChildValue(const Element& e) - : Element(e) { + ChildValue(const Element& e) + : Element(e) { } /// Access parameters: id diff --git a/DDCore/include/XML/XMLDetector.h b/DDCore/include/XML/XMLDetector.h index f836eb9c22051478ccc9f23e30f39315438b8d08..f19b1b25ca28be6d4d1ba1002e66a247b7476a62 100644 --- a/DDCore/include/XML/XMLDetector.h +++ b/DDCore/include/XML/XMLDetector.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_XMLDETECTOR_H #define DD4HEP_XMLDETECTOR_H @@ -32,12 +38,12 @@ namespace DD4hep { */ struct Component: public Dimension { /// Constructor from Handle - Component(Handle_t e) - : Dimension(e) { + Component(Handle_t e) + : Dimension(e) { } /// Constructor from Element - Component(const Element& e) - : Dimension(e) { + Component(const Element& e) + : Dimension(e) { } /// Access material attribute as STL string std::string materialStr() const; @@ -62,8 +68,8 @@ namespace DD4hep { */ struct DetElement: public Dimension { /// Constructor from Handle - DetElement(Handle_t e) - : Dimension(e) { + DetElement(Handle_t e) + : Dimension(e) { } /// Access underlying XML handle object Handle_t handle() const { diff --git a/DDCore/include/XML/XMLDimension.h b/DDCore/include/XML/XMLDimension.h index 5c8391c265ae6fd316db3efb04b5f12b91bc9b53..0f9869baee337062dd7abd7a13472ef4c69a3409 100644 --- a/DDCore/include/XML/XMLDimension.h +++ b/DDCore/include/XML/XMLDimension.h @@ -1,11 +1,17 @@ -// $Id: XMLDetector.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_XMLDIMENSION_H #define DD4HEP_XMLDIMENSION_H @@ -45,16 +51,16 @@ namespace DD4hep { */ struct Dimension: public Element { /// Default constructor - Dimension() - : Element(Handle_t(0)) { + Dimension() + : Element(Handle_t(0)) { } /// Constructor from Handle - Dimension(Handle_t e) - : Element(e) { + Dimension(Handle_t e) + : Element(e) { } /// Constructor from Element - Dimension(const Element& e) - : Element(e) { + Dimension(const Element& e) + : Element(e) { } /// Access parameters: id diff --git a/DDCore/include/XML/XMLElements.h b/DDCore/include/XML/XMLElements.h index b0dc23d19c8d68cf27bc862a49b107886105a5f7..956bb74120a269782723e3c29744076675c4e1bc 100644 --- a/DDCore/include/XML/XMLElements.h +++ b/DDCore/include/XML/XMLElements.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_XMLELEMENTS_H #define DD4HEP_XMLELEMENTS_H @@ -73,9 +78,9 @@ namespace DD4hep { class XmlException { public: std::string msg; - XmlException() : msg() {} - XmlException(const std::string& m) : msg(m) {} - XmlException(const XmlException& e) : msg(e.msg) {} + XmlException() : msg() {} + XmlException(const std::string& m) : msg(m) {} + XmlException(const XmlException& e) : msg(e.msg) {} virtual ~XmlException() {} XmlException& operator=(const XmlException& c) { if ( &c != this ) msg = c.msg; @@ -113,7 +118,7 @@ namespace DD4hep { std::string _ptrToString(const void* p, const char* fmt = "%p"); /// Format void pointer (64 bits) to string with arbitrary format \ingroup DD4HEP_XML template <typename T> std::string _toString(const T* p, const char* fmt = "%p") - { return _ptrToString((void*)p,fmt); } + { return _ptrToString((void*)p,fmt); } /// Helper function to populate the evaluator dictionary \ingroup DD4HEP_XML void _toDictionary(const XmlChar* name, const XmlChar* value); @@ -233,27 +238,27 @@ namespace DD4hep { std::string m_str; #ifndef __TIXML__ /// Constructor from normal ASCII string - Tag_t(const char* s) - : Strng_t(s), m_str(s) { + Tag_t(const char* s) + : Strng_t(s), m_str(s) { } #endif /// Constructor from unicode string - Tag_t(const XmlChar* s) - : Strng_t(s), m_str(_toString(s)) { + Tag_t(const XmlChar* s) + : Strng_t(s), m_str(_toString(s)) { } /// Constructor from internal XML string - Tag_t(const Strng_t& s) - : Strng_t(s), m_str(_toString(s)) { + Tag_t(const Strng_t& s) + : Strng_t(s), m_str(_toString(s)) { } /// Constructor from STL string - Tag_t(const std::string& s) - : Strng_t(s), m_str(s) { + Tag_t(const std::string& s) + : Strng_t(s), m_str(s) { } /// Constructor from STL string with registration. /// ONLY to be used for static global entries to protect against duplicated static memory. - Tag_t(const std::string& v, const std::string& s, void (*register_func)(const std::string&, Tag_t*)) - : Strng_t(s), m_str(s) { - register_func(v, this); + Tag_t(const std::string& v, const std::string& s, void (*register_func)(const std::string&, Tag_t*)) + : Strng_t(s), m_str(s) { + register_func(v, this); } /// Destructor ~Tag_t() { @@ -349,8 +354,8 @@ namespace DD4hep { mutable Elt_t m_node; /// Initializing constructor - Handle_t(Elt_t e = 0) - : m_node(e) { + Handle_t(Elt_t e = 0) + : m_node(e) { } /// Direct access to the XmlElement using the operator-> Elt_t operator->() const { @@ -510,19 +515,19 @@ namespace DD4hep { } #if 0 template<> INLINE bool Handle_t::attr<bool>(const Attribute tag_value) const - { return _toBool(attr_value(tag_value));} + { return _toBool(attr_value(tag_value));} template<> INLINE int Handle_t::attr<int>(const Attribute tag_value) const - { return _toInt(attr_value(tag_value));} + { return _toInt(attr_value(tag_value));} template<> INLINE float Handle_t::attr<float>(const Attribute tag_value) const - { return _toFloat(attr_value(tag_value));} + { return _toFloat(attr_value(tag_value));} template<> INLINE double Handle_t::attr<double>(const Attribute tag_value) const - { return _toDouble(attr_value(tag_value));} + { return _toDouble(attr_value(tag_value));} template<> INLINE std::string Handle_t::attr<std::string>(const Attribute tag_value) const - { return _toString(attr_value(tag_value));} + { return _toString(attr_value(tag_value));} #endif /// Class to support the access to collections of XmlNodes (or XmlElements) @@ -598,8 +603,8 @@ namespace DD4hep { DOC m_doc; /// Constructor - Document(DOC d) - : m_doc(d) { + Document(DOC d) + : m_doc(d) { } /// Auto-conversion to DOM document operator DOC() const { @@ -637,8 +642,8 @@ namespace DD4hep { class DocumentHolder : public Document { public: /// Constructor - DocumentHolder(DOC d) - : Document(d) { + DocumentHolder(DOC d) + : Document(d) { } /// Standard destructor - releases the document virtual ~DocumentHolder(); @@ -665,8 +670,8 @@ namespace DD4hep { Handle_t m_element; /// Constructor from XmlElement handle - Element(const Handle_t& e) - : m_element(e) { + Element(const Handle_t& e) + : m_element(e) { } /// Constructor from DOM document entity Element(const Document& document, const XmlChar* type); @@ -761,7 +766,7 @@ namespace DD4hep { Attribute getAttr(const XmlChar* name) const; /// Set single attribute template <class T> - Attribute setAttr(const XmlChar* nam, const T& val) const { + Attribute setAttr(const XmlChar* nam, const T& val) const { return m_element.setAttr(nam, val); } /// Set element value diff --git a/DDCore/include/XML/XMLTags.h b/DDCore/include/XML/XMLTags.h index b6e24665058d9496609814dbe455d4522849340e..5732956c694d33990c9aa3ebf07ca4edf0815f0b 100644 --- a/DDCore/include/XML/XMLTags.h +++ b/DDCore/include/XML/XMLTags.h @@ -1,16 +1,23 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4hep_XML_TAGS_H #define DD4hep_XML_TAGS_H #define DECLARE_UNICODE_TAG(x) extern const Tag_t Unicode_##x (#x) +// Framework include files #include "XML/XMLElements.h" #define UNICODE(x) extern const Tag_t Unicode_##x #include "XML/UnicodeValues.h" diff --git a/DDCore/include/XML/config.h b/DDCore/include/XML/config.h index e39db645e7a5131b3f618bad2c0d846b56d97192..472ef8473d678e34a2548372201c44c12a00b2aa 100644 --- a/DDCore/include/XML/config.h +++ b/DDCore/include/XML/config.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_XML_CONFIG_H #define DD4HEP_XML_CONFIG_H @@ -13,6 +18,7 @@ #define __TIXML__ #endif +// C/C++ include files #include <cstdlib> /* Setup XML parsing for the use of Apache Xerces-C and TiXml diff --git a/DDCore/include/XML/tinystr.h b/DDCore/include/XML/tinystr.h index ca177a3f7247cfe03443035270bc26a001cd0a31..fcb7a7ab0af5781ce247d8fa5bbf1f5dcda1eb98 100644 --- a/DDCore/include/XML/tinystr.h +++ b/DDCore/include/XML/tinystr.h @@ -66,7 +66,7 @@ */ class TiXmlString { - public : +public : // The size type used typedef size_t size_type; @@ -76,66 +76,66 @@ class TiXmlString // TiXmlString empty constructor TiXmlString () : rep_(&nullrep_) - { - } + { + } // TiXmlString copy constructor TiXmlString ( const TiXmlString & copy) : rep_(0) - { - init(copy.length()); - memcpy(start(), copy.data(), length()); - } + { + init(copy.length()); + memcpy(start(), copy.data(), length()); + } // TiXmlString constructor, based on a string TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) - { - init( static_cast<size_type>( strlen(copy) )); - memcpy(start(), copy, length()); - } + { + init( static_cast<size_type>( strlen(copy) )); + memcpy(start(), copy, length()); + } // TiXmlString constructor, based on a string TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) - { - init(len); - memcpy(start(), str, len); - } + { + init(len); + memcpy(start(), str, len); + } // TiXmlString destructor ~TiXmlString () - { - quit(); - } + { + quit(); + } // = operator TiXmlString& operator = (const char * copy) - { - return assign( copy, (size_type)strlen(copy)); - } + { + return assign( copy, (size_type)strlen(copy)); + } // = operator TiXmlString& operator = (const TiXmlString & copy) - { - return assign(copy.start(), copy.length()); - } + { + return assign(copy.start(), copy.length()); + } // += operator. Maps to append TiXmlString& operator += (const char * suffix) - { - return append(suffix, static_cast<size_type>( strlen(suffix) )); - } + { + return append(suffix, static_cast<size_type>( strlen(suffix) )); + } // += operator. Maps to append TiXmlString& operator += (char single) - { - return append(&single, 1); - } + { + return append(&single, 1); + } // += operator. Maps to append TiXmlString& operator += (const TiXmlString & suffix) - { - return append(suffix.data(), suffix.length()); - } + { + return append(suffix.data(), suffix.length()); + } // Convert a TiXmlString into a null-terminated char * @@ -183,9 +183,9 @@ class TiXmlString if (offset >= length()) return npos; for (const char* p = c_str() + offset; *p != '\0'; ++p) - { - if (*p == tofind) return static_cast< size_type >( p - c_str() ); - } + { + if (*p == tofind) return static_cast< size_type >( p - c_str() ); + } return npos; } @@ -215,7 +215,7 @@ class TiXmlString other.rep_ = r; } - private: +private: void init(size_type sz) { init(sz, sz); } void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } @@ -231,33 +231,33 @@ class TiXmlString void init(size_type sz, size_type cap) { if (cap) - { - // Lee: the original form: - // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); - // doesn't work in some cases of new being overloaded. Switching - // to the normal allocation, although use an 'int' for systems - // that are overly picky about structure alignment. - const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); - rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); - - rep_->str[ rep_->size = sz ] = '\0'; - rep_->capacity = cap; - } + { + // Lee: the original form: + // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap)); + // doesn't work in some cases of new being overloaded. Switching + // to the normal allocation, although use an 'int' for systems + // that are overly picky about structure alignment. + const size_type bytesNeeded = sizeof(Rep) + cap; + const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); + rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] ); + + rep_->str[ rep_->size = sz ] = '\0'; + rep_->capacity = cap; + } else - { - rep_ = &nullrep_; - } + { + rep_ = &nullrep_; + } } void quit() { if (rep_ != &nullrep_) - { - // The rep_ is really an array of ints. (see the allocator, above). - // Cast it back before delete, so the compiler won't incorrectly call destructors. - delete [] ( reinterpret_cast<int*>( rep_ ) ); - } + { + // The rep_ is really an array of ints. (see the allocator, above). + // Cast it back before delete, so the compiler won't incorrectly call destructors. + delete [] ( reinterpret_cast<int*>( rep_ ) ); + } } Rep * rep_; @@ -269,7 +269,7 @@ class TiXmlString inline bool operator == (const TiXmlString & a, const TiXmlString & b) { return ( a.length() == b.length() ) // optimization on some platforms - && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare + && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare } inline bool operator < (const TiXmlString & a, const TiXmlString & b) { @@ -297,21 +297,21 @@ TiXmlString operator + (const char* a, const TiXmlString & b); */ class TiXmlOutStream : public TiXmlString { - public : +public : // TiXmlOutStream << operator. TiXmlOutStream & operator << (const TiXmlString & in) - { - *this += in; - return *this; - } + { + *this += in; + return *this; + } // TiXmlOutStream << operator. TiXmlOutStream & operator << (const char * in) - { - *this += in; - return *this; - } + { + *this += in; + return *this; + } } ; diff --git a/DDCore/include/XML/tinyxml.h b/DDCore/include/XML/tinyxml.h index 95921278ddb22577bdac2900c5c5c8375f526505..a2e71bc08123e0dbed26df8f964830c73e4f8e68 100644 --- a/DDCore/include/XML/tinyxml.h +++ b/DDCore/include/XML/tinyxml.h @@ -130,7 +130,7 @@ struct TiXmlCursor { @sa TiXmlNode::Accept() */ class TiXmlVisitor { - public: +public: virtual ~TiXmlVisitor() { } @@ -209,9 +209,9 @@ class TiXmlBase { friend class TiXmlElement; friend class TiXmlDocument; - public: - TiXmlBase() - : userData(0) { +public: + TiXmlBase() + : userData(0) { } virtual ~TiXmlBase() { } @@ -305,7 +305,7 @@ class TiXmlBase { TIXML_ERROR_STRING_COUNT }; - protected: +protected: static const char* SkipWhiteSpace(const char*, TiXmlEncoding encoding); inline static bool IsWhiteSpace(char c) { @@ -405,7 +405,7 @@ class TiXmlBase { } static void ConvertUTF32ToUTF8(unsigned long input, char* output, int* length); - private: +private: TiXmlBase(const TiXmlBase&); // not implemented. void operator=(const TiXmlBase& base); // not allowed. @@ -432,7 +432,7 @@ class TiXmlNode: public TiXmlBase { friend class TiXmlDocument; friend class TiXmlElement; - public: +public: #ifdef TIXML_USE_STL /** An input stream operator, for every class. Tolerant of newlines and @@ -836,7 +836,7 @@ class TiXmlNode: public TiXmlBase { */ virtual bool Accept(TiXmlVisitor* visitor) const = 0; - protected: +protected: TiXmlNode(NodeType _type); // Copy to the allocated object. Shared functionality between Clone, Copy constructor, @@ -862,7 +862,7 @@ class TiXmlNode: public TiXmlBase { TiXmlNode* prev; TiXmlNode* next; - private: +private: TiXmlNode(const TiXmlNode&); // not implemented. void operator=(const TiXmlNode& base); // not allowed. }; @@ -877,10 +877,10 @@ class TiXmlNode: public TiXmlBase { class TiXmlAttribute: public TiXmlBase { friend class TiXmlAttributeSet; - public: +public: /// Construct an empty attribute. - TiXmlAttribute() - : TiXmlBase() { + TiXmlAttribute() + : TiXmlBase() { document = 0; prev = next = 0; } @@ -995,7 +995,7 @@ class TiXmlAttribute: public TiXmlBase { document = doc; } - private: +private: TiXmlAttribute(const TiXmlAttribute&); // not implemented. void operator=(const TiXmlAttribute& base); // not allowed. @@ -1018,7 +1018,7 @@ class TiXmlAttribute: public TiXmlBase { - it demonstrates some independence from the (typical) doubly linked list. */ class TiXmlAttributeSet { - public: +public: TiXmlAttributeSet(); ~TiXmlAttributeSet(); @@ -1050,7 +1050,7 @@ class TiXmlAttributeSet { #endif - private: +private: //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), //*ME: this class must be also use a hidden/disabled copy-constructor !!! TiXmlAttributeSet(const TiXmlAttributeSet&); // not allowed @@ -1064,7 +1064,7 @@ class TiXmlAttributeSet { Elements also contain an arbitrary number of attributes. */ class TiXmlElement: public TiXmlNode { - public: +public: /// Construct an element. TiXmlElement(const char * in_value); @@ -1255,7 +1255,7 @@ class TiXmlElement: public TiXmlNode { */ virtual bool Accept(TiXmlVisitor* visitor) const; - protected: +protected: void CopyTo(TiXmlElement* target) const; void ClearThis(); // like clear, but initializes 'this' object as well @@ -1270,7 +1270,7 @@ class TiXmlElement: public TiXmlNode { */ const char* ReadValue(const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding); - private: +private: TiXmlAttributeSet attributeSet; }; @@ -1278,14 +1278,14 @@ class TiXmlElement: public TiXmlNode { /** An XML comment. */ class TiXmlComment: public TiXmlNode { - public: +public: /// Constructs an empty comment. - TiXmlComment() - : TiXmlNode(TiXmlNode::COMMENT) { + TiXmlComment() + : TiXmlNode(TiXmlNode::COMMENT) { } /// Construct a comment from text. - TiXmlComment(const char* _value) - : TiXmlNode(TiXmlNode::COMMENT) { + TiXmlComment(const char* _value) + : TiXmlNode(TiXmlNode::COMMENT) { SetValue(_value); } TiXmlComment(const TiXmlComment&); @@ -1315,7 +1315,7 @@ class TiXmlComment: public TiXmlNode { */ virtual bool Accept(TiXmlVisitor* visitor) const; - protected: +protected: void CopyTo(TiXmlComment* target) const; // used to be public @@ -1324,7 +1324,7 @@ class TiXmlComment: public TiXmlNode { #endif // virtual void StreamOut( TIXML_OSTREAM * out ) const; - private: +private: }; @@ -1335,13 +1335,13 @@ class TiXmlComment: public TiXmlNode { */ class TiXmlText: public TiXmlNode { friend class TiXmlElement; - public: +public: /** Constructor for text element. By default, it is treated as normal, encoded text. If you want it be output as a CDATA text element, set the parameter _cdata to 'true' */ - TiXmlText(const char * initValue) - : TiXmlNode(TiXmlNode::TEXT) { + TiXmlText(const char * initValue) + : TiXmlNode(TiXmlNode::TEXT) { SetValue(initValue); cdata = false; } @@ -1350,15 +1350,15 @@ class TiXmlText: public TiXmlNode { #ifdef TIXML_USE_STL /// Constructor. - TiXmlText(const std::string& initValue) - : TiXmlNode(TiXmlNode::TEXT) { + TiXmlText(const std::string& initValue) + : TiXmlNode(TiXmlNode::TEXT) { SetValue(initValue); cdata = false; } #endif - TiXmlText(const TiXmlText& copy) - : TiXmlNode(TiXmlNode::TEXT) { + TiXmlText(const TiXmlText& copy) + : TiXmlNode(TiXmlNode::TEXT) { copy.CopyTo(this); } void operator=(const TiXmlText& base) { @@ -1390,7 +1390,7 @@ class TiXmlText: public TiXmlNode { */ virtual bool Accept(TiXmlVisitor* content) const; - protected: +protected: /// [internal use] Creates a new Element and returns it. virtual TiXmlNode* Clone() const; void CopyTo(TiXmlText* target) const; @@ -1401,7 +1401,7 @@ class TiXmlText: public TiXmlNode { virtual void StreamIn(std::istream * in, TIXML_STRING * tag); #endif - private: +private: bool cdata; // true if this should be input and output as a CDATA style text element }; @@ -1419,10 +1419,10 @@ class TiXmlText: public TiXmlNode { because there can only be at most 3 and they are always the same. */ class TiXmlDeclaration: public TiXmlNode { - public: +public: /// Construct an empty declaration. - TiXmlDeclaration() - : TiXmlNode(TiXmlNode::DECLARATION) { + TiXmlDeclaration() + : TiXmlNode(TiXmlNode::DECLARATION) { } #ifdef TIXML_USE_STL @@ -1473,14 +1473,14 @@ class TiXmlDeclaration: public TiXmlNode { */ virtual bool Accept(TiXmlVisitor* visitor) const; - protected: +protected: void CopyTo(TiXmlDeclaration* target) const; // used to be public #ifdef TIXML_USE_STL virtual void StreamIn(std::istream * in, TIXML_STRING * tag); #endif - private: +private: TIXML_STRING version;TIXML_STRING encoding;TIXML_STRING standalone; }; @@ -1493,15 +1493,15 @@ class TiXmlDeclaration: public TiXmlNode { DTD tags get thrown into TiXmlUnknowns. */ class TiXmlUnknown: public TiXmlNode { - public: - TiXmlUnknown() - : TiXmlNode(TiXmlNode::UNKNOWN) { +public: + TiXmlUnknown() + : TiXmlNode(TiXmlNode::UNKNOWN) { } virtual ~TiXmlUnknown() { } - TiXmlUnknown(const TiXmlUnknown& copy) - : TiXmlNode(TiXmlNode::UNKNOWN) { + TiXmlUnknown(const TiXmlUnknown& copy) + : TiXmlNode(TiXmlNode::UNKNOWN) { copy.CopyTo(this); } void operator=(const TiXmlUnknown& copy) { @@ -1526,14 +1526,14 @@ class TiXmlUnknown: public TiXmlNode { */ virtual bool Accept(TiXmlVisitor* content) const; - protected: +protected: void CopyTo(TiXmlUnknown* target) const; #ifdef TIXML_USE_STL virtual void StreamIn(std::istream * in, TIXML_STRING * tag); #endif - private: +private: }; @@ -1542,7 +1542,7 @@ class TiXmlUnknown: public TiXmlNode { The 'value' of a document node is the xml file name. */ class TiXmlDocument: public TiXmlNode { - public: +public: /// Create an empty document, that has no name. TiXmlDocument(); /// Create a document with a name. The name of the document is also the filename of the xml. @@ -1715,14 +1715,14 @@ class TiXmlDocument: public TiXmlNode { */ virtual bool Accept(TiXmlVisitor* content) const; - protected: +protected: // [internal use] virtual TiXmlNode* Clone() const; #ifdef TIXML_USE_STL virtual void StreamIn(std::istream * in, TIXML_STRING * tag); #endif - private: +private: void CopyTo(TiXmlDocument* target) const; bool error; @@ -1813,7 +1813,7 @@ class TiXmlDocument: public TiXmlNode { @endverbatim */ class TiXmlHandle { - public: +public: /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. TiXmlHandle(TiXmlNode* _node) { this->node = _node; @@ -1917,7 +1917,7 @@ class TiXmlHandle { return ToUnknown(); } - private: +private: TiXmlNode* node; }; @@ -1941,9 +1941,9 @@ class TiXmlHandle { @endverbatim */ class TiXmlPrinter: public TiXmlVisitor { - public: - TiXmlPrinter() - : depth(0), simpleTextPrint(false), buffer(), indent(" "), lineBreak("\n") { +public: + TiXmlPrinter() + : depth(0), simpleTextPrint(false), buffer(), indent(" "), lineBreak("\n") { } virtual bool VisitEnter(const TiXmlDocument& doc); @@ -2002,7 +2002,7 @@ class TiXmlPrinter: public TiXmlVisitor { } #endif - private: +private: void DoIndent() { for (int i = 0; i < depth; ++i) buffer += indent; diff --git a/DDCore/python/lcdd.py b/DDCore/python/lcdd.py index ace78459ad7adfe85ea610dbda565b0ac880fece..b9546c758847030484e7eb10b21d7e1f0d848114 100644 --- a/DDCore/python/lcdd.py +++ b/DDCore/python/lcdd.py @@ -1,3 +1,15 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + from math import cos, sin, pi, tan from os import path, listdir from functools import partial diff --git a/DDCore/src/Alignment.cpp b/DDCore/src/Alignment.cpp index 5c6f5a6e025a3eef2af21899a3cfe4f217ec5687..fba675f2d2c0b0658498343562479c5d7c84644e 100644 --- a/DDCore/src/Alignment.cpp +++ b/DDCore/src/Alignment.cpp @@ -1,11 +1,16 @@ -// $Id: Readout.cpp 985 2014-01-30 13:50:10Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Alignment.h" diff --git a/DDCore/src/BasicGrammar.cpp b/DDCore/src/BasicGrammar.cpp index 3ad703af8b43b747f0c330a006b391863edfb240..2e6602afd2fbe7e92f49c6d5e0ba6c1a9499455d 100644 --- a/DDCore/src/BasicGrammar.cpp +++ b/DDCore/src/BasicGrammar.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Handle.h" @@ -28,7 +33,7 @@ void DD4hep::BasicGrammar::invalidConversion(const std::string& value, const std std::string to_name = typeName(to); throw unrelated_value_error(to, "Data conversion of '" + value + "' to type '" + - to_name + "' is not defined."); + to_name + "' is not defined."); } /// Error callback on invalid conversion @@ -37,5 +42,5 @@ void DD4hep::BasicGrammar::invalidConversion(const std::type_info& from, const s std::string from_name = typeName(from); throw unrelated_type_error(from, to, "Data conversion from '" + from_name + - "' to '" + to_name + "' is not implemented."); + "' to '" + to_name + "' is not implemented."); } diff --git a/DDCore/src/BasicGrammarTypes.cpp b/DDCore/src/BasicGrammarTypes.cpp index 1f35683b60713a7b66cd8e5793309b46986b3d9c..f4d8a9b1d41f3edd65341b8fff5f164e10de94cc 100644 --- a/DDCore/src/BasicGrammarTypes.cpp +++ b/DDCore/src/BasicGrammarTypes.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/objects/BasicGrammar_inl.h" diff --git a/DDCore/src/Callback.cpp b/DDCore/src/Callback.cpp index 3136e756941756656a94afb2312c6ea412036e51..67b4abb951df6424cd721107d86d34d0d8f66098 100644 --- a/DDCore/src/Callback.cpp +++ b/DDCore/src/Callback.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Callback.h" diff --git a/DDCore/src/Conditions.cpp b/DDCore/src/Conditions.cpp index 169805556eeefda05efcef5cc56c1810d77d62c4..d1082c8eb37828ee38564baddd9dfa6565e30dce 100644 --- a/DDCore/src/Conditions.cpp +++ b/DDCore/src/Conditions.cpp @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DD4hep/Handle.inl" diff --git a/DDCore/src/ConditionsInterna.cpp b/DDCore/src/ConditionsInterna.cpp index a5cea74f6c5fbf0f32bbe0ee72a987750c5064a3..f4d397e56829a8c611b0b7a3603978631829d52f 100644 --- a/DDCore/src/ConditionsInterna.cpp +++ b/DDCore/src/ConditionsInterna.cpp @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DD4hep/Handle.inl" diff --git a/DDCore/src/ConditonsTypes.cpp b/DDCore/src/ConditonsTypes.cpp index 21462e0116d7163ca21ffaf388b0680c7ee87332..c07197e264212f35c80e1f3d09424c3fb874b6b5 100644 --- a/DDCore/src/ConditonsTypes.cpp +++ b/DDCore/src/ConditonsTypes.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/objects/ConditionsInterna.h" @@ -23,22 +28,22 @@ DD4HEP_DEFINE_CONDITIONS_U_CONT(char) DD4HEP_DEFINE_CONDITIONS_U_CONT(short) - DD4HEP_DEFINE_CONDITIONS_U_CONT(int) - DD4HEP_DEFINE_CONDITIONS_U_CONT(long) - DD4HEP_DEFINE_CONDITIONS_U_CONT(long long) +DD4HEP_DEFINE_CONDITIONS_U_CONT(int) +DD4HEP_DEFINE_CONDITIONS_U_CONT(long) +DD4HEP_DEFINE_CONDITIONS_U_CONT(long long) - DD4HEP_DEFINE_CONDITIONS_CONT(bool) - DD4HEP_DEFINE_CONDITIONS_CONT(float) - DD4HEP_DEFINE_CONDITIONS_CONT(double) +DD4HEP_DEFINE_CONDITIONS_CONT(bool) +DD4HEP_DEFINE_CONDITIONS_CONT(float) +DD4HEP_DEFINE_CONDITIONS_CONT(double) - DD4HEP_DEFINE_CONDITIONS_TYPE(std::string) - DD4HEP_DEFINE_CONDITIONS_TYPE(std::vector<std::string>) - DD4HEP_DEFINE_CONDITIONS_TYPE(std::list<std::string>) - DD4HEP_DEFINE_CONDITIONS_TYPE(std::set<std::string>) +DD4HEP_DEFINE_CONDITIONS_TYPE(std::string) +DD4HEP_DEFINE_CONDITIONS_TYPE(std::vector<std::string>) +DD4HEP_DEFINE_CONDITIONS_TYPE(std::list<std::string>) +DD4HEP_DEFINE_CONDITIONS_TYPE(std::set<std::string>) // ROOT::Math Object instances - typedef std::map<std::string, int> map_string_int; +typedef std::map<std::string, int> map_string_int; DD4HEP_DEFINE_CONDITIONS_TYPE(map_string_int) DD4HEP_DEFINE_CONDITIONS_TYPE(ROOT::Math::XYZPoint) - DD4HEP_DEFINE_CONDITIONS_TYPE(ROOT::Math::XYZVector) - DD4HEP_DEFINE_CONDITIONS_TYPE(ROOT::Math::PxPyPzEVector) +DD4HEP_DEFINE_CONDITIONS_TYPE(ROOT::Math::XYZVector) +DD4HEP_DEFINE_CONDITIONS_TYPE(ROOT::Math::PxPyPzEVector) diff --git a/DDCore/src/DD4hepRootPersistency.cpp b/DDCore/src/DD4hepRootPersistency.cpp index 2f3cdd2f32b3d267e384d04dfa8b64d1f6365392..a482524d170b446349b4a15f8db361db865e694f 100644 --- a/DDCore/src/DD4hepRootPersistency.cpp +++ b/DDCore/src/DD4hepRootPersistency.cpp @@ -1,11 +1,16 @@ -// $Id: Detector.cpp 1087 2014-04-09 12:25:51Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" diff --git a/DDCore/src/Detector.cpp b/DDCore/src/Detector.cpp index 4fbd9bdca503f1094abc8b51664147285f244f90..d8d84e8a0819b540f1a6543fdab632408a5be181 100644 --- a/DDCore/src/Detector.cpp +++ b/DDCore/src/Detector.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/objects/DetectorInterna.h" diff --git a/DDCore/src/DetectorInterna.cpp b/DDCore/src/DetectorInterna.cpp index 839c511584b62c9506ca4318b265412d1804615f..af26f4062af045b4b75c268de5e5dd898b905657 100644 --- a/DDCore/src/DetectorInterna.cpp +++ b/DDCore/src/DetectorInterna.cpp @@ -1,11 +1,16 @@ -// $Id: Detector.cpp 1087 2014-04-09 12:25:51Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/objects/ConditionsInterna.h" diff --git a/DDCore/src/DetectorTools.cpp b/DDCore/src/DetectorTools.cpp index 7add405c14a2848611c62bbc8fb58599fc3d7e22..bd40129968098897e3fcf3ce9eb9d48923783040 100644 --- a/DDCore/src/DetectorTools.cpp +++ b/DDCore/src/DetectorTools.cpp @@ -1,11 +1,17 @@ -// $Id: Readout.cpp 985 2014-01-30 13:50:10Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #define DETECTORTOOLS_CPP #include "DD4hep/DetectorTools.h" diff --git a/DDCore/src/Evaluator/Evaluator.cpp b/DDCore/src/Evaluator/Evaluator.cpp index ff53648ec8348fe44ca39a0faec6e3b69f9904f6..20121036ef7656097d421dbfae37efcc36773532 100644 --- a/DDCore/src/Evaluator/Evaluator.cpp +++ b/DDCore/src/Evaluator/Evaluator.cpp @@ -60,8 +60,8 @@ namespace { //--------------------------------------------------------------------------- #define EVAL XmlTools::Evaluator -#define REMOVE_BLANKS \ - for(pointer=name;;pointer++) if (!isspace(*pointer)) break; \ +#define REMOVE_BLANKS \ + for(pointer=name;;pointer++) if (!isspace(*pointer)) break; \ for(n=strlen(pointer);n>0;n--) if (!isspace(*(pointer+n-1))) break #define SKIP_BLANKS \ @@ -251,9 +251,9 @@ static int operand(pchar begin, pchar end, double & result, par_end = pointer-1; EVAL_STATUS = engine(par_begin, par_end, value, par_end, dictionary); if (EVAL_STATUS == EVAL::WARNING_BLANK_STRING) - { EVAL_EXIT( EVAL::ERROR_EMPTY_PARAMETER, --par_end ); } + { EVAL_EXIT( EVAL::ERROR_EMPTY_PARAMETER, --par_end ); } if (EVAL_STATUS != EVAL::OK) - { EVAL_EXIT( EVAL_STATUS, par_end ); } + { EVAL_EXIT( EVAL_STATUS, par_end ); } par.push(value); par_begin = pointer + 1; } @@ -271,7 +271,7 @@ static int operand(pchar begin, pchar end, double & result, break; case EVAL::WARNING_BLANK_STRING: if (par.size() != 0) - { EVAL_EXIT( EVAL::ERROR_EMPTY_PARAMETER, --par_end ); } + { EVAL_EXIT( EVAL::ERROR_EMPTY_PARAMETER, --par_end ); } break; default: EVAL_EXIT( EVAL_STATUS, par_end ); @@ -704,8 +704,8 @@ namespace XmlTools { string env_name(name+2,::strlen(name)-3); const char* env_str = ::getenv(env_name.c_str()); if ( 0 != env_str ) { - s->theStatus = EVAL::OK; - return env_str; + s->theStatus = EVAL::OK; + return env_str; } } s->theStatus = EVAL::ERROR_UNKNOWN_VARIABLE; diff --git a/DDCore/src/Evaluator/hash_map.src b/DDCore/src/Evaluator/hash_map.src index 400dd3d3b56acaa48f042087efe656abc0fe43ef..1cbf5f36350edbe67de46624e08c3d729ab599f4 100644 --- a/DDCore/src/Evaluator/hash_map.src +++ b/DDCore/src/Evaluator/hash_map.src @@ -121,11 +121,11 @@ public: for (size_type i=0; i<max_size; i++) { Entry* n = tmp[i]; while(n) { - Entry* p = n; - n = p->next; - size_type ii = hash(p->data.first) % s; - p->next = table[ii]; - table[ii] = p; + Entry* p = n; + n = p->next; + size_type ii = hash(p->data.first) % s; + p->next = table[ii]; + table[ii] = p; } } max_size = s; @@ -166,9 +166,9 @@ public: Entry** pp = &table[i]; for (p=p->next; p; p=p->next) { if (eq(key,p->data.first)) { - *pp = p->next; delete p; cur_size--; return 1; + *pp = p->next; delete p; cur_size--; return 1; }else{ - pp = &(p->next); + pp = &(p->next); } } return 0; @@ -178,9 +178,9 @@ public: void clear() { for(size_type i=0; i<max_size; i++) { for (Entry* p=table[i]; p;) { - Entry* pp = p; p = p->next; delete pp; + Entry* pp = p; p = p->next; delete pp; } - table[i] = 0; + table[i] = 0; } cur_size = 0; } @@ -194,9 +194,9 @@ public: std::cout << endl; for(size_type i=0; i<max_size; i++) { for (Entry* p=table[i]; p; p=p->next) { - std::cout - << '"' << p->data.first << '"' << " " << p->data.second - << std::endl; + std::cout + << '"' << p->data.first << '"' << " " << p->data.second + << std::endl; } } } diff --git a/DDCore/src/Evaluator/stack.src b/DDCore/src/Evaluator/stack.src index 79623ed724a0a1c614adfa4a2518943ca16b03f1..9dfabd4c3f1be73ba1d4092fa27fe1d8ec483ac8 100644 --- a/DDCore/src/Evaluator/stack.src +++ b/DDCore/src/Evaluator/stack.src @@ -18,14 +18,14 @@ */ template<class T> class stack { - private: +private: int k, max_size; T * v; stack(const stack& ) {} stack& operator=(const stack&) { return *this; } - public: +public: stack() : k(0), max_size(20), v(new T[20]) {} ~stack() { delete [] v; } diff --git a/DDCore/src/Exceptions.cpp b/DDCore/src/Exceptions.cpp index 339bafab14ebd064bfa2cce0de5ea2599b528c6b..0d51d8fc9ee5e2844a8096cb96ebd1416d2888c5 100644 --- a/DDCore/src/Exceptions.cpp +++ b/DDCore/src/Exceptions.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Exceptions.h" diff --git a/DDCore/src/ExpressionEvaluator.cpp b/DDCore/src/ExpressionEvaluator.cpp index 9bc741e94d4dde9be3a35109ed1b576f660e5611..7b01f446991476ed9ad9363688fb3e103368ff27 100644 --- a/DDCore/src/ExpressionEvaluator.cpp +++ b/DDCore/src/ExpressionEvaluator.cpp @@ -1,3 +1,17 @@ +// $Id$ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + #include "XML/Evaluator.h" #include "DD4hep/DD4hepUnits.h" diff --git a/DDCore/src/FieldTypes.cpp b/DDCore/src/FieldTypes.cpp index 65e593c9f40501bed318622ccfa54e2cb6ff0dcf..88199ee003fadb9ab0afb27802248bab308601eb 100644 --- a/DDCore/src/FieldTypes.cpp +++ b/DDCore/src/FieldTypes.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #include "DD4hep/Handle.inl" #include "DD4hep/FieldTypes.h" diff --git a/DDCore/src/Fields.cpp b/DDCore/src/Fields.cpp index b06e71aeb8fcaad94a091002f878d4e237b12b30..af48581645eb29bbeb7fa61563aae59918f0d6c7 100644 --- a/DDCore/src/Fields.cpp +++ b/DDCore/src/Fields.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #include "DD4hep/Handle.inl" #include "DD4hep/Fields.h" diff --git a/DDCore/src/GeoHandler.cpp b/DDCore/src/GeoHandler.cpp index 918e8e55fd09cf0d6d1af4749739a6d1e04b0b39..43f4325bc128026340e5fe9db623c66cce27dab3 100644 --- a/DDCore/src/GeoHandler.cpp +++ b/DDCore/src/GeoHandler.cpp @@ -1,12 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/GeoHandler.h" #include "DD4hep/objects/ObjectsInterna.h" diff --git a/DDCore/src/GeometryTreeDump.cpp b/DDCore/src/GeometryTreeDump.cpp index ab3f49b42d65b055cdc5507dce7ec80db8361901..82632e295e1f57870f347ee3fe63ad06df12f1e0 100644 --- a/DDCore/src/GeometryTreeDump.cpp +++ b/DDCore/src/GeometryTreeDump.cpp @@ -1,12 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/LCDD.h" #include "GeometryTreeDump.h" // ROOT includes diff --git a/DDCore/src/GeometryTreeDump.h b/DDCore/src/GeometryTreeDump.h index e833949df687ecef13dad7e6fe235defe59f4d7a..d899845b045b240a5d15ad024a87ddfa13f4d8d7 100644 --- a/DDCore/src/GeometryTreeDump.h +++ b/DDCore/src/GeometryTreeDump.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEOMETRYTREEDUMP_H #define DD4HEP_GEOMETRYTREEDUMP_H diff --git a/DDCore/src/Handle.cpp b/DDCore/src/Handle.cpp index 3583f89dbb9105f0a752ee786f53cd93e08a4239..8e0f1de44f152c47d10c9137e7466af2823c3911 100644 --- a/DDCore/src/Handle.cpp +++ b/DDCore/src/Handle.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #include "DD4hep/InstanceCount.h" #include "DD4hep/Handle.inl" diff --git a/DDCore/src/IDDescriptor.cpp b/DDCore/src/IDDescriptor.cpp index f50dd726ec8d0441c9dbe5536f18a8e825aa5e3d..f3d94641eaad2c864d419623adc54b1dc12bc7d9 100644 --- a/DDCore/src/IDDescriptor.cpp +++ b/DDCore/src/IDDescriptor.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #include "DD4hep/Handle.inl" #include "DD4hep/IDDescriptor.h" diff --git a/DDCore/src/InstanceCount.cpp b/DDCore/src/InstanceCount.cpp index 3c532d548d2c34efe4a07327ba55f1353e96bd54..97502ec4ce0f2cffc65f8778dab6884dd6bd8dd7 100644 --- a/DDCore/src/InstanceCount.cpp +++ b/DDCore/src/InstanceCount.cpp @@ -1,14 +1,22 @@ -// $Id: IDDescriptor.cpp 570 2013-05-17 07:47:11Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/InstanceCount.h" #include "DD4hep/Handle.h" #include "DD4hep/Memory.h" +// C/C++ include files #include <iostream> #include <iomanip> #include <cstdio> diff --git a/DDCore/src/LCDDData.cpp b/DDCore/src/LCDDData.cpp index 811e962cb657664198f598ca502be0957ee3be86..98cda856d97ab64fe1d045f26f8b6259900e2e44 100644 --- a/DDCore/src/LCDDData.cpp +++ b/DDCore/src/LCDDData.cpp @@ -1,11 +1,16 @@ -// $Id: LCDDImp.cpp 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDDData.h" diff --git a/DDCore/src/LCDDHelper.cpp b/DDCore/src/LCDDHelper.cpp index 1a993ceb6648674384d2dac0f365b8f6fb34d124..f20b9d70fb67df80203d09461af1fadd47f87885 100644 --- a/DDCore/src/LCDDHelper.cpp +++ b/DDCore/src/LCDDHelper.cpp @@ -1,11 +1,16 @@ -// $Id: Handle.h 1679 2015-03-27 15:24:39Z /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #include "DD4hep/LCDDHelper.h" @@ -25,12 +30,12 @@ SensitiveDetector LCDDHelper::sensitiveDetector(DetElement detector) const { if ( par.ptr() != ptr()->world().ptr() ) { PlacedVolume pv = par.placement(); if ( pv.isValid() ) { - const PlacedVolume::VolIDs& ids = pv.volIDs(); - for(PlacedVolume::VolIDs::const_iterator i=ids.begin(); i!=ids.end();++i) { - if ( (*i).first == "system" ) { - return sensitiveDetector(par.name()); - } - } + const PlacedVolume::VolIDs& ids = pv.volIDs(); + for(PlacedVolume::VolIDs::const_iterator i=ids.begin(); i!=ids.end();++i) { + if ( (*i).first == "system" ) { + return sensitiveDetector(par.name()); + } + } } } } diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/LCDDImp.cpp index 6598b500d9279271e86808b1a42b0b7c69d02518..65ccc0bcc2b3d0197b6e1ddf0897acecbfc51976 100644 --- a/DDCore/src/LCDDImp.cpp +++ b/DDCore/src/LCDDImp.cpp @@ -1,12 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" #include "DD4hep/GeoHandler.h" @@ -51,7 +57,7 @@ namespace { struct TypePreserve { LCDDBuildType& m_t; TypePreserve(LCDDBuildType& t) - : m_t(t) { + : m_t(t) { } ~TypePreserve() { m_t = BUILD_NONE; @@ -64,12 +70,12 @@ namespace { throw; } catch( std::exception& e){ std::cout << "\n" - << "**************************************************** \n" - << "* A runtime error has occured : \n" - << "* " << e.what() << std::endl - << "* the program will have to be terminated - sorry. \n" - << "**************************************************** \n" - << std::endl ; + << "**************************************************** \n" + << "* A runtime error has occured : \n" + << "* " << e.what() << std::endl + << "* the program will have to be terminated - sorry. \n" + << "**************************************************** \n" + << std::endl ; std::set_unexpected( std::unexpected ) ; std::set_terminate( std::terminate ) ; @@ -167,8 +173,8 @@ void LCDDImp::declareMotherVolume(const std::string& detector_name, const Volume if ( vol.isValid() ) { HandleMap::const_iterator i = m_motherVolumes.find(detector_name); if (i == m_motherVolumes.end()) { - m_motherVolumes.insert(make_pair(detector_name,vol)); - return; + m_motherVolumes.insert(make_pair(detector_name,vol)); + return; } throw runtime_error("LCDD: A mother volume to the detector "+detector_name+" was already registered."); } @@ -200,7 +206,7 @@ LCDD& LCDDImp::addDetector(const Ref_t& ref_det) { if ( sd.isValid() ) { stringstream str; str << "LCDD: The sensitive sub-detectors " << det_element.name() << " and " - << existing_det.name() << " have the identical ID:" << det_element.id() << "."; + << existing_det.name() << " have the identical ID:" << det_element.id() << "."; printout(ERROR,"LCDD",str.str()); throw runtime_error(str.str()); } @@ -294,14 +300,14 @@ void LCDDImp::mapDetectorTypes() { if ( det.parent().isValid() ) { // Exclude 'world' HandleMap::const_iterator j=m_sensitive.find(det.name()); if ( j != m_sensitive.end() ) { - SensitiveDetector sd((*j).second); - m_detectorTypes[sd.type()].push_back(det); + SensitiveDetector sd((*j).second); + m_detectorTypes[sd.type()].push_back(det); } else if ( det.type() == "compound" ) { - m_detectorTypes[det.type()].push_back(det); + m_detectorTypes[det.type()].push_back(det); } else { - m_detectorTypes["passive"].push_back(det); + m_detectorTypes["passive"].push_back(det); } } } @@ -333,10 +339,10 @@ const vector<DetElement>& LCDDImp::detectors(const string& type) { /// Access a set of subdetectors according to several sensitive types. vector<DetElement> LCDDImp::detectors(const string& type1, - const string& type2, - const string& type3, - const string& type4, - const string& type5 ) { + const string& type2, + const string& type3, + const string& type4, + const string& type5 ) { if ( m_manager->IsClosed() ) { vector<DetElement> v; DetectorTypeMap::const_iterator i, end=m_detectorTypes.end(); diff --git a/DDCore/src/LCDDImp.h b/DDCore/src/LCDDImp.h index d2026c3c9c6aafe329651cfdac6e156b0dd27bb0..0277651fd08de66c06657a3e52e628f1583cc18c 100644 --- a/DDCore/src/LCDDImp.h +++ b/DDCore/src/LCDDImp.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4hep_LCDDGEOIMP_H #define DD4hep_LCDDGEOIMP_H @@ -246,19 +252,19 @@ namespace DD4hep { /// Access a set of subdetectors according to the sensitive type. /** - Please note: - - The sensitive type of a detector is set in the 'detector constructor'. - - Not sensitive detector structures have the name 'passive' - - Compounds (ie. nested detectors) are of type 'compound' - */ + Please note: + - The sensitive type of a detector is set in the 'detector constructor'. + - Not sensitive detector structures have the name 'passive' + - Compounds (ie. nested detectors) are of type 'compound' + */ virtual const std::vector<DetElement>& detectors(const std::string& type); /// Access a set of subdetectors according to several sensitive types. virtual std::vector<DetElement> detectors(const std::string& type1, - const std::string& type2, - const std::string& type3="", - const std::string& type4="", - const std::string& type5="" ); + const std::string& type2, + const std::string& type3="", + const std::string& type4="", + const std::string& type5="" ); /// Access the availible detector types virtual std::vector<std::string> detectorTypes() const; diff --git a/DDCore/src/LCDDLoad.cpp b/DDCore/src/LCDDLoad.cpp index b1ae24fc51c0cef55f6d350580ed28c1562f0eac..394781a457d1a84c889737bb244378accf935aad 100644 --- a/DDCore/src/LCDDLoad.cpp +++ b/DDCore/src/LCDDLoad.cpp @@ -1,11 +1,18 @@ -// $Id: LCDDImp.cpp 1224 2014-06-19 19:26:59Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/LCDDLoad.h" #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" diff --git a/DDCore/src/MatrixHelpers.cpp b/DDCore/src/MatrixHelpers.cpp index 8b647b73e7b9e26dd2a5627e22c13fc9f7c73012..d222939f5c88bb902e406707bac0e7159a3cbabe 100644 --- a/DDCore/src/MatrixHelpers.cpp +++ b/DDCore/src/MatrixHelpers.cpp @@ -1,11 +1,16 @@ -// $Id: Handle.cpp 575 2013-05-17 20:41:52Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/MatrixHelpers.h" diff --git a/DDCore/src/NamedObject.cpp b/DDCore/src/NamedObject.cpp index 985267cc05e92b6331e3e3c5c8d90b49cfaa9871..bdaee9de3d73a92e0fa984fd79452a0fec6bfd85 100644 --- a/DDCore/src/NamedObject.cpp +++ b/DDCore/src/NamedObject.cpp @@ -1,11 +1,16 @@ -// $Id: Readout.h 951 2013-12-16 23:37:56Z Christian.Grefe@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DD4hep/NamedObject.h" diff --git a/DDCore/src/ObjectExtensions.cpp b/DDCore/src/ObjectExtensions.cpp index 5b28528c580ace3efb3c922152c00e0c87fe48c2..c57c84e5c0b46ba1de72acf9020819f1f1d47169 100644 --- a/DDCore/src/ObjectExtensions.cpp +++ b/DDCore/src/ObjectExtensions.cpp @@ -1,11 +1,16 @@ -// $Id: Detector.cpp 1087 2014-04-09 12:25:51Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/ObjectExtensions.h" diff --git a/DDCore/src/Objects.cpp b/DDCore/src/Objects.cpp index 1762164479ba0ac11a12d5b213ba87d22e6cdfa9..454a4e2f5610f53f9d7422ae936cbddede1db388 100644 --- a/DDCore/src/Objects.cpp +++ b/DDCore/src/Objects.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDCore/src/ObjectsInterna.cpp b/DDCore/src/ObjectsInterna.cpp index cad475f004582d18cfb1cb891f5b437b40414ee9..a7afec8c4585331435046b071b401eee6545810c 100644 --- a/DDCore/src/ObjectsInterna.cpp +++ b/DDCore/src/ObjectsInterna.cpp @@ -1,11 +1,17 @@ -// $Id: Objects.cpp 1163 2014-05-19 12:26:55Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #include "DD4hep/Handle.inl" #include "DD4hep/InstanceCount.h" #include "DD4hep/Objects.h" diff --git a/DDCore/src/Plugins.cpp b/DDCore/src/Plugins.cpp index e50412325930e8fa166ed5f5ea0bc52c83ee334a..cb6e2c6d0abd93e3240e7ebecae8c733b14f1c0b 100644 --- a/DDCore/src/Plugins.cpp +++ b/DDCore/src/Plugins.cpp @@ -1,11 +1,18 @@ -// $Id: Readout.cpp 590 2013-06-03 17:02:43Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Handle.h" #include "DD4hep/Plugins.inl" @@ -55,17 +62,27 @@ string PluginDebug::missingFactory(const string& name) const { return msg; } +/// Dummy functions of the plugin service +void* PluginService::getCreator(const std::string&, const std::type_info&) { return 0; } +void PluginService::addFactory(const std::string&, void*, const std::type_info&, const std::type_info&) {} + #else // ROOT 6 +#include "DD4hep/Printout.h" +#define private public +#include "Gaudi/PluginService.h" // Do not know yet what code to really put in there.....at least it presevers the interfaces and links /// Default constructor -PluginDebug::PluginDebug(int) +PluginDebug::PluginDebug(int dbg) : m_debug(0) { + m_debug = Gaudi::PluginService::Debug(); + Gaudi::PluginService::SetDebug(dbg); } /// Default destructor PluginDebug::~PluginDebug() { + Gaudi::PluginService::SetDebug(m_debug); } /// Helper to check factory existence @@ -75,6 +92,21 @@ string PluginDebug::missingFactory(const string& name) const { return msg; } +void* PluginService::getCreator(const std::string& id, const std::type_info& info) { + return Gaudi::PluginService::Details::getCreator(id, info.name()); +} + +void PluginService::addFactory(const std::string& id, stub_t stub, + const std::type_info& signature_type, + const std::type_info& return_type) +{ + using namespace Gaudi::PluginService::Details; + if ( PluginService::debug() ) { + printout(INFO,"PluginService","+++ Declared factory[%s] with signature %s type:%s.", + id.c_str(),signature_type.name(),return_type.name()); + } + Registry::instance().add(id,stub,signature_type.name(),return_type.name(),id); +} #endif DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(NamedObject*, (Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*)) @@ -88,4 +120,3 @@ DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, (Geometry::LCDD*, const Geometry::GeoHand DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(long, ()) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(void*, (const char*)) - diff --git a/DDCore/src/Primitives.cpp b/DDCore/src/Primitives.cpp index 3b151e4ffcb1a0dcfce70eecc52f21bfb2315559..be08efca67abb76eaccf5718982168bf61c249b1 100644 --- a/DDCore/src/Primitives.cpp +++ b/DDCore/src/Primitives.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Primitives.h" @@ -174,7 +179,7 @@ void DD4hep::typeinfoCheck(const std::type_info& typ1, const std::type_info& typ /// Initializing Constructor DD4hep::ComponentCast::ComponentCast(const std::type_info& t, destroy_t d, cast_t c) -: type(t), destroy(d), cast(c) { + : type(t), destroy(d), cast(c) { #ifdef __APPLE__ abi_class = 0; #else diff --git a/DDCore/src/Printout.cpp b/DDCore/src/Printout.cpp index d9c2c8ef08e7f03729486384cfc99315b35a1309..175e29f3c73c821643a6fcde7bc26bbc6aaab4c1 100644 --- a/DDCore/src/Printout.cpp +++ b/DDCore/src/Printout.cpp @@ -1,16 +1,24 @@ -// $Id: Geant4Converter.cpp 588 2013-06-03 11:41:35Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Objects.h" #include "DD4hep/objects/ObjectsInterna.h" #include "DD4hep/Printout.h" + +// C/C++ include files #include <cstdarg> #include <stdexcept> diff --git a/DDCore/src/Readout.cpp b/DDCore/src/Readout.cpp index cd7a206f390410728a93eef1861ff24b1df2f3e2..4cd819eb0fa799212ad9c4e6465fe370f113ef31 100644 --- a/DDCore/src/Readout.cpp +++ b/DDCore/src/Readout.cpp @@ -1,12 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/Readout.h" #include "DD4hep/objects/ObjectsInterna.h" #include "DD4hep/InstanceCount.h" diff --git a/DDCore/src/Segmentations.cpp b/DDCore/src/Segmentations.cpp index 72051bcc3f1e589f2140163a55d0fabf555356d2..129c8528748576359fce44a74d4acb24050c02cb 100644 --- a/DDCore/src/Segmentations.cpp +++ b/DDCore/src/Segmentations.cpp @@ -1,15 +1,23 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/Segmentations.h" #include "DD4hep/InstanceCount.h" #include "DD4hep/Handle.inl" + +// C/C++ include files #include <iostream> #include <stdexcept> diff --git a/DDCore/src/Shapes.cpp b/DDCore/src/Shapes.cpp index cbfeff8db0ddfb995942987ed3ebb64de3d441e8..3c97aaa30af5ac009409ff1020d2c7e0b3948108 100644 --- a/DDCore/src/Shapes.cpp +++ b/DDCore/src/Shapes.cpp @@ -1,16 +1,24 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #define _USE_MATH_DEFINES + +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/MatrixHelpers.h" #include "DD4hep/DD4hepUnits.h" + // C/C++ include files #include <stdexcept> @@ -59,7 +67,7 @@ std::string DD4hep::Geometry::toStringSolid(const TGeoShape* shape, int precisio else if (cl == TGeoHalfSpace::Class()) { TGeoHalfSpace* s = (TGeoHalfSpace*)(const_cast<TGeoShape*>(shape)); log << " Point: (" << s->GetPoint()[0] << ", " << s->GetPoint()[1] << ", " << s->GetPoint()[2] << ") " - << " Normal: (" << s->GetNorm()[0] << ", " << s->GetNorm()[1] << ", " << s->GetNorm()[2] << ") "; + << " Normal: (" << s->GetNorm()[0] << ", " << s->GetNorm()[1] << ", " << s->GetNorm()[2] << ") "; } else if (cl == TGeoTube::Class()) { const TGeoTube* s = (const TGeoTube*) shape; diff --git a/DDCore/src/SimpleGDMLWriter.cpp b/DDCore/src/SimpleGDMLWriter.cpp index dfc849659f02c5e89d18ba5b113b60a1120fb641..e2b9aa9ff33e3d7acd6a4b6b34fbb24b79a9bfed 100644 --- a/DDCore/src/SimpleGDMLWriter.cpp +++ b/DDCore/src/SimpleGDMLWriter.cpp @@ -1,14 +1,21 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/LCDD.h" #include "SimpleGDMLWriter.h" + // ROOT includes #include "TROOT.h" #include "TColor.h" @@ -28,6 +35,8 @@ #include "TGeoCompositeShape.h" #include "TClass.h" #include "TMath.h" + +// C/C++ include files #include <iostream> using namespace DD4hep::Geometry; diff --git a/DDCore/src/SimpleGDMLWriter.h b/DDCore/src/SimpleGDMLWriter.h index 3b59a7cf7f88409a9b324e7886ec175bcaf4c1a3..a1ec405d4d8c9b3974f750c694059751790fdbd7 100644 --- a/DDCore/src/SimpleGDMLWriter.h +++ b/DDCore/src/SimpleGDMLWriter.h @@ -1,19 +1,30 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_SIMPLEGDMLWRITER_H #define DD4HEP_SIMPLEGDMLWRITER_H +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/GeoHandler.h" + +// C/C++ include files #include <set> #include <map> #include <vector> + +// Forward declarations class TGeoVolume; class TGeoNode; @@ -34,8 +45,8 @@ namespace DD4hep { /// Reference to output stream std::ostream& m_output; - SimpleGDMLWriter(std::ostream& os) - : m_output(os) { + SimpleGDMLWriter(std::ostream& os) + : m_output(os) { } /// Standard destructor virtual ~SimpleGDMLWriter() { diff --git a/DDCore/src/SurfaceInstaller.cpp b/DDCore/src/SurfaceInstaller.cpp index 1bd2137309384eebb04cc12f8f6ac2ca16cc7534..f14f75f33c73f816308cf89fc0b43c567583be6d 100644 --- a/DDCore/src/SurfaceInstaller.cpp +++ b/DDCore/src/SurfaceInstaller.cpp @@ -1,17 +1,25 @@ -// $Id: SiTrackerBarrel_geo.cpp 1360 2014-10-27 16:32:06Z Nikiforos.Nikiforou@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Shapes.h" #include "DD4hep/Printout.h" #include "DD4hep/SurfaceInstaller.h" // C/C++ include files #include <stdexcept> + // ROOT includes #include "TClass.h" diff --git a/DDCore/src/ToStream.cpp b/DDCore/src/ToStream.cpp index c37792078df682e2074e73eefa795080afaddb2f..ab5c1738e93e65e38605a404c9d68dbd37fec818 100644 --- a/DDCore/src/ToStream.cpp +++ b/DDCore/src/ToStream.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/ToStream.h" diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index 561e295f1edac14b87c5ca59b8107d1bf14784d1..bd0a98168db5af42f48dc027f7a309eb02c902a7 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -1,11 +1,17 @@ -// $Id: VolumeManager.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" @@ -85,7 +91,7 @@ namespace { if (vol.isSensitive()) { sd = vol.sensitiveDetector(); Readout ro = sd.readout(); - if ( sd.isValid() && ro.isValid() ) { + if ( sd.isValid() && ro.isValid() ) { got_readout = true; add_entry(sd, parent, e, node, ids, chain); ++count; @@ -156,9 +162,9 @@ namespace { pair<VolumeID, VolumeID> code = encoding(iddesc, ids); if (m_entries.find(code.first) == m_entries.end()) { - string sd_name = sd.name(); - DetElement sub_detector = m_lcdd.detector(sd_name); - VolumeManager section = m_volManager.addSubdetector(sub_detector, ro); + string sd_name = sd.name(); + DetElement sub_detector = m_lcdd.detector(sd_name); + VolumeManager section = m_volManager.addSubdetector(sub_detector, ro); // This is the block, we effectively have to save for each physical volume with a VolID VolumeManager::Context* context = new VolumeManager::Context; context->identifier = code.first; @@ -245,7 +251,7 @@ VolumeManager VolumeManager::addSubdetector(DetElement det, Readout ro) { Object& o = _data(); if (!det.isValid()) { throw runtime_error("DD4hep: VolumeManager::addSubdetector: Only valid subdetectors " - "are allowed. [Invalid DetElement]"); + "are allowed. [Invalid DetElement]"); } Detectors::const_iterator i = o.subdetectors.find(det); if (i == o.subdetectors.end()) { @@ -282,7 +288,7 @@ VolumeManager VolumeManager::addSubdetector(DetElement det, Readout ro) { mo.detMask = mo.sysID; o.managers[mo.sysID] = m; det.callAtUpdate(DetElement::PLACEMENT_CHANGED|DetElement::PLACEMENT_DETECTOR, - &mo,&Object::update); + &mo,&Object::update); } return (*i).second; } diff --git a/DDCore/src/VolumeManagerInterna.cpp b/DDCore/src/VolumeManagerInterna.cpp index 88b703aa6e240fa1e7768f311b29dbed8acb49ac..4e1d8b77f8ab7f0cdd68b1d4bce19b9f4494436b 100644 --- a/DDCore/src/VolumeManagerInterna.cpp +++ b/DDCore/src/VolumeManagerInterna.cpp @@ -1,11 +1,17 @@ -// $Id: VolumeManager.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/Handle.inl" diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp index 8a1f259e44684fba139d681d462019b97444d647..9c673dadb1e8998c7a321911a1225ab36e4cf5af 100644 --- a/DDCore/src/Volumes.cpp +++ b/DDCore/src/Volumes.cpp @@ -1,12 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" @@ -68,7 +74,7 @@ namespace DD4hep { INCREMENT_COUNTER; } DD_TGeoNodeMatrix(const DD_TGeoNodeMatrix& c) - : TGeoNodeMatrix(c.GetVolume(), c.GetMatrix()), DDExtension(c) { + : TGeoNodeMatrix(c.GetVolume(), c.GetMatrix()), DDExtension(c) { INCREMENT_COUNTER; } virtual ~DD_TGeoNodeMatrix() { @@ -412,7 +418,7 @@ ClassImp(VolumeExtension) /// Default constructor VolumeExtension::VolumeExtension() - : TGeoExtension(), magic(0), refCount(0), region(), limits(), vis(), sens_det(), referenced(0) { +: TGeoExtension(), magic(0), refCount(0), region(), limits(), vis(), sens_det(), referenced(0) { INCREMENT_COUNTER; } diff --git a/DDCore/src/XML/DocumentHandler.cpp b/DDCore/src/XML/DocumentHandler.cpp index 32702402fd09947d16cddb84be15708769c78fb9..27de2f6bb2a1d86f969f2f6d92e12972fed500bb 100644 --- a/DDCore/src/XML/DocumentHandler.cpp +++ b/DDCore/src/XML/DocumentHandler.cpp @@ -1,13 +1,22 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Printout.h" #include "XML/DocumentHandler.h" + +// C/C++ include files #include <iostream> #include <stdexcept> #include <sys/types.h> diff --git a/DDCore/src/XML/Layering.cpp b/DDCore/src/XML/Layering.cpp index 07f2e5b370a60b92711f50d6861f023baadc5e9b..8659a16ff3edf5134ad12a14da892e53f53a014a 100644 --- a/DDCore/src/XML/Layering.cpp +++ b/DDCore/src/XML/Layering.cpp @@ -1,15 +1,23 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "XML/XMLDetector.h" #include "XML/Layering.h" #include "XML/XMLTags.h" + +// C/C++ include files #include <algorithm> #include <stdexcept> #include <cfloat> diff --git a/DDCore/src/XML/Utilities.cpp b/DDCore/src/XML/Utilities.cpp index 7981e8c3eaf05c9c6c31c02166387ee5606cf1e4..b5f390af25347dd17aa586096c5882172c90aba1 100644 --- a/DDCore/src/XML/Utilities.cpp +++ b/DDCore/src/XML/Utilities.cpp @@ -1,11 +1,17 @@ -// $Id: XMLDetector.cpp 1479 2014-12-18 16:00:45Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "XML/Utilities.h" #include "DD4hep/Printout.h" @@ -27,7 +33,7 @@ DD4hep::XML::createShape(Geometry::LCDD& lcdd, const std::string& shape_type, XM PluginDebug dbg; PluginService::Create<NamedObject*>(shape_type, &lcdd, &solid_elt); except("XML::createShape","Failed to create solid of type %s [%s]", - shape_type.c_str(),dbg.missingFactory(shape_type).c_str()); + shape_type.c_str(),dbg.missingFactory(shape_type).c_str()); } return solid; } @@ -36,7 +42,7 @@ DD4hep::XML::createShape(Geometry::LCDD& lcdd, const std::string& shape_type, XM Geometry::Volume DD4hep::XML::createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd, DD4hep::XML::Handle_t e , - DD4hep::Geometry::DetElement sdet ){ + DD4hep::Geometry::DetElement sdet ){ xml_det_t x_det = e; string det_name = x_det.nameStr(); @@ -74,7 +80,7 @@ Geometry::Volume DD4hep::XML::createPlacedEnvelope( DD4hep::Geometry::LCDD& lcdd if( !env_solid.isValid() ){ throw std::runtime_error( std::string(" Cannot create envelope volume : ") + x_shape.typeStr() + - std::string(" for detector " ) + det_name ) ; + std::string(" for detector " ) + det_name ) ; } Material env_mat = lcdd.material( x_shape.materialStr() ); diff --git a/DDCore/src/XML/XMLChildValue.cpp b/DDCore/src/XML/XMLChildValue.cpp index eb6d43b30c8bbf979e2d8c9e988fafae3b956f7b..e4d297ce23f2b59e431d98a9761a6da6bf7c7699 100644 --- a/DDCore/src/XML/XMLChildValue.cpp +++ b/DDCore/src/XML/XMLChildValue.cpp @@ -1,11 +1,17 @@ -// $Id: XMLElements.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "XML/XMLChildValue.h" @@ -20,12 +26,12 @@ using namespace DD4hep::XML; return def; #define XML_ATTR_ACCESSOR(type,name) type ChildValue::name() const { return childValue(name,type); } -#define XML_ATTR_ACCESSOR_DEFAULT(name,type,dressing) \ - type ChildValue::name(type default_val) const { \ - Handle_t __h = m_element.child(Unicode_##name,false); \ - if ( __h.ptr() ) { \ - const XmlChar* val = __h.attr_value_nothrow(Unicode_value); \ - return val ? dressing(val) : default_val; } \ +#define XML_ATTR_ACCESSOR_DEFAULT(name,type,dressing) \ + type ChildValue::name(type default_val) const { \ + Handle_t __h = m_element.child(Unicode_##name,false); \ + if ( __h.ptr() ) { \ + const XmlChar* val = __h.attr_value_nothrow(Unicode_value); \ + return val ? dressing(val) : default_val; } \ return default_val; } #define XML_ATTR_ACCESSOR_DOUBLE(name) XML_ATTR_ACCESSOR_DEFAULT(name,double,_toDouble) diff --git a/DDCore/src/XML/XMLDetector.cpp b/DDCore/src/XML/XMLDetector.cpp index 338addc091f72bcf95c2627dc527c6ea8a5187d9..ab40d3a9fdc9819a0da7ffcd53d65b9020404295 100644 --- a/DDCore/src/XML/XMLDetector.cpp +++ b/DDCore/src/XML/XMLDetector.cpp @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "XML/XMLDetector.h" #include "DD4hep/Plugins.h" diff --git a/DDCore/src/XML/XMLDimension.cpp b/DDCore/src/XML/XMLDimension.cpp index 15426b78500471d7c96d521ed90a93b309700856..42ed258272d486080659f5ee34d562e0f54879f1 100644 --- a/DDCore/src/XML/XMLDimension.cpp +++ b/DDCore/src/XML/XMLDimension.cpp @@ -1,11 +1,17 @@ -// $Id: XMLElements.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "XML/XMLDimension.h" @@ -18,15 +24,15 @@ using namespace DD4hep::XML; const XmlChar* val = m_element.attr_value_nothrow(Unicode_##name); \ return val ? dressing(val) : default_val; } -#define XML_ATTR_ACCESSOR_DOUBLE(name) \ - XML_ATTR_ACCESSOR(double,name) \ +#define XML_ATTR_ACCESSOR_DOUBLE(name) \ + XML_ATTR_ACCESSOR(double,name) \ XML_ATTR_ACCESSOR_DEFAULT(name,double,_toDouble) #define XML_ATTR_ACCESSOR_INT(name) XML_ATTR_ACCESSOR_DEFAULT(name,int,_toInt) #define XML_ATTR_ACCESSOR_BOOL(name) XML_ATTR_ACCESSOR_DEFAULT(name,bool,_toBool) -#define XML_CHILD_ACCESSOR_XML_DIM(name) \ - Dimension Dimension::name(bool throw_if_not_present) const { \ +#define XML_CHILD_ACCESSOR_XML_DIM(name) \ + Dimension Dimension::name(bool throw_if_not_present) const { \ return m_element.child(Unicode_##name,throw_if_not_present); } XML_ATTR_ACCESSOR(int, id) @@ -38,7 +44,7 @@ XML_ATTR_ACCESSOR_DOUBLE(X) XML_ATTR_ACCESSOR_DOUBLE(dx) XML_ATTR_ACCESSOR_DOUBLE(x0) -XML_ATTR_ACCESSOR_DOUBLE(x1) + XML_ATTR_ACCESSOR_DOUBLE(x1) XML_ATTR_ACCESSOR_DOUBLE(x2) XML_ATTR_ACCESSOR_DOUBLE(x3) XML_ATTR_ACCESSOR_DOUBLE(x4) diff --git a/DDCore/src/XML/XMLElements.cpp b/DDCore/src/XML/XMLElements.cpp index 261a12535da413ec2999a0f3ba44fc2aea33e2a1..58c164c0a5ed0c0c34810cb952901cf12f3cb744 100644 --- a/DDCore/src/XML/XMLElements.cpp +++ b/DDCore/src/XML/XMLElements.cpp @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "XML/Evaluator.h" @@ -99,7 +105,7 @@ void DD4hep::XML::XmlString::release(char** p) {if(p && *p) {::free(*p); *p=0;} /// Union to ease castless object access when using XercesC union Xml { Xml(const void* ptr) - : p(ptr) { + : p(ptr) { } const void* p; xercesc::DOMNode* n; diff --git a/DDCore/src/XML/XMLTags.cpp b/DDCore/src/XML/XMLTags.cpp index 3954ccdb35998e393314af174a6323ad5a04a052..af827319eb4f7e00f421eaf701027b9cc0e2119b 100644 --- a/DDCore/src/XML/XMLTags.cpp +++ b/DDCore/src/XML/XMLTags.cpp @@ -1,21 +1,30 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== -#include <stdexcept> -#include <iostream> -#include <map> +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "XML/XMLElements.h" #ifndef __TIXML__ #include "xercesc/util/XMLString.hpp" #include "xercesc/util/PlatformUtils.hpp" #endif +// C/C++ include files +#include <stdexcept> +#include <iostream> +#include <map> + + namespace { struct __Init { typedef std::map<std::string,DD4hep::XML::Tag_t*> Inventory_t; @@ -29,7 +38,7 @@ namespace { std::string xml_err = xercesc::XMLString::transcode(e.getMessage()); std::string err = "xercesc::XMLPlatformUtils: Xerces-c error in initialization:"+xml_err; std::cout << err << std::endl; - throw std::runtime_error(err); + throw std::runtime_error(err); } #endif } @@ -42,13 +51,13 @@ namespace { }; __Init __In__; void __Init::register_tag(const std::string& name, DD4hep::XML::Tag_t* tag) { - Inventory_t::const_iterator i = __In__.m_inventory.find(name); - if ( i != __In__.m_inventory.end() ) { - std::string err = "XMLTags: Failed to register XML tag: "+name+". [Tag already exists]"; - std::cout << err << std::endl; - throw std::runtime_error(err); - } - __In__.m_inventory[name] = tag; + Inventory_t::const_iterator i = __In__.m_inventory.find(name); + if ( i != __In__.m_inventory.end() ) { + std::string err = "XMLTags: Failed to register XML tag: "+name+". [Tag already exists]"; + std::cout << err << std::endl; + throw std::runtime_error(err); + } + __In__.m_inventory[name] = tag; } } diff --git a/DDCore/src/XML/tinyxml_inl.h b/DDCore/src/XML/tinyxml_inl.h index 3c72ed5a6e073623a24a8ab9a74d011d418a31ef..d6e82225000643ed10ce60b951558326d3da443f 100644 --- a/DDCore/src/XML/tinyxml_inl.h +++ b/DDCore/src/XML/tinyxml_inl.h @@ -44,82 +44,82 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString ) int i=0; while( i<(int)str.length() ) + { + unsigned char c = (unsigned char) str[i]; + + if ( c == '&' + && i < ( (int)str.length() - 2 ) + && str[i+1] == '#' + && str[i+2] == 'x' ) + { + // Hexadecimal character reference. + // Pass through unchanged. + // © -- copyright symbol, for example. + // + // The -1 is a bug fix from Rob Laveaux. It keeps + // an overflow from happening if there is no ';'. + // There are actually 2 ways to exit this loop - + // while fails (error case) and break (semicolon found). + // However, there is no mechanism (currently) for + // this function to return an error. + while ( i<(int)str.length()-1 ) + { + outString->append( str.c_str() + i, 1 ); + ++i; + if ( str[i] == ';' ) + break; + } + } + else if ( c == '&' ) + { + outString->append( entity[0].str, entity[0].strLength ); + ++i; + } + else if ( c == '<' ) + { + outString->append( entity[1].str, entity[1].strLength ); + ++i; + } + else if ( c == '>' ) + { + outString->append( entity[2].str, entity[2].strLength ); + ++i; + } + else if ( c == '\"' ) + { + outString->append( entity[3].str, entity[3].strLength ); + ++i; + } + else if ( c == '\'' ) { - unsigned char c = (unsigned char) str[i]; - - if ( c == '&' - && i < ( (int)str.length() - 2 ) - && str[i+1] == '#' - && str[i+2] == 'x' ) - { - // Hexadecimal character reference. - // Pass through unchanged. - // © -- copyright symbol, for example. - // - // The -1 is a bug fix from Rob Laveaux. It keeps - // an overflow from happening if there is no ';'. - // There are actually 2 ways to exit this loop - - // while fails (error case) and break (semicolon found). - // However, there is no mechanism (currently) for - // this function to return an error. - while ( i<(int)str.length()-1 ) - { - outString->append( str.c_str() + i, 1 ); - ++i; - if ( str[i] == ';' ) - break; - } - } - else if ( c == '&' ) - { - outString->append( entity[0].str, entity[0].strLength ); - ++i; - } - else if ( c == '<' ) - { - outString->append( entity[1].str, entity[1].strLength ); - ++i; - } - else if ( c == '>' ) - { - outString->append( entity[2].str, entity[2].strLength ); - ++i; - } - else if ( c == '\"' ) - { - outString->append( entity[3].str, entity[3].strLength ); - ++i; - } - else if ( c == '\'' ) - { - outString->append( entity[4].str, entity[4].strLength ); - ++i; - } - else if ( c < 32 ) - { - // Easy pass at non-alpha/numeric/symbol - // Below 32 is symbolic. - char buf[ 32 ]; + outString->append( entity[4].str, entity[4].strLength ); + ++i; + } + else if ( c < 32 ) + { + // Easy pass at non-alpha/numeric/symbol + // Below 32 is symbolic. + char buf[ 32 ]; #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); + TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); #else - sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); + sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); #endif - //*ME: warning C4267: convert 'size_t' to 'int' - //*ME: Int-Cast to make compiler happy ... - outString->append( buf, (int)strlen( buf ) ); - ++i; - } - else - { - //char realc = (char) c; - //outString->append( &realc, 1 ); - *outString += (char) c; // somewhat more efficient function call. - ++i; - } + //*ME: warning C4267: convert 'size_t' to 'int' + //*ME: Int-Cast to make compiler happy ... + outString->append( buf, (int)strlen( buf ) ); + ++i; + } + else + { + //char realc = (char) c; + //outString->append( &realc, 1 ); + *outString += (char) c; // somewhat more efficient function call. + ++i; } + } } @@ -140,11 +140,11 @@ TiXmlNode::~TiXmlNode() TiXmlNode* temp = 0; while ( node ) - { - temp = node; - node = node->next; - delete temp; - } + { + temp = node; + node = node->next; + delete temp; + } } @@ -161,11 +161,11 @@ void TiXmlNode::Clear() TiXmlNode* temp = 0; while ( node ) - { - temp = node; - node = node->next; - delete temp; - } + { + temp = node; + node = node->next; + delete temp; + } firstChild = 0; lastChild = 0; @@ -178,11 +178,11 @@ TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); if ( node->Type() == TiXmlNode::DOCUMENT ) - { - delete node; - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } + { + delete node; + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } node->parent = this; @@ -202,10 +202,10 @@ TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) { if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } TiXmlNode* node = addThis.Clone(); if ( !node ) return 0; @@ -220,10 +220,10 @@ TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& return 0; } if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } TiXmlNode* node = addThis.Clone(); if ( !node ) @@ -233,14 +233,14 @@ TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& node->next = beforeThis; node->prev = beforeThis->prev; if ( beforeThis->prev ) - { - beforeThis->prev->next = node; - } + { + beforeThis->prev->next = node; + } else - { - assert( firstChild == beforeThis ); - firstChild = node; - } + { + assert( firstChild == beforeThis ); + firstChild = node; + } beforeThis->prev = node; return node; } @@ -252,10 +252,10 @@ TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& a return 0; } if ( addThis.Type() == TiXmlNode::DOCUMENT ) - { - if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } + { + if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } TiXmlNode* node = addThis.Clone(); if ( !node ) @@ -265,14 +265,14 @@ TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& a node->prev = afterThis; node->next = afterThis->next; if ( afterThis->next ) - { - afterThis->next->prev = node; - } + { + afterThis->next->prev = node; + } else - { - assert( lastChild == afterThis ); - lastChild = node; - } + { + assert( lastChild == afterThis ); + lastChild = node; + } afterThis->next = node; return node; } @@ -309,10 +309,10 @@ TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& wit bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) { if ( removeThis->parent != this ) - { - assert( 0 ); - return false; - } + { + assert( 0 ); + return false; + } if ( removeThis->next ) removeThis->next->prev = removeThis->prev; @@ -332,10 +332,10 @@ const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const { const TiXmlNode* node; for ( node = firstChild; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } return 0; } @@ -344,10 +344,10 @@ const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const { const TiXmlNode* node; for ( node = lastChild; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } return 0; } @@ -355,28 +355,28 @@ const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const { if ( !previous ) - { - return FirstChild(); - } + { + return FirstChild(); + } else - { - assert( previous->parent == this ); - return previous->NextSibling(); - } + { + assert( previous->parent == this ); + return previous->NextSibling(); + } } const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const { if ( !previous ) - { - return FirstChild( val ); - } + { + return FirstChild( val ); + } else - { - assert( previous->parent == this ); - return previous->NextSibling( val ); - } + { + assert( previous->parent == this ); + return previous->NextSibling( val ); + } } @@ -384,10 +384,10 @@ const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const { const TiXmlNode* node; for ( node = next; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } return 0; } @@ -396,10 +396,10 @@ const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const { const TiXmlNode* node; for ( node = prev; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } + { + if ( strcmp( node->Value(), _value ) == 0 ) + return node; + } return 0; } @@ -413,10 +413,10 @@ void TiXmlElement::RemoveAttribute( const char * name ) TiXmlAttribute* node = attributeSet.Find( name ); #endif if ( node ) - { - attributeSet.Remove( node ); - delete node; - } + { + attributeSet.Remove( node ); + delete node; + } } const TiXmlElement* TiXmlNode::FirstChildElement() const @@ -426,10 +426,10 @@ const TiXmlElement* TiXmlNode::FirstChildElement() const for ( node = FirstChild(); node; node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } + { + if ( node->ToElement() ) + return node->ToElement(); + } return 0; } @@ -441,10 +441,10 @@ const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const for ( node = FirstChild( _value ); node; node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } + { + if ( node->ToElement() ) + return node->ToElement(); + } return 0; } @@ -456,10 +456,10 @@ const TiXmlElement* TiXmlNode::NextSiblingElement() const for ( node = NextSibling(); node; node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } + { + if ( node->ToElement() ) + return node->ToElement(); + } return 0; } @@ -471,10 +471,10 @@ const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const for ( node = NextSibling( _value ); node; node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } + { + if ( node->ToElement() ) + return node->ToElement(); + } return 0; } @@ -486,10 +486,10 @@ const TiXmlElement* TiXmlNode::PreviousSiblingElement() const for ( node = PreviousSibling(); node; node = node->PreviousSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } + { + if ( node->ToElement() ) + return node->ToElement(); + } return 0; } @@ -500,10 +500,10 @@ const TiXmlElement* TiXmlNode::PreviousSiblingElement( const char * _value ) con for ( node = PreviousSibling( _value ); node; node = node->PreviousSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } + { + if ( node->ToElement() ) + return node->ToElement(); + } return 0; } @@ -513,16 +513,16 @@ const TiXmlDocument* TiXmlNode::GetDocument() const const TiXmlNode* node; for( node = this; node; node = node->parent ) - { - if ( node->ToDocument() ) - return node->ToDocument(); - } + { + if ( node->ToDocument() ) + return node->ToDocument(); + } return 0; } TiXmlElement::TiXmlElement (const char * _value) -: TiXmlNode( TiXmlNode::ELEMENT ) + : TiXmlNode( TiXmlNode::ELEMENT ) { firstChild = lastChild = 0; value = _value; @@ -531,7 +531,7 @@ TiXmlElement::TiXmlElement (const char * _value) #ifdef TIXML_USE_STL TiXmlElement::TiXmlElement( const std::string& _value ) -: TiXmlNode( TiXmlNode::ELEMENT ) + : TiXmlNode( TiXmlNode::ELEMENT ) { firstChild = lastChild = 0; value = _value; @@ -540,7 +540,7 @@ TiXmlElement::TiXmlElement( const std::string& _value ) TiXmlElement::TiXmlElement( const TiXmlElement& copy) -: TiXmlNode( TiXmlNode::ELEMENT ) + : TiXmlNode( TiXmlNode::ELEMENT ) { firstChild = lastChild = 0; copy.CopyTo( this ); @@ -554,31 +554,31 @@ void TiXmlElement::operator=( const TiXmlElement& base ) } - TiXmlElement::~TiXmlElement() - { - ClearThis(); - } +TiXmlElement::~TiXmlElement() +{ + ClearThis(); +} void TiXmlElement::ClearThis() { Clear(); while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } + { + TiXmlAttribute* node = attributeSet.First(); + attributeSet.Remove( node ); + delete node; + } } void TiXmlElement::ClearAttributes() { while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } + { + TiXmlAttribute* node = attributeSet.First(); + attributeSet.Remove( node ); + delete node; + } } @@ -606,14 +606,14 @@ const char* TiXmlElement::Attribute( const char* name, int* i ) const { const char* s = Attribute( name ); if ( i ) - { - if ( s ) { - *i = atoi( s ); - } - else { - *i = 0; - } + { + if ( s ) { + *i = atoi( s ); } + else { + *i = 0; + } + } return s; } @@ -623,14 +623,14 @@ const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) co { const std::string* s = Attribute( name ); if ( i ) - { - if ( s ) { - *i = atoi( s->c_str() ); - } - else { - *i = 0; - } + { + if ( s ) { + *i = atoi( s->c_str() ); } + else { + *i = 0; + } + } return s; } #endif @@ -640,14 +640,14 @@ const char* TiXmlElement::Attribute( const char* name, double* d ) const { const char* s = Attribute( name ); if ( d ) - { - if ( s ) { - *d = atof( s ); - } - else { - *d = 0; - } + { + if ( s ) { + *d = atof( s ); + } + else { + *d = 0; } + } return s; } @@ -657,14 +657,14 @@ const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) { const std::string* s = Attribute( name ); if ( d ) - { - if ( s ) { - *d = atof( s->c_str() ); - } - else { - *d = 0; - } + { + if ( s ) { + *d = atof( s->c_str() ); + } + else { + *d = 0; } + } return s; } #endif @@ -756,21 +756,21 @@ void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) TiXmlAttribute* node = attributeSet.Find( _name ); if ( node ) - { - node->SetValue( _value ); - return; - } + { + node->SetValue( _value ); + return; + } TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue ); if ( attrib ) - { - attributeSet.Add( attrib ); - } + { + attributeSet.Add( attrib ); + } else - { - TiXmlDocument* document = GetDocument(); - if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } + { + TiXmlDocument* document = GetDocument(); + if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } } @@ -779,21 +779,21 @@ void TiXmlElement::SetAttribute( const std::string& name, const std::string& _va { TiXmlAttribute* node = attributeSet.Find( name ); if ( node ) - { - node->SetValue( _value ); - return; - } + { + node->SetValue( _value ); + return; + } TiXmlAttribute* attrib = new TiXmlAttribute( name, _value ); if ( attrib ) - { - attributeSet.Add( attrib ); - } + { + attributeSet.Add( attrib ); + } else - { - TiXmlDocument* document = GetDocument(); - if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } + { + TiXmlDocument* document = GetDocument(); + if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } } #endif @@ -810,10 +810,10 @@ void TiXmlElement::Print( FILE* cfile, int depth ) const const TiXmlAttribute* attrib; for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() ) - { - fprintf( cfile, " " ); - attrib->Print( cfile, depth ); - } + { + fprintf( cfile, " " ); + attrib->Print( cfile, depth ); + } // There are 3 different formatting approaches: // 1) An element without children is printed as a <foo /> node @@ -821,33 +821,33 @@ void TiXmlElement::Print( FILE* cfile, int depth ) const // 3) An element with children is printed on multiple lines. TiXmlNode* node; if ( !firstChild ) - { - fprintf( cfile, " />" ); - } + { + fprintf( cfile, " />" ); + } else if ( firstChild == lastChild && firstChild->ToText() ) - { - fprintf( cfile, ">" ); - firstChild->Print( cfile, depth + 1 ); - fprintf( cfile, "</%s>", value.c_str() ); - } + { + fprintf( cfile, ">" ); + firstChild->Print( cfile, depth + 1 ); + fprintf( cfile, "</%s>", value.c_str() ); + } else + { + fprintf( cfile, ">" ); + + for ( node = firstChild; node; node=node->NextSibling() ) { - fprintf( cfile, ">" ); - - for ( node = firstChild; node; node=node->NextSibling() ) - { - if ( !node->ToText() ) - { - fprintf( cfile, "\n" ); - } - node->Print( cfile, depth+1 ); - } - fprintf( cfile, "\n" ); - for( i=0; i<depth; ++i ) { - fprintf( cfile, " " ); + if ( !node->ToText() ) + { + fprintf( cfile, "\n" ); } - fprintf( cfile, "</%s>", value.c_str() ); + node->Print( cfile, depth+1 ); + } + fprintf( cfile, "\n" ); + for( i=0; i<depth; ++i ) { + fprintf( cfile, " " ); } + fprintf( cfile, "</%s>", value.c_str() ); + } } @@ -862,27 +862,27 @@ void TiXmlElement::CopyTo( TiXmlElement* target ) const for( attribute = attributeSet.First(); attribute; attribute = attribute->Next() ) - { - target->SetAttribute( attribute->Name(), attribute->Value() ); - } + { + target->SetAttribute( attribute->Name(), attribute->Value() ); + } TiXmlNode* node = 0; for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } + { + target->LinkEndChild( node->Clone() ); + } } bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const { if ( visitor->VisitEnter( *this, attributeSet.First() ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } + if ( !node->Accept( visitor ) ) + break; } + } return visitor->VisitExit( *this ); } @@ -951,13 +951,13 @@ void TiXmlDocument::operator=( const TiXmlDocument& copy ) } - bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) - { - // See STL_STRING_BUG below. - //StringToBuffer buf( value ); +bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) +{ + // See STL_STRING_BUG below. + //StringToBuffer buf( value ); - return LoadFile( Value(), encoding ); - } + return LoadFile( Value(), encoding ); +} bool TiXmlDocument::SaveFile() const @@ -988,25 +988,25 @@ bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) FILE* file = fopen( value.c_str (), "rb" ); if ( file ) - { - bool result = LoadFile( file, encoding ); - fclose( file ); - return result; - } + { + bool result = LoadFile( file, encoding ); + fclose( file ); + return result; + } else - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } } bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) { if ( !file ) - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } // Delete the existing data: Clear(); @@ -1020,10 +1020,10 @@ bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) // Strange case, but good to handle up front. if ( length == 0 ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } // If we have a file, assume it is all one big XML file, and read it in. // The document parser may decide the document ends sooner than the entire file, however. @@ -1120,11 +1120,11 @@ bool TiXmlDocument::SaveFile( const char * filename ) const // The old c stuff lives on... FILE* fp = fopen( filename, "w" ); if ( fp ) - { - bool result = SaveFile( fp ); - fclose( fp ); - return result; - } + { + bool result = SaveFile( fp ); + fclose( fp ); + return result; + } return false; } @@ -1132,15 +1132,15 @@ bool TiXmlDocument::SaveFile( const char * filename ) const bool TiXmlDocument::SaveFile( FILE* fp ) const { if ( useMicrosoftBOM ) - { - const unsigned char TIXML_UTF_LEAD_0 = 0xefU; - const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; - const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + { + const unsigned char TIXML_UTF_LEAD_0 = 0xefU; + const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; + const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - fputc( TIXML_UTF_LEAD_0, fp ); - fputc( TIXML_UTF_LEAD_1, fp ); - fputc( TIXML_UTF_LEAD_2, fp ); - } + fputc( TIXML_UTF_LEAD_0, fp ); + fputc( TIXML_UTF_LEAD_1, fp ); + fputc( TIXML_UTF_LEAD_2, fp ); + } Print( fp, 0 ); return (ferror(fp) == 0); } @@ -1155,9 +1155,9 @@ void TiXmlDocument::CopyTo( TiXmlDocument* target ) const TiXmlNode* node = 0; for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } + { + target->LinkEndChild( node->Clone() ); + } } @@ -1176,23 +1176,23 @@ void TiXmlDocument::Print( FILE* cfile, int depth ) const { assert( cfile ); for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - node->Print( cfile, depth ); - fprintf( cfile, "\n" ); - } + { + node->Print( cfile, depth ); + fprintf( cfile, "\n" ); + } } bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const { if ( visitor->VisitEnter( *this ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } + if ( !node->Accept( visitor ) ) + break; } + } return visitor->VisitExit( *this ); } @@ -1323,15 +1323,15 @@ void TiXmlComment::operator=( const TiXmlComment& base ) } - void TiXmlComment::Print( FILE* cfile, int depth ) const +void TiXmlComment::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + for ( int i=0; i<depth; i++ ) { - assert( cfile ); - for ( int i=0; i<depth; i++ ) - { - fprintf( cfile, " " ); - } - fprintf( cfile, "<!--%s-->", value.c_str() ); + fprintf( cfile, " " ); } + fprintf( cfile, "<!--%s-->", value.c_str() ); +} void TiXmlComment::CopyTo( TiXmlComment* target ) const @@ -1362,20 +1362,20 @@ void TiXmlText::Print( FILE* cfile, int depth ) const { assert( cfile ); if ( cdata ) - { - int i; - fprintf( cfile, "\n" ); - for ( i=0; i<depth; i++ ) { - fprintf( cfile, " " ); - } - fprintf( cfile, "<![CDATA[%s]]>\n", value.c_str() ); // unformatted output + { + int i; + fprintf( cfile, "\n" ); + for ( i=0; i<depth; i++ ) { + fprintf( cfile, " " ); } + fprintf( cfile, "<![CDATA[%s]]>\n", value.c_str() ); // unformatted output + } else - { - TIXML_STRING buffer; - PutString( value, &buffer ); - fprintf( cfile, "%s", buffer.c_str() ); - } + { + TIXML_STRING buffer; + PutString( value, &buffer ); + fprintf( cfile, "%s", buffer.c_str() ); + } } @@ -1408,7 +1408,7 @@ TiXmlNode* TiXmlText::Clone() const TiXmlDeclaration::TiXmlDeclaration( const char * _version, const char * _encoding, const char * _standalone ) -: TiXmlNode( TiXmlNode::DECLARATION ) + : TiXmlNode( TiXmlNode::DECLARATION ) { version = _version; encoding = _encoding; @@ -1420,7 +1420,7 @@ TiXmlDeclaration::TiXmlDeclaration( const char * _version, TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, const std::string& _encoding, const std::string& _standalone ) -: TiXmlNode( TiXmlNode::DECLARATION ) + : TiXmlNode( TiXmlNode::DECLARATION ) { version = _version; encoding = _encoding; @@ -1430,7 +1430,7 @@ TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) -: TiXmlNode( TiXmlNode::DECLARATION ) + : TiXmlNode( TiXmlNode::DECLARATION ) { copy.CopyTo( this ); } @@ -1443,26 +1443,26 @@ void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) } - void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const - { - if ( cfile ) fprintf( cfile, "<?xml " ); - if ( str ) (*str) += "<?xml "; +void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const +{ + if ( cfile ) fprintf( cfile, "<?xml " ); + if ( str ) (*str) += "<?xml "; - if ( !version.empty() ) { - if ( cfile ) fprintf (cfile, "version=\"%s\" ", version.c_str ()); - if ( str ) { (*str) += "version=\""; (*str) += version; (*str) += "\" "; } - } - if ( !encoding.empty() ) { - if ( cfile ) fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ()); - if ( str ) { (*str) += "encoding=\""; (*str) += encoding; (*str) += "\" "; } - } - if ( !standalone.empty() ) { - if ( cfile ) fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ()); - if ( str ) { (*str) += "standalone=\""; (*str) += standalone; (*str) += "\" "; } - } - if ( cfile ) fprintf( cfile, "?>" ); - if ( str ) (*str) += "?>"; + if ( !version.empty() ) { + if ( cfile ) fprintf (cfile, "version=\"%s\" ", version.c_str ()); + if ( str ) { (*str) += "version=\""; (*str) += version; (*str) += "\" "; } + } + if ( !encoding.empty() ) { + if ( cfile ) fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ()); + if ( str ) { (*str) += "encoding=\""; (*str) += encoding; (*str) += "\" "; } } + if ( !standalone.empty() ) { + if ( cfile ) fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ()); + if ( str ) { (*str) += "standalone=\""; (*str) += standalone; (*str) += "\" "; } + } + if ( cfile ) fprintf( cfile, "?>" ); + if ( str ) (*str) += "?>"; +} void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const @@ -1559,16 +1559,16 @@ void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) TiXmlAttribute* node; for( node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( node == removeMe ) { - if ( node == removeMe ) - { - node->prev->next = node->next; - node->next->prev = node->prev; - node->next = 0; - node->prev = 0; - return; - } + node->prev->next = node->next; + node->next->prev = node->prev; + node->next = 0; + node->prev = 0; + return; } + } assert( 0 ); // we tried to remove a non-linked attribute. } @@ -1577,10 +1577,10 @@ void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const { for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - return node; - } + { + if ( node->name == name ) + return node; + } return 0; } @@ -1601,10 +1601,10 @@ const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const const TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const { for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - return node; - } + { + if ( strcmp( node->name.c_str(), name ) == 0 ) + return node; + } return 0; } @@ -1660,11 +1660,11 @@ std::string& operator<< (std::string& out, const TiXmlNode& base ) TiXmlHandle TiXmlHandle::FirstChild() const { if ( node ) - { - TiXmlNode* child = node->FirstChild(); - if ( child ) - return TiXmlHandle( child ); - } + { + TiXmlNode* child = node->FirstChild(); + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1672,11 +1672,11 @@ TiXmlHandle TiXmlHandle::FirstChild() const TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const { if ( node ) - { - TiXmlNode* child = node->FirstChild( value ); - if ( child ) - return TiXmlHandle( child ); - } + { + TiXmlNode* child = node->FirstChild( value ); + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1684,11 +1684,11 @@ TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const TiXmlHandle TiXmlHandle::FirstChildElement() const { if ( node ) - { - TiXmlElement* child = node->FirstChildElement(); - if ( child ) - return TiXmlHandle( child ); - } + { + TiXmlElement* child = node->FirstChildElement(); + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1696,11 +1696,11 @@ TiXmlHandle TiXmlHandle::FirstChildElement() const TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const { if ( node ) - { - TiXmlElement* child = node->FirstChildElement( value ); - if ( child ) - return TiXmlHandle( child ); - } + { + TiXmlElement* child = node->FirstChildElement( value ); + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1708,18 +1708,18 @@ TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const TiXmlHandle TiXmlHandle::Child( int count ) const { if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild(); + for ( i=0; + child && i<count; + child = child->NextSibling(), ++i ) { - int i; - TiXmlNode* child = node->FirstChild(); - for ( i=0; - child && i<count; - child = child->NextSibling(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); + // nothing } + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1727,18 +1727,18 @@ TiXmlHandle TiXmlHandle::Child( int count ) const TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const { if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild( value ); + for ( i=0; + child && i<count; + child = child->NextSibling( value ), ++i ) { - int i; - TiXmlNode* child = node->FirstChild( value ); - for ( i=0; - child && i<count; - child = child->NextSibling( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); + // nothing } + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1746,18 +1746,18 @@ TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const TiXmlHandle TiXmlHandle::ChildElement( int count ) const { if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement(); + for ( i=0; + child && i<count; + child = child->NextSiblingElement(), ++i ) { - int i; - TiXmlElement* child = node->FirstChildElement(); - for ( i=0; - child && i<count; - child = child->NextSiblingElement(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); + // nothing } + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1765,18 +1765,18 @@ TiXmlHandle TiXmlHandle::ChildElement( int count ) const TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const { if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement( value ); + for ( i=0; + child && i<count; + child = child->NextSiblingElement( value ), ++i ) { - int i; - TiXmlElement* child = node->FirstChildElement( value ); - for ( i=0; - child && i<count; - child = child->NextSiblingElement( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); + // nothing } + if ( child ) + return TiXmlHandle( child ); + } return TiXmlHandle( 0 ); } @@ -1798,31 +1798,31 @@ bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute buffer += element.Value(); for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - buffer += " "; - attrib->Print( 0, 0, &buffer ); - } + { + buffer += " "; + attrib->Print( 0, 0, &buffer ); + } if ( !element.FirstChild() ) + { + buffer += " />"; + DoLineBreak(); + } + else + { + buffer += ">"; + if ( element.FirstChild()->ToText() + && element.LastChild() == element.FirstChild() + && element.FirstChild()->ToText()->CDATA() == false ) { - buffer += " />"; - DoLineBreak(); + simpleTextPrint = true; + // no DoLineBreak()! } - else + else { - buffer += ">"; - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) - { - simpleTextPrint = true; - // no DoLineBreak()! - } - else - { - DoLineBreak(); - } + DoLineBreak(); } + } ++depth; return true; } @@ -1832,24 +1832,24 @@ bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) { --depth; if ( !element.FirstChild() ) + { + // nothing. + } + else + { + if ( simpleTextPrint ) { - // nothing. + simpleTextPrint = false; } - else + else { - if ( simpleTextPrint ) - { - simpleTextPrint = false; - } - else - { - DoIndent(); - } - buffer += "</"; - buffer += element.Value(); - buffer += ">"; - DoLineBreak(); + DoIndent(); } + buffer += "</"; + buffer += element.Value(); + buffer += ">"; + DoLineBreak(); + } return true; } @@ -1857,23 +1857,23 @@ bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) bool TiXmlPrinter::Visit( const TiXmlText& text ) { if ( text.CDATA() ) - { - DoIndent(); - buffer += "<![CDATA["; - buffer += text.Value(); - buffer += "]]>"; - DoLineBreak(); - } + { + DoIndent(); + buffer += "<![CDATA["; + buffer += text.Value(); + buffer += "]]>"; + DoLineBreak(); + } else if ( simpleTextPrint ) - { - buffer += text.Value(); - } + { + buffer += text.Value(); + } else - { - DoIndent(); - buffer += text.Value(); - DoLineBreak(); - } + { + DoIndent(); + buffer += text.Value(); + DoLineBreak(); + } return true; } diff --git a/DDCore/src/XML/tinyxmlparser_inl.h b/DDCore/src/XML/tinyxmlparser_inl.h index e6c218fb3e236703a206ec5def1449f267ffa6a3..2e0e58a331856c598518cd255cbfe47f0b076668 100644 --- a/DDCore/src/XML/tinyxmlparser_inl.h +++ b/DDCore/src/XML/tinyxmlparser_inl.h @@ -108,29 +108,29 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng else if ( input < 0x200000 ) *length = 4; else - { *length = 0; return; } // This code won't covert this correctly anyway. + { *length = 0; return; } // This code won't covert this correctly anyway. output += *length; // Scary scary fall throughs. switch (*length) - { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - } + { + case 4: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 3: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 2: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 1: + --output; + *output = (char)(input | FIRST_BYTE_MARK[*length]); + } } @@ -179,21 +179,21 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng class TiXmlParsingData { friend class TiXmlDocument; - public: +public: void Stamp( const char* now, TiXmlEncoding encoding ); const TiXmlCursor& Cursor() { return cursor; } - private: +private: // Only used by the document! TiXmlParsingData( const char* start, int _tabsize, int row, int col ) - { - assert( start ); - stamp = start; - tabsize = _tabsize; - cursor.row = row; - cursor.col = col; - } + { + assert( start ); + stamp = start; + tabsize = _tabsize; + cursor.row = row; + cursor.col = col; + } TiXmlCursor cursor; const char* stamp; @@ -207,9 +207,9 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) // Do nothing if the tabsize is 0. if ( tabsize < 1 ) - { - return; - } + { + return; + } // Get the current row, column. int row = cursor.row; @@ -218,98 +218,98 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) assert( p ); while ( p < now ) - { - // Treat p as unsigned, so we have a happy compiler. - const unsigned char* pU = (const unsigned char*)p; + { + // Treat p as unsigned, so we have a happy compiler. + const unsigned char* pU = (const unsigned char*)p; + + // Code contributed by Fletcher Dunn: (modified by lee) + switch (*pU) { + case 0: + // We *should* never get here, but in case we do, don't + // advance past the terminating null character, ever + return; - // Code contributed by Fletcher Dunn: (modified by lee) - switch (*pU) { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; + case '\r': + // bump down to the next line + ++row; + col = 0; + // Eat the character + ++p; - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character + // Check for \r\n sequence, and treat this as a single character + if (*p == '\n') { ++p; + } + break; - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') { - ++p; - } - break; + case '\n': + // bump down to the next line + ++row; + col = 0; - case '\n': - // bump down to the next line - ++row; - col = 0; + // Eat the character + ++p; - // Eat the character + // Check for \n\r sequence, and treat this as a single + // character. (Yes, this bizarre thing does occur still + // on some arcane platforms...) + if (*p == '\r') { ++p; + } + break; - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') { - ++p; - } - break; - - case '\t': - // Eat the character - ++p; + case '\t': + // Eat the character + ++p; - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; + // Skip to next tab stop + col = (col / tabsize + 1) * tabsize; + break; - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) - { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; - else - { p +=3; ++col; } // A normal character. - } - } - else - { - ++p; - ++col; - } - break; + case TIXML_UTF_LEAD_0: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( *(p+1) && *(p+2) ) + { + // In these cases, don't advance the column. These are + // 0-width spaces. + if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) + p += 3; + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) + p += 3; + else + { p +=3; ++col; } // A normal character. + } + } + else + { + ++p; + ++col; + } + break; - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - if ( step == 0 ) - step = 1; // Error case from bad encoding, but handle gracefully. - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - break; + default: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // Eat the 1 to 4 byte utf8 character. + int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; + if ( step == 0 ) + step = 1; // Error case from bad encoding, but handle gracefully. + p += step; + + // Just advance one column, of course. + ++col; } + else + { + ++p; + ++col; + } + break; } + } cursor.row = row; cursor.col = col; assert( cursor.row >= -1 ); @@ -322,49 +322,49 @@ void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) { if ( !p || !*p ) - { - return 0; - } + { + return 0; + } if ( encoding == TIXML_ENCODING_UTF8 ) + { + while ( *p ) { - while ( *p ) - { - const unsigned char* pU = (const unsigned char*)p; - - // Skip the stupid Microsoft UTF-8 Byte order marks - if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 - && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbeU ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbfU ) - { - p += 3; - continue; - } - - if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space. - ++p; - else - break; - } - } - else - { - while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' ) + const unsigned char* pU = (const unsigned char*)p; + + // Skip the stupid Microsoft UTF-8 Byte order marks + if ( *(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==TIXML_UTF_LEAD_1 + && *(pU+2)==TIXML_UTF_LEAD_2 ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbeU ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbfU ) + { + p += 3; + continue; + } + + if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' ) // Still using old rules for white space. ++p; + else + break; } + } + else + { + while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' ) + ++p; + } return p; } @@ -373,32 +373,32 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) /*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) { for( ;; ) - { - if ( !in->good() ) return false; + { + if ( !in->good() ) return false; - int c = in->peek(); - // At this scope, we can't get to a document. So fail silently. - if ( !IsWhiteSpace( c ) || c <= 0 ) - return true; + int c = in->peek(); + // At this scope, we can't get to a document. So fail silently. + if ( !IsWhiteSpace( c ) || c <= 0 ) + return true; - *tag += (char) in->get(); - } + *tag += (char) in->get(); + } } /*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) { //assert( character > 0 && character < 128 ); // else it won't work in utf-8 while ( in->good() ) - { - int c = in->peek(); - if ( c == character ) - return true; - if ( c <= 0 ) // Silent failure: can't get document at this scope - return false; - - in->get(); - *tag += (char) c; - } + { + int c = in->peek(); + if ( c == character ) + return true; + if ( c <= 0 ) // Silent failure: can't get document at this scope + return false; + + in->get(); + *tag += (char) c; + } return false; } #endif @@ -423,23 +423,23 @@ const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncodi // but tinyxml can't tell namespaces from names.) if ( p && *p && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) - { - const char* start = p; - while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) - || *p == '_' - || *p == '-' - || *p == '.' - || *p == ':' ) ) - { - //(*name) += *p; // expensive - ++p; - } - if ( p-start > 0 ) { - name->assign( start, p-start ); - } - return p; + { + const char* start = p; + while( p && *p + && ( IsAlphaNum( (unsigned char ) *p, encoding ) + || *p == '_' + || *p == '-' + || *p == '.' + || *p == ':' ) ) + { + //(*name) += *p; // expensive + ++p; } + if ( p-start > 0 ) { + name->assign( start, p-start ); + } + return p; + } return 0; } @@ -451,85 +451,85 @@ const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXml *length = 0; if ( *(p+1) && *(p+1) == '#' && *(p+2) ) + { + unsigned long ucs = 0; + ptrdiff_t delta = 0; + unsigned mult = 1; + + if ( *(p+2) == 'x' ) { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; + // Hexadecimal. + if ( !*(p+3) ) return 0; - if ( *(p+2) == 'x' ) - { - // Hexadecimal. - if ( !*(p+3) ) return 0; - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != 'x' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else if ( *q >= 'a' && *q <= 'f' ) - ucs += mult * (*q - 'a' + 10); - else if ( *q >= 'A' && *q <= 'F' ) - ucs += mult * (*q - 'A' + 10 ); - else - return 0; - mult *= 16; - --q; - } - } - else - { - // Decimal. - if ( !*(p+2) ) return 0; - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != '#' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else - return 0; - mult *= 10; - --q; - } - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - } - else - { - *value = (char)ucs; - *length = 1; - } - return p + delta + 1; + const char* q = p+3; + q = strchr( q, ';' ); + + if ( !q || !*q ) return 0; + + delta = q-p; + --q; + + while ( *q != 'x' ) + { + if ( *q >= '0' && *q <= '9' ) + ucs += mult * (*q - '0'); + else if ( *q >= 'a' && *q <= 'f' ) + ucs += mult * (*q - 'a' + 10); + else if ( *q >= 'A' && *q <= 'F' ) + ucs += mult * (*q - 'A' + 10 ); + else + return 0; + mult *= 16; + --q; + } + } + else + { + // Decimal. + if ( !*(p+2) ) return 0; + + const char* q = p+2; + q = strchr( q, ';' ); + + if ( !q || !*q ) return 0; + + delta = q-p; + --q; + + while ( *q != '#' ) + { + if ( *q >= '0' && *q <= '9' ) + ucs += mult * (*q - '0'); + else + return 0; + mult *= 10; + --q; + } + } + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // convert the UCS to UTF-8 + ConvertUTF32ToUTF8( ucs, value, length ); } + else + { + *value = (char)ucs; + *length = 1; + } + return p + delta + 1; + } // Now try to match it. for( i=0; i<NUM_ENTITY; ++i ) + { + if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 ) { - if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 ) - { - assert( strlen( entity[i].str ) == entity[i].strLength ); - *value = entity[i].chr; - *length = 1; - return ( p + entity[i].strLength ); - } + assert( strlen( entity[i].str ) == entity[i].strLength ); + *value = entity[i].chr; + *length = 1; + return ( p + entity[i].strLength ); } + } // So it wasn't an entity, its unrecognized, or something like that. *value = *p; // Don't put back the last one, since we return it! @@ -547,35 +547,35 @@ bool TiXmlBase::StringEqual( const char* p, assert( p ); assert( tag ); if ( !p || !*p ) - { - assert( 0 ); - return false; - } + { + assert( 0 ); + return false; + } const char* q = p; if ( ignoreCase ) + { + while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) ) { - while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) ) - { - ++q; - ++tag; - } - - if ( *tag == 0 ) - return true; + ++q; + ++tag; } + + if ( *tag == 0 ) + return true; + } else + { + while ( *q && *tag && *q == *tag ) { - while ( *q && *tag && *q == *tag ) - { - ++q; - ++tag; - } - - if ( *tag == 0 ) // Have we found the end of the tag, and everything equal? - return true; + ++q; + ++tag; } + + if ( *tag == 0 ) // Have we found the end of the tag, and everything equal? + return true; + } return false; } @@ -589,56 +589,56 @@ const char* TiXmlBase::ReadText( const char* p, *text = ""; if ( !trimWhiteSpace // certain tags always keep whitespace || !condenseWhiteSpace ) // if true, whitespace is always kept + { + // Keep all the white space. + while ( p && *p + && !StringEqual( p, endTag, caseInsensitive, encoding ) + ) { - // Keep all the white space. - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) - ) - { - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - text->append( cArr, len ); - } + int len; + char cArr[4] = { 0, 0, 0, 0 }; + p = GetChar( p, cArr, &len, encoding ); + text->append( cArr, len ); } + } else - { - bool whitespace = false; + { + bool whitespace = false; - // Remove leading white space: - p = SkipWhiteSpace( p, encoding ); - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) ) + // Remove leading white space: + p = SkipWhiteSpace( p, encoding ); + while ( p && *p + && !StringEqual( p, endTag, caseInsensitive, encoding ) ) + { + if ( *p == '\r' || *p == '\n' ) + { + whitespace = true; + ++p; + } + else if ( IsWhiteSpace( *p ) ) + { + whitespace = true; + ++p; + } + else + { + // If we've found whitespace, add it before the + // new character. Any whitespace just becomes a space. + if ( whitespace ) { - if ( *p == '\r' || *p == '\n' ) - { - whitespace = true; - ++p; - } - else if ( IsWhiteSpace( *p ) ) - { - whitespace = true; - ++p; - } - else - { - // If we've found whitespace, add it before the - // new character. Any whitespace just becomes a space. - if ( whitespace ) - { - (*text) += ' '; - whitespace = false; - } - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - if ( len == 1 ) - (*text) += cArr[0]; // more efficient - else - text->append( cArr, len ); - } + (*text) += ' '; + whitespace = false; } + int len; + char cArr[4] = { 0, 0, 0, 0 }; + p = GetChar( p, cArr, &len, encoding ); + if ( len == 1 ) + (*text) += cArr[0]; // more efficient + else + text->append( cArr, len ); + } } + } if ( p ) p += strlen( endTag ); return p; @@ -656,53 +656,53 @@ void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) // sub-tag can orient itself. if ( !StreamTo( in, '<', tag ) ) + { + SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + + while ( in->good() ) + { + int tagIndex = (int) tag->length(); + while ( in->good() && in->peek() != '>' ) { - SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; + int c = in->get(); + if ( c <= 0 ) + { + SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + break; + } + (*tag) += (char) c; } - while ( in->good() ) + if ( in->good() ) { - int tagIndex = (int) tag->length(); - while ( in->good() && in->peek() != '>' ) - { - int c = in->get(); - if ( c <= 0 ) - { - SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - break; - } - (*tag) += (char) c; - } + // We now have something we presume to be a node of + // some sort. Identify it, and call the node to + // continue streaming. + TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - if ( in->good() ) + if ( node ) + { + node->StreamIn( in, tag ); + bool isElement = node->ToElement() != 0; + delete node; + node = 0; + + // If this is the root element, we're done. Parsing will be + // done by the >> operator. + if ( isElement ) { - // We now have something we presume to be a node of - // some sort. Identify it, and call the node to - // continue streaming. - TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - - if ( node ) - { - node->StreamIn( in, tag ); - bool isElement = node->ToElement() != 0; - delete node; - node = 0; - - // If this is the root element, we're done. Parsing will be - // done by the >> operator. - if ( isElement ) - { - return; - } - } - else - { - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } + return; } + } + else + { + SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } } + } // We should have returned sooner. SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); } @@ -717,82 +717,82 @@ const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiX // contains nothing but other tags, most of what happens // here is skipping white space. if ( !p || !*p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } // Note that, for a document, this needs to come // before the while space skip, so that parsing // starts from the pointer we are given. location.Clear(); if ( prevData ) - { - location.row = prevData->cursor.row; - location.col = prevData->cursor.col; - } + { + location.row = prevData->cursor.row; + location.col = prevData->cursor.col; + } else - { - location.row = 0; - location.col = 0; - } + { + location.row = 0; + location.col = 0; + } TiXmlParsingData data( p, TabSize(), location.row, location.col ); location = data.Cursor(); if ( encoding == TIXML_ENCODING_UNKNOWN ) + { + // Check for the Microsoft UTF-8 lead bytes. + const unsigned char* pU = (const unsigned char*)p; + if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 + && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 + && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) { - // Check for the Microsoft UTF-8 lead bytes. - const unsigned char* pU = (const unsigned char*)p; - if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 - && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 - && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) - { - encoding = TIXML_ENCODING_UTF8; - useMicrosoftBOM = true; - } + encoding = TIXML_ENCODING_UTF8; + useMicrosoftBOM = true; } + } p = SkipWhiteSpace( p, encoding ); if ( !p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } while ( p && *p ) + { + TiXmlNode* node = Identify( p, encoding ); + if ( node ) { - TiXmlNode* node = Identify( p, encoding ); - if ( node ) - { - p = node->Parse( p, &data, encoding ); - LinkEndChild( node ); - } - else - { - break; - } + p = node->Parse( p, &data, encoding ); + LinkEndChild( node ); + } + else + { + break; + } - // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) - { - TiXmlDeclaration* dec = node->ToDeclaration(); - const char* enc = dec->Encoding(); - assert( enc ); - - if ( *enc == 0 ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else - encoding = TIXML_ENCODING_LEGACY; - } + // Did we get encoding info? + if ( encoding == TIXML_ENCODING_UNKNOWN + && node->ToDeclaration() ) + { + TiXmlDeclaration* dec = node->ToDeclaration(); + const char* enc = dec->Encoding(); + assert( enc ); - p = SkipWhiteSpace( p, encoding ); + if ( *enc == 0 ) + encoding = TIXML_ENCODING_UTF8; + else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) + encoding = TIXML_ENCODING_UTF8; + else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) + encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice + else + encoding = TIXML_ENCODING_LEGACY; } + p = SkipWhiteSpace( p, encoding ); + } + // Was this empty? if ( !firstChild ) { SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); @@ -816,10 +816,10 @@ void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* dat errorLocation.Clear(); if ( pError && data ) - { - data->Stamp( pError, encoding ); - errorLocation = data->Cursor(); - } + { + data->Stamp( pError, encoding ); + errorLocation = data->Cursor(); + } } @@ -829,17 +829,17 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) p = SkipWhiteSpace( p, encoding ); if( !p || !*p || *p != '<' ) - { - return 0; - } + { + return 0; + } TiXmlDocument* doc = GetDocument(); p = SkipWhiteSpace( p, encoding ); if ( !p || !*p ) - { - return 0; - } + { + return 0; + } // What is this thing? // - Elements start with a letter or underscore, but xml is reserved. @@ -854,61 +854,61 @@ TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) const char* cdataHeader = { "<![CDATA[" }; if ( StringEqual( p, xmlHeader, true, encoding ) ) - { + { #ifdef DEBUG_PARSER - TIXML_LOG( "XML parsing Declaration\n" ); + TIXML_LOG( "XML parsing Declaration\n" ); #endif - returnNode = new TiXmlDeclaration(); - } + returnNode = new TiXmlDeclaration(); + } else if ( StringEqual( p, commentHeader, false, encoding ) ) - { + { #ifdef DEBUG_PARSER - TIXML_LOG( "XML parsing Comment\n" ); + TIXML_LOG( "XML parsing Comment\n" ); #endif - returnNode = new TiXmlComment(); - } + returnNode = new TiXmlComment(); + } else if ( StringEqual( p, cdataHeader, false, encoding ) ) - { + { #ifdef DEBUG_PARSER - TIXML_LOG( "XML parsing CDATA\n" ); + TIXML_LOG( "XML parsing CDATA\n" ); #endif - TiXmlText* text = new TiXmlText( "" ); - text->SetCDATA( true ); - returnNode = text; - } + TiXmlText* text = new TiXmlText( "" ); + text->SetCDATA( true ); + returnNode = text; + } else if ( StringEqual( p, dtdHeader, false, encoding ) ) - { + { #ifdef DEBUG_PARSER - TIXML_LOG( "XML parsing Unknown(1)\n" ); + TIXML_LOG( "XML parsing Unknown(1)\n" ); #endif - returnNode = new TiXmlUnknown(); - } + returnNode = new TiXmlUnknown(); + } else if ( IsAlpha( *(p+1), encoding ) || *(p+1) == '_' ) - { + { #ifdef DEBUG_PARSER - TIXML_LOG( "XML parsing Element\n" ); + TIXML_LOG( "XML parsing Element\n" ); #endif - returnNode = new TiXmlElement( "" ); - } + returnNode = new TiXmlElement( "" ); + } else - { + { #ifdef DEBUG_PARSER - TIXML_LOG( "XML parsing Unknown(2)\n" ); + TIXML_LOG( "XML parsing Unknown(2)\n" ); #endif - returnNode = new TiXmlUnknown(); - } + returnNode = new TiXmlUnknown(); + } if ( returnNode ) - { - // Set the parent, so it can report errors - returnNode->parent = this; - } + { + // Set the parent, so it can report errors + returnNode->parent = this; + } else - { - if ( doc ) - doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } + { + if ( doc ) + doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } return returnNode; } @@ -919,20 +919,20 @@ void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag) // We're called with some amount of pre-parsing. That is, some of "this" // element is in "tag". Go ahead and stream to the closing ">" while( in->good() ) + { + int c = in->get(); + if ( c <= 0 ) { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c ; - - if ( c == '>' ) - break; + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; } + (*tag) += (char) c ; + + if ( c == '>' ) + break; + } if ( tag->length() < 3 ) return; @@ -941,116 +941,116 @@ void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag) if ( tag->at( tag->length() - 1 ) == '>' && tag->at( tag->length() - 2 ) == '/' ) - { - // All good! - return; - } + { + // All good! + return; + } else if ( tag->at( tag->length() - 1 ) == '>' ) - { - // There is more. Could be: - // text - // cdata text (which looks like another node) - // closing tag - // another node. - for ( ;; ) + { + // There is more. Could be: + // text + // cdata text (which looks like another node) + // closing tag + // another node. + for ( ;; ) + { + StreamWhiteSpace( in, tag ); + + // Do we have text? + if ( in->good() && in->peek() != '<' ) + { + // Yep, text. + TiXmlText text( "" ); + text.StreamIn( in, tag ); + + // What follows text is a closing tag or another node. + // Go around again and figure it out. + continue; + } + + // We now have either a closing tag...or another node. + // We should be at a "<", regardless. + if ( !in->good() ) return; + assert( in->peek() == '<' ); + int tagIndex = (int) tag->length(); + + bool closingTag = false; + bool firstCharFound = false; + + for( ;; ) + { + if ( !in->good() ) + return; + + int c = in->peek(); + if ( c <= 0 ) { - StreamWhiteSpace( in, tag ); - - // Do we have text? - if ( in->good() && in->peek() != '<' ) - { - // Yep, text. - TiXmlText text( "" ); - text.StreamIn( in, tag ); - - // What follows text is a closing tag or another node. - // Go around again and figure it out. - continue; - } - - // We now have either a closing tag...or another node. - // We should be at a "<", regardless. - if ( !in->good() ) return; - assert( in->peek() == '<' ); - int tagIndex = (int) tag->length(); - - bool closingTag = false; - bool firstCharFound = false; - - for( ;; ) - { - if ( !in->good() ) - return; - - int c = in->peek(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - if ( c == '>' ) - break; - - *tag += (char) c; - in->get(); - - // Early out if we find the CDATA id. - if ( c == '[' && tag->size() >= 9 ) - { - size_t len = tag->size(); - const char* start = tag->c_str() + len - 9; - if ( strcmp( start, "<![CDATA[" ) == 0 ) { - assert( !closingTag ); - break; - } - } - - if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) ) - { - firstCharFound = true; - if ( c == '/' ) - closingTag = true; - } - } - // If it was a closing tag, then read in the closing '>' to clean up the input stream. - // If it was not, the streaming will be done by the tag. - if ( closingTag ) - { - if ( !in->good() ) - return; - - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - assert( c == '>' ); - *tag += (char) c; - - // We are done, once we've found our closing tag. - return; - } - else - { - // If not a closing tag, id it, and stream. - const char* tagloc = tag->c_str() + tagIndex; - TiXmlNode* node = Identify( tagloc, TIXML_DEFAULT_ENCODING ); - if ( !node ) - return; - node->StreamIn( in, tag ); - delete node; - node = 0; - - // No return: go around from the beginning: text, closing tag, or node. - } + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + + if ( c == '>' ) + break; + + *tag += (char) c; + in->get(); + + // Early out if we find the CDATA id. + if ( c == '[' && tag->size() >= 9 ) + { + size_t len = tag->size(); + const char* start = tag->c_str() + len - 9; + if ( strcmp( start, "<![CDATA[" ) == 0 ) { + assert( !closingTag ); + break; + } + } + + if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) ) + { + firstCharFound = true; + if ( c == '/' ) + closingTag = true; + } + } + // If it was a closing tag, then read in the closing '>' to clean up the input stream. + // If it was not, the streaming will be done by the tag. + if ( closingTag ) + { + if ( !in->good() ) + return; + + int c = in->get(); + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; } + assert( c == '>' ); + *tag += (char) c; + + // We are done, once we've found our closing tag. + return; + } + else + { + // If not a closing tag, id it, and stream. + const char* tagloc = tag->c_str() + tagIndex; + TiXmlNode* node = Identify( tagloc, TIXML_DEFAULT_ENCODING ); + if ( !node ) + return; + node->StreamIn( in, tag ); + delete node; + node = 0; + + // No return: go around from the beginning: text, closing tag, or node. + } } + } } #endif @@ -1060,22 +1060,22 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc TiXmlDocument* document = GetDocument(); if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding ); + return 0; + } if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } if ( *p != '<' ) - { - if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding ); + return 0; + } p = SkipWhiteSpace( p+1, encoding ); @@ -1084,10 +1084,10 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc p = ReadName( p, &value, encoding ); if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding ); + return 0; + } TIXML_STRING endTag ("</"); endTag += value; @@ -1096,84 +1096,84 @@ const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc // Check for and read attributes. Also look for an empty // tag or an end tag. while ( p && *p ) + { + pErr = p; + p = SkipWhiteSpace( p, encoding ); + if ( !p || !*p ) { - pErr = p; - p = SkipWhiteSpace( p, encoding ); + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); + return 0; + } + if ( *p == '/' ) + { + ++p; + // Empty tag. + if ( *p != '>' ) + { + if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding ); + return 0; + } + return (p+1); + } + else if ( *p == '>' ) + { + // Done with attributes (if there were any.) + // Read the value -- which can include other + // elements -- read the end tag, and return. + ++p; + p = ReadValue( p, data, encoding ); // Note this is an Element method, and will set the error if one happens. if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - return 0; - } - if ( *p == '/' ) - { - ++p; - // Empty tag. - if ( *p != '>' ) - { - if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding ); - return 0; - } - return (p+1); - } - else if ( *p == '>' ) - { - // Done with attributes (if there were any.) - // Read the value -- which can include other - // elements -- read the end tag, and return. - ++p; - p = ReadValue( p, data, encoding ); // Note this is an Element method, and will set the error if one happens. - if ( !p || !*p ) - return 0; - - // We should find the end tag now - if ( StringEqual( p, endTag.c_str(), false, encoding ) ) - { - p += endTag.length(); - return p; - } - else - { - if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding ); - return 0; - } - } + return 0; + + // We should find the end tag now + if ( StringEqual( p, endTag.c_str(), false, encoding ) ) + { + p += endTag.length(); + return p; + } else - { - // Try to read an attribute: - TiXmlAttribute* attrib = new TiXmlAttribute(); - if ( !attrib ) - { - if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding ); - return 0; - } - - attrib->SetDocument( document ); - pErr = p; - p = attrib->Parse( p, data, encoding ); - - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding ); - delete attrib; - return 0; - } - - // Handle the strange case of double attributes: + { + if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding ); + return 0; + } + } + else + { + // Try to read an attribute: + TiXmlAttribute* attrib = new TiXmlAttribute(); + if ( !attrib ) + { + if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding ); + return 0; + } + + attrib->SetDocument( document ); + pErr = p; + p = attrib->Parse( p, data, encoding ); + + if ( !p || !*p ) + { + if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding ); + delete attrib; + return 0; + } + + // Handle the strange case of double attributes: #ifdef TIXML_USE_STL - TiXmlAttribute* node = attributeSet.Find( attrib->NameTStr() ); + TiXmlAttribute* node = attributeSet.Find( attrib->NameTStr() ); #else - TiXmlAttribute* node = attributeSet.Find( attrib->Name() ); + TiXmlAttribute* node = attributeSet.Find( attrib->Name() ); #endif - if ( node ) - { - node->SetValue( attrib->Value() ); - delete attrib; - return 0; - } - - attributeSet.Add( attrib ); - } + if ( node ) + { + node->SetValue( attrib->Value() ); + delete attrib; + return 0; + } + + attributeSet.Add( attrib ); } + } return p; } @@ -1187,65 +1187,65 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm p = SkipWhiteSpace( p, encoding ); while ( p && *p ) + { + if ( *p != '<' ) + { + // Take what we have, make a text element. + TiXmlText* textNode = new TiXmlText( "" ); + + if ( !textNode ) + { + if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding ); + return 0; + } + + if ( TiXmlBase::IsWhiteSpaceCondensed() ) + { + p = textNode->Parse( p, data, encoding ); + } + else + { + // Special case: we want to keep the white space + // so that leading spaces aren't removed. + p = textNode->Parse( pWithWhiteSpace, data, encoding ); + } + + if ( !textNode->Blank() ) + LinkEndChild( textNode ); + else + delete textNode; + } + else { - if ( *p != '<' ) + // We hit a '<' + // Have we hit a new element or an end tag? This could also be + // a TiXmlText in the "CDATA" style. + if ( StringEqual( p, "</", false, encoding ) ) + { + return p; + } + else + { + TiXmlNode* node = Identify( p, encoding ); + if ( node ) { - // Take what we have, make a text element. - TiXmlText* textNode = new TiXmlText( "" ); - - if ( !textNode ) - { - if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding ); - return 0; - } - - if ( TiXmlBase::IsWhiteSpaceCondensed() ) - { - p = textNode->Parse( p, data, encoding ); - } - else - { - // Special case: we want to keep the white space - // so that leading spaces aren't removed. - p = textNode->Parse( pWithWhiteSpace, data, encoding ); - } - - if ( !textNode->Blank() ) - LinkEndChild( textNode ); - else - delete textNode; + p = node->Parse( p, data, encoding ); + LinkEndChild( node ); } - else + else { - // We hit a '<' - // Have we hit a new element or an end tag? This could also be - // a TiXmlText in the "CDATA" style. - if ( StringEqual( p, "</", false, encoding ) ) - { - return p; - } - else - { - TiXmlNode* node = Identify( p, encoding ); - if ( node ) - { - p = node->Parse( p, data, encoding ); - LinkEndChild( node ); - } - else - { - return 0; - } - } + return 0; } - pWithWhiteSpace = p; - p = SkipWhiteSpace( p, encoding ); + } } + pWithWhiteSpace = p; + p = SkipWhiteSpace( p, encoding ); + } if ( !p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding ); - } + { + if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding ); + } return p; } @@ -1254,23 +1254,23 @@ const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXm void TiXmlUnknown::StreamIn( std::istream * in, TIXML_STRING * tag ) { while ( in->good() ) + { + int c = in->get(); + if ( c <= 0 ) { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + (*tag) += (char) c; - if ( c == '>' ) - { - // All is well. - return; - } + if ( c == '>' ) + { + // All is well. + return; } + } } #endif @@ -1281,28 +1281,28 @@ const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc p = SkipWhiteSpace( p, encoding ); if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } if ( !p || !*p || *p != '<' ) - { - if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding ); + return 0; + } ++p; value = ""; while ( p && *p && *p != '>' ) - { - value += *p; - ++p; - } + { + value += *p; + ++p; + } if ( !p ) - { - if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding ); - } + { + if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding ); + } if ( *p == '>' ) return p+1; return p; @@ -1312,26 +1312,26 @@ const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag ) { while ( in->good() ) + { + int c = in->get(); + if ( c <= 0 ) { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } - (*tag) += (char) c; + (*tag) += (char) c; - if ( c == '>' - && tag->at( tag->length() - 2 ) == '-' - && tag->at( tag->length() - 3 ) == '-' ) - { - // All is well. - return; - } + if ( c == '>' + && tag->at( tag->length() - 2 ) == '-' + && tag->at( tag->length() - 3 ) == '-' ) + { + // All is well. + return; } + } } #endif @@ -1344,18 +1344,18 @@ const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEnc p = SkipWhiteSpace( p, encoding ); if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } const char* startTag = "<!--"; const char* endTag = "-->"; if ( !StringEqual( p, startTag, false, encoding ) ) - { - document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); - return 0; - } + { + document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); + return 0; + } p += strlen( startTag ); p = ReadText( p, &value, false, endTag, false, encoding ); return p; @@ -1372,70 +1372,70 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE // tabsize = document->TabSize(); if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } // Read the name, the '=' and the value. const char* pErr = p; p = ReadName( p, &name, encoding ); if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); + return 0; + } p = SkipWhiteSpace( p, encoding ); if ( !p || !*p || *p != '=' ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } ++p; // skip '=' p = SkipWhiteSpace( p, encoding ); if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } const char* end; const char SINGLE_QUOTE = '\''; const char DOUBLE_QUOTE = '\"'; if ( *p == SINGLE_QUOTE ) - { - ++p; - end = "\'"; // single quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } + { + ++p; + end = "\'"; // single quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } else if ( *p == DOUBLE_QUOTE ) - { - ++p; - end = "\""; // double quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } + { + ++p; + end = "\""; // double quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } else - { - // All attribute values should be in single or double quotes. - // But this is such a common error that the parser will try - // its best, even without them. - value = ""; - while ( p && *p // existence - && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace - && *p != '/' && *p != '>' ) // tag end - { - if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { - // [ 1451649 ] Attribute values with trailing quotes not handled correctly - // We did not have an opening quote but seem to have a - // closing one. Give up and throw an error. - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - value += *p; - ++p; - } + { + // All attribute values should be in single or double quotes. + // But this is such a common error that the parser will try + // its best, even without them. + value = ""; + while ( p && *p // existence + && !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r' // whitespace + && *p != '/' && *p != '>' ) // tag end + { + if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { + // [ 1451649 ] Attribute values with trailing quotes not handled correctly + // We did not have an opening quote but seem to have a + // closing one. Give up and throw an error. + if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + return 0; + } + value += *p; + ++p; } + } return p; } @@ -1443,31 +1443,31 @@ const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlE void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) { while ( in->good() ) + { + int c = in->peek(); + if ( !cdata && (c == '<' ) ) { - int c = in->peek(); - if ( !cdata && (c == '<' ) ) - { - return; - } - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } + return; + } + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } - (*tag) += (char) c; - in->get(); // "commits" the peek made above + (*tag) += (char) c; + in->get(); // "commits" the peek made above - if ( cdata && c == '>' && tag->size() >= 3 ) { - size_t len = tag->size(); - if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { - // terminator of cdata. - return; - } + if ( cdata && c == '>' && tag->size() >= 3 ) { + size_t len = tag->size(); + if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { + // terminator of cdata. + return; } } + } } #endif @@ -1477,71 +1477,71 @@ const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncodi TiXmlDocument* document = GetDocument(); if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } const char* const startTag = "<![CDATA["; const char* const endTag = "]]>"; if ( cdata || StringEqual( p, startTag, false, encoding ) ) - { - cdata = true; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); - return 0; - } - p += strlen( startTag ); + { + cdata = true; - // Keep all the white space, ignore the encoding, etc. - while ( p && *p - && !StringEqual( p, endTag, false, encoding ) - ) - { - value += *p; - ++p; - } + if ( !StringEqual( p, startTag, false, encoding ) ) + { + document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); + return 0; + } + p += strlen( startTag ); - TIXML_STRING dummy; - p = ReadText( p, &dummy, false, endTag, false, encoding ); - return p; + // Keep all the white space, ignore the encoding, etc. + while ( p && *p + && !StringEqual( p, endTag, false, encoding ) + ) + { + value += *p; + ++p; } + + TIXML_STRING dummy; + p = ReadText( p, &dummy, false, endTag, false, encoding ); + return p; + } else - { - bool ignoreWhite = true; + { + bool ignoreWhite = true; - const char* end = "<"; - p = ReadText( p, &value, ignoreWhite, end, false, encoding ); - if ( p ) - return p-1; // don't truncate the '<' - return 0; - } + const char* end = "<"; + p = ReadText( p, &value, ignoreWhite, end, false, encoding ); + if ( p ) + return p-1; // don't truncate the '<' + return 0; + } } #ifdef TIXML_USE_STL void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) { while ( in->good() ) + { + int c = in->get(); + if ( c <= 0 ) { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; + TiXmlDocument* document = GetDocument(); + if ( document ) + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + (*tag) += (char) c; - if ( c == '>' ) - { - // All is well. - return; - } + if ( c == '>' ) + { + // All is well. + return; } + } } #endif @@ -1552,15 +1552,15 @@ const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXm // the stuff in-between. TiXmlDocument* document = GetDocument(); if ( !p || !*p || !StringEqual( p, "<?xml", true, _encoding ) ) - { - if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - return 0; - } + { + if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); + return 0; + } if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } + { + data->Stamp( p, _encoding ); + location = data->Cursor(); + } p += 5; version = ""; @@ -1568,39 +1568,39 @@ const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXm standalone = ""; while ( p && *p ) + { + if ( *p == '>' ) { - if ( *p == '>' ) - { - ++p; - return p; - } + ++p; + return p; + } - p = SkipWhiteSpace( p, _encoding ); - if ( StringEqual( p, "version", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - version = attrib.Value(); - } - else if ( StringEqual( p, "encoding", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - encoding = attrib.Value(); - } - else if ( StringEqual( p, "standalone", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - standalone = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - ++p; - } + p = SkipWhiteSpace( p, _encoding ); + if ( StringEqual( p, "version", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + version = attrib.Value(); + } + else if ( StringEqual( p, "encoding", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + encoding = attrib.Value(); } + else if ( StringEqual( p, "standalone", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + standalone = attrib.Value(); + } + else + { + // Read over whatever it is. + while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) + ++p; + } + } return 0; } diff --git a/DDCore/src/parsers/Grammars.h b/DDCore/src/parsers/Grammars.h index b67a7d21351dad70c4211d6545177726305e933d..ef8e0a8af76b944ae021ea07df2112f2291d6283 100644 --- a/DDCore/src/parsers/Grammars.h +++ b/DDCore/src/parsers/Grammars.h @@ -1,4 +1,15 @@ -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== + #ifndef DD4HEPKERNEL_GRAMMARS_H #define DD4HEPKERNEL_GRAMMARS_H 1 #ifdef __GNUC__ @@ -60,11 +71,11 @@ namespace DD4hep * @date 2006-05-14 */ template <typename T> - struct ClosureGrammar : public boost::spirit::closure < ClosureGrammar<T>,T > - { - typedef boost::spirit::closure<ClosureGrammar, T> closure; - typename closure::member1 val; - }; + struct ClosureGrammar : public boost::spirit::closure < ClosureGrammar<T>,T > + { + typedef boost::spirit::closure<ClosureGrammar, T> closure; + typename closure::member1 val; + }; // ======================================================================== /** @struct AttributesClosureGrammar * @@ -77,13 +88,13 @@ namespace DD4hep * @date 2006-05-14 */ template <typename T1,typename T2> - struct AttributesClosureGrammar + struct AttributesClosureGrammar : public boost::spirit::closure<AttributesClosureGrammar<T1,T2>,T1,T2> - { - typedef boost::spirit::closure<AttributesClosureGrammar, T1,T2> closure; - typename closure::member1 val; - typename closure::member2 attrs; - }; + { + typedef boost::spirit::closure<AttributesClosureGrammar, T1,T2> closure; + typename closure::member1 val; + typename closure::member2 attrs; + }; // ======================================================================== /** @class BoolGrammar * @@ -97,31 +108,31 @@ namespace DD4hep * @date 2006-05-14 */ class BoolGrammar : public grammar - < + < BoolGrammar, ClosureGrammar<bool>::context_t > + { + public: + typedef bool ResultT; + public: + template <typename ScannerT> + struct definition + { + definition( BoolGrammar const &self) { - public: - typedef bool ResultT; - public: - template <typename ScannerT> - struct definition - { - definition( BoolGrammar const &self) - { - boolean_literal - = true_literal[self.val = true] | false_literal[self.val = false]; - true_literal - = str_p("true" ) | str_p("True" ) | str_p("TRUE" ) | str_p("1"); - false_literal - = str_p("false") | str_p("False") | str_p("FALSE") | str_p("0"); - } - rule<ScannerT> const& start() const - { return boolean_literal;} - rule<ScannerT> boolean_literal,true_literal,false_literal; - }; - }; + boolean_literal + = true_literal[self.val = true] | false_literal[self.val = false]; + true_literal + = str_p("true" ) | str_p("True" ) | str_p("TRUE" ) | str_p("1"); + false_literal + = str_p("false") | str_p("False") | str_p("FALSE") | str_p("0"); + } + rule<ScannerT> const& start() const + { return boolean_literal;} + rule<ScannerT> boolean_literal,true_literal,false_literal; + }; + }; // ======================================================================== /** @class CharGrammar * @@ -134,14 +145,14 @@ namespace DD4hep * @date 2006-05-14 */ template<typename RT=char> - class CharGrammar : public grammar - < + class CharGrammar : public grammar + < CharGrammar<RT> , typename ClosureGrammar<RT>::context_t > - { - public: + { + public: typedef RT ResultT; - public: + public: template <typename ScannerT> struct definition { @@ -157,7 +168,7 @@ namespace DD4hep { return char_literal; } rule<ScannerT> char_literal; }; - }; + }; // ======================================================================== /** @class IntGrammar * @@ -171,15 +182,15 @@ namespace DD4hep * @date 2006-05-14 */ template<typename RT=int> - class IntGrammar : public grammar - < + class IntGrammar : public grammar + < IntGrammar<RT>, typename ClosureGrammar<RT>::context_t > - { - public: + { + public: typedef RT ResultT; - public: + public: template <typename ScannerT> struct definition { @@ -191,7 +202,7 @@ namespace DD4hep rule<ScannerT> const& start() const { return int_literal; } rule<ScannerT> int_literal; }; - }; + }; // ======================================================================== /** @class RealGrammar * @@ -205,14 +216,14 @@ namespace DD4hep * @date 2006-05-14 */ template<typename RT=double> - class RealGrammar : public grammar - < + class RealGrammar : public grammar + < RealGrammar<RT>,typename ClosureGrammar<RT>::context_t > - { - public: + { + public: typedef RT ResultT; - public: + public: template <typename ScannerT> struct definition { @@ -227,7 +238,7 @@ namespace DD4hep { return real_literal; } rule<ScannerT> real_literal; }; - }; + }; // ======================================================================== /** @class StringGrammar * @@ -244,52 +255,52 @@ namespace DD4hep */ class StringGrammar : public grammar - < + < StringGrammar, ClosureGrammar<std::string>::context_t > + { + public: + typedef std::string ResultT; + /** remove CR/LF symbols form the parsed strings + * @attention it is a bit dangerous operation + * The operation allows to write "very long" input strings + * for opts-files (it is actual e.g. for DataOnDemandSvc configuration) + * by splitting the strings into few lines + * All new-line symbols (as well as '\n', '\t', CR/LF etc + * are substituted by ordinary blanks. + */ + void matchString() const { - public: - typedef std::string ResultT; - /** remove CR/LF symbols form the parsed strings - * @attention it is a bit dangerous operation - * The operation allows to write "very long" input strings - * for opts-files (it is actual e.g. for DataOnDemandSvc configuration) - * by splitting the strings into few lines - * All new-line symbols (as well as '\n', '\t', CR/LF etc - * are substituted by ordinary blanks. - */ - void matchString() const + for ( std::string::iterator cur=this->val().begin(); + cur!=this->val().end();cur++) + { if(std::isspace(*cur) ) { *cur = ' '; } } + } + public: + template <typename ScannerT> + struct definition + { + definition( StringGrammar const &self ) { - for ( std::string::iterator cur=this->val().begin(); - cur!=this->val().end();cur++) - { if(std::isspace(*cur) ) { *cur = ' '; } } + string_literal = (lexeme_d + [ + ('"' >> (*( str_p("\\\"") + | + (anychar_p-'"') )) + [self.val = construct_<std::string> + (arg1,arg2)] >> + '"') + | + ('\'' >> (*( str_p("\\'") + | + (anychar_p-'\'') )) + [self.val = construct_<std::string> + (arg1,arg2)]>> + '\'')])[boost::bind(&StringGrammar::matchString,&self)]; } - public: - template <typename ScannerT> - struct definition - { - definition( StringGrammar const &self ) - { - string_literal = (lexeme_d - [ - ('"' >> (*( str_p("\\\"") - | - (anychar_p-'"') )) - [self.val = construct_<std::string> - (arg1,arg2)] >> - '"') - | - ('\'' >> (*( str_p("\\'") - | - (anychar_p-'\'') )) - [self.val = construct_<std::string> - (arg1,arg2)]>> - '\'')])[boost::bind(&StringGrammar::matchString,&self)]; - } - rule<ScannerT> const& start() const { return string_literal; } - rule<ScannerT> string_literal; - }; + rule<ScannerT> const& start() const { return string_literal; } + rule<ScannerT> string_literal; }; + }; // ======================================================================== /** @class SkipperGrammar * @@ -316,30 +327,30 @@ namespace DD4hep bool skipnewline() const{return m_skipnewline;} public: template <typename ScannerT> - struct definition + struct definition + { + definition( SkipperGrammar const& self) { - definition( SkipperGrammar const& self) + if ( self.skipnewline() ) { - if ( self.skipnewline() ) - { - skip - = space_p - | comment_p("//") // C++ comment - | comment_p("/*", "*/") // C comment - ; - } - else - { - skip - = (space_p-eol_p) - | comment_p("//") // C++ comment - | comment_p("/*", "*/") // C comment - ; - } + skip + = space_p + | comment_p("//") // C++ comment + | comment_p("/*", "*/") // C comment + ; } - rule<ScannerT> skip; - rule<ScannerT> const& start() const { return skip; } - }; + else + { + skip + = (space_p-eol_p) + | comment_p("//") // C++ comment + | comment_p("/*", "*/") // C comment + ; + } + } + rule<ScannerT> skip; + rule<ScannerT> const& start() const { return skip; } + }; private: bool m_skipnewline; }; @@ -355,59 +366,59 @@ namespace DD4hep * @date 2006-05-14 */ template <typename KeyGrammarT, typename ValueGrammarT> - class PairGrammar : public grammar - < + class PairGrammar : public grammar + < PairGrammar<KeyGrammarT,ValueGrammarT>, typename ClosureGrammar< - std::pair<typename KeyGrammarT::ResultT, - typename ValueGrammarT::ResultT> >::context_t + std::pair<typename KeyGrammarT::ResultT, + typename ValueGrammarT::ResultT> >::context_t > + { + public: + typedef typename KeyGrammarT::ResultT KeyT; + typedef typename ValueGrammarT::ResultT ValueT; + typedef std::pair<KeyT,ValueT> ResultT; + public: + /** Constructor + * @param delim Delimiter for pair values + */ + PairGrammar ( const std::string& delim = "," ) + : m_delim(delim) {} + public: + /// callback. Action when we match first value + void matchFirst ( const KeyT& first ) const { this->val().first = first; } + /// callback. Action when we match second value + void matchSecond ( const ValueT& second ) const { this->val().second = second; } + public: + template <typename ScannerT> + struct definition + { + definition( PairGrammar const &self) { - public: - typedef typename KeyGrammarT::ResultT KeyT; - typedef typename ValueGrammarT::ResultT ValueT; - typedef std::pair<KeyT,ValueT> ResultT; - public: - /** Constructor - * @param delim Delimiter for pair values - */ - PairGrammar ( const std::string& delim = "," ) - : m_delim(delim) {} - public: - /// callback. Action when we match first value - void matchFirst ( const KeyT& first ) const { this->val().first = first; } - /// callback. Action when we match second value - void matchSecond ( const ValueT& second ) const { this->val().second = second; } - public: - template <typename ScannerT> - struct definition - { - definition( PairGrammar const &self) - { - para - = ( - str_p("(") - >> (grkey[boost::bind(&PairGrammar::matchFirst,&self,_1)]) - >> self.delim().c_str() - >> (grvalue[boost::bind(&PairGrammar::matchSecond,&self,_1)]) - >> str_p(")") - ) ; - } - rule<ScannerT> const& start() const { return para; } - rule<ScannerT> para; - KeyGrammarT grkey; - ValueGrammarT grvalue; - }; - public: - /// @return Delimiter for pair values - const std::string& delim() const { return m_delim ; } - /** Set delimiters for pair values - * @param delim Delimiter - */ - void setDelim ( const std::string& delim ) { m_delim = delim;} - private: - std::string m_delim; - }; + para + = ( + str_p("(") + >> (grkey[boost::bind(&PairGrammar::matchFirst,&self,_1)]) + >> self.delim().c_str() + >> (grvalue[boost::bind(&PairGrammar::matchSecond,&self,_1)]) + >> str_p(")") + ) ; + } + rule<ScannerT> const& start() const { return para; } + rule<ScannerT> para; + KeyGrammarT grkey; + ValueGrammarT grvalue; + }; + public: + /// @return Delimiter for pair values + const std::string& delim() const { return m_delim ; } + /** Set delimiters for pair values + * @param delim Delimiter + */ + void setDelim ( const std::string& delim ) { m_delim = delim;} + private: + std::string m_delim; + }; // ======================================================================== /** @class VectorGrammar * @@ -421,38 +432,38 @@ namespace DD4hep * @date 2006-05-14 */ template <typename GrammarT> - class VectorGrammar : public grammar - < + class VectorGrammar : public grammar + < VectorGrammar<GrammarT> , typename ClosureGrammar<std::vector<typename GrammarT::ResultT> >::context_t > + { + public: + typedef typename GrammarT::ResultT ValueT; + typedef std::vector<ValueT> ResultT; + typedef VectorGrammar<GrammarT> SelfT; + public: + /// callback. Action when we match inner value + void matchItem(const ValueT& value) const { this->val().push_back(value); } + public: + template <typename ScannerT> + struct definition { - public: - typedef typename GrammarT::ResultT ValueT; - typedef std::vector<ValueT> ResultT; - typedef VectorGrammar<GrammarT> SelfT; - public: - /// callback. Action when we match inner value - void matchItem(const ValueT& value) const { this->val().push_back(value); } - public: - template <typename ScannerT> - struct definition - { - definition(SelfT const &self) - { - inner = - !(gr[boost::bind(&VectorGrammar::matchItem,&self,_1)] - >> *(','>>gr[boost::bind(&VectorGrammar::matchItem,&self,_1)])); - vec = - '[' >> inner >> ']' | // a'la python list - '(' >> inner >> ')' | // a'la python tuple - '{' >> inner >> '}' ; // like obsolete list from opts-grammar - } - rule<ScannerT> const& start() const { return vec; } - rule<ScannerT> vec,inner; - GrammarT gr; - }; + definition(SelfT const &self) + { + inner = + !(gr[boost::bind(&VectorGrammar::matchItem,&self,_1)] + >> *(','>>gr[boost::bind(&VectorGrammar::matchItem,&self,_1)])); + vec = + '[' >> inner >> ']' | // a'la python list + '(' >> inner >> ')' | // a'la python tuple + '{' >> inner >> '}' ; // like obsolete list from opts-grammar + } + rule<ScannerT> const& start() const { return vec; } + rule<ScannerT> vec,inner; + GrammarT gr; }; + }; // ======================================================================== /** @class MapGrammar * @@ -469,57 +480,57 @@ namespace DD4hep * @date 2006-05-14 */ template <typename KeyGrammarT, typename ValueGrammarT> - class MapGrammar : public grammar - < + class MapGrammar : public grammar + < MapGrammar<KeyGrammarT,ValueGrammarT>, typename AttributesClosureGrammar < std::map<typename KeyGrammarT::ResultT, - typename ValueGrammarT::ResultT>, - std::pair<typename KeyGrammarT::ResultT, - typename ValueGrammarT::ResultT> >::context_t + typename ValueGrammarT::ResultT>, + std::pair<typename KeyGrammarT::ResultT, + typename ValueGrammarT::ResultT> >::context_t > + { + public: + typedef typename KeyGrammarT::ResultT KeyT; + typedef typename ValueGrammarT::ResultT ValueT; + typedef std::map<KeyT,ValueT> ResultT; + public: + /// call backs. Action when we match pair in map + void matchItem () const + { + //this->val().insert(this->attrs()); + this->val()[this->attrs().first] = this->attrs().second ; + } + /// call backs. Action when we match key of pair + void matchFirst ( const KeyT& value ) const { this->attrs().first = value ; } + /// call backs. Action when we match value pf pair + void matchSecond( const ValueT& value ) const { this->attrs().second = value ; } + public: + template <typename ScannerT> + struct definition + { + definition( MapGrammar const &self) { - public: - typedef typename KeyGrammarT::ResultT KeyT; - typedef typename ValueGrammarT::ResultT ValueT; - typedef std::map<KeyT,ValueT> ResultT; - public: - /// call backs. Action when we match pair in map - void matchItem () const - { - //this->val().insert(this->attrs()); - this->val()[this->attrs().first] = this->attrs().second ; - } - /// call backs. Action when we match key of pair - void matchFirst ( const KeyT& value ) const { this->attrs().first = value ; } - /// call backs. Action when we match value pf pair - void matchSecond( const ValueT& value ) const { this->attrs().second = value ; } - public: - template <typename ScannerT> - struct definition - { - definition( MapGrammar const &self) - { - vec - = ('{'>> inner_list >> '}') | ('['>>inner_list>>']'); - inner_list - = - !( inner[boost::bind(&MapGrammar::matchItem,&self)] - >> *( ch_p(',') >> - inner[boost::bind(&MapGrammar::matchItem,&self)] ) - ); - inner - = - grKey[boost ::bind(&MapGrammar::matchFirst,&self,_1)] - >> ( ch_p('=') | ch_p(':')) - >> grValue[boost::bind(&MapGrammar::matchSecond,&self,_1)] ; - } - KeyGrammarT grKey; - ValueGrammarT grValue; - rule<ScannerT> const& start() const { return vec; } - rule<ScannerT> vec,inner, inner_list ; - }; - }; + vec + = ('{'>> inner_list >> '}') | ('['>>inner_list>>']'); + inner_list + = + !( inner[boost::bind(&MapGrammar::matchItem,&self)] + >> *( ch_p(',') >> + inner[boost::bind(&MapGrammar::matchItem,&self)] ) + ); + inner + = + grKey[boost ::bind(&MapGrammar::matchFirst,&self,_1)] + >> ( ch_p('=') | ch_p(':')) + >> grValue[boost::bind(&MapGrammar::matchSecond,&self,_1)] ; + } + KeyGrammarT grKey; + ValueGrammarT grValue; + rule<ScannerT> const& start() const { return vec; } + rule<ScannerT> vec,inner, inner_list ; + }; + }; // ======================================================================== } // end of namespace Dd4hep::Parsers } // end of namespace Dd4hep diff --git a/DDCore/src/parsers/GrammarsV2.h b/DDCore/src/parsers/GrammarsV2.h index 45b5e9100c22659cd0d76094f020f55cb178e2b9..a7fcc6c1e1ddc9c6f7abf81ad3715b808a580511 100644 --- a/DDCore/src/parsers/GrammarsV2.h +++ b/DDCore/src/parsers/GrammarsV2.h @@ -1,4 +1,16 @@ -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEPKERNEL_GRAMMARSV2_H #define DD4HEPKERNEL_GRAMMARSV2_H 1 #ifdef __GNUC__ @@ -53,61 +65,61 @@ namespace DD4hep { namespace Parsers { typedef enc::space_type DefaultSkipper; //============================================================================== template <typename Iterator, typename T, typename Skipper, class Enable=void> - struct Grammar_ { - /* READ THIS IF YOUR COMPILE BREAKS ON THE FOLLOWING LINE - * - * To users: You have to ask developers to implement parser for your type T - * To developer: You have to implement and register Grammar for type T - * - */ - BOOST_MPL_ASSERT_MSG(false, GRAMMAR_FOR_TYPE_DOES_NOT_EXISTS, (T)); - }; + struct Grammar_ { + /* READ THIS IF YOUR COMPILE BREAKS ON THE FOLLOWING LINE + * + * To users: You have to ask developers to implement parser for your type T + * To developer: You have to implement and register Grammar for type T + * + */ + BOOST_MPL_ASSERT_MSG(false, GRAMMAR_FOR_TYPE_DOES_NOT_EXISTS, (T)); + }; -#define REGISTER_GRAMMAR(ResultType, GrammarName) \ - template <typename Iterator, typename Skipper> \ - struct Grammar_<Iterator, ResultType, Skipper> \ - { \ - typedef GrammarName<Iterator, Skipper> Grammar; \ - } +#define REGISTER_GRAMMAR(ResultType, GrammarName) \ + template <typename Iterator, typename Skipper> \ + struct Grammar_<Iterator, ResultType, Skipper> \ + { \ + typedef GrammarName<Iterator, Skipper> Grammar; \ + } //============================================================================== template< typename Iterator> struct SkipperGrammar : qi::grammar<Iterator> - { + { SkipperGrammar() : SkipperGrammar::base_type(comments) { - comments = enc::space | rep::confix("/*", "*/")[*(qi::char_ - "*/")] - | - rep::confix("//", (sp::eol | sp::eoi))[*(qi::char_ - (sp::eol|sp::eoi))]; - } - qi::rule<Iterator> comments; - }; + comments = enc::space | rep::confix("/*", "*/")[*(qi::char_ - "*/")] + | + rep::confix("//", (sp::eol | sp::eoi))[*(qi::char_ - (sp::eol|sp::eoi))]; + } + qi::rule<Iterator> comments; + }; //============================================================================== template< typename Iterator, typename Skipper> - struct StringGrammar : qi::grammar<Iterator, std::string(), qi::locals<char>,Skipper> - { - //------------------------------------------------------------------------------ - typedef std::string ResultT; - //------------------------------------------------------------------------------ + struct StringGrammar : qi::grammar<Iterator, std::string(), qi::locals<char>,Skipper> + { + //------------------------------------------------------------------------------ + typedef std::string ResultT; + //------------------------------------------------------------------------------ StringGrammar() : StringGrammar::base_type( str ) { - begin_quote = enc::char_("\"'"); - quote = enc::char_(qi::_r1); + begin_quote = enc::char_("\"'"); + quote = enc::char_(qi::_r1); - str = qi::lexeme[begin_quote[qi::_a = qi::_1] - > *( (enc::char_('\\') >> quote(qi::_a))[qi::_val += qi::_a] - | (enc::char_[qi::_val += qi::_1] - quote(qi::_a))) > - quote(qi::_a)] - ; - } - //------------------------------------------------------------------------------ - qi::rule<Iterator, std::string(), qi::locals<char>, Skipper> str; - qi::rule<Iterator, char()> begin_quote; - qi::rule<Iterator, void(char)> quote; - //------------------------------------------------------------------------------ - }; + str = qi::lexeme[begin_quote[qi::_a = qi::_1] + > *( (enc::char_('\\') >> quote(qi::_a))[qi::_val += qi::_a] + | (enc::char_[qi::_val += qi::_1] - quote(qi::_a))) > + quote(qi::_a)] + ; + } + //------------------------------------------------------------------------------ + qi::rule<Iterator, std::string(), qi::locals<char>, Skipper> str; + qi::rule<Iterator, char()> begin_quote; + qi::rule<Iterator, void(char)> quote; + //------------------------------------------------------------------------------ + }; REGISTER_GRAMMAR(std::string, StringGrammar); //============================================================================== template< typename Iterator, typename Skipper> - struct CharGrammar : qi::grammar<Iterator, char(), Skipper> { + struct CharGrammar : qi::grammar<Iterator, char(), Skipper> { typedef char ResultT; - CharGrammar() : CharGrammar::base_type( ch ) { + CharGrammar() : CharGrammar::base_type( ch ) { ch = qi::int_parser<char>() | '\'' >> (qi::char_-'\'') >> '\''; @@ -117,23 +129,23 @@ namespace DD4hep { namespace Parsers { REGISTER_GRAMMAR(char, CharGrammar); //============================================================================== template< typename Iterator, typename Skipper> - struct BoolGrammar : qi::grammar<Iterator, bool(), Skipper> - { - typedef bool ResultT; + struct BoolGrammar : qi::grammar<Iterator, bool(), Skipper> + { + typedef bool ResultT; BoolGrammar() : BoolGrammar::base_type( boolean_literal ) { - boolean_literal = - (qi::lit("true") | "True" | "TRUE" | "1")[qi::_val=true] - | - (qi::lit("false") | "False" | "FALSE" | "0")[qi::_val=false]; - } - qi::rule<Iterator, bool(), Skipper> boolean_literal; - }; + boolean_literal = + (qi::lit("true") | "True" | "TRUE" | "1")[qi::_val=true] + | + (qi::lit("false") | "False" | "FALSE" | "0")[qi::_val=false]; + } + qi::rule<Iterator, bool(), Skipper> boolean_literal; + }; REGISTER_GRAMMAR(bool, BoolGrammar); //============================================================================== template< typename Iterator, typename RT , typename Skipper> - struct IntGrammar : qi::grammar<Iterator, RT(), Skipper> { + struct IntGrammar : qi::grammar<Iterator, RT(), Skipper> { typedef RT ResultT; - IntGrammar() : IntGrammar::base_type( integer ) { + IntGrammar() : IntGrammar::base_type( integer ) { integer = qi::int_parser<RT>()[qi::_val = qi::_1] >> -qi::no_case[qi::char_('L')]; } @@ -143,16 +155,16 @@ namespace DD4hep { namespace Parsers { // Register IntGrammar: // ---------------------------------------------------------------------------- template <typename Iterator, typename T, typename Skipper> - struct Grammar_<Iterator, T, Skipper, - typename boost::enable_if<boost::is_integral<T> >::type> - { - typedef IntGrammar<Iterator, T, Skipper> Grammar; - }; + struct Grammar_<Iterator, T, Skipper, + typename boost::enable_if<boost::is_integral<T> >::type> + { + typedef IntGrammar<Iterator, T, Skipper> Grammar; + }; //============================================================================== template< typename Iterator, typename RT, typename Skipper> - struct RealGrammar : qi::grammar<Iterator, RT(), Skipper> { + struct RealGrammar : qi::grammar<Iterator, RT(), Skipper> { typedef RT ResultT; - RealGrammar() : RealGrammar::base_type(real) { + RealGrammar() : RealGrammar::base_type(real) { real = qi::real_parser<RT>(); } qi::rule<Iterator, RT(), Skipper> real; @@ -161,77 +173,77 @@ namespace DD4hep { namespace Parsers { // Register RealGrammar: // ---------------------------------------------------------------------------- template <typename Iterator, typename T, typename Skipper > - struct Grammar_<Iterator, T, Skipper, - typename boost::enable_if<boost::is_floating_point<T> >::type > { + struct Grammar_<Iterator, T, Skipper, + typename boost::enable_if<boost::is_floating_point<T> >::type > { typedef RealGrammar<Iterator, T, Skipper> Grammar; }; //============================================================================== template< typename Iterator, typename VectorT, typename Skipper> - struct VectorGrammar : qi::grammar<Iterator, VectorT(), qi::locals<char>,Skipper> - { - //------------------------------------------------------------------------------ - typedef VectorT ResultT; - //------------------------------------------------------------------------------ + struct VectorGrammar : qi::grammar<Iterator, VectorT(), qi::locals<char>,Skipper> + { + //------------------------------------------------------------------------------ + typedef VectorT ResultT; + //------------------------------------------------------------------------------ VectorGrammar() : VectorGrammar::base_type(vec) { - begin = enc::char_('[')[qi::_val=']'] | enc::char_('{')[qi::_val='}'] - | enc::char_('(')[qi::_val=')']; - end = enc::char_(qi::_r1); - list = elementGrammar % ','; - vec = begin[qi::_a = qi::_1] >> -list[qi::_val=qi::_1] >> end(qi::_a); - } - // ---------------------------------------------------------------------------- - typename - Grammar_<Iterator, typename VectorT::value_type, Skipper>::Grammar - elementGrammar; - qi::rule<Iterator, char()> begin; - qi::rule<Iterator, void(char)> end; + begin = enc::char_('[')[qi::_val=']'] | enc::char_('{')[qi::_val='}'] + | enc::char_('(')[qi::_val=')']; + end = enc::char_(qi::_r1); + list = elementGrammar % ','; + vec = begin[qi::_a = qi::_1] >> -list[qi::_val=qi::_1] >> end(qi::_a); + } + // ---------------------------------------------------------------------------- + typename + Grammar_<Iterator, typename VectorT::value_type, Skipper>::Grammar + elementGrammar; + qi::rule<Iterator, char()> begin; + qi::rule<Iterator, void(char)> end; - qi::rule<Iterator, ResultT(), qi::locals<char>,Skipper> vec; - qi::rule<Iterator, ResultT(), Skipper> list; - // ---------------------------------------------------------------------------- - }; + qi::rule<Iterator, ResultT(), qi::locals<char>,Skipper> vec; + qi::rule<Iterator, ResultT(), Skipper> list; + // ---------------------------------------------------------------------------- + }; // ---------------------------------------------------------------------------- // Register VectorGrammar for std::vector: // ---------------------------------------------------------------------------- template <typename Iterator,typename InnerT,typename AllocatorT,typename Skipper> - struct Grammar_<Iterator, std::vector<InnerT, AllocatorT>, Skipper > { + struct Grammar_<Iterator, std::vector<InnerT, AllocatorT>, Skipper > { typedef - VectorGrammar<Iterator, std::vector<InnerT, AllocatorT>,Skipper> - Grammar; + VectorGrammar<Iterator, std::vector<InnerT, AllocatorT>,Skipper> + Grammar; }; // ---------------------------------------------------------------------------- // Register VectorGrammar for std::list: // ---------------------------------------------------------------------------- template <typename Iterator, typename InnerT, typename AllocatorT,typename Skipper> - struct Grammar_<Iterator, std::list<InnerT, AllocatorT>, Skipper > { + struct Grammar_<Iterator, std::list<InnerT, AllocatorT>, Skipper > { typedef - VectorGrammar<Iterator, std::list<InnerT, AllocatorT>,Skipper> - Grammar; + VectorGrammar<Iterator, std::list<InnerT, AllocatorT>,Skipper> + Grammar; }; // ---------------------------------------------------------------------------- // Register VectorGrammar for std::set: // ---------------------------------------------------------------------------- template <typename Iterator, typename InnerT, typename CompareT,typename AllocatorT, typename Skipper> - struct Grammar_<Iterator, std::set<InnerT, CompareT, AllocatorT>, Skipper > { + struct Grammar_<Iterator, std::set<InnerT, CompareT, AllocatorT>, Skipper > { typedef - VectorGrammar<Iterator, std::set<InnerT, CompareT, AllocatorT>,Skipper> - Grammar; + VectorGrammar<Iterator, std::set<InnerT, CompareT, AllocatorT>,Skipper> + Grammar; }; //============================================================================== template< typename Iterator, typename PairT, typename Skipper> - struct PairGrammar : - qi::grammar<Iterator,PairT(), qi::locals<char>, Skipper> { + struct PairGrammar : + qi::grammar<Iterator,PairT(), qi::locals<char>, Skipper> { //------------------------------------------------------------------------------ typedef PairT ResultT; typedef typename PairT::first_type first_type; typedef typename PairT::second_type second_type; //------------------------------------------------------------------------------ - PairGrammar() : PairGrammar::base_type(pair) { + PairGrammar() : PairGrammar::base_type(pair) { init(","); } - PairGrammar(const std::string& delimeter) : PairGrammar::base_type(pair) { + PairGrammar(const std::string& delimeter) : PairGrammar::base_type(pair) { init(delimeter); } //------------------------------------------------------------------------------ @@ -247,10 +259,10 @@ namespace DD4hep { namespace Parsers { } // ---------------------------------------------------------------------------- typename - Grammar_<Iterator, typename PairT::first_type, Skipper>::Grammar key; + Grammar_<Iterator, typename PairT::first_type, Skipper>::Grammar key; typename - Grammar_<Iterator, typename PairT::second_type, Skipper>::Grammar - value; + Grammar_<Iterator, typename PairT::second_type, Skipper>::Grammar + value; qi::rule<Iterator, char()> begin; qi::rule<Iterator, void(char)> end; qi::rule<Iterator, ResultT(), qi::locals<char>, Skipper> pair; @@ -262,14 +274,14 @@ namespace DD4hep { namespace Parsers { // Register PairGrammar: // ---------------------------------------------------------------------------- template <typename Iterator, typename KeyT, typename ValueT, - typename Skipper> - struct Grammar_<Iterator, std::pair<KeyT, ValueT>, Skipper > - { - typedef PairGrammar<Iterator, std::pair<KeyT, ValueT>, Skipper> Grammar; - }; + typename Skipper> + struct Grammar_<Iterator, std::pair<KeyT, ValueT>, Skipper > + { + typedef PairGrammar<Iterator, std::pair<KeyT, ValueT>, Skipper> Grammar; + }; // ============================================================================ template< typename Iterator, typename MapT, typename Skipper> - struct MapGrammar : qi::grammar<Iterator,MapT(), Skipper> { + struct MapGrammar : qi::grammar<Iterator,MapT(), Skipper> { //------------------------------------------------------------------------------ typedef MapT ResultT; typedef typename MapT::key_type KeyT; @@ -282,9 +294,9 @@ namespace DD4hep { namespace Parsers { struct tag_mapped{}; struct Operations { template <typename A, typename B = boost::fusion::unused_type, - typename C = boost::fusion::unused_type, - typename D = boost::fusion::unused_type> - struct result { typedef void type; }; + typename C = boost::fusion::unused_type, + typename D = boost::fusion::unused_type> + struct result { typedef void type; }; //---------------------------------------------------------------------- void operator()(ResultT& res, const VectorPairT& vec) const{ for(typename VectorPairT::const_iterator cur = vec.begin(); @@ -301,7 +313,7 @@ namespace DD4hep { namespace Parsers { //---------------------------------------------------------------------- }; //------------------------------------------------------------------------------ - MapGrammar() : MapGrammar::base_type(map) { + MapGrammar() : MapGrammar::base_type(map) { pair = key[op(qi::_val,qi::_1, tag_key())] > (qi::lit(':') | '=') > value[op(qi::_val,qi::_1, tag_mapped())]; list = -(pair % enc::char_(',')); @@ -310,9 +322,9 @@ namespace DD4hep { namespace Parsers { } // ---------------------------------------------------------------------------- typename - Grammar_<Iterator, typename MapT::key_type, Skipper>::Grammar key; + Grammar_<Iterator, typename MapT::key_type, Skipper>::Grammar key; typename - Grammar_<Iterator, typename MapT::mapped_type, Skipper>::Grammar value; + Grammar_<Iterator, typename MapT::mapped_type, Skipper>::Grammar value; qi::rule<Iterator, PairT(), Skipper> pair; qi::rule<Iterator, VectorPairT(), Skipper> list; qi::rule<Iterator, ResultT(), Skipper> map; @@ -323,24 +335,24 @@ namespace DD4hep { namespace Parsers { // Register MapGrammar for std::map: // ---------------------------------------------------------------------------- template <typename Iterator, typename KeyT, typename ValueT, - typename KeyCompareT, typename AllocatorT, typename Skipper> - struct Grammar_<Iterator, std::map<KeyT, ValueT, KeyCompareT, AllocatorT>, - Skipper > { + typename KeyCompareT, typename AllocatorT, typename Skipper> + struct Grammar_<Iterator, std::map<KeyT, ValueT, KeyCompareT, AllocatorT>, + Skipper > { typedef MapGrammar<Iterator, - std::map<KeyT, ValueT, KeyCompareT, AllocatorT>, Skipper> Grammar; + std::map<KeyT, ValueT, KeyCompareT, AllocatorT>, Skipper> Grammar; }; // ============================================================================ template< typename Iterator, typename Skipper> - struct KeyValueGrammar : - qi::grammar<Iterator, std::pair<std::string, std::string>(), Skipper> { + struct KeyValueGrammar : + qi::grammar<Iterator, std::pair<std::string, std::string>(), Skipper> { //------------------------------------------------------------------------------ typedef std::pair<std::string, std::string> ResultT; //------------------------------------------------------------------------------ struct first {}; struct second {}; - KeyValueGrammar() : KeyValueGrammar::base_type(pair) { + KeyValueGrammar() : KeyValueGrammar::base_type(pair) { //------------------------------------------------------------------------------ pair = gstring >> ":" >> +enc::char_; } @@ -354,15 +366,15 @@ namespace DD4hep { namespace Parsers { // ============================================================================ template< typename Iterator, typename PointT, typename Skipper> - struct Pnt3DGrammar : qi::grammar<Iterator, PointT(), Skipper> { + struct Pnt3DGrammar : qi::grammar<Iterator, PointT(), Skipper> { typedef PointT ResultT; typedef std::string Scalar; // ---------------------------------------------------------------------------- struct Operations { template <typename A, typename B = boost::fusion::unused_type, - typename C = boost::fusion::unused_type, - typename D = boost::fusion::unused_type> - struct result { typedef void type; }; + typename C = boost::fusion::unused_type, + typename D = boost::fusion::unused_type> + struct result { typedef void type; }; void operator()(ResultT& res, const Scalar& value,const char xyz) const{ typename PointT::Scalar val = evaluate_string<typename PointT::Scalar>(value); switch(xyz) { @@ -374,7 +386,7 @@ namespace DD4hep { namespace Parsers { } }; // Operations // ---------------------------------------------------------------------------- - Pnt3DGrammar() : Pnt3DGrammar::base_type(point) { + Pnt3DGrammar() : Pnt3DGrammar::base_type(point) { point = list | ('(' >> list >> ')') | ('[' >> list >> ']'); list = -(enc::no_case[qi::lit("x") | qi::lit("px")] >> ':') >> scalar[op(qi::_val,qi::_1,'x')] >> @@ -393,27 +405,27 @@ namespace DD4hep { namespace Parsers { // Register Pnt3DGrammar for ROOT::Math::PositionVector3D: // ---------------------------------------------------------------------------- template <typename Iterator, typename T1, typename T2, typename Skipper> - struct Grammar_<Iterator, ROOT::Math::PositionVector3D<T1,T2>, Skipper>{ + struct Grammar_<Iterator, ROOT::Math::PositionVector3D<T1,T2>, Skipper>{ typedef Pnt3DGrammar<Iterator, ROOT::Math::PositionVector3D<T1,T2>, Skipper> Grammar; }; // ---------------------------------------------------------------------------- // Register Pnt3DGrammar for ROOT::Math::DisplacementVector3D: // ---------------------------------------------------------------------------- template <typename Iterator, typename T1, typename T2, typename Skipper> - struct Grammar_<Iterator, ROOT::Math::DisplacementVector3D<T1,T2>, Skipper>{ + struct Grammar_<Iterator, ROOT::Math::DisplacementVector3D<T1,T2>, Skipper>{ typedef Pnt3DGrammar<Iterator,ROOT::Math::DisplacementVector3D<T1,T2>, Skipper> Grammar; }; // ============================================================================ template< typename Iterator, typename PointT, typename Skipper> - struct Pnt4DGrammar : qi::grammar<Iterator, PointT(), Skipper> { + struct Pnt4DGrammar : qi::grammar<Iterator, PointT(), Skipper> { typedef PointT ResultT; typedef std::string ScalarT; //----------------------------------------------------------------------------- struct Operations { template <typename A, typename B = boost::fusion::unused_type, - typename C = boost::fusion::unused_type, - typename D = boost::fusion::unused_type> - struct result { typedef void type; }; + typename C = boost::fusion::unused_type, + typename D = boost::fusion::unused_type> + struct result { typedef void type; }; void operator()(ResultT& res, const ScalarT& value,const char xyz) const{ typename PointT::Scalar val = evaluate_string<typename PointT::Scalar>(value); @@ -432,7 +444,7 @@ namespace DD4hep { namespace Parsers { } }; // Operations // ---------------------------------------------------------------------------- - Pnt4DGrammar() : Pnt4DGrammar::base_type(point4d) { + Pnt4DGrammar() : Pnt4DGrammar::base_type(point4d) { point4d = list4d | ('(' >> list4d >> ')') | ('[' >> list4d >> ']'); list4d = (point3d[op(qi::_val,qi::_1)] >> enc::char_(";,") >> e[op(qi::_val, qi::_1, 'e')]) @@ -462,7 +474,7 @@ namespace DD4hep { namespace Parsers { // Register Pnt4DGrammar for ROOT::Math::LorentzVector: // ---------------------------------------------------------------------------- template <typename Iterator, typename T1, typename Skipper> - struct Grammar_<Iterator, ROOT::Math::LorentzVector<T1>, Skipper > { + struct Grammar_<Iterator, ROOT::Math::LorentzVector<T1>, Skipper > { typedef Pnt4DGrammar<Iterator, ROOT::Math::LorentzVector<T1>, Skipper> Grammar; }; // ============================================================================ diff --git a/DDCore/src/parsers/Parsers.icpp b/DDCore/src/parsers/Parsers.icpp index 170fd142dde455565f5ff41a51190f841ae67295..3353b30817f956bf8cc49ce8f971959c8be1c0d8 100644 --- a/DDCore/src/parsers/Parsers.icpp +++ b/DDCore/src/parsers/Parsers.icpp @@ -1,5 +1,14 @@ -// $Id: Parsers.icpp,v 1.5 2008/10/28 14:02:18 marcocle Exp $ -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #ifndef DD4HEP_PARSERS_ICPP #define DD4HEP_PARSERS_ICPP 1 // ============================================================================ diff --git a/DDCore/src/parsers/ParsersFactory.h b/DDCore/src/parsers/ParsersFactory.h index b618661d11a4d3d6dd648ec1e7571a9f26361d5e..b07b464c1cf1323e900a06db14204f458dafb32f 100644 --- a/DDCore/src/parsers/ParsersFactory.h +++ b/DDCore/src/parsers/ParsersFactory.h @@ -1,4 +1,14 @@ -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #ifndef DD4HEPPROPERTYPARSERS_PARSERSGENERATOR_H #define DD4HEPPROPERTYPARSERS_PARSERSGENERATOR_H 1 // ============================================================================ @@ -27,7 +37,7 @@ namespace DD4hep { typedef SkipperGrammar<IteratorT> Skipper; // ======================================================================== template<typename ResultT> inline int - parse_(ResultT& result, const std::string& input){ + parse_(ResultT& result, const std::string& input){ Skipper skipper; typename Grammar_<IteratorT, ResultT, Skipper>::Grammar g; IteratorT iter = input.begin(), end = input.end(); @@ -35,7 +45,7 @@ namespace DD4hep { } //========================================================================= template<> inline int - parse_(std::string& result, const std::string& input){ + parse_(std::string& result, const std::string& input){ Skipper skipper; Grammar_<IteratorT, std::string, Skipper>::Grammar g; IteratorT iter = input.begin(), end = input.end(); diff --git a/DDCore/src/parsers/ParsersObjects.cpp b/DDCore/src/parsers/ParsersObjects.cpp index 23465f6e20d427be4585b7f20f6ab80899a050e3..6a2c02251b1c115721249cf6cea63808a422daca 100644 --- a/DDCore/src/parsers/ParsersObjects.cpp +++ b/DDCore/src/parsers/ParsersObjects.cpp @@ -1,6 +1,17 @@ -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== +//========================================================================== // Include files -// ============================================================================ +//========================================================================== #include "ParsersFactory.h" #include "DD4hep/ToStream.h" diff --git a/DDCore/src/parsers/ParsersStandardList1.cpp b/DDCore/src/parsers/ParsersStandardList1.cpp index 4a76b514f85f5d92ddbb68261a66ad77b0c36330..381b3d6f700f91a599a3757943b25b76b55d1a1a 100644 --- a/DDCore/src/parsers/ParsersStandardList1.cpp +++ b/DDCore/src/parsers/ParsersStandardList1.cpp @@ -1,5 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardListCommon.h" PARSERS_DEF_FOR_LIST(bool) PARSERS_DEF_FOR_LIST(char) - PARSERS_DEF_FOR_LIST(unsigned char) - PARSERS_DEF_FOR_LIST(signed char) +PARSERS_DEF_FOR_LIST(unsigned char) +PARSERS_DEF_FOR_LIST(signed char) diff --git a/DDCore/src/parsers/ParsersStandardList2.cpp b/DDCore/src/parsers/ParsersStandardList2.cpp index f3040a991cd5762f56677b4d8586c8b3ea2ad0ef..09d46c48754408c15293228a8af04aa9a65ce753 100644 --- a/DDCore/src/parsers/ParsersStandardList2.cpp +++ b/DDCore/src/parsers/ParsersStandardList2.cpp @@ -1,5 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardListCommon.h" PARSERS_DEF_FOR_LIST(int) PARSERS_DEF_FOR_LIST(short) - PARSERS_DEF_FOR_LIST(unsigned short) - PARSERS_DEF_FOR_LIST(unsigned int) +PARSERS_DEF_FOR_LIST(unsigned short) +PARSERS_DEF_FOR_LIST(unsigned int) diff --git a/DDCore/src/parsers/ParsersStandardList3.cpp b/DDCore/src/parsers/ParsersStandardList3.cpp index d610cfc7cc70a15ed7ebd3a713cf3bddcb36233d..1e6c359052a3c43fc89843c8ade0eef9249402b8 100644 --- a/DDCore/src/parsers/ParsersStandardList3.cpp +++ b/DDCore/src/parsers/ParsersStandardList3.cpp @@ -1,5 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardListCommon.h" PARSERS_DEF_FOR_LIST(long) PARSERS_DEF_FOR_LIST(unsigned long) - PARSERS_DEF_FOR_LIST(long long) - PARSERS_DEF_FOR_LIST(unsigned long long) +PARSERS_DEF_FOR_LIST(long long) +PARSERS_DEF_FOR_LIST(unsigned long long) diff --git a/DDCore/src/parsers/ParsersStandardList4.cpp b/DDCore/src/parsers/ParsersStandardList4.cpp index 5db505633b78f40b8358e4e434de6f60625b387f..6df92a204fa6f3fdbc395afcd9fbb5783db25eef 100644 --- a/DDCore/src/parsers/ParsersStandardList4.cpp +++ b/DDCore/src/parsers/ParsersStandardList4.cpp @@ -1,5 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardListCommon.h" PARSERS_DEF_FOR_LIST(double) PARSERS_DEF_FOR_LIST(float) - PARSERS_DEF_FOR_LIST(long double) - PARSERS_DEF_FOR_LIST(std::string) +PARSERS_DEF_FOR_LIST(long double) +PARSERS_DEF_FOR_LIST(std::string) diff --git a/DDCore/src/parsers/ParsersStandardListCommon.h b/DDCore/src/parsers/ParsersStandardListCommon.h index d6987868d6ea2865777c6977a35140760331c0ab..976daf014f99aa92dc2a76e8963fac8930aa44be 100644 --- a/DDCore/src/parsers/ParsersStandardListCommon.h +++ b/DDCore/src/parsers/ParsersStandardListCommon.h @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #ifndef PARSERS_STANDARD_LIST_COMMON_H #define PARSERS_STANDARD_LIST_COMMON_H 1 // ============================================================================ diff --git a/DDCore/src/parsers/ParsersStandardMisc1.cpp b/DDCore/src/parsers/ParsersStandardMisc1.cpp index a653ba631eef0cc5027cfc3c23b4944d9fa213e3..15ce1db24e580865002dfbb9f48740c51071c729 100644 --- a/DDCore/src/parsers/ParsersStandardMisc1.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc1.cpp @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardMiscCommon.h" int DD4hep::Parsers::parse(std::pair<double,double>& result, const std::string& input) { diff --git a/DDCore/src/parsers/ParsersStandardMisc2.cpp b/DDCore/src/parsers/ParsersStandardMisc2.cpp index 04cd39710c35913d30cf0f44550751a2e837fe37..92960e318c8f3d37a46e0f8a20b6efcb4dd9cf03 100644 --- a/DDCore/src/parsers/ParsersStandardMisc2.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc2.cpp @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardMiscCommon.h" int DD4hep::Parsers::parse(std::vector<std::vector<double> >& result, const std::string& input) { diff --git a/DDCore/src/parsers/ParsersStandardMisc3.cpp b/DDCore/src/parsers/ParsersStandardMisc3.cpp index 5da3432ca06f0b39ac91bb068fdf8f0fcebbac98..05dd2f01ee8df69f88fea5c40b3e9d74c931468e 100644 --- a/DDCore/src/parsers/ParsersStandardMisc3.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc3.cpp @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardMiscCommon.h" int DD4hep::Parsers::parse(std::map<std::string, int>& result, const std::string& input) { diff --git a/DDCore/src/parsers/ParsersStandardMisc4.cpp b/DDCore/src/parsers/ParsersStandardMisc4.cpp index 6baab15b04daee2cff91fb1b2e4008460694f16b..610206a743521d08f32bc6b0ae99505adad95e88 100644 --- a/DDCore/src/parsers/ParsersStandardMisc4.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc4.cpp @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardMiscCommon.h" int DD4hep::Parsers::parse(std::map<std::string, std::vector<int> >& result, const std::string& input) { diff --git a/DDCore/src/parsers/ParsersStandardMisc5.cpp b/DDCore/src/parsers/ParsersStandardMisc5.cpp index 12ea5ec5f8bd8ed49db80061e97052423ef9946b..cbc8b0ef188288b2bba1e1d2bd069bb8c7cb1eeb 100644 --- a/DDCore/src/parsers/ParsersStandardMisc5.cpp +++ b/DDCore/src/parsers/ParsersStandardMisc5.cpp @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "ParsersStandardMiscCommon.h" int DD4hep::Parsers::parse(std::map<unsigned int, std::string>& result, const std::string& input) { diff --git a/DDCore/src/parsers/ParsersStandardMiscCommon.h b/DDCore/src/parsers/ParsersStandardMiscCommon.h index 8a2db6bdbd136476faf5aa3d1bfd9fccaf8e7c20..71ce7555ae9549840e1eb20fd6eb0d7a31f3b1fb 100644 --- a/DDCore/src/parsers/ParsersStandardMiscCommon.h +++ b/DDCore/src/parsers/ParsersStandardMiscCommon.h @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #ifndef PARSERS_STANDARD_MISC_COMMON_H #define PARSERS_STANDARD_MISC_COMMON_H 1 // ============================================================================ diff --git a/DDCore/src/parsers/ParsersStandardSingle.cpp b/DDCore/src/parsers/ParsersStandardSingle.cpp index 64ef13e38a0d974fa164aaa00bac143a9533c680..ccd35b8c0efd51f6a05800b4b74db4102d3001a6 100644 --- a/DDCore/src/parsers/ParsersStandardSingle.cpp +++ b/DDCore/src/parsers/ParsersStandardSingle.cpp @@ -1,26 +1,34 @@ -// ============================================================================ -// Include files -// ============================================================================ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "DD4hep/Parsers.h" #include "ParsersFactory.h" // ============================================================================ -#define PARSERS_DEF_FOR_SINGLE(Type) \ - int DD4hep::Parsers::parse(Type& result, const std::string& input) \ +#define PARSERS_DEF_FOR_SINGLE(Type) \ + int DD4hep::Parsers::parse(Type& result, const std::string& input) \ { return DD4hep::Parsers::parse_(result, input); } // ============================================================================ PARSERS_DEF_FOR_SINGLE(bool) PARSERS_DEF_FOR_SINGLE(char) - PARSERS_DEF_FOR_SINGLE(unsigned char) - PARSERS_DEF_FOR_SINGLE(signed char) - PARSERS_DEF_FOR_SINGLE(int) - PARSERS_DEF_FOR_SINGLE(short) - PARSERS_DEF_FOR_SINGLE(unsigned short) - PARSERS_DEF_FOR_SINGLE(unsigned int) - PARSERS_DEF_FOR_SINGLE(long) - PARSERS_DEF_FOR_SINGLE(unsigned long) - PARSERS_DEF_FOR_SINGLE(long long) - PARSERS_DEF_FOR_SINGLE(unsigned long long) - PARSERS_DEF_FOR_SINGLE(double) - PARSERS_DEF_FOR_SINGLE(float) - PARSERS_DEF_FOR_SINGLE(long double) - PARSERS_DEF_FOR_SINGLE(std::string) +PARSERS_DEF_FOR_SINGLE(unsigned char) +PARSERS_DEF_FOR_SINGLE(signed char) +PARSERS_DEF_FOR_SINGLE(int) +PARSERS_DEF_FOR_SINGLE(short) +PARSERS_DEF_FOR_SINGLE(unsigned short) +PARSERS_DEF_FOR_SINGLE(unsigned int) +PARSERS_DEF_FOR_SINGLE(long) +PARSERS_DEF_FOR_SINGLE(unsigned long) +PARSERS_DEF_FOR_SINGLE(long long) +PARSERS_DEF_FOR_SINGLE(unsigned long long) +PARSERS_DEF_FOR_SINGLE(double) +PARSERS_DEF_FOR_SINGLE(float) +PARSERS_DEF_FOR_SINGLE(long double) +PARSERS_DEF_FOR_SINGLE(std::string) diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index 5bfb3213e68173172c92fa4c3ae75c5baad40aef..7006ae6b547701c2d6a53a65bb9fd0231febda46 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DD4hep/DetFactoryHelper.h" @@ -336,7 +341,7 @@ template <> void Converter<Material>::operator()(xml_h e) const { else if (0 != (comp_elt = table->FindElement(nam.c_str()))) fraction *= comp_elt->A(); else - except("Compact2Objects","Converting material: %s Element missing: %s",mname.c_str(),nam.c_str()); + except("Compact2Objects","Converting material: %s Element missing: %s",mname.c_str(),nam.c_str()); composite_fractions_total += fraction; composite_fractions.push_back(fraction); } @@ -554,33 +559,33 @@ template <> void Converter<Readout>::operator()(xml_h e) const { string pType = p->type(); if (pType.compare("int") == 0) { - typedef DD4hep::DDSegmentation::TypedSegmentationParameter< int > ParInt; - static_cast<ParInt*>(p)->setTypedValue(seg.attr<int>(Unicode(p->name()))); + typedef DD4hep::DDSegmentation::TypedSegmentationParameter< int > ParInt; + static_cast<ParInt*>(p)->setTypedValue(seg.attr<int>(Unicode(p->name()))); } else if (pType.compare("float") == 0) { - typedef DD4hep::DDSegmentation::TypedSegmentationParameter< float > ParFloat; - static_cast<ParFloat*>(p)->setTypedValue(seg.attr<float>(Unicode(p->name()))); + typedef DD4hep::DDSegmentation::TypedSegmentationParameter< float > ParFloat; + static_cast<ParFloat*>(p)->setTypedValue(seg.attr<float>(Unicode(p->name()))); } else if (pType.compare("doublevec") == 0) { - std::vector<double> valueVector; - std::string parameterString = seg.attr<string>(Unicode(p->name())); - printout(DEBUG, "Compact", "++ Converting this string structure: %s.", parameterString.c_str()); + std::vector<double> valueVector; + std::string parameterString = seg.attr<string>(Unicode(p->name())); + printout(DEBUG, "Compact", "++ Converting this string structure: %s.", parameterString.c_str()); - std::vector<std::string> elements = DD4hep::DDSegmentation::splitString(parameterString); - for (std::vector<std::string>::const_iterator j = elements.begin(); j != elements.end(); ++j) { - if ((*j).empty()) continue; - valueVector.push_back(DD4hep::Geometry::_toDouble((*j))); - } + std::vector<std::string> elements = DD4hep::DDSegmentation::splitString(parameterString); + for (std::vector<std::string>::const_iterator j = elements.begin(); j != elements.end(); ++j) { + if ((*j).empty()) continue; + valueVector.push_back(DD4hep::Geometry::_toDouble((*j))); + } - typedef DD4hep::DDSegmentation::TypedSegmentationParameter< std::vector<double> > ParDouVec; - static_cast<ParDouVec*>(p)->setTypedValue(valueVector); + typedef DD4hep::DDSegmentation::TypedSegmentationParameter< std::vector<double> > ParDouVec; + static_cast<ParDouVec*>(p)->setTypedValue(valueVector); } else if (pType.compare("double") == 0) { - typedef DD4hep::DDSegmentation::TypedSegmentationParameter< double > ParDouble; - static_cast<ParDouble*>(p)->setTypedValue(seg.attr<double>(Unicode(p->name()))); + typedef DD4hep::DDSegmentation::TypedSegmentationParameter< double > ParDouble; + static_cast<ParDouble*>(p)->setTypedValue(seg.attr<double>(Unicode(p->name()))); } else { p->setValue(seg.attr<string>(Unicode(p->name()))); @@ -801,12 +806,12 @@ template <> void Converter<DetElement>::operator()(xml_h element) const { string par_name = element.attr<string>(attr_par); DetElement parent_detector = lcdd.detector(par_name); if ( !parent_detector.isValid() ) { - except("Compact","Failed to access valid parent detector of %s",name.c_str()); + except("Compact","Failed to access valid parent detector of %s",name.c_str()); } Volume parent_volume = parent_detector.placement().volume(); if ( !parent_volume.isValid() ) { - except("Compact","Failed to access valid parent volume of %s from %s", - name.c_str(), par_name.c_str()); + except("Compact","Failed to access valid parent volume of %s from %s", + name.c_str(), par_name.c_str()); } lcdd.declareMotherVolume(name, parent_volume); } diff --git a/DDCore/src/plugins/Geant4XML.cpp b/DDCore/src/plugins/Geant4XML.cpp index bb6083f75569340a4fec2b7167f01dc655b75734..aa3b01feeaa29c0b8da79f22da657906dcc31278 100644 --- a/DDCore/src/plugins/Geant4XML.cpp +++ b/DDCore/src/plugins/Geant4XML.cpp @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #include "XML/Conversions.h" #include "DD4hep/DetFactoryHelper.h" diff --git a/DDCore/src/plugins/GeometryWalk.cpp b/DDCore/src/plugins/GeometryWalk.cpp index 6d866f9f468edf153d49d3cc54eae79fb53b9359..de5b3097aa7fa9a48f40d47c41bf2b5ca07a85b8 100644 --- a/DDCore/src/plugins/GeometryWalk.cpp +++ b/DDCore/src/plugins/GeometryWalk.cpp @@ -1,11 +1,16 @@ -// $Id: TubeSegment_geo.cpp 633 2013-06-21 13:50:50Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDCore/src/plugins/LCDD2Output.cpp b/DDCore/src/plugins/LCDD2Output.cpp index 9b1028d4a7f0ca539be70d4d83f39325b8621f2d..9e18f807624d49b7c55eb94b83d2e3e416e66a46 100644 --- a/DDCore/src/plugins/LCDD2Output.cpp +++ b/DDCore/src/plugins/LCDD2Output.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #include "XML/Conversions.h" #include "DD4hep/LCDD.h" diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp index c40dbced8e2b21e0f1e0e9c8106f718f78264baa..f802bb3d7cacdaea447c1b2b4199fd8566dacde5 100644 --- a/DDCore/src/plugins/LCDDConverter.cpp +++ b/DDCore/src/plugins/LCDDConverter.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DD4hep/Plugins.h" @@ -327,7 +332,7 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con zplane.setAttr(_U(rmax), s->GetRmax(i)); solid.append(zplane); } - } + } else if (isa == TGeoPcon::Class()) { const TGeoPcon* s = (const TGeoPcon*) shape; geo.doc_solids.append(solid = xml_elt_t(geo.doc, _U(polycone))); @@ -470,9 +475,9 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con solid.setAttr(_U(lunit), "cm"); } else if (isa == TGeoCompositeShape::Class() || - isa == TGeoUnion::Class() || - isa == TGeoIntersection::Class() || - isa == TGeoSubtraction::Class() ) { + isa == TGeoUnion::Class() || + isa == TGeoIntersection::Class() || + isa == TGeoSubtraction::Class() ) { const TGeoCompositeShape* s = (const TGeoCompositeShape*) shape; const TGeoBoolNode* boolean = s->GetBoolNode(); TGeoBoolNode::EGeoBoolType oper = boolean->GetBooleanOperator(); @@ -495,29 +500,29 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con //if left == TGeoScaledShape AND right == TGeoBBox // AND if TGeoScaledShape->GetShape == TGeoSphere if (strcmp(ls->ClassName(), "TGeoScaledShape") == 0 && - strcmp(rs->ClassName(), "TGeoBBox") == 0) { - if (strcmp(((TGeoScaledShape *)ls)->GetShape()->ClassName(), "TGeoSphere") == 0) { - if (oper == TGeoBoolNode::kGeoIntersection) { - TGeoScaledShape* lls = (TGeoScaledShape *)ls; - TGeoBBox* rrs = (TGeoBBox*)rs; - solid = xml_elt_t(geo.doc,Unicode("ellipsoid")); - solid.setAttr(_U(name), Unicode(shape_name)); - double sx = lls->GetScale()->GetScale()[0]; - double sy = lls->GetScale()->GetScale()[1]; - double radius = ((TGeoSphere *)lls->GetShape())->GetRmax(); - double dz = rrs->GetDZ(); - double zorig = rrs->GetOrigin()[2]; - double zcut2 = dz + zorig; - double zcut1 = 2 * zorig - zcut2; - solid.setAttr(Unicode("ax"),sx * radius); - solid.setAttr(Unicode("by"),sy * radius); - solid.setAttr(Unicode("cz"),radius); - solid.setAttr(Unicode("zcut1"),zcut1); - solid.setAttr(Unicode("zcut2"),zcut2); - solid.setAttr(_U(lunit), "cm"); - return data().xmlSolids[shape] = solid; - } - } + strcmp(rs->ClassName(), "TGeoBBox") == 0) { + if (strcmp(((TGeoScaledShape *)ls)->GetShape()->ClassName(), "TGeoSphere") == 0) { + if (oper == TGeoBoolNode::kGeoIntersection) { + TGeoScaledShape* lls = (TGeoScaledShape *)ls; + TGeoBBox* rrs = (TGeoBBox*)rs; + solid = xml_elt_t(geo.doc,Unicode("ellipsoid")); + solid.setAttr(_U(name), Unicode(shape_name)); + double sx = lls->GetScale()->GetScale()[0]; + double sy = lls->GetScale()->GetScale()[1]; + double radius = ((TGeoSphere *)lls->GetShape())->GetRmax(); + double dz = rrs->GetDZ(); + double zorig = rrs->GetOrigin()[2]; + double zcut2 = dz + zorig; + double zcut1 = 2 * zorig - zcut2; + solid.setAttr(Unicode("ax"),sx * radius); + solid.setAttr(Unicode("by"),sy * radius); + solid.setAttr(Unicode("cz"),radius); + solid.setAttr(Unicode("zcut1"),zcut1); + solid.setAttr(Unicode("zcut2"),zcut2); + solid.setAttr(_U(lunit), "cm"); + return data().xmlSolids[shape] = solid; + } + } } if ( oper == TGeoBoolNode::kGeoSubtraction ) @@ -539,18 +544,18 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con if ((tr[0] != 0.0) || (tr[1] != 0.0) || (tr[2] != 0.0)) { first.append(obj = xml_elt_t(geo.doc, _U(firstposition))); - obj.setAttr(_U(name), name+"_"+lnam+"_pos"); + obj.setAttr(_U(name), name+"_"+lnam+"_pos"); obj.setAttr(_U(x), tr[0]); obj.setAttr(_U(y), tr[1]); obj.setAttr(_U(z), tr[2]); - obj.setAttr(_U(unit), "cm"); + obj.setAttr(_U(unit), "cm"); } if (lm->IsRotation()) { TGeoMatrix& linv = lm->Inverse(); XYZRotation rot = getXYZangles(linv.GetRotationMatrix()); if ((rot.X() != 0.0) || (rot.Y() != 0.0) || (rot.Z() != 0.0)) { first.append(obj = xml_elt_t(geo.doc, _U(firstrotation))); - obj.setAttr(_U(name), name+"_"+lnam+"_rot"); + obj.setAttr(_U(name), name+"_"+lnam+"_rot"); obj.setAttr(_U(x), rot.X()); obj.setAttr(_U(y), rot.Y()); obj.setAttr(_U(z), rot.Z()); @@ -998,7 +1003,7 @@ xml_h LCDDConverter::handleField(const std::string& /* name */, OverlayedField f field.setAttr(_U(name), f->GetName()); fld = PluginService::Create<NamedObject*>(type + "_Convert2LCDD", &m_lcdd, &field, &fld); printout(ALWAYS,"LCDDConverter","++ %s electromagnetic field:%s of type %s", - (fld.isValid() ? "Converted" : "FAILED to convert "), f->GetName(), type.c_str()); + (fld.isValid() ? "Converted" : "FAILED to convert "), f->GetName(), type.c_str()); if (!fld.isValid()) { PluginDebug dbg; PluginService::Create<NamedObject*>(type + "_Convert2LCDD", &m_lcdd, &field, &fld); @@ -1332,7 +1337,7 @@ static long create_visASCII(LCDD& lcdd, int /* argc */, char** argv) { os << "vol:" << vol.nameStr() << sep << "vis:" << vis.nameStr() << sep << "visible:" << vis.visible() << sep << "r:" << col.R() << sep << "g:" << col.G() << sep << "b:" << col.B() << sep << "alpha:" << col.alpha() << sep << "line_style:" << vis.attr < string > (_U(line_style)) << sep << "drawing_style:" << vis.attr < string - > (_U(drawing_style)) << sep << "show_daughters:" << vis.show_daughters() << sep << endl; + > (_U(drawing_style)) << sep << "show_daughters:" << vis.show_daughters() << sep << endl; } os.close(); return 1; diff --git a/DDCore/src/plugins/LCDDConverter.h b/DDCore/src/plugins/LCDDConverter.h index 7c5ca04599c555c6ef89a58da1eab10255268d61..f115208d01055cd7958b91ed1ee7fd9dbbda8e48 100644 --- a/DDCore/src/plugins/LCDDConverter.h +++ b/DDCore/src/plugins/LCDDConverter.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEOMETRY_LCDDCONVERTER_H #define DD4HEP_GEOMETRY_LCDDCONVERTER_H diff --git a/DDCore/src/plugins/LCDDFields.cpp b/DDCore/src/plugins/LCDDFields.cpp index bd81e49fcabae245a528a39f209a2962d2087095..291dad36c3e320a54995198ae8e5ae1362a9518f 100644 --- a/DDCore/src/plugins/LCDDFields.cpp +++ b/DDCore/src/plugins/LCDDFields.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DD4hep/FieldTypes.h" diff --git a/DDCore/src/plugins/LCDDHelperTest.cpp b/DDCore/src/plugins/LCDDHelperTest.cpp index 0c56006cea4fc2fc57a607d76d35554526eefa66..b6af50269aa5de9c2cf7a2e51d706c827406cda2 100644 --- a/DDCore/src/plugins/LCDDHelperTest.cpp +++ b/DDCore/src/plugins/LCDDHelperTest.cpp @@ -1,11 +1,16 @@ -// $Id: TubeSegment_geo.cpp 633 2013-06-21 13:50:50Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" @@ -53,21 +58,21 @@ namespace { void walkSD(LCDDHelper h, DetElement de) const { printSD(h,de); for(DetElement::Children::const_iterator i=de.children().begin(); i!=de.children().end(); ++i) { - DetElement child = (*i).second; - printSD(h,child); - if ( child.children().size() > 0 ) walkSD(h,child); + DetElement child = (*i).second; + printSD(h,child); + if ( child.children().size() > 0 ) walkSD(h,child); } } void printSD(LCDDHelper h, DetElement de) const { SensitiveDetector sd = h.sensitiveDetector(de); printout(INFO,"LCDDHelperTest","Sensitive detector[%s]: %p --> %s",de.path().c_str(),(void*)sd.ptr(), - sd.ptr() ? sd.name() : "????"); + sd.ptr() ? sd.name() : "????"); } void printSD(LCDDHelper h, const char* nam) const { SensitiveDetector sd = h.sensitiveDetector(nam); printout(INFO,"LCDDHelperTest","Sensitive detector[%s]: %p --> %s",nam,(void*)sd.ptr(), - sd.ptr() ? sd.name() : "????"); + sd.ptr() ? sd.name() : "????"); } /// Action routine to execute the test diff --git a/DDCore/src/plugins/PandoraConverter.cpp b/DDCore/src/plugins/PandoraConverter.cpp index 4011ddb17ec6b2bf1b852107bbf0a33b284674d9..fe11589f5cafd32ab84a0a995dd75c4123971391 100644 --- a/DDCore/src/plugins/PandoraConverter.cpp +++ b/DDCore/src/plugins/PandoraConverter.cpp @@ -1,10 +1,17 @@ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id$ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // $Id$ #ifndef DD4HEP_GEOMETRY_PANDORACONVERTER_H #define DD4HEP_GEOMETRY_PANDORACONVERTER_H @@ -194,7 +201,7 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { * @version $Id$ */ public class Main implements Converter - { + { private final static boolean DEBUG = false; // ConditionsManager instance. @@ -270,17 +277,17 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { } public SamplingLayers(List<SamplingLayerRange> ranges) - { - this.addAll(ranges); - } + { + this.addAll(ranges); + } public SamplingLayerRange getSamplingLayerRange(int layern) { for (SamplingLayerRange range : this) - { - if (range.inRange(layern)) - return range; - } + { + if (range.inRange(layern)) + return range; + } return null; } } @@ -304,11 +311,11 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { StringBuffer buff = new StringBuffer(); buff.append(name + '\n'); for (SamplingLayerRange range : samplingLayers) - { - buff.append("[" + range.getLowerLayer() + " - " + range.getUpperLayer() + "]" + '\n'); - buff.append(" em = " + range.getEMSampling() + '\n'); - buff.append(" had = " + range.getHADSampling() + '\n'); - } + { + buff.append("[" + range.getLowerLayer() + " - " + range.getUpperLayer() + "]" + '\n'); + buff.append(" em = " + range.getEMSampling() + '\n'); + buff.append(" had = " + range.getHADSampling() + '\n'); + } return buff.toString(); } @@ -334,39 +341,39 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { // CalorimeterType. String layeringName = null; if (calorimeter.getCalorimeterType() == CalorimeterType.EM_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.EM_ENDCAP) - { - layeringName = "ECalLayering"; - } + { + layeringName = "ECalLayering"; + } else if (calorimeter.getCalorimeterType() == CalorimeterType.HAD_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.HAD_ENDCAP) - { - layeringName = "HCalLayering"; - } + { + layeringName = "HCalLayering"; + } else if (calorimeter.getCalorimeterType() == CalorimeterType.MUON_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.MUON_ENDCAP) - { - layeringName = "MuonLayering"; - } + { + layeringName = "MuonLayering"; + } else - { - throw new RuntimeException("Don't know how to handle CalorimeterConditions for " + calorimeter.getName() + "."); - } + { + throw new RuntimeException("Don't know how to handle CalorimeterConditions for " + calorimeter.getName() + "."); + } String emName = null; String hadName = null; if (calorimeter.getCalorimeterType() == CalorimeterType.EM_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.HAD_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.MUON_BARREL) - { - emName = "EMBarrel_SF"; - hadName = "HadBarrel_SF"; - } + { + emName = "EMBarrel_SF"; + hadName = "HadBarrel_SF"; + } else if (calorimeter.getCalorimeterType() == CalorimeterType.EM_ENDCAP || calorimeter.getCalorimeterType() == CalorimeterType.HAD_ENDCAP || calorimeter.getCalorimeterType() == CalorimeterType.MUON_ENDCAP) - { - emName = "EMEndcap_SF"; - hadName = "HadEndcap_SF"; - } + { + emName = "EMEndcap_SF"; + hadName = "HadEndcap_SF"; + } if (emName == null || hadName == null) - { - throw new RuntimeException("Sampling fractions not found for " + calorimeter.getName() + "."); - } + { + throw new RuntimeException("Sampling fractions not found for " + calorimeter.getName() + "."); + } String emSampling = conditions.getString(emName); String hadSampling = conditions.getString(hadName); @@ -374,66 +381,66 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { List<Double> hadSamplingFractions = new ArrayList<Double>(); StringTokenizer tok = new StringTokenizer(emSampling, ","); while (tok.hasMoreTokens()) - { - Double emSamplingFraction = Double.valueOf(tok.nextToken().trim()); - emSamplingFractions.add(emSamplingFraction); - } + { + Double emSamplingFraction = Double.valueOf(tok.nextToken().trim()); + emSamplingFractions.add(emSamplingFraction); + } tok = new StringTokenizer(hadSampling, ","); while (tok.hasMoreTokens()) - { - Double hadSamplingFraction = Double.valueOf(tok.nextToken().trim()); - hadSamplingFractions.add(hadSamplingFraction); - } + { + Double hadSamplingFraction = Double.valueOf(tok.nextToken().trim()); + hadSamplingFractions.add(hadSamplingFraction); + } String layering = conditions.getString(layeringName); tok = new StringTokenizer(layering, ","); List<Integer> layers = new ArrayList<Integer>(); int maxLayer = calorimeter.getLayering().getLayerCount() - 1; while (tok.hasMoreTokens()) - { - String nextToken = tok.nextToken().trim(); - int nextLayer = Integer.valueOf(nextToken); - layers.add(nextLayer); - } + { + String nextToken = tok.nextToken().trim(); + int nextLayer = Integer.valueOf(nextToken); + layers.add(nextLayer); + } // FIXME Hack to get the correct starting index for the sampling // fractions. Ideally, the sampling fractions should be separated by subdetector name. int samplingIndex = 0; if (calorimeter.getCalorimeterType() == HAD_BARREL || calorimeter.getCalorimeterType() == HAD_ENDCAP) - { - samplingIndex = (new StringTokenizer(conditions.getString("ECalLayering"), ",").countTokens()); - } + { + samplingIndex = (new StringTokenizer(conditions.getString("ECalLayering"), ",").countTokens()); + } if (calorimeter.getCalorimeterType() == MUON_BARREL || calorimeter.getCalorimeterType() == MUON_ENDCAP) - { - samplingIndex = (new StringTokenizer(conditions.getString("ECalLayering"), ",").countTokens()); - samplingIndex += (new StringTokenizer(conditions.getString("HCalLayering"), ",").countTokens()); - } + { + samplingIndex = (new StringTokenizer(conditions.getString("ECalLayering"), ",").countTokens()); + samplingIndex += (new StringTokenizer(conditions.getString("HCalLayering"), ",").countTokens()); + } // System.out.println(" samplingIndex: " + samplingIndex); // Create the SamplingLayerRange list. samplingLayers = new SamplingLayers(); for (int i = 0; i < layers.size(); i++) - { - // Figure out the layer range. - int lowerLayer = layers.get(i); - int upperLayer = 0; - if (i + 1 > layers.size() - 1) - upperLayer = maxLayer; - else - upperLayer = layers.get(i + 1) - 1; - - // Create the sampling layer range. - double emSamplingFraction = emSamplingFractions.get(samplingIndex); - double hadSamplingFraction = hadSamplingFractions.get(samplingIndex); - SamplingLayerRange samplingLayerRange = new SamplingLayerRange(lowerLayer, upperLayer, emSamplingFraction, hadSamplingFraction); - // System.out.println(" " + lowerLayer + " - " + upperLayer + - // " : " + emSamplingFraction + ", " + hadSamplingFraction); - - samplingLayers.add(samplingLayerRange); - - ++samplingIndex; - } + { + // Figure out the layer range. + int lowerLayer = layers.get(i); + int upperLayer = 0; + if (i + 1 > layers.size() - 1) + upperLayer = maxLayer; + else + upperLayer = layers.get(i + 1) - 1; + + // Create the sampling layer range. + double emSamplingFraction = emSamplingFractions.get(samplingIndex); + double hadSamplingFraction = hadSamplingFractions.get(samplingIndex); + SamplingLayerRange samplingLayerRange = new SamplingLayerRange(lowerLayer, upperLayer, emSamplingFraction, hadSamplingFraction); + // System.out.println(" " + lowerLayer + " - " + upperLayer + + // " : " + emSamplingFraction + ", " + hadSamplingFraction); + + samplingLayers.add(samplingLayerRange); + + ++samplingIndex; + } // MIP energy. String mipCondition = null; @@ -442,23 +449,23 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { // FIXME: Cleanup this ugliness. if (calorimeter.getCalorimeterType() == CalorimeterType.EM_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.EM_ENDCAP) - { - mipCondition = "ECalMip_MPV"; - mipSigmaCondition = "ECalMip_sig"; - mipCutCondition = "ECalMip_Cut"; - } + { + mipCondition = "ECalMip_MPV"; + mipSigmaCondition = "ECalMip_sig"; + mipCutCondition = "ECalMip_Cut"; + } else if (calorimeter.getCalorimeterType() == CalorimeterType.HAD_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.HAD_ENDCAP) - { - mipCondition = "HCalMip_MPV"; - mipSigmaCondition = "HCalMip_sig"; - mipCutCondition = "HCalMip_Cut"; - } + { + mipCondition = "HCalMip_MPV"; + mipSigmaCondition = "HCalMip_sig"; + mipCutCondition = "HCalMip_Cut"; + } else if (calorimeter.getCalorimeterType() == CalorimeterType.MUON_BARREL || calorimeter.getCalorimeterType() == CalorimeterType.MUON_ENDCAP) - { - mipCondition = "MuonMip_MPV"; - mipSigmaCondition = "MuonMip_sig"; - mipCutCondition = "MuonMip_Cut"; - } + { + mipCondition = "MuonMip_MPV"; + mipSigmaCondition = "MuonMip_sig"; + mipCutCondition = "MuonMip_Cut"; + } mipEnergy = conditions.getDouble(mipCondition); mipSigma = conditions.getDouble(mipSigmaCondition); mipCut = conditions.getDouble(mipCutCondition); @@ -475,10 +482,10 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { public SamplingLayerRange getSamplingLayerRange(int layer) { for (SamplingLayerRange layers : this.samplingLayers) - { - if (layers.inRange(layer)) - return layers; - } + { + if (layers.inRange(layer)) + return layers; + } return null; } @@ -504,27 +511,27 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { } public void convert(String inputFileName, InputStream in, OutputStream out) throws Exception + { + GeometryReader reader = new GeometryReader(); + Detector det = reader.read(in); + String detectorName = det.getDetectorName(); + try { - GeometryReader reader = new GeometryReader(); - Detector det = reader.read(in); - String detectorName = det.getDetectorName(); - try - { - conditionsManager.setDetector(detectorName, 0); - } - catch (ConditionsNotFoundException x) - { - throw new RuntimeException("Failed to setup conditions system for detector: " + detectorName, x); - } - Document doc = convertDetectorToPandora(det); - XMLOutputter outputter = new XMLOutputter(); - if (out != null) - { - outputter.setFormat(Format.getPrettyFormat()); - outputter.output(doc, out); - out.close(); - } + conditionsManager.setDetector(detectorName, 0); } + catch (ConditionsNotFoundException x) + { + throw new RuntimeException("Failed to setup conditions system for detector: " + detectorName, x); + } + Document doc = convertDetectorToPandora(det); + XMLOutputter outputter = new XMLOutputter(); + if (out != null) + { + outputter.setFormat(Format.getPrettyFormat()); + outputter.output(doc, out); + out.close(); + } + } public Document convertDetectorToPandora(Detector detector) { @@ -543,212 +550,212 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { // Setup CalorimeterCalibration conditions. ConditionsSet calorimeterCalibration = null; try - { - calorimeterCalibration = conditionsManager.getConditions("CalorimeterCalibration"); - } + { + calorimeterCalibration = conditionsManager.getConditions("CalorimeterCalibration"); + } catch (Exception x) - { - } + { + } boolean haveCalCalib = (calorimeterCalibration == null) ? false : true; // Process the subdetectors. for (Subdetector subdetector : detector.getSubdetectors().values()) + { + //System.out.println(subdetector.getName()); + // Only handle calorimeters that are planar. + if (subdetector instanceof AbstractPolyhedraCalorimeter) { - //System.out.println(subdetector.getName()); - // Only handle calorimeters that are planar. - if (subdetector instanceof AbstractPolyhedraCalorimeter) + Element calorimeter = new Element("calorimeter"); + AbstractPolyhedraCalorimeter polycal = (AbstractPolyhedraCalorimeter) subdetector; + + // Look for specific calorimeter types in the compact + // description. + Calorimeter.CalorimeterType calType = polycal.getCalorimeterType(); + if (calType.equals(HAD_BARREL) || calType.equals(HAD_ENDCAP) || calType.equals(EM_ENDCAP) || calType.equals(EM_BARREL) || calType.equals(MUON_BARREL) || calType.equals(MUON_ENDCAP)) + { + // Set basic parameters in pandora calorimeter. + calorimeter.setAttribute("type", Calorimeter.CalorimeterType.toString(calType)); + calorimeter.setAttribute("innerR", Double.toString(polycal.getInnerRadius())); + calorimeter.setAttribute("innerZ", Double.toString(polycal.getInnerZ())); + calorimeter.setAttribute("innerPhi", Double.toString(polycal.getSectionPhi())); + calorimeter.setAttribute("innerSymmetryOrder", Double.toString(polycal.getNumberOfSides())); + calorimeter.setAttribute("outerR", Double.toString(polycal.getOuterRadius())); + calorimeter.setAttribute("outerZ", Double.toString(polycal.getOuterZ())); + calorimeter.setAttribute("outerPhi", Double.toString(polycal.getSectionPhi())); + calorimeter.setAttribute("outerSymmetryOrder", Double.toString(polycal.getNumberOfSides())); + calorimeter.setAttribute("collection", subdetector.getReadout().getName()); + + // Get the cell sizes from the segmentation. + List<Double> cellSizes = getCellSizes(subdetector); + + // For endcaps, X is U, and Y is V. + if (subdetector.isEndcap()) + { + calorimeter.setAttribute("cellSizeU", Double.toString(cellSizes.get(0))); + calorimeter.setAttribute("cellSizeV", Double.toString(cellSizes.get(1))); + } + // The UV mapping is flipped around for barrel. X is V, and Y is U. + else if (subdetector.isBarrel()) + { + calorimeter.setAttribute("cellSizeU", Double.toString(cellSizes.get(1))); + calorimeter.setAttribute("cellSizeV", Double.toString(cellSizes.get(0))); + } + + // Create identifier description and add to subdet. + calorimeter.addContent(makeIdentifierDescription(polycal)); + + // Add the calorimeter. + calorimeters.addContent(calorimeter); + + LayerStack layers = polycal.getLayering().getLayerStack(); + + Element layersElem = new Element("layers"); + layersElem.setAttribute("nlayers", Integer.toString(layers.getNumberOfLayers())); + + calorimeter.addContent(layersElem); + + double layerD = 0.; + + if (polycal.isBarrel()) + { + layerD = polycal.getInnerRadius(); + } + else if (polycal.isEndcap()) + { + layerD = polycal.getInnerZ(); + } + + CalorimeterConditions subdetectorCalorimeterConditions = null; + + if (haveCalCalib) { - Element calorimeter = new Element("calorimeter"); - AbstractPolyhedraCalorimeter polycal = (AbstractPolyhedraCalorimeter) subdetector; + subdetectorCalorimeterConditions = new CalorimeterConditions((Calorimeter) subdetector, calorimeterCalibration); + } - // Look for specific calorimeter types in the compact - // description. - Calorimeter.CalorimeterType calType = polycal.getCalorimeterType(); - if (calType.equals(HAD_BARREL) || calType.equals(HAD_ENDCAP) || calType.equals(EM_ENDCAP) || calType.equals(EM_BARREL) || calType.equals(MUON_BARREL) || calType.equals(MUON_ENDCAP)) + // Set MIP energy from calibration. + if (haveCalCalib) + { + calorimeter.setAttribute("mipEnergy", xfrac.format(subdetectorCalorimeterConditions.getMipEnergy())); + calorimeter.setAttribute("mipSigma", xfrac.format(subdetectorCalorimeterConditions.getMipSigma())); + calorimeter.setAttribute("mipCut", xfrac.format(subdetectorCalorimeterConditions.getMipCut())); + calorimeter.setAttribute("timeCut", xfrac.format(subdetectorCalorimeterConditions.getTimeCut())); + } + // Set MIP energy from Bethe-Bloche calculation. + // TODO Check accuracy of this algorithm. + else + { + List<LayerSlice> sensors = subdetector.getLayering().getLayerStack().getLayer(0).getSensors(); + LayerSlice sensor = sensors.get(0); + IMaterial sensorMaterial = MaterialStore.getInstance().get(sensor.getMaterial().getName()); + + ParticleType particleType = ParticlePropertyManager.getParticlePropertyProvider().get(13); + + Hep3Vector p = new BasicHep3Vector(-6.8641, -7.2721, 1.2168e-7); + + double emip = BetheBlochCalculator.computeBetheBloch(sensorMaterial, p, particleType.getMass(), particleType.getCharge(), sensor.getThickness()); + + // Set MIP Energy from Bethe Bloche. + calorimeter.setAttribute("mipEnergy", xfrac.format(emip)); + + // Set defaults for CalCalib parameters. + calorimeter.setAttribute("mipSigma", "0"); + calorimeter.setAttribute("mipCut", "0"); + calorimeter.setAttribute("timeCut", xfrac.format(Double.MAX_VALUE)); + } + + double totalX0 = 0; + + for (int i = 0; i < layers.getNumberOfLayers(); i++) + { + //System.out.println(" layer " + i); + Layer layer = layers.getLayer(i); + + Element layerElem = new Element("layer"); + layersElem.addContent(layerElem); + + // Set radiation and interaction lengths. + double intLen = 0; + double radLen = 0; + for (int j = 0; j < layer.getNumberOfSlices(); j++) + { + LayerSlice slice = layer.getSlice(j); + //System.out.println(" slice " + j + " " + slice.getMaterial().getName()); + double x0 = slice.getMaterial().getRadiationLength(); + //System.out.println(" x0_mat_D="+x0); + //System.out.println(" x0_mat="+slice.getMaterial().getRadiationLength()); + radLen += slice.getThickness() / (x0*10); + //System.out.println(" radLen="+radLen); + + double lambda = slice.getMaterial().getNuclearInteractionLength(); + intLen += slice.getThickness() / (lambda*10); + } + //System.out.println(" x0_lyr_tot=" + radLen); + + totalX0 += radLen; + + //System.out.println(" layer " + i + " " + radLen); + + layerElem.setAttribute("radLen", xlen.format(radLen)); + layerElem.setAttribute("intLen", xlen.format(intLen)); + + // Set distance to IP. + double layerD2 = layerD + layer.getThicknessToSensitiveMid(); + layerElem.setAttribute("distanceToIp", xthick.format(layerD2)); + + // Set cell thickness. + layerElem.setAttribute("cellThickness", xthick.format(layer.getThickness())); + + // Set EM and HAD sampling fractions from + // CalorimeterCalibration conditions, if present. + if (haveCalCalib) + { + SamplingLayerRange layerRange = subdetectorCalorimeterConditions.getSamplingLayerRange(i); + if (calType == EM_BARREL || calType == EM_ENDCAP) { - // Set basic parameters in pandora calorimeter. - calorimeter.setAttribute("type", Calorimeter.CalorimeterType.toString(calType)); - calorimeter.setAttribute("innerR", Double.toString(polycal.getInnerRadius())); - calorimeter.setAttribute("innerZ", Double.toString(polycal.getInnerZ())); - calorimeter.setAttribute("innerPhi", Double.toString(polycal.getSectionPhi())); - calorimeter.setAttribute("innerSymmetryOrder", Double.toString(polycal.getNumberOfSides())); - calorimeter.setAttribute("outerR", Double.toString(polycal.getOuterRadius())); - calorimeter.setAttribute("outerZ", Double.toString(polycal.getOuterZ())); - calorimeter.setAttribute("outerPhi", Double.toString(polycal.getSectionPhi())); - calorimeter.setAttribute("outerSymmetryOrder", Double.toString(polycal.getNumberOfSides())); - calorimeter.setAttribute("collection", subdetector.getReadout().getName()); - - // Get the cell sizes from the segmentation. - List<Double> cellSizes = getCellSizes(subdetector); - - // For endcaps, X is U, and Y is V. - if (subdetector.isEndcap()) - { - calorimeter.setAttribute("cellSizeU", Double.toString(cellSizes.get(0))); - calorimeter.setAttribute("cellSizeV", Double.toString(cellSizes.get(1))); - } - // The UV mapping is flipped around for barrel. X is V, and Y is U. - else if (subdetector.isBarrel()) - { - calorimeter.setAttribute("cellSizeU", Double.toString(cellSizes.get(1))); - calorimeter.setAttribute("cellSizeV", Double.toString(cellSizes.get(0))); - } - - // Create identifier description and add to subdet. - calorimeter.addContent(makeIdentifierDescription(polycal)); - - // Add the calorimeter. - calorimeters.addContent(calorimeter); - - LayerStack layers = polycal.getLayering().getLayerStack(); - - Element layersElem = new Element("layers"); - layersElem.setAttribute("nlayers", Integer.toString(layers.getNumberOfLayers())); - - calorimeter.addContent(layersElem); - - double layerD = 0.; - - if (polycal.isBarrel()) - { - layerD = polycal.getInnerRadius(); - } - else if (polycal.isEndcap()) - { - layerD = polycal.getInnerZ(); - } - - CalorimeterConditions subdetectorCalorimeterConditions = null; - - if (haveCalCalib) - { - subdetectorCalorimeterConditions = new CalorimeterConditions((Calorimeter) subdetector, calorimeterCalibration); - } - - // Set MIP energy from calibration. - if (haveCalCalib) - { - calorimeter.setAttribute("mipEnergy", xfrac.format(subdetectorCalorimeterConditions.getMipEnergy())); - calorimeter.setAttribute("mipSigma", xfrac.format(subdetectorCalorimeterConditions.getMipSigma())); - calorimeter.setAttribute("mipCut", xfrac.format(subdetectorCalorimeterConditions.getMipCut())); - calorimeter.setAttribute("timeCut", xfrac.format(subdetectorCalorimeterConditions.getTimeCut())); - } - // Set MIP energy from Bethe-Bloche calculation. - // TODO Check accuracy of this algorithm. - else - { - List<LayerSlice> sensors = subdetector.getLayering().getLayerStack().getLayer(0).getSensors(); - LayerSlice sensor = sensors.get(0); - IMaterial sensorMaterial = MaterialStore.getInstance().get(sensor.getMaterial().getName()); - - ParticleType particleType = ParticlePropertyManager.getParticlePropertyProvider().get(13); - - Hep3Vector p = new BasicHep3Vector(-6.8641, -7.2721, 1.2168e-7); - - double emip = BetheBlochCalculator.computeBetheBloch(sensorMaterial, p, particleType.getMass(), particleType.getCharge(), sensor.getThickness()); - - // Set MIP Energy from Bethe Bloche. - calorimeter.setAttribute("mipEnergy", xfrac.format(emip)); - - // Set defaults for CalCalib parameters. - calorimeter.setAttribute("mipSigma", "0"); - calorimeter.setAttribute("mipCut", "0"); - calorimeter.setAttribute("timeCut", xfrac.format(Double.MAX_VALUE)); - } - - double totalX0 = 0; - - for (int i = 0; i < layers.getNumberOfLayers(); i++) - { - //System.out.println(" layer " + i); - Layer layer = layers.getLayer(i); - - Element layerElem = new Element("layer"); - layersElem.addContent(layerElem); - - // Set radiation and interaction lengths. - double intLen = 0; - double radLen = 0; - for (int j = 0; j < layer.getNumberOfSlices(); j++) - { - LayerSlice slice = layer.getSlice(j); - //System.out.println(" slice " + j + " " + slice.getMaterial().getName()); - double x0 = slice.getMaterial().getRadiationLength(); - //System.out.println(" x0_mat_D="+x0); - //System.out.println(" x0_mat="+slice.getMaterial().getRadiationLength()); - radLen += slice.getThickness() / (x0*10); - //System.out.println(" radLen="+radLen); - - double lambda = slice.getMaterial().getNuclearInteractionLength(); - intLen += slice.getThickness() / (lambda*10); - } - //System.out.println(" x0_lyr_tot=" + radLen); - - totalX0 += radLen; - - //System.out.println(" layer " + i + " " + radLen); - - layerElem.setAttribute("radLen", xlen.format(radLen)); - layerElem.setAttribute("intLen", xlen.format(intLen)); - - // Set distance to IP. - double layerD2 = layerD + layer.getThicknessToSensitiveMid(); - layerElem.setAttribute("distanceToIp", xthick.format(layerD2)); - - // Set cell thickness. - layerElem.setAttribute("cellThickness", xthick.format(layer.getThickness())); - - // Set EM and HAD sampling fractions from - // CalorimeterCalibration conditions, if present. - if (haveCalCalib) - { - SamplingLayerRange layerRange = subdetectorCalorimeterConditions.getSamplingLayerRange(i); - if (calType == EM_BARREL || calType == EM_ENDCAP) - { - layerElem.setAttribute("samplingFraction", xfrac.format(layerRange.getEMSampling())); - } - if (calType == HAD_BARREL || calType == HAD_ENDCAP) - { - layerElem.setAttribute("samplingFraction", xfrac.format(layerRange.getHADSampling())); - } - if (calType == MUON_BARREL || calType == MUON_ENDCAP) - { - layerElem.setAttribute("samplingFraction", xfrac.format(layerRange.getHADSampling())); - } - layerElem.setAttribute("emSamplingFraction", xfrac.format(layerRange.getEMSampling())); - layerElem.setAttribute("hadSamplingFraction", xfrac.format(layerRange.getHADSampling())); - } - // Set from base SamplingFraction conditions. May throw - // an exception if neither CalorimeterCalibration - // or SamplingFractions conditions exists. - else - { - double samplingFraction = SamplingFractionManager.defaultInstance().getSamplingFraction(subdetector, i); - layerElem.setAttribute("emSamplingFraction", xfrac.format(samplingFraction)); - layerElem.setAttribute("hadSamplingFraction", xfrac.format(samplingFraction)); - } - - // Increment layer distance by thickness of layer. - layerD += layer.getThickness(); - } - - //System.out.println(" X0 Sum = " + totalX0); + layerElem.setAttribute("samplingFraction", xfrac.format(layerRange.getEMSampling())); } - - // Set digital flag. - try + if (calType == HAD_BARREL || calType == HAD_ENDCAP) { - // Set digital attribute from conditions, if present. - ConditionsSet conditions = conditionsManager.getConditions("SamplingFractions/" + subdetector.getName()); - boolean isDigital = conditions.getBoolean("digital"); - calorimeter.setAttribute("digital", String.valueOf(isDigital)); + layerElem.setAttribute("samplingFraction", xfrac.format(layerRange.getHADSampling())); } - catch (Exception x) + if (calType == MUON_BARREL || calType == MUON_ENDCAP) { - calorimeter.setAttribute("digital", "false"); + layerElem.setAttribute("samplingFraction", xfrac.format(layerRange.getHADSampling())); } + layerElem.setAttribute("emSamplingFraction", xfrac.format(layerRange.getEMSampling())); + layerElem.setAttribute("hadSamplingFraction", xfrac.format(layerRange.getHADSampling())); + } + // Set from base SamplingFraction conditions. May throw + // an exception if neither CalorimeterCalibration + // or SamplingFractions conditions exists. + else + { + double samplingFraction = SamplingFractionManager.defaultInstance().getSamplingFraction(subdetector, i); + layerElem.setAttribute("emSamplingFraction", xfrac.format(samplingFraction)); + layerElem.setAttribute("hadSamplingFraction", xfrac.format(samplingFraction)); + } + + // Increment layer distance by thickness of layer. + layerD += layer.getThickness(); } + + //System.out.println(" X0 Sum = " + totalX0); + } + + // Set digital flag. + try + { + // Set digital attribute from conditions, if present. + ConditionsSet conditions = conditionsManager.getConditions("SamplingFractions/" + subdetector.getName()); + boolean isDigital = conditions.getBoolean("digital"); + calorimeter.setAttribute("digital", String.valueOf(isDigital)); + } + catch (Exception x) + { + calorimeter.setAttribute("digital", "false"); + } } + } // TODO clean up the hard coded assumptions on coil geometry double coilRadLen = 0; @@ -759,48 +766,48 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { double bfield = 0; double coilMaxZ = 0; try + { + MultiLayerTracker c = (MultiLayerTracker) detector.getSubdetector("SolenoidCoilBarrel"); + if (c != null) { - MultiLayerTracker c = (MultiLayerTracker) detector.getSubdetector("SolenoidCoilBarrel"); - if (c != null) + coilLayers = c.getNumberOfLayers(); + coilInnerR = c.getInnerR()[0]; + coilOuterR = c.getInnerR()[coilLayers-1] + c.getLayerThickness(coilLayers-1); + for (int layern = 0; layern != c.getNumberOfLayers(); layern++) + { + for (LayerSlice slice : c.getLayer(layern).getSlices()) { - coilLayers = c.getNumberOfLayers(); - coilInnerR = c.getInnerR()[0]; - coilOuterR = c.getInnerR()[coilLayers-1] + c.getLayerThickness(coilLayers-1); - for (int layern = 0; layern != c.getNumberOfLayers(); layern++) - { - for (LayerSlice slice : c.getLayer(layern).getSlices()) - { - double x0 = slice.getMaterial().getRadiationLength(); - double sliceRadLen = slice.getThickness() / (x0*10); - double lambda = slice.getMaterial().getNuclearInteractionLength(); - double sliceIntLen = slice.getThickness() / (lambda*10); - - coilRadLen += sliceRadLen; - coilIntLen += sliceIntLen; - } - } - //calculate average interaction/radiation length in coil material - coilRadLen = coilRadLen/(coilOuterR-coilInnerR); - coilIntLen = coilIntLen/(coilOuterR-coilInnerR); + double x0 = slice.getMaterial().getRadiationLength(); + double sliceRadLen = slice.getThickness() / (x0*10); + double lambda = slice.getMaterial().getNuclearInteractionLength(); + double sliceIntLen = slice.getThickness() / (lambda*10); + + coilRadLen += sliceRadLen; + coilIntLen += sliceIntLen; } + } + //calculate average interaction/radiation length in coil material + coilRadLen = coilRadLen/(coilOuterR-coilInnerR); + coilIntLen = coilIntLen/(coilOuterR-coilInnerR); } + } catch (ClassCastException e) - { - throw new RuntimeException(e); - } + { + throw new RuntimeException(e); + } try + { + Solenoid s = (Solenoid) detector.getFields().get("GlobalSolenoid"); + if (s != null) { - Solenoid s = (Solenoid) detector.getFields().get("GlobalSolenoid"); - if (s != null) - { - bfield = s.getField(new BasicHep3Vector(0, 0, 0)).z(); - coilMaxZ = s.getZMax(); - } + bfield = s.getField(new BasicHep3Vector(0, 0, 0)).z(); + coilMaxZ = s.getZMax(); } + } catch (ClassCastException e) - { - throw new RuntimeException(e); - } + { + throw new RuntimeException(e); + } Element coil = new Element("coil"); coil.setAttribute("radLen", xlen.format(coilRadLen)); @@ -826,42 +833,42 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { IDDescriptor descr = subdet.getIDDecoder().getIDDescription(); Element id = new Element("id"); for (int i = 0, j = descr.fieldCount(); i < j; i++) - { - Element field = new Element("field"); - field.setAttribute("name", descr.fieldName(i)); - field.setAttribute("length", Integer.toString(descr.fieldLength(i))); - field.setAttribute("start", Integer.toString(descr.fieldStart(i))); - field.setAttribute("signed", Boolean.toString(descr.isSigned(i))); + { + Element field = new Element("field"); + field.setAttribute("name", descr.fieldName(i)); + field.setAttribute("length", Integer.toString(descr.fieldLength(i))); + field.setAttribute("start", Integer.toString(descr.fieldStart(i))); + field.setAttribute("signed", Boolean.toString(descr.isSigned(i))); - id.addContent(field); - } + id.addContent(field); + } return id; } private List<Double> getCellSizes(Subdetector subdetector) + { + List<Double> cellSizes = new ArrayList<Double>(); + BaseIDDecoder dec = (BaseIDDecoder) subdetector.getReadout().getIDDecoder(); + if (dec instanceof AbstractCartesianGrid) { - List<Double> cellSizes = new ArrayList<Double>(); - BaseIDDecoder dec = (BaseIDDecoder) subdetector.getReadout().getIDDecoder(); - if (dec instanceof AbstractCartesianGrid) - { - AbstractCartesianGrid cgrid = (AbstractCartesianGrid) dec; - if (cgrid.getGridSizeX() != 0) - { - cellSizes.add(cgrid.getGridSizeX()); - } - if (cgrid.getGridSizeY() != 0) - { - cellSizes.add(cgrid.getGridSizeY()); - } - if (cgrid.getGridSizeZ() != 0) - { - cellSizes.add(cgrid.getGridSizeZ()); - } - } - if (cellSizes.size() != 2) - throw new RuntimeException("Only 2 cell dimensions are allowed."); - return cellSizes; + AbstractCartesianGrid cgrid = (AbstractCartesianGrid) dec; + if (cgrid.getGridSizeX() != 0) + { + cellSizes.add(cgrid.getGridSizeX()); + } + if (cgrid.getGridSizeY() != 0) + { + cellSizes.add(cgrid.getGridSizeY()); + } + if (cgrid.getGridSizeZ() != 0) + { + cellSizes.add(cgrid.getGridSizeZ()); + } } + if (cellSizes.size() != 2) + throw new RuntimeException("Only 2 cell dimensions are allowed."); + return cellSizes; + } public String getOutputFormat() { @@ -874,19 +881,19 @@ static long create_lcdd(LCDD& /* lcdd */, int /* argc */, char** /* argv */) { } private static class PandoraFileFilter extends FileFilter - { + { public boolean accept(java.io.File file) - { - return file.getName().endsWith(".xml"); - } + { + return file.getName().endsWith(".xml"); + } public String getDescription() { return "Pandora Geometry file (*.xml)"; } - } - } + } + } #endif } DECLARE_APPLY(DD4hepGeometry2PANDORA,create_lcdd) diff --git a/DDCore/src/plugins/PluginInvoker.cpp b/DDCore/src/plugins/PluginInvoker.cpp index d0b7636f07d258585e016a53d13550741fd1549b..2f702ca7dda44ff5a09a18e72e34f3c66ed9b498 100644 --- a/DDCore/src/plugins/PluginInvoker.cpp +++ b/DDCore/src/plugins/PluginInvoker.cpp @@ -1,11 +1,16 @@ -// $Id: Compact2Objects.cpp 1059 2014-04-04 20:24:53Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DD4hep/LCDD.h" diff --git a/DDCore/src/plugins/ShapePlugins.cpp b/DDCore/src/plugins/ShapePlugins.cpp index a17edaf9382cd34609ad34122bf3d7488c881cf7..c3c0a726577202b460104087576ffbff9a1f312b 100644 --- a/DDCore/src/plugins/ShapePlugins.cpp +++ b/DDCore/src/plugins/ShapePlugins.cpp @@ -1,13 +1,16 @@ -// $Id: StandardPlugins.cpp 1224 2014-06-19 19:26:59Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Standard plugins necessary for nearly everything. +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -// Author : M.Frank +// Author : M.Frank // -//==================================================================== +//========================================================================== // Framework include files #include "DD4hep/DetFactoryHelper.h" @@ -221,7 +224,7 @@ static Ref_t create_BooleanShape(lcdd_t&, xml_h element) { } else{ throw std::runtime_error(std::string(" create_BooleanShape - unknown operation given: ") + op + - std::string(" - needs to be one of 'subtraction','union' or 'intersection' ") ) ; + std::string(" - needs to be one of 'subtraction','union' or 'intersection' ") ) ; } diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index 06c6a2553555f7b2a840e5032755e82c5d00c409..d5392d9f84bab5daf5256d21be83267d11be3cb2 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -1,13 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Standard plugins necessary for nearly everything. +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -// Author : M.Frank +// Author : M.Frank // -//==================================================================== +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" @@ -167,19 +170,19 @@ static long dump_volume_tree(LCDD& lcdd, int , char** ) { static long dump(TGeoNode* ideal, TGeoNode* aligned,int level) { char fmt[256]; if ( ideal == aligned ) { - ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s \t\tNode:%p",level+1,2*level+1,(void*)ideal); + ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s \t\tNode:%p",level+1,2*level+1,(void*)ideal); } else { - ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s Ideal node:%p Aligned node:%p", - level+1,2*level+1,(void*)ideal,(void*)aligned); + ::snprintf(fmt,sizeof(fmt),"%03d %%-%ds %%s Ideal node:%p Aligned node:%p", + level+1,2*level+1,(void*)ideal,(void*)aligned); } printout(INFO,"+++",fmt,"",aligned->GetName()); TGeoVolume* volume = ideal->GetVolume(); for (Int_t idau = 0, ndau = aligned->GetNdaughters(); idau < ndau; ++idau) { - TGeoNode* ideal_daughter = ideal->GetDaughter(idau); - const char* daughter_name = ideal_daughter->GetName(); - TGeoNode* aligned_daughter = volume->GetNode(daughter_name); - dump(ideal_daughter,aligned_daughter,level+1); + TGeoNode* ideal_daughter = ideal->GetDaughter(idau); + const char* daughter_name = ideal_daughter->GetName(); + TGeoNode* aligned_daughter = volume->GetNode(daughter_name); + dump(ideal_daughter,aligned_daughter,level+1); } return 1; } @@ -204,25 +207,25 @@ template <int flag> long dump_detelement_tree(LCDD& lcdd, int argc, char** argv) static long dump(DetElement de,int level, bool sensitive_only) { const DetElement::Children& c = de.children(); if ( !sensitive_only || 0 != de.volumeID() ) { - int value = flag; - char fmt[64]; - switch(value) { - case 0: - ::sprintf(fmt,"%03d %%-%ds %%s #Dau:%%d VolID:%%p",level+1,2*level+1); - printout(INFO,"+++",fmt,"",de.path().c_str(),int(c.size()),(void*)de.volumeID()); - break; - case 1: - ::sprintf(fmt,"%03d %%-%ds Detector: %%s #Dau:%%d VolID:%%p",level+1,2*level+1); - printout(INFO,"+++",fmt,"",de.path().c_str(),int(c.size()),(void*)de.volumeID()); - ::sprintf(fmt,"%03d %%-%ds Placement: %%s",level+1,2*level+3); - printout(INFO,"+++",fmt,"",de.placementPath().c_str()); - break; - default: - break; - } + int value = flag; + char fmt[64]; + switch(value) { + case 0: + ::sprintf(fmt,"%03d %%-%ds %%s #Dau:%%d VolID:%%p",level+1,2*level+1); + printout(INFO,"+++",fmt,"",de.path().c_str(),int(c.size()),(void*)de.volumeID()); + break; + case 1: + ::sprintf(fmt,"%03d %%-%ds Detector: %%s #Dau:%%d VolID:%%p",level+1,2*level+1); + printout(INFO,"+++",fmt,"",de.path().c_str(),int(c.size()),(void*)de.volumeID()); + ::sprintf(fmt,"%03d %%-%ds Placement: %%s",level+1,2*level+3); + printout(INFO,"+++",fmt,"",de.placementPath().c_str()); + break; + default: + break; + } } for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) - dump((*i).second,level+1,sensitive_only); + dump((*i).second,level+1,sensitive_only); return 1; } }; @@ -250,7 +253,7 @@ static long detelement_cache(LCDD& lcdd, int , char** ) { de.placementPath(); de.path(); for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) - cache((*i).second); + cache((*i).second); return 1; } }; diff --git a/DDCore/src/plugins/VolumeMgrTest.cpp b/DDCore/src/plugins/VolumeMgrTest.cpp index a4052cf6aff661d8c9d0f6687e7ab58d15f3578d..05328174ffef4f732426742171d8135e3525fc75 100644 --- a/DDCore/src/plugins/VolumeMgrTest.cpp +++ b/DDCore/src/plugins/VolumeMgrTest.cpp @@ -1,11 +1,16 @@ -// $Id: TubeSegment_geo.cpp 633 2013-06-21 13:50:50Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt index b881c88539accc7945f40b63c52713ca46fcb434..dc6e60a92a71a9df452906eae82f35f793ee489d 100644 --- a/DDEve/CMakeLists.txt +++ b/DDEve/CMakeLists.txt @@ -1,8 +1,20 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) #--------------------------- set( PackageName DDEve ) -#---add additional packages here-------------------------------------------------- +#---add additional packages here------------------------------------------- if(DD4HEP_BUILD_ALL) find_package( DD4hep ) endif() @@ -10,33 +22,33 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) include( DD4hep ) find_package( ROOT REQUIRED ) -#---Includedirs ------------------------------------------------------------------ +#---Includedirs ----------------------------------------------------------- if(DD4HEP_USE_GEANT4) include_directories(${CMAKE_SOURCE_DIR}/DDCore/include ${CMAKE_SOURCE_DIR}/DDSegmentation/include ${CMAKE_SOURCE_DIR}/DDG4/include ${CMAKE_CURRENT_SOURCE_DIR}/include - ${DD4hep_INCLUDE_DIRS} +# ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ) else() include_directories(${CMAKE_SOURCE_DIR}/DDCore/include ${CMAKE_SOURCE_DIR}/DDSegmentation/include ${CMAKE_CURRENT_SOURCE_DIR}/include - ${DD4hep_INCLUDE_DIRS} +# ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ) endif() -#---DDEve library -------------------------------------------------------------- +#---DDEve library --------------------------------------------------------- file(GLOB headers include/DDEve/*.h) file(GLOB sources src/*.cpp) set( eve_link_libraries DDCore ${ROOT_EVE_LIBRARIES} -lFTGL ) -#--------------------------- Support for the LCIO data I/O ------------------------ +#--------------------------- Support for the LCIO data I/O --------------- if(DD4HEP_USE_LCIO) find_package(LCIO REQUIRED) include_directories( ${LCIO_INCLUDE_DIRS} ) list(APPEND sources lcio/LCIOEventHandler.cpp) list(APPEND eve_link_libraries ${LCIO_LIBRARIES} ) endif() -#--------------------------- Support for the DDG4 data I/O ------------------------ +#--------------------------- Support for the DDG4 data I/O --------------- if(DD4HEP_USE_GEANT4) root_generate_dictionary( G__DDG4IO ${CMAKE_CURRENT_SOURCE_DIR}/DDEve/DDG4IO.C LINKDEF ${CMAKE_SOURCE_DIR}/DDCore/include/ROOT/LinkDef.h ) list(APPEND sources G__DDG4IO.cxx) @@ -51,9 +63,9 @@ target_link_libraries(DDEve ${eve_link_libraries}) SET_TARGET_PROPERTIES(DDEve PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) -#---DDEve rootmap -------------------------------------------------------------- +#---DDEve rootmap --------------------------------------------------------- dd4hep_generate_rootmap(DDEve) -#---Package installation procedure(s) ---------------------------------------------- +#---Package installation procedure(s) ------------------------------------- install(DIRECTORY include/DDEve DESTINATION include PATTERN ".svn" EXCLUDE ) diff --git a/DDEve/DDEve/DDEve.C b/DDEve/DDEve/DDEve.C index 0ee7856c6c99018f0c3511c0ec747b34fdce963f..5a047274fc11767dfb988bbb9cee99c613bf767b 100644 --- a/DDEve/DDEve/DDEve.C +++ b/DDEve/DDEve/DDEve.C @@ -1,3 +1,17 @@ +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + #include <string> #include <cerrno> #include "TError.h" diff --git a/DDEve/DDEve/DDG4IO.C b/DDEve/DDEve/DDG4IO.C index 95b02705bb351e29b8842ef11ee9e33a82de351e..e5b82293f10438c3f5bb013b7aeebd4e73d9d295 100644 --- a/DDEve/DDEve/DDG4IO.C +++ b/DDEve/DDEve/DDG4IO.C @@ -1,13 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== -// Framework include files - +// Author : M.Frank +// +//========================================================================== #define __DDG4_STANDALONE_DICTIONARIES__ // C/C++ include files diff --git a/DDEve/include/DDEve/Annotation.h b/DDEve/include/DDEve/Annotation.h index a8df29f7622d9fa2aac9e37253dabc8c5eb8feb1..9673b1fb543a7c0d28f80f9c44d2de3b8d2cd94c 100644 --- a/DDEve/include/DDEve/Annotation.h +++ b/DDEve/include/DDEve/Annotation.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_ANNOTATION_H #define DD4HEP_DDEVE_ANNOTATION_H diff --git a/DDEve/include/DDEve/Calo2DProjection.h b/DDEve/include/DDEve/Calo2DProjection.h index ee85ce171f2fea7cb0860d964a42dff9584307be..1ab748d2a7207456410b6970e9442da5af7c87c6 100644 --- a/DDEve/include/DDEve/Calo2DProjection.h +++ b/DDEve/include/DDEve/Calo2DProjection.h @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// Original Author: Matevz Tadel 2009 (MultiView.C) +// +//========================================================================== #ifndef DD4HEP_DDEVE_CALO2DPROJECTION_H #define DD4HEP_DDEVE_CALO2DPROJECTION_H diff --git a/DDEve/include/DDEve/Calo3DProjection.h b/DDEve/include/DDEve/Calo3DProjection.h index 72f84d41f7e673f0a4d4b0676e08262566d0e4a5..90aae36e10133cdcd92dccefedc3914b3f58296b 100644 --- a/DDEve/include/DDEve/Calo3DProjection.h +++ b/DDEve/include/DDEve/Calo3DProjection.h @@ -1,10 +1,15 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// Author : M.Frank +// Original Author: Matevz Tadel 2009 (MultiView.C) // //==================================================================== #ifndef DD4HEP_DDEVE_CALO3DPROJECTION_H diff --git a/DDEve/include/DDEve/CaloLego.h b/DDEve/include/DDEve/CaloLego.h index 906aa57b6b16da46c04bf0bdd241e90578ef69a4..38102de04a350d7ad9d20f5fc31047f7bc67f75e 100644 --- a/DDEve/include/DDEve/CaloLego.h +++ b/DDEve/include/DDEve/CaloLego.h @@ -1,10 +1,15 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// Author : M.Frank +// Original Author: Matevz Tadel 2009 (MultiView.C) // //==================================================================== #ifndef DD4HEP_DDEVE_CALOLEGO_H diff --git a/DDEve/include/DDEve/ContextMenu.h b/DDEve/include/DDEve/ContextMenu.h index 4f1e37d5ff6b578078b75298d4464a25aadf2586..69f3871f0427036842f493fac2f9e8582c0d6708 100644 --- a/DDEve/include/DDEve/ContextMenu.h +++ b/DDEve/include/DDEve/ContextMenu.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_CONTEXTMENU_H #define DD4HEP_DDEVE_CONTEXTMENU_H @@ -75,7 +80,7 @@ namespace DD4hep { ContextMenu& AddSeparator(); /// Add a user item to the menu template <typename Q,typename T> - ContextMenu& Add(const std::string& title, Q* ptr, void (T::*pmf)(TObject*, void* ud), void* ud=0) { + ContextMenu& Add(const std::string& title, Q* ptr, void (T::*pmf)(TObject*, void* ud), void* ud=0) { return Add(title, Callback(ptr).make(pmf), ud); } /// Root implementation macro diff --git a/DDEve/include/DDEve/DD4hepMenu.h b/DDEve/include/DDEve/DD4hepMenu.h index eba39e3d6f26c50e07c4b8013cadd90853cb14a9..311b7e95df13dc0dbc5bffe8d464f9f3f6e89365 100644 --- a/DDEve/include/DDEve/DD4hepMenu.h +++ b/DDEve/include/DDEve/DD4hepMenu.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_DD4HEPMENU_H #define DD4HEP_DDEVE_DD4HEPMENU_H diff --git a/DDEve/include/DDEve/DDEveEventData.h b/DDEve/include/DDEve/DDEveEventData.h index d562e02462756c8de4d8fec7737cbe709dc7f6a6..5abb27fcbb96424752c41517e018e841d42742ea 100644 --- a/DDEve/include/DDEve/DDEveEventData.h +++ b/DDEve/include/DDEve/DDEveEventData.h @@ -1,11 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDEVE_DDEVEHIT_H #define DD4HEP_DDEVE_DDEVEHIT_H diff --git a/DDEve/include/DDEve/DDG4EventHandler.h b/DDEve/include/DDEve/DDG4EventHandler.h index 5d7f65b977524569de4b81159d55301ac8aa6cef..a877137fca80943d825239f8f90f63d5fcf674f0 100644 --- a/DDEve/include/DDEve/DDG4EventHandler.h +++ b/DDEve/include/DDEve/DDG4EventHandler.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_DDG4EVENTHANDLER_H #define DD4HEP_DDEVE_DDG4EVENTHANDLER_H diff --git a/DDEve/include/DDEve/Dictionary.h b/DDEve/include/DDEve/Dictionary.h index c889664017e28deaa5b3e0808080f2300d9f442f..d5686f131a7849c535975d9923760f0f7bfbcb25 100644 --- a/DDEve/include/DDEve/Dictionary.h +++ b/DDEve/include/DDEve/Dictionary.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_DICTIONARY_H #define DD4HEP_DDEVE_DICTIONARY_H diff --git a/DDEve/include/DDEve/Display.h b/DDEve/include/DDEve/Display.h index 05f6cc37284681b1436b5ed8e3cce500acb5a11e..1ba1bcabe6b409f8764b3d25ba683e526adec358 100644 --- a/DDEve/include/DDEve/Display.h +++ b/DDEve/include/DDEve/Display.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_DISPLAY_H #define DD4HEP_DDEVE_DISPLAY_H diff --git a/DDEve/include/DDEve/DisplayConfiguration.h b/DDEve/include/DDEve/DisplayConfiguration.h index b401fcd1fe49e97d713d477bb3e99230061366e5..07e55d0e01fd47cb8caaf6674d43892a6fce5158 100644 --- a/DDEve/include/DDEve/DisplayConfiguration.h +++ b/DDEve/include/DDEve/DisplayConfiguration.h @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // // Author : M.Frank // Original Author: Matevz Tadel 2009 (MultiView.C) // -//==================================================================== +//========================================================================== #ifndef DD4HEP_DDEVE_DISPLAYCONFIGURATION_H #define DD4HEP_DDEVE_DISPLAYCONFIGURATION_H @@ -35,10 +40,10 @@ namespace DD4hep { Display* m_display; public: enum { CALODATA=1<<1, - DETELEMENT=1<<2, - VIEW=1<<3, - PANEL=1<<4, - COLLECTION=1<<5 + DETELEMENT=1<<2, + VIEW=1<<3, + PANEL=1<<4, + COLLECTION=1<<5 }; struct Defaults { char load_geo; @@ -70,12 +75,12 @@ namespace DD4hep { class Config { public: union Values { - double vals[20]; - Defaults defaults; - Calo3D calo3d; - Calodata calodata; - Panel pane; - Hits hits; + double vals[20]; + Defaults defaults; + Calo3D calo3d; + Calodata calodata; + Panel pane; + Hits hits; } data; std::string name; std::string hits; diff --git a/DDEve/include/DDEve/ElementList.h b/DDEve/include/DDEve/ElementList.h index bf5210cf9f7f88eec83da30aa3e9e1c673e78abc..32db5dab290f8a89153483a2f89d9ec82a6de7f9 100644 --- a/DDEve/include/DDEve/ElementList.h +++ b/DDEve/include/DDEve/ElementList.h @@ -1,12 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_ELEMENTLIST_H #define DD4HEP_DDEVE_ELEMENTLIST_H diff --git a/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h b/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h index b33cb74242437b96e89cfbb98eb4c2b45aa425b6..6724e5d037546e7d338cb3566bc2dc9688fb0e51 100644 --- a/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h +++ b/DDEve/include/DDEve/EvePgonSetProjectedContextMenu.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_EVEPGONSETPROJECTEDCONTEXTMENU_H #define DD4HEP_DDEVE_EVEPGONSETPROJECTEDCONTEXTMENU_H diff --git a/DDEve/include/DDEve/EveShapeContextMenu.h b/DDEve/include/DDEve/EveShapeContextMenu.h index f9eba87f5cee14e3e65d078e8fad52c2fa49b1f9..dc4c929ff5c037072043bef3d1fb1b1fd6ee1a9b 100644 --- a/DDEve/include/DDEve/EveShapeContextMenu.h +++ b/DDEve/include/DDEve/EveShapeContextMenu.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_EVESHAPECONTEXTMENU_H #define DD4HEP_DDEVE_EVESHAPECONTEXTMENU_H diff --git a/DDEve/include/DDEve/EveUserContextMenu.h b/DDEve/include/DDEve/EveUserContextMenu.h index ba9f40eb0b39aaab672b4b20531759ea556836d8..2a6f863b97222b83f2855930a15eab7dc8bb470c 100644 --- a/DDEve/include/DDEve/EveUserContextMenu.h +++ b/DDEve/include/DDEve/EveUserContextMenu.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_EVEUSERCONTEXTMENU_H #define DD4HEP_DDEVE_EVEUSERCONTEXTMENU_H diff --git a/DDEve/include/DDEve/EventControl.h b/DDEve/include/DDEve/EventControl.h index b2348065296307bbd1a89c65cc5844b5c55bb55d..e39df0b84d994e0767d4d63e1fcc669fba2bf9b1 100644 --- a/DDEve/include/DDEve/EventControl.h +++ b/DDEve/include/DDEve/EventControl.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_EVENTCONTROL_H #define DD4HEP_DDEVE_EVENTCONTROL_H diff --git a/DDEve/include/DDEve/EventHandler.h b/DDEve/include/DDEve/EventHandler.h index 153008360c0f7f088c8baa31788383f3addf8cda..d1153b644519dfe5720cc231c9ff386f77aa59ee 100644 --- a/DDEve/include/DDEve/EventHandler.h +++ b/DDEve/include/DDEve/EventHandler.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_EVENTHANDLER_H #define DD4HEP_DDEVE_EVENTHANDLER_H @@ -108,7 +113,7 @@ namespace DD4hep { /// Goto a specified event in the file virtual bool GotoEvent(long event_number) = 0; - ClassDef(EventHandler,0); + ClassDef(EventHandler,0); }; /** @class EventConsumer EventHandler.h DDEve/EventHandler.h diff --git a/DDEve/include/DDEve/Factories.h b/DDEve/include/DDEve/Factories.h index 95d6b16360e501d1f31f73ced5d18761671eb940..9aac8050633b604acab19b773b4d29692879cf99 100644 --- a/DDEve/include/DDEve/Factories.h +++ b/DDEve/include/DDEve/Factories.h @@ -1,11 +1,16 @@ -// $Id: Factories.h 1201 2014-06-02 18:21:45Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description -//-------------------------------------------------------------------- +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_FACTORIES_H #define DD4HEP_DDEVE_FACTORIES_H @@ -15,34 +20,15 @@ #include "DDEve/View.h" #include "DDEve/Display.h" -/// Namespace for the AIDA detector description toolkit -namespace DD4hep { - - // Forward declarations - class View; - class Display; - - /// Factory template for view objects - template <typename T> class ViewFactory { - public: - static View* create(Display* dis, const char* arg); - }; - -} - namespace { - /// Base factory template template <typename P, typename S> class Factory; - - template <typename P> class Factory<P, DD4hep::View*(DD4hep::Display* dis, const char*)> { - public: - static void Func(void *ret, void*, const std::vector<void*>& arg, void*) { - *(void**)ret = new P((DD4hep::Display*)arg[0], (const char*) arg[1]); - } - }; + + /// DDEve view factory + DD4HEP_PLUGIN_FACTORY_ARGS_2(DD4hep::View*,DD4hep::Display*,const char*) { return new P(a0,a1); } } -#define DECLARE_VIEW_FACTORY(x) DD4HEP_PLUGINSVC_FACTORY(x,DD4hep_DDEve_##x,DD4hep::View*(DD4hep::Display*, const char*),__LINE__) +#define DECLARE_VIEW_FACTORY(x) \ +DD4HEP_PLUGINSVC_FACTORY(x,DD4hep_DDEve_##x,DD4hep::View*(DD4hep::Display*, const char*),__LINE__) #endif // DD4HEP_DDEVE_FACTORIES_H diff --git a/DDEve/include/DDEve/FrameControl.h b/DDEve/include/DDEve/FrameControl.h index fc57e61cb44962c18d23f98e1278fdf309a9ff10..c3015451bbcb28acb658c50706329a8742287ab5 100644 --- a/DDEve/include/DDEve/FrameControl.h +++ b/DDEve/include/DDEve/FrameControl.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_FRAMECONTROL_H #define DD4HEP_DDEVE_FRAMECONTROL_H diff --git a/DDEve/include/DDEve/GenericEventHandler.h b/DDEve/include/DDEve/GenericEventHandler.h index d0eb13eed8345cedc6ed531de5aa2dc7135a9fae..a50344923296efe1021c74ec248017efbc1a1815 100644 --- a/DDEve/include/DDEve/GenericEventHandler.h +++ b/DDEve/include/DDEve/GenericEventHandler.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_GENERICEVENTHANDLER_H #define DD4HEP_DDEVE_GENERICEVENTHANDLER_H diff --git a/DDEve/include/DDEve/HitActors.h b/DDEve/include/DDEve/HitActors.h index 1c87b2d686704c0fa05d7ab00cbb4687593ebb74..78f7d7790d8c000618ad2945469436790f50b46f 100644 --- a/DDEve/include/DDEve/HitActors.h +++ b/DDEve/include/DDEve/HitActors.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_HITHANDLERS_H #define DD4HEP_DDEVE_HITHANDLERS_H @@ -37,7 +42,7 @@ namespace DD4hep { }; /// Fill a 3D pointset from a hit collection. - /* + /* * \author M.Frank * \version 1.0 * \ingroup DD4HEP_EVE @@ -88,11 +93,11 @@ namespace DD4hep { */ struct TowersetCreator : public BoxsetCreator { /// Standard initializing constructor - TowersetCreator(const std::string& collection, size_t length) - : BoxsetCreator(collection,length) {} + TowersetCreator(const std::string& collection, size_t length) + : BoxsetCreator(collection,length) {} /// Standard initializing constructor - TowersetCreator(const std::string& collection, size_t length, const DisplayConfiguration::Config& cfg) - : BoxsetCreator(collection, length, cfg) {} + TowersetCreator(const std::string& collection, size_t length, const DisplayConfiguration::Config& cfg) + : BoxsetCreator(collection, length, cfg) {} /// Standard destructor virtual ~TowersetCreator() {} /// Action callback of this functor: diff --git a/DDEve/include/DDEve/MultiView.h b/DDEve/include/DDEve/MultiView.h index d4061e37d1cc5ef30ddfda8f7d3b339d2a620779..f1b01d06f0f7030dc8e9073393b4b4bc8ac3a981 100644 --- a/DDEve/include/DDEve/MultiView.h +++ b/DDEve/include/DDEve/MultiView.h @@ -1,12 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_MULTIVIEW_H #define DD4HEP_DDEVE_MULTIVIEW_H diff --git a/DDEve/include/DDEve/ParticleActors.h b/DDEve/include/DDEve/ParticleActors.h index 7442a78f2f744a9ce2c62b15b90e1ad5cb52698c..ab88bceb8396d8dc04b0a6543e132a2332dc1eaa 100644 --- a/DDEve/include/DDEve/ParticleActors.h +++ b/DDEve/include/DDEve/ParticleActors.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_PARTICLEHANDLERS_H #define DD4HEP_DDEVE_PARTICLEHANDLERS_H diff --git a/DDEve/include/DDEve/PopupMenu.h b/DDEve/include/DDEve/PopupMenu.h index 1da9ad4dd4b1032c913197c5754d5200d23a0277..8a0e9f64181149fc183eac01e001f6a72840b927 100644 --- a/DDEve/include/DDEve/PopupMenu.h +++ b/DDEve/include/DDEve/PopupMenu.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_POPUPMENU_H #define DD4HEP_DDEVE_POPUPMENU_H @@ -61,7 +66,7 @@ namespace DD4hep { virtual int AddEntry(const char* name, Callback cb, void* ud=0, const TGPicture* p=0, TGMenuEntry* before=0); /// Add a new popup menu entry with a callback template <typename T> - int AddEntry(const char* name, T* ptr, void (T::*pmf)(TGMenuEntry*, void*), void* ud=0, const TGPicture* p=0, TGMenuEntry* before=0) { + int AddEntry(const char* name, T* ptr, void (T::*pmf)(TGMenuEntry*, void*), void* ud=0, const TGPicture* p=0, TGMenuEntry* before=0) { return AddEntry(name, Callback(ptr).make(pmf), ud, p, before); } /// Check menu entry diff --git a/DDEve/include/DDEve/Projection.h b/DDEve/include/DDEve/Projection.h index 2c0d5006f3acbe8e2b5fb43b01f91c6e7eaba8fc..5dcb7057fee84fc3bc367ed34719acd0bf317e47 100644 --- a/DDEve/include/DDEve/Projection.h +++ b/DDEve/include/DDEve/Projection.h @@ -1,12 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_PROJECTION_H #define DD4HEP_DDEVE_PROJECTION_H diff --git a/DDEve/include/DDEve/RhoPhiProjection.h b/DDEve/include/DDEve/RhoPhiProjection.h index cd5aededdb404154ec696dc724a84e22cad1e5dd..5322443ca88205a9c9d9dafd711c6e722a6fcefa 100644 --- a/DDEve/include/DDEve/RhoPhiProjection.h +++ b/DDEve/include/DDEve/RhoPhiProjection.h @@ -1,7 +1,12 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // // Author : M.Frank // Original Author: Matevz Tadel 2009 (MultiView.C) diff --git a/DDEve/include/DDEve/RhoZProjection.h b/DDEve/include/DDEve/RhoZProjection.h index 9c209d18c2a4a35a400e24a225685e0e87adebda..7400f9d07bdc9dc78b924ed912a6e758a2870378 100644 --- a/DDEve/include/DDEve/RhoZProjection.h +++ b/DDEve/include/DDEve/RhoZProjection.h @@ -1,7 +1,12 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // // Author : M.Frank // Original Author: Matevz Tadel 2009 (MultiView.C) diff --git a/DDEve/include/DDEve/Utilities.h b/DDEve/include/DDEve/Utilities.h index db0ba4a083defc97fdfee6d663c11c9b5a5e5e65..70cd338eb6842fce5f0d68802e77b25ff071109a 100644 --- a/DDEve/include/DDEve/Utilities.h +++ b/DDEve/include/DDEve/Utilities.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_UTILITIES_H #define DD4HEP_DDEVE_UTILITIES_H @@ -24,10 +29,10 @@ namespace DD4hep { int findNodeWithMatrix(TGeoNode* p, TGeoNode* n, TGeoHMatrix* mat, std::string* sub_path=0); std::pair<bool,TEveElement*> - createEveShape(int level, int max_level, TEveElement* p, TGeoNode* n, TGeoHMatrix mat, const std::string& node_name); + createEveShape(int level, int max_level, TEveElement* p, TGeoNode* n, TGeoHMatrix mat, const std::string& node_name); std::pair<bool,TEveElement*> - LoadDetElement(Geometry::DetElement element,int levels, TEveElement* parent); + LoadDetElement(Geometry::DetElement element,int levels, TEveElement* parent); /// Make a set of nodes starting from a top element (in-)visible with a given depth void MakeNodesVisible(TEveElement* e, bool visible, int level); diff --git a/DDEve/include/DDEve/View.h b/DDEve/include/DDEve/View.h index d931871d36cdafd237d0e3c2da6a49cef4db7772..56c8e04dc1c462842d94379f3dbc3f0a407028fa 100644 --- a/DDEve/include/DDEve/View.h +++ b/DDEve/include/DDEve/View.h @@ -1,12 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_VIEW_H #define DD4HEP_DDEVE_VIEW_H @@ -114,10 +118,10 @@ namespace DD4hep { /// Create a new instance of the geometry of a sub-detector virtual std::pair<bool,TEveElement*> - CreateGeometry(DetElement de, const DisplayConfiguration::Config& cfg); + CreateGeometry(DetElement de, const DisplayConfiguration::Config& cfg); /// Access the global instance of the subdetector geometry virtual std::pair<bool,TEveElement*> - GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config& cfg); + GetGlobalGeometry(DetElement de, const DisplayConfiguration::Config& cfg); /// Call to import geometry elements into topics diff --git a/DDEve/include/DDEve/View3D.h b/DDEve/include/DDEve/View3D.h index 3c06bd3410ab32d47c28ad20ffeb7b697bd389a5..4814e5e0e0dc342957a42e71455366c7729708ff 100644 --- a/DDEve/include/DDEve/View3D.h +++ b/DDEve/include/DDEve/View3D.h @@ -1,12 +1,18 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// // // Author : M.Frank // Original Author: Matevz Tadel 2009 (MultiView.C) // -//==================================================================== +//========================================================================== #ifndef DD4HEP_DDEVE_VIEW3D_H #define DD4HEP_DDEVE_VIEW3D_H diff --git a/DDEve/include/DDEve/ViewMenu.h b/DDEve/include/DDEve/ViewMenu.h index 201d3f51d26cc8d71cbdae5abca6440281eeb992..707540c37d410be35283c656c5613708a8803042 100644 --- a/DDEve/include/DDEve/ViewMenu.h +++ b/DDEve/include/DDEve/ViewMenu.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_VIEWMENU_H #define DD4HEP_DDEVE_VIEWMENU_H diff --git a/DDEve/lcio/LCIOEventHandler.cpp b/DDEve/lcio/LCIOEventHandler.cpp index 39a448aa77d01c0b864415c71ffd5bb336bf1154..bfbb14c66368c27294ab96b384fdf9a317df7bbc 100644 --- a/DDEve/lcio/LCIOEventHandler.cpp +++ b/DDEve/lcio/LCIOEventHandler.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "LCIOEventHandler.h" @@ -90,10 +95,10 @@ long LCIOEventHandler::numEvents() const { EventHandler::CollectionType LCIOEventHandler::collectionType(const std::string& /* collection */) const { return CALO_HIT_COLLECTION; #if 0 - if ( cl == cl_calo ) return CALO_HIT_COLLECTION; - else if ( cl == cl_tracker ) return TRACKER_HIT_COLLECTION; - else if ( cl == cl_particles ) return PARTICLE_COLLECTION; - else return NO_COLLECTION; + if ( cl == cl_calo ) return CALO_HIT_COLLECTION; + else if ( cl == cl_tracker ) return TRACKER_HIT_COLLECTION; + else if ( cl == cl_particles ) return PARTICLE_COLLECTION; + else return NO_COLLECTION; #endif } @@ -107,10 +112,10 @@ size_t LCIOEventHandler::collectionLoop(const std::string& collection, DDEveHitA int n = c->getNumberOfElements(); actor.setSize(n); for(int i=0; i<n; ++i) { - LCObject* ptr = c->getElementAt(i); - if ( _convertHitFunc(ptr,&hit) ) { - actor(hit); - } + LCObject* ptr = c->getElementAt(i); + if ( _convertHitFunc(ptr,&hit) ) { + actor(hit); + } } return n; } @@ -128,10 +133,10 @@ size_t LCIOEventHandler::collectionLoop(const std::string& collection, DDEvePart int n = c->getNumberOfElements(); actor.setSize(n); for(int i=0; i<n; ++i) { - LCObject* ptr = c->getElementAt(i); - if ( _convertParticleFunc(ptr,&part) ) { - actor(part); - } + LCObject* ptr = c->getElementAt(i); + if ( _convertParticleFunc(ptr,&part) ) { + actor(part); + } } return n; } @@ -163,9 +168,9 @@ bool LCIOEventHandler::NextEvent() { if ( m_event ) { const std::vector<std::string>* collnames = m_event->getCollectionNames(); for( std::vector< std::string >::const_iterator i = collnames->begin(); i != collnames->end(); i++){ - LCCollection* c = m_event->getCollection(*i); - m_data[c->getTypeName()].push_back(make_pair((*i).c_str(),c->getNumberOfElements())); - m_branches[*i] = c; + LCCollection* c = m_event->getCollection(*i); + m_data[c->getTypeName()].push_back(make_pair((*i).c_str(),c->getNumberOfElements())); + m_branches[*i] = c; } m_hasEvent = true; return 1; @@ -178,11 +183,11 @@ bool LCIOEventHandler::NextEvent() { /// Load the previous event bool LCIOEventHandler::PreviousEvent() { throw runtime_error("+++ This version of the LCIO reader can only access files sequentially!\n" - "+++ Access to the previous event is not supported."); + "+++ Access to the previous event is not supported."); } /// Goto a specified event in the file bool LCIOEventHandler::GotoEvent(long /* event_number */) { throw runtime_error("+++ This version of the LCIO reader can only access files sequentially!\n" - "+++ Random access is not supported."); + "+++ Random access is not supported."); } diff --git a/DDEve/lcio/LCIOEventHandler.h b/DDEve/lcio/LCIOEventHandler.h index e574c5e91df9499241165e044943f4b91e33ef28..f98ae2f8172d31cf57221991bb4d7c42792ba939 100644 --- a/DDEve/lcio/LCIOEventHandler.h +++ b/DDEve/lcio/LCIOEventHandler.h @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDEVE_LCIOEVENTHANDLER_H #define DD4HEP_DDEVE_LCIOEVENTHANDLER_H diff --git a/DDEve/src/Annotation.cpp b/DDEve/src/Annotation.cpp index f8e878786fb3b52931dbc5e0db981e4987e81b32..244dee0605b6bc686bb6a6bd317589c5a3119a01 100644 --- a/DDEve/src/Annotation.cpp +++ b/DDEve/src/Annotation.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/Annotation.h" diff --git a/DDEve/src/Calo2DProjection.cpp b/DDEve/src/Calo2DProjection.cpp index 1897425b9b25aadff6938f233ea52e436a5cd854..daeb73897f1aff594543d41d052901cc34cfb28e 100644 --- a/DDEve/src/Calo2DProjection.cpp +++ b/DDEve/src/Calo2DProjection.cpp @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDEve/Calo2DProjection.h" #include "DDEve/Annotation.h" diff --git a/DDEve/src/Calo3DProjection.cpp b/DDEve/src/Calo3DProjection.cpp index 3b59a009a78c1045505b6bf3ca8becb838df3392..3f271c52a50ec7a302752ba4a4c80e6ef0f610a5 100644 --- a/DDEve/src/Calo3DProjection.cpp +++ b/DDEve/src/Calo3DProjection.cpp @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDEve/Calo3DProjection.h" #include "DDEve/Factories.h" diff --git a/DDEve/src/CaloLego.cpp b/DDEve/src/CaloLego.cpp index af7ad3dca733aece91394aa663adb4d51e7fa0f4..d9055d66138952f8d578ac0c80ccb4b0f8b82bfc 100644 --- a/DDEve/src/CaloLego.cpp +++ b/DDEve/src/CaloLego.cpp @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDEve/CaloLego.h" #include "DDEve/Annotation.h" diff --git a/DDEve/src/ContextMenu.cpp b/DDEve/src/ContextMenu.cpp index 850991fec48af4bb520b760cf9cb128cea046fbd..8f2f4e318d7d862bdb2623c3b4747d89e7dc76f3 100644 --- a/DDEve/src/ContextMenu.cpp +++ b/DDEve/src/ContextMenu.cpp @@ -1,11 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDEve/ContextMenu.h" diff --git a/DDEve/src/DD4hepMenu.cpp b/DDEve/src/DD4hepMenu.cpp index 951e96ef1ffad98384b27b3afb7cf033dbd33c8d..c140b1061167f901c705e3e4ac9abac6f850d5ec 100644 --- a/DDEve/src/DD4hepMenu.cpp +++ b/DDEve/src/DD4hepMenu.cpp @@ -1,12 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Plugins.h" diff --git a/DDEve/src/DDEveEventData.cpp b/DDEve/src/DDEveEventData.cpp index a9d2be87a84ae9993d10497c539c94006bd1de11..37e1f46ea0ba7c214fb59f59e8fcb2962dda9369 100644 --- a/DDEve/src/DDEveEventData.cpp +++ b/DDEve/src/DDEveEventData.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/DDEveEventData.h" diff --git a/DDEve/src/DDEvePlugins.cpp b/DDEve/src/DDEvePlugins.cpp index 5e7afa4f9277cc20c408bd3f2e921924479999b9..17af9eca4b690ddb1b5e78ca5c82709737ebdf4d 100644 --- a/DDEve/src/DDEvePlugins.cpp +++ b/DDEve/src/DDEvePlugins.cpp @@ -1,11 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Plugins.inl" diff --git a/DDEve/src/DDG4EventHandler.cpp b/DDEve/src/DDG4EventHandler.cpp index 768fe9d70a5631460e20e6333f1713510a8ed2ee..d138f7e8e0256712fc7ecead08733138bc80ee86 100644 --- a/DDEve/src/DDG4EventHandler.cpp +++ b/DDEve/src/DDG4EventHandler.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/DDG4EventHandler.h" @@ -121,9 +126,9 @@ size_t DDG4EventHandler::collectionLoop(const std::string& collection, DDEveHitA DDEveHit hit; actor.setSize(data_ptr->size()); for(_P::const_iterator j=data_ptr->begin(); j!=data_ptr->end(); ++j) { - if ( (*m_simhitConverter)(*j,&hit) ) { - actor(hit); - } + if ( (*m_simhitConverter)(*j,&hit) ) { + actor(hit); + } } return data_ptr->size(); } @@ -141,9 +146,9 @@ size_t DDG4EventHandler::collectionLoop(const std::string& collection, DDEvePart DDEveParticle part; actor.setSize(data_ptr->size()); for(_P::const_iterator j=data_ptr->begin(); j!=data_ptr->end(); ++j) { - if ( (*m_particleConverter)(*j,&part) ) { - actor(part); - } + if ( (*m_particleConverter)(*j,&part) ) { + actor(part); + } } return data_ptr->size(); } @@ -169,9 +174,9 @@ Int_t DDG4EventHandler::ReadEvent(Long64_t event_number) { if ( nbytes >= 0 ) { printout(ERROR,"DDG4EventHandler","+++ ReadEvent: Read %d bytes of event data for entry:%d",nbytes,event_number); for(Branches::const_iterator i=m_branches.begin(); i != m_branches.end(); ++i) { - TBranch* b = (*i).second.first; - std::vector<void*>* ptr_data = *(std::vector<void*>**)b->GetAddress(); - m_data[b->GetClassName()].push_back(make_pair(b->GetName(),ptr_data->size())); + TBranch* b = (*i).second.first; + std::vector<void*>* ptr_data = *(std::vector<void*>**)b->GetAddress(); + m_data[b->GetClassName()].push_back(make_pair(b->GetName(),ptr_data->size())); } m_hasEvent = true; return nbytes; @@ -198,15 +203,15 @@ bool DDG4EventHandler::Open(const std::string&, const std::string& name) { m_entry = -1; m_branches.clear(); for(Int_t i=0; i<br->GetSize(); ++i) { - TBranch* b = (TBranch*)br->At(i); - if ( !b ) continue; - m_branches[b->GetName()] = make_pair(b,(void*)0); - printout(INFO,"DDG4EventHandler::open","+++ Branch %s has %ld entries.",b->GetName(),b->GetEntries()); + TBranch* b = (TBranch*)br->At(i); + if ( !b ) continue; + m_branches[b->GetName()] = make_pair(b,(void*)0); + printout(INFO,"DDG4EventHandler::open","+++ Branch %s has %ld entries.",b->GetName(),b->GetEntries()); } for(Int_t i=0; i<br->GetSize(); ++i) { - TBranch* b = (TBranch*)br->At(i); - if ( !b ) continue; - b->SetAddress(&m_branches[b->GetName()].second); + TBranch* b = (TBranch*)br->At(i); + if ( !b ) continue; + b->SetAddress(&m_branches[b->GetName()].second); } m_hasFile = true; return true; diff --git a/DDEve/src/Display.cpp b/DDEve/src/Display.cpp index e8e95cdca04d17b4c6d5b9e29de1c446ccf87d45..bfb3ffb01afec476ef86d8a9828d2200cf8d67d3 100644 --- a/DDEve/src/Display.cpp +++ b/DDEve/src/Display.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/View.h" @@ -66,11 +71,11 @@ namespace DD4hep { } else { display->MessageBox(INFO,"No DDEve setup given.\nYou need to choose now.....\n" - "If you need an example, open\n\n" - "examples/CLIDSid/eve/DDEve.xml\n" - "and the corresponding event data\n" - "examples/CLIDSid/eve/CLICSiD_Events.root\n\n\n", - "Need to choos setup file"); + "If you need an example, open\n\n" + "examples/CLIDSid/eve/DDEve.xml\n" + "and the corresponding event data\n" + "examples/CLIDSid/eve/CLICSiD_Events.root\n\n\n", + "Need to choos setup file"); display->ChooseGeometry(); //display->LoadXML("file:../DD4hep/examples/CLICSiD/compact/DDEve.xml"); } @@ -215,37 +220,37 @@ Display::CalodataContext& Display::GetCaloHistogram(const string& nam) { string use = ctx.config.use; string hits = ctx.config.hits; if ( use.empty() ) { - const char* n = nam.c_str(); - const DisplayConfiguration::Calodata& cd = (*j).second.data.calodata; - TH2F* h = new TH2F(n,n,cd.n_eta, cd.eta_min, cd.eta_max, cd.n_phi, cd.phi_min, cd.phi_max); - h->SetTitle(hits.c_str()); - ctx.eveHist = new TEveCaloDataHist(); - ctx.slice = ctx.eveHist->GetNSlices(); - ctx.eveHist->AddHistogram(h); - ctx.eveHist->RefSliceInfo(0).Setup(n,cd.threshold,cd.color,101); - ctx.eveHist->GetEtaBins()->SetTitleFont(120); - ctx.eveHist->GetEtaBins()->SetTitle("h"); - ctx.eveHist->GetPhiBins()->SetTitleFont(120); - ctx.eveHist->GetPhiBins()->SetTitle("f"); - ctx.eveHist->IncDenyDestroy(); - - ctx.calo3D = new TEveCalo3D(ctx.eveHist); - ctx.calo3D->SetName(n); - ctx.calo3D->SetBarrelRadius(cd.rmin); - ctx.calo3D->SetEndCapPos(cd.dz); - ctx.calo3D->SetAutoRange(kTRUE); - ctx.calo3D->SetMaxTowerH(cd.towerH); - ImportGeo(ctx.calo3D); - EtaPhiHistogramActor actor(h); - eventHandler().collectionLoop(hits,actor); - ctx.eveHist->DataChanged(); + const char* n = nam.c_str(); + const DisplayConfiguration::Calodata& cd = (*j).second.data.calodata; + TH2F* h = new TH2F(n,n,cd.n_eta, cd.eta_min, cd.eta_max, cd.n_phi, cd.phi_min, cd.phi_max); + h->SetTitle(hits.c_str()); + ctx.eveHist = new TEveCaloDataHist(); + ctx.slice = ctx.eveHist->GetNSlices(); + ctx.eveHist->AddHistogram(h); + ctx.eveHist->RefSliceInfo(0).Setup(n,cd.threshold,cd.color,101); + ctx.eveHist->GetEtaBins()->SetTitleFont(120); + ctx.eveHist->GetEtaBins()->SetTitle("h"); + ctx.eveHist->GetPhiBins()->SetTitleFont(120); + ctx.eveHist->GetPhiBins()->SetTitle("f"); + ctx.eveHist->IncDenyDestroy(); + + ctx.calo3D = new TEveCalo3D(ctx.eveHist); + ctx.calo3D->SetName(n); + ctx.calo3D->SetBarrelRadius(cd.rmin); + ctx.calo3D->SetEndCapPos(cd.dz); + ctx.calo3D->SetAutoRange(kTRUE); + ctx.calo3D->SetMaxTowerH(cd.towerH); + ImportGeo(ctx.calo3D); + EtaPhiHistogramActor actor(h); + eventHandler().collectionLoop(hits,actor); + ctx.eveHist->DataChanged(); } else { - CalodataContext c = GetCaloHistogram(use); - ctx = c; - ctx.config.use = use; - ctx.config.hits = hits; - ctx.config.name = nam; + CalodataContext c = GetCaloHistogram(use); + ctx = c; + ctx.config.use = use; + ctx.config.hits = hits; + ctx.config.name = nam; } i = m_calodata.insert(make_pair(nam,ctx)).first; return (*i).second; @@ -297,7 +302,7 @@ void Display::MessageBox(PrintLevel level, const string& text, const string& tit else if ( level == FATAL ) pic = client().GetPicture((path+"interrupt.xpm").c_str()); new TGMsgBox(gClient->GetRoot(),0,title.c_str(),text.c_str(),pic, - kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY); + kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY); } /// Popup XML file chooser. returns chosen file name; empty on cancel @@ -378,53 +383,53 @@ void Display::OnNewEvent(EventHandler* handler ) { size_t len = (*j).second; const char* nam = (*j).first; if ( len > 0 ) { - EventHandler::CollectionType typ = handler->collectionType(nam); - if ( typ == EventHandler::CALO_HIT_COLLECTION || - typ == EventHandler::TRACKER_HIT_COLLECTION ) { - const DataConfigurations::const_iterator i=m_collectionsConfigs.find(nam); - if ( i != m_collectionsConfigs.end() ) { - const DataConfig& cfg = (*i).second; - if ( cfg.hits == "PointSet" ) { - PointsetCreator cr(nam,len,cfg); - handler->collectionLoop((*j).first, cr); - ImportEvent(cr.element()); - } - else if ( cfg.hits == "BoxSet" ) { - BoxsetCreator cr(nam,len,cfg); - handler->collectionLoop((*j).first, cr); - ImportEvent(cr.element()); - } - else if ( cfg.hits == "TowerSet" ) { - TowersetCreator cr(nam,len,cfg); - handler->collectionLoop((*j).first, cr); - ImportEvent(cr.element()); - } - else { // Default is point set - PointsetCreator cr(nam,len); - handler->collectionLoop((*j).first, cr); - ImportEvent(cr.element()); - } - } - else { - PointsetCreator cr(nam,len); - handler->collectionLoop((*j).first, cr); - ImportEvent(cr.element()); - } - } - else if ( typ == EventHandler::PARTICLE_COLLECTION ) { - // We do not have to care about memory leaks here: - // TEveTrackPropagator is reference counted and will be destroyed if the - // last track is gone ie. when we re-initialize the event scene - - // $$$ Do not know exactly what the field parameters mean - const DataConfigurations::const_iterator i=m_collectionsConfigs.find(nam); - const DataConfig* cfg = (i==m_collectionsConfigs.end()) ? 0 : &((*i).second); - MCParticleCreator cr(new TEveTrackPropagator("","",new TEveMagFieldDuo(350, -3.5, 2.0)), - new TEveCompound("MC_Particles","MC_Particles"),cfg); - handler->collectionLoop((*j).first, cr); - cr.close(); - particles = cr.particles; - } + EventHandler::CollectionType typ = handler->collectionType(nam); + if ( typ == EventHandler::CALO_HIT_COLLECTION || + typ == EventHandler::TRACKER_HIT_COLLECTION ) { + const DataConfigurations::const_iterator i=m_collectionsConfigs.find(nam); + if ( i != m_collectionsConfigs.end() ) { + const DataConfig& cfg = (*i).second; + if ( cfg.hits == "PointSet" ) { + PointsetCreator cr(nam,len,cfg); + handler->collectionLoop((*j).first, cr); + ImportEvent(cr.element()); + } + else if ( cfg.hits == "BoxSet" ) { + BoxsetCreator cr(nam,len,cfg); + handler->collectionLoop((*j).first, cr); + ImportEvent(cr.element()); + } + else if ( cfg.hits == "TowerSet" ) { + TowersetCreator cr(nam,len,cfg); + handler->collectionLoop((*j).first, cr); + ImportEvent(cr.element()); + } + else { // Default is point set + PointsetCreator cr(nam,len); + handler->collectionLoop((*j).first, cr); + ImportEvent(cr.element()); + } + } + else { + PointsetCreator cr(nam,len); + handler->collectionLoop((*j).first, cr); + ImportEvent(cr.element()); + } + } + else if ( typ == EventHandler::PARTICLE_COLLECTION ) { + // We do not have to care about memory leaks here: + // TEveTrackPropagator is reference counted and will be destroyed if the + // last track is gone ie. when we re-initialize the event scene + + // $$$ Do not know exactly what the field parameters mean + const DataConfigurations::const_iterator i=m_collectionsConfigs.find(nam); + const DataConfig* cfg = (i==m_collectionsConfigs.end()) ? 0 : &((*i).second); + MCParticleCreator cr(new TEveTrackPropagator("","",new TEveMagFieldDuo(350, -3.5, 2.0)), + new TEveCompound("MC_Particles","MC_Particles"),cfg); + handler->collectionLoop((*j).first, cr); + cr.close(); + particles = cr.particles; + } } } } @@ -437,7 +442,7 @@ void Display::OnNewEvent(EventHandler* handler ) { size_t n = eventHandler().collectionLoop(ctx.config.hits, actor); ctx.eveHist->DataChanged(); printout(INFO,"FillEtaPhiHistogram","+++ %s: Filled %ld hits from %s....", - ctx.calo3D->GetName(), n, ctx.config.hits.c_str()); + ctx.calo3D->GetName(), n, ctx.config.hits.c_str()); } /// We absolutely want to import the particles as the last elements, otherwise /// they end up under the hits and are close to invisible @@ -534,48 +539,48 @@ void Display::LoadGeoChildren(TEveElement* start, int levels, bool redraw) { const DetElement::Children& c = world.children(); printout(INFO,"Display","+++ Load children of %s to %d levels", - world.placement().name(), levels); + world.placement().name(), levels); for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) { - DetElement de = (*i).second; - SensitiveDetector sd = m_lcdd->sensitiveDetector(de.name()); - TEveElementList& parent = sd.isValid() ? sens : struc; - pair<bool,TEveElement*> e = Utilities::LoadDetElement(de,levels,&parent); - if ( e.second && e.first ) { - parent.AddElement(e.second); - } + DetElement de = (*i).second; + SensitiveDetector sd = m_lcdd->sensitiveDetector(de.name()); + TEveElementList& parent = sd.isValid() ? sens : struc; + pair<bool,TEveElement*> e = Utilities::LoadDetElement(de,levels,&parent); + if ( e.second && e.first ) { + parent.AddElement(e.second); + } } } else { TGeoNode* n = (TGeoNode*)start->GetUserData(); printout(INFO,"Display","+++ Load children of %s to %d levels",Utilities::GetName(start),levels); if ( 0 != n ) { - TGeoHMatrix mat; - const char* node_name = n->GetName(); - int level = Utilities::findNodeWithMatrix(lcdd().world().placement().ptr(),n,&mat); - if ( level > 0 ) { - pair<bool,TEveElement*> e(false,0); - const DetElement::Children& c = world.children(); - for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) { - DetElement de = (*i).second; - if ( de.placement().ptr() == n ) { - e = Utilities::createEveShape(0, levels, start, n, mat, de.name()); - break; - } - } - if ( !e.first && !e.second ) { - e = Utilities::createEveShape(0, levels, start, n, mat, node_name); - } - if ( e.first ) { // newly created - start->AddElement(e.second); - } - printout(INFO,"Display","+++ Import geometry node %s with %d levels.",node_name, levels); - } - else { - printout(INFO,"Display","+++ FAILED to import geometry node %s with %d levels.",node_name, levels); - } + TGeoHMatrix mat; + const char* node_name = n->GetName(); + int level = Utilities::findNodeWithMatrix(lcdd().world().placement().ptr(),n,&mat); + if ( level > 0 ) { + pair<bool,TEveElement*> e(false,0); + const DetElement::Children& c = world.children(); + for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) { + DetElement de = (*i).second; + if ( de.placement().ptr() == n ) { + e = Utilities::createEveShape(0, levels, start, n, mat, de.name()); + break; + } + } + if ( !e.first && !e.second ) { + e = Utilities::createEveShape(0, levels, start, n, mat, node_name); + } + if ( e.first ) { // newly created + start->AddElement(e.second); + } + printout(INFO,"Display","+++ Import geometry node %s with %d levels.",node_name, levels); + } + else { + printout(INFO,"Display","+++ FAILED to import geometry node %s with %d levels.",node_name, levels); + } } else { - LoadGeoChildren(0,levels,false); + LoadGeoChildren(0,levels,false); } } } @@ -587,7 +592,7 @@ void Display::LoadGeoChildren(TEveElement* start, int levels, bool redraw) { /// Make a set of nodes starting from a top element (in-)visible with a given depth void Display::MakeNodesVisible(TEveElement* e, bool visible, int level) { printout(INFO,"Display","+++ %s element %s with a depth of %d.", - visible ? "Show" : "Hide",Utilities::GetName(e),level); + visible ? "Show" : "Hide",Utilities::GetName(e),level); Utilities::MakeNodesVisible(e, visible, level); manager().Redraw3D(); } diff --git a/DDEve/src/DisplayConfiguration.cpp b/DDEve/src/DisplayConfiguration.cpp index 8222b668208af4ef15cd4913ac88cc0cab00a6f6..3e02132330a178315836abcdc15fb033efef8289 100644 --- a/DDEve/src/DisplayConfiguration.cpp +++ b/DDEve/src/DisplayConfiguration.cpp @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDEve/DisplayConfiguration.h" diff --git a/DDEve/src/DisplayConfigurationParser.cpp b/DDEve/src/DisplayConfigurationParser.cpp index 0d3e9b892e11e78d1c34523772e92cd69dd4fb76..b7a6593ee40b62cf352fbbd2c1264c28edaa0466 100644 --- a/DDEve/src/DisplayConfigurationParser.cpp +++ b/DDEve/src/DisplayConfigurationParser.cpp @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/LCDDLoad.h" @@ -154,7 +159,7 @@ template <> void Converter<view>::operator()(xml_h e) const { c.show_sensitive = e.hasAttr(_U(sensitive)) ? e.attr<bool>(_U(sensitive)) : true; c.name = e.attr<string>(_U(name)); printout(INFO,"DisplayConfiguration","+++ View: %s sensitive:%d structure:%d.", - c.name.c_str(), c.show_sensitive, c.show_structure); + c.name.c_str(), c.show_sensitive, c.show_structure); xml_coll_t(e,_Unicode(panel)).for_each(Converter<panel>(lcdd,&c.subdetectors)); xml_coll_t(e,_Unicode(detelement)).for_each(Converter<detelement>(lcdd,&c.subdetectors)); xml_coll_t(e,_Unicode(calodata)).for_each(Converter<calodata_configs>(lcdd,&c.subdetectors)); diff --git a/DDEve/src/ElementList.cpp b/DDEve/src/ElementList.cpp index 99f00e6b8af6f4c69505a4caca59106c19ba19db..c4b335904edde906b29d2bb0ecb322c3da8c9de4 100644 --- a/DDEve/src/ElementList.cpp +++ b/DDEve/src/ElementList.cpp @@ -1,11 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/InstanceCount.h" #include "DDEve/EveUserContextMenu.h" @@ -29,7 +35,7 @@ ElementList::ElementList() : TEveElementList() { /// Initializing constructor ElementList::ElementList(const std::string& name, const std::string& title, bool doCol, bool doTrans) -: TEveElementList(name.c_str(), title.c_str(), doCol, doTrans) { + : TEveElementList(name.c_str(), title.c_str(), doCol, doTrans) { InstanceCount::increment(this); } diff --git a/DDEve/src/EvePgonSetProjectedContextMenu.cpp b/DDEve/src/EvePgonSetProjectedContextMenu.cpp index ca60b3729f74d22e3fab991d9aa228b5a8aa910c..17c12db25c44bad124f2d77be6cbc044a0231705 100644 --- a/DDEve/src/EvePgonSetProjectedContextMenu.cpp +++ b/DDEve/src/EvePgonSetProjectedContextMenu.cpp @@ -1,11 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDEve/ContextMenu.h" #include "DDEve/EvePgonSetProjectedContextMenu.h" diff --git a/DDEve/src/EveShapeContextMenu.cpp b/DDEve/src/EveShapeContextMenu.cpp index 202797703335379b6950dbe1c7ca2e51d54b837c..51606c53e3fd20569116545f26bd56aec5c31fc8 100644 --- a/DDEve/src/EveShapeContextMenu.cpp +++ b/DDEve/src/EveShapeContextMenu.cpp @@ -1,11 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DDEve/EveShapeContextMenu.h" diff --git a/DDEve/src/EveUserContextMenu.cpp b/DDEve/src/EveUserContextMenu.cpp index a33d8ebe737923b1344cb3ca53cfa1333a76b9de..a78ade7e4eea59c08af104fd02f3b793593c09e6 100644 --- a/DDEve/src/EveUserContextMenu.cpp +++ b/DDEve/src/EveUserContextMenu.cpp @@ -1,11 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DDEve/Display.h" diff --git a/DDEve/src/EventControl.cpp b/DDEve/src/EventControl.cpp index b1414d7bb23ac5316416344fc67dc47021038894..f79f8fbd3227ae3611580dea7d92ffc05301e627 100644 --- a/DDEve/src/EventControl.cpp +++ b/DDEve/src/EventControl.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/Display.h" diff --git a/DDEve/src/EventHandler.cpp b/DDEve/src/EventHandler.cpp index 44aa3d08b7cf272a41bbcd083580e9aba4e8ed04..aa350afb115941862330481252b3e1da0d35451e 100644 --- a/DDEve/src/EventHandler.cpp +++ b/DDEve/src/EventHandler.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/EventHandler.h" diff --git a/DDEve/src/FrameControl.cpp b/DDEve/src/FrameControl.cpp index 4481c54c2bd4fde06d1f275850ad094d6452809f..6437c329724e974c8c0122c4ffd602de748f8355 100644 --- a/DDEve/src/FrameControl.cpp +++ b/DDEve/src/FrameControl.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/FrameControl.h" diff --git a/DDEve/src/GenericEventHandler.cpp b/DDEve/src/GenericEventHandler.cpp index be9168cd47dd685a2d45a48d33385fdeb1f21ac6..45d701ea1f5ca47a8f17e0e6d61fde8be1cd8e53 100644 --- a/DDEve/src/GenericEventHandler.cpp +++ b/DDEve/src/GenericEventHandler.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/GenericEventHandler.h" @@ -108,9 +113,9 @@ bool GenericEventHandler::Open(const string& file_type, const string& file_name) } if ( m_current ) { if ( m_current->Open(file_type, file_name) ) { - m_hasFile = true; - NotifySubscribers(&EventConsumer::OnFileOpen); - return true; + m_hasFile = true; + NotifySubscribers(&EventConsumer::OnFileOpen); + return true; } err = "+++ Failed to open the data file:"+file_name; deletePtr(m_current); @@ -126,7 +131,7 @@ bool GenericEventHandler::Open(const string& file_type, const string& file_name) string path = TString::Format("%s/icons/stop_t.xpm", gSystem->Getenv("ROOTSYS")).Data(); const TGPicture* pic = gClient->GetPicture(path.c_str()); new TGMsgBox(gClient->GetRoot(),0,"Failed to open event data",err.c_str(),pic, - kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY); + kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY); return false; } @@ -136,9 +141,9 @@ bool GenericEventHandler::NextEvent() { try { if ( m_hasFile ) { if ( current()->NextEvent() > 0 ) { - m_hasEvent = true; - NotifySubscribers(&EventConsumer::OnNewEvent); - return 1; + m_hasEvent = true; + NotifySubscribers(&EventConsumer::OnNewEvent); + return 1; } } throw runtime_error("+++ EventHandler::readEvent: No file open!"); @@ -149,7 +154,7 @@ bool GenericEventHandler::NextEvent() { "while reading a new event:\n" + string(e.what()) + "\n\n"; const TGPicture* pic = gClient->GetPicture(path.c_str()); new TGMsgBox(gClient->GetRoot(),0,"Failed to read event", err.c_str(),pic, - kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY); + kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY); } return -1; } diff --git a/DDEve/src/HitActors.cpp b/DDEve/src/HitActors.cpp index f76a48d95df8f23e367fba76a880f5b3a966823f..b02503cb701385ee0eb894c078d4dec45b08c22c 100644 --- a/DDEve/src/HitActors.cpp +++ b/DDEve/src/HitActors.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/HitActors.h" @@ -55,10 +60,10 @@ TEveElement* PointsetCreator::element() const { PointsetCreator::~PointsetCreator() { if ( pointset ) { pointset->SetTitle(Form("Hit collection:\n" - "Container%s\n" - "with %d hits\n" - "total deposit:%.3f GeV", - pointset->GetName(), count, deposit)); + "Container%s\n" + "with %d hits\n" + "total deposit:%.3f GeV", + pointset->GetName(), count, deposit)); } } @@ -97,10 +102,10 @@ BoxsetCreator::BoxsetCreator(const std::string& collection, size_t /*length */) BoxsetCreator::~BoxsetCreator() { if ( boxset ) { boxset->SetTitle(Form("Hit collection:\n" - "Container%s\n" - "with %d hits\n" - "total deposit:%.3f GeV", - boxset->GetName(), count, deposit)); + "Container%s\n" + "with %d hits\n" + "total deposit:%.3f GeV", + boxset->GetName(), count, deposit)); } } @@ -123,13 +128,13 @@ void BoxsetCreator::operator()(const DDEveHit& hit) { float s1Z = scale(1)/2.0; float s2Z = s1Z; float coords[24]= { float(p.X()+s1X), float(p.Y()+s1Y), float(p.Z()-s1Z), - float(p.X()+s1X), float(p.Y()+s1Y), float(p.Z()+s1Z), - float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()+s2Z), - float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()-s2Z), - float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()-s2Z), - float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()+s2Z), - float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()+s1Z), - float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()-s1Z) }; + float(p.X()+s1X), float(p.Y()+s1Y), float(p.Z()+s1Z), + float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()+s2Z), + float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()-s2Z), + float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()-s2Z), + float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()+s2Z), + float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()+s1Z), + float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()-s1Z) }; ++count; deposit += hit.deposit*MEV_2_GEV; boxset->AddBox(coords); @@ -150,13 +155,13 @@ void TowersetCreator::operator()(const DDEveHit& hit) { float s2Z = s1Z; p = TVector3(hit.x*MM_2_CM-s1X, hit.y*MM_2_CM-s1Y, hit.z*MM_2_CM-s1Z); float coords[24]= { float(p.X()+s1X), float(p.Y()+s1Y), float(p.Z()-s1Z), - float(p.X()+s1X), float(p.Y()+s1Y), float(p.Z()+s1Z), - float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()+s2Z), - float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()-s2Z), - float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()-s2Z), - float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()+s2Z), - float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()+s1Z), - float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()-s1Z) }; + float(p.X()+s1X), float(p.Y()+s1Y), float(p.Z()+s1Z), + float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()+s2Z), + float(p.X()-s2X), float(p.Y()-s2Y), float(p.Z()-s2Z), + float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()-s2Z), + float(p.X()+s2X), float(p.Y()+s2Y), float(p.Z()+s2Z), + float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()+s1Z), + float(p.X()-s1X), float(p.Y()-s1Y), float(p.Z()-s1Z) }; ++count; deposit += hit.deposit*MEV_2_GEV; boxset->AddBox(coords); diff --git a/DDEve/src/MultiView.cpp b/DDEve/src/MultiView.cpp index 2aa59c7c4a606c65bf51406421e3c4cf99437947..aa3e19d8d2b393adc92450346edf3bdbca6efb29 100644 --- a/DDEve/src/MultiView.cpp +++ b/DDEve/src/MultiView.cpp @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDEve/MultiView.h" #include "DDEve/Factories.h" diff --git a/DDEve/src/ParticleActors.cpp b/DDEve/src/ParticleActors.cpp index f2238f891447be56338a80c3b34b445764877a07..53c29300bf08d04c991a96b756110e79afc6f16b 100644 --- a/DDEve/src/ParticleActors.cpp +++ b/DDEve/src/ParticleActors.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/ParticleActors.h" @@ -108,9 +113,9 @@ void MCParticleCreator::operator()(const DDEveParticle& p) { TDatabasePDG* db = TDatabasePDG::Instance(); TParticlePDG* def = db->GetParticle(p.pdgID); TParticle part(p.pdgID, - 0,0,0,0,0, - p.psx*MEV_2_GEV, p.psy*MEV_2_GEV, p.psz*MEV_2_GEV, p.energy*MEV_2_GEV, - p.vsx*MM_2_CM, p.vsy*MM_2_CM, p.vsz*MM_2_CM, p.time); + 0,0,0,0,0, + p.psx*MEV_2_GEV, p.psy*MEV_2_GEV, p.psz*MEV_2_GEV, p.energy*MEV_2_GEV, + p.vsx*MM_2_CM, p.vsy*MM_2_CM, p.vsz*MM_2_CM, p.time); TEveTrack* t = new TEveTrack(&part,p.id,propagator); @@ -122,18 +127,18 @@ void MCParticleCreator::operator()(const DDEveParticle& p) { t->AddPathMark(TEvePathMark(TEvePathMark::kDecay,end,momentum)); t->SetLineWidth(lineWidth); t->SetTitle(Form("MCParticle: Track ID=%d Parent:%d\n" - "Type:%s Charge=%.3f Time:%.3f ns\n" - "Start(Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n" - "End (Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n" - "Length:%.3f [cm]\n" - "(Px, Py, Pz, E) = (%.3f, %.3f, %.3f, %.3f) [GeV]", - p.id, p.parent, - def ? def->GetName() : "Unknown", - def ? def->Charge() : 0.0, p.time, - p.vsx*MM_2_CM, p.vsy*MM_2_CM, p.vsz*MM_2_CM, - p.vex*MM_2_CM, p.vey*MM_2_CM, p.vez*MM_2_CM, - dir.R(), - p.psx*MEV_2_GEV, p.psy*MEV_2_GEV, p.psz*MEV_2_GEV, p.energy*MEV_2_GEV)); + "Type:%s Charge=%.3f Time:%.3f ns\n" + "Start(Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n" + "End (Vx, Vy, Vz, t) = (%.3f, %.3f, %.3f) [cm]\n" + "Length:%.3f [cm]\n" + "(Px, Py, Pz, E) = (%.3f, %.3f, %.3f, %.3f) [GeV]", + p.id, p.parent, + def ? def->GetName() : "Unknown", + def ? def->Charge() : 0.0, p.time, + p.vsx*MM_2_CM, p.vsy*MM_2_CM, p.vsz*MM_2_CM, + p.vex*MM_2_CM, p.vey*MM_2_CM, p.vez*MM_2_CM, + dir.R(), + p.psx*MEV_2_GEV, p.psy*MEV_2_GEV, p.psz*MEV_2_GEV, p.energy*MEV_2_GEV)); // Add element to collection int pdg = abs(p.pdgID); diff --git a/DDEve/src/PopupMenu.cpp b/DDEve/src/PopupMenu.cpp index e562942adaac543736dbe7a1248d4ce73070b86b..0480143eebe13e6ce50fb0c5e427a81a23440d3b 100644 --- a/DDEve/src/PopupMenu.cpp +++ b/DDEve/src/PopupMenu.cpp @@ -1,11 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDEve/PopupMenu.h" diff --git a/DDEve/src/Projection.cpp b/DDEve/src/Projection.cpp index dcaee9203a1acbdf0f04498878f9bf31c8cc02ec..068a011b7a2012df2a60d425882a637caca065bc 100644 --- a/DDEve/src/Projection.cpp +++ b/DDEve/src/Projection.cpp @@ -1,12 +1,17 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DDEve/Projection.h" @@ -53,8 +58,8 @@ TEveElement* Projection::ImportElement(TEveElement* el, TEveElementList* list) } TEveElement* e = m_projMgr->ImportElements(el, list); printout(INFO,"Projection","ImportElement %s [%s] into list: %s Projectable:%s [%p]", - Utilities::GetName(el),el->IsA()->GetName(),list->GetName(), - dynamic_cast<TEveProjectable*>(list) ? "true" : "false", e); + Utilities::GetName(el),el->IsA()->GetName(),list->GetName(), + dynamic_cast<TEveProjectable*>(list) ? "true" : "false", e); unprojected->AddElement(el); if ( list != m_geoScene && list != m_eveScene ) { diff --git a/DDEve/src/RhoPhiProjection.cpp b/DDEve/src/RhoPhiProjection.cpp index 7931a0f60d276b64b8805e799f94253261f50d66..e65d2aaba8bd5e1d55c89a24e6df49257c3414fa 100644 --- a/DDEve/src/RhoPhiProjection.cpp +++ b/DDEve/src/RhoPhiProjection.cpp @@ -1,12 +1,18 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// Original Author: Matevz Tadel 2009 (MultiView.C) +// +//========================================================================== + // Framework include files #include "DDEve/RhoPhiProjection.h" #include "DDEve/Factories.h" @@ -18,7 +24,7 @@ DECLARE_VIEW_FACTORY(RhoPhiProjection) /// Initializing constructor RhoPhiProjection::RhoPhiProjection(Display* eve, const std::string& nam) - : Projection(eve, nam) +: Projection(eve, nam) { } diff --git a/DDEve/src/RhoZProjection.cpp b/DDEve/src/RhoZProjection.cpp index b3a002af55a3d963e1adab13cb5d25ad970e9e91..2c8b70e38d1188354499cce0899ec7f8f52bcc68 100644 --- a/DDEve/src/RhoZProjection.cpp +++ b/DDEve/src/RhoZProjection.cpp @@ -1,12 +1,18 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// Original Author: Matevz Tadel 2009 (MultiView.C) +// +//========================================================================== + // Framework include files #include "DDEve/RhoZProjection.h" #include "DDEve/Factories.h" @@ -19,7 +25,7 @@ DECLARE_VIEW_FACTORY(RhoZProjection) /// Initializing constructor RhoZProjection::RhoZProjection(Display* eve, const std::string& nam) - : Projection(eve, nam) +: Projection(eve, nam) { } diff --git a/DDEve/src/Utilities.cpp b/DDEve/src/Utilities.cpp index 1a5db0f288f6bf9a8f98975d04a0a9e368794ab7..170cb79c25ee3cfa56fdd7859923fe6ce4d98293 100644 --- a/DDEve/src/Utilities.cpp +++ b/DDEve/src/Utilities.cpp @@ -1,3 +1,18 @@ +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Objects.h" #include "DD4hep/Detector.h" #include "DD4hep/Volumes.h" @@ -161,8 +176,8 @@ int Utilities::findNodeWithMatrix(TGeoNode* p, TGeoNode* n, TGeoHMatrix* mat, st int level = findNodeWithMatrix(daughter,n,daughter_matrix,sub_path ? &spath : 0); if ( level>0 ) { if ( sub_path ) { - *sub_path += "/"; - *sub_path += spath; + *sub_path += "/"; + *sub_path += spath; } if ( mat ) *mat = *daughter_matrix; return level+1; @@ -182,7 +197,7 @@ std::pair<bool,TEveElement*> Utilities::LoadDetElement(Geometry::DetElement de,i std::pair<bool,TEveElement*> e = createEveShape(0, levels, parent, n, *matrix, de.name()); TEveElementList* list = dynamic_cast<TEveElementList*>(e.second); if ( list ) { - list->SetName(de.name()); + list->SetName(de.name()); } return e; } diff --git a/DDEve/src/View.cpp b/DDEve/src/View.cpp index 865b3f7950c4f9525a39a77f587806ab8f735d3c..1a15f07a5e739f75fa7fbfecb21a816c090c75f4 100644 --- a/DDEve/src/View.cpp +++ b/DDEve/src/View.cpp @@ -1,12 +1,18 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// Original Author: Matevz Tadel 2009 (MultiView.C) +// +//========================================================================== + // Framework include files #include "DDEve/View.h" #include "DDEve/Display.h" @@ -107,7 +113,7 @@ TEveElement* View::ImportEventElement(TEveElement* el, TEveElementList* list) { } if ( el ) { printout(INFO,"View","ImportElement %s [%s] into list: %s", - Utilities::GetName(el),el->IsA()->GetName(),list->GetName()); + Utilities::GetName(el),el->IsA()->GetName(),list->GetName()); list->AddElement(el); } return el; @@ -177,18 +183,18 @@ void View::ConfigureGeometry(const DisplayConfiguration::ViewConfig& config) else if ( cfg.type == DisplayConfiguration::DETELEMENT ) { DetElement::Children::const_iterator i = c.find(nam); if ( i != c.end() ) { - DetElement de = (*i).second; - SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(nam); - TEveElementList& topic = GetGeoTopic(sd.isValid() ? "Sensitive" : "Structure"); - pair<bool,TEveElement*> e(false,0); - if ( cfg.data.defaults.load_geo > 0 ) // Create a new instance - e = CreateGeometry(de,cfg); // with the given number of levels - else if ( cfg.data.defaults.load_geo < 0 ) // Use the global geometry instance - e = GetGlobalGeometry(de,cfg); // with the given number of levels - if ( e.first && e.second ) { - ImportGeo(topic,e.second); - } - dets += nam + "(Geo) "; + DetElement de = (*i).second; + SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(nam); + TEveElementList& topic = GetGeoTopic(sd.isValid() ? "Sensitive" : "Structure"); + pair<bool,TEveElement*> e(false,0); + if ( cfg.data.defaults.load_geo > 0 ) // Create a new instance + e = CreateGeometry(de,cfg); // with the given number of levels + else if ( cfg.data.defaults.load_geo < 0 ) // Use the global geometry instance + e = GetGlobalGeometry(de,cfg); // with the given number of levels + if ( e.first && e.second ) { + ImportGeo(topic,e.second); + } + dets += nam + "(Geo) "; } } } @@ -252,24 +258,24 @@ void View::ConfigureEvent(const DisplayConfiguration::ViewConfig& config) { else if ( cfg.type == DisplayConfiguration::COLLECTION ) { // Not using the global scene! if ( cfg.data.defaults.show_evt>0 ) { - TEveElement* child = m_eve->manager().GetEventScene()->FindChild(nam); - printout(INFO,"View","+++ Add collection:%s data:%p scene:%p",nam.c_str(),child,m_eveScene); - if ( child ) ImportEvent(child); + TEveElement* child = m_eve->manager().GetEventScene()->FindChild(nam); + printout(INFO,"View","+++ Add collection:%s data:%p scene:%p",nam.c_str(),child,m_eveScene); + if ( child ) ImportEvent(child); } } else if ( cfg.type == DisplayConfiguration::DETELEMENT ) { // Not using the global scene! DetElement::Children::const_iterator i = c.find(nam); if ( i != c.end() && cfg.data.defaults.show_evt>0 ) { - SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(nam); - if ( sd.isValid() ) { - // This should be configurable! - const char* coll = sd.readout().name(); - TEveElement* child = m_eve->manager().GetEventScene()->FindChild(coll); - printout(INFO,"View","+++ Add detector event %s collection:%s data:%p scene:%p", - nam.c_str(),coll,child,m_eveScene); - if ( child ) ImportEvent(child); - } + SensitiveDetector sd = m_eve->lcdd().sensitiveDetector(nam); + if ( sd.isValid() ) { + // This should be configurable! + const char* coll = sd.readout().name(); + TEveElement* child = m_eve->manager().GetEventScene()->FindChild(coll); + printout(INFO,"View","+++ Add detector event %s collection:%s data:%p scene:%p", + nam.c_str(),coll,child,m_eveScene); + if ( child ) ImportEvent(child); + } } } } diff --git a/DDEve/src/View3D.cpp b/DDEve/src/View3D.cpp index 5a0e29a615b9b6106138b0d371a3ad6f918d2f82..163b3c99d567dc2277ea1386ee5d4d63740a1624 100644 --- a/DDEve/src/View3D.cpp +++ b/DDEve/src/View3D.cpp @@ -1,12 +1,18 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// Original Author: Matevz Tadel 2009 (MultiView.C) +// +//========================================================================== + // Framework include files #include "DDEve/View3D.h" #include "DDEve/Factories.h" diff --git a/DDEve/src/ViewMenu.cpp b/DDEve/src/ViewMenu.cpp index 73c0937dd4064f15b97a866bb95bab66e75066b6..5c34fcb5930d478783711479ebbab94117434b24 100644 --- a/DDEve/src/ViewMenu.cpp +++ b/DDEve/src/ViewMenu.cpp @@ -1,12 +1,16 @@ -// $Id: LCDD.h 1117 2014-04-25 08:07:22Z markus.frank@cern.ch $ -//==================================================================== +// $Id: run_plugin.h 1663 2015-03-20 13:54:53Z gaede $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank -// Original Author: Matevz Tadel 2009 (MultiView.C) +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Plugins.h" diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index f1fc10031f18024f1070bbe3fb473c8f87911300..ba6ea7ef64822ccb1de01f45a75a9097261f26b1 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -1,3 +1,15 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + #---Find Geant4------------------------------------------------------------------- find_package(Geant4 REQUIRED gdml ui_all vis_all) INCLUDE(${Geant4_USE_FILE}) # this also takes care of geant 4 definitions and include dirs diff --git a/DDG4/g4FromXML.cpp b/DDG4/g4FromXML.cpp index df9765bae6e1a17baef379dad4a06813533142af..674cf4d49041aa4a59bf84e1fe3e38bd6f265cd5 100644 --- a/DDG4/g4FromXML.cpp +++ b/DDG4/g4FromXML.cpp @@ -1,5 +1,23 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDG4/Geant4Config.h" + +// C/C++ include files #include <iostream> + using namespace DD4hep::Simulation::Setup; void setupG4_XML() { diff --git a/DDG4/g4gdmlDisplay.cpp b/DDG4/g4gdmlDisplay.cpp index a552703cc073eab41ddc6661b217224563c31656..86fee601831215bad0221f21b95cc5fdb3aa92b7 100644 --- a/DDG4/g4gdmlDisplay.cpp +++ b/DDG4/g4gdmlDisplay.cpp @@ -1,3 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== //#define G4UI_USE //#define G4VIS_USE //#define G4INTY_USE_XT diff --git a/DDG4/include/DDG4/ComponentProperties.h b/DDG4/include/DDG4/ComponentProperties.h index 1a9116bc5f000d2206007d9fdad20706c8cd01d4..5a4bd9c15106bf1bac1b644044787140cbdeb699 100644 --- a/DDG4/include/DDG4/ComponentProperties.h +++ b/DDG4/include/DDG4/ComponentProperties.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_COMPONENTPROPERTIES_H #define DD4HEP_DDG4_COMPONENTPROPERTIES_H @@ -138,8 +144,8 @@ namespace DD4hep { template <class TYPE> class PropertyValue : private Property { public: TYPE data; - PropertyValue() - : Property(data) { + PropertyValue() + : Property(data) { } /// Assignment operator PropertyValue& operator=(const TYPE& val) { diff --git a/DDG4/include/DDG4/ComponentProperties_inl.h b/DDG4/include/DDG4/ComponentProperties_inl.h index e0932cecab8aa80ddf01a9f6e30e3c2a3d8c65dc..0027fd1e3799f145e5583143064808e7878bbddc 100644 --- a/DDG4/include/DDG4/ComponentProperties_inl.h +++ b/DDG4/include/DDG4/ComponentProperties_inl.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_COMPONENTPROPERTIES_INL_H #define DD4HEP_DDG4_COMPONENTPROPERTIES_INL_H @@ -67,11 +72,11 @@ namespace DD4hep { } // End namespace DD4hep // Instantiate single property -#define DD4HEP_DEFINE_PROPERTY_TYPE(x) \ - template x Property::value() const; \ - template void Property::value(x& value) const; \ - template void Property::set(const x& value); \ - template Property& Property::operator=(const x& value); \ +#define DD4HEP_DEFINE_PROPERTY_TYPE(x) \ + template x Property::value() const; \ + template void Property::value(x& value) const; \ + template void Property::set(const x& value); \ + template Property& Property::operator=(const x& value); \ template void Property::make(x& value) // Instantiate single property with support for STL containers diff --git a/DDG4/include/DDG4/ComponentUtils.h b/DDG4/include/DDG4/ComponentUtils.h index fbb23ab261a15c36793a7c734ee47e0f7a29b0b7..c99d6f86226e4c22ce8a59a175be2c13d3e49821 100644 --- a/DDG4/include/DDG4/ComponentUtils.h +++ b/DDG4/include/DDG4/ComponentUtils.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_COMPONENTTUILS_H #define DD4HEP_DDG4_COMPONENTTUILS_H diff --git a/DDG4/include/DDG4/DDG4Dict.h b/DDG4/include/DDG4/DDG4Dict.h index d9525fcd0f806fb0e0cca7cdd7b3497cdf14a48c..7c24ee584b44bca5e7ef321755868fc58e4e6605 100644 --- a/DDG4/include/DDG4/DDG4Dict.h +++ b/DDG4/include/DDG4/DDG4Dict.h @@ -1,13 +1,20 @@ -// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== // // Define the ROOT dictionaries for all data classes to be saved // which are created by the DDG4 examples. // -// Author : M.Frank -// //==================================================================== #ifndef DD4HEP_DDG4_DDG4DICT_H #define DD4HEP_DDG4_DDG4DICT_H diff --git a/DDG4/include/DDG4/Defs.h b/DDG4/include/DDG4/Defs.h index d03756da2a7a2bff75930354a7ef70ac4a1e9627..0e29784dcec02a7f01397a2d3dfabd53542afcd4 100644 --- a/DDG4/include/DDG4/Defs.h +++ b/DDG4/include/DDG4/Defs.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DDG4_DEFS_H #define DDG4_DEFS_H diff --git a/DDG4/include/DDG4/Factories.h b/DDG4/include/DDG4/Factories.h index ba21bf2bb419e708e350837168aa2390fb7e46f0..81c8b2d3493aebe7c18f7a9de5921ed5485fd0d6 100644 --- a/DDG4/include/DDG4/Factories.h +++ b/DDG4/include/DDG4/Factories.h @@ -1,19 +1,23 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DDG4_FACTORIES_H #define DDG4_FACTORIES_H -#include "DD4hep/Plugins.h" -#include "RVersion.h" - // Framework include files #include "DDG4/Defs.h" +#include "DD4hep/Plugins.h" #include "DD4hep/Printout.h" #include "DD4hep/Primitives.h" @@ -32,12 +36,16 @@ class G4VPhysicsConstructor; class G4VUserPhysicsList; class G4VProcess; +/// Namespace for the AIDA detector description toolkit namespace DD4hep { + + /// Namespace for the geometry part of the AIDA detector description toolkit namespace Geometry { class GeoHandler; class DetElement; class LCDD; } + /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit namespace Simulation { class Geant4Context; class Geant4Action; @@ -46,182 +54,142 @@ namespace DD4hep { class Geant4UserPhysics; class Geant4EventReader; class Geant4PhysicsListActionSequence; - - /// Templated factory method to invoke setup action - template <typename T> class Geant4SetupAction { - public: - static long create(Geometry::LCDD& lcdd, const Geometry::GeoHandler& cnv, const std::map<std::string, std::string>& attrs); - }; - /// Deprecated: Templated factory method to create sensitive detector - template <typename T> class Geant4SensitiveDetectorFactory { - public: - static G4VSensitiveDetector* create(const std::string& name, DD4hep::Geometry::LCDD& lcdd); - }; } + + /// Templated factory method to invoke setup action + template <typename T> class Geant4SetupAction : public PluginFactoryBase { + public: + static long create(lcdd_t& lcdd, const DD4hep::Geometry::GeoHandler& cnv, const std::map<str_t,str_t>& attrs); + }; + /// Deprecated: Templated factory method to create sensitive detector + template <typename T> class Geant4SensitiveDetectorFactory : public PluginFactoryBase { + public: + static G4VSensitiveDetector* create(const str_t& name, lcdd_t& lcdd); + }; + } namespace { - namespace DS = DD4hep::Simulation; - typedef DD4hep::Geometry::LCDD LCDD; - typedef DD4hep::Geometry::GeoHandler GeoHandler; - typedef DD4hep::Geometry::DetElement DE; - typedef DS::Geant4Action GA; - typedef DS::Geant4Context CT; - typedef std::string STR; - typedef const std::vector<void*>& ARGS; + /// Base factory template + template <typename P, typename S> class Factory {}; - template <typename P, typename S> class Factory; - template <typename P> class Factory<P, long(LCDD*, const GeoHandler*, const std::map<STR, STR>*)> { - public: - typedef GeoHandler cnv_t; - typedef std::map<STR, STR> attrs_t; - static void Func(void *ret, void*, ARGS arg, void*) { - long r = DS::Geant4SetupAction<P>::create(*(LCDD*) arg[0], *(cnv_t*) arg[1], *(attrs_t*) arg[2]); - new (ret) (long)(r); - } + namespace DS = DD4hep::Simulation; + struct _ns { + typedef DD4hep::Geometry::LCDD LCDD; + typedef DD4hep::Geometry::GeoHandler GH; + typedef DD4hep::Geometry::DetElement DE; + typedef DD4hep::Simulation::Geant4Action GA; + typedef DD4hep::Simulation::Geant4Context CT; + typedef DD4hep::Simulation::Geant4EventReader RDR; + typedef std::map<std::string,std::string> STRM; + typedef G4MagIntegratorStepper Stepper; }; - /// Factory to create Geant4 sensitive detectors - template <typename P> class Factory<P, G4VSensitiveDetector*(STR, LCDD*)> { - public: - typedef G4VSensitiveDetector SD; - static void Func(void *ret, void*, ARGS arg, void*) { - *(void**) ret = DS::Geant4SensitiveDetectorFactory<P>::create(*(STR*) arg[0], *(LCDD*) arg[1]); - } - //{ *(SD**)ret = (SD*)new P(*(STR*)arg[0], *(LCDD*)arg[1]); } - }; + DD4HEP_PLUGIN_FACTORY_ARGS_3(long, _ns::LCDD*, const _ns::GH*, const _ns::STRM*) + { return make_return<long>(DD4hep::Geant4SetupAction<P>::create(*a0, *a1, *a2)); } /// Factory to create Geant4 sensitive detectors - template <typename P> class Factory<P, DS::Geant4Sensitive*(CT*, STR, DE*, LCDD*)> { - public: - typedef DS::Geant4Sensitive _S; - static void Func(void *ret, void*, ARGS arg, void*) { - *(_S**) ret = (_S*) new P((CT*) arg[0], *(STR*) arg[1], *(DE*) arg[2], *(LCDD*) arg[3]); - } - }; + DD4HEP_PLUGIN_FACTORY_ARGS_2(G4VSensitiveDetector*,std::string,_ns::LCDD*) + { return DD4hep::Geant4SensitiveDetectorFactory<P>::create(a0,*a1); } /// Factory to create Geant4 sensitive detectors - template <typename P> class Factory<P, DS::Geant4Action*(CT*, STR)> { - public: - static void Func(void *ret, void*, ARGS arg, void*) { - *(GA**) ret = (GA*) new P((CT*) arg[0], *(STR*) arg[1]); - } - }; + DD4HEP_PLUGIN_FACTORY_ARGS_4(DS::Geant4Sensitive*,_ns::CT*,std::string,_ns::DE*,_ns::LCDD*) + { return new P(a0, a1, *a2, *a3); } - /// Templated Factory for constructors without argument - template <typename P, typename R> struct FF0 { - static void Func(void *ret, void*, ARGS, void*) { - *(R*) ret = (R) (new P()); - } - }; - /// Templated Factory for constructors with exactly 1 argument - template <typename P, typename R, typename A0> struct FF1 { - static void Func(void *ret, void*, ARGS arg, void*) { - *(R*) ret = (R) (new P((A0) arg[0])); - } - }; + /// Factory to create Geant4 action objects + DD4HEP_PLUGIN_FACTORY_ARGS_2(DS::Geant4Action*,_ns::CT*, std::string) + { return new P(a0,a1); } + + /// Factory to create Geant4 equations of motion for magnetic fields + DD4HEP_PLUGIN_FACTORY_ARGS_1(G4Mag_EqRhs*,G4MagneticField*) + { return new P(a0); } /// Factory to create Geant4 steppers - template <typename P> class Factory<P, G4MagIntegratorStepper*(G4EquationOfMotion*)> : public FF1<P, G4MagIntegratorStepper*, - G4EquationOfMotion*> { - }; + DD4HEP_PLUGIN_FACTORY_ARGS_1(_ns::Stepper*,G4EquationOfMotion*) + { return new P(a0); } + /// Factory to create Geant4 steppers - template <typename P> class Factory<P, G4MagIntegratorStepper*(G4Mag_EqRhs*)> : public FF1<P, G4MagIntegratorStepper*, - G4Mag_EqRhs*> { - }; - /// Factory to create Geant4 equations of motion for magnetic fields - template <typename P> class Factory<P, G4Mag_EqRhs*(G4MagneticField*)> : public FF1<P, G4Mag_EqRhs*, G4MagneticField*> { - }; + DD4HEP_PLUGIN_FACTORY_ARGS_1(_ns::Stepper*,G4Mag_EqRhs*) + { return new P(a0); } /// Factory to create Geant4 Processes - template <typename P> class Factory<P, G4VProcess*()> : public FF0<P, G4VProcess*> { - }; - /// Factory to create Geant4 Processes - template <typename P> class Factory<P, G4VPhysicsConstructor*()> : public FF0<P, G4VPhysicsConstructor*> { - }; + DD4HEP_PLUGIN_FACTORY_ARGS_0(G4VProcess*) + { return (G4VProcess*)new P(); } + + /// Factory to create Geant4 Physics objects + DD4HEP_PLUGIN_FACTORY_ARGS_0(G4VPhysicsConstructor*) + { return new P(); } + + /// Factory to access Geant4 Particle definitions + DD4HEP_PLUGIN_FACTORY_ARGS_0(G4ParticleDefinition*) + { return P::Definition(); } + + /// Generic particle constructor + DD4HEP_PLUGIN_FACTORY_ARGS_0(long) { + P::ConstructParticle(); + return make_return<long>(1L); + } - template <typename P> class Factory<P, G4ParticleDefinition*()> { - public: - static void Func(void *ret, void*, ARGS, void*) { - *(G4ParticleDefinition**) ret = P::Definition(); - } - }; - template <typename P> class Factory<P, long()> { - public: - static void Func(void *ret, void*, ARGS, void*) { - P::ConstructParticle(); - *(long*) ret = 1L; - } - }; /// Factory to create Geant4 physics constructions - template <typename P> class Factory<P, G4VUserPhysicsList*(DS::Geant4PhysicsListActionSequence*, int)> { - public: - static void Func(void *ret, void*, ARGS a, void*) { - DD4hep::printout(DD4hep::INFO,"PhysicsList","+++ Create physics list of type:%s", - DD4hep::typeName(typeid(P)).c_str()); - *(G4VUserPhysicsList**) ret = (G4VUserPhysicsList*) new P((DS::Geant4PhysicsListActionSequence*) a[0], *(int*) a[1]); - } - }; + DD4HEP_PLUGIN_FACTORY_ARGS_2(G4VUserPhysicsList*,DS::Geant4PhysicsListActionSequence*,int) { + DD4hep::printout(DD4hep::INFO,"PhysicsList","+++ Create physics list of type:%s", + DD4hep::typeName(typeid(P)).c_str()); + return new P(a0,a1); + } /// Factory template to create Geant4 event reader objects - template <typename P> class Factory<P, DD4hep::Simulation::Geant4EventReader*(std::string)> { public: - static void Func(void *ret, void*, const std::vector<void*>& a, void*) - { *(DD4hep::Simulation::Geant4EventReader**)ret = (DD4hep::Simulation::Geant4EventReader*)new P(*(std::string*)a[0]);} - }; - + DD4HEP_PLUGIN_FACTORY_ARGS_1(_ns::RDR*,std::string) + { return new P(a0); } } -#define DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(name,func) \ - namespace DD4hep { namespace Simulation { struct external_geant4_sd_##name {}; \ - template <> G4VSensitiveDetector* Geant4SensitiveDetectorFactory< external_geant4_sd_##name >::create(const std::string& n,DD4hep::Geometry::LCDD& l) { return func(n,l); } \ - }} using DD4hep::Simulation::external_geant4_sd_##name; \ - DD4HEP_PLUGINSVC_FACTORY(external_geant4_sd_##name,name,G4VSensitiveDetector*(std::string,DD4hep::Geometry::LCDD*),__LINE__) +#define __IMPLEMENT_GEANT4SENSDET(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,geant4_sd_##name) { \ + template <> G4VSensitiveDetector* Geant4SensitiveDetectorFactory< geant4_sd_##name >:: \ + create(const str_t& n,_ns::LCDD& l) { return func (n,l); } \ + DD4HEP_PLUGINSVC_FACTORY(geant4_sd_##name,name,G4VSensitiveDetector*(std::string,_ns::LCDD*),__LINE__) } + +#define DECLARE_EXTERNAL_GEANT4SENSITIVEDETECTOR(id,func) __IMPLEMENT_GEANT4SENSDET(id,func) +#define DECLARE_GEANT4SENSITIVEDETECTOR(id) __IMPLEMENT_GEANT4SENSDET(id,new id) +#define DECLARE_GEANT4SENSITIVEDETECTOR_NS(ns,id) __IMPLEMENT_GEANT4SENSDET(id,new ns::id) -/// Plugin definition to create Geant4 sensitive detectors -#define DECLARE_GEANT4SENSITIVEDETECTOR(name) namespace DD4hep { namespace Simulation { struct geant4_sd_##name {}; \ - template <> G4VSensitiveDetector* Geant4SensitiveDetectorFactory< geant4_sd_##name >::create(const std::string& n,DD4hep::Geometry::LCDD& l) { return new name(n,l); } \ - }} using DD4hep::Simulation::geant4_sd_##name; \ - DD4HEP_PLUGINSVC_FACTORY(geant4_sd_##name,name,G4VSensitiveDetector*(std::string,DD4hep::Geometry::LCDD*),__LINE__) -#define DECLARE_GEANT4SENSITIVE_NS(ns,name) using ns::name; \ - DD4HEP_PLUGINSVC_FACTORY(name,name,DD4hep::Simulation::Geant4Sensitive*(DD4hep::Simulation::Geant4Context*,std::string,DD4hep::Geometry::DetElement*,DD4hep::Geometry::LCDD*),__LINE__) -#define DECLARE_GEANT4SENSITIVE(name) DECLARE_GEANT4SENSITIVE_NS(DD4hep::Simulation,name) +#define DECLARE_GEANT4SENSITIVE_NS(name_space,name) using name_space::name; \ + DD4HEP_PLUGINSVC_FACTORY(name,name,DS::Geant4Sensitive*(_ns::CT*,std::string,_ns::DE*,_ns::LCDD*),__LINE__) +#define DECLARE_GEANT4SENSITIVE(name) DECLARE_GEANT4SENSITIVE_NS(DD4hep::Simulation,name) /// Plugin defintion to create Geant4Action objects -#define DECLARE_GEANT4ACTION_NS(ns,name) using ns::name; \ - DD4HEP_PLUGINSVC_FACTORY(name,name,DD4hep::Simulation::Geant4Action*(DD4hep::Simulation::Geant4Context*,std::string),__LINE__) +#define DECLARE_GEANT4ACTION_NS(name_space,name) using name_space::name; \ + DD4HEP_PLUGINSVC_FACTORY(name,name,DD4hep::Simulation::Geant4Action*(_ns::CT*,std::string),__LINE__) /// Plugin defintion to create Geant4Action objects -#define DECLARE_GEANT4ACTION(name) DECLARE_GEANT4ACTION_NS(DD4hep::Simulation,name) +#define DECLARE_GEANT4ACTION(name) DECLARE_GEANT4ACTION_NS(DD4hep::Simulation,name) /// Plugin definition to create Geant4 stepper objects -#define DECLARE_GEANT4_STEPPER(name) DD4HEP_PLUGINSVC_FACTORY(G4##name,name,G4MagIntegratorStepper*(G4EquationOfMotion*),__LINE__) -#define DECLARE_GEANT4_MAGSTEPPER(name) DD4HEP_PLUGINSVC_FACTORY(G4##name,name,G4MagIntegratorStepper*(G4Mag_EqRhs*),__LINE__) +#define DECLARE_GEANT4_STEPPER(name) DD4HEP_PLUGINSVC_FACTORY(G4##name,name,_ns::Stepper*(G4EquationOfMotion*),__LINE__) +#define DECLARE_GEANT4_MAGSTEPPER(name) DD4HEP_PLUGINSVC_FACTORY(G4##name,name,_ns::Stepper*(G4Mag_EqRhs*),__LINE__) /// Plugin definition to create Geant4 equations of motion for magnetic fields -#define DECLARE_GEANT4_MAGMOTION(name) DD4HEP_PLUGINSVC_FACTORY(G4##name,name,G4Mag_EqRhs*(G4MagneticField*),__LINE__) +#define DECLARE_GEANT4_MAGMOTION(name) DD4HEP_PLUGINSVC_FACTORY(G4##name,name,G4Mag_EqRhs*(G4MagneticField*),__LINE__) /// Plugin definition to create Geant4 physics processes (G4VProcess) -#define DECLARE_GEANT4_PROCESS(name) DD4HEP_PLUGINSVC_FACTORY(name,name,G4VProcess*(),__LINE__) +#define DECLARE_GEANT4_PROCESS(name) DD4HEP_PLUGINSVC_FACTORY(name,name,G4VProcess*(),__LINE__) /// Plugin definition to create Geant4 physics constructors (G4VPhysicsConstructor) -#define DECLARE_GEANT4_PHYSICS(name) DD4HEP_PLUGINSVC_FACTORY(name,name,G4VPhysicsConstructor*(),__LINE__) +#define DECLARE_GEANT4_PHYSICS(name) DD4HEP_PLUGINSVC_FACTORY(name,name,G4VPhysicsConstructor*(),__LINE__) /// Plugin definition to force particle constructors for GEANT4 (G4ParticleDefinition) -#define DECLARE_GEANT4_PARTICLE(name) DD4HEP_PLUGINSVC_FACTORY(name,name,G4ParticleDefinition*(),__LINE__) +#define DECLARE_GEANT4_PARTICLE(name) DD4HEP_PLUGINSVC_FACTORY(name,name,G4ParticleDefinition*(),__LINE__) /// Plugin definition to force particle constructors for GEANT4 (G4XXXXConstructor) #define DECLARE_GEANT4_PARTICLEGROUP(name) DD4HEP_PLUGINSVC_FACTORY(name,name,long(),__LINE__) /// Plugin definition to force geant4 physics constructs such as FTFP_BERT (from source/physics_lists/) etc -#define DECLARE_GEANT4_PHYSICS_LIST(name) typedef DD4hep::Simulation::Geant4UserPhysicsList< name > G4_physics_list_##name; \ - DD4HEP_PLUGINSVC_FACTORY(G4_physics_list_##name,name,G4VUserPhysicsList*(DD4hep::Simulation::Geant4PhysicsListActionSequence*,int),__LINE__) - -#define DECLARE_GEANT4_SETUP(name,func) \ - namespace DD4hep { namespace Simulation { struct xml_g4_setup_##name {}; \ - template <> long Geant4SetupAction<DD4hep::Simulation::xml_g4_setup_##name>::create(LCDD& l,const DD4hep::Geometry::GeoHandler& e, const std::map<std::string,std::string>& a) {return func(l,e,a);} }} \ - DD4HEP_PLUGINSVC_FACTORY(xml_g4_setup_##name,name##_Geant4_action,long(DD4hep::Geometry::LCDD*,const DD4hep::Geometry::GeoHandler*,const std::map<std::string,std::string>*),__LINE__) +#define DECLARE_GEANT4_PHYSICS_LIST(name) typedef DS::Geant4UserPhysicsList< name > G4_physics_list_##name; \ + DD4HEP_PLUGINSVC_FACTORY(G4_physics_list_##name,name,G4VUserPhysicsList*(DS::Geant4PhysicsListActionSequence*,int),__LINE__) +/// Plugin defintion for setup actions +#define DECLARE_GEANT4_SETUP(name,func) DD4HEP_OPEN_PLUGIN(DD4hep,xml_g4_setup_##name) { \ + template <> long Geant4SetupAction< xml_g4_setup_##name >:: \ + create(_ns::LCDD& l,const _ns::GH& e, const _ns::STRM& a) {return func(l,e,a);} \ + DD4HEP_PLUGINSVC_FACTORY(xml_g4_setup_##name,name##_Geant4_action,long(_ns::LCDD*,const _ns::GH*,const _ns::STRM*),__LINE__) } /// Plugin defintion to create event reader objects -#define DECLARE_GEANT4_EVENT_READER(name) \ - DD4HEP_PLUGINSVC_FACTORY(name,name,DD4hep::Simulation::Geant4EventReader*(std::string),__LINE__) +#define DECLARE_GEANT4_EVENT_READER(name) DD4HEP_PLUGINSVC_FACTORY(name,name,_ns::RDR*(std::string),__LINE__) /// Plugin defintion to create event reader objects -#define DECLARE_GEANT4_EVENT_READER_NS(ns,name) typedef ns::name __##name##__; \ - DD4HEP_PLUGINSVC_FACTORY(__##name##__,name,DD4hep::Simulation::Geant4EventReader*(std::string),__LINE__) +#define DECLARE_GEANT4_EVENT_READER_NS(name_space,name) typedef name_space::name __##name##__; \ + DD4HEP_PLUGINSVC_FACTORY(__##name##__,name,_ns::RDR*(std::string),__LINE__) #endif // DDG4_FACTORIES_H diff --git a/DDG4/include/DDG4/Geant4Action.h b/DDG4/include/DDG4/Geant4Action.h index c5c671616e4782938559e9c2b5759b9ad4747d53..e571c37c16620d1779e77289ec8eeb5de8bc37b5 100644 --- a/DDG4/include/DDG4/Geant4Action.h +++ b/DDG4/include/DDG4/Geant4Action.h @@ -1,15 +1,21 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- -// -// Author : M.Frank -// -//==================================================================== + #ifndef DD4HEP_DDG4_GEANT4ACTION_H #define DD4HEP_DDG4_GEANT4ACTION_H // Framework include files +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (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/Printout.h" #include "DDG4/Geant4Context.h" #include "DDG4/Geant4Callback.h" diff --git a/DDG4/include/DDG4/Geant4ActionPhase.h b/DDG4/include/DDG4/Geant4ActionPhase.h index 3ba94568e1028737e983c401a1114e6698840bcc..b4f2de603e91375cf9e859a2c84e29954e2edd6b 100644 --- a/DDG4/include/DDG4/Geant4ActionPhase.h +++ b/DDG4/include/DDG4/Geant4ActionPhase.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4ACTIONPHASE_H #define DD4HEP_DDG4_GEANT4ACTIONPHASE_H @@ -91,7 +96,7 @@ namespace DD4hep { virtual bool remove(Geant4Action* action, Callback callback); /// Add a new member to the phase template <typename TYPE, typename IF_TYPE, typename A0, typename R> - bool add(TYPE* member, R (IF_TYPE::*callback)(A0 arg)) { + bool add(TYPE* member, R (IF_TYPE::*callback)(A0 arg)) { typeinfoCheck(typeid(A0), *m_argTypes[0], "Invalid ARG0 type. Failed to add phase callback."); if (dynamic_cast<IF_TYPE*>(member)) { return add(member,Callback(member).make(callback)); @@ -100,7 +105,7 @@ namespace DD4hep { } /// Add a new member to the phase template <typename TYPE, typename IF_TYPE, typename A0, typename A1, typename R> - bool add(TYPE* member, R (IF_TYPE::*callback)(A0 arg0, A1 arg1)) { + bool add(TYPE* member, R (IF_TYPE::*callback)(A0 arg0, A1 arg1)) { typeinfoCheck(typeid(A0), *m_argTypes[0], "Invalid ARG0 type. Failed to add phase callback."); typeinfoCheck(typeid(A1), *m_argTypes[1], "Invalid ARG1 type. Failed to add phase callback."); if (dynamic_cast<IF_TYPE*>(member)) { @@ -110,7 +115,7 @@ namespace DD4hep { } /// Add a new member to the phase template <typename TYPE, typename IF_TYPE, typename A0, typename A1, typename A2, typename R> - bool add(TYPE* member, R (IF_TYPE::*callback)(A0 arg0, A1 arg1)) { + bool add(TYPE* member, R (IF_TYPE::*callback)(A0 arg0, A1 arg1)) { typeinfoCheck(typeid(A0), *m_argTypes[0], "Invalid ARG0 type. Failed to add phase callback."); typeinfoCheck(typeid(A1), *m_argTypes[1], "Invalid ARG1 type. Failed to add phase callback."); typeinfoCheck(typeid(A2), *m_argTypes[2], "Invalid ARG2 type. Failed to add phase callback."); diff --git a/DDG4/include/DDG4/Geant4AssemblyVolume.h b/DDG4/include/DDG4/Geant4AssemblyVolume.h index 469802957dab5d2958a193700c69d7126599f99b..324b3a1129af4de38cf2e84a83b291c4b76b62bd 100644 --- a/DDG4/include/DDG4/Geant4AssemblyVolume.h +++ b/DDG4/include/DDG4/Geant4AssemblyVolume.h @@ -1,3 +1,17 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + #define private public #include "G4AssemblyVolume.hh" #undef private diff --git a/DDG4/include/DDG4/Geant4Call.h b/DDG4/include/DDG4/Geant4Call.h index 31aa6f2a0b75dc82bc51d2fbb6be72cdb471f494..5869767c165cf684c93555239c2b18204c85eec4 100644 --- a/DDG4/include/DDG4/Geant4Call.h +++ b/DDG4/include/DDG4/Geant4Call.h @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 875 2013-11-04 16:15:14Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4CALL_H #define DD4HEP_DDG4_GEANT4CALL_H diff --git a/DDG4/include/DDG4/Geant4Callback.h b/DDG4/include/DDG4/Geant4Callback.h index 3010426f3ac7e84d1620f7b1a883f7a7cb31268d..d5f6b208ad4df122bfaa0e3036d0d8c5d453bf54 100644 --- a/DDG4/include/DDG4/Geant4Callback.h +++ b/DDG4/include/DDG4/Geant4Callback.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4CALLBACK_H #define DD4HEP_DDG4_GEANT4CALLBACK_H diff --git a/DDG4/include/DDG4/Geant4Config.h b/DDG4/include/DDG4/Geant4Config.h index 2690d9ec80c85139351819a46d9e97965c57f6d7..96c82be1ba04cacaa5c5282b9b1768ad135f62dc 100644 --- a/DDG4/include/DDG4/Geant4Config.h +++ b/DDG4/include/DDG4/Geant4Config.h @@ -1,13 +1,20 @@ -// $Id: Geant4config.h 615 2013-06-18 11:13:35Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== // // Small helper file with abbreviations to write configurations // for CINT; also used when writing the XML configuration. // -// Author : M.Frank -// //==================================================================== #ifndef DDG4_GEANT4CONFIG_H #define DDG4_GEANT4CONFIG_H diff --git a/DDG4/include/DDG4/Geant4Context.h b/DDG4/include/DDG4/Geant4Context.h index bd7b46a9b3c07c7b636edd4e9a5946e447d5df09..5dc9ca381793fa1a311a775590605a7fddaba95b 100644 --- a/DDG4/include/DDG4/Geant4Context.h +++ b/DDG4/include/DDG4/Geant4Context.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4CONTEXT_H #define DD4HEP_DDG4_GEANT4CONTEXT_H diff --git a/DDG4/include/DDG4/Geant4Converter.h b/DDG4/include/DDG4/Geant4Converter.h index 6d05fe964211b02904ad7e643c5f075e2997c2d0..4b96fa63b3c8cf2ef98a14fb1a72dd16db1c1f47 100644 --- a/DDG4/include/DDG4/Geant4Converter.h +++ b/DDG4/include/DDG4/Geant4Converter.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEANT4CONVERTER_H #define DD4HEP_GEANT4CONVERTER_H diff --git a/DDG4/include/DDG4/Geant4Data.h b/DDG4/include/DDG4/Geant4Data.h index 5cf3c0adebfe018b4b749f3ad8106f25b73a0ec7..cc7ee3378fd42f44ada6658e2fe75366276a1451 100644 --- a/DDG4/include/DDG4/Geant4Data.h +++ b/DDG4/include/DDG4/Geant4Data.h @@ -1,11 +1,17 @@ -// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEANT4DATA_H #define DD4HEP_GEANT4DATA_H @@ -126,29 +132,29 @@ namespace DD4hep { float x,y,z; /// Default constructor - MonteCarloContrib() - : trackID(-1), pdgID(-1), deposit(0.0), time(0.0), x(0), y(0), z(0) { + MonteCarloContrib() + : trackID(-1), pdgID(-1), deposit(0.0), time(0.0), x(0), y(0), z(0) { } /// Initializing constructor - MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp) - : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp), x(0), y(0), z(0) { + MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp) + : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp), x(0), y(0), z(0) { } /// Initializing constructor - MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, float* pos) - : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp), - x(pos[0]), y(pos[1]), z(pos[2]) - { - } + MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, float* pos) + : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp), + x(pos[0]), y(pos[1]), z(pos[2]) + { + } /// Initializing constructor - MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, double* pos) - : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp), - x(pos[0]), y(pos[1]), z(pos[2]) - { - } + MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp, double* pos) + : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp), + x(pos[0]), y(pos[1]), z(pos[2]) + { + } /// Copy constructor - MonteCarloContrib(const MonteCarloContrib& c) - : trackID(c.trackID), pdgID(c.pdgID), deposit(c.deposit), time(c.time), - x(c.x), y(c.y), z(c.z) { + MonteCarloContrib(const MonteCarloContrib& c) + : trackID(c.trackID), pdgID(c.pdgID), deposit(c.deposit), time(c.time), + x(c.x), y(c.y), z(c.z) { } /// Assignment operator MonteCarloContrib& operator=(const MonteCarloContrib& c) { diff --git a/DDG4/include/DDG4/Geant4DataConversion.h b/DDG4/include/DDG4/Geant4DataConversion.h index 65d14693edf9b8973d7fe1eb7d6b8a7604c9d027..7d492cb72cc8ce60c2f00490a7c368ff6154b359 100644 --- a/DDG4/include/DDG4/Geant4DataConversion.h +++ b/DDG4/include/DDG4/Geant4DataConversion.h @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 875 2013-11-04 16:15:14Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4CONVERSION_H #define DD4HEP_DDG4_GEANT4CONVERSION_H @@ -77,37 +83,37 @@ namespace DD4hep { namespace Simulation { template <typename OUTPUT,typename ARGS> - Geant4Conversion<OUTPUT,ARGS>::Geant4Conversion() + Geant4Conversion<OUTPUT,ARGS>::Geant4Conversion() : Geant4ConversionHelper() - { - } + { + } template <typename OUTPUT,typename ARGS> - Geant4Conversion<OUTPUT,ARGS>::~Geant4Conversion() - { - } + Geant4Conversion<OUTPUT,ARGS>::~Geant4Conversion() + { + } template <typename OUTPUT,typename ARGS> - typename Geant4Conversion<OUTPUT,ARGS>::Converters& - Geant4Conversion<OUTPUT,ARGS>::conversions() - { - static Converters s_converter; - return s_converter; - } + typename Geant4Conversion<OUTPUT,ARGS>::Converters& + Geant4Conversion<OUTPUT,ARGS>::conversions() + { + static Converters s_converter; + return s_converter; + } template <typename OUTPUT, typename ARGS> - const Geant4Conversion<OUTPUT,ARGS>& - Geant4Conversion<OUTPUT,ARGS>::converter(const std::type_info& typ) - { - typename Converters::const_iterator i = conversions().find(&typ); - if ( i != conversions().end() ) { - return *((*i).second); - } - throw std::runtime_error(typeName(typeid(self_t))+ - ": No appropriate LCIO_OUTPUT conversion " - "mechanism known for tag:"+ - typeName(typ)); + const Geant4Conversion<OUTPUT,ARGS>& + Geant4Conversion<OUTPUT,ARGS>::converter(const std::type_info& typ) + { + typename Converters::const_iterator i = conversions().find(&typ); + if ( i != conversions().end() ) { + return *((*i).second); } + throw std::runtime_error(typeName(typeid(self_t))+ + ": No appropriate LCIO_OUTPUT conversion " + "mechanism known for tag:"+ + typeName(typ)); + } /// Template class for data conversion. To be specialized by the client. /** @@ -116,17 +122,17 @@ namespace DD4hep { * \ingroup DD4HEP_SIMULATION */ template <typename OUTPUT, typename ARGS, typename TAG> - class Geant4DataConversion : public Geant4Conversion<OUTPUT,ARGS> { + class Geant4DataConversion : public Geant4Conversion<OUTPUT,ARGS> { public: typedef TAG tag_t; typedef ARGS arg_t; typedef OUTPUT output_t; typedef Geant4Conversion<output_t,arg_t> self_t; - Geant4DataConversion(void*) : Geant4Conversion<OUTPUT,ARGS>() - { - this->self_t::conversions().insert(make_pair(&typeid(TAG),this)); - //std::cout << "Registered " << typeName(typeid(*this)) << std::endl; - } + Geant4DataConversion(void*) : Geant4Conversion<OUTPUT,ARGS>() + { + this->self_t::conversions().insert(make_pair(&typeid(TAG),this)); + //std::cout << "Registered " << typeName(typeid(*this)) << std::endl; + } virtual OUTPUT* operator()(const ARGS& args) const; }; diff --git a/DDG4/include/DDG4/Geant4DataDump.h b/DDG4/include/DDG4/Geant4DataDump.h index b6d2865cdc881035c6b1f1de9da0c17b4695c679..65c9d14426fec730122f09aaf2b8653522dffefe 100644 --- a/DDG4/include/DDG4/Geant4DataDump.h +++ b/DDG4/include/DDG4/Geant4DataDump.h @@ -1,11 +1,17 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4DATADUMP_H #define DD4HEP_DDG4_GEANT4DATADUMP_H diff --git a/DDG4/include/DDG4/Geant4DetectorConstruction.h b/DDG4/include/DDG4/Geant4DetectorConstruction.h index 62500f157ef85ac69a2be9e55281d0deb3ca16e4..32dbab73f25498cdbc5b2e1c8bcde2d8d1b2dbb6 100644 --- a/DDG4/include/DDG4/Geant4DetectorConstruction.h +++ b/DDG4/include/DDG4/Geant4DetectorConstruction.h @@ -1,10 +1,17 @@ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id$ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEANT4DETECTORCONSTRUCTION_H #define DD4HEP_GEANT4DETECTORCONSTRUCTION_H diff --git a/DDG4/include/DDG4/Geant4EventAction.h b/DDG4/include/DDG4/Geant4EventAction.h index beff038651aa0df4d8395da5362c352ffaa1c7a3..c816930a391c637aa6465d8a173ffba02cd1e514 100644 --- a/DDG4/include/DDG4/Geant4EventAction.h +++ b/DDG4/include/DDG4/Geant4EventAction.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4EVENTACTION_H #define DD4HEP_DDG4_GEANT4EVENTACTION_H @@ -79,17 +85,17 @@ namespace DD4hep { virtual ~Geant4EventActionSequence(); /// Register begin-of-event callback template <typename Q, typename T> - void callAtBegin(Q* p, void (T::*f)(const G4Event*)) { + void callAtBegin(Q* p, void (T::*f)(const G4Event*)) { m_begin.add(p, f); } /// Register end-of-event callback template <typename Q, typename T> - void callAtEnd(Q* p, void (T::*f)(const G4Event*)) { + void callAtEnd(Q* p, void (T::*f)(const G4Event*)) { m_end.add(p, f); } /// Register event-cleanup callback (after end-of-event callback -- unordered) template <typename Q, typename T> - void callAtFinal(Q* p, void (T::*f)(const G4Event*)) { + void callAtFinal(Q* p, void (T::*f)(const G4Event*)) { m_final.add(p, f); } /// Add an actor responding to all callbacks. Sequence takes ownership. diff --git a/DDG4/include/DDG4/Geant4Field.h b/DDG4/include/DDG4/Geant4Field.h index 62f220ea374f79bc390750c3776ecc145e5d5600..33eff2890c4c4e4f0758a0348f5816fa232967c9 100644 --- a/DDG4/include/DDG4/Geant4Field.h +++ b/DDG4/include/DDG4/Geant4Field.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4FIELD_H #define DD4HEP_DDG4_GEANT4FIELD_H @@ -38,8 +44,8 @@ namespace DD4hep { public: /// Constructor. The sensitive detector element is identified by the detector name - Geant4Field(Geometry::OverlayedField field) - : m_field(field) { + Geant4Field(Geometry::OverlayedField field) + : m_field(field) { } /// Standard destructor virtual ~Geant4Field() { diff --git a/DDG4/include/DDG4/Geant4GDMLDetector.h b/DDG4/include/DDG4/Geant4GDMLDetector.h index f94d306a09b3ddc8af7c67c3bcd9f626b1709c47..16b23df4ea6811600952f6a18caa892d41642cfd 100644 --- a/DDG4/include/DDG4/Geant4GDMLDetector.h +++ b/DDG4/include/DDG4/Geant4GDMLDetector.h @@ -1,10 +1,17 @@ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_Geant4GDMLDetector_H #define DD4HEP_Geant4GDMLDetector_H diff --git a/DDG4/include/DDG4/Geant4GeneratorAction.h b/DDG4/include/DDG4/Geant4GeneratorAction.h index badff9f15f583e60ba1b8281a75ddf3437c80457..14e597b702f58c392956b0586d87b309d405e703 100644 --- a/DDG4/include/DDG4/Geant4GeneratorAction.h +++ b/DDG4/include/DDG4/Geant4GeneratorAction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4GENERATORACTION_H #define DD4HEP_DDG4_GEANT4GENERATORACTION_H @@ -73,7 +78,7 @@ namespace DD4hep { virtual ~Geant4GeneratorActionSequence(); /// Register primary particle generation callback. Types Q and T must be polymorph! template <typename Q, typename T> - void call(Q* p, void (T::*f)(G4Event*)) { + void call(Q* p, void (T::*f)(G4Event*)) { m_calls.add(p, f); } /// Add an actor responding to all callbacks. Sequence takes ownership. diff --git a/DDG4/include/DDG4/Geant4GeneratorActionInit.h b/DDG4/include/DDG4/Geant4GeneratorActionInit.h index 391460c9af3ebdc980ece4bde9b6f43f94dd5d21..265f102c155314576267a279df76a317f642f28a 100644 --- a/DDG4/include/DDG4/Geant4GeneratorActionInit.h +++ b/DDG4/include/DDG4/Geant4GeneratorActionInit.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4GENERATORACTIONINIT_H #define DD4HEP_DDG4_GEANT4GENERATORACTIONINIT_H diff --git a/DDG4/include/DDG4/Geant4GeometryInfo.h b/DDG4/include/DDG4/Geant4GeometryInfo.h index fe6fe13f66bb96d1dc4ecd3284d9530c59a3165a..febae86b495b311b59a86e68ba0a6f602cc27084 100644 --- a/DDG4/include/DDG4/Geant4GeometryInfo.h +++ b/DDG4/include/DDG4/Geant4GeometryInfo.h @@ -1,11 +1,17 @@ -// $Id: Geant4Geometryinfo.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4GEOMETRYINFO_H #define DD4HEP_DDG4_GEANT4GEOMETRYINFO_H diff --git a/DDG4/include/DDG4/Geant4Handle.h b/DDG4/include/DDG4/Geant4Handle.h index df3693c142e3381dfbdce2b84a2f18a7b0bdf9f8..c430c81055d2269e26606ad95c981fad6b979ad4 100644 --- a/DDG4/include/DDG4/Geant4Handle.h +++ b/DDG4/include/DDG4/Geant4Handle.h @@ -1,12 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== -#ifndef DD4HEP_DDG4_GEANT4SETUP_H +// Author : M.Frank +// +//========================================================================== + #define DD4HEP_DDG4_GEANT4SETUP_H // Framework include files diff --git a/DDG4/include/DDG4/Geant4HierarchyDump.h b/DDG4/include/DDG4/Geant4HierarchyDump.h index db19b24737a194104a8c49effad18786662d0f44..ee3d891b60277021937803c9ada26557981a0cd3 100644 --- a/DDG4/include/DDG4/Geant4HierarchyDump.h +++ b/DDG4/include/DDG4/Geant4HierarchyDump.h @@ -1,10 +1,17 @@ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4HIERARCHYDUMP_H #define DD4HEP_DDG4_GEANT4HIERARCHYDUMP_H diff --git a/DDG4/include/DDG4/Geant4HitCollection.h b/DDG4/include/DDG4/Geant4HitCollection.h index e4ebefad56bf48bf1d31e2603ab988210cbb5661..4f6a28da2ed3dc173ac305b00ca8ab20745d98fe 100644 --- a/DDG4/include/DDG4/Geant4HitCollection.h +++ b/DDG4/include/DDG4/Geant4HitCollection.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4HITCOLLECTION_H #define DD4HEP_DDG4_GEANT4HITCOLLECTION_H @@ -105,18 +110,18 @@ namespace DD4hep { public: /// Default constructor - Geant4HitWrapper() : G4VHit() { + Geant4HitWrapper() : G4VHit() { m_data.second = manipulator<InvalidHit>(); m_data.first = 0; } /// Copy constructor - Geant4HitWrapper(const Geant4HitWrapper& v) : G4VHit() { + Geant4HitWrapper(const Geant4HitWrapper& v) : G4VHit() { m_data = v.m_data; v.m_data.first = 0; //v.release(); } /// Copy constructor - Geant4HitWrapper(const Wrapper& v) : G4VHit() { + Geant4HitWrapper(const Wrapper& v) : G4VHit() { m_data = v; } /// Default destructor @@ -219,17 +224,17 @@ namespace DD4hep { public: /// Initializing constructor (C++ version) template <typename TYPE> - Geant4HitCollection(const std::string& det, const std::string& coll, Geant4Sensitive* sd) + Geant4HitCollection(const std::string& det, const std::string& coll, Geant4Sensitive* sd) : G4VHitsCollection(det, coll), m_detector(sd), - m_manipulator(Geant4HitWrapper::manipulator<TYPE>()) { + m_manipulator(Geant4HitWrapper::manipulator<TYPE>()) { newInstance(); m_hits.reserve(200); } /// Initializing constructor template <typename TYPE> - Geant4HitCollection(const std::string& det, const std::string& coll, Geant4Sensitive* sd, const TYPE*) + Geant4HitCollection(const std::string& det, const std::string& coll, Geant4Sensitive* sd, const TYPE*) : G4VHitsCollection(det, coll), m_detector(sd), - m_manipulator(Geant4HitWrapper::manipulator<TYPE>()) { + m_manipulator(Geant4HitWrapper::manipulator<TYPE>()) { newInstance(); m_hits.reserve(200); } @@ -310,13 +315,13 @@ namespace DD4hep { public: const POS& pos; /// Constructor - PositionCompare(const POS& p) : pos(p) { } + PositionCompare(const POS& p) : pos(p) { } /// Comparison function virtual void* operator()(const Geant4HitWrapper& w) const; }; template <typename TYPE, typename POS> - void* PositionCompare<TYPE,POS>::operator()(const Geant4HitWrapper& w) const { + void* PositionCompare<TYPE,POS>::operator()(const Geant4HitWrapper& w) const { TYPE* h = w; return pos == h->position ? h : 0; } @@ -333,13 +338,13 @@ namespace DD4hep { public: long long int id; /// Constructor - CellIDCompare(long long int i) : id(i) { } + CellIDCompare(long long int i) : id(i) { } /// Comparison function. virtual void* operator()(const Geant4HitWrapper& w) const; }; template <typename TYPE> - void* CellIDCompare<TYPE>::operator()(const Geant4HitWrapper& w) const { + void* CellIDCompare<TYPE>::operator()(const Geant4HitWrapper& w) const { TYPE* h = w; if ( id == h->cellID ) return h; diff --git a/DDG4/include/DDG4/Geant4Hits.h b/DDG4/include/DDG4/Geant4Hits.h index 0e7449218d447c8d51fce4a3c675dd6387fa8c0c..c3a7844c46c34685a0491b9c7b75fd246b7b3c59 100644 --- a/DDG4/include/DDG4/Geant4Hits.h +++ b/DDG4/include/DDG4/Geant4Hits.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEANT4HITS_H #define DD4HEP_GEANT4HITS_H @@ -52,8 +58,8 @@ namespace DD4hep { template <class HIT> struct HitPositionCompare: public HitCompare<HIT> { const Position& pos; /// Constructor - HitPositionCompare(const Position& p) - : pos(p) { + HitPositionCompare(const Position& p) + : pos(p) { } /// Default destructor virtual ~HitPositionCompare() {} @@ -89,18 +95,18 @@ namespace DD4hep { double deposit; /// Timestamp when this energy was deposited double time; - MonteCarloContrib() - : trackID(-1), pdgID(-1), deposit(0.0), time(0.0) { - } - MonteCarloContrib(int track_id, double dep, double time_stamp) - : trackID(track_id), pdgID(-1), deposit(dep), time(time_stamp) { - } - MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp) - : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp) { - } - MonteCarloContrib(const MonteCarloContrib& c) - : trackID(c.trackID), pdgID(c.pdgID), deposit(c.deposit), time(c.time) { - } + MonteCarloContrib() + : trackID(-1), pdgID(-1), deposit(0.0), time(0.0) { + } + MonteCarloContrib(int track_id, double dep, double time_stamp) + : trackID(track_id), pdgID(-1), deposit(dep), time(time_stamp) { + } + MonteCarloContrib(int track_id, int pdg, double dep, double time_stamp) + : trackID(track_id), pdgID(pdg), deposit(dep), time(time_stamp) { + } + MonteCarloContrib(const MonteCarloContrib& c) + : trackID(c.trackID), pdgID(c.pdgID), deposit(c.deposit), time(c.time) { + } /// Assignment operator MonteCarloContrib& operator=(const MonteCarloContrib& c) { if ( this != &c ) { @@ -111,17 +117,17 @@ namespace DD4hep { } return *this; } - void clear() { - time = deposit = 0.0; - pdgID = trackID = -1; - } + void clear() { + time = deposit = 0.0; + pdgID = trackID = -1; + } }; typedef MonteCarloContrib Contribution; typedef std::vector<MonteCarloContrib> Contributions; public: /// Standard constructor - Geant4Hit() : cellID(0) { + Geant4Hit() : cellID(0) { } /// Default destructor virtual ~Geant4Hit() { diff --git a/DDG4/include/DDG4/Geant4InputAction.h b/DDG4/include/DDG4/Geant4InputAction.h index a9f3c551c361216ff2ac7c78865fcdddb30274f9..32eda4baf6e8851ac575b39d7c1ccc95d81989cc 100644 --- a/DDG4/include/DDG4/Geant4InputAction.h +++ b/DDG4/include/DDG4/Geant4InputAction.h @@ -1,9 +1,17 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (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_DDG4_GEANT4INPUTACTION_H #define DD4HEP_DDG4_GEANT4INPUTACTION_H diff --git a/DDG4/include/DDG4/Geant4InputHandling.h b/DDG4/include/DDG4/Geant4InputHandling.h index ba0e2019c848d249b87b33b3ea6e9d9ec9b13a70..c94db3aa52189b895f7f4daf71fddb90aba73d02 100644 --- a/DDG4/include/DDG4/Geant4InputHandling.h +++ b/DDG4/include/DDG4/Geant4InputHandling.h @@ -1,10 +1,17 @@ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4INPUTHANDLING_H #define DD4HEP_DDG4_GEANT4INPUTHANDLING_H diff --git a/DDG4/include/DDG4/Geant4InteractionMerger.h b/DDG4/include/DDG4/Geant4InteractionMerger.h index 6e2009c3c2215fb52e288b49c36f0fa4e0e432d3..33bd53c0b9d53627cc449c56ca25b2344c43c702 100644 --- a/DDG4/include/DDG4/Geant4InteractionMerger.h +++ b/DDG4/include/DDG4/Geant4InteractionMerger.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4INTERACTIONMERGER_H #define DD4HEP_DDG4_GEANT4INTERACTIONMERGER_H diff --git a/DDG4/include/DDG4/Geant4InteractionVertexBoost.h b/DDG4/include/DDG4/Geant4InteractionVertexBoost.h index 6371ebc4a1a25e65dd159b628a60b373a9723ab0..b83b77840021d6123ef3e0ae04df5add3d666e66 100644 --- a/DDG4/include/DDG4/Geant4InteractionVertexBoost.h +++ b/DDG4/include/DDG4/Geant4InteractionVertexBoost.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4INTERACTIONVERTEXBOOST_H #define DD4HEP_DDG4_GEANT4INTERACTIONVERTEXBOOST_H diff --git a/DDG4/include/DDG4/Geant4InteractionVertexSmear.h b/DDG4/include/DDG4/Geant4InteractionVertexSmear.h index ed61f8938581ce1394d324ea68e6ac7126fe7f5c..301cedb818ea36e31b5cd1b1e05a901c13394664 100644 --- a/DDG4/include/DDG4/Geant4InteractionVertexSmear.h +++ b/DDG4/include/DDG4/Geant4InteractionVertexSmear.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4INTERACTIONVERTEXSMEAR_H #define DD4HEP_DDG4_GEANT4INTERACTIONVERTEXSMEAR_H diff --git a/DDG4/include/DDG4/Geant4IsotropeGenerator.h b/DDG4/include/DDG4/Geant4IsotropeGenerator.h index 08880af4b581bbcb9caf00c5d523cbf0db059206..9b39ec88e8407e9c392c9649fb0304beff9ed3e9 100644 --- a/DDG4/include/DDG4/Geant4IsotropeGenerator.h +++ b/DDG4/include/DDG4/Geant4IsotropeGenerator.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4ISOTROPEGENERATOR_H #define DD4HEP_DDG4_GEANT4ISOTROPEGENERATOR_H @@ -27,8 +33,8 @@ namespace DD4hep { protected: /// Particle modification. Caller presets defaults to: ( direction = m_direction, momentum = m_energy) /** Use this function to implement isotrop guns, multiple guns etc. - User must return a UNIT vector, which gets scaled with momentum. - */ + User must return a UNIT vector, which gets scaled with momentum. + */ virtual void getParticleDirection(int num, ROOT::Math::XYZVector& direction, double& momentum) const; public: diff --git a/DDG4/include/DDG4/Geant4Kernel.h b/DDG4/include/DDG4/Geant4Kernel.h index 74f36eaf93b6bc9d112e2538e99b63eeaeb8c8c5..544dd6ca200a8fe3f825c41745e0063dbe8027e4 100644 --- a/DDG4/include/DDG4/Geant4Kernel.h +++ b/DDG4/include/DDG4/Geant4Kernel.h @@ -1,11 +1,16 @@ -// $Id: $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4KERNEL_H #define DD4HEP_DDG4_GEANT4KERNEL_H @@ -129,8 +134,8 @@ namespace DD4hep { PhaseSelector(Geant4Kernel* kernel); /// Copy constructor PhaseSelector(const PhaseSelector& c); - /// Assignment operator - PhaseSelector& operator=(const PhaseSelector& c); + /// Assignment operator + PhaseSelector& operator=(const PhaseSelector& c); /// Phase access to the map Geant4ActionPhase& operator[](const std::string& name) const; } phase; @@ -162,11 +167,11 @@ namespace DD4hep { } /// Access the tracking manager G4TrackingManager* trackMgr() const { - return m_trackMgr; + return m_trackMgr; } /// Access the tracking manager void setTrackMgr(G4TrackingManager* mgr) { - m_trackMgr = mgr; + m_trackMgr = mgr; } /// Access to the Geant4 run manager G4RunManager& runManager(); @@ -184,7 +189,7 @@ namespace DD4hep { Property& property(const std::string& name); /// Access the output level PrintLevel outputLevel() const { - return (PrintLevel)m_outputLevel; + return (PrintLevel)m_outputLevel; } /// Set the global output level of the kernel object; returns previous value PrintLevel setOutputLevel(PrintLevel new_level); @@ -218,7 +223,7 @@ namespace DD4hep { /// Add a new phase to the phase virtual Geant4ActionPhase* addPhase(const std::string& name, const std::type_info& arg1, const std::type_info& arg2, - const std::type_info& arg3, bool throw_on_exist); + const std::type_info& arg3, bool throw_on_exist); /// Add a new phase to the phase template <typename A0> Geant4ActionPhase* addPhase(const std::string& name, bool throw_on_exist = true) { return addPhase(name, typeid(A0), typeid(void), typeid(void), throw_on_exist); diff --git a/DDG4/include/DDG4/Geant4Mapping.h b/DDG4/include/DDG4/Geant4Mapping.h index 060efd4a8e300f4f7648ed3503ef3fd539327071..16ce142b84907111b1de43250dccba997f00221d 100644 --- a/DDG4/include/DDG4/Geant4Mapping.h +++ b/DDG4/include/DDG4/Geant4Mapping.h @@ -1,11 +1,17 @@ -// $Id: Geant4Mapping.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4MAPPING_H #define DD4HEP_DDG4_GEANT4MAPPING_H diff --git a/DDG4/include/DDG4/Geant4MonteCarloTruth.h b/DDG4/include/DDG4/Geant4MonteCarloTruth.h index 27507ad073119d04a51411d154e563ee542b26a6..0fde37435c10246cf8de3ce06151863f3699f18a 100644 --- a/DDG4/include/DDG4/Geant4MonteCarloTruth.h +++ b/DDG4/include/DDG4/Geant4MonteCarloTruth.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4MONTECARLOTRUTH_H #define DD4HEP_DDG4_GEANT4MONTECARLOTRUTH_H diff --git a/DDG4/include/DDG4/Geant4Output2ROOT.h b/DDG4/include/DDG4/Geant4Output2ROOT.h index a901d0a0859b186ffd0ebc54f33e659fefac4da3..d0f0c623408c302685c41c22c78bcdbe617d16dc 100644 --- a/DDG4/include/DDG4/Geant4Output2ROOT.h +++ b/DDG4/include/DDG4/Geant4Output2ROOT.h @@ -1,11 +1,16 @@ -// $Id: Geant4Field.cpp 875 2013-11-04 16:15:14Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4OUTPUT2ROOT_H #define DD4HEP_DDG4_GEANT4OUTPUT2ROOT_H diff --git a/DDG4/include/DDG4/Geant4OutputAction.h b/DDG4/include/DDG4/Geant4OutputAction.h index e7efac7251db7bcc31bbba4667eb1ee3309a2adc..c05f1d864be28463a7737bfb88e50502d8e5a209 100644 --- a/DDG4/include/DDG4/Geant4OutputAction.h +++ b/DDG4/include/DDG4/Geant4OutputAction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Field.cpp 875 2013-11-04 16:15:14Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4OUTPUTACTION_H #define DD4HEP_DDG4_GEANT4OUTPUTACTION_H @@ -40,8 +45,8 @@ namespace DD4hep { public: const T* context; void* userData; - OutputContext(const T* c) - : context(c), userData(0) { + OutputContext(const T* c) + : context(c), userData(0) { } template <typename U> U* data() const { return (U*) userData; diff --git a/DDG4/include/DDG4/Geant4Particle.h b/DDG4/include/DDG4/Geant4Particle.h index b052e4583308722453f97d21b04f3916e3c7532b..7e3a0982e170ad5ed1dfb3f23b3ede2c3bc24b49 100644 --- a/DDG4/include/DDG4/Geant4Particle.h +++ b/DDG4/include/DDG4/Geant4Particle.h @@ -1,11 +1,17 @@ -// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEANT4PARTICLE_H #define DD4HEP_GEANT4PARTICLE_H diff --git a/DDG4/include/DDG4/Geant4ParticleGenerator.h b/DDG4/include/DDG4/Geant4ParticleGenerator.h index e1fb87bcb6bdaa1965a7a6ceb2834d57dedcc069..9c5f56aefdfaa667dc156919a7a8fdbb4e5a09d1 100644 --- a/DDG4/include/DDG4/Geant4ParticleGenerator.h +++ b/DDG4/include/DDG4/Geant4ParticleGenerator.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4PARTICLEGENERATOR_H #define DD4HEP_DDG4_GEANT4PARTICLEGENERATOR_H @@ -52,8 +57,8 @@ namespace DD4hep { /// Particle modification. Caller presets defaults to: ( direction = m_direction, momentum = m_energy) /** Use this function to implement isotrop guns, multiple guns etc. - User must return a UNIT vector, which gets scaled with momentum. - */ + User must return a UNIT vector, which gets scaled with momentum. + */ virtual void getParticleDirection(int num, ROOT::Math::XYZVector& direction, double& momentum) const; public: diff --git a/DDG4/include/DDG4/Geant4ParticleGun.h b/DDG4/include/DDG4/Geant4ParticleGun.h index f051c0fb0f8555b28ca89a21f273900a62c2b769..d804f5282b84febbb91b3819114b83a253baf84c 100644 --- a/DDG4/include/DDG4/Geant4ParticleGun.h +++ b/DDG4/include/DDG4/Geant4ParticleGun.h @@ -1,10 +1,17 @@ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4PARTICLEGUN_H #define DD4HEP_DDG4_GEANT4PARTICLEGUN_H diff --git a/DDG4/include/DDG4/Geant4ParticleHandler.h b/DDG4/include/DDG4/Geant4ParticleHandler.h index 803335b1fc54ea122c8082a6377c8de457fec32c..bd9b6029e8ae7c2e1168729e7a2a7984670026d3 100644 --- a/DDG4/include/DDG4/Geant4ParticleHandler.h +++ b/DDG4/include/DDG4/Geant4ParticleHandler.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4PARTICLEHANDLER_H #define DD4HEP_DDG4_GEANT4PARTICLEHANDLER_H diff --git a/DDG4/include/DDG4/Geant4ParticlePrint.h b/DDG4/include/DDG4/Geant4ParticlePrint.h index 7cdc2ea3f7ae6709c82df8b5f3add2bda874302b..7b75e30593d1af08c8c603e0c6a3fd117324bb25 100644 --- a/DDG4/include/DDG4/Geant4ParticlePrint.h +++ b/DDG4/include/DDG4/Geant4ParticlePrint.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4PARTICLEPRINT_H #define DD4HEP_DDG4_GEANT4PARTICLEPRINT_H diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index 66f7df440c956ace104c834b61880e4b66ab834d..4e6f119054b75abb82fccf8b4b5f6f0094af8664 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4PHYSICSLIST_H #define DD4HEP_DDG4_GEANT4PHYSICSLIST_H @@ -80,12 +86,12 @@ namespace DD4hep { class ParticleConstructor: public std::string { public: /// Default constructor - ParticleConstructor() - : std::string() { + ParticleConstructor() + : std::string() { } /// Initalizing constructor - ParticleConstructor(const std::string& s) - : std::string(s) { + ParticleConstructor(const std::string& s) + : std::string(s) { } /// Default destructor ~ParticleConstructor() { @@ -102,12 +108,12 @@ namespace DD4hep { class PhysicsConstructor: public std::string { public: /// Default constructor - PhysicsConstructor() - : std::string() { + PhysicsConstructor() + : std::string() { } /// Initalizing constructor - PhysicsConstructor(const std::string& s) - : std::string(s) { + PhysicsConstructor(const std::string& s) + : std::string(s) { } /// Default destructor ~PhysicsConstructor() { @@ -225,12 +231,12 @@ namespace DD4hep { } /// Register process construction callback template <typename Q, typename T> - void constructProcess(Q* p, void (T::*f)(Geant4UserPhysics*)) { + void constructProcess(Q* p, void (T::*f)(Geant4UserPhysics*)) { m_process.add(p, f); } /// Register particle construction callback template <typename Q, typename T> - void constructParticle(Q* p, void (T::*f)(Geant4UserPhysics*)) { + void constructParticle(Q* p, void (T::*f)(Geant4UserPhysics*)) { m_particle.add(p, f); } /// Add an actor responding to all callbacks. Sequence takes ownership. diff --git a/DDG4/include/DDG4/Geant4Primary.h b/DDG4/include/DDG4/Geant4Primary.h index 562bd3d5a3931d5f6a549b09a0ffcf975d042a44..b90a5b0dde090876ce949d59ca25f78c299ae2e9 100644 --- a/DDG4/include/DDG4/Geant4Primary.h +++ b/DDG4/include/DDG4/Geant4Primary.h @@ -1,11 +1,17 @@ -// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEANT4PRIMARY_H #define DD4HEP_GEANT4PRIMARY_H diff --git a/DDG4/include/DDG4/Geant4PrimaryHandler.h b/DDG4/include/DDG4/Geant4PrimaryHandler.h index 1e6f325eb34ecbf69f42d5caee1796964a191275..c433632f7a5026b5c93de6fa0598792d070ad3fc 100644 --- a/DDG4/include/DDG4/Geant4PrimaryHandler.h +++ b/DDG4/include/DDG4/Geant4PrimaryHandler.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4PRIMARYHANDLER_H #define DD4HEP_DDG4_GEANT4PRIMARYHANDLER_H diff --git a/DDG4/include/DDG4/Geant4Primitives.h b/DDG4/include/DDG4/Geant4Primitives.h index ccb0e5681669bb529168354de38e189e4a663cc2..26627eb0e8a3a8d26891b6e503f9894a5678d6ac 100644 --- a/DDG4/include/DDG4/Geant4Primitives.h +++ b/DDG4/include/DDG4/Geant4Primitives.h @@ -1,11 +1,16 @@ -// $Id: Geant4Primitives.h 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4PRIMITIVES_H #define DD4HEP_DDG4_GEANT4PRIMITIVES_H diff --git a/DDG4/include/DDG4/Geant4Random.h b/DDG4/include/DDG4/Geant4Random.h index d449bd0849adb7d72665916c5bffb0e88500cd3c..248145ed4172aac2ce39ad592b4e70b682bf9de4 100644 --- a/DDG4/include/DDG4/Geant4Random.h +++ b/DDG4/include/DDG4/Geant4Random.h @@ -1,11 +1,16 @@ -// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEANT4RANDOM_H #define DD4HEP_GEANT4RANDOM_H diff --git a/DDG4/include/DDG4/Geant4RunAction.h b/DDG4/include/DDG4/Geant4RunAction.h index 35e3b50214ee6f48c9397223ae1bc319465d10c2..307d5c3c54ec45c70d8e99af8d69d243f33febac 100644 --- a/DDG4/include/DDG4/Geant4RunAction.h +++ b/DDG4/include/DDG4/Geant4RunAction.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4RUNACTION_H #define DD4HEP_DDG4_GEANT4RUNACTION_H @@ -70,12 +76,12 @@ namespace DD4hep { virtual ~Geant4RunActionSequence(); /// Register begin-of-run callback. Types Q and T must be polymorph! template <typename Q, typename T> - void callAtBegin(Q* p, void (T::*f)(const G4Run*)) { + void callAtBegin(Q* p, void (T::*f)(const G4Run*)) { m_begin.add(p, f); } /// Register end-of-run callback. Types Q and T must be polymorph! template <typename Q, typename T> - void callAtEnd(Q* p, void (T::*f)(const G4Run*)) { + void callAtEnd(Q* p, void (T::*f)(const G4Run*)) { m_end.add(p, f); } /// Add an actor responding to all callbacks. Sequence takes ownership. diff --git a/DDG4/include/DDG4/Geant4SensDetAction.h b/DDG4/include/DDG4/Geant4SensDetAction.h index 2f26b4be6c8554f227650a71393bb48cbc515e2e..8638585c07bfffca7a504a7cf62c05f48f79a7dc 100644 --- a/DDG4/include/DDG4/Geant4SensDetAction.h +++ b/DDG4/include/DDG4/Geant4SensDetAction.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4SENSDETACTION_H #define DD4HEP_DDG4_GEANT4SENSDETACTION_H diff --git a/DDG4/include/DDG4/Geant4SensDetAction.inl b/DDG4/include/DDG4/Geant4SensDetAction.inl index b586965013e4fa51643dfab7e43329ae1cc718ce..148494b29653093e914cba572d3a2350bf68f521 100644 --- a/DDG4/include/DDG4/Geant4SensDetAction.inl +++ b/DDG4/include/DDG4/Geant4SensDetAction.inl @@ -1,11 +1,16 @@ -// $Id: $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #ifndef DD4HEP_DDG4_GEANT4SENSDETACTION_H diff --git a/DDG4/include/DDG4/Geant4SensitiveDetector.h b/DDG4/include/DDG4/Geant4SensitiveDetector.h index 04d1825f260299663ee094a949cf90b66ebbd7b8..ef9fcce759a49cb45498c82529de7f28b6495ca8 100644 --- a/DDG4/include/DDG4/Geant4SensitiveDetector.h +++ b/DDG4/include/DDG4/Geant4SensitiveDetector.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEANT4SENSITIVEDETECTOR_H #define DD4HEP_GEANT4SENSITIVEDETECTOR_H diff --git a/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h b/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h index 9b1d8cf8223e1a8fd68ac67fd9c0b161f48089ac..0dc5cbb339e4e422e9840e7cc71f7903f8d252ae 100644 --- a/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h +++ b/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_GEANT4SENSITIVEDETECTOR_INLINE_H #define DD4HEP_GEANT4SENSITIVEDETECTOR_INLINE_H @@ -14,7 +20,7 @@ /// Constructor. The sensitive detector element is identified by the detector name template <class SD> DD4hep::Simulation::Geant4GenericSD<SD>::Geant4GenericSD(const std::string& nam, LCDD& lcdd_ref) -: Geant4SensitiveDetector(nam, lcdd_ref) { + : Geant4SensitiveDetector(nam, lcdd_ref) { defineCollection(m_sensitive.hitsCollection()); } diff --git a/DDG4/include/DDG4/Geant4StackingAction.h b/DDG4/include/DDG4/Geant4StackingAction.h index c7db44b4c66e91db2c21f6e4b9003f964c8f7d17..779adcd8c0347fc2e44707c93465cacb6fd8fc29 100644 --- a/DDG4/include/DDG4/Geant4StackingAction.h +++ b/DDG4/include/DDG4/Geant4StackingAction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4STACKINGACTION_H #define DD4HEP_DDG4_GEANT4STACKINGACTION_H diff --git a/DDG4/include/DDG4/Geant4StepHandler.h b/DDG4/include/DDG4/Geant4StepHandler.h index ef79b1e7ba2fcd891a60824a1a4afce4e6090f14..204034f77d2a981f569b519859077fda72e7230b 100644 --- a/DDG4/include/DDG4/Geant4StepHandler.h +++ b/DDG4/include/DDG4/Geant4StepHandler.h @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEANT4STEPHANDLER_H #define DD4HEP_GEANT4STEPHANDLER_H @@ -46,12 +51,12 @@ namespace DD4hep { G4StepPoint* post; G4Track* track; bool applyBirksLaw; - Geant4StepHandler(const G4Step* s) - : step(s) { + Geant4StepHandler(const G4Step* s) + : step(s) { pre = s->GetPreStepPoint(); post = s->GetPostStepPoint(); track = s->GetTrack(); - applyBirksLaw = false; + applyBirksLaw = false; } G4ParticleDefinition* trackDef() const { return track->GetDefinition(); @@ -67,10 +72,10 @@ namespace DD4hep { const char* postStepStatus() const; /// Returns total energy deposit double totalEnergy() const { - if(applyBirksLaw == true) - return BirkAttenuation(step); - else - return step->GetTotalEnergyDeposit(); + if(applyBirksLaw == true) + return BirkAttenuation(step); + else + return step->GetTotalEnergyDeposit(); } /// Returns the pre-step position Position prePos() const { @@ -204,28 +209,28 @@ namespace DD4hep { /// Apply BirksLaw double BirkAttenuation(const G4Step* aStep) const { - double energyDeposition = aStep->GetTotalEnergyDeposit(); - double length = aStep->GetStepLength(); - double niel = aStep->GetNonIonizingEnergyDeposit(); - const G4Track* track = aStep->GetTrack(); - const G4ParticleDefinition* particle = track->GetDefinition(); - const G4MaterialCutsCouple* couple = track->GetMaterialCutsCouple(); + double energyDeposition = aStep->GetTotalEnergyDeposit(); + double length = aStep->GetStepLength(); + double niel = aStep->GetNonIonizingEnergyDeposit(); + const G4Track* trk = aStep->GetTrack(); + const G4ParticleDefinition* particle = trk->GetDefinition(); + const G4MaterialCutsCouple* couple = trk->GetMaterialCutsCouple(); #if G4VERSION_NUMBER >= 1001 - G4EmSaturation* emSaturation = new G4EmSaturation(0); + G4EmSaturation* emSaturation = new G4EmSaturation(0); #else - G4EmSaturation* emSaturation = new G4EmSaturation(); + G4EmSaturation* emSaturation = new G4EmSaturation(); #endif - double engyVis = emSaturation->VisibleEnergyDeposition(particle, - couple, - length, - energyDeposition, - niel); - delete emSaturation; - return engyVis; + double engyVis = emSaturation->VisibleEnergyDeposition(particle, + couple, + length, + energyDeposition, + niel); + delete emSaturation; + return engyVis; } /// Set applyBirksLaw to ture void doApplyBirksLaw(void) { - applyBirksLaw = true; + applyBirksLaw = true; } }; diff --git a/DDG4/include/DDG4/Geant4SteppingAction.h b/DDG4/include/DDG4/Geant4SteppingAction.h index cde38d1603aed1659b65388a44fd6a652ff30b7a..b2d7eb985ef573c2861bb3fc6c2644b810911d95 100644 --- a/DDG4/include/DDG4/Geant4SteppingAction.h +++ b/DDG4/include/DDG4/Geant4SteppingAction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4STEPPINGACTION_H #define DD4HEP_DDG4_GEANT4STEPPINGACTION_H @@ -62,7 +67,7 @@ namespace DD4hep { virtual ~Geant4SteppingActionSequence(); /// Register stepping action callback. Types Q and T must be polymorph! template <typename Q, typename T> - void call(Q* p, void (T::*f)(const G4Step*, G4SteppingManager*)) { + void call(Q* p, void (T::*f)(const G4Step*, G4SteppingManager*)) { m_calls.add(p, f); } /// Add an actor responding to all callbacks. Sequence takes ownership. diff --git a/DDG4/include/DDG4/Geant4TestActions.h b/DDG4/include/DDG4/Geant4TestActions.h index aaf7cfbcde21cc661625f98fb02da6debf0bef89..38074298e14f76af5c754dec61ca4b03d154cb50 100644 --- a/DDG4/include/DDG4/Geant4TestActions.h +++ b/DDG4/include/DDG4/Geant4TestActions.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4TESTACTIONS_H #define DD4HEP_DDG4_GEANT4TESTACTIONS_H diff --git a/DDG4/include/DDG4/Geant4TouchableHandler.h b/DDG4/include/DDG4/Geant4TouchableHandler.h index ebd77051a26b72323ae7ff06ee95b370abe55c23..628694e3ea3a132f16462baeea9b5ff643af64d0 100644 --- a/DDG4/include/DDG4/Geant4TouchableHandler.h +++ b/DDG4/include/DDG4/Geant4TouchableHandler.h @@ -1,11 +1,16 @@ -// $Id: Geant4TouchableHandler.h 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEANT4TOUCHABLEHANDLER_H #define DD4HEP_GEANT4TOUCHABLEHANDLER_H @@ -44,7 +49,7 @@ namespace DD4hep { const G4VTouchable* touchable; /// Default constructor. - Geant4TouchableHandler(const G4VTouchable* t) : touchable(t) {} + Geant4TouchableHandler(const G4VTouchable* t) : touchable(t) {} /// Default constructor. Takes the step's pre-touchable Geant4TouchableHandler(const G4Step* step); /// Default constructor. Takes the step's pre-touchable diff --git a/DDG4/include/DDG4/Geant4TrackHandler.h b/DDG4/include/DDG4/Geant4TrackHandler.h index 9b6edbdfb934e778e69c7b82e3638da529313134..176afa8d42feea65d396049ed1aa5008566c71d9 100644 --- a/DDG4/include/DDG4/Geant4TrackHandler.h +++ b/DDG4/include/DDG4/Geant4TrackHandler.h @@ -1,11 +1,16 @@ -// $Id: Geant4TrackHandler.h 683 2013-08-08 16:18:20Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4TRACKHANDLER_H #define DD4HEP_DDG4_GEANT4TRACKHANDLER_H @@ -51,8 +56,8 @@ namespace DD4hep { /// Reference to the track object const G4Track* track; /// Initializing constructor - Geant4TrackHandler(const G4Track* t) - : track(t) { + Geant4TrackHandler(const G4Track* t) + : track(t) { /// Should test here if the track pointer is valid to avoind any later trouble if ( 0 == t ) { throw std::runtime_error("Geant4TrackHandler: NULL pointer passed to constructor!"); diff --git a/DDG4/include/DDG4/Geant4TrackInformation.h b/DDG4/include/DDG4/Geant4TrackInformation.h index fa36d08ff0f8a35cae8d7f27061e7d8b73b1a551..f4bfadcae813ef0fe24d2ed3c6e5e58fdcd24140 100644 --- a/DDG4/include/DDG4/Geant4TrackInformation.h +++ b/DDG4/include/DDG4/Geant4TrackInformation.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4TRACKINFORMATION_H #define DD4HEP_DDG4_GEANT4TRACKINFORMATION_H diff --git a/DDG4/include/DDG4/Geant4TrackingAction.h b/DDG4/include/DDG4/Geant4TrackingAction.h index 67e04f16e133845b2f252f0a159c7071c630b18d..0404911efd7a7e8dfc6875d1a636c8f2a010197b 100644 --- a/DDG4/include/DDG4/Geant4TrackingAction.h +++ b/DDG4/include/DDG4/Geant4TrackingAction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4TRACKINGACTION_H #define DD4HEP_DDG4_GEANT4TRACKINGACTION_H @@ -84,26 +89,26 @@ namespace DD4hep { virtual ~Geant4TrackingActionSequence(); /// Register Pre-track action callback before anything else template <typename Q, typename T> - void callUpFront(Q* p, void (T::*f)(const G4Track*), - CallbackSequence::Location where=CallbackSequence::END) { + void callUpFront(Q* p, void (T::*f)(const G4Track*), + CallbackSequence::Location where=CallbackSequence::END) { m_front.add(p, f, where); } /// Register Pre-track action callback template <typename Q, typename T> - void callAtBegin(Q* p, void (T::*f)(const G4Track*), - CallbackSequence::Location where=CallbackSequence::END) { + void callAtBegin(Q* p, void (T::*f)(const G4Track*), + CallbackSequence::Location where=CallbackSequence::END) { m_begin.add(p, f, where); } /// Register Post-track action callback template <typename Q, typename T> - void callAtEnd(Q* p, void (T::*f)(const G4Track*), - CallbackSequence::Location where=CallbackSequence::END) { + void callAtEnd(Q* p, void (T::*f)(const G4Track*), + CallbackSequence::Location where=CallbackSequence::END) { m_end.add(p, f, where); } /// Register Post-track action callback template <typename Q, typename T> - void callAtFinal(Q* p, void (T::*f)(const G4Track*), - CallbackSequence::Location where=CallbackSequence::END) { + void callAtFinal(Q* p, void (T::*f)(const G4Track*), + CallbackSequence::Location where=CallbackSequence::END) { m_final.add(p, f, where); } /// Add an actor responding to all callbacks. Sequence takes ownership. diff --git a/DDG4/include/DDG4/Geant4TrackingPostAction.h b/DDG4/include/DDG4/Geant4TrackingPostAction.h index 6336bf375e5941c6951346e3ed25dabb9de958e5..54e730ef66d11d4aae2ddd235a982fbb74a72ad4 100644 --- a/DDG4/include/DDG4/Geant4TrackingPostAction.h +++ b/DDG4/include/DDG4/Geant4TrackingPostAction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4TRACKINGPOSTACTION_H #define DD4HEP_DDG4_GEANT4TRACKINGPOSTACTION_H diff --git a/DDG4/include/DDG4/Geant4TrackingPreAction.h b/DDG4/include/DDG4/Geant4TrackingPreAction.h index 5b13baf6d242ff1970c720b9ef6b336d118d1f53..d4b67fdf651d3c33b497a14b0b6bc4bc39504380 100644 --- a/DDG4/include/DDG4/Geant4TrackingPreAction.h +++ b/DDG4/include/DDG4/Geant4TrackingPreAction.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4TRACKINGPREACTION_H #define DD4HEP_DDG4_GEANT4TRACKINGPREACTION_H diff --git a/DDG4/include/DDG4/Geant4UIManager.h b/DDG4/include/DDG4/Geant4UIManager.h index f9b3be5f332112862fc1b1866a0dd1f60f10dd6c..f0ff13392913c41dfcbdd9806032ae0bfdcfd4c8 100644 --- a/DDG4/include/DDG4/Geant4UIManager.h +++ b/DDG4/include/DDG4/Geant4UIManager.h @@ -1,11 +1,16 @@ -// $Id: Geant4Field.cpp 875 2013-11-04 16:15:14Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4UIMANAGER_H #define DD4HEP_DDG4_GEANT4UIMANAGER_H diff --git a/DDG4/include/DDG4/Geant4UIMessenger.h b/DDG4/include/DDG4/Geant4UIMessenger.h index 75d0a064bbf4f9b4860572090533c6847073c0a8..b752df17c714fc8588145ef936abbbd166b864f0 100644 --- a/DDG4/include/DDG4/Geant4UIMessenger.h +++ b/DDG4/include/DDG4/Geant4UIMessenger.h @@ -1,11 +1,17 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4UIMESSENGER_H #define DD4HEP_DDG4_GEANT4UIMESSENGER_H @@ -54,7 +60,7 @@ namespace DD4hep { void addCall(const std::string& name, const std::string& description, const Callback& cb); /// Add any callback (without parameters to the messenger template <typename Q, typename R, typename T> - void addCall(const std::string& name, const std::string& description, Q* p, R (T::*f)()) { + void addCall(const std::string& name, const std::string& description, Q* p, R (T::*f)()) { CallbackSequence::checkTypes(typeid(Q), typeid(T), dynamic_cast<T*>(p)); addCall(name, description, Callback(p).make(f)); } diff --git a/DDG4/include/DDG4/Geant4UserParticleHandler.h b/DDG4/include/DDG4/Geant4UserParticleHandler.h index f7adc0cfe74e92f7e423fe4db3187ceafa224927..4cff239bc1ee7986c293e5cf7bfb692b972f3719 100644 --- a/DDG4/include/DDG4/Geant4UserParticleHandler.h +++ b/DDG4/include/DDG4/Geant4UserParticleHandler.h @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4USERPARTICLEHANDLER_H #define DD4HEP_DDG4_GEANT4USERPARTICLEHANDLER_H diff --git a/DDG4/include/DDG4/Geant4UserPhysicsList.h b/DDG4/include/DDG4/Geant4UserPhysicsList.h index f8d4468d50d3a8f851e0703ddab2b04d974fc932..ef4c8c844ad0a0f2ecb1c718f471d34ff3ee33e6 100644 --- a/DDG4/include/DDG4/Geant4UserPhysicsList.h +++ b/DDG4/include/DDG4/Geant4UserPhysicsList.h @@ -1,14 +1,16 @@ -// $Id: Geant4config.h 615 2013-06-18 11:13:35Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Small helper file with abbreviations to write configurations -// for CINT; also used when writing the XML configuration. +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -// Author : M.Frank +// Author : M.Frank // -//==================================================================== +//========================================================================== #ifndef DDG4_GEANT4USERPHYSICSLIST_H #define DDG4_GEANT4USERPHYSICSLIST_H @@ -34,8 +36,8 @@ namespace DD4hep { Geant4PhysicsListActionSequence* m_sequence; public: /// Standard constructor - Geant4UserPhysicsList(Geant4PhysicsListActionSequence* seq, int verbose) - : Geant4UserPhysics(), BASE_IMP(verbose), m_sequence(seq) { + Geant4UserPhysicsList(Geant4PhysicsListActionSequence* seq, int verbose) + : Geant4UserPhysics(), BASE_IMP(verbose), m_sequence(seq) { if (m_sequence) m_sequence->addRef(); InstanceCount::increment(this); diff --git a/DDG4/include/DDG4/Geant4Vertex.h b/DDG4/include/DDG4/Geant4Vertex.h index f025f9e00c6ddd5f2464fdf211fde410f1c27116..7f53b3ce531eb8eb3cdd881334f2bf9d9fc4a0b7 100644 --- a/DDG4/include/DDG4/Geant4Vertex.h +++ b/DDG4/include/DDG4/Geant4Vertex.h @@ -1,11 +1,16 @@ -// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_GEANT4VERTEX_H #define DD4HEP_GEANT4VERTEX_H diff --git a/DDG4/include/DDG4/Geant4VolumeManager.h b/DDG4/include/DDG4/Geant4VolumeManager.h index 2fc471d4807ef6643be25565fafbeda5c57a0e15..9171db788701802afff367572ad2ba8062ec7f5b 100644 --- a/DDG4/include/DDG4/Geant4VolumeManager.h +++ b/DDG4/include/DDG4/Geant4VolumeManager.h @@ -1,11 +1,16 @@ -// $Id: Geant4VolumeManager.h 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4VOLUMEMANAGER_H #define DD4HEP_DDG4_GEANT4VOLUMEMANAGER_H @@ -60,16 +65,16 @@ namespace DD4hep { /// Initializing constructor. The tree will automatically be built if possible Geant4VolumeManager(Geometry::LCDD& lcdd, Geant4GeometryInfo* info); /// Default constructor - Geant4VolumeManager() - : Base(), m_isValid(false) { + Geant4VolumeManager() + : Base(), m_isValid(false) { } /// Constructor to be used when reading the already parsed object - Geant4VolumeManager(const Base& e) - : Base(e), m_isValid(false) { + Geant4VolumeManager(const Base& e) + : Base(e), m_isValid(false) { } /// Constructor to be used when reading the already parsed object - Geant4VolumeManager(const Geant4VolumeManager& e) - : Base(e), m_isValid(false) { + Geant4VolumeManager(const Geant4VolumeManager& e) + : Base(e), m_isValid(false) { } /// Constructor to be used when reading the already parsed object template <typename Q> Geant4VolumeManager(const Geometry::Handle<Q>& e) diff --git a/DDG4/include/DDG4/IoStreams.h b/DDG4/include/DDG4/IoStreams.h index 799d12750d739939f8a0ff457b334384e1a0087a..18837de3d43f6df7cfc9407cce73e0220a67aaa7 100644 --- a/DDG4/include/DDG4/IoStreams.h +++ b/DDG4/include/DDG4/IoStreams.h @@ -1,11 +1,16 @@ -// $Id: Primitives.h 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DD4HEP_IOSTREAMS_H #define DD4HEP_DD4HEP_IOSTREAMS_H @@ -60,7 +65,7 @@ namespace DD4hep { struct category : boost::iostreams::seekable_device_tag, boost::iostreams::closable_tag { }; // Default constructor - dd4hep_file() : m_handle(0) { } + dd4hep_file() : m_handle(0) { } // Constructors taking file desciptors dd4hep_file(handle_type fd, dd4hep_file_flags); // Constructors taking file desciptors @@ -104,48 +109,48 @@ namespace DD4hep { */ template <typename T=int> class dd4hep_file_source : private dd4hep_file<T> { public: - typedef dd4hep_file<T> descriptor; - struct category : boost::iostreams::input_seekable, - boost::iostreams::device_tag, - boost::iostreams::closable_tag { }; - typedef typename descriptor::handle_type handle_type; - typedef typename descriptor::char_type char_type; - using descriptor::is_open; - using descriptor::close; - using descriptor::read; - using descriptor::seek; - using descriptor::handle; - - /// Default Constructor - dd4hep_file_source() : descriptor() { } - - /// Copy constructor - dd4hep_file_source(const dd4hep_file_source<T>& other) - : descriptor(other) { } - - /// Constructors taking file desciptors - explicit dd4hep_file_source(handle_type h, dd4hep_file_flags flags) - : descriptor(h,flags) { } - - /// Constructors taking file desciptors - explicit dd4hep_file_source(const char* name, BOOST_IOS::openmode mode = BOOST_IOS::in) - : descriptor(name,mode) { } - - /// open overload taking file desciptors - void open(handle_type h, dd4hep_file_flags flags) - { this->descriptor::open(h, flags); } - - /// open overload taking C-style string - void open(const char* path, BOOST_IOS::openmode mode = BOOST_IOS::in) - { this->descriptor::open(path,mode); } - - /// open overload taking a std::string - void open(const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in) - { open(path.c_str(), mode); } - - /// open overload taking a Boost.Filesystem path - template<typename Path> void open(const Path& path, BOOST_IOS::openmode mode = BOOST_IOS::in) - { open(detail_path(path), mode); } + typedef dd4hep_file<T> descriptor; + struct category : boost::iostreams::input_seekable, + boost::iostreams::device_tag, + boost::iostreams::closable_tag { }; + typedef typename descriptor::handle_type handle_type; + typedef typename descriptor::char_type char_type; + using descriptor::is_open; + using descriptor::close; + using descriptor::read; + using descriptor::seek; + using descriptor::handle; + + /// Default Constructor + dd4hep_file_source() : descriptor() { } + + /// Copy constructor + dd4hep_file_source(const dd4hep_file_source<T>& other) + : descriptor(other) { } + + /// Constructors taking file desciptors + explicit dd4hep_file_source(handle_type h, dd4hep_file_flags flags) + : descriptor(h,flags) { } + + /// Constructors taking file desciptors + explicit dd4hep_file_source(const char* name, BOOST_IOS::openmode mode = BOOST_IOS::in) + : descriptor(name,mode) { } + + /// open overload taking file desciptors + void open(handle_type h, dd4hep_file_flags flags) + { this->descriptor::open(h, flags); } + + /// open overload taking C-style string + void open(const char* path, BOOST_IOS::openmode mode = BOOST_IOS::in) + { this->descriptor::open(path,mode); } + + /// open overload taking a std::string + void open(const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in) + { open(path.c_str(), mode); } + + /// open overload taking a Boost.Filesystem path + template<typename Path> void open(const Path& path, BOOST_IOS::openmode mode = BOOST_IOS::in) + { open(detail_path(path), mode); } }; /// DD4hep file sink extension to boost::iostreams @@ -167,12 +172,12 @@ namespace DD4hep { * \see http://www.boost.org/libs/iostreams for further documentation. */ template <typename T> - class dd4hep_file_sink : private dd4hep_file<T> { + class dd4hep_file_sink : private dd4hep_file<T> { public: typedef dd4hep_file<T> descriptor; struct category : boost::iostreams::output_seekable, - boost::iostreams::device_tag, - boost::iostreams::closable_tag { }; + boost::iostreams::device_tag, + boost::iostreams::closable_tag { }; typedef typename descriptor::handle_type handle_type; typedef typename descriptor::char_type char_type; using descriptor::is_open; @@ -185,8 +190,8 @@ namespace DD4hep { dd4hep_file_sink() { } /// Copy constructor - dd4hep_file_sink(const dd4hep_file_sink<T>& other) - : descriptor(other) { } + dd4hep_file_sink(const dd4hep_file_sink<T>& other) + : descriptor(other) { } /// Constructors taking file desciptors explicit dd4hep_file_sink(handle_type fd, dd4hep_file_flags flags) @@ -202,7 +207,7 @@ namespace DD4hep { /// Constructor taking a Boost.Filesystem path template<typename Path> - explicit dd4hep_file_sink(const Path& path, BOOST_IOS::openmode mode = BOOST_IOS::out ) + explicit dd4hep_file_sink(const Path& path, BOOST_IOS::openmode mode = BOOST_IOS::out ) : descriptor(detail_path(path), mode) { } /// open overloads taking file descriptors @@ -219,7 +224,7 @@ namespace DD4hep { /// open overload taking a Boost.Filesystem path template<typename Path> void open(const Path& path, BOOST_IOS::openmode mode = BOOST_IOS::out ) - { open(detail_path(path), mode); } + { open(detail_path(path), mode); } }; } // End namespace boost #endif // DD4HEP_DD4HEP_IOSTREAMs_H diff --git a/DDG4/lcio/Geant4Output2LCIO.cpp b/DDG4/lcio/Geant4Output2LCIO.cpp index d2e47ca56a66c0fcdef76b56bd95e5700d06759a..7591d81e17202fd2616e05f02ea61180f399d21f 100644 --- a/DDG4/lcio/Geant4Output2LCIO.cpp +++ b/DDG4/lcio/Geant4Output2LCIO.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 875 2013-11-04 16:15:14Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4OUTPUT2LCIO_H #define DD4HEP_DDG4_GEANT4OUTPUT2LCIO_H @@ -69,14 +75,19 @@ namespace DD4hep { } // End namespace DD4hep #endif // DD4HEP_DDG4_GEANT4OUTPUT2LCIO_H -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -// Author : M.Frank +// Author : M.Frank // -//==================================================================== +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" diff --git a/DDG4/lcio/LCIOConversions.cpp b/DDG4/lcio/LCIOConversions.cpp index d846d64c82e04746ff33af6467f72f27b39aa0e1..eb0130b6527db6637dc2e3974bbc4a1b8c998511 100644 --- a/DDG4/lcio/LCIOConversions.cpp +++ b/DDG4/lcio/LCIOConversions.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #define DDG4_MAKE_INSTANTIATIONS diff --git a/DDG4/lcio/LCIOEventReader.cpp b/DDG4/lcio/LCIOEventReader.cpp index bf6fab820f3a9229975e23afd0ecb6ca776e59cb..268611f9bd193486cd07bbf132332ce64d8166a6 100644 --- a/DDG4/lcio/LCIOEventReader.cpp +++ b/DDG4/lcio/LCIOEventReader.cpp @@ -1,7 +1,12 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // // @author P.Kostka (main author) // @author M.Frank (code reshuffeling into new DDG4 scheme) diff --git a/DDG4/lcio/LCIOEventReader.h b/DDG4/lcio/LCIOEventReader.h index 50eeff9d4474bbf545f279bbe22984cc8b758f4f..289d80d454faca569215095fb11d483329eb4320 100644 --- a/DDG4/lcio/LCIOEventReader.h +++ b/DDG4/lcio/LCIOEventReader.h @@ -1,9 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (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_DDG4_LCIOEVENTREADER_H #define DD4HEP_DDG4_LCIOEVENTREADER_H diff --git a/DDG4/lcio/LCIOFileReader.cpp b/DDG4/lcio/LCIOFileReader.cpp index 23038ee74deeca924853e754ae39a748cbf07bab..7b60b49b6342c7b5934ec4b4a11c814f30c09779 100644 --- a/DDG4/lcio/LCIOFileReader.cpp +++ b/DDG4/lcio/LCIOFileReader.cpp @@ -1,9 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (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_DDG4_LCIOFILEREADER_H #define DD4HEP_DDG4_LCIOFILEREADER_H diff --git a/DDG4/lcio/LCIOSDTestActions.cpp b/DDG4/lcio/LCIOSDTestActions.cpp index 05a7b108b780561262c48190f84cefb75d4c8334..0879174425d7d41f4097981501db2f9fa05fa013 100644 --- a/DDG4/lcio/LCIOSDTestActions.cpp +++ b/DDG4/lcio/LCIOSDTestActions.cpp @@ -1,16 +1,24 @@ -//==================================================================== -// DDSim - LC simulation based on DD4hep -//-------------------------------------------------------------------- -// F.Gaede, DESY -//==================================================================== - +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : F.Gaede, DESY +// +//========================================================================== + +// Framework include files #include "IMPL/LCCollectionVec.h" #include "IMPL/SimTrackerHitImpl.h" #include "IMPL/SimCalorimeterHitImpl.h" #include "IMPL/MCParticleImpl.h" #include "UTIL/Operators.h" #include "UTIL/ILDConf.h" -//#include "G4lcioSimHit.h" #include "DDG4/Geant4SensDetAction.h" #include "DDG4/Geant4Data.h" diff --git a/DDG4/lcio/LCIOStdHepReader.cpp b/DDG4/lcio/LCIOStdHepReader.cpp index 556469c93a3ce409f45e3fa1cf2d4926a89bcaef..43f1da530a1bb219b18c12fd4d52c1d939df947a 100644 --- a/DDG4/lcio/LCIOStdHepReader.cpp +++ b/DDG4/lcio/LCIOStdHepReader.cpp @@ -1,14 +1,22 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (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_DDG4_LCIOSTDHEPREADER_H #define DD4HEP_DDG4_LCIOSTDHEPREADER_H // Framework include files #include "LCIOEventReader.h" + // LCIO include files #include "UTIL/LCStdHepRdr.h" @@ -41,7 +49,23 @@ namespace DD4hep { } /* End namespace DD4hep */ #endif /* DD4HEP_DDG4_LCIOSTDHEPREADER_H */ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDG4/Factories.h" + // Factory entry DECLARE_GEANT4_EVENT_READER_NS(DD4hep::Simulation,LCIOStdHepReader) diff --git a/DDG4/legacy/Geant4CalorimeterSD.cpp b/DDG4/legacy/Geant4CalorimeterSD.cpp index 331e7c52d490aeb0636dbe29ab0c0323e9880d03..7658e5576225f5544fd2ab1c143f2a563186cfb7 100644 --- a/DDG4/legacy/Geant4CalorimeterSD.cpp +++ b/DDG4/legacy/Geant4CalorimeterSD.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4CalorimeterSD.cpp 796 2013-10-03 19:19:39Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4SensitiveDetector_inline.h" @@ -52,7 +57,7 @@ namespace DD4hep { namespace Simulation { typedef Geant4GenericSD<Calorimeter> Geant4Calorimeter; }} // End namespace DD4hep::Simulation -DECLARE_GEANT4SENSITIVEDETECTOR(Geant4Calorimeter) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4Calorimeter) /* * DD4hep::Simulation namespace declaration @@ -107,4 +112,4 @@ namespace DD4hep { namespace Simulation { typedef Geant4GenericSD<OpticalCalorimeter> Geant4OpticalCalorimeter; }} // End namespace DD4hep::Simulation -DECLARE_GEANT4SENSITIVEDETECTOR(Geant4OpticalCalorimeter) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4OpticalCalorimeter) diff --git a/DDG4/legacy/Geant4TrackerCombineSD.cpp b/DDG4/legacy/Geant4TrackerCombineSD.cpp index b6772fcf8a46d87ecf7a81b9021fcbdc01f893f2..a8d22b5846585140149d181073837e8c5f698979 100644 --- a/DDG4/legacy/Geant4TrackerCombineSD.cpp +++ b/DDG4/legacy/Geant4TrackerCombineSD.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4TrackerCombineSD.cpp 796 2013-10-03 19:19:39Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4SensitiveDetector_inline.h" @@ -110,4 +115,4 @@ namespace DD4hep { namespace Simulation { typedef Geant4GenericSD<TrackerCombine> Geant4TrackerCombine; }} // End namespace DD4hep::Simulation -DECLARE_GEANT4SENSITIVEDETECTOR(Geant4TrackerCombine) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4TrackerCombine) diff --git a/DDG4/legacy/Geant4TrackerSD.cpp b/DDG4/legacy/Geant4TrackerSD.cpp index c096d85b070f7ff354cbf6de4d59af4604d54c88..242016f2a23a1d9381d48726798cc0c94af3b407 100644 --- a/DDG4/legacy/Geant4TrackerSD.cpp +++ b/DDG4/legacy/Geant4TrackerSD.cpp @@ -1,17 +1,22 @@ -// $Id: Geant4TrackerSD.cpp 796 2013-10-03 19:19:39Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDG4/Geant4SensitiveDetector_inline.h" #include "DDG4/Factories.h" #include "DDG4/Geant4StepHandler.h" #include "DDG4/Geant4Mapping.h" -//#include "DDSegmentation/BitField64.h" // C include files #include <stdexcept> @@ -62,4 +67,4 @@ namespace DD4hep { namespace Simulation { typedef Geant4GenericSD<Tracker> Geant4Tracker; }} // End namespace DD4hep::Simulation -DECLARE_GEANT4SENSITIVEDETECTOR(Geant4Tracker) +DECLARE_GEANT4SENSITIVEDETECTOR_NS(DD4hep::Simulation,Geant4Tracker) diff --git a/DDG4/plugins/Geant4.10.PhysicsConstructors.h b/DDG4/plugins/Geant4.10.PhysicsConstructors.h index a5b8febeb6be670dd8e6f5671543f09e0924ef65..94ccc8793dcb739c377f6172adffd9c1a0d2e5c3 100644 --- a/DDG4/plugins/Geant4.10.PhysicsConstructors.h +++ b/DDG4/plugins/Geant4.10.PhysicsConstructors.h @@ -1,3 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== // EM physics #include "G4EmStandardPhysics_option1.hh" diff --git a/DDG4/plugins/Geant4.9.PhysicsConstructors.h b/DDG4/plugins/Geant4.9.PhysicsConstructors.h index 6d1473c5874958806275fb6d126c1d0233107f47..f445df1d60c25b0c142a28c8caa09a18f18bf81e 100644 --- a/DDG4/plugins/Geant4.9.PhysicsConstructors.h +++ b/DDG4/plugins/Geant4.9.PhysicsConstructors.h @@ -1,3 +1,17 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + // EM physics #include "G4EmStandardPhysics_option1.hh" DECLARE_GEANT4_PHYSICS(G4EmStandardPhysics_option1) diff --git a/DDG4/plugins/Geant4EscapeCounter.cpp b/DDG4/plugins/Geant4EscapeCounter.cpp index b472c60886689e7d5e5bf19e8ff45eebe52d1d26..5c544e9eee865f1153ee03fe27b0b37e9ddafbdc 100644 --- a/DDG4/plugins/Geant4EscapeCounter.cpp +++ b/DDG4/plugins/Geant4EscapeCounter.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4ESCAPECOUNTER_H #define DD4HEP_DDG4_GEANT4ESCAPECOUNTER_H @@ -72,7 +77,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4EscapeCounter::Geant4EscapeCounter(Geant4Context* ctxt, const string& nam, DetElement det, LCDD& lcdd_ref) -: Geant4Sensitive(ctxt, nam, det, lcdd_ref) + : Geant4Sensitive(ctxt, nam, det, lcdd_ref) { string coll_name = name()+"Hits"; m_needsControl = true; diff --git a/DDG4/plugins/Geant4EventReaderHepEvt.cpp b/DDG4/plugins/Geant4EventReaderHepEvt.cpp index ce559443d31c17a38f11c2bab455542b50874d49..207bfe4ec50c3981605c7253514f254aed0c66f3 100644 --- a/DDG4/plugins/Geant4EventReaderHepEvt.cpp +++ b/DDG4/plugins/Geant4EventReaderHepEvt.cpp @@ -1,9 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -//==================================================================== +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4InputAction.h" diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index 2409c9520e3ac85e7962079093ead3a43d53f987..a083c6bb1c836ff72f1a87b8677306e0f24bee64 100644 --- a/DDG4/plugins/Geant4EventReaderHepMC.cpp +++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp @@ -1,9 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -//==================================================================== +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/IoStreams.h" @@ -152,7 +159,7 @@ namespace DD4hep { /// Initializing constructor Geant4EventReaderHepMC::Geant4EventReaderHepMC(const string& nam) -: Geant4EventReader(nam), m_input(), m_events(0) + : Geant4EventReader(nam), m_input(), m_events(0) { // Now open the input file: m_input.open(nam.c_str(),BOOST_IOS::in|BOOST_IOS::binary); diff --git a/DDG4/plugins/Geant4Factories.cpp b/DDG4/plugins/Geant4Factories.cpp index 4f04807d5a9c2f66c7c91232552b3e804cf65a25..9566ca6cfaf90fce2c39306ddb8b9d0ad271096b 100644 --- a/DDG4/plugins/Geant4Factories.cpp +++ b/DDG4/plugins/Geant4Factories.cpp @@ -1,11 +1,18 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDG4/Factories.h" using namespace DD4hep::Simulation; diff --git a/DDG4/plugins/Geant4FieldTrackingSetup.cpp b/DDG4/plugins/Geant4FieldTrackingSetup.cpp index 207022b07e9d29c183c0d5c93e717467cd2440f3..8fd4919af0155efd2c5aae753dc04a5735842620 100644 --- a/DDG4/plugins/Geant4FieldTrackingSetup.cpp +++ b/DDG4/plugins/Geant4FieldTrackingSetup.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + #ifndef DD4HEP_DDG4_GEANT4FIELDTRACKINGSETUP_H #define DD4HEP_DDG4_GEANT4FIELDTRACKINGSETUP_H 1 @@ -88,14 +94,20 @@ namespace DD4hep { #endif // DD4HEP_DDG4_GEANT4FIELDTRACKINGSETUP_H -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Handle.h" #include "DD4hep/Fields.h" @@ -201,7 +213,7 @@ static long setup_fields(lcdd_t& lcdd, const DD4hep::Geometry::GeoHandler& /* cn /// Standard constructor Geant4FieldTrackingSetupAction::Geant4FieldTrackingSetupAction(Geant4Context* ctxt, const std::string& nam) -: Geant4PhaseAction(ctxt,nam), Geant4FieldTrackingSetup() + : Geant4PhaseAction(ctxt,nam), Geant4FieldTrackingSetup() { declareProperty("equation", eq_typ); declareProperty("stepper", stepper_typ); @@ -217,9 +229,9 @@ Geant4FieldTrackingSetupAction::Geant4FieldTrackingSetupAction(Geant4Context* ct void Geant4FieldTrackingSetupAction::operator()() { execute(context()->lcdd()); print("Geant4 magnetic field tracking configured. G4MagIntegratorStepper:%s G4Mag_EqRhs:%s " - "Epsilon:[min:%f mm max:%f mm] Delta:[chord:%f 1-step:%f intersect:%f]", - stepper_typ.c_str(),eq_typ.c_str(),eps_min, eps_max, - delta_chord,delta_one_step,delta_intersection); + "Epsilon:[min:%f mm max:%f mm] Delta:[chord:%f 1-step:%f intersect:%f]", + stepper_typ.c_str(),eq_typ.c_str(),eps_min, eps_max, + delta_chord,delta_one_step,delta_intersection); } DECLARE_GEANT4_SETUP(Geant4FieldSetup,setup_fields) diff --git a/DDG4/plugins/Geant4HitExtractor.cpp b/DDG4/plugins/Geant4HitExtractor.cpp index 9b4bcc4f4017cbd9bdf8c15f00272e32d5734322..4e782308d0b9372819b82f1381291e84ef4ca281 100644 --- a/DDG4/plugins/Geant4HitExtractor.cpp +++ b/DDG4/plugins/Geant4HitExtractor.cpp @@ -1,3 +1,18 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDG4/Geant4Data.h" using namespace DD4hep; diff --git a/DDG4/plugins/Geant4MaterialScanner.cpp b/DDG4/plugins/Geant4MaterialScanner.cpp index e7f9599c4be5cf0f5851945a8ec97e77ea56fc67..cf6631d1338e167d646db529d92d30199dd4ce6a 100644 --- a/DDG4/plugins/Geant4MaterialScanner.cpp +++ b/DDG4/plugins/Geant4MaterialScanner.cpp @@ -1,11 +1,17 @@ -// $Id:$ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Objects.h" #include "DDG4/Geant4SteppingAction.h" diff --git a/DDG4/plugins/Geant4Particles.cpp b/DDG4/plugins/Geant4Particles.cpp index bc3a0b31570a64205da0a910b9b5695cfc21f756..cfe550cd92b62a005a2e930271b700655a01cc5a 100644 --- a/DDG4/plugins/Geant4Particles.cpp +++ b/DDG4/plugins/Geant4Particles.cpp @@ -1,17 +1,23 @@ -// $Id: Factories.h 797 2013-10-03 19:20:32Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - -#include <G4Version.hh> +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Factories.h" +// Geant4 include files +#include "G4Version.hh" + // ---- Adjoint particles #include "G4AdjointAlpha.hh" DECLARE_GEANT4_PARTICLE(G4AdjointAlpha) diff --git a/DDG4/plugins/Geant4PhysicsConstructors.cpp b/DDG4/plugins/Geant4PhysicsConstructors.cpp index d39e21a21dd30be45e9ca66c1cd8f3d2b5010fec..ef94a6787e1144f69ee4b1f6345d465121cc70ec 100644 --- a/DDG4/plugins/Geant4PhysicsConstructors.cpp +++ b/DDG4/plugins/Geant4PhysicsConstructors.cpp @@ -1,11 +1,16 @@ -// $Id: Factories.h 797 2013-10-03 19:20:32Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//----------------------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//=================================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Factories.h" diff --git a/DDG4/plugins/Geant4PhysicsLists.cpp b/DDG4/plugins/Geant4PhysicsLists.cpp index e4a1e223773397d71596b9d43390a833cdaed503..fb72b0b7b0fa2885cec0c6936677023c3bb6028a 100644 --- a/DDG4/plugins/Geant4PhysicsLists.cpp +++ b/DDG4/plugins/Geant4PhysicsLists.cpp @@ -1,11 +1,16 @@ -// $Id: Factories.h 797 2013-10-03 19:20:32Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Factories.h" @@ -51,114 +56,114 @@ DECLARE_GEANT4_PHYSICS_LIST(CHIPS) #if G4VERSION_NUMBER < 1000 #include "CHIPS_HP.hh" - DECLARE_GEANT4_PHYSICS_LIST(CHIPS_HP) +DECLARE_GEANT4_PHYSICS_LIST(CHIPS_HP) #include "QGSP_BERT_95.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_95) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_95) #include "QGSP_BERT_95XS.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_95XS) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_95XS) #endif #include "FTFP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) #include "FTFP_BERT_HP.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_HP) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_HP) #if G4VERSION_NUMBER < 1000 // extra EM physics lists only via physicsListFactory #include "FTFP_BERT_EMV.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_EMV) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_EMV) #include "FTFP_BERT_EMX.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_EMX) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_EMX) #include "LHEP_EMV.hh" - DECLARE_GEANT4_PHYSICS_LIST(LHEP_EMV) +DECLARE_GEANT4_PHYSICS_LIST(LHEP_EMV) #include "QGSP_BERT_EMV.hh" DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMV) #include "QGSP_BERT_EMX.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMX) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMX) #include "QGSP_BIC_EMY.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_EMY) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_EMY) #include "LHEP.hh" - DECLARE_GEANT4_PHYSICS_LIST(LHEP) +DECLARE_GEANT4_PHYSICS_LIST(LHEP) #include "QGSC_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSC_BERT) +DECLARE_GEANT4_PHYSICS_LIST(QGSC_BERT) #include "QGSC_CHIPS.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSC_CHIPS) +DECLARE_GEANT4_PHYSICS_LIST(QGSC_CHIPS) #include "QGSP_BERT_CHIPS.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_CHIPS) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_CHIPS) #include "QGSP_BERT_EMV.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMV) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMV) #include "QGSP_BERT_EMX.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMX) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_EMX) #include "QGSP_BERT_NOLEP.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_NOLEP) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_NOLEP) #include "QGSP_BERT_TRV.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_TRV) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_TRV) #include "QGSP.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP) +DECLARE_GEANT4_PHYSICS_LIST(QGSP) #include "QGSP_QEL.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_QEL) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_QEL) #include "HadronPhysicsCHIPS.hh" #endif #include "FTFP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) #include "FTFP_BERT_TRV.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_TRV) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_TRV) #include "LBE.hh" //DECLARE_GEANT4_PHYSICS_LIST(LBE) takes no verbosity arg! #include "QBBC.hh" - DECLARE_GEANT4_PHYSICS_LIST(QBBC) +DECLARE_GEANT4_PHYSICS_LIST(QBBC) #include "QGS_BIC.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGS_BIC) +DECLARE_GEANT4_PHYSICS_LIST(QGS_BIC) #include "QGSP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT) #endif #if G4VERSION_NUMBER>=1000 #include "NuBeam.hh" - DECLARE_GEANT4_PHYSICS_LIST(NuBeam) +DECLARE_GEANT4_PHYSICS_LIST(NuBeam) #include "FTFP_INCLXX.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_INCLXX) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_INCLXX) #include "QGSP_BERT_HP.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_HP) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT_HP) #include "QGSP_BIC_AllHP.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_AllHP) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_AllHP) #include "QGSP_INCLXX.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_INCLXX) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_INCLXX) #endif #include "FTFP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) #include "FTFP_BERT_HP.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_HP) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_HP) #include "QGSP_INCLXX.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_INCLXX) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_INCLXX) #include "FTF_BIC.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTF_BIC) +DECLARE_GEANT4_PHYSICS_LIST(FTF_BIC) #include "FTFP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT) #include "FTFP_BERT_TRV.hh" - DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_TRV) +DECLARE_GEANT4_PHYSICS_LIST(FTFP_BERT_TRV) #include "LBE.hh" //DECLARE_GEANT4_PHYSICS_LIST(LBE) takes no verbosity arg! #include "QBBC.hh" - DECLARE_GEANT4_PHYSICS_LIST(QBBC) +DECLARE_GEANT4_PHYSICS_LIST(QBBC) #include "QGS_BIC.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGS_BIC) +DECLARE_GEANT4_PHYSICS_LIST(QGS_BIC) #include "QGSP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BERT) #include "QGSP_BIC_HP.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_HP) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC_HP) #include "QGSP_BIC.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_BIC) #include "QGSP_FTFP_BERT.hh" - DECLARE_GEANT4_PHYSICS_LIST(QGSP_FTFP_BERT) +DECLARE_GEANT4_PHYSICS_LIST(QGSP_FTFP_BERT) #if 0 #include ".hh" - DECLARE_GEANT4_PHYSICS_LIST() +DECLARE_GEANT4_PHYSICS_LIST() #endif diff --git a/DDG4/plugins/Geant4Processes.cpp b/DDG4/plugins/Geant4Processes.cpp index 26df360d66c82a7fbc02dc4551424616270ff26f..edcae19d3fb44efb37e0b12b6981c5135e3987cd 100644 --- a/DDG4/plugins/Geant4Processes.cpp +++ b/DDG4/plugins/Geant4Processes.cpp @@ -1,14 +1,20 @@ -// $Id:$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Factories.h" + // Geant4 physics lists #include "G4Version.hh" diff --git a/DDG4/plugins/Geant4SDActions.cpp b/DDG4/plugins/Geant4SDActions.cpp index 7ff8e1ea4deab6e2ba7cee264a6a0d3e427abc16..64f32772ee1c4a0dc2ffe29e7ae6aca95717cefa 100644 --- a/DDG4/plugins/Geant4SDActions.cpp +++ b/DDG4/plugins/Geant4SDActions.cpp @@ -1,11 +1,17 @@ -// $Id:$ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDG4/Geant4SensDetAction.inl" #include "DDG4/Geant4EventAction.h" @@ -55,12 +61,12 @@ namespace DD4hep { collection(m_collectionID)->add(hit); mark(h.track); if ( 0 == hit->cellID ) { - hit->cellID = volumeID( step ) ; - except("+++ Invalid CELL ID for hit!"); + hit->cellID = volumeID( step ) ; + except("+++ Invalid CELL ID for hit!"); } print("%s> Hit with deposit:%f Pos:%f %f %f ID=%016X", - c_name(),step->GetTotalEnergyDeposit(),position.X(),position.Y(),position.Z(), - (void*)hit->cellID); + c_name(),step->GetTotalEnergyDeposit(),position.X(),position.Y(),position.Z(), + (void*)hit->cellID); Geant4TouchableHandler handler(step); print("%s> Geant4 path:%s",c_name(),handler.path().c_str()); return true; @@ -83,23 +89,23 @@ namespace DD4hep { HitCollection* coll = collection(m_collectionID); long long int cell; try { - cell = cellID(step); + cell = cellID(step); } catch(std::runtime_error &e) { - std::stringstream out; - out << std::setprecision(20) << std::scientific; - out << "ERROR: " << e.what() << std::endl; - out << "Position: " - << "Pre (" << std::setw(24) << step->GetPreStepPoint()->GetPosition() << ") " - << "Post (" << std::setw(24) << step->GetPostStepPoint()->GetPosition() << ") " - << std::endl; - out << "Momentum: " - << " Pre (" <<std::setw(24) << step->GetPreStepPoint() ->GetMomentum() << ") " - << " Post (" <<std::setw(24) << step->GetPostStepPoint()->GetMomentum() << ") " - << std::endl; - - std::cout << out.str(); - - return true; + std::stringstream out; + out << std::setprecision(20) << std::scientific; + out << "ERROR: " << e.what() << std::endl; + out << "Position: " + << "Pre (" << std::setw(24) << step->GetPreStepPoint()->GetPosition() << ") " + << "Post (" << std::setw(24) << step->GetPostStepPoint()->GetPosition() << ") " + << std::endl; + out << "Momentum: " + << " Pre (" <<std::setw(24) << step->GetPreStepPoint() ->GetMomentum() << ") " + << " Post (" <<std::setw(24) << step->GetPostStepPoint()->GetMomentum() << ") " + << std::endl; + + std::cout << out.str(); + + return true; } Hit* hit = coll->find<Hit>(CellIDCompare<Hit>(cell)); @@ -199,23 +205,23 @@ namespace DD4hep { HitCollection* coll = collection(m_collectionID); long long int cell; try { - cell = cellID(step); + cell = cellID(step); } catch(std::runtime_error &e) { - std::stringstream out; - out << std::setprecision(20) << std::scientific; - out << "ERROR: " << e.what() << std::endl; - out << "Position: " - << "Pre (" << std::setw(24) << step->GetPreStepPoint()->GetPosition() << ") " - << "Post (" << std::setw(24) << step->GetPostStepPoint()->GetPosition() << ") " - << std::endl; - out << "Momentum: " - << " Pre (" <<std::setw(24) << step->GetPreStepPoint() ->GetMomentum() << ") " - << " Post (" <<std::setw(24) << step->GetPostStepPoint()->GetMomentum() << ") " - << std::endl; - - std::cout << out; - - return true; + std::stringstream out; + out << std::setprecision(20) << std::scientific; + out << "ERROR: " << e.what() << std::endl; + out << "Position: " + << "Pre (" << std::setw(24) << step->GetPreStepPoint()->GetPosition() << ") " + << "Post (" << std::setw(24) << step->GetPostStepPoint()->GetPosition() << ") " + << std::endl; + out << "Momentum: " + << " Pre (" <<std::setw(24) << step->GetPreStepPoint() ->GetMomentum() << ") " + << " Post (" <<std::setw(24) << step->GetPostStepPoint()->GetMomentum() << ") " + << std::endl; + + std::cout << out; + + return true; } Hit* hit = coll->find<Hit>(CellIDCompare<Hit>(cell)); diff --git a/DDG4/plugins/Geant4SensDet.cpp b/DDG4/plugins/Geant4SensDet.cpp index 7684fa625df3a11631889df9870a3a8a60835a18..0ec48a4af56d090a8c63f32a4e3bf44ff12c2ed8 100644 --- a/DDG4/plugins/Geant4SensDet.cpp +++ b/DDG4/plugins/Geant4SensDet.cpp @@ -1,11 +1,18 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Printout.h" #include "DD4hep/Primitives.h" #include "DD4hep/InstanceCount.h" @@ -14,6 +21,8 @@ #include "DDG4/Geant4Context.h" #include "DDG4/Geant4HitCollection.h" #include "DDG4/Geant4SensDetAction.h" + +// Geant4 include files #include "G4VSensitiveDetector.hh" #include "G4Event.hh" #include "G4Run.hh" @@ -160,4 +169,3 @@ typedef DD4hep::Simulation::Geant4SensDet Geant4calorimeter; DECLARE_GEANT4SENSITIVEDETECTOR(Geant4SensDet) DECLARE_GEANT4SENSITIVEDETECTOR(Geant4tracker) DECLARE_GEANT4SENSITIVEDETECTOR(Geant4calorimeter) - diff --git a/DDG4/plugins/Geant4SensDetFilters.cpp b/DDG4/plugins/Geant4SensDetFilters.cpp index 67cc1d0bd434bc8b07f1c2ccceaa4090caa00c37..0f1d652457dbaba2cfeaaceb28f2f3748bdfc364 100644 --- a/DDG4/plugins/Geant4SensDetFilters.cpp +++ b/DDG4/plugins/Geant4SensDetFilters.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDG4/Geant4SensDetAction.h" @@ -126,12 +132,12 @@ using namespace std; //DECLARE_GEANT4ACTION() DECLARE_GEANT4ACTION(GeantinoRejectFilter) DECLARE_GEANT4ACTION(ParticleRejectFilter) - DECLARE_GEANT4ACTION(ParticleSelectFilter) - DECLARE_GEANT4ACTION(EnergyDepositMinimumCut) +DECLARE_GEANT4ACTION(ParticleSelectFilter) +DECLARE_GEANT4ACTION(EnergyDepositMinimumCut) /// Constructor. - ParticleFilter::ParticleFilter(Geant4Context* ctxt, const std::string& nam) - : Geant4Filter(ctxt,nam), m_definition(0) +ParticleFilter::ParticleFilter(Geant4Context* ctxt, const std::string& nam) +: Geant4Filter(ctxt,nam), m_definition(0) { declareProperty("particle",m_particle); InstanceCount::increment(this); diff --git a/DDG4/plugins/Geant4Steppers.cpp b/DDG4/plugins/Geant4Steppers.cpp index f353770cdfa3ec63dcf60f51b1f8c2fbb3be5e5f..e6348ff23a442fb3dc9738dac664d6cb31a67ba3 100644 --- a/DDG4/plugins/Geant4Steppers.cpp +++ b/DDG4/plugins/Geant4Steppers.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Steppers.cpp 566 2013-05-15 08:30:34Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDG4/Factories.h" @@ -19,10 +25,10 @@ DECLARE_GEANT4_STEPPER(ImplicitEuler) DECLARE_GEANT4_STEPPER(ExplicitEuler) - DECLARE_GEANT4_STEPPER(SimpleRunge) - DECLARE_GEANT4_STEPPER(SimpleHeum) - DECLARE_GEANT4_MAGSTEPPER(ConstRK4) - DECLARE_GEANT4_STEPPER(ClassicalRK4) +DECLARE_GEANT4_STEPPER(SimpleRunge) +DECLARE_GEANT4_STEPPER(SimpleHeum) +DECLARE_GEANT4_MAGSTEPPER(ConstRK4) +DECLARE_GEANT4_STEPPER(ClassicalRK4) // Geant 4 include files @@ -32,11 +38,11 @@ DECLARE_GEANT4_STEPPER(ExplicitEuler) #include "G4HelixSimpleRunge.hh" #include "G4HelixHeum.hh" - DECLARE_GEANT4_MAGSTEPPER(HelixImplicitEuler) - DECLARE_GEANT4_MAGSTEPPER(HelixExplicitEuler) - DECLARE_GEANT4_MAGSTEPPER(HelixMixedStepper) - DECLARE_GEANT4_MAGSTEPPER(HelixSimpleRunge) - DECLARE_GEANT4_MAGSTEPPER(HelixHeum) +DECLARE_GEANT4_MAGSTEPPER(HelixImplicitEuler) +DECLARE_GEANT4_MAGSTEPPER(HelixExplicitEuler) +DECLARE_GEANT4_MAGSTEPPER(HelixMixedStepper) +DECLARE_GEANT4_MAGSTEPPER(HelixSimpleRunge) +DECLARE_GEANT4_MAGSTEPPER(HelixHeum) // Geant 4 include files @@ -46,7 +52,7 @@ DECLARE_GEANT4_STEPPER(ExplicitEuler) #include "G4KM_OpticalEqRhs.hh" #include "G4KM_NucleonEqRhs.hh" //Virtual: DECLARE_GEANT4_MAGMOTION(Mag_EqRhs); - DECLARE_GEANT4_MAGMOTION(Mag_SpinEqRhs) - DECLARE_GEANT4_MAGMOTION(Mag_UsualEqRhs) +DECLARE_GEANT4_MAGMOTION(Mag_SpinEqRhs) +DECLARE_GEANT4_MAGMOTION(Mag_UsualEqRhs) //DECLARE_GEANT4_MAGMOTION(KM_OpticalEqRhs); //DECLARE_GEANT4_MAGMOTION(KM_NucleonEqRhs); diff --git a/DDG4/plugins/Geant4TCUserParticleHandler.cpp b/DDG4/plugins/Geant4TCUserParticleHandler.cpp index c55d49744830e3f5295236e1a7ab1b20aef6d056..4a52df435b6b8ab19a07cbb0756f61e41ca4938b 100644 --- a/DDG4/plugins/Geant4TCUserParticleHandler.cpp +++ b/DDG4/plugins/Geant4TCUserParticleHandler.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== #ifndef DD4HEP_DDG4_GEANT4TCUSERPARTICLEHANDLER_H #define DD4HEP_DDG4_GEANT4TCUSERPARTICLEHANDLER_H diff --git a/DDG4/plugins/Geant4XMLSetup.cpp b/DDG4/plugins/Geant4XMLSetup.cpp index 0d7743f67abf3d6819d9e7a6c294562bf91d6922..336a2ddde738200b8ba0c94613a6f8900c3f3a65 100644 --- a/DDG4/plugins/Geant4XMLSetup.cpp +++ b/DDG4/plugins/Geant4XMLSetup.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Setup.cpp 578 2013-05-17 22:33:09Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" diff --git a/DDG4/python/DD4hep.py b/DDG4/python/DD4hep.py index d2a4177c7f10a0bf3b87bbfb74f31f89580c6805..b393d3d794db7105b7debe21ff3e8764be2963d5 100644 --- a/DDG4/python/DD4hep.py +++ b/DDG4/python/DD4hep.py @@ -1,4 +1,15 @@ -#--------------------------------------------------------------------------- +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== +# # We compile the DDG4 plugin on the fly if it does not exist using the AClick mechanism: def compileAClick(dictionary,g4=True): from ROOT import gInterpreter, gSystem diff --git a/DDG4/python/DDG4.py b/DDG4/python/DDG4.py index 1ea3529cd5acce69ecef12c285f947a0b971d057..132b3162984af45eea5d3478eefc4c39a6f24915 100644 --- a/DDG4/python/DDG4.py +++ b/DDG4/python/DDG4.py @@ -1,3 +1,15 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + from DD4hep import * def loadDDG4(): @@ -362,7 +374,7 @@ class Simple: def printDetectors(self): print '+++ List of sensitive detectors:' for i in self.lcdd.detectors(): - o = DetElement(i.second) + o = DetElement(i.second.ptr()) sd = self.lcdd.sensitiveDetector(o.name()) if sd.isValid(): typ = sd.type() diff --git a/DDG4/python/DDG4Dict.C b/DDG4/python/DDG4Dict.C index e46db7536ec79f2279e88cb9b00d1b5bd8312fdd..73a1801e68132948f60668cdd9a680a8d1b094f5 100644 --- a/DDG4/python/DDG4Dict.C +++ b/DDG4/python/DDG4Dict.C @@ -1,10 +1,17 @@ -// $Id: Geant4Data.h 513 2013-04-05 14:31:53Z gaede $ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// //==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- // -// Define the ROOT dictionaries for all data classes to be saved -// which are created by the DDG4 examples. +// Define the ROOT dictionaries for all data classes to be saved +// which are created by the DDG4 examples. // // Author : M.Frank // @@ -13,25 +20,6 @@ #include "DDG4/Geant4Primary.h" #include "DDG4/DDG4Dict.h" -// CINT configuration -#if defined(__MAKECINT__) -#pragma link C++ namespace DD4hep::DDSegmentation; - -/// Geant4 Vertex dictionaries -#pragma link C++ class DD4hep::Simulation::VertexExtension+; -#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::VertexExtension>+; -#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::PrimaryExtension>+; -#pragma link C++ class DD4hep::Simulation::Geant4Vertex+; -#pragma link C++ class std::vector<DD4hep::Simulation::Geant4Vertex*>+; -#pragma link C++ class std::map<int,DD4hep::Simulation::Geant4Vertex*>+; - -#pragma link C++ class DD4hep::Simulation::Geant4ParticleMap+; -#pragma link C++ class DD4hep::Simulation::PrimaryExtension+; -#pragma link C++ class DD4hep::Simulation::Geant4PrimaryInteraction+; -#pragma link C++ class std::map<int,DD4hep::Simulation::Geant4PrimaryInteraction*>+; -#pragma link C++ class DD4hep::Simulation::Geant4PrimaryEvent+; - -#endif using namespace std; using namespace DD4hep; @@ -191,8 +179,27 @@ namespace DD4hep { typedef DD4hep::Simulation::Geant4ActionCreation Geant4ActionCreation; #include "DD4hep/objects/DetectorInterna.h" -// CINT configuration for DDG4 + +// CINT configuration #if defined(__MAKECINT__) +#pragma link C++ namespace DDSegmentation; + +/// Geant4 Vertex dictionaries +#pragma link C++ class Simulation::VertexExtension+; +#pragma link C++ class Simulation::Geant4Vertex+; +#pragma link C++ class std::vector<Simulation::Geant4Vertex*>+; +#pragma link C++ class std::map<int,Simulation::Geant4Vertex*>+; + +#pragma link C++ class Simulation::Geant4ParticleMap+; +#pragma link C++ class Simulation::PrimaryExtension+; +#pragma link C++ class Simulation::Geant4PrimaryInteraction+; +#pragma link C++ class std::map<int,Simulation::Geant4PrimaryInteraction*>+; +#pragma link C++ class Simulation::Geant4PrimaryEvent+; + +#pragma link C++ class PropertyResult; +#pragma link C++ class Geant4InputAction::Particles; + +#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) namespace { struct bla { dd4hep_ptr<Geant4InputAction::Particles> __m1; @@ -200,10 +207,11 @@ namespace { dd4hep_ptr<DataExtension> __m3; }; } -#pragma link C++ class PropertyResult; -#pragma link C++ class Geant4InputAction::Particles; +#pragma link C++ class dd4hep_ptr<Simulation::VertexExtension>+; +#pragma link C++ class dd4hep_ptr<Simulation::PrimaryExtension>+; #pragma link C++ class dd4hep_ptr<Geant4InputAction::Particles>; #pragma link C++ class dd4hep_ptr<Geant4InputAction::Particles>::base_t; +#endif #pragma link C++ class ActionHandle; #pragma link C++ class FilterHandle; diff --git a/DDG4/python/checkGeometry.py b/DDG4/python/checkGeometry.py index b92144a2471a3fbf311696f1a3610089b35da0f2..ba44a7ab26e8dc81c7bbd77c36a0862f4fbc2609 100755 --- a/DDG4/python/checkGeometry.py +++ b/DDG4/python/checkGeometry.py @@ -1,4 +1,16 @@ #!/bin/python +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + import sys, optparse parser = optparse.OptionParser() diff --git a/DDG4/python/checkOverlaps.py b/DDG4/python/checkOverlaps.py index e626f3c6a49656b98ae2c260cd64c4bad830b844..0e1d1ac11a24b515f65f65cb318ae16f8bf24946 100755 --- a/DDG4/python/checkOverlaps.py +++ b/DDG4/python/checkOverlaps.py @@ -1,4 +1,16 @@ #!/bin/python +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + import sys, optparse parser = optparse.OptionParser() diff --git a/DDG4/scripts/dumpDDG4.C b/DDG4/scripts/dumpDDG4.C index 943e3b6b8fb30b90930963f046bdbee9b2f0e5d5..a7d62efdb777080b4e5f23b941616b9eb15117b7 100644 --- a/DDG4/scripts/dumpDDG4.C +++ b/DDG4/scripts/dumpDDG4.C @@ -1,11 +1,16 @@ -// $Id:$ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "CLHEP/Units/SystemOfUnits.h" diff --git a/DDG4/src/ComponentProperties.cpp b/DDG4/src/ComponentProperties.cpp index 3832c3f6d597e9ecc9dcacbe514f090da9878bc8..fa0f179cbf55d6423e714744c63c8667525c5ec7 100644 --- a/DDG4/src/ComponentProperties.cpp +++ b/DDG4/src/ComponentProperties.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" diff --git a/DDG4/src/Geant4Action.cpp b/DDG4/src/Geant4Action.cpp index 66b5f480a3500da6c9ac18823f9eb1580a99c1e6..2bb0224897eccb8bc7397775e5aac2ef8a8fec63 100644 --- a/DDG4/src/Geant4Action.cpp +++ b/DDG4/src/Geant4Action.cpp @@ -1,12 +1,18 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== -#include <algorithm> +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4Context.h" @@ -17,6 +23,9 @@ // Geant4 include files #include "G4UIdirectory.hh" +// C/C++ include files +#include <algorithm> + using namespace std; using namespace DD4hep; using namespace DD4hep::Simulation; @@ -50,8 +59,8 @@ void Geant4Action::ContextUpdate::operator()(Geant4Action* action) const { /// Standard constructor Geant4Action::Geant4Action(Geant4Context* ctxt, const string& nam) -: m_context(0), - m_control(0), m_outputLevel(INFO), m_needsControl(false), m_name(nam), m_refCount(1) { + : m_context(0), + m_control(0), m_outputLevel(INFO), m_needsControl(false), m_name(nam), m_refCount(1) { InstanceCount::increment(this); if ( ctxt ) m_context = *ctxt; m_outputLevel = ctxt ? ctxt->kernel().getOutputLevel(nam) : (printLevel()-1); @@ -76,7 +85,7 @@ long Geant4Action::release() { long count = --m_refCount; if (m_refCount <= 0) { printM1("Geant4Action: Deleting object %s of type %s Pointer:%p", - m_name.c_str(),typeName(typeid(*this)).c_str(),(void*)this); + m_name.c_str(),typeName(typeid(*this)).c_str(),(void*)this); delete this; } return count; diff --git a/DDG4/src/Geant4ActionPhase.cpp b/DDG4/src/Geant4ActionPhase.cpp index 51ddd44992f3d6d377f53c5683bf935998050275..7698750c82f12a561f6d4431c0c9fedd7b6155ee 100644 --- a/DDG4/src/Geant4ActionPhase.cpp +++ b/DDG4/src/Geant4ActionPhase.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4ActionPhase.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" @@ -16,7 +21,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4PhaseAction::Geant4PhaseAction(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt,nam) + : Geant4Action(ctxt,nam) { } @@ -35,7 +40,7 @@ DD4hep::Callback Geant4PhaseAction::callback() { /// Standard constructor Geant4ActionPhase::Geant4ActionPhase(Geant4Context* ctxt, const string& nam, const type_info& arg_type0, const type_info& arg_type1, const type_info& arg_type2) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { m_argTypes[0] = &arg_type0; m_argTypes[1] = &arg_type1; m_argTypes[2] = &arg_type2; diff --git a/DDG4/src/Geant4Call.cpp b/DDG4/src/Geant4Call.cpp index 6b53c9a322b8516c46b7f1c50fdf0454572bf9c7..223914aa5c0cd2897519103d470ecd062763bc38 100644 --- a/DDG4/src/Geant4Call.cpp +++ b/DDG4/src/Geant4Call.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDG4/Geant4Call.h" diff --git a/DDG4/src/Geant4Context.cpp b/DDG4/src/Geant4Context.cpp index 936406b0e969996e3d06ca96f715df4728789c6f..25e14ef155e5405a00685ee7f79b6eb07209e5d3 100644 --- a/DDG4/src/Geant4Context.cpp +++ b/DDG4/src/Geant4Context.cpp @@ -1,24 +1,33 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== -#include <algorithm> +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4Context.h" #include "DDG4/Geant4Kernel.h" +// C/C++ include files +#include <algorithm> + using namespace std; using namespace DD4hep; using namespace DD4hep::Simulation; /// Intializing constructor Geant4Run::Geant4Run(const G4Run* run_pointer) -: ObjectExtensions(typeid(Geant4Run)), m_run(run_pointer) + : ObjectExtensions(typeid(Geant4Run)), m_run(run_pointer) { InstanceCount::increment(this); } @@ -30,7 +39,7 @@ Geant4Run::~Geant4Run() { /// Intializing constructor Geant4Event::Geant4Event(const G4Event* evt, Geant4Random* rnd) -: ObjectExtensions(typeid(Geant4Event)), m_event(evt), m_random(rnd) + : ObjectExtensions(typeid(Geant4Event)), m_event(evt), m_random(rnd) { InstanceCount::increment(this); } @@ -42,7 +51,7 @@ Geant4Event::~Geant4Event() { /// Default constructor Geant4Context::Geant4Context(Geant4Kernel* kernel_pointer) -: m_kernel(kernel_pointer), m_run(0), m_event(0) { + : m_kernel(kernel_pointer), m_run(0), m_event(0) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index f561c26d4e8cd8cea8639528f15dc911f81ca914..b45e594c147218dacd591a5feb452c4e048a3cc9 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -1,12 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Plugins.h" #include "DD4hep/Volumes.h" @@ -17,7 +23,6 @@ #include "DDG4/Geant4Field.h" #include "DDG4/Geant4Converter.h" -#include "DDG4/Factories.h" #include "DDG4/Geant4SensitiveDetector.h" // ROOT includes @@ -84,6 +89,7 @@ #include "G4ReflectionFactory.hh" #include "CLHEP/Units/SystemOfUnits.h" +// C/C++ include files #include <iostream> #include <iomanip> #include <sstream> diff --git a/DDG4/src/Geant4Data.cpp b/DDG4/src/Geant4Data.cpp index 0232f5b891adae814b35ee6b8565abf85934bc1a..f68f34b8236cfda2c3dfdc143dd73937ac909ec0 100644 --- a/DDG4/src/Geant4Data.cpp +++ b/DDG4/src/Geant4Data.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" diff --git a/DDG4/src/Geant4DataConversion.cpp b/DDG4/src/Geant4DataConversion.cpp index 0ca9c6a04f0e352fa71b061523416290e660d17e..347a14c893417aeafd4bd72cb5289e45a2c279fe 100644 --- a/DDG4/src/Geant4DataConversion.cpp +++ b/DDG4/src/Geant4DataConversion.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4DataConversion.h" diff --git a/DDG4/src/Geant4DataDump.cpp b/DDG4/src/Geant4DataDump.cpp index 5193613cebb5d5c3e678b3a917eaeabc5297493c..14fc7e3984df105c7ae488dad6051597496a7c2e 100644 --- a/DDG4/src/Geant4DataDump.cpp +++ b/DDG4/src/Geant4DataDump.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Primitives.h" diff --git a/DDG4/src/Geant4DetectorConstruction.cpp b/DDG4/src/Geant4DetectorConstruction.cpp index 97fb0d5063525d354dde8df5e8969d0f27e15d9d..85b9797cebf5bad15d1395bef55e82da0be5af83 100644 --- a/DDG4/src/Geant4DetectorConstruction.cpp +++ b/DDG4/src/Geant4DetectorConstruction.cpp @@ -1,18 +1,28 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDG4/Geant4DetectorConstruction.h" #include "DDG4/Geant4HierarchyDump.h" #include "DDG4/Geant4Converter.h" #include "DDG4/Geant4Kernel.h" #include "DD4hep/LCDD.h" + #include "TGeoManager.h" #include "G4PVPlacement.hh" + +// C/C++ include files #include <iostream> #ifdef GEANT4_HAS_GDML @@ -35,7 +45,7 @@ Geant4DetectorConstruction* Geant4DetectorConstruction::instance(Geant4Kernel& k /// Initializing constructor for other clients Geant4DetectorConstruction::Geant4DetectorConstruction(Geometry::LCDD& lcdd) -: Geant4Action(0,"DetectorConstruction"), m_lcdd(lcdd), m_world(0) + : Geant4Action(0,"DetectorConstruction"), m_lcdd(lcdd), m_world(0) { m_outputLevel = PrintLevel(printLevel()-1); s_instance = this; @@ -43,7 +53,7 @@ Geant4DetectorConstruction::Geant4DetectorConstruction(Geometry::LCDD& lcdd) /// Initializing constructor for DDG4 Geant4DetectorConstruction::Geant4DetectorConstruction(Geant4Kernel& kernel) -: Geant4Action(0,"DetectorConstruction"), m_lcdd(kernel.lcdd()), m_world(0) + : Geant4Action(0,"DetectorConstruction"), m_lcdd(kernel.lcdd()), m_world(0) { m_outputLevel = kernel.getOutputLevel("Geant4Converter"); s_instance = this; diff --git a/DDG4/src/Geant4EventAction.cpp b/DDG4/src/Geant4EventAction.cpp index 468236930c2c18760cc6e9cdaef848f67437d27e..e3109b844d82c4c1be78887de3f6e69e2c69efa7 100644 --- a/DDG4/src/Geant4EventAction.cpp +++ b/DDG4/src/Geant4EventAction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" @@ -18,7 +23,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4EventAction::Geant4EventAction(Geant4Context* ctxt, const string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -37,7 +42,7 @@ void Geant4EventAction::end(const G4Event*) { /// Standard constructor Geant4EventActionSequence::Geant4EventActionSequence(Geant4Context* ctxt, const string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4Exec.cpp b/DDG4/src/Geant4Exec.cpp index db9807e82833b4d92c4afe67bf288efef8e06507..b268e6588687755ba6fa96763e7c3b65be705168 100644 --- a/DDG4/src/Geant4Exec.cpp +++ b/DDG4/src/Geant4Exec.cpp @@ -1,27 +1,21 @@ -// $Id: Geant4Hits.h 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - -#include <G4Version.hh> +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/Printout.h" #include "DD4hep/Primitives.h" #include "DD4hep/InstanceCount.h" - -#include "G4UserRunAction.hh" -#include "G4UserEventAction.hh" -#include "G4UserTrackingAction.hh" -#include "G4UserStackingAction.hh" -#include "G4UserSteppingAction.hh" -#include "G4VUserPhysicsList.hh" -#include "G4VModularPhysicsList.hh" -#include "G4VUserPrimaryGeneratorAction.hh" - #include "DD4hep/Handle.h" #include "DDG4/Geant4RunAction.h" #include "DDG4/Geant4EventAction.h" @@ -34,6 +28,18 @@ #include "DDG4/Geant4Kernel.h" #include "DDG4/Geant4Random.h" +// Geant4 include files +#include <G4Version.hh> +#include "G4UserRunAction.hh" +#include "G4UserEventAction.hh" +#include "G4UserTrackingAction.hh" +#include "G4UserStackingAction.hh" +#include "G4UserSteppingAction.hh" +#include "G4VUserPhysicsList.hh" +#include "G4VModularPhysicsList.hh" +#include "G4VUserPrimaryGeneratorAction.hh" + +// C/C++ include files #include <memory> #include <stdexcept> diff --git a/DDG4/src/Geant4Field.cpp b/DDG4/src/Geant4Field.cpp index 73fe87a87f236975752a495d63c461fac70aaa19..68007569bbb57735546247b2859d711e31bfec99 100644 --- a/DDG4/src/Geant4Field.cpp +++ b/DDG4/src/Geant4Field.cpp @@ -1,11 +1,17 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDG4/Geant4Field.h" #include "DD4hep/DD4hepUnits.h" diff --git a/DDG4/src/Geant4GDMLDetector.cpp b/DDG4/src/Geant4GDMLDetector.cpp index 766b051f2bc95752ac9f337b1fbc81a1660b58f8..c2dcff4ccd41f445afb40f39aef34cf12aa57e90 100644 --- a/DDG4/src/Geant4GDMLDetector.cpp +++ b/DDG4/src/Geant4GDMLDetector.cpp @@ -1,4 +1,21 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDG4/Geant4GDMLDetector.h" + +// C/C++ include files #include <iostream> //#define GEANT4_HAS_GDML @@ -11,7 +28,7 @@ using namespace std; using namespace DD4hep; DD4hep::Simulation::Geant4GDMLDetector::Geant4GDMLDetector(const std::string& gdmlFile) -: m_fileName(gdmlFile), m_world(0) { + : m_fileName(gdmlFile), m_world(0) { } G4VPhysicalVolume* DD4hep::Simulation::Geant4GDMLDetector::Construct() { diff --git a/DDG4/src/Geant4GeneratorAction.cpp b/DDG4/src/Geant4GeneratorAction.cpp index 35da73556bb6c86134f6cf70128556947ea57624..b8cb71e46fdda972a667f410d63eddfc01357be3 100644 --- a/DDG4/src/Geant4GeneratorAction.cpp +++ b/DDG4/src/Geant4GeneratorAction.cpp @@ -1,15 +1,21 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4GeneratorAction.h" + // C/C++ include files #include <stdexcept> @@ -17,7 +23,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4GeneratorAction::Geant4GeneratorAction(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -28,7 +34,7 @@ Geant4GeneratorAction::~Geant4GeneratorAction() { /// Standard constructor Geant4GeneratorActionSequence::Geant4GeneratorActionSequence(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4GeneratorActionInit.cpp b/DDG4/src/Geant4GeneratorActionInit.cpp index 32af3b4c434ae6156be98a1c8097104c9ecf8445..d701044c24cc7ac5c72924d2e4dbdf87ec9c120c 100644 --- a/DDG4/src/Geant4GeneratorActionInit.cpp +++ b/DDG4/src/Geant4GeneratorActionInit.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" @@ -20,7 +26,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4GeneratorActionInit::Geant4GeneratorActionInit(Geant4Context* ctxt, const std::string& nam) -: Geant4GeneratorAction(ctxt,nam), m_run(0), m_evtTotal(0), m_evtRun(0) + : Geant4GeneratorAction(ctxt,nam), m_run(0), m_evtTotal(0), m_evtRun(0) { InstanceCount::increment(this); context()->kernel().runAction().callAtEnd(this,&Geant4GeneratorActionInit::end); diff --git a/DDG4/src/Geant4GeometryInfo.cpp b/DDG4/src/Geant4GeometryInfo.cpp index 2c346fda650c09771a0c18210b504624fcf7a14e..aa13b37c7c25bfe91a9a9b708bf78c4261a22018 100644 --- a/DDG4/src/Geant4GeometryInfo.cpp +++ b/DDG4/src/Geant4GeometryInfo.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Mapping.cpp 588 2013-06-03 11:41:35Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "G4VPhysicalVolume.hh" @@ -35,7 +40,7 @@ string Geant4GeometryMaps::placementPath(const Geant4PlacementPath& path, bool r /// Default constructor Geant4GeometryInfo::Geant4GeometryInfo() -: TNamed("Geant4GeometryInfo", "Geant4GeometryInfo"), m_world(0), valid(false) { + : TNamed("Geant4GeometryInfo", "Geant4GeometryInfo"), m_world(0), valid(false) { } /// Default destructor diff --git a/DDG4/src/Geant4Handle.cpp b/DDG4/src/Geant4Handle.cpp index 5399c2846acec7979f2f306547f8b606d353c002..b450fe1437d85dab0703728e192a39762ff090ab 100644 --- a/DDG4/src/Geant4Handle.cpp +++ b/DDG4/src/Geant4Handle.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Setup.cpp 796 2013-10-03 19:19:39Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" diff --git a/DDG4/src/Geant4HierarchyDump.cpp b/DDG4/src/Geant4HierarchyDump.cpp index ccd98d0edf7641c3fe145b93f18a145259b37360..757c2b9f86502f9486ae8fe85e820b1e1be1a3c5 100644 --- a/DDG4/src/Geant4HierarchyDump.cpp +++ b/DDG4/src/Geant4HierarchyDump.cpp @@ -1,24 +1,29 @@ -// $Id: Geant4Converter.cpp 602 2013-06-11 14:50:57Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== - -#include <G4Version.hh> +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Plugins.h" #include "DD4hep/Volumes.h" #include "DD4hep/Printout.h" #include "DDG4/Geant4HierarchyDump.h" +// Geant4 include files +#include "G4Version.hh" #include "G4VisAttributes.hh" #include "G4ProductionCuts.hh" #include "G4VUserRegionInformation.hh" -// Geant4 include files #include "G4Element.hh" #include "G4SDManager.hh" @@ -50,6 +55,7 @@ #include "G4ElectroMagneticField.hh" #include "G4FieldManager.hh" +// C/C++ include files #include <iostream> #include <iomanip> #include <sstream> diff --git a/DDG4/src/Geant4HitCollection.cpp b/DDG4/src/Geant4HitCollection.cpp index 0117b8cbf7be6c2f41c4e3415023b5a9e63b59d0..74fa0e45e54d52f244882739125ecab22979d77a 100644 --- a/DDG4/src/Geant4HitCollection.cpp +++ b/DDG4/src/Geant4HitCollection.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Mapping.cpp 588 2013-06-03 11:41:35Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" @@ -23,7 +28,7 @@ Geant4HitWrapper::InvalidHit::~InvalidHit() { /// Initializing Constructor Geant4HitWrapper::HitManipulator::HitManipulator(const ComponentCast& c, const ComponentCast& v) -: cast(c), vec_type(v) { + : cast(c), vec_type(v) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4Hits.cpp b/DDG4/src/Geant4Hits.cpp index 4f42f5c4e9d520615a56e6112abc9dfeb64b0c9f..f280f4a52174a3d8b69361d3fb6030fa7f420e81 100644 --- a/DDG4/src/Geant4Hits.cpp +++ b/DDG4/src/Geant4Hits.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4Hits.h" @@ -49,12 +54,12 @@ static G4Allocator<Geant4TrackerHit> TrackerHitAllocator; /// Default constructor Geant4TrackerHit::Geant4TrackerHit() -: Geant4Hit(), position(), momentum(), length(0.0), truth(), energyDeposit(0.0) { + : Geant4Hit(), position(), momentum(), length(0.0), truth(), energyDeposit(0.0) { } /// Standard initializing constructor Geant4TrackerHit::Geant4TrackerHit(int track_id, int pdg_id, double deposit, double time_stamp) -: Geant4Hit(), position(), momentum(), length(0.0), truth(track_id, pdg_id, deposit, time_stamp), energyDeposit(deposit) { + : Geant4Hit(), position(), momentum(), length(0.0), truth(track_id, pdg_id, deposit, time_stamp), energyDeposit(deposit) { } /// Assignment operator @@ -110,7 +115,7 @@ static G4Allocator<Geant4CalorimeterHit> CalorimeterHitAllocator; /// Standard constructor Geant4CalorimeterHit::Geant4CalorimeterHit(const Position& pos) -: Geant4Hit(), position(pos), truth(), energyDeposit(0) { + : Geant4Hit(), position(pos), truth(), energyDeposit(0) { } /// Geant4 required object allocator diff --git a/DDG4/src/Geant4InputAction.cpp b/DDG4/src/Geant4InputAction.cpp index 1245fbb4a4afbec3f5141e7ee2746f55d466c17b..1564bde6235c1b7ed24bcfe27fbcaa37b3ad76b3 100644 --- a/DDG4/src/Geant4InputAction.cpp +++ b/DDG4/src/Geant4InputAction.cpp @@ -1,7 +1,12 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // // @author P.Kostka (main author) // @author M.Frank (code reshuffeling into new DDG4 scheme) @@ -22,7 +27,7 @@ typedef DD4hep::ReferenceBitMask<int> PropertyMask; /// Initializing constructor Geant4EventReader::Geant4EventReader(const std::string& nam) -: m_name(nam), m_directAccess(false), m_currEvent(0) + : m_name(nam), m_directAccess(false), m_currEvent(0) { } @@ -70,7 +75,7 @@ Geant4EventReader::moveToEvent(int event_number) { /// Standard constructor Geant4InputAction::Geant4InputAction(Geant4Context* ctxt, const string& nam) -: Geant4GeneratorAction(ctxt,nam), m_reader(0) + : Geant4GeneratorAction(ctxt,nam), m_reader(0) { declareProperty("Input", m_input); declareProperty("Sync", m_firstEvent=0); diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp index 328160e548758b0621c81e519ebaccfcf5f9e0c8..11444b9bb1e6bc27308c130593da7919b313f522 100644 --- a/DDG4/src/Geant4InputHandling.cpp +++ b/DDG4/src/Geant4InputHandling.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DDG4/Geant4InputHandling.h" #include "DDG4/Geant4Primary.h" @@ -14,6 +20,7 @@ #include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Units/PhysicalConstants.h" +// Geant4 include files #include "G4ParticleDefinition.hh" #include "G4Event.hh" #include "G4PrimaryVertex.hh" diff --git a/DDG4/src/Geant4InteractionMerger.cpp b/DDG4/src/Geant4InteractionMerger.cpp index a094999acbe4420d833b97537ddb9969a8e3b222..600a396733068057b3f0a8f1795606c22b30a5c3 100644 --- a/DDG4/src/Geant4InteractionMerger.cpp +++ b/DDG4/src/Geant4InteractionMerger.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" @@ -16,7 +22,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4InteractionMerger::Geant4InteractionMerger(Geant4Context* ctxt, const std::string& nam) -: Geant4GeneratorAction(ctxt,nam) + : Geant4GeneratorAction(ctxt,nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4InteractionVertexBoost.cpp b/DDG4/src/Geant4InteractionVertexBoost.cpp index 9a3ba936614c3ff7bf3e13c6b3fb31458a518d50..326f442b546d0c4c3b9f51828d4f570444694d5e 100644 --- a/DDG4/src/Geant4InteractionVertexBoost.cpp +++ b/DDG4/src/Geant4InteractionVertexBoost.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -17,7 +22,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4InteractionVertexBoost::Geant4InteractionVertexBoost(Geant4Context* ctxt, const std::string& nam) -: Geant4GeneratorAction(ctxt, nam) + : Geant4GeneratorAction(ctxt, nam) { InstanceCount::increment(this); declareProperty("Angle", m_angle = 0); diff --git a/DDG4/src/Geant4InteractionVertexSmear.cpp b/DDG4/src/Geant4InteractionVertexSmear.cpp index 114cfd722f9dc76154c78766fa85782fb436bc68..0b2e491535185d5ffedb1a138de21c2a84495097 100644 --- a/DDG4/src/Geant4InteractionVertexSmear.cpp +++ b/DDG4/src/Geant4InteractionVertexSmear.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -22,7 +27,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4InteractionVertexSmear::Geant4InteractionVertexSmear(Geant4Context* ctxt, const std::string& nam) -: Geant4GeneratorAction(ctxt, nam) + : Geant4GeneratorAction(ctxt, nam) { InstanceCount::increment(this); declareProperty("Offset", m_offset); diff --git a/DDG4/src/Geant4IsotropeGenerator.cpp b/DDG4/src/Geant4IsotropeGenerator.cpp index 69852ad301f0febd50d58e5147717087ba6c0983..625b3cf5820e0f8fd113509e30bceaf9f747da3c 100644 --- a/DDG4/src/Geant4IsotropeGenerator.cpp +++ b/DDG4/src/Geant4IsotropeGenerator.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -18,7 +23,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4IsotropeGenerator::Geant4IsotropeGenerator(Geant4Context* ctxt, const string& nam) -: Geant4ParticleGenerator(ctxt, nam) + : Geant4ParticleGenerator(ctxt, nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp index bc59d3595a5bc471cff3270d12b82f755584f113..cf470b70e5c5bd2b50df78db1b1b51974a1c95e1 100644 --- a/DDG4/src/Geant4Kernel.cpp +++ b/DDG4/src/Geant4Kernel.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Kernel.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" @@ -38,12 +43,12 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4Kernel::PhaseSelector::PhaseSelector(Geant4Kernel* kernel) -: m_kernel(kernel) { + : m_kernel(kernel) { } /// Copy constructor Geant4Kernel::PhaseSelector::PhaseSelector(const PhaseSelector& c) -: m_kernel(c.m_kernel) { + : m_kernel(c.m_kernel) { } /// Assignment operator @@ -65,9 +70,9 @@ Geant4ActionPhase& Geant4Kernel::PhaseSelector::operator[](const std::string& na /// Standard constructor Geant4Kernel::Geant4Kernel(LCDD& lcdd_ref) -: m_runManager(0), m_generatorAction(0), m_runAction(0), m_eventAction(0), - m_trackingAction(0), m_steppingAction(0), m_stackingAction(0), m_sensDetActions(0), - m_physicsList(0), m_lcdd(lcdd_ref), phase(this) { + : m_runManager(0), m_generatorAction(0), m_runAction(0), m_eventAction(0), + m_trackingAction(0), m_steppingAction(0), m_stackingAction(0), m_sensDetActions(0), + m_physicsList(0), m_lcdd(lcdd_ref), phase(this) { #if 0 registerSequence(m_runAction, "RunAction"); registerSequence(m_eventAction, "EventAction"); diff --git a/DDG4/src/Geant4Mapping.cpp b/DDG4/src/Geant4Mapping.cpp index 90a8d4cc5e3bce920f869aa81c14227a0b837e81..3c5bd005c7c8972e0c744c62460e3176ce27795d 100644 --- a/DDG4/src/Geant4Mapping.cpp +++ b/DDG4/src/Geant4Mapping.cpp @@ -1,12 +1,18 @@ -// $Id: Geant4Mapping.cpp 588 2013-06-03 11:41:35Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DD4hep/Printout.h" #include "DDG4/Geant4Mapping.h" #include "G4PVPlacement.hh" @@ -18,7 +24,7 @@ using namespace std; /// Initializing Constructor Geant4Mapping::Geant4Mapping(LCDD& lcdd_ref) -: m_lcdd(lcdd_ref), m_dataPtr(0) { + : m_lcdd(lcdd_ref), m_dataPtr(0) { } /// Standard destructor diff --git a/DDG4/src/Geant4MonteCarloTruth.cpp b/DDG4/src/Geant4MonteCarloTruth.cpp index bfa1a452007a28e3bbc43a020a8d8fd8881e79a3..f8862cbc00cee644e434dbcb4b8ca4b155448f6e 100644 --- a/DDG4/src/Geant4MonteCarloTruth.cpp +++ b/DDG4/src/Geant4MonteCarloTruth.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" @@ -24,7 +29,8 @@ Geant4MonteCarloTruth::~Geant4MonteCarloTruth() { } /// Standard constructor -Geant4DummyTruthHandler::Geant4DummyTruthHandler(Geant4Context* ctxt,const std::string& nam) : Geant4Action(ctxt,nam), Geant4MonteCarloTruth() +Geant4DummyTruthHandler::Geant4DummyTruthHandler(Geant4Context* ctxt,const std::string& nam) + : Geant4Action(ctxt,nam), Geant4MonteCarloTruth() { } diff --git a/DDG4/src/Geant4Output2ROOT.cpp b/DDG4/src/Geant4Output2ROOT.cpp index 8ce393026f16596cba2c458c775c76cc08e62db3..9c77f0152b5d1d4875f0d49272f3cd10b7d411da 100644 --- a/DDG4/src/Geant4Output2ROOT.cpp +++ b/DDG4/src/Geant4Output2ROOT.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -29,7 +34,7 @@ using namespace std; /// Standard constructor Geant4Output2ROOT::Geant4Output2ROOT(Geant4Context* ctxt, const string& nam) -: Geant4OutputAction(ctxt, nam), m_file(0), m_tree(0) { + : Geant4OutputAction(ctxt, nam), m_file(0), m_tree(0) { declareProperty("Section", m_section = "EVENT"); declareProperty("HandleMCTruth", m_handleMCTruth = true); InstanceCount::increment(this); @@ -160,27 +165,27 @@ void Geant4Output2ROOT::saveCollection(OutputContext<G4Event>& /* ctxt */, G4VHi size_t nhits = coll->GetSize(); if ( m_handleMCTruth && m_truth && nhits > 0 ) { try { - for(size_t i=0; i<nhits; ++i) { - Geant4HitData* h = coll->hit(i); - Geant4Tracker::Hit* trk_hit = dynamic_cast<Geant4Tracker::Hit*>(h); - if ( 0 != trk_hit ) { - Geant4HitData::Contribution& t = trk_hit->truth; - int trackID = t.trackID; - t.trackID = m_truth->particleID(trackID); - } - Geant4Calorimeter::Hit* cal_hit = dynamic_cast<Geant4Calorimeter::Hit*>(h); - if ( 0 != cal_hit ) { - Geant4HitData::Contributions& c = cal_hit->truth; - for(Geant4HitData::Contributions::iterator j=c.begin(); j!=c.end(); ++j) { - Geant4HitData::Contribution& t = *j; - int trackID = t.trackID; - t.trackID = m_truth->particleID(trackID); - } - } - } + for(size_t i=0; i<nhits; ++i) { + Geant4HitData* h = coll->hit(i); + Geant4Tracker::Hit* trk_hit = dynamic_cast<Geant4Tracker::Hit*>(h); + if ( 0 != trk_hit ) { + Geant4HitData::Contribution& t = trk_hit->truth; + int trackID = t.trackID; + t.trackID = m_truth->particleID(trackID); + } + Geant4Calorimeter::Hit* cal_hit = dynamic_cast<Geant4Calorimeter::Hit*>(h); + if ( 0 != cal_hit ) { + Geant4HitData::Contributions& c = cal_hit->truth; + for(Geant4HitData::Contributions::iterator j=c.begin(); j!=c.end(); ++j) { + Geant4HitData::Contribution& t = *j; + int trackID = t.trackID; + t.trackID = m_truth->particleID(trackID); + } + } + } } catch(...) { - printout(ERROR,name(),"+++ Exception while saving collection %s.",hc_nam.c_str()); + printout(ERROR,name(),"+++ Exception while saving collection %s.",hc_nam.c_str()); } } fill(hc_nam, coll->vector_type(), &hits); diff --git a/DDG4/src/Geant4OutputAction.cpp b/DDG4/src/Geant4OutputAction.cpp index 4c54f82bee84a724c8005ed18d3b4ce0c3d85b07..9fa61e0187e3822495274fe2dfbc487166ba1d0b 100644 --- a/DDG4/src/Geant4OutputAction.cpp +++ b/DDG4/src/Geant4OutputAction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -24,7 +29,7 @@ using namespace std; /// Standard constructor Geant4OutputAction::Geant4OutputAction(Geant4Context* ctxt, const string& nam) -: Geant4EventAction(ctxt, nam), m_truth(0) + : Geant4EventAction(ctxt, nam), m_truth(0) { InstanceCount::increment(this); declareProperty("Output", m_output); @@ -51,37 +56,37 @@ void Geant4OutputAction::end(const G4Event* evt) { try { m_truth = context()->event().extension<Geant4ParticleMap>(false); if ( m_truth && !m_truth->isValid() ) { - m_truth = 0; - printout(WARNING,name(),"+++ [Event:%d] No valid MC truth info present. " - "Is a Particle handler installed ?",evt->GetEventID()); + m_truth = 0; + printout(WARNING,name(),"+++ [Event:%d] No valid MC truth info present. " + "Is a Particle handler installed ?",evt->GetEventID()); } try { - saveEvent(ctxt); - for (int i = 0; i < nCol; ++i) { - G4VHitsCollection* hc = hce->GetHC(i); - saveCollection(ctxt, hc); - } + saveEvent(ctxt); + for (int i = 0; i < nCol; ++i) { + G4VHitsCollection* hc = hce->GetHC(i); + saveCollection(ctxt, hc); + } } catch(const exception& e) { - printout(ERROR,name(),"+++ [Event:%d] Exception while saving event:%s", - evt->GetEventID(),e.what()); - if ( m_errorFatal ) throw; + printout(ERROR,name(),"+++ [Event:%d] Exception while saving event:%s", + evt->GetEventID(),e.what()); + if ( m_errorFatal ) throw; } catch(...) { - printout(ERROR,name(),"+++ [Event:%d] UNKNWON Exception while saving event", - evt->GetEventID()); - if ( m_errorFatal ) throw; + printout(ERROR,name(),"+++ [Event:%d] UNKNWON Exception while saving event", + evt->GetEventID()); + if ( m_errorFatal ) throw; } commit(ctxt); } catch(const exception& e) { printout(ERROR,name(),"+++ [Event:%d] Exception while saving event:%s", - evt->GetEventID(),e.what()); + evt->GetEventID(),e.what()); if ( m_errorFatal ) throw; } catch(...) { printout(ERROR,name(),"+++ [Event:%d] UNKNWON Exception while saving event", - evt->GetEventID()); + evt->GetEventID()); if ( m_errorFatal ) throw; } m_truth = 0; diff --git a/DDG4/src/Geant4Particle.cpp b/DDG4/src/Geant4Particle.cpp index 2a6085b797212940712cfb03786863192f8c55ae..5171ae0d66d14e423ff7db4b19d4752da3a27626 100644 --- a/DDG4/src/Geant4Particle.cpp +++ b/DDG4/src/Geant4Particle.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" diff --git a/DDG4/src/Geant4ParticleGenerator.cpp b/DDG4/src/Geant4ParticleGenerator.cpp index a8b1759a9d0507df29429fe2722d3a83c899743d..6f72ebded10447a8836b47a77737693eeec2f9b0 100644 --- a/DDG4/src/Geant4ParticleGenerator.cpp +++ b/DDG4/src/Geant4ParticleGenerator.cpp @@ -15,6 +15,7 @@ #include "DDG4/Geant4ParticleGenerator.h" #include "CLHEP/Units/SystemOfUnits.h" +// Geant4 include files #include "G4ParticleTable.hh" #include "G4ParticleDefinition.hh" diff --git a/DDG4/src/Geant4ParticleGun.cpp b/DDG4/src/Geant4ParticleGun.cpp index af411d32480eacaeb69e411e661c1f058636de58..ccda0a356e6821dcbad512b613b2530114475140 100644 --- a/DDG4/src/Geant4ParticleGun.cpp +++ b/DDG4/src/Geant4ParticleGun.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -17,6 +22,7 @@ #include "DDG4/Geant4InputHandling.h" #include "CLHEP/Units/SystemOfUnits.h" +// Geant4 include files #include "G4ParticleTable.hh" #include "G4ParticleDefinition.hh" @@ -32,8 +38,8 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4ParticleGun::Geant4ParticleGun(Geant4Context* ctxt, const string& nam) -: Geant4GeneratorAction(ctxt,nam), m_position(0,0,0), m_direction(1,1,0.3), - m_particle(0), m_shotNo(0) + : Geant4GeneratorAction(ctxt,nam), m_position(0,0,0), m_direction(1,1,0.3), + m_particle(0), m_shotNo(0) { InstanceCount::increment(this); m_needsControl = true; diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index 1aaa9e6cd7b70b04be171b5dd33060f429b88def..c9b1b3e9d996fad0a473daea4dafa28b8b5a8275 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -1,13 +1,18 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files -//#include "DD4hep/Printout.h" #include "DD4hep/Primitives.h" #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4StepHandler.h" @@ -19,6 +24,7 @@ #include "DDG4/Geant4ParticleHandler.h" #include "DDG4/Geant4UserParticleHandler.h" +// Geant4 include files #include "G4Step.hh" #include "G4Track.hh" #include "G4Event.hh" @@ -29,6 +35,7 @@ #include "G4ParticleDefinition.hh" #include "CLHEP/Units/SystemOfUnits.h" +// C/C++ include files #include <set> #include <stdexcept> #include <algorithm> diff --git a/DDG4/src/Geant4ParticlePrint.cpp b/DDG4/src/Geant4ParticlePrint.cpp index ddd3eda4110b6fd2209fd1b43e1ed6d8c8298fc6..48e830caca3fceac3bed1ee9227e9dea955ca5f4 100644 --- a/DDG4/src/Geant4ParticlePrint.cpp +++ b/DDG4/src/Geant4ParticlePrint.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/Primitives.h" @@ -13,10 +19,13 @@ #include "DDG4/Geant4ParticlePrint.h" #include "DDG4/Geant4Data.h" #include "DDG4/Geant4HitCollection.h" -#include <cstring> +// Geant4 include files #include "G4Event.hh" +// C/C++ include files +#include <cstring> + using namespace std; using namespace DD4hep; using namespace DD4hep::Simulation; @@ -25,7 +34,7 @@ typedef ReferenceBitMask<const int> PropertyMask; /// Standard constructor Geant4ParticlePrint::Geant4ParticlePrint(Geant4Context* ctxt, const std::string& nam) -: Geant4EventAction(ctxt,nam) + : Geant4EventAction(ctxt,nam) { declareProperty("OutputType",m_outputType=3); declareProperty("PrintBegin",m_printBegin=false); diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index bbed22ebb73be3ef3a0801a1d27f80925794f0c4..0803c9d27caebb250726f3b802393ebdb2d80c11 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4PhysicsList.h" @@ -14,6 +19,7 @@ #include "DD4hep/Printout.h" #include "DD4hep/Plugins.h" +// Geant4 include files #include "G4VPhysicsConstructor.hh" #include "G4ParticleTable.hh" #include "G4ProcessManager.hh" @@ -70,11 +76,11 @@ Geant4UserPhysics::~Geant4UserPhysics() { /// Default constructor Geant4PhysicsList::Process::Process() -: ordAtRestDoIt(-1), ordAlongSteptDoIt(-1), ordPostStepDoIt(-1) { + : ordAtRestDoIt(-1), ordAlongSteptDoIt(-1), ordPostStepDoIt(-1) { } /// Copy constructor Geant4PhysicsList::Process::Process(const Process& p) -: name(p.name), ordAtRestDoIt(p.ordAtRestDoIt), ordAlongSteptDoIt(p.ordAlongSteptDoIt), ordPostStepDoIt(p.ordPostStepDoIt) { + : name(p.name), ordAtRestDoIt(p.ordAtRestDoIt), ordAlongSteptDoIt(p.ordAlongSteptDoIt), ordPostStepDoIt(p.ordPostStepDoIt) { } /// Assignment operator @@ -90,7 +96,7 @@ Geant4PhysicsList::Process& Geant4PhysicsList::Process::operator=(const Process& /// Standard constructor Geant4PhysicsList::Geant4PhysicsList(Geant4Context* ctxt, const string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -239,7 +245,7 @@ void Geant4PhysicsList::constructProcesses(Geant4UserPhysics* physics_pointer) { /// Standard constructor Geant4PhysicsListActionSequence::Geant4PhysicsListActionSequence(Geant4Context* ctxt, const string& nam) -: Geant4Action(ctxt, nam), m_transportation(false), m_decays(false) { + : Geant4Action(ctxt, nam), m_transportation(false), m_decays(false) { declareProperty("transportation", m_transportation); declareProperty("extends", m_extends); declareProperty("decays", m_decays); diff --git a/DDG4/src/Geant4Plugins.cpp b/DDG4/src/Geant4Plugins.cpp index 891621a4819a353463271ba0c0d7e45af856e771..0f505f4f76db702f897391211b783132c8a109c5 100644 --- a/DDG4/src/Geant4Plugins.cpp +++ b/DDG4/src/Geant4Plugins.cpp @@ -1,11 +1,18 @@ -// $Id: Readout.cpp 590 2013-06-03 17:02:43Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Plugins.inl" #include "DDG4/Factories.h" #include "DDG4/Geant4SensDetAction.h" @@ -13,6 +20,7 @@ #include "DDG4/Geant4InputAction.h" #include "DDG4/Geant4Converter.h" +// Geant4 include files #include "G4VSensitiveDetector.hh" #include "G4MagIntegratorStepper.hh" #include "G4EquationOfMotion.hh" @@ -24,7 +32,9 @@ #include "G4VUserPhysicsList.hh" DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4VSensitiveDetector*, (std::string,DD4hep::Geometry::LCDD*)) -DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::Simulation::Geant4Sensitive*, (DD4hep::Simulation::Geant4Context*,std::string,DD4hep::Geometry::DetElement*,DD4hep::Geometry::LCDD*)) +DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::Simulation::Geant4Sensitive*, (DD4hep::Simulation::Geant4Context*, + std::string,DD4hep::Geometry::DetElement*, + DD4hep::Geometry::LCDD*)) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(DD4hep::Simulation::Geant4Action*, (DD4hep::Simulation::Geant4Context*,std::string)) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4MagIntegratorStepper*, (G4EquationOfMotion*)) DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(G4MagIntegratorStepper*, (G4Mag_EqRhs*)) diff --git a/DDG4/src/Geant4Primary.cpp b/DDG4/src/Geant4Primary.cpp index 1924f9bed262bc72a166870d25655ddd5d54eddb..80a8ac633487bcaa07af22a0b19ee5e4e2b03093 100644 --- a/DDG4/src/Geant4Primary.cpp +++ b/DDG4/src/Geant4Primary.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Primitives.h" @@ -30,13 +35,13 @@ Geant4PrimaryMap::~Geant4PrimaryMap() { /// Default constructor Geant4PrimaryInteraction::Geant4PrimaryInteraction() -: mask(0), next_particle_identifier(-1) + : mask(0), next_particle_identifier(-1) { } /// Copy constructor Geant4PrimaryInteraction::Geant4PrimaryInteraction(const Geant4PrimaryInteraction&) -: mask(0), next_particle_identifier(-1) + : mask(0), next_particle_identifier(-1) { } diff --git a/DDG4/src/Geant4PrimaryHandler.cpp b/DDG4/src/Geant4PrimaryHandler.cpp index 978ac9028bc3f5097d5f9efa124fd59f9cbc5b8f..bf22db1ccca8976fdf3732489826bab32ba67cd1 100644 --- a/DDG4/src/Geant4PrimaryHandler.cpp +++ b/DDG4/src/Geant4PrimaryHandler.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" @@ -16,7 +22,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4PrimaryHandler::Geant4PrimaryHandler(Geant4Context* ctxt, const std::string& nam) -: Geant4GeneratorAction(ctxt,nam) + : Geant4GeneratorAction(ctxt,nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4ROOTDump.cpp b/DDG4/src/Geant4ROOTDump.cpp index 4f9cf0ed733fd18aafb5bdc2457a33624c21776a..ba857780cd0fd2a8970e79aea9330eec342133fa 100644 --- a/DDG4/src/Geant4ROOTDump.cpp +++ b/DDG4/src/Geant4ROOTDump.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" @@ -14,6 +19,7 @@ #include "DDG4/Geant4DataDump.h" #include "DDG4/Geant4Particle.h" +// ROOT include files #include "TInterpreter.h" #include "TSystem.h" #include "TFile.h" diff --git a/DDG4/src/Geant4Random.cpp b/DDG4/src/Geant4Random.cpp index 2e729ff7ca00379818c16c73b28a6b489af8610b..aa587edf69ece7984d98b8443ad8db7da2336331 100644 --- a/DDG4/src/Geant4Random.cpp +++ b/DDG4/src/Geant4Random.cpp @@ -1,17 +1,23 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4Random.h" +// ROOT include files #include "TRandom1.h" // C/C++ include files diff --git a/DDG4/src/Geant4RunAction.cpp b/DDG4/src/Geant4RunAction.cpp index b915ffe1066bf0a4a326c52a5b4cde18bbfa600b..b8e221bca2580188dd8e7956288ecefbe63ebabb 100644 --- a/DDG4/src/Geant4RunAction.cpp +++ b/DDG4/src/Geant4RunAction.cpp @@ -1,15 +1,21 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4RunAction.h" + // C/C++ include files #include <stdexcept> @@ -17,7 +23,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4RunAction::Geant4RunAction(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -36,7 +42,7 @@ void Geant4RunAction::end(const G4Run*) { /// Standard constructor Geant4RunActionSequence::Geant4RunActionSequence(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4SensDetAction.cpp b/DDG4/src/Geant4SensDetAction.cpp index 46cf42d3f92226ce6d474313a5ad4b04fb2f7ff7..32aa63a9cb3e7e6d274c68d9f428f58d38deb184 100644 --- a/DDG4/src/Geant4SensDetAction.cpp +++ b/DDG4/src/Geant4SensDetAction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -18,6 +23,7 @@ #include "DDG4/Geant4VolumeManager.h" #include "DDG4/Geant4MonteCarloTruth.h" +// Geant4 include files #include <G4Step.hh> #include <G4SDManager.hh> #include <G4VSensitiveDetector.hh> @@ -52,7 +58,7 @@ namespace { /// Standard action constructor Geant4ActionSD::Geant4ActionSD(const std::string& nam) -: Geant4Action(0, nam) { + : Geant4Action(0, nam) { InstanceCount::increment(this); } @@ -63,7 +69,7 @@ Geant4ActionSD::~Geant4ActionSD() { /// Standard constructor Geant4Filter::Geant4Filter(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -79,8 +85,8 @@ bool Geant4Filter::operator()(const G4Step*) const { /// Constructor. The detector element is identified by the name Geant4Sensitive::Geant4Sensitive(Geant4Context* ctxt, const string& nam, DetElement det, LCDD& lcdd_ref) -: Geant4Action(ctxt, nam), m_sensitiveDetector(0), m_sequence(0), - m_lcdd(lcdd_ref), m_detector(det), m_sensitive(), m_readout(), m_segmentation() + : Geant4Action(ctxt, nam), m_sensitiveDetector(0), m_sequence(0), + m_lcdd(lcdd_ref), m_detector(det), m_sensitive(), m_readout(), m_segmentation() { InstanceCount::increment(this); if (!det.isValid()) { @@ -212,7 +218,7 @@ long long int Geant4Sensitive::cellID(G4Step* s) { /// Standard constructor Geant4SensDetActionSequence::Geant4SensDetActionSequence(Geant4Context* ctxt, const string& nam) -: Geant4Action(ctxt, nam), m_hce(0) + : Geant4Action(ctxt, nam), m_hce(0) { m_needsControl = true; context()->sensitiveActions().insert(name(), this); diff --git a/DDG4/src/Geant4SensitiveDetector.cpp b/DDG4/src/Geant4SensitiveDetector.cpp index 3fd235f5501b8ff00229c3e3579cc765dda1ef1a..e06536f9c898375567df0e891d6f1b4fa4da4b65 100644 --- a/DDG4/src/Geant4SensitiveDetector.cpp +++ b/DDG4/src/Geant4SensitiveDetector.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4SensitiveDetector.h" @@ -14,9 +19,11 @@ #include "DD4hep/Printout.h" #include "DD4hep/LCDD.h" +// Geant4 include files #include "G4Step.hh" #include "G4PVPlacement.hh" +// ROOT include files #include "TGeoNode.h" #define DEBUG 0 @@ -31,7 +38,7 @@ using namespace DD4hep::Simulation; /// Constructor. The detector element is identified by the name Geant4SensitiveDetector::Geant4SensitiveDetector(const string& nam, LCDD& lcdd) -: G4VSensitiveDetector(nam), m_lcdd(lcdd), m_detector(), m_sensitive(), m_readout(), m_hce(0) { + : G4VSensitiveDetector(nam), m_lcdd(lcdd), m_detector(), m_sensitive(), m_readout(), m_hce(0) { m_sensitive = lcdd.sensitiveDetector(nam); m_detector = lcdd.detector(nam); m_readout = m_sensitive.readout(); @@ -44,8 +51,7 @@ Geant4SensitiveDetector::~Geant4SensitiveDetector() { /// Initialize the sensitive detector for the usage of a single hit collection bool Geant4SensitiveDetector::defineCollection(const string& coll_name) { if (coll_name.empty()) { - throw runtime_error( - "Geant4SensitiveDetector: No collection defined for " + name() + " of type " + string(m_sensitive.type())); + throw runtime_error("Geant4SensitiveDetector: No collection defined for "+name()+" of type "+string(m_sensitive.type())); } collectionName.insert(coll_name); return true; @@ -111,7 +117,8 @@ G4bool Geant4SensitiveDetector::process(G4Step* step, G4TouchableHistory* hist) } } #if DEBUG - std::cout << " *** too small energy deposit : " << step->GetTotalEnergyDeposit() << " < " << ene_cut << " at " << step->GetPreStepPoint()->GetPosition() << std::endl; + std::cout << " *** too small energy deposit : " << step->GetTotalEnergyDeposit() + << " < " << ene_cut << " at " << step->GetPreStepPoint()->GetPosition() << std::endl; #endif return false; } @@ -150,10 +157,13 @@ void Geant4SensitiveDetector::dumpStep(G4Step* st, G4TouchableHistory* /* histor Position pos2 = step.postPos(); Momentum mom = step.postMom(); - printout(INFO, "G4Step", " Track:%08ld Pos:(%8f %8f %8f) -> (%f %f %f) Mom:%7.0f %7.0f %7.0f", long(step.track), pos1.X(), + printout(INFO, "G4Step", " Track:%08ld Pos:(%8f %8f %8f) -> (%f %f %f) Mom:%7.0f %7.0f %7.0f", + long(step.track), pos1.X(), pos1.Y(), pos1.Z(), pos2.X(), pos2.Y(), pos2.Z(), mom.X(), mom.Y(), mom.Z()); - printout(INFO, "G4Step", " pre-Vol: %s Status:%s", step.preVolume()->GetName().c_str(), step.preStepStatus()); - printout(INFO, "G4Step", " post-Vol:%s Status:%s", step.postVolume()->GetName().c_str(), + printout(INFO, "G4Step", " pre-Vol: %s Status:%s", + step.preVolume()->GetName().c_str(), step.preStepStatus()); + printout(INFO, "G4Step", " post-Vol:%s Status:%s", + step.postVolume()->GetName().c_str(), step.postStepStatus()); const G4VPhysicalVolume* pv = step.volume(step.post); @@ -205,56 +215,8 @@ long long Geant4SensitiveDetector::getVolumeID(G4Step* aStep) { str << (*i).first->name() << "=" << (*i).second << " "; } ::printf(" --> CellID: %X [%X] -> %s\n",id,dsc.first,str.str().c_str()); - } - #endif - return id; - - // // old way of lookup ----------- does not work for assemblies .... - - // //------------ get the cellID description string ----------------------------------- - - // Geometry::PlacedVolume place = mapping.placement( g4v ) ; - - // if( ! place.isValid() || ! place.volume().isSensitive() ) { - // G4cout << " **** Error in Geant4SensitiveDetector::getVolumeID: invalid first sensitive volume in buildHits is not sensitive !!! " << std::endl ; - // } - // Geometry::Volume vol = place.volume(); - // Geometry::SensitiveDetector sd = vol.sensitiveDetector(); - // Geometry::Readout ro = sd.readout(); - - // std::string idDescStr = ro.idSpec().fieldDescription() ; - // BitField64 bf( idDescStr ) ; - - // //------------ now fill the cellID from the volIDs of the complete path ----------------------------------- - - // const G4NavigationHistory* hist = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory() ; - // int depth = hist->GetDepth() ; - // //const G4VPhysicalVolume* g4v = hist->GetVolume( depth ) ; - - // for(int i=depth ; i>0 ; --i ) { - - // g4v = hist->GetVolume(i) ; - // Geometry::PlacedVolume place = mapping.placement( g4v ) ; - - // if( ! place.isValid() ) { - // G4cout << " **** WARNING in Geant4SensitiveDetector::getVolumeID: ingnoring invalid PlacedVolume for : " << g4v->GetName() << std::endl ; - // continue ; - // } - - // // G4cout << "--- VolIDs : " << std::endl ; - // Geometry::PlacedVolume::VolIDs ids = place.volIDs() ; - - // for( Geometry::PlacedVolume::VolIDs::const_iterator it = ids.begin() ; it != ids.end() ; ++it ){ - - // // G4cout << "--- " << it->first << " -- " << it->second << std:: - // bf[ it->first ] = it->second ; - // } - // } - - // return bf.getValue() ; - } diff --git a/DDG4/src/Geant4StackingAction.cpp b/DDG4/src/Geant4StackingAction.cpp index 9a929657e99232def2f223f7e96020c689044082..3f9211ed0b585f689537ea609d2f12bbbe5e8e70 100644 --- a/DDG4/src/Geant4StackingAction.cpp +++ b/DDG4/src/Geant4StackingAction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" @@ -18,7 +23,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4StackingAction::Geant4StackingAction(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -29,7 +34,7 @@ Geant4StackingAction::~Geant4StackingAction() { /// Standard constructor Geant4StackingActionSequence::Geant4StackingActionSequence(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4StepHandler.cpp b/DDG4/src/Geant4StepHandler.cpp index 21275671164098c2540deb6ef78678103582ec05..6567894f88041daff3f7f2efe1e1b31f6321ad96 100644 --- a/DDG4/src/Geant4StepHandler.cpp +++ b/DDG4/src/Geant4StepHandler.cpp @@ -1,11 +1,16 @@ // $Id$ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4StepHandler.h" diff --git a/DDG4/src/Geant4SteppingAction.cpp b/DDG4/src/Geant4SteppingAction.cpp index 87794828b2b2ab44621179c7c83eca4b9e04edc3..574db51d2e97549b549b7aa7d0bf6e00d8d77b4e 100644 --- a/DDG4/src/Geant4SteppingAction.cpp +++ b/DDG4/src/Geant4SteppingAction.cpp @@ -1,15 +1,21 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4SteppingAction.h" + using namespace DD4hep::Simulation; /// Standard constructor diff --git a/DDG4/src/Geant4TestActions.cpp b/DDG4/src/Geant4TestActions.cpp index 6cb4051b4f7bc2a69afe85da7a58d9b08bc94a7a..6a1720d2ab4ba95e8607d36bea1167ecc027afda 100644 --- a/DDG4/src/Geant4TestActions.cpp +++ b/DDG4/src/Geant4TestActions.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================= // Framework include files #include "DD4hep/Printout.h" @@ -37,7 +42,7 @@ namespace { /// Standard constructor Geant4TestBase::Geant4TestBase(Geant4Action* a, const std::string& typ) -: m_type(typ) { + : m_type(typ) { a->declareProperty("Property_int", m_value1 = 0); a->declareProperty("Property_double", m_value2 = 0e0); a->declareProperty("Property_string", m_value3); @@ -50,7 +55,7 @@ Geant4TestBase::~Geant4TestBase() { /// Standard constructor with initializing arguments Geant4TestGeneratorAction::Geant4TestGeneratorAction(Geant4Context* c, const std::string& n) -: Geant4GeneratorAction(c, n), Geant4TestBase(this, "Geant4TestGeneratorAction") { + : Geant4GeneratorAction(c, n), Geant4TestBase(this, "Geant4TestGeneratorAction") { InstanceCount::increment(this); } @@ -67,7 +72,7 @@ void Geant4TestGeneratorAction::operator()(G4Event* evt) { /// Standard constructor with initializing arguments Geant4TestRunAction::Geant4TestRunAction(Geant4Context* c, const std::string& n) -: Geant4RunAction(c, n), Geant4TestBase(this, "Geant4TestRunAction") { + : Geant4RunAction(c, n), Geant4TestBase(this, "Geant4TestRunAction") { InstanceCount::increment(this); } @@ -102,7 +107,7 @@ void Geant4TestRunAction::endEvent(const G4Event* evt) { /// Standard constructor with initializing arguments Geant4TestEventAction::Geant4TestEventAction(Geant4Context* c, const std::string& n) -: Geant4EventAction(c, n), Geant4TestBase(this, "Geant4TestEventAction") { + : Geant4EventAction(c, n), Geant4TestBase(this, "Geant4TestEventAction") { InstanceCount::increment(this); } @@ -142,7 +147,7 @@ void Geant4TestEventAction::endRun(const G4Run* run) { /// Standard constructor with initializing arguments Geant4TestTrackAction::Geant4TestTrackAction(Geant4Context* c, const std::string& n) -: Geant4TrackingAction(c, n), Geant4TestBase(this, "Geant4TestTrackAction") { + : Geant4TrackingAction(c, n), Geant4TestBase(this, "Geant4TestTrackAction") { InstanceCount::increment(this); } @@ -168,7 +173,7 @@ void Geant4TestTrackAction::end(const G4Track* trk) { /// Standard constructor with initializing arguments Geant4TestStepAction::Geant4TestStepAction(Geant4Context* c, const std::string& n) -: Geant4SteppingAction(c, n), Geant4TestBase(this, "Geant4TestStepAction") { + : Geant4SteppingAction(c, n), Geant4TestBase(this, "Geant4TestStepAction") { InstanceCount::increment(this); } @@ -183,7 +188,7 @@ void Geant4TestStepAction::operator()(const G4Step*, G4SteppingManager*) { /// Standard constructor with initializing arguments Geant4TestSensitive::Geant4TestSensitive(Geant4Context* c, const std::string& n, DetElement det, LCDD& lcdd) -: Geant4Sensitive(c, n, det, lcdd), Geant4TestBase(this, "Geant4TestSensitive") { + : Geant4Sensitive(c, n, det, lcdd), Geant4TestBase(this, "Geant4TestSensitive") { InstanceCount::increment(this); m_collectionID = defineCollection < TestHit > (n); PRINT("%s> Collection ID is %d", m_type.c_str(), int(m_collectionID)); diff --git a/DDG4/src/Geant4TouchableHandler.cpp b/DDG4/src/Geant4TouchableHandler.cpp index fc0dbe2b96716233d48ee6261211e1deb5c8f475..a1489e51d71fb70ae5871a6ef7f586894286dd49 100644 --- a/DDG4/src/Geant4TouchableHandler.cpp +++ b/DDG4/src/Geant4TouchableHandler.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4StepHandler.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DDG4/Geant4TouchableHandler.h" diff --git a/DDG4/src/Geant4TrackInformation.cpp b/DDG4/src/Geant4TrackInformation.cpp index 4c40ca6bba8d4367349ffcfe4ea165880cc4ebdd..525085b81dbd5c1adf3d09ee5656522a4254c69b 100644 --- a/DDG4/src/Geant4TrackInformation.cpp +++ b/DDG4/src/Geant4TrackInformation.cpp @@ -1,11 +1,18 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DDG4/Geant4TrackInformation.h" using namespace std; @@ -14,7 +21,7 @@ using namespace DD4hep::Simulation; /// Default constructor Geant4TrackInformation::Geant4TrackInformation() -: G4VUserTrackInformation(), m_flags(0) { + : G4VUserTrackInformation(), m_flags(0) { } /// Standard destructor diff --git a/DDG4/src/Geant4TrackingAction.cpp b/DDG4/src/Geant4TrackingAction.cpp index 8dd92f184ddfb04d8ac8ceefa26630a9930ac39e..b8958b7f2b6b00b5e9408429fc2071124d3bda06 100644 --- a/DDG4/src/Geant4TrackingAction.cpp +++ b/DDG4/src/Geant4TrackingAction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" @@ -29,7 +34,7 @@ class G4TouchableHistory; /// Standard constructor Geant4TrackingActionSequence::Geant4TrackingActionSequence(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } @@ -73,7 +78,7 @@ void Geant4TrackingActionSequence::end(const G4Track* track) { /// Standard constructor Geant4TrackingAction::Geant4TrackingAction(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt, nam) { + : Geant4Action(ctxt, nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4TrackingPostAction.cpp b/DDG4/src/Geant4TrackingPostAction.cpp index 98804abca28e2176be15b1c09bcb027f00816aec..cba85e9649f62cd1a6f372e9d8a0d851091cc223 100644 --- a/DDG4/src/Geant4TrackingPostAction.cpp +++ b/DDG4/src/Geant4TrackingPostAction.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" @@ -15,6 +20,7 @@ // Geant4 include files #include "G4TrackingManager.hh" +// C/C++ include files #include <algorithm> using namespace std; diff --git a/DDG4/src/Geant4TrackingPreAction.cpp b/DDG4/src/Geant4TrackingPreAction.cpp index 6719976fe3a1d31665b1c000c1472fa187b99c1e..f676f94581ae7847571682018feab3af23e21d2e 100644 --- a/DDG4/src/Geant4TrackingPreAction.cpp +++ b/DDG4/src/Geant4TrackingPreAction.cpp @@ -1,15 +1,21 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/InstanceCount.h" #include "DDG4/Geant4TrackingPreAction.h" + // Geant4 include files #include "G4TrackingManager.hh" @@ -17,7 +23,7 @@ using namespace DD4hep::Simulation; /// Standard constructor Geant4TrackingPreAction::Geant4TrackingPreAction(Geant4Context* ctxt, const std::string& nam) -: Geant4TrackingAction(ctxt, nam) { + : Geant4TrackingAction(ctxt, nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4UIManager.cpp b/DDG4/src/Geant4UIManager.cpp index e2e3e24f02243edaa44a584d290f95ddcb4b3457..716db5c7f2907063b088251b66d723be40935d64 100644 --- a/DDG4/src/Geant4UIManager.cpp +++ b/DDG4/src/Geant4UIManager.cpp @@ -1,16 +1,24 @@ -// $Id: Geant4Field.cpp 875 2013-11-04 16:15:14Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== +// Framework include files #include "DDG4/Geant4UIManager.h" #include "DDG4/Geant4Kernel.h" #include "DD4hep/Primitives.h" #include "DD4hep/Printout.h" + +// Geant4 include files #include "G4VisExecutive.hh" #include "G4UImanager.hh" #include "G4UIsession.hh" @@ -29,7 +37,7 @@ namespace { /// Initializing constructor Geant4UIManager::Geant4UIManager(Geant4Context* ctxt, const std::string& nam) -: Geant4Action(ctxt,nam), m_vis(0), m_ui(0) + : Geant4Action(ctxt,nam), m_vis(0), m_ui(0) { declareProperty("SetupUI", m_uiSetup=""); declareProperty("SetupVIS", m_visSetup=""); diff --git a/DDG4/src/Geant4UIMessenger.cpp b/DDG4/src/Geant4UIMessenger.cpp index d59ce794e2781e983453467f2344f76a48d5fa0d..ee5366f593a41b3065e65a263f4ca6e14c271a33 100644 --- a/DDG4/src/Geant4UIMessenger.cpp +++ b/DDG4/src/Geant4UIMessenger.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Converter.cpp 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -42,7 +47,7 @@ namespace { } Geant4UIMessenger::Geant4UIMessenger(const string& name, const string& path) -: G4UImessenger(), m_directory(0), m_properties(0), m_name(name), m_path(path) { + : G4UImessenger(), m_directory(0), m_properties(0), m_name(name), m_path(path) { m_directory = new G4UIdirectory(path.c_str()); printout(INFO, "Geant4UIMessenger", "+++ %s> Install Geant4 control directory:%s", name.c_str(), path.c_str()); m_directory->SetGuidance(("Control hierarchy for Geant4 action:" + name).c_str()); @@ -89,26 +94,26 @@ void Geant4UIMessenger::SetNewValue(G4UIcommand *c, G4String v) { const string& n = (*i).second; try { if (!v.empty()) { - Property& p = (*m_properties)[n]; - p.str(v); - printout(INFO, "Geant4UIMessenger", - "+++ %s> Setting property value %s = %s native:%s.", - m_name.c_str(), n.c_str(), v.c_str(), p.str().c_str()); + Property& p = (*m_properties)[n]; + p.str(v); + printout(INFO, "Geant4UIMessenger", + "+++ %s> Setting property value %s = %s native:%s.", + m_name.c_str(), n.c_str(), v.c_str(), p.str().c_str()); } else { - string value = (*m_properties)[n].str(); - printout(INFO, "Geant4UIMessenger", "+++ %s> Unchanged property value %s = %s.", - m_name.c_str(), n.c_str(), value.c_str()); + string value = (*m_properties)[n].str(); + printout(INFO, "Geant4UIMessenger", "+++ %s> Unchanged property value %s = %s.", + m_name.c_str(), n.c_str(), value.c_str()); } } catch(const exception& e) { printout(INFO, "Geant4UIMessenger", "+++ %s> Exception: Failed to change property %s = '%s'.", - m_name.c_str(), n.c_str(), v.c_str()); + m_name.c_str(), n.c_str(), v.c_str()); printout(INFO, "Geant4UIMessenger", "+++ %s> Exception: %s", m_name.c_str(), e.what()); } catch(...) { printout(INFO, "Geant4UIMessenger", "+++ %s> UNKNOWN Exception: Failed to change property %s = '%s'.", - m_name.c_str(), n.c_str(), v.c_str()); + m_name.c_str(), n.c_str(), v.c_str()); } return; } @@ -116,16 +121,16 @@ void Geant4UIMessenger::SetNewValue(G4UIcommand *c, G4String v) { Actions::iterator j = m_actionCmd.find(c); if (j != m_actionCmd.end()) { try { - (*j).second.execute(0); + (*j).second.execute(0); } catch(const exception& e) { - printout(INFO, "Geant4UIMessenger", "+++ %s> Exception: Failed to exec action '%s' [%s].", - m_name.c_str(), c->GetCommandName().c_str(), c->GetCommandPath().c_str()); - printout(INFO, "Geant4UIMessenger", "+++ %s> Exception: %s",e.what()); + printout(INFO, "Geant4UIMessenger", "+++ %s> Exception: Failed to exec action '%s' [%s].", + m_name.c_str(), c->GetCommandName().c_str(), c->GetCommandPath().c_str()); + printout(INFO, "Geant4UIMessenger", "+++ %s> Exception: %s",e.what()); } catch(...) { - printout(INFO, "Geant4UIMessenger", "+++ %s> UNKNOWN Exception: Failed to exec action '%s' [%s].", - m_name.c_str(), c->GetCommandName().c_str(), c->GetCommandPath().c_str()); + printout(INFO, "Geant4UIMessenger", "+++ %s> UNKNOWN Exception: Failed to exec action '%s' [%s].", + m_name.c_str(), c->GetCommandName().c_str(), c->GetCommandPath().c_str()); } return; } diff --git a/DDG4/src/Geant4UserParticleHandler.cpp b/DDG4/src/Geant4UserParticleHandler.cpp index 9ffb7a51b2f9f6148848e615858d9c1815d87651..2d25d06095aa8884e1a521d2682c1cd34b0b0505 100644 --- a/DDG4/src/Geant4UserParticleHandler.cpp +++ b/DDG4/src/Geant4UserParticleHandler.cpp @@ -1,11 +1,17 @@ -// $Id: Geant4Field.cpp 888 2013-11-14 15:54:56Z markus.frank@cern.ch $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + // Framework include files #include "DD4hep/Printout.h" #include "DD4hep/InstanceCount.h" diff --git a/DDG4/src/Geant4Vertex.cpp b/DDG4/src/Geant4Vertex.cpp index e5c1ae725ca57fbfe3af1b2f3ec0adf5709da27f..f0ab89425d0c59c34dc369090244bc09949816eb 100644 --- a/DDG4/src/Geant4Vertex.cpp +++ b/DDG4/src/Geant4Vertex.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4Hits.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -21,14 +26,14 @@ VertexExtension::~VertexExtension() { /// Copy constructor Geant4Vertex::Geant4Vertex(const Geant4Vertex& c) -: ref(1), mask(c.mask), x(c.x), y(c.y), z(c.z), time(c.time), out(c.out), in(c.in) + : ref(1), mask(c.mask), x(c.x), y(c.y), z(c.z), time(c.time), out(c.out), in(c.in) { InstanceCount::increment(this); } /// Default constructor Geant4Vertex::Geant4Vertex() -: ref(1), mask(0), x(0), y(0), z(0), time(0) + : ref(1), mask(0), x(0), y(0), z(0), time(0) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp index 979922213dd8f2012e27fec2e9c45bf71b6c7527..6a8dfc1afd7ae90048da4cba31cae05f64a598fb 100644 --- a/DDG4/src/Geant4VolumeManager.cpp +++ b/DDG4/src/Geant4VolumeManager.cpp @@ -1,11 +1,16 @@ -// $Id: Geant4VolumeManager.cpp 513 2013-04-05 14:31:53Z gaede $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/Printout.h" @@ -184,7 +189,7 @@ namespace { /// Initializing constructor. The tree will automatically be built if possible Geant4VolumeManager::Geant4VolumeManager(LCDD& lcdd, Geant4GeometryInfo* info) -: Base(info), m_isValid(false) { + : Base(info), m_isValid(false) { if (info && info->valid && info->g4Paths.empty()) { Populator p(lcdd, *info); p.populate(lcdd.world()); diff --git a/DDG4/src/IoStreams.cpp b/DDG4/src/IoStreams.cpp index 614a81be256eead2a7f76761298c051d46ea38ab..f4bd2fc5b84005153ca531ac54d6b9eee43e3798 100644 --- a/DDG4/src/IoStreams.cpp +++ b/DDG4/src/IoStreams.cpp @@ -1,19 +1,27 @@ -// $Id: Primitives.h 603 2013-06-13 21:15:14Z markus.frank $ -//==================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------- +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework includes #include "DDG4/IoStreams.h" +// C/C++ include files #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <cstdio> + +// ROOT include files #include "TFile.h" using namespace DD4hep; diff --git a/GaudiPluginService/CMakeLists.txt b/GaudiPluginService/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7746f74511b43844f25bc624fa55728e818b57d --- /dev/null +++ b/GaudiPluginService/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) + +project(DDPluginManager) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +add_library(DDPluginManager SHARED src/PluginService.cpp src/capi_pluginservice.cpp) +target_link_libraries(DDPluginManager ${CMAKE_DL_LIBS}) +SET_TARGET_PROPERTIES(DDPluginManager PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) + +if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) + SET ( DDPluginManager_LIBRARIES DDPluginManager PARENT_SCOPE ) + SET ( DDPluginManager_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE ) +endif() + +add_executable(listcomponents src/listcomponents.cpp src/PluginService.cpp) +target_link_libraries(listcomponents ${CMAKE_DL_LIBS}) + +#--- install target------------------------------------- +install(DIRECTORY Gaudi + DESTINATION include + PATTERN ".svn" EXCLUDE ) + +install(TARGETS listcomponents DDPluginManager + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib ) diff --git a/GaudiPluginService/Gaudi/Details/PluginServiceDetails.h b/GaudiPluginService/Gaudi/Details/PluginServiceDetails.h new file mode 100644 index 0000000000000000000000000000000000000000..f4f031832e6a563d9227963111b105538fd2bc93 --- /dev/null +++ b/GaudiPluginService/Gaudi/Details/PluginServiceDetails.h @@ -0,0 +1,259 @@ +#ifndef _GAUDI_PLUGIN_SERVICE_DETAILS_H_ +#define _GAUDI_PLUGIN_SERVICE_DETAILS_H_ +/*****************************************************************************\ +* (c) Copyright 2013 CERN * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +/// @author Marco Clemencic <marco.clemencic@cern.ch> + +#include <string> +#include <sstream> +#include <map> +#include <set> +#include <typeinfo> +#include <utility> + +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +#include <mutex> +#endif + +#if __GNUC__ >= 4 +# define GAUDIPS_HASCLASSVISIBILITY +#endif + +#if defined(GAUDIPS_HASCLASSVISIBILITY) +# define GAUDIPS_IMPORT __attribute__((visibility("default"))) +# define GAUDIPS_EXPORT __attribute__((visibility("default"))) +# define GAUDIPS_LOCAL __attribute__((visibility("hidden"))) +#else +# define GAUDIPS_IMPORT +# define GAUDIPS_EXPORT +# define GAUDIPS_LOCAL +#endif + +#ifdef GaudiPluginService_EXPORTS +#define GAUDIPS_API GAUDIPS_EXPORT +#else +#define GAUDIPS_API GAUDIPS_IMPORT +#endif + +namespace Gaudi { namespace PluginService { + + namespace Details { + /// Class providing default factory functions. + /// + /// The template argument T is the class to be created, while the methods + /// template argument S is the specific factory signature. + template <class T> + class Factory { + public: +#if !defined(__REFLEX__) || defined(ATLAS) + template <typename S, typename... Args> + static typename S::ReturnType create(Args&&... args) { + return new T(std::forward<Args>(args)...); + } +#endif + }; + + /// Function used to load a specific factory function. + /// @return the pointer to the factory function. + GAUDIPS_API + void* getCreator(const std::string& id, const std::string& type); + + /// Convoluted implementation of getCreator with an embedded + /// reinterpret_cast, used to avoid the warning + /// <pre> + /// warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object + /// </pre> + /// It is an ugly trick but works.<br/> + /// See: + /// <ul> + /// <li>http://www.trilithium.com/johan/2004/12/problem-with-dlsym/</li> + /// <li>http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#573</li> + /// <li>http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195</li> + /// </ul> + template <typename F> + inline F getCreator(const std::string& id) { + union { void* src; F dst; } p2p; + p2p.src = getCreator(id, typeid(F).name()); + return p2p.dst; + } + + /// Return a canonical name for type_info object (implementation borrowed + /// from GaudiKernel/System). + GAUDIPS_API + std::string demangle(const std::type_info& id); + + /// Return a canonical name for the template argument. + template <typename T> + inline std::string demangle() { return demangle(typeid(T)); } + + /// In-memory database of the loaded factories. + class GAUDIPS_API Registry { + public: + typedef std::string KeyType; + + /// Type used for the properties implementation. + typedef std::map<KeyType, std::string> Properties; + + struct FactoryInfo { + FactoryInfo(const std::string& lib, void* p=0, + const std::string& t="", + const std::string& rt="", + const std::string& cn="", + const Properties& props=Properties()): + library(lib), ptr(p), type(t), rtype(rt), className(cn), properties(props) {} + + std::string library; + void* ptr; + std::string type; + std::string rtype; + std::string className; + Properties properties; + + FactoryInfo& addProperty(const KeyType& k, const std::string& v) { + properties[k] = v; + return *this; + } + }; + + /// Type used for the database implementation. + typedef std::map<KeyType, FactoryInfo> FactoryMap; + + /// Retrieve the singleton instance of Registry. + static Registry& instance(); + + /// Add a factory to the database. + template <typename F, typename T, typename I> + inline FactoryInfo& add(const I& id, typename F::FuncType ptr){ + union { typename F::FuncType src; void* dst; } p2p; + p2p.src = ptr; + std::ostringstream o; o << id; + return add(o.str(), p2p.dst, + typeid(typename F::FuncType).name(), + typeid(typename F::ReturnType).name(), + demangle<T>()); + } + + /// Retrieve the factory for the given id. + void* get(const std::string& id, const std::string& type) const; + + /// Retrieve the FactoryInfo object for an id. + const FactoryInfo& getInfo(const std::string& id) const; + + /// Add a property to an already existing FactoryInfo object (via its id.) + Registry& + addProperty(const std::string& id, + const std::string& k, + const std::string& v); + + /// Return a list of all the known and loaded factories + std::set<KeyType> loadedFactories() const; + + /// Return the known factories (loading the list if not yet done). + inline const FactoryMap& factories() const { + if (!m_initialized) const_cast<Registry*>(this)->initialize(); + return m_factories; + } + + private: + /// Private constructor for the singleton pattern. + /// At construction time, the internal database of known factories is + /// filled with the name of the libraries containing them, using the + /// ".components" files in the LD_LIBRARY_PATH. + Registry(); + + /// Private copy constructor for the singleton pattern. + Registry(const Registry&): m_initialized(false) {} + + /// Add a factory to the database. + FactoryInfo& + add(const std::string& id, void *factory, + const std::string& type, const std::string& rtype, + const std::string& className, + const Properties& props = Properties()); + + /// Return the known factories (loading the list if not yet done). + inline FactoryMap& factories() { + if (!m_initialized) initialize(); + return m_factories; + } + + /// Initialize the registry loading the list of factories from the + /// .component files in the library search path. + void initialize(); + + /// Flag recording if the registry has been initialized or not. + bool m_initialized; + + /// Internal storage for factories. + FactoryMap m_factories; + +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L + /// Mutex used to control concurrent access to the internal data. + mutable std::recursive_mutex m_mutex; +#endif + }; + + /// Simple logging class, just to provide a default implementation. + class GAUDIPS_API Logger { + public: + enum Level { Debug=0, Info=1, Warning=2, Error=3 }; + Logger(Level level = Warning): m_level(level) {} + virtual ~Logger() {} + inline Level level() const { return m_level; } + inline void setLevel(Level level) { m_level = level; } + inline void info(const std::string& msg) { report(Info, msg); } + inline void debug(const std::string& msg) { report(Debug, msg); } + inline void warning(const std::string& msg) { report(Warning, msg); } + inline void error(const std::string& msg) { report(Error, msg); } + private: + virtual void report(Level lvl, const std::string& msg); + Level m_level; + }; + + /// Return the current logger instance. + GAUDIPS_API Logger& logger(); + /// Set the logger instance to use. + /// It must be a new instance and the ownership is passed to the function. + GAUDIPS_API void setLogger(Logger* logger); + } + + /// Backward compatibility with Reflex. + GAUDIPS_API void SetDebug(int debugLevel); + /// Backward compatibility with Reflex. + GAUDIPS_API int Debug(); + +}} + +#define _INTERNAL_FACTORY_REGISTER_CNAME(name, serial) \ + _register_ ## _ ## serial + +#define _INTERNAL_DECLARE_FACTORY_WITH_CREATOR(type, typecreator, \ + id, factory, serial) \ + namespace { \ + class _INTERNAL_FACTORY_REGISTER_CNAME(type, serial) { \ + public: \ + typedef factory s_t; \ + typedef typecreator f_t; \ + static s_t::FuncType creator() { return &f_t::create<s_t>; } \ + _INTERNAL_FACTORY_REGISTER_CNAME(type, serial) () { \ + using ::Gaudi::PluginService::Details::Registry; \ + Registry::instance().add<s_t, type>(id, creator()); \ + } \ + } _INTERNAL_FACTORY_REGISTER_CNAME(s_ ## type, serial); \ + } + +#define _INTERNAL_DECLARE_FACTORY(type, id, factory, serial) \ + _INTERNAL_DECLARE_FACTORY_WITH_CREATOR(type, \ + ::Gaudi::PluginService::Details::Factory<type>, \ + id, factory, serial) + +#endif //_GAUDI_PLUGIN_SERVICE_DETAILS_H_ diff --git a/GaudiPluginService/Gaudi/PluginService.h b/GaudiPluginService/Gaudi/PluginService.h new file mode 100644 index 0000000000000000000000000000000000000000..4b3ab6a72d5cbd5d222f5b8c91c32acdcce35fa5 --- /dev/null +++ b/GaudiPluginService/Gaudi/PluginService.h @@ -0,0 +1,75 @@ +#ifndef _GAUDI_PLUGIN_SERVICE_H_ +#define _GAUDI_PLUGIN_SERVICE_H_ +/*****************************************************************************\ +* (c) Copyright 2013 CERN * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +/// @author Marco Clemencic <marco.clemencic@cern.ch> +/// @see @ref GaudiPluginService-readme + +#include <string> +#include <typeinfo> +#include <utility> +#include <Gaudi/Details/PluginServiceDetails.h> + +#define DECLARE_FACTORY_WITH_ID(type, id, factory) \ + _INTERNAL_DECLARE_FACTORY(type, id, factory, __LINE__) + +#define DECLARE_FACTORY(type, factory) \ + DECLARE_FACTORY_WITH_ID(type, \ + ::Gaudi::PluginService::Details::demangle<type>(), factory) + +#define DECLARE_FACTORY_WITH_CREATOR_AND_ID(type, typecreator, id, factory) \ + _INTERNAL_DECLARE_FACTORY_WITH_CREATOR(type, typecreator, id, factory, __LINE__) + +#define DECLARE_FACTORY_WITH_CREATOR(type, typecreator, factory) \ + DECLARE_FACTORY_WITH_CREATOR_AND_ID(type, typecreator, \ + ::Gaudi::PluginService::Details::demangle<type>(), factory) + +#define DECLARE_COMPONENT(type) \ + DECLARE_FACTORY(type, type::Factory) + +#define DECLARE_COMPONENT_WITH_ID(type, id) \ + DECLARE_FACTORY_WITH_ID(type, id, type::Factory) + +namespace Gaudi { namespace PluginService { + +#if !defined(__REFLEX__) || defined(ATLAS) + /// Class wrapping the signature for a factory with any number of arguments. + template <typename R, typename... Args> + class Factory { + public: + typedef R ReturnType; + typedef R (*FuncType)(Args&&...); + + static ReturnType create(const std::string& id, Args... args) { + const FuncType c = Details::getCreator<FuncType>(id); + return c ? (*c)(std::forward<Args>(args)...) : 0; + } + + template <typename T> + static ReturnType create(const T& id, Args... args) { + std::ostringstream o; o << id; + return create(o.str(), std::forward<Args>(args)...); + } + }; +#endif + + class GAUDIPS_EXPORT Exception: public std::exception { + public: + Exception(const std::string& msg); + virtual ~Exception() throw(); + virtual const char* what() const throw(); + private: + std::string m_msg; + }; +}} + +#endif //_GAUDI_PLUGIN_SERVICE_H_ diff --git a/GaudiPluginService/LICENCE b/GaudiPluginService/LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..94a9ed024d3859793618152ea559a168bbcbb5e2 --- /dev/null +++ b/GaudiPluginService/LICENCE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/GaudiPluginService/cmt/fragments/listcomponents b/GaudiPluginService/cmt/fragments/listcomponents new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/GaudiPluginService/cmt/fragments/listcomponents_header b/GaudiPluginService/cmt/fragments/listcomponents_header new file mode 100644 index 0000000000000000000000000000000000000000..b2930c073f6d134caee2067d284f3feef2eca501 --- /dev/null +++ b/GaudiPluginService/cmt/fragments/listcomponents_header @@ -0,0 +1,22 @@ +## +componentslistfile = ${LIBNAME}.components +COMPONENTSLIST_DIR = ../$(tag) +fulllibname = lib${LIBNAME}.$(shlibsuffix) + +${CONSTITUENT} :: ${COMPONENTSLIST_DIR}/$(componentslistfile) + @: + +${COMPONENTSLIST_DIR}/$(componentslistfile) :: $(bin)$(fulllibname) + @echo 'Generating componentslist file for $(fulllibname)' + cd ../$(tag);$(listcomponents_cmd) --output ${COMPONENTSLIST_DIR}/$(componentslistfile) $(fulllibname) + +install :: ${CONSTITUENT}install +${CONSTITUENT}install :: ${CONSTITUENT} + +uninstall :: ${CONSTITUENT}uninstall +${CONSTITUENT}uninstall :: ${CONSTITUENT}clean + +${CONSTITUENT}clean :: + @echo 'Deleting $(componentslistfile)' + @rm -f ${COMPONENTSLIST_DIR}/$(componentslistfile) + diff --git a/GaudiPluginService/cmt/requirements b/GaudiPluginService/cmt/requirements new file mode 100644 index 0000000000000000000000000000000000000000..7ba1f67a6dd37373f079ed99e472c9117397d0c9 --- /dev/null +++ b/GaudiPluginService/cmt/requirements @@ -0,0 +1,36 @@ +package GaudiPluginService +version v2r2 +author "Marco Clemencic" + +private +# genconfuser.py cannot be used in GaudiPluginService +# Note: the tag must be set before including GaudiPolicy +apply_tag skip_genconfuser +end_private + +use GaudiPolicy * + +apply_pattern install_more_includes more=Gaudi + +library GaudiPluginService -no_static PluginService.cpp capi_pluginservice.cpp +apply_pattern linker_library library=GaudiPluginService + +apply_pattern install_python_modules + +application listcomponents listcomponents.cpp +macro_append listcomponents_dependencies " GaudiPluginService " +# This seems to be needed on Ubuntu, but not on SLC6. +macro_append listcomponentslinkopts " -ldl " + +macro listcomponents_cmd listcomponents.exe +make_fragment listcomponents -header=listcomponents_header + +# FIXME: we need to be able to determine if PluginSvc is available globally +macro_append pp_cppflags " -DHAVE_GAUDI_PLUGINSVC " +macro_append pp_cflags " -DHAVE_GAUDI_PLUGINSVC " +apply_tag HAVE_GAUDI_PLUGINSVC + +private +macro_append pp_cppflags " -DGaudiPluginService_EXPORTS " +macro_append pp_cppflags " -DGAUDI_REFLEX_COMPONENT_ALIASES " +end_private diff --git a/GaudiPluginService/doc/README.md b/GaudiPluginService/doc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f8eab973b1924bb4a56930a1a6f5b3a22ee2fc5c --- /dev/null +++ b/GaudiPluginService/doc/README.md @@ -0,0 +1,128 @@ +Gaudi Plugin Service Instructions {#GaudiPluginService-readme} +================================== + +Introduction +------------ + +The Gaudi Plugin Service is a small tool to add to a C++ application the +possibility of dynamically instantiate (via _factories_) objects from classes +defined in plug-in (or component) libraries. + +While being part of Gaudi, it only depends on a Posix system (support for other +systems is possible, but very low priority). + + +Usage +------ + +To be able to use plug-ins from an application you need: + +- a base class (abstract or not) from a library +- a library that provides a class that inherits from the base class + +In the base class you should declare the signature of the the factory for your +derived classes. For example, if your base class is called `Foo` and you want +to instantiate the derived classes with one `std::string` argument, you can +write something like: + + #include <Gaudi/PluginService.h> + #include <string> + class Foo { + public: + typedef Gaudi::PluginService::Factory1<Foo*, const std::string&> Factory; + + /// Constructor + Foo(const std::string& name); + + // ... + }; + +The templated class `Gaudi::PluginService::Factory1` takes as first template +argument the return type of the factory and as second argument the type of the +first argument of the factory function (with all the required qualifiers +explicit). There are several variants of the class for different number of +arguments required by the constructor (`Factory0`, `Factory1`, `Factory2`, ...). + +The plug-in class `Bar` defined in the dynamically loaded library will require +a declaration to the Plugin Service to use it, so in the source file you have to +have something like: + + #include "Bar.h" + DECLARE_COMPONENT(Bar) + +The library with `Foo` and the library with `Bar` will have to be linked against +the library `libGaudiPluginService.so`. + +To enable the automatic discovery of plugins, the library with `Bar` must be +processed by the program `listcomponents` and the output must be stored in a +file with extension `.comonents` in a directory in the `LD_LIBRARY_PATH`. +For example, if the `lib` directory contains `libBar.so` and it is specified in +the `LD_LIBRARY_PATH`, you can call the commands: + + listcomponents libBar.so >> lib/MyApp.components + +Note that the `.components` file does not need to be in the same directory as +`libBar.so`. + +The application code, linked against the library providing `Foo` can now +instantiate objects of class `Bar` like this: + + #include "Foo.h" + + // ... + Foo* myBar = Foo::Factory::create("Bar", "myBar"); + // ... + +where the first argument to the function `create` is the name of the class you +want to instantiate, and the other arguments are passed to the constructor of +the class. + + +Special cases +------------- + +### Factory aliases + +Together with the simple usage described above, the Gaudi Plugin Service allows +you to give to use aliases to refer to the plug-in class. +For example, for a templated plug-in class you may have: + + #include "TemplatedBar.h" + typedef TemplatedBar<int, std::vector<double> > MyBar; + DECLARE_COMPONENT(MyBar) + +but to instantiate it you must call + + Foo* b = Foo::Factory::create("TemplatedBar<int, std::vector<double> >", + "MyTemplatedBar"); + +Which is error prone and unreadable, but you can declare the component class +with and _id_ (an alias): + + DECLARE_COMPONENT_WITH_ID(MyBar, "MyBar") + +(note that the _id_ must support the `<<` operator of `std::ostream`). +The call in the application becomes: + + Foo* b = Foo::Factory::create("MyBar", "MyTemplatedBar"); + + +### Namespaces + +You cannot use namespace delimiters in the call to `DECLARE_COMPONENT`, but you +can still use namespaces for you component classes. For example, if you have the +class `Baz::Fun` you can declare it as a component class in any of the following +ways: + + using Baz::Fun; + DECLARE_COMPONENT(Fun) + + namespace Baz { + DECLARE_COMPONENT(Fun) + } + + typedef Baz::Fun BF; + DECLARE_COMPONENT(BF) + +In all cases the name of the factory to be passed to the `create` function will +be "Baz::Fun". diff --git a/GaudiPluginService/doc/release.notes b/GaudiPluginService/doc/release.notes new file mode 100644 index 0000000000000000000000000000000000000000..312acb298d25a1fab5dd71f5de426463a1094d4e --- /dev/null +++ b/GaudiPluginService/doc/release.notes @@ -0,0 +1,151 @@ +!----------------------------------------------------------------------------- +! Package : GaudiPluginService +! Responsible : Marco Clemencic +! Purpose : Provide a generic plugin service. +! Commit Id : 6d000098f7da11c89cbbbfa26aaa43c277f6d903 +!----------------------------------------------------------------------------- + +========================== GaudiPluginService v2r2 =========================== +! 2014-07-04 - Marco Clemencic + - Improved Doxygen documentation. + +========================== GaudiPluginService v2r1 =========================== +! 2014-10-28 - Marco Clemencic + - Demangle factory types in warning messages. + +========================== GaudiPluginService v2r0 =========================== +! 2014-09-30 - David Quarrie + - do not hide C++11 constructs from Reflex for ATLAS (different version of + GCCXML) + +! 2014-05-07 - Sebastien Binet + - leverage C++11 variadic templates for the factories. + - internally, also use l-value references and std::forward + - hide the C++11 constructs from Reflex as GCC-XML parser predates C++11 + +========================== GaudiPluginService v1r2 =========================== +! 2014-05-12 - Marco Clemencic + - Fixed listcomponents command lines tests (CMake only). + +========================== GaudiPluginService v1r1 =========================== + +! 2014-05-19 - Charles Leggett + - add HAVE_GAUDI_PLUGINSVC tag for cmt requirements + +! 2014-05-09 - Charles Leggett + - add macro HAVE_GAUDI_PLUGINSVC so external packages can see if it's available + +! 2014-05-09 - Marco Clemencic + - Improved command line of listcomponents: now it accepts --output and --help. + - Modified the listcomponents CMT document to use --output instead of output + redirection. Fixes bug #104455 + +========================== GaudiPluginService v1r0 =========================== +! 2014-02-03 - Marco Clemencic + - Added support for Reflex names for components, enabled with the compile flag + -DGAUDI_REFLEX_COMPONENT_ALIASES. + +! 2014-01-10 - Marco Clemencic + - Fixed error handling in listcomponents.cpp: exit with a failure status code + if there is an error loading a library. + +! 2013-12-19 - Marco Clemencic + - Minor fix to CMake configuration. + +! 2013-08-28 - Sebastien Binet + - Added (C++) tests for optional metadata (properties). + - Added docstrings to the python interface. + +! 2013-08-27 - Marco Clemencic + - Fixed symbol visibility. + +! 2013-08-23 - Marco Clemencic + - Updated the CMT configuration. + +! 2013-08-23 - Sebastien Binet + - Added optional metadata (properties) to the factories. + - Added a Python module to query the list of factories (based on ctypes). + +! 2013-07-26 - Marco Clemencic + - Ported new GaudiPluginService to CMT. + +! 2013-07-25 - Marco Clemencic + - Removed the extra level of indirection and simplified the support for + private/protected constructors. + +! 2013-07-25 - Marco Clemencic + - Added an extra level of indirection (a creator class) to allow components + with protected/private constructors. + +! 2013-07-24 - Marco Clemencic + - Do not use the type name in the helper local class created by the DECLARE_* + macros: it's not really needed and it allows the use of namespaces and + templates in the parameter passed to DECLARE_*. + +! 2013-07-24 - Marco Clemencic + - Added some tests. + +! 2013-07-23 - Marco Clemencic + - Added thread safety (with locks) if compiled with C++11. + +! 2013-07-23 - Marco Clemencic + - Changes the dlopen flags from (RTLD_LAZY | RTLD_LOCAL) to + (RTLD_LAZY | RTLD_GLOBAL) to avoid problems with Python binary modules + imported through the Python C/C++ API. + The Python binary modules may not be linked to the Python library, so they + need that the Python symbols are visible globally. + +! 2013-07-19 - Marco Clemencic + - Added instructions for the Plugin Service in a README.md file. + +! 2013-07-18 - Marco Clemencic + - Modified the symbol resolution policy when loading a component library, + using RTLD_LAZY instead of RTLD_NOW. + It allows loading of component libraries with unresolved symbols, but it is + consistent with the old behavior. + +! 2013-07-18 - Marco Clemencic + - Added the macros DECLARE_COMPONENT and DECLARE_COMPONENT_WITH_ID to simplify + the declaration of component classes when the factory is declared as the + typedef Factory in a base class. + In the example below the declaration becomes: + + #include "MyDerivedComponent.h" + DECLARE_COMPONENT(MyDerivedComponent) + +! 2013-07-18 - Marco Clemencic + - Fixed a problem when the DECLARE_* macros are called from within a namespace. + +! 2013-07-17 - Marco Clemencic + - First complete implementation of a ROOT/Reflex-free Plugin Service for + Gaudi. The typical use is: + + - headers + + #include <Gaudi/PluginService.h> + + class IMyInterface { ... }; + + class MyBaseComponent: virtual public IMyInterface { + public: + typedef Gaudi::PluginService::Factory1<IMyInterface*, + const std::string&> + Factory; + MyBaseComponent(const std::string&); + ... + }; + + class MyDerivedComponent: public MyBaseComponent { + ... + }; + + - sources + + #include "MyDerivedComponent.h" + DECLARE_FACTORY(MyDerivedComponent, MyBaseComponent::Factory) + + - to instantiate + + #include "MyBaseComponent.h" + IMyInterface* ptr = + MyBaseComponent::Factory::create("MyDerivedComponent", "argument"); diff --git a/GaudiPluginService/python/GaudiPluginService/__init__.py b/GaudiPluginService/python/GaudiPluginService/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..429d969e96c23be4f3575763373f8e4fc445db80 --- /dev/null +++ b/GaudiPluginService/python/GaudiPluginService/__init__.py @@ -0,0 +1 @@ +# hook for GaudiPluginService diff --git a/GaudiPluginService/python/GaudiPluginService/cpluginsvc.py b/GaudiPluginService/python/GaudiPluginService/cpluginsvc.py new file mode 100644 index 0000000000000000000000000000000000000000..8af5cdb017331ce1bc4909e4f0f4d99c9239d5a4 --- /dev/null +++ b/GaudiPluginService/python/GaudiPluginService/cpluginsvc.py @@ -0,0 +1,238 @@ +## cpluginsvc is a ctypes-based wrapper for the C-exposed API of GaudiPluginService +__doc__ = ''' +cpluginsvc is a ctypes-based wrapper for the C-API of the GaudiPluginService. + +e.g.: + +>>> from GaudiPluginService import cpluginsvc +>>> for _,f in cpluginsvc.factories().items(): +... try: +... f.load() +... except Exception: +... print ("** could not load [%s] for factory [%s]" % (f.library, f.name)) +... continue +... print f +... for k,v in f.properties.iteritems(): +... print ("\t%s: %s" % (k,v)) +''' + +import ctypes +import ctypes.util + +__all__ = ( + "Registry", + "registry", + "factories", + "Factory", + "Property", + ) + +_libname = None +def _get_filename(): + if _libname: + return _libname + import platform + name = platform.system() + + fname = { + 'Darwin': "libGaudiPluginService.so", # or .dylib ? FIXME + 'Windows': "libGaudiPluginService.dll", + 'Linux': "libGaudiPluginService.so", + }[name] + return fname + +_libname = _get_filename() +_lib = ctypes.cdll.LoadLibrary(_libname) + +class Registry(ctypes.Structure): + '''Registry holds the list of factories known by the gaudi PluginService. + ''' + _fields_ = [("_registry", ctypes.c_void_p)] + + @property + def factories(self): + facts = {} + n = _lib.cgaudi_pluginsvc_get_factory_size(self) + for i in range(n): + f = _lib.cgaudi_pluginsvc_get_factory_at(self, i) + facts[f.name] = f + return facts + pass + +_instance = None +def registry(): + '''registry returns the singleton-like instance of the plugin service.''' + + global _instance + if _instance: + return _instance + _instance = _lib.cgaudi_pluginsvc_instance() + return _instance + +def factories(): + ''' + factories returns the list of components factory informations known to the plugin service + ''' + return registry().factories + +class Factory(ctypes.Structure): + """ + Factory holds informations about a component's factory: + - its name + - the library hosting that component + - the type of component (algorithm, service, tool, ...) + - the return type of this factory + - the C++ class name of that component + - the properties which may decorate that component. + """ + _fields_ = [ + ("_registry", Registry), + ("_id", ctypes.c_char_p), + ] + + @property + def name(self): + return self._id + + @property + def library(self): + return _lib.cgaudi_factory_get_library(self) + + @property + def type(self): + return _lib.cgaudi_factory_get_type(self) + + @property + def rtype(self): + return _lib.cgaudi_factory_get_rtype(self) + + @property + def classname(self): + return _lib.cgaudi_factory_get_classname(self) + + @property + def properties(self): + props = {} + nprops = _lib.cgaudi_factory_get_property_size(self) + for i in range(nprops): + prop = _lib.cgaudi_factory_get_property_at(self, i) + props[prop.key] = prop.value + return props + + def load(self): + '''load the C++ library hosting this factory + ''' + return ctypes.cdll.LoadLibrary(self.library) + + def __repr__(self): + return "<Factory id=%s library=%s type=%s rtype=%s class=%s props=%d>" % ( + self._id, + self.library, + self.type, + self.rtype, + self.classname, + len(self.properties), + ) + pass + +class Property(ctypes.Structure): + ''' + Property is a pair (key, value) optionally decorating a factory. + It is used to attach additional informations about a factory. + ''' + _fields_ = [ + ("_registry", Registry), + ("_id", ctypes.c_char_p), + ("_key", ctypes.c_char_p), + ] + + @property + def key(self): + return _lib.cgaudi_property_get_key(self) + + @property + def value(self): + return _lib.cgaudi_property_get_value(self) + + pass + +_functions_list = [ + ("cgaudi_pluginsvc_instance", + [], + Registry, + ), + + ("cgaudi_pluginsvc_get_factory_size", + [Registry], + ctypes.c_int, + ), + + ("cgaudi_pluginsvc_get_factory_at", + [Registry, ctypes.c_int], + Factory, + ), + + ("cgaudi_factory_get_library", + [Factory], + ctypes.c_char_p, + ), + + ("cgaudi_factory_get_type", + [Factory], + ctypes.c_char_p, + ), + + ("cgaudi_factory_get_rtype", + [Factory], + ctypes.c_char_p, + ), + + ("cgaudi_factory_get_classname", + [Factory], + ctypes.c_char_p, + ), + + ("cgaudi_factory_get_property_size", + [Factory], + ctypes.c_int, + ), + + ("cgaudi_factory_get_property_at", + [Factory, ctypes.c_int], + Property, + ), + + ("cgaudi_property_get_key", + [Property], + ctypes.c_char_p, + ), + + ("cgaudi_property_get_value", + [Property], + ctypes.c_char_p, + ) +] + +for f in _functions_list: + n = f[0] + func = getattr(_lib, n) + func.argtypes = f[1] + func.restype = f[2] + if len(f) == 4: func.errcheck = f[3] + pass + + +if __name__ == "__main__": + print ("instance: %s" % registry()) + print ("factories: %d" % len(factories())) + for _,f in factories().items(): + try: + f.load() + except Exception: + print ("** could not load [%s] for factory [%s]" % (f.library, f.name)) + continue + print f + for k,v in f.properties.items(): + print ("\t%s: %s" % (k,v)) + +## EOF diff --git a/GaudiPluginService/src/PluginService.cpp b/GaudiPluginService/src/PluginService.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b6c779196b0622db6b5f27a1e535e4b77dccd906 --- /dev/null +++ b/GaudiPluginService/src/PluginService.cpp @@ -0,0 +1,381 @@ +/*****************************************************************************\ +* (c) Copyright 2013 CERN * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +/// @author Marco Clemencic <marco.clemencic@cern.ch> + +#include <Gaudi/PluginService.h> + +#include <dlfcn.h> +#include <dirent.h> + +#include <cstdlib> +#include <iostream> +#include <fstream> +#include <memory> + +#include <cxxabi.h> +#include <sys/stat.h> + +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +#define REG_SCOPE_LOCK \ + std::lock_guard<std::recursive_mutex> _guard(m_mutex); + +namespace { + std::mutex registrySingletonMutex; +} +#define SINGLETON_LOCK \ + std::lock_guard<std::mutex> _guard(::registrySingletonMutex); +#else +#define REG_SCOPE_LOCK +#define SINGLETON_LOCK +#endif + +// string trimming functions taken from +// http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring +#include <algorithm> +// trim from start +static inline std::string <rim(std::string &s) { + s.erase(s.begin(), + std::find_if(s.begin(), s.end(), + std::not1(std::ptr_fun<int, int>(std::isspace)))); + return s; +} + +// trim from end +static inline std::string &rtrim(std::string &s) { + s.erase(std::find_if(s.rbegin(), s.rend(), + std::not1(std::ptr_fun<int, int>(std::isspace))) + .base(), + s.end()); + return s; +} +// trim from both ends +static inline std::string &trim(std::string &s) { + return ltrim(rtrim(s)); +} + +namespace { + /// Helper function used to set values in FactoryInfo data members only + /// if the original value is empty and reporting warnings in case of + /// inconsistencies. + inline void factoryInfoSetHelper(std::string& dest, const std::string value, + const std::string& desc, + const std::string& id) { + if (dest.empty()) { + dest = value; + } else if (dest != value) { + std::ostringstream o; + o << "new factory loaded for '" << id << "' with different " + << desc << ": " << dest << " != " << value; + Gaudi::PluginService::Details::logger().warning(o.str()); + } + } + + struct OldStyleCnv { + std::string name; + void operator() (const char c) { + switch(c) { + case '<': + case '>': + case ',': + case '(': + case ')': + case ':': + case '.': + name.push_back('_'); break; + case '&': + name.push_back('r'); break; + case '*': + name.push_back('p'); break; + case ' ': break; + default: + name.push_back(c); break; + } + } + }; + /// Convert a class name in the string used with the Reflex plugin service + std::string old_style_name(const std::string& name) { + return std::for_each(name.begin(), name.end(), OldStyleCnv()).name; + } +} + +namespace Gaudi { namespace PluginService { + + Exception::Exception(const std::string& msg): m_msg(msg) {} + Exception::~Exception() throw() {} + const char* Exception::what() const throw() { + return m_msg.c_str(); + } + + namespace Details { + void* getCreator(const std::string& id, const std::string& type) { + return Registry::instance().get(id, type); + } + + std::string demangle(const std::string& id) { + int status; + char* realname; + realname = abi::__cxa_demangle(id.c_str(), 0, 0, &status); + if (realname == 0) return id; + std::string result(realname); + free(realname); + return result; + } + std::string demangle(const std::type_info& id) { + return demangle(id.name()); + } + + Registry& Registry::instance() { + SINGLETON_LOCK + static Registry r; + return r; + } + + Registry::Registry(): m_initialized(false) {} + + void Registry::initialize() { + REG_SCOPE_LOCK + if (m_initialized) return; + m_initialized = true; +#ifdef WIN32 + const char* envVar = "PATH"; + const char sep = ';'; +#else + const char* envVar = "LD_LIBRARY_PATH"; + const char sep = ':'; +#endif + char *search_path = ::getenv(envVar); + if (search_path) { + logger().debug(std::string("searching factories in ") + envVar); + std::string path(search_path); + std::string::size_type pos = 0; + std::string::size_type newpos = 0; + while (pos != std::string::npos) { + std::string dirName; + // get the next entry in the path + newpos = path.find(sep, pos); + if (newpos != std::string::npos) { + dirName = path.substr(pos, newpos - pos); + pos = newpos+1; + } else { + dirName = path.substr(pos); + pos = newpos; + } + logger().debug(std::string(" looking into ") + dirName); + // look for files called "*.components" in the directory + DIR *dir = opendir(dirName.c_str()); + if (dir) { + struct dirent * entry; + while ((entry = readdir(dir))) { + std::string name(entry->d_name); + // check if the file name ends with ".components" + std::string::size_type extpos = name.find(".components"); + if ((extpos != std::string::npos) && + ((extpos+11) == name.size())) { + std::string fullPath = (dirName + '/' + name); + { // check if it is a regular file + struct stat buf; + stat(fullPath.c_str(), &buf); + if (!S_ISREG(buf.st_mode)) continue; + } + // read the file + logger().debug(std::string(" reading ") + name); + std::ifstream factories(fullPath.c_str()); + std::string line; + int factoriesCount = 0; + int lineCount = 0; + while (!factories.eof()) { + ++lineCount; + std::getline(factories, line); + trim(line); + // skip empty lines and lines starting with '#' + if (line.empty() || line[0] == '#') continue; + // look for the separator + std::string::size_type pos = line.find(':'); + if (pos == std::string::npos) { + std::ostringstream o; + o << "failed to parse line " << fullPath + << ':' << lineCount; + logger().warning(o.str()); + continue; + } + const std::string lib(line, 0, pos); + const std::string fact(line, pos+1); + m_factories.insert(std::make_pair(fact, FactoryInfo(lib))); +#ifdef GAUDI_REFLEX_COMPONENT_ALIASES + // add an alias for the factory using the Reflex convention + std::string old_name = old_style_name(fact); + if (fact != old_name) { + FactoryInfo old_info(lib); + old_info.properties["ReflexName"] = "true"; + m_factories.insert(std::make_pair(old_name, old_info)); + } +#endif + ++factoriesCount; + } + if (logger().level() <= Logger::Debug) { + std::ostringstream o; + o << " found " << factoriesCount << " factories"; + logger().debug(o.str()); + } + } + } + closedir(dir); + } + } + } + } + + Registry::FactoryInfo& + Registry::add(const std::string& id, void *factory, + const std::string& type, const std::string& rtype, + const std::string& className, + const Properties& props){ + REG_SCOPE_LOCK + FactoryMap &facts = factories(); + FactoryMap::iterator entry = facts.find(id); + if (entry == facts.end()) + { + // this factory was not known yet + entry = facts.insert(std::make_pair(id, + FactoryInfo("unknown", factory, + type, rtype, className, props))).first; + } else { + // do not replace an existing factory with a new one + if (!entry->second.ptr) { + entry->second.ptr = factory; + } + factoryInfoSetHelper(entry->second.type, type, "type", id); + factoryInfoSetHelper(entry->second.rtype, rtype, "return type", id); + factoryInfoSetHelper(entry->second.className, className, "class", id); + } +#ifdef GAUDI_REFLEX_COMPONENT_ALIASES + // add an alias for the factory using the Reflex convention + std::string old_name = old_style_name(id); + if (id != old_name) + add(old_name, factory, type, rtype, className, props) + .properties["ReflexName"] = "true"; +#endif + return entry->second; + } + + void* Registry::get(const std::string& id, const std::string& type) const { + REG_SCOPE_LOCK + const FactoryMap &facts = factories(); + FactoryMap::const_iterator f = facts.find(id); + if (f != facts.end()) + { +#ifdef GAUDI_REFLEX_COMPONENT_ALIASES + const Properties& props = f->second.properties; + if (props.find("ReflexName") != props.end()) + logger().warning("requesting factory via old name '" + id + "'" + "use '" + f->second.className + "' instead"); +#endif + if (!f->second.ptr) { + if (!dlopen(f->second.library.c_str(), RTLD_LAZY | RTLD_GLOBAL)) { + logger().warning("cannot load " + f->second.library + + " for factory " + id); + char *dlmsg = dlerror(); + if (dlmsg) + logger().warning(dlmsg); + return 0; + } + f = facts.find(id); // ensure that the iterator is valid + } + if (f->second.type == type) { + return f->second.ptr; + } else { + logger().warning("found factory " + id + ", but of wrong type: " + + demangle(f->second.type) + " instead of " + demangle(type)); + } + } + return 0; // factory not found + } + + const Registry::FactoryInfo& Registry::getInfo(const std::string& id) const { + REG_SCOPE_LOCK + static FactoryInfo unknown("unknown"); + const FactoryMap &facts = factories(); + FactoryMap::const_iterator f = facts.find(id); + if (f != facts.end()) + { + return f->second; + } + return unknown; // factory not found + } + + Registry& + Registry::addProperty(const std::string& id, + const std::string& k, + const std::string& v) { + REG_SCOPE_LOCK + FactoryMap &facts = factories(); + FactoryMap::iterator f = facts.find(id); + if (f != facts.end()) + { + f->second.properties[k] = v; + } + return *this; + } + + std::set<Registry::KeyType> Registry::loadedFactories() const { + REG_SCOPE_LOCK + const FactoryMap &facts = factories(); + std::set<KeyType> l; + for (FactoryMap::const_iterator f = facts.begin(); + f != facts.end(); ++f) + { + if (f->second.ptr) + l.insert(f->first); + } + return l; + } + + void Logger::report(Level lvl, const std::string& msg) { + static const char* levels[] = {"DEBUG : ", + "INFO : ", + "WARNING: ", + "ERROR : "}; + if (lvl >= level()) { + std::cerr << levels[lvl] << msg << std::endl; + } + } + + static std::auto_ptr<Logger> s_logger(new Logger); + Logger& logger() { + return *s_logger; + } + void setLogger(Logger* logger) { + s_logger.reset(logger); + } + + } // namespace Details + + void SetDebug(int debugLevel) { + using namespace Details; + Logger& l = logger(); + if (debugLevel > 1) + l.setLevel(Logger::Debug); + else if (debugLevel > 0) + l.setLevel(Logger::Info); + else l.setLevel(Logger::Warning); + } + + int Debug() { + using namespace Details; + switch (logger().level()) { + case Logger::Debug: return 2; break; + case Logger::Info: return 1; break; + default: return 0; + } + } + +}} // namespace Gaudi::PluginService diff --git a/GaudiPluginService/src/capi_pluginservice.cpp b/GaudiPluginService/src/capi_pluginservice.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94b09228531a2621e637c8ac964fca586f7ef557 --- /dev/null +++ b/GaudiPluginService/src/capi_pluginservice.cpp @@ -0,0 +1,133 @@ +#include <vector> +#include "capi_pluginservice.h" +#include <Gaudi/PluginService.h> + +#include <iostream> +using namespace Gaudi::PluginService::Details; + +cgaudi_pluginsvc_t +cgaudi_pluginsvc_instance() +{ + static Registry& cxxreg = Registry::instance(); + cgaudi_pluginsvc_t reg; + reg.registry = (void*)(&cxxreg); + return reg; +} + +int +cgaudi_pluginsvc_get_factory_size(cgaudi_pluginsvc_t self) +{ + const Registry::FactoryMap &fmap = ((const Registry*)self.registry)->factories(); + return int(fmap.size()); +} + + +cgaudi_factory_t +cgaudi_pluginsvc_get_factory_at(cgaudi_pluginsvc_t self, int n) +{ + const Registry *reg = ((const Registry*)self.registry); + std::vector<Registry::KeyType> keys; + keys.reserve(reg->factories().size()); + for (Registry::FactoryMap::const_iterator + itr = reg->factories().begin(), + iend= reg->factories().end(); + itr != iend; + itr++) { + keys.push_back(itr->first); + } + const char *key = keys[n].c_str(); + cgaudi_factory_t fac; + fac.registry = self; + fac.id = key; + return fac; +} + +const char* +cgaudi_factory_get_library(cgaudi_factory_t self) +{ + Registry ® = Registry::instance(); + std::string id = self.id; + const Registry::FactoryInfo& fi = reg.getInfo(id); + return fi.library.c_str(); +} + +const char* +cgaudi_factory_get_type(cgaudi_factory_t self) +{ + Registry ® = Registry::instance(); + std::string id = self.id; + const Registry::FactoryInfo& fi = reg.getInfo(id); + return fi.type.c_str(); +} + +const char* +cgaudi_factory_get_rtype(cgaudi_factory_t self) +{ + Registry ® = Registry::instance(); + std::string id = self.id; + const Registry::FactoryInfo& fi = reg.getInfo(id); + return fi.rtype.c_str(); +} + +const char* +cgaudi_factory_get_classname(cgaudi_factory_t self) +{ + Registry ® = Registry::instance(); + std::string id = self.id; + const Registry::FactoryInfo& fi = reg.getInfo(id); + return fi.className.c_str(); +} + +int +cgaudi_factory_get_property_size(cgaudi_factory_t self) +{ + Registry ® = Registry::instance(); + std::string id = self.id; + const Registry::FactoryInfo& fi = reg.getInfo(id); + return int(fi.properties.size()); +} + + +cgaudi_property_t +cgaudi_factory_get_property_at(cgaudi_factory_t self, int n) +{ + cgaudi_property_t cprop; + cprop.registry = self.registry; + cprop.id = self.id; + cprop.key = NULL; + Registry ® = Registry::instance(); + std::string id = cprop.id; + const Registry::FactoryInfo& fi = reg.getInfo(id); + int i = 0; + for (Registry::Properties::const_iterator + itr = fi.properties.begin(), + iend = fi.properties.end(); + itr != iend; + itr++, i++) { + if (i == n) { + cprop.key = itr->first.c_str(); + return cprop; + } + } + return cprop; +} + +const char* +cgaudi_property_get_key(cgaudi_property_t self) +{ + return self.key; +} + +const char* +cgaudi_property_get_value(cgaudi_property_t self) +{ + Registry ® = Registry::instance(); + std::string id = self.id; + const Registry::FactoryInfo& fi = reg.getInfo(id); + Registry::KeyType key = self.key; + Registry::Properties::const_iterator prop = fi.properties.find(key); + if (prop == fi.properties.end()) { + return NULL; + } + return prop->second.c_str(); +} diff --git a/GaudiPluginService/src/capi_pluginservice.h b/GaudiPluginService/src/capi_pluginservice.h new file mode 100644 index 0000000000000000000000000000000000000000..71cb17aa977477d8d8e4155fa0064ac37acf628d --- /dev/null +++ b/GaudiPluginService/src/capi_pluginservice.h @@ -0,0 +1,103 @@ +#ifndef _GAUDI_C_PLUGIN_SERVICE_H_ +#define _GAUDI_C_PLUGIN_SERVICE_H_ 1 +/*****************************************************************************\ +* (c) Copyright 2013 CERN * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +/* @author Sebastien Binet <binet@cern.ch> */ + +#include <stdint.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if __GNUC__ >= 4 +# define CGAUDI_HASCLASSVISIBILITY +#endif + +#if defined(CGAUDI_HASCLASSVISIBILITY) +# define CGAUDI_IMPORT __attribute__((visibility("default"))) +# define CGAUDI_EXPORT __attribute__((visibility("default"))) +# define CGAUDI_LOCAL __attribute__((visibility("hidden"))) +#else +# define CGAUDI_IMPORT +# define CGAUDI_EXPORT +# define CGAUDI_LOCAL +#endif + +#define CGAUDI_API CGAUDI_EXPORT + + typedef struct { + void *registry; + } cgaudi_pluginsvc_t; + + typedef struct { + cgaudi_pluginsvc_t registry; + const char *id; + } cgaudi_factory_t; + + typedef struct { + cgaudi_pluginsvc_t registry; + const char *id; + const char *key; + } cgaudi_property_t; + + CGAUDI_API + cgaudi_pluginsvc_t + cgaudi_pluginsvc_instance(void); + + CGAUDI_API + int + cgaudi_pluginsvc_get_factory_size(cgaudi_pluginsvc_t self); + + CGAUDI_API + cgaudi_factory_t + cgaudi_pluginsvc_get_factory_at(cgaudi_pluginsvc_t self, int n); + + CGAUDI_API + const char* + cgaudi_factory_get_library(cgaudi_factory_t self); + + CGAUDI_API + const char* + cgaudi_factory_get_type(cgaudi_factory_t self); + + CGAUDI_API + const char* + cgaudi_factory_get_rtype(cgaudi_factory_t self); + + CGAUDI_API + const char* + cgaudi_factory_get_classname(cgaudi_factory_t self); + + CGAUDI_API + int + cgaudi_factory_get_property_size(cgaudi_factory_t self); + + CGAUDI_API + cgaudi_property_t + cgaudi_factory_get_property_at(cgaudi_factory_t self, int n); + + CGAUDI_API + const char* + cgaudi_property_get_key(cgaudi_property_t self); + + CGAUDI_API + const char* + cgaudi_property_get_value(cgaudi_property_t self); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !_GAUDI_C_PLUGIN_SERVICE_H_ */ + diff --git a/GaudiPluginService/src/listcomponents.cpp b/GaudiPluginService/src/listcomponents.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa91e6349f2ed5988d291f68d26b78978e44abd8 --- /dev/null +++ b/GaudiPluginService/src/listcomponents.cpp @@ -0,0 +1,129 @@ +/*****************************************************************************\ +* (c) Copyright 2013 CERN * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ + +/// @author Marco Clemencic <marco.clemencic@cern.ch> + +#include <iostream> +#include <fstream> +#include <string> +#include <set> +#include <list> +#include <memory> +#include <cstdlib> + +#include <getopt.h> +#include <dlfcn.h> + +#include <Gaudi/PluginService.h> + +void help(std::string argv0) { + std::cout << "Usage: " << argv0 << " [option] library1 [library2 ...]\n" + "\n list the component factories present in the given libraries\n\n" + "Options:\n\n" + " -h, --help show this help message and exit\n" + " -o OUTPUT, --output OUTPUT\n" + " write the list of factories on the file OUTPUT, use - for\n" + " standard output (default)\n" + << std::endl; +} + +void usage(std::string argv0) { + std::cout << "Usage: " << argv0 << " [option] library1 [library2 ...]\n" + "Try `" << argv0 << " -h' for more information.\n" + << std::endl; +} + +int main(int argc, char* argv[]) { + Gaudi::PluginService::Details::Registry ® = + Gaudi::PluginService::Details::Registry::instance(); + typedef Gaudi::PluginService::Details::Registry::KeyType key_type; + + // cache to keep track of the loaded factories + std::map<key_type, std::string> loaded; + { + // initialize the local cache + std::set<key_type> base = reg.loadedFactories(); + for (std::set<key_type>::const_iterator f = base.begin(); f != base.end(); ++f) + { + loaded.insert(std::make_pair(*f, std::string("<preloaded>"))); + } + } + + // Parse command line + std::list<char*> libs; + std::string output_opt("-"); + { + std::string argv0(argv[0]); + { + auto i = argv0.rfind('/'); + if (i != std::string::npos) + argv0 = argv0.substr(i+1); + } + + int i = 1; + while (i < argc) { + const std::string arg(argv[i]); + if (arg == "-o" || arg == "--output") { + if (++i < argc) { + output_opt = argv[i]; + } else { + std::cerr << "ERROR: missing argument for option " << arg << std::endl; + std::cerr << "See `" << argv0 << " -h' for more details." << std::endl; + return EXIT_FAILURE; + } + } else if (arg == "-h" || arg == "--help") { + help(argv0); + return EXIT_SUCCESS; + } else { + libs.push_back(argv[i]); + } + ++i; + } + if (libs.empty()) { + usage(argv0); + return EXIT_FAILURE; + } + } + + // handle output option + std::unique_ptr<std::ostream> output_file; + if (output_opt != "-") { + output_file = std::unique_ptr<std::ostream>(new std::ofstream(output_opt.c_str())); + } + std::ostream &output = (output_file ? *output_file : std::cout); + + // loop over the list of libraries passed on the command line + for (char* lib: libs) { + + if (dlopen(lib, RTLD_LAZY | RTLD_LOCAL)) { + + std::set<key_type> factories = reg.loadedFactories(); + std::set<key_type>::const_iterator f; + for (f = factories.begin(); f != factories.end(); ++f) { + if (loaded.find(*f) == loaded.end()) + { + output << lib << ":" << *f << std::endl; + loaded[*f] = lib; + } + else + std::cerr << "WARNING: factory '" << *f + << "' already found in " << loaded[*f] + << std::endl; + } + + } else { + std::cerr << "ERROR: failed to load " << lib << std::endl; + return EXIT_FAILURE; + } + } + + return EXIT_SUCCESS; +} diff --git a/GaudiPluginService/tests/src/UseCases.cpp b/GaudiPluginService/tests/src/UseCases.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bf76eac9e379954e0ff8cdd9e2aaee5c399e4043 --- /dev/null +++ b/GaudiPluginService/tests/src/UseCases.cpp @@ -0,0 +1,142 @@ +/*****************************************************************************\ +* (c) Copyright 2013 CERN * +* * +* This software is distributed under the terms of the GNU General Public * +* Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\*****************************************************************************/ +/** + * Compile-time test for all known PluginService use-cases + * + * @author Marco Clemencic <marco.clemencic@cern.ch> + */ + +#include <Gaudi/PluginService.h> + +// standard use, 0 arguments +class Base { +public: + typedef Gaudi::PluginService::Factory<Base*> Factory; + virtual ~Base() {} +}; +class Component0: public Base { }; +DECLARE_COMPONENT(Component0) + +class Component1: public Base { }; +#define DECLARE_COMPONENT_WITH_PROPS(type) \ + DECLARE_FACTORY_WITH_PROPS(type, type::Factory) +#define DECLARE_FACTORY_WITH_PROPS(type, factory) \ + DECLARE_FACTORY_WITH_ID_AND_PROPS(type, \ + ::Gaudi::PluginService::Details::demangle<type>(), \ + factory) +#define DECLARE_FACTORY_WITH_ID_AND_PROPS(type, id, factory) \ + _INTERNAL_DECLARE_FACTORY_WITH_PROPS(type, id, factory, __LINE__) +#define _INTERNAL_DECLARE_FACTORY_WITH_PROPS(type, id, factory, serial) \ + _INTERNAL_DECLARE_FACTORY_WITH_CREATOR_AND_PROPS \ + (type, \ + ::Gaudi::PluginService::Details::Factory<type>, \ + id, factory, serial) +#define _INTERNAL_DECLARE_FACTORY_WITH_CREATOR_AND_PROPS(type, typecreator, \ + id, factory, serial) \ + namespace { \ + class _INTERNAL_FACTORY_REGISTER_CNAME(type, serial) { \ + public: \ + typedef factory s_t; \ + typedef typecreator f_t; \ + static s_t::FuncType creator() { return &f_t::create<s_t>; } \ + _INTERNAL_FACTORY_REGISTER_CNAME(type, serial) () { \ + using ::Gaudi::PluginService::Details::Registry; \ + Registry::instance().add<s_t, type>(id, creator()) \ + .addProperty("name", #type); \ + } \ + } _INTERNAL_FACTORY_REGISTER_CNAME(s_ ## type, serial); \ + } + +DECLARE_COMPONENT_WITH_PROPS(Component1) + +// standard use, 2 arguments +class Base2 { +public: + typedef Gaudi::PluginService::Factory<Base2*, const std::string&, int> Factory; + virtual ~Base2() {} +}; +class Component2: public Base2 { +public: + Component2(const std::string& _s, int _i): i(_i), s(_s) {} + int i; + std::string s; +}; +DECLARE_COMPONENT(Component2) + +// namespaces +namespace Test { + class ComponentA: public Base {}; + class ComponentB: public Base {}; + class ComponentC: public Base {}; +} + +namespace { + using Test::ComponentA; + DECLARE_COMPONENT(ComponentA) +} + +DECLARE_COMPONENT(Test::ComponentB) + +namespace Test { + DECLARE_COMPONENT(ComponentC) +} + +// using ids +DECLARE_COMPONENT_WITH_ID(Component2, "Id2") +DECLARE_COMPONENT_WITH_ID(Test::ComponentB, "B") + +// explicit factory +DECLARE_FACTORY_WITH_ID(Test::ComponentA, "A", Base::Factory) + + +// Tests +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( basic ) +{ + BOOST_CHECK(Base::Factory::create("Component0") != 0); +} + +BOOST_AUTO_TEST_CASE( basic_with_args ) +{ + Base2* instance = Base2::Factory::create("Component2", "hello", 2); + BOOST_CHECK(instance != 0); + + Component2* c2 = dynamic_cast<Component2*>(instance); + BOOST_REQUIRE(c2 != 0); + BOOST_CHECK(c2->i == 2); + BOOST_CHECK(c2->s == "hello"); +} + +BOOST_AUTO_TEST_CASE( namespaces ) +{ + BOOST_CHECK(Base::Factory::create("Test::ComponentA") != 0); + BOOST_CHECK(Base::Factory::create("Test::ComponentB") != 0); + BOOST_CHECK(Base::Factory::create("Test::ComponentC") != 0); +} + +BOOST_AUTO_TEST_CASE( ids ) +{ + BOOST_CHECK(Base2::Factory::create("Id2", "id", -2) != 0); + BOOST_CHECK(Base::Factory::create("A") != 0); + BOOST_CHECK(Base::Factory::create("B") != 0); +} + +BOOST_AUTO_TEST_CASE( properties ) +{ + using Gaudi::PluginService::Details::Registry; + Registry ® = Registry::instance(); + Registry::Properties props = reg.getInfo("Component1").properties; + + BOOST_CHECK(props["name"] == "Component1"); +} diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000000000000000000000000000000000000..94a9ed024d3859793618152ea559a168bbcbb5e2 --- /dev/null +++ b/LICENCE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt index 16d3e5a2edd35e1d75e8cc5f0f15c24b18cb96df..d85fd6bff2d8edf515f9aafc8c31a4f60489126f 100644 --- a/UtilityApps/CMakeLists.txt +++ b/UtilityApps/CMakeLists.txt @@ -1,3 +1,15 @@ +# $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +#========================================================================== +# AIDA Detector description implementation for LCD +#-------------------------------------------------------------------------- +# Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +# All rights reserved. +# +# For the licensing terms see $DD4hepINSTALL/LICENSE. +# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +# +#========================================================================== + cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include @@ -9,22 +21,22 @@ include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include #----------------------------------------------------------------------------------- add_executable(geoDisplay src/display.cpp) -target_link_libraries(geoDisplay DDCore ) +target_link_libraries(geoDisplay DDCore ${ROOT_LIBRARIES}) #----------------------------------------------------------------------------------- add_executable(geoConverter src/converter.cpp) -target_link_libraries(geoConverter DDCore) +target_link_libraries(geoConverter DDCore ${ROOT_LIBRARIES}) #----------------------------------------------------------------------------------- add_executable(geoPluginRun src/plugin_runner.cpp) -target_link_libraries(geoPluginRun DDCore) +target_link_libraries(geoPluginRun DDCore ${ROOT_LIBRARIES}) #----------------------------------------------------------------------------------- add_executable( print_materials src/print_materials.cpp) -target_link_libraries(print_materials DDCore DDRec) +target_link_libraries(print_materials DDCore DDRec ${ROOT_LIBRARIES}) #----------------------------------------------------------------------------------- add_executable( materialScan src/materialScan.cpp) -target_link_libraries(materialScan DDCore DDRec) +target_link_libraries(materialScan DDCore DDRec ${ROOT_LIBRARIES}) #----------------------------------------------------------------------------------- add_executable( dumpdetector src/dumpdetector.cpp) -target_link_libraries(dumpdetector DDCore DDRec) +target_link_libraries(dumpdetector DDCore DDRec ${ROOT_LIBRARIES}) #----------------------------------------------------------------------------------- @@ -35,7 +47,7 @@ if(DD4HEP_USE_LCIO) add_executable(teveDisplay src/teve_display.cpp G__teve.cxx src/next_event_lcio.cpp) add_executable(test_surfaces src/test_surfaces.cpp ) - target_link_libraries(test_surfaces DDCore DDRec ${LCIO_LIBRARIES} ) + target_link_libraries(test_surfaces DDCore DDRec ${LCIO_LIBRARIES} ${ROOT_LIBRARIES}) else() add_executable(teveDisplay src/teve_display.cpp G__teve.cxx src/next_event_dummy.cpp) endif() diff --git a/UtilityApps/src/EvNavHandler.h b/UtilityApps/src/EvNavHandler.h index 280b73228b9e98208d8a3e75d1f1c510c8311741..939ebf19bc1c706cd726775b824abb933257edd3 100644 --- a/UtilityApps/src/EvNavHandler.h +++ b/UtilityApps/src/EvNavHandler.h @@ -1,3 +1,15 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== + #ifndef EvNavHandler_h #define EvNavHandler_h diff --git a/UtilityApps/src/LinkDef.h b/UtilityApps/src/LinkDef.h index d294195850f9df45785534793a858d473140cfeb..ed84a61c20c9714988ac86c73a53192f9a15209e 100644 --- a/UtilityApps/src/LinkDef.h +++ b/UtilityApps/src/LinkDef.h @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #ifdef __CINT__ #pragma link off all globals; diff --git a/UtilityApps/src/MultiView.h b/UtilityApps/src/MultiView.h index 52ca9c1193260ce913814c0b07c903ff54f99fa3..fea42ec4678fad7bb0cb7c5ba91d63e75499efdd 100644 --- a/UtilityApps/src/MultiView.h +++ b/UtilityApps/src/MultiView.h @@ -1,3 +1,15 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== + #ifndef MultiView_h #define MultiView_h @@ -58,13 +70,13 @@ public: //======== fRPhiGeomScene = gEve->SpawnNewScene("RPhi Geometry", - "Scene holding projected geometry for the RPhi view."); + "Scene holding projected geometry for the RPhi view."); fRhoZGeomScene = gEve->SpawnNewScene("RhoZ Geometry", - "Scene holding projected geometry for the RhoZ view."); + "Scene holding projected geometry for the RhoZ view."); fRPhiEventScene = gEve->SpawnNewScene("RPhi Event Data", - "Scene holding projected event-data for the RPhi view."); + "Scene holding projected event-data for the RPhi view."); fRhoZEventScene = gEve->SpawnNewScene("RhoZ Event Data", - "Scene holding projected event-data for the RhoZ view."); + "Scene holding projected event-data for the RhoZ view."); // Projection managers diff --git a/UtilityApps/src/converter.cpp b/UtilityApps/src/converter.cpp index 52927190ca6c7c5be22e59c6457b517a63ddca84..f5ce9c11d8ca82384d74c045c76e5e5a189e620d 100644 --- a/UtilityApps/src/converter.cpp +++ b/UtilityApps/src/converter.cpp @@ -1,13 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Generic ROOT based geometry display program -// -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "run_plugin.h" //______________________________________________________________________________ @@ -29,7 +34,7 @@ namespace { " before exiting the application \n" " -volmgr [OPTIONAL] Load and populate phys.volume manager to \n" " check the volume ids for duplicates etc. \n" - << endl; + << endl; exit(EINVAL); } } @@ -49,15 +54,15 @@ int main(int argc,char** argv) { for(int i=1; i<argc;++i) { if ( argv[i][0]=='-' ) { if ( strncmp(argv[i],"-compact2lcdd",12)==0 ) - compact2lcdd = true; + compact2lcdd = true; else if ( strncmp(argv[i],"-compact2gdml",12)==0 ) - compact2gdml = true; + compact2gdml = true; else if ( strncmp(argv[i],"-compact2pandora",12)==0 ) - compact2pand = true; + compact2pand = true; else if ( strncmp(argv[i],"-compact2vis",12)==0 ) - compact2vis = true; + compact2vis = true; else if ( strncmp(argv[i],"-input",2)==0 ) - geo_files.push_back(argv[++i]); + geo_files.push_back(argv[++i]); else if ( strncmp(argv[i],"-output",2)==0 ) output = ++i; else if ( strncmp(argv[i],"-ascii",5)==0 ) @@ -67,7 +72,7 @@ int main(int argc,char** argv) { else if ( strncmp(argv[i],"-volmgr",2)==0 ) volmgr = true; else - usage(); + usage(); } else { usage(); diff --git a/UtilityApps/src/display.cpp b/UtilityApps/src/display.cpp index e5f15dab41b623c4d55408d949b3698ac48bf377..464c6241f2079162da38d3a07f8e21ffb64c031c 100644 --- a/UtilityApps/src/display.cpp +++ b/UtilityApps/src/display.cpp @@ -1,13 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Generic ROOT based geometry display program -// -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "run_plugin.h" //______________________________________________________________________________ diff --git a/UtilityApps/src/dumpdetector.cpp b/UtilityApps/src/dumpdetector.cpp index ed188d13a9bd62b2d81f51fa4a01064bb94b8925..d25d22b11a5496c8f47b9e21b7829d0edf9f1b2f 100644 --- a/UtilityApps/src/dumpdetector.cpp +++ b/UtilityApps/src/dumpdetector.cpp @@ -1,13 +1,22 @@ -// $Id:$ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== // // Simple program to dump the complete DetElement hierarchy // // Author : F.Gaede, CERN/DESY // Date : 07 Nov 2014 -//==================================================================== +//========================================================================== + +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/DD4hepUnits.h" @@ -15,6 +24,7 @@ #include "DDRec/DetectorSurfaces.h" #include "DDRec/SurfaceHelper.h" +// C/C++ include files #include <list> @@ -47,7 +57,7 @@ int main(int argc, char** argv ){ std::cout << "############################################################################### " << std::endl - << " sensitive detectors: " << std::endl ; + << " sensitive detectors: " << std::endl ; for( DD4hep::Geometry::LCDD::HandleMap::const_iterator it = sensDet.begin() ; it != sensDet.end() ; ++it ){ @@ -65,14 +75,14 @@ int main(int argc, char** argv ){ std::list< DetElement > gdaugs ; daugs.push_back( world ) ; while( ! daugs.empty() ) { - for( std::list< DetElement >::iterator li=daugs.begin() ; li != daugs.end() ; ++li ){ - DetElement dau = *li ; - DetElement::Children chMap = dau.children() ; - for ( DetElement::Children::const_iterator it=chMap.begin() ; it != chMap.end() ; ++it ){ - DetElement de = (*it).second ; - gdaugs.push_back( de ) ; - } - } + for( std::list< DetElement >::iterator li=daugs.begin() ; li != daugs.end() ; ++li ){ + DetElement dau = *li ; + DetElement::Children chMap = dau.children() ; + for ( DetElement::Children::const_iterator it=chMap.begin() ; it != chMap.end() ; ++it ){ + DetElement de = (*it).second ; + gdaugs.push_back( de ) ; + } + } dets.splice( dets.end() , daugs ) ; daugs.splice( daugs.end() , gdaugs ) ; } diff --git a/UtilityApps/src/materialScan.cpp b/UtilityApps/src/materialScan.cpp index 0a3d06393c3cb41fc6820de028691a3a167c09ca..3e214e0cfd897ee5e811e060302d74bbda57f08e 100644 --- a/UtilityApps/src/materialScan.cpp +++ b/UtilityApps/src/materialScan.cpp @@ -1,7 +1,14 @@ -// $Id:$ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== // // Simple program to print all the materials in a detector on // a straight line between two given points @@ -9,8 +16,11 @@ // Author : F.Gaede, DESY // Author : M.Frank, CERN // -//==================================================================== +//========================================================================== + #include "TError.h" + +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/Printout.h" #include "DDRec/MaterialManager.h" @@ -27,8 +37,8 @@ int main(int argc, char** argv) { } static void usage() { std::cout << " usage: materialScan compact.xml x0 y0 z0 x1 y1 z1 " << std::endl - << " -> prints the materials on a straight line between the two given points ( unit is cm) " - << std::endl; + << " -> prints the materials on a straight line between the two given points ( unit is cm) " + << std::endl; exit(1); } } _handler; @@ -58,7 +68,7 @@ int main(int argc, char** argv) { const char* line = " +--------------------------------------------------------------------------------------------------------------------------------------------------\n"; ::printf("%s + Material scan between: x_0 = (%7.2f,%7.2f,%7.2f) [cm] and x_1 = (%7.2f,%7.2f,%7.2f) [cm] : \n%s", - line,p0[0],p0[1],p0[2],p1[0],p1[1],p1[2],line); + line,p0[0],p0[1],p0[2],p1[0],p1[1],p1[2],line); ::printf(" | \\ %-11s Atomic Radiation Interaction Path Integrated Integrated Material\n","Material"); ::printf(" | Num. \\ %-11s Number/Z Mass/A Density Length Length Thickness Length X0 Lambda Endpoint \n","Name"); ::printf(" | Layer \\ %-11s [g/mole] [g/cm3] [cm] [cm] [cm] [cm] [cm] [cm] ( cm, cm, cm)\n",""); @@ -75,8 +85,8 @@ int main(int argc, char** argv) { end = path_length * direction; const char* fmt = mat->GetRadLen() >= 1e5 ? fmt2 : fmt1; ::printf(fmt, i+1, mat->GetName(), mat->GetZ(), mat->GetA(), - mat->GetDensity(), mat->GetRadLen(), mat->GetIntLen(), - length, path_length, sum_x0, sum_lambda, end[0], end[1], end[2]); + mat->GetDensity(), mat->GetRadLen(), mat->GetIntLen(), + length, path_length, sum_x0, sum_lambda, end[0], end[1], end[2]); //mat->Print(); } printf("%s",line); @@ -84,11 +94,11 @@ int main(int argc, char** argv) { const char* fmt = avg.radiationLength() >= 1e5 ? fmt2 : fmt1; end = path_length * direction; ::printf(fmt,0,"Average Material",avg.Z(),avg.A(),avg.density(), - avg.radiationLength(), avg.interactionLength(), - path_length, path_length, - path_length/avg.radiationLength(), - path_length/avg.interactionLength(), - end[0], end[1], end[2]); + avg.radiationLength(), avg.interactionLength(), + path_length, path_length, + path_length/avg.radiationLength(), + path_length/avg.interactionLength(), + end[0], end[1], end[2]); printf("%s",line); return 0; } diff --git a/UtilityApps/src/next_event_dummy.cpp b/UtilityApps/src/next_event_dummy.cpp index 68b42cefdfbde13750087dacb9b05228dfa2eab5..8193eed5e752b0e4d33698ae6fad8154492447c9 100644 --- a/UtilityApps/src/next_event_dummy.cpp +++ b/UtilityApps/src/next_event_dummy.cpp @@ -1,3 +1,15 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== + #include "TEveManager.h" #include <iostream> #include "TEveStraightLineSet.h" @@ -28,30 +40,30 @@ void next_event(){ //===================================================================================== TEveStraightLineSet* lineset(Int_t nlines, Int_t nmarkers ) { - TEveManager::Create(); + TEveManager::Create(); - TRandom r(0); - Float_t s = 100; + TRandom r(0); + Float_t s = 100; - TEveStraightLineSet* ls = new TEveStraightLineSet(); + TEveStraightLineSet* ls = new TEveStraightLineSet(); - for(Int_t i = 0; i<nlines; i++) - { - ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s), - r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s)); - // add random number of markers - Int_t nm = Int_t(nmarkers* r.Rndm()); - for(Int_t m = 0; m < nm; m++) { - ls->AddMarker(i, r.Rndm()); - } - } + for(Int_t i = 0; i<nlines; i++) + { + ls->AddLine( r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s), + r.Uniform(-s,s), r.Uniform(-s,s), r.Uniform(-s,s)); + // add random number of markers + Int_t nm = Int_t(nmarkers* r.Rndm()); + for(Int_t m = 0; m < nm; m++) { + ls->AddMarker(i, r.Rndm()); + } + } - ls->SetMarkerSize(1.5); - ls->SetMarkerStyle(4); + ls->SetMarkerSize(1.5); + ls->SetMarkerStyle(4); - gEve->AddElement(ls); - gEve->Redraw3D(); + gEve->AddElement(ls); + gEve->Redraw3D(); - return ls; + return ls; } //===================================================================================== diff --git a/UtilityApps/src/next_event_lcio.cpp b/UtilityApps/src/next_event_lcio.cpp index 6cccfe8dba8e56717fa9e203b115abd92d7b2af3..6fd5d2444a8bd7c8d44fad876c7d8f366baab38b 100644 --- a/UtilityApps/src/next_event_lcio.cpp +++ b/UtilityApps/src/next_event_lcio.cpp @@ -1,3 +1,14 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== #include "TEveManager.h" #include "TEveStraightLineSet.h" #include "TEvePointSet.h" @@ -60,10 +71,10 @@ void next_event(){ }catch(lcio::IOException& e) { std::cout << " ------------------------------------------------------------------------------------------------ " << std::endl - << "*** file " << lcioFileName << " does not exist - can't read LCIO events ! " << std::endl - << " will display detector geometry only. Link LCIO file to " << lcioFileName << " to display events ! "<< std::endl - << " -------------------------------------------------------------------------------------------------" - << std::endl ; + << "*** file " << lcioFileName << " does not exist - can't read LCIO events ! " << std::endl + << " will display detector geometry only. Link LCIO file to " << lcioFileName << " to display events ! "<< std::endl + << " -------------------------------------------------------------------------------------------------" + << std::endl ; return ; } @@ -94,19 +105,19 @@ void next_event(){ if( col->getTypeName() == LCIO::SIMTRACKERHIT ){ - MultiView::instance()->ImportEvent( createPointSet<EVENT::SimTrackerHit>( col , colNames[ icol ] , kMagenta+2 , 1 , 4 ) ) ; + MultiView::instance()->ImportEvent( createPointSet<EVENT::SimTrackerHit>( col , colNames[ icol ] , kMagenta+2 , 1 , 4 ) ) ; } else if( col->getTypeName() == LCIO::SIMCALORIMETERHIT ){ - MultiView::instance()->ImportEvent( createPointSet<EVENT::SimCalorimeterHit>( col , colNames[ icol ] , kMagenta+4 , 1 , 4 ) ) ; + MultiView::instance()->ImportEvent( createPointSet<EVENT::SimCalorimeterHit>( col , colNames[ icol ] , kMagenta+4 , 1 , 4 ) ) ; } else if( col->getTypeName() == LCIO::TRACKERHIT ){ - MultiView::instance()->ImportEvent( createPointSet<EVENT::TrackerHit>( col , colNames[ icol ] , kBlue+2 , 1 , 4 ) ) ; + MultiView::instance()->ImportEvent( createPointSet<EVENT::TrackerHit>( col , colNames[ icol ] , kBlue+2 , 1 , 4 ) ) ; } else if( col->getTypeName() == LCIO::CALORIMETERHIT ){ - MultiView::instance()->ImportEvent( createPointSet<EVENT::CalorimeterHit>( col , colNames[ icol ] , kBlue+4 , 1 , 4 ) ) ; + MultiView::instance()->ImportEvent( createPointSet<EVENT::CalorimeterHit>( col , colNames[ icol ] , kBlue+4 , 1 , 4 ) ) ; } } diff --git a/UtilityApps/src/plugin_runner.cpp b/UtilityApps/src/plugin_runner.cpp index 6faae2f4cc2e865969c3aad4dba8e320e0dacdc4..63647ed118b1540d68212529060a8335a7e78be3 100644 --- a/UtilityApps/src/plugin_runner.cpp +++ b/UtilityApps/src/plugin_runner.cpp @@ -1,13 +1,18 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Generic ROOT based geometry display program -// -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "run_plugin.h" //______________________________________________________________________________ @@ -31,11 +36,11 @@ int main(int argc,char** argv) { for(int i=1; i<argc;++i) { if ( argv[i][0]=='-' ) { if ( arguments.handle(i,argc,argv) ) - continue; + continue; else if ( strncmp(argv[i],"-plugin",2)==0 ) plugin = argv[++i]; else - options.push_back(argv[i]); + options.push_back(argv[i]); } else { usage(); diff --git a/UtilityApps/src/print_materials.cpp b/UtilityApps/src/print_materials.cpp index c8d6ebc9d6549f32e45be5646a74ed50839df5aa..9e950d29c607e09fa50d6cfd9411f7d000a2b2a7 100644 --- a/UtilityApps/src/print_materials.cpp +++ b/UtilityApps/src/print_materials.cpp @@ -1,17 +1,24 @@ -// $Id:$ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== // Simple program to print all the materials in a detector on // a straight line between two given points // // Author : F.Gaede, DESY // -//==================================================================== +//========================================================================== + +// Framework include files #include "DD4hep/LCDD.h" #include "DD4hep/DD4hepUnits.h" - #include "DDRec/MaterialManager.h" using namespace std ; @@ -27,8 +34,8 @@ int main(int argc, char** argv ){ if( argc != 8 ) { std::cout << " usage: print_materials compact.xml x0 y0 z0 x1 y1 z1 " << std::endl - << " -> prints the materials on a straight line between the two given points ( unit is cm) " - << std::endl ; + << " -> prints the materials on a straight line between the two given points ( unit is cm) " + << std::endl ; exit(1) ; } @@ -83,8 +90,8 @@ int main(int argc, char** argv ){ const MaterialData& avMat = matMgr.createAveragedMaterial( materials ) ; std::cout << " averaged Material : " << " Z: " << avMat.Z() << " A: " << avMat.A() << " densitiy: " << avMat.density() - << " radiationLength: " << avMat.radiationLength() - << " interactionLength: " << avMat.interactionLength() << std::endl << std::endl ; + << " radiationLength: " << avMat.radiationLength() + << " interactionLength: " << avMat.interactionLength() << std::endl << std::endl ; std::cout << " Total length : " << path_length / dd4hep::mm << " mm " << std::endl ; diff --git a/UtilityApps/src/run_plugin.h b/UtilityApps/src/run_plugin.h index 551f78f536cb614618ae05cd106cda8230589c4a..2a6c3b208c45fd119a55a886bdc85843df4a34cc 100644 --- a/UtilityApps/src/run_plugin.h +++ b/UtilityApps/src/run_plugin.h @@ -1,13 +1,16 @@ // $Id$ -//==================================================================== +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Generic ROOT based geometry display program -// -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== // Framework include files #include "DD4hep/LCDD.h" @@ -35,7 +38,7 @@ namespace { union { void* p; LCDD* l; } v; v.p = ::DD4hep::PluginService::Create<void*>("LCDD_constructor",name); if ( v.p ) { - return *v.l; + return *v.l; } throw runtime_error("Failed to locate plugin to create LCDD instance"); } @@ -92,7 +95,7 @@ namespace { print_default_args() << " -load_only [OPTIONAL] Dry-run to only load geometry without \n" " starting the dispay. \n" - << endl; + << endl; exit(EINVAL); } @@ -109,53 +112,53 @@ namespace { } int handle(int& i, int argc, char** argv) { if ( strncmp(argv[i],"-compact",5)==0 || strncmp(argv[i],"-input",4)==0 ) { - geo_files.push_back(argv[++i]); - if ( argc>i+2 && strncmp(argv[i+1],"-build_type",6)==0 ) { - build_types.push_back(argv[i+2]); - i += 2; - } - else { - build_types.push_back("BUILD_DEFAULT"); - } + geo_files.push_back(argv[++i]); + if ( argc>i+2 && strncmp(argv[i+1],"-build_type",6)==0 ) { + build_types.push_back(argv[i+2]); + i += 2; + } + else { + build_types.push_back("BUILD_DEFAULT"); + } } else if ( strncmp(argv[i],"-load_only",5)==0 ) - dry_run = true; + dry_run = true; else if ( strncmp(argv[i],"-print",4)==0 ) - DD4hep::setPrintLevel(DD4hep::PrintLevel(print = decodePrintLevel(argv[++i]))); + DD4hep::setPrintLevel(DD4hep::PrintLevel(print = decodePrintLevel(argv[++i]))); else if ( strncmp(argv[i],"-destroy",5)==0 ) - destroy = true; + destroy = true; else if ( strncmp(argv[i],"-volmgr",4)==0 ) - volmgr = true; + volmgr = true; else - return 0; + return 0; return 1; } int decodePrintLevel(const std::string& val) { switch(::toupper(val[0])) { case '1': case 'V': - return DD4hep::VERBOSE; + return DD4hep::VERBOSE; case '2': case 'D': - return DD4hep::DEBUG; + return DD4hep::DEBUG; case '3': case 'I': - return DD4hep::INFO; + return DD4hep::INFO; case '4': case 'W': - return DD4hep::WARNING; + return DD4hep::WARNING; case '5': case 'E': - return DD4hep::ERROR; + return DD4hep::ERROR; case '6': case 'F': - return DD4hep::FATAL; + return DD4hep::FATAL; case '7': case 'A': - return DD4hep::FATAL; + return DD4hep::FATAL; default: - cout << "Unknown print level supplied:'" << val << "'. Argument ignored." << endl; - throw std::runtime_error("Invalid printLevel:"+val); + cout << "Unknown print level supplied:'" << val << "'. Argument ignored." << endl; + throw std::runtime_error("Invalid printLevel:"+val); } } }; @@ -172,14 +175,14 @@ namespace { Args args; for(int i=1; i<argc;++i) { if ( argv[i][0]=='-' ) { - if ( args.handle(i,argc,argv) ) - continue; - else - usage_default(name); + if ( args.handle(i,argc,argv) ) + continue; + else + usage_default(name); } else { // This is the default - args.geo_files.push_back(argv[i]); - args.build_types.push_back("BUILD_DEFAULT"); + args.geo_files.push_back(argv[i]); + args.build_types.push_back("BUILD_DEFAULT"); } } if ( args.geo_files.empty() ) diff --git a/UtilityApps/src/test_surfaces.cpp b/UtilityApps/src/test_surfaces.cpp index 9d626f3d15b972d7b6a24a07a1f0db85094468bf..39c30b5b8518be6928e584ac093a91836b5d1b65 100644 --- a/UtilityApps/src/test_surfaces.cpp +++ b/UtilityApps/src/test_surfaces.cpp @@ -1,3 +1,16 @@ +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +//========================================================================== + +// Framework include files #include "DD4hep/LCDD.h" #include "DDRec/Surface.h" @@ -45,7 +58,7 @@ int main(int argc, char** argv ){ #if 0 - // create a list of all surfaces in the detector: + // create a list of all surfaces in the detector: DetElement world = lcdd.world() ; SurfaceHelper surfMan( world ) ; @@ -96,7 +109,7 @@ int main(int argc, char** argv ){ std::string typeName = col->getTypeName() ; if( typeName != lcio::LCIO::SIMTRACKERHIT ) - continue ; + continue ; std::cout << " -- testing collection : " << colNames[ icol ] << std::endl ; @@ -108,90 +121,90 @@ int main(int argc, char** argv ){ for(int i=0 ; i< nHit ; ++i){ - SimTrackerHit* sHit = (SimTrackerHit*) col->getElementAt(i) ; + SimTrackerHit* sHit = (SimTrackerHit*) col->getElementAt(i) ; - DD4hep::long64 id = sHit->getCellID0() ; + DD4hep::long64 id = sHit->getCellID0() ; - idDecoder.setValue( id ) ; - // std::cout << " simhit with cellid : " << idDecoder << std::endl ; + idDecoder.setValue( id ) ; + // std::cout << " simhit with cellid : " << idDecoder << std::endl ; #if 0 - Surface* surf = surfMap[ id ] ; + Surface* surf = surfMap[ id ] ; #else - SurfaceMap::const_iterator si = surfMap.find( id ) ; - Surface* surf = ( si != surfMap.end() ? si->second : 0 ) ; + SurfaceMap::const_iterator si = surfMap.find( id ) ; + Surface* surf = ( si != surfMap.end() ? si->second : 0 ) ; #endif - std::stringstream sst ; - sst << " surface found for id : " << std::hex << id << std::dec << " " << idDecoder.valueString() << std ::endl ; + std::stringstream sst ; + sst << " surface found for id : " << std::hex << id << std::dec << " " << idDecoder.valueString() << std ::endl ; - // ===== test that we have a surface with the correct ID for every hit ====================== + // ===== test that we have a surface with the correct ID for every hit ====================== - test( surf != 0 , true , sst.str() ) ; + test( surf != 0 , true , sst.str() ) ; - if( surf != 0 ){ + if( surf != 0 ){ - // std::cout << " found surface " << *surf << std::endl ; + // std::cout << " found surface " << *surf << std::endl ; - Vector3D point( sHit->getPosition()[0]* dd4hep::mm , sHit->getPosition()[1]* dd4hep::mm , sHit->getPosition()[2]* dd4hep::mm ) ; + Vector3D point( sHit->getPosition()[0]* dd4hep::mm , sHit->getPosition()[1]* dd4hep::mm , sHit->getPosition()[2]* dd4hep::mm ) ; - double dist = surf->distance( point ) ; + double dist = surf->distance( point ) ; - bool isInside = surf->insideBounds( point ) ; + bool isInside = surf->insideBounds( point ) ; - sst.str("") ; - sst << " point " << point << " is on surface " ; + sst.str("") ; + sst << " point " << point << " is on surface " ; - // ====== test that hit points are inside their surface ================================ + // ====== test that hit points are inside their surface ================================ - test( isInside , true , sst.str() ) ; + test( isInside , true , sst.str() ) ; - if( ! isInside ) { + if( ! isInside ) { - std::cout << " found surface " << *surf << std::endl - << " id : " << idDecoder.valueString() - << " point : " << point - << " is inside : " << isInside - << " distance from surface : " << dist/dd4hep::mm << std::endl - << std::endl ; - } + std::cout << " found surface " << *surf << std::endl + << " id : " << idDecoder.valueString() + << " point : " << point + << " is inside : " << isInside + << " distance from surface : " << dist/dd4hep::mm << std::endl + << std::endl ; + } - // ====== test that slightly moved hit points are inside their surface ================================ + // ====== test that slightly moved hit points are inside their surface ================================ - Vector3D point2 = point + 1e-5 * surf->normal() ; - sst.str("") ; - sst << " point2 " << point2 << " is on surface " ; - isInside = surf->insideBounds( point2 ) ; - test( isInside , true , sst.str() ) ; + Vector3D point2 = point + 1e-5 * surf->normal() ; + sst.str("") ; + sst << " point2 " << point2 << " is on surface " ; + isInside = surf->insideBounds( point2 ) ; + test( isInside , true , sst.str() ) ; - if( ! isInside ) { + if( ! isInside ) { - std::cout << " found surface " << *surf << std::endl - << " id : " << idDecoder.valueString() - << " point : " << point - << " is inside : " << isInside - << " distance from surface : " << dist/dd4hep::mm << std::endl - << std::endl ; + std::cout << " found surface " << *surf << std::endl + << " id : " << idDecoder.valueString() + << " point : " << point + << " is inside : " << isInside + << " distance from surface : " << dist/dd4hep::mm << std::endl + << std::endl ; - } + } - // ====== test that moved hit points are outside their surface ================================ + // ====== test that moved hit points are outside their surface ================================ - Vector3D point3 = point + 1e-3 * surf->normal() ; - sst.str("") ; - sst << " point3 " << point3 << " is not on surface " ; - isInside = surf->insideBounds( point3) ; - test( isInside , false , sst.str() ) ; + Vector3D point3 = point + 1e-3 * surf->normal() ; + sst.str("") ; + sst << " point3 " << point3 << " is not on surface " ; + isInside = surf->insideBounds( point3) ; + test( isInside , false , sst.str() ) ; - } else { + } else { - std::cout << "ERROR: no surface found for id: " << idDecoder << std::endl ; - } + std::cout << "ERROR: no surface found for id: " << idDecoder << std::endl ; + } } diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp index b0959687abc60e593b1ee1b32a831183cf765f4f..4ac90e666a58b07efebfb8bde49f64e6cdb7fc75 100644 --- a/UtilityApps/src/teve_display.cpp +++ b/UtilityApps/src/teve_display.cpp @@ -1,13 +1,18 @@ -// $Id: display.cpp 590 2013-06-03 17:02:43Z markus.frank $ -//==================================================================== +// $Id: Handle.h 570 2013-05-17 07:47:11Z markus.frank $ +//========================================================================== // AIDA Detector description implementation for LCD -//-------------------------------------------------------------------- +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europ茅enne pour la Recherche nucl茅aire (CERN) +// All rights reserved. // -// Generic ROOT based geometry display program -// -// Author : M.Frank +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // -//==================================================================== +// Author : M.Frank +// +//========================================================================== + +// Framework include files #include "DD4hep/Factories.h" #include "DD4hep/LCDD.h" #include "DDRec/SurfaceHelper.h" @@ -223,7 +228,7 @@ TEveStraightLineSet* getSurfaces(int col, const SurfaceType& type) { // std::cout << " **** drawSurfaces() : draw line for surface " << lines[i].first << " - " << lines[i].second << std::endl ; ls->AddLine( lines[i].first.x(), lines[i].first.y(), lines[i].first.z(), - lines[i].second.x(), lines[i].second.y(), lines[i].second.z() ) ; + lines[i].second.x(), lines[i].second.y(), lines[i].second.z() ) ; } ls->SetLineColor( col ) ; @@ -240,41 +245,41 @@ TEveStraightLineSet* getSurfaces(int col, const SurfaceType& type) { void make_gui() { - // Create minimal GUI for event navigation. + // Create minimal GUI for event navigation. - TEveBrowser* browser = gEve->GetBrowser(); - browser->StartEmbedding(TRootBrowser::kLeft); + TEveBrowser* browser = gEve->GetBrowser(); + browser->StartEmbedding(TRootBrowser::kLeft); - TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600); - frmMain->SetWindowName("DD4hep GUI"); - frmMain->SetCleanup(kDeepCleanup); + TGMainFrame* frmMain = new TGMainFrame(gClient->GetRoot(), 1000, 600); + frmMain->SetWindowName("DD4hep GUI"); + frmMain->SetCleanup(kDeepCleanup); - TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain); - { + TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain); + { - TString icondir( Form("%s/icons/", gSystem->Getenv("ROOTSYS")) ); - TGPictureButton* b = 0; - EvNavHandler *fh = new EvNavHandler; - - b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif")); - b->SetEnabled(kFALSE); - b->SetToolTipText("Go to previous event - not supported."); - hf->AddFrame(b); - b->Connect("Clicked()", "EvNavHandler", fh, "Bck()"); - - b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif")); - b->SetToolTipText("Generate new event."); - hf->AddFrame(b); - b->Connect("Clicked()", "EvNavHandler", fh, "Fwd()"); - } - frmMain->AddFrame(hf); - - frmMain->MapSubwindows(); - frmMain->Resize(); - frmMain->MapWindow(); - - browser->StopEmbedding(); - browser->SetTabTitle("Event Control", 0); + TString icondir( Form("%s/icons/", gSystem->Getenv("ROOTSYS")) ); + TGPictureButton* b = 0; + EvNavHandler *fh = new EvNavHandler; + + b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoBack.gif")); + b->SetEnabled(kFALSE); + b->SetToolTipText("Go to previous event - not supported."); + hf->AddFrame(b); + b->Connect("Clicked()", "EvNavHandler", fh, "Bck()"); + + b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif")); + b->SetToolTipText("Generate new event."); + hf->AddFrame(b); + b->Connect("Clicked()", "EvNavHandler", fh, "Fwd()"); + } + frmMain->AddFrame(hf); + + frmMain->MapSubwindows(); + frmMain->Resize(); + frmMain->MapWindow(); + + browser->StopEmbedding(); + browser->SetTabTitle("Event Control", 0); } //===================================================================================== diff --git a/doc/CREDITS b/doc/CREDITS new file mode 100644 index 0000000000000000000000000000000000000000..f3c5cfe548eea656b2a8b55f161c8da24370f023 --- /dev/null +++ b/doc/CREDITS @@ -0,0 +1,39 @@ + +This file lists the most important contributors to the DD4hep project. +It is sorted by name and formatted to allow easy grepping and beautification +by scripts. The fields are: name (N), email (E), description (D). + +Thanks, + Markus Frank + + +PS: please let us know if you are not on this list while you should be, or + if something in your entry is incorrect. + +--------------------------------------------------------------------------- +Dependencies on other software projects: + +- ROOT see http://root.cern.ch +- Geant4 see http://geant4.cern.ch +- Boost - Spirit see http://www.boost.org +- Xerces-C see https://xerces.apache.org/xerces-c +- TinyXML see http://sourceforge.net/projects/tinyxml +- Gaudi PluginService see http://www.cern.ch/gaudi/ +--------------------------------------------------------------------------- + +N: Vanya BELYAEV +E: ibelyaev@physics.syr.edu +D: Boost Spirit adapation taken from Gaudi + +N: Markus FRANK +E: Markus.Frank@cern.ch +D: Main author of the DD4hep packages DDCore, DDG4, DDAlign, DDCond, DDEve. Project leader + +N: Frank GAEDE +E: Frank.Gaede@desy.de +D: Main author of the DD4hep package DDRec + +N. Alexander MAZUROV +E: Alexander.Mazurov@gmail.com +D: Boost Spirit adapation taken from Gaudi + diff --git a/doc/release.notes b/doc/release.notes index 8ca8c2ad963b08e3bf244eafd4686e17bd12ecbf..4d071312fbeff7d4ec090f3c400ff3324c80e449 100644 --- a/doc/release.notes +++ b/doc/release.notes @@ -3,6 +3,30 @@ DD4hep ---- Release Notes ================================= + + +2015-07-11n M.Frank +------------------- +*** Important *** + Before updating, backup your existing and working checkout. Though I was running + the basic tests, there may be unchecked corners of the software. + +Notes: + - Backwards compatibility mode for the usage of ROOT 5 and ROOT 6 alternatively. + - For ROOT 6 the Gaudi PluginService is used and added to the distribution. + - DD4hep is distributed with a licence. See $DD4hepINSTALL/LICENSE for details. + - In the doc area the $DD4hepINSTALL/doc/CREDITS file everybode should add her/his + name, if contributed significantly. + - Unfortunately this meant to add/change the headers of all files and give a + pointer to the licence file. If I accidentally changed the author name, please + chagne it back. + + - The plugin factory declaration statements were changed to accomodate both + ROOT 5 and ROOT 6 and to keep the number of 'ifdef' statements at a minimum. + + - TODO: Properly change the cmake scripts to accomodate for ROOT 6 and the + automatic switch when building DD4hep. + -------- | v00-13 | --------