diff --git a/Reconstruction/SiliconTracking/CMakeLists.txt b/Reconstruction/SiliconTracking/CMakeLists.txt index 93d860ba31a396d5797b31746788a39533698e2d..b0aefce1633b9752bdea1e9474021d096843c51f 100644 --- a/Reconstruction/SiliconTracking/CMakeLists.txt +++ b/Reconstruction/SiliconTracking/CMakeLists.txt @@ -4,6 +4,7 @@ find_package(GEAR REQUIRED) find_package(GSL REQUIRED ) find_package(LCIO REQUIRED ) find_package(EDM4HEP REQUIRED ) +find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) gaudi_depends_on_subdirs( Service/GearSvc diff --git a/Service/TrackSystemSvc/CMakeLists.txt b/Service/TrackSystemSvc/CMakeLists.txt index 98f32914f19370b83261a09ff94619532c2c67d6..9498f37728a6fae6b0dbb3fae0303b9cc905cd6d 100644 --- a/Service/TrackSystemSvc/CMakeLists.txt +++ b/Service/TrackSystemSvc/CMakeLists.txt @@ -7,6 +7,7 @@ find_package(LCIO REQUIRED) find_package(EDM4HEP REQUIRED) #find_package(KalTest REQUIRED) #find_package(KalDet REQUIRED) +find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) gaudi_depends_on_subdirs(Service/GearSvc Detector/DetInterface Utilities/DataHelper Utilities/KalTest Utilities/KalDet) diff --git a/Service/TrackSystemSvc/src/MarlinKalTest.cc b/Service/TrackSystemSvc/src/MarlinKalTest.cc index 38a4f5fc5c76b1c85827b185ee12b41ba6fe9849..0c0dde8c5a14c4663cce7ae2af288447d375bbae 100644 --- a/Service/TrackSystemSvc/src/MarlinKalTest.cc +++ b/Service/TrackSystemSvc/src/MarlinKalTest.cc @@ -128,7 +128,7 @@ namespace MarlinTrk{ bool SIT_found = false ; try{ - ILDSITKalDetector* sitdet = new ILDSITKalDetector( *_gearMgr ) ; + ILDSITKalDetector* sitdet = new ILDSITKalDetector( *_gearMgr, _geoSvc ) ; // store the measurement layer id's for the active layers this->storeActiveMeasurementModuleIDs(sitdet); _det->Install( *sitdet ) ; @@ -151,7 +151,7 @@ namespace MarlinTrk{ } try{ - ILDSETKalDetector* setdet = new ILDSETKalDetector( *_gearMgr ) ; + ILDSETKalDetector* setdet = new ILDSETKalDetector( *_gearMgr, _geoSvc ) ; // store the measurement layer id's for the active layers this->storeActiveMeasurementModuleIDs(setdet); _det->Install( *setdet ) ; @@ -163,7 +163,7 @@ namespace MarlinTrk{ bool FTD_found = false ; try{ - ILDFTDKalDetector* ftddet = new ILDFTDKalDetector( *_gearMgr ) ; + ILDFTDKalDetector* ftddet = new ILDFTDKalDetector( *_gearMgr, _geoSvc ) ; // store the measurement layer id's for the active layers this->storeActiveMeasurementModuleIDs(ftddet); _det->Install( *ftddet ) ; @@ -186,7 +186,7 @@ namespace MarlinTrk{ } try{ - ILDTPCKalDetector* tpcdet = new ILDTPCKalDetector( *_gearMgr ) ; + ILDTPCKalDetector* tpcdet = new ILDTPCKalDetector( *_gearMgr, _geoSvc ) ; // store the measurement layer id's for the active layers this->storeActiveMeasurementModuleIDs(tpcdet); _det->Install( *tpcdet ) ; diff --git a/Service/TrackSystemSvc/src/MarlinKalTestTrack.cc b/Service/TrackSystemSvc/src/MarlinKalTestTrack.cc index 6a4ec5925048849ee2048de91c2a4cf518ae1805..9f83748cb7a7df9fa1477ca20df7bbb1bc11a7cc 100644 --- a/Service/TrackSystemSvc/src/MarlinKalTestTrack.cc +++ b/Service/TrackSystemSvc/src/MarlinKalTestTrack.cc @@ -122,7 +122,7 @@ namespace MarlinTrk { return this->addHit( trkhit, ml->ConvertLCIOTrkHit(trkhit), ml) ; } else { - std::cout << "MarlinKalTestTrack::addHit: trkhit = " << trkhit.id() << " addr: " << trkhit << " ml = " << ml << std::endl ; + //std::cout << "MarlinKalTestTrack::addHit: trkhit = " << trkhit.id() << " addr: " << trkhit << " ml = " << ml << std::endl ; //streamlog_out( ERROR ) << " MarlinKalTestTrack::addHit - bad inputs " << trkhit << " ml : " << ml << std::endl ; return bad_intputs ; } @@ -609,6 +609,7 @@ namespace MarlinTrk { // get the measurement layer of the current hit const ILDVMeasLayer* ml = dynamic_cast<const ILDVMeasLayer*>( &(kalhit->GetMeasLayer() ) ) ; TVector3 pos = ml->HitToXv(*kalhit); + /* std::cout << "debug: Kaltrack::addAndFit : site discarded! at index : " << ml->GetIndex() << " for type " << ml->GetName() << " chi2increment = " << chi2increment @@ -623,8 +624,8 @@ namespace MarlinTrk { << dynamic_cast<const ILDVMeasLayer*>( &(kalhit->GetMeasLayer() ) )->getCellIDs()[i] << std::endl ; } + */ - #ifdef MARLINTRK_DIAGNOSTICS_ON _ktest->_diagnostics.record_rejected_site(kalhit, temp_site); #endif diff --git a/Utilities/KalDet/CMakeLists.txt b/Utilities/KalDet/CMakeLists.txt index 5b4c1a9456ba59044d7d293cc6ceb7549687787d..241b66d2e3811355fd3c4abefa716d14ed0ad2b9 100644 --- a/Utilities/KalDet/CMakeLists.txt +++ b/Utilities/KalDet/CMakeLists.txt @@ -10,6 +10,7 @@ find_package(LCIO) find_package(GEAR) find_package(ROOT COMPONENTS MathCore) find_package(EDM4HEP REQUIRED) +find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) gaudi_depends_on_subdirs( Detector/DetInterface @@ -76,5 +77,5 @@ set( KalDetLib_srcs ${LIB_SOURCES} ${COMMON_SOURCES} ) gaudi_add_library(KalDetLib ${KalDetLib_srcs} PUBLIC_HEADERS kaldet - LINK_LIBRARIES GaudiKernel ROOT CLHEP LCIO $ENV{GEAR}/lib/libgearsurf.so KalTestLib EDM4HEP::edm4hep EDM4HEP::edm4hepDict + LINK_LIBRARIES GaudiKernel ROOT CLHEP LCIO $ENV{GEAR}/lib/libgearsurf.so KalTestLib EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${DD4hep_COMPONENT_LIBRARIES} ) diff --git a/Utilities/KalDet/kaldet/ILDFTDKalDetector.h b/Utilities/KalDet/kaldet/ILDFTDKalDetector.h index 36cf54b8e5a889a09431635740c3e2c3035d6d6a..80d348a8a58a6b916d8e7f901099a3129d5bb1e6 100644 --- a/Utilities/KalDet/kaldet/ILDFTDKalDetector.h +++ b/Utilities/KalDet/kaldet/ILDFTDKalDetector.h @@ -11,6 +11,7 @@ class TNode; class TVector3; +class IGeoSvc; namespace gear{ class GearMgr ; @@ -21,7 +22,7 @@ class ILDFTDKalDetector : public TVKalDetector { public: /** Initialize the FTD from GEAR */ - ILDFTDKalDetector( const gear::GearMgr& gearMgr ); + ILDFTDKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ); private: diff --git a/Utilities/KalDet/kaldet/ILDSETKalDetector.h b/Utilities/KalDet/kaldet/ILDSETKalDetector.h index 9327aa8a065e8ff6243df53193df544e37389381..6c434cba9d28ee3c89c9d5dbec35dc442eef8789 100644 --- a/Utilities/KalDet/kaldet/ILDSETKalDetector.h +++ b/Utilities/KalDet/kaldet/ILDSETKalDetector.h @@ -16,18 +16,20 @@ namespace gear{ class GearMgr ; } +class IGeoSvc; class ILDSETKalDetector : public TVKalDetector { public: /** Initialize the SET from GEAR */ - ILDSETKalDetector( const gear::GearMgr& gearMgr ); + ILDSETKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc=0 ); private: void setupGearGeom( const gear::GearMgr& gearMgr ) ; + void setupGearGeom( IGeoSvc* geoSvc ); int _nLayers ; double _bZ ; diff --git a/Utilities/KalDet/kaldet/ILDSITKalDetector.h b/Utilities/KalDet/kaldet/ILDSITKalDetector.h index 639e1b27bb76512ad05c8570814b218a9480cb5b..d9eb3059b680eb16823cef7de3b315659c056272 100644 --- a/Utilities/KalDet/kaldet/ILDSITKalDetector.h +++ b/Utilities/KalDet/kaldet/ILDSITKalDetector.h @@ -16,18 +16,20 @@ namespace gear{ class GearMgr ; } +class IGeoSvc; class ILDSITKalDetector : public TVKalDetector { public: /** Initialize the SIT from GEAR */ - ILDSITKalDetector( const gear::GearMgr& gearMgr ); + ILDSITKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ); private: void setupGearGeom( const gear::GearMgr& gearMgr ) ; + void setupGearGeom( IGeoSvc* geoSvc ); int _nLayers ; double _bZ ; diff --git a/Utilities/KalDet/kaldet/ILDTPCKalDetector.h b/Utilities/KalDet/kaldet/ILDTPCKalDetector.h index e5ab8db97c723357f2fbd8e964ab319ec7102ca6..a249f22ce1a7133dc88135ec233c785b54d777b7 100644 --- a/Utilities/KalDet/kaldet/ILDTPCKalDetector.h +++ b/Utilities/KalDet/kaldet/ILDTPCKalDetector.h @@ -14,12 +14,13 @@ namespace gear{ class GearMgr ; } +class IGeoSvc; class ILDTPCKalDetector : public TVKalDetector { public: /** Initialize the TPC from GEAR */ - ILDTPCKalDetector( const gear::GearMgr& gearMgr ); + ILDTPCKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc=0 ); private: diff --git a/Utilities/KalDet/rootdict/gen.cxx b/Utilities/KalDet/rootdict/gen.cxx new file mode 100644 index 0000000000000000000000000000000000000000..982c8a36c9b6b622c0c47885b732e2206b896af3 --- /dev/null +++ b/Utilities/KalDet/rootdict/gen.cxx @@ -0,0 +1,188 @@ +// Do NOT change. Changes will be lost next time file is generated + +#define R__DICTIONARY_FILENAME dIcefsdIhiggsdIfucddIKey4hepdICEPCSWdIUtilitiesdIKalDetdIrootdictdIgen +#define R__NO_DEPRECATION + +/*******************************************************************/ +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#define G__DICTIONARY +#include "RConfig.h" +#include "TClass.h" +#include "TDictAttributeMap.h" +#include "TInterpreter.h" +#include "TROOT.h" +#include "TBuffer.h" +#include "TMemberInspector.h" +#include "TInterpreter.h" +#include "TVirtualMutex.h" +#include "TError.h" + +#ifndef G__ROOT +#define G__ROOT +#endif + +#include "RtypesImp.h" +#include "TIsAProxy.h" +#include "TFileMergeInfo.h" +#include <algorithm> +#include "TCollectionProxyInfo.h" +/*******************************************************************/ + +#include "TDataMember.h" + +// The generated code does not explicitly qualifies STL entities +namespace std {} using namespace std; + +// Header files passed as explicit arguments +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/gen/EXEventGen.h" + +// Header files passed via #pragma extra_include + +namespace ROOT { + static TClass *EXEventGen_Dictionary(); + static void EXEventGen_TClassManip(TClass*); + static void delete_EXEventGen(void *p); + static void deleteArray_EXEventGen(void *p); + static void destruct_EXEventGen(void *p); + + // Function generating the singleton type initializer + static TGenericClassInfo *GenerateInitInstanceLocal(const ::EXEventGen*) + { + ::EXEventGen *ptr = 0; + static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(::EXEventGen)); + static ::ROOT::TGenericClassInfo + instance("EXEventGen", "", 13, + typeid(::EXEventGen), ::ROOT::Internal::DefineBehavior(ptr, ptr), + &EXEventGen_Dictionary, isa_proxy, 4, + sizeof(::EXEventGen) ); + instance.SetDelete(&delete_EXEventGen); + instance.SetDeleteArray(&deleteArray_EXEventGen); + instance.SetDestructor(&destruct_EXEventGen); + return &instance; + } + TGenericClassInfo *GenerateInitInstance(const ::EXEventGen*) + { + return GenerateInitInstanceLocal((::EXEventGen*)0); + } + // Static variable to force the class initialization + static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::EXEventGen*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init)); + + // Dictionary for non-ClassDef classes + static TClass *EXEventGen_Dictionary() { + TClass* theClass =::ROOT::GenerateInitInstanceLocal((const ::EXEventGen*)0x0)->GetClass(); + EXEventGen_TClassManip(theClass); + return theClass; + } + + static void EXEventGen_TClassManip(TClass* ){ + } + +} // end of namespace ROOT + +namespace ROOT { + // Wrapper around operator delete + static void delete_EXEventGen(void *p) { + delete ((::EXEventGen*)p); + } + static void deleteArray_EXEventGen(void *p) { + delete [] ((::EXEventGen*)p); + } + static void destruct_EXEventGen(void *p) { + typedef ::EXEventGen current_t; + ((current_t*)p)->~current_t(); + } +} // end of namespace ROOT for class ::EXEventGen + +namespace { + void TriggerDictionaryInitialization_gen_Impl() { + static const char* headers[] = { +"0", +0 + }; + static const char* includePaths[] = { +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalTest", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/gen", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/kern", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC", +"/cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/include/", +"/cefs/higgs/fucd/Key4hep/CEPCSW/build/Utilities/KalDet/", +0 + }; + static const char* fwdDeclCode = R"DICTFWDDCLS( +#line 1 "gen dictionary forward declarations' payload" +#pragma clang diagnostic ignored "-Wkeyword-compat" +#pragma clang diagnostic ignored "-Wignored-attributes" +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +extern int __Cling_Autoloading_Map; +class EXEventGen; +)DICTFWDDCLS"; + static const char* payloadCode = R"DICTPAYLOAD( +#line 1 "gen dictionary payload" + +#ifndef HANDLE_DICT_EXCEPTIONS + #define HANDLE_DICT_EXCEPTIONS IGNORED_FOR_CINT +#endif + +#define _BACKWARD_BACKWARD_WARNING_H +// Inline headers +#ifndef __EXEVENTGEN__ +#define __EXEVENTGEN__ + +#include "kaltest/TKalDetCradle.h" +#include "kaltest/THelicalTrack.h" +#include "TMath.h" + +class EXEventGen { +public: + EXEventGen(TKalDetCradle const &cradle, TObjArray &kalhits) + : fCradlePtr(&cradle), fHitBufPtr(&kalhits) {} + virtual ~EXEventGen() {} + + THelicalTrack GenerateHelix(Double_t pt, + Double_t cosmin, + Double_t cosmax, + Double_t phimin=0., + Double_t phimax=2*TMath::Pi(), + TVector3 xv0=TVector3(0.,0.,0.)); + void Swim(THelicalTrack &heltrk); + + static void SetT0(Double_t t0) { fgT0 = t0; } + static Double_t GetT0() { return fgT0; } + +private: + TKalDetCradle const *fCradlePtr; // pointer to detector system + TObjArray *fHitBufPtr; // pointer to hit array + + static Double_t fgT0; // t0 + +}; + +#endif + +#undef _BACKWARD_BACKWARD_WARNING_H +)DICTPAYLOAD"; + static const char* classesHeaders[] = { +"EXEventGen", payloadCode, "@", +nullptr +}; + static bool isInitialized = false; + if (!isInitialized) { + TROOT::RegisterModule("gen", + headers, includePaths, payloadCode, fwdDeclCode, + TriggerDictionaryInitialization_gen_Impl, {}, classesHeaders, /*hasCxxModule*/false); + isInitialized = true; + } + } + static struct DictInit { + DictInit() { + TriggerDictionaryInitialization_gen_Impl(); + } + } __TheDictionaryInitializer; +} +void TriggerDictionaryInitialization_gen() { + TriggerDictionaryInitialization_gen_Impl(); +} diff --git a/Utilities/KalDet/rootdict/gen_rdict.pcm b/Utilities/KalDet/rootdict/gen_rdict.pcm new file mode 100644 index 0000000000000000000000000000000000000000..bdc7c539c3a36a9eab430b217935facc01a96adc Binary files /dev/null and b/Utilities/KalDet/rootdict/gen_rdict.pcm differ diff --git a/Utilities/KalDet/rootdict/kern.cxx b/Utilities/KalDet/rootdict/kern.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fadf290e4dff92f959ef9e987b97308da3e84d98 --- /dev/null +++ b/Utilities/KalDet/rootdict/kern.cxx @@ -0,0 +1,415 @@ +// Do NOT change. Changes will be lost next time file is generated + +#define R__DICTIONARY_FILENAME dIcefsdIhiggsdIfucddIKey4hepdICEPCSWdIUtilitiesdIKalDetdIrootdictdIkern +#define R__NO_DEPRECATION + +/*******************************************************************/ +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#define G__DICTIONARY +#include "RConfig.h" +#include "TClass.h" +#include "TDictAttributeMap.h" +#include "TInterpreter.h" +#include "TROOT.h" +#include "TBuffer.h" +#include "TMemberInspector.h" +#include "TInterpreter.h" +#include "TVirtualMutex.h" +#include "TError.h" + +#ifndef G__ROOT +#define G__ROOT +#endif + +#include "RtypesImp.h" +#include "TIsAProxy.h" +#include "TFileMergeInfo.h" +#include <algorithm> +#include "TCollectionProxyInfo.h" +/*******************************************************************/ + +#include "TDataMember.h" + +// The generated code does not explicitly qualifies STL entities +namespace std {} using namespace std; + +// Header files passed as explicit arguments +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/kern/EXVKalDetector.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/kern/EXVMeasLayer.h" + +// Header files passed via #pragma extra_include + +namespace ROOT { + static void delete_EXVKalDetector(void *p); + static void deleteArray_EXVKalDetector(void *p); + static void destruct_EXVKalDetector(void *p); + static Long64_t merge_EXVKalDetector(void *obj, TCollection *coll,TFileMergeInfo *info); + + // Function generating the singleton type initializer + static TGenericClassInfo *GenerateInitInstanceLocal(const ::EXVKalDetector*) + { + ::EXVKalDetector *ptr = 0; + static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::EXVKalDetector >(0); + static ::ROOT::TGenericClassInfo + instance("EXVKalDetector", ::EXVKalDetector::Class_Version(), "", 43, + typeid(::EXVKalDetector), ::ROOT::Internal::DefineBehavior(ptr, ptr), + &::EXVKalDetector::Dictionary, isa_proxy, 4, + sizeof(::EXVKalDetector) ); + instance.SetDelete(&delete_EXVKalDetector); + instance.SetDeleteArray(&deleteArray_EXVKalDetector); + instance.SetDestructor(&destruct_EXVKalDetector); + instance.SetMerge(&merge_EXVKalDetector); + return &instance; + } + TGenericClassInfo *GenerateInitInstance(const ::EXVKalDetector*) + { + return GenerateInitInstanceLocal((::EXVKalDetector*)0); + } + // Static variable to force the class initialization + static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::EXVKalDetector*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init)); +} // end of namespace ROOT + +namespace ROOT { + static void delete_EXVMeasLayer(void *p); + static void deleteArray_EXVMeasLayer(void *p); + static void destruct_EXVMeasLayer(void *p); + + // Function generating the singleton type initializer + static TGenericClassInfo *GenerateInitInstanceLocal(const ::EXVMeasLayer*) + { + ::EXVMeasLayer *ptr = 0; + static ::TVirtualIsAProxy* isa_proxy = new ::TInstrumentedIsAProxy< ::EXVMeasLayer >(0); + static ::ROOT::TGenericClassInfo + instance("EXVMeasLayer", ::EXVMeasLayer::Class_Version(), "", 106, + typeid(::EXVMeasLayer), ::ROOT::Internal::DefineBehavior(ptr, ptr), + &::EXVMeasLayer::Dictionary, isa_proxy, 4, + sizeof(::EXVMeasLayer) ); + instance.SetDelete(&delete_EXVMeasLayer); + instance.SetDeleteArray(&deleteArray_EXVMeasLayer); + instance.SetDestructor(&destruct_EXVMeasLayer); + return &instance; + } + TGenericClassInfo *GenerateInitInstance(const ::EXVMeasLayer*) + { + return GenerateInitInstanceLocal((::EXVMeasLayer*)0); + } + // Static variable to force the class initialization + static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::EXVMeasLayer*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init)); +} // end of namespace ROOT + +//______________________________________________________________________________ +atomic_TClass_ptr EXVKalDetector::fgIsA(0); // static to hold class pointer + +//______________________________________________________________________________ +const char *EXVKalDetector::Class_Name() +{ + return "EXVKalDetector"; +} + +//______________________________________________________________________________ +const char *EXVKalDetector::ImplFileName() +{ + return ::ROOT::GenerateInitInstanceLocal((const ::EXVKalDetector*)0x0)->GetImplFileName(); +} + +//______________________________________________________________________________ +int EXVKalDetector::ImplFileLine() +{ + return ::ROOT::GenerateInitInstanceLocal((const ::EXVKalDetector*)0x0)->GetImplFileLine(); +} + +//______________________________________________________________________________ +TClass *EXVKalDetector::Dictionary() +{ + fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::EXVKalDetector*)0x0)->GetClass(); + return fgIsA; +} + +//______________________________________________________________________________ +TClass *EXVKalDetector::Class() +{ + if (!fgIsA.load()) { R__LOCKGUARD(gInterpreterMutex); fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::EXVKalDetector*)0x0)->GetClass(); } + return fgIsA; +} + +//______________________________________________________________________________ +atomic_TClass_ptr EXVMeasLayer::fgIsA(0); // static to hold class pointer + +//______________________________________________________________________________ +const char *EXVMeasLayer::Class_Name() +{ + return "EXVMeasLayer"; +} + +//______________________________________________________________________________ +const char *EXVMeasLayer::ImplFileName() +{ + return ::ROOT::GenerateInitInstanceLocal((const ::EXVMeasLayer*)0x0)->GetImplFileName(); +} + +//______________________________________________________________________________ +int EXVMeasLayer::ImplFileLine() +{ + return ::ROOT::GenerateInitInstanceLocal((const ::EXVMeasLayer*)0x0)->GetImplFileLine(); +} + +//______________________________________________________________________________ +TClass *EXVMeasLayer::Dictionary() +{ + fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::EXVMeasLayer*)0x0)->GetClass(); + return fgIsA; +} + +//______________________________________________________________________________ +TClass *EXVMeasLayer::Class() +{ + if (!fgIsA.load()) { R__LOCKGUARD(gInterpreterMutex); fgIsA = ::ROOT::GenerateInitInstanceLocal((const ::EXVMeasLayer*)0x0)->GetClass(); } + return fgIsA; +} + +//______________________________________________________________________________ +void EXVKalDetector::Streamer(TBuffer &R__b) +{ + // Stream an object of class EXVKalDetector. + + if (R__b.IsReading()) { + R__b.ReadClassBuffer(EXVKalDetector::Class(),this); + } else { + R__b.WriteClassBuffer(EXVKalDetector::Class(),this); + } +} + +namespace ROOT { + // Wrapper around operator delete + static void delete_EXVKalDetector(void *p) { + delete ((::EXVKalDetector*)p); + } + static void deleteArray_EXVKalDetector(void *p) { + delete [] ((::EXVKalDetector*)p); + } + static void destruct_EXVKalDetector(void *p) { + typedef ::EXVKalDetector current_t; + ((current_t*)p)->~current_t(); + } + // Wrapper around the merge function. + static Long64_t merge_EXVKalDetector(void *obj,TCollection *coll,TFileMergeInfo *) { + return ((::EXVKalDetector*)obj)->Merge(coll); + } +} // end of namespace ROOT for class ::EXVKalDetector + +//______________________________________________________________________________ +void EXVMeasLayer::Streamer(TBuffer &R__b) +{ + // Stream an object of class EXVMeasLayer. + + if (R__b.IsReading()) { + R__b.ReadClassBuffer(EXVMeasLayer::Class(),this); + } else { + R__b.WriteClassBuffer(EXVMeasLayer::Class(),this); + } +} + +namespace ROOT { + // Wrapper around operator delete + static void delete_EXVMeasLayer(void *p) { + delete ((::EXVMeasLayer*)p); + } + static void deleteArray_EXVMeasLayer(void *p) { + delete [] ((::EXVMeasLayer*)p); + } + static void destruct_EXVMeasLayer(void *p) { + typedef ::EXVMeasLayer current_t; + ((current_t*)p)->~current_t(); + } +} // end of namespace ROOT for class ::EXVMeasLayer + +namespace { + void TriggerDictionaryInitialization_kern_Impl() { + static const char* headers[] = { +"0", +0 + }; + static const char* includePaths[] = { +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalTest", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/gen", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/kern", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC", +"/cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/include/", +"/cefs/higgs/fucd/Key4hep/CEPCSW/build/Utilities/KalDet/", +0 + }; + static const char* fwdDeclCode = R"DICTFWDDCLS( +#line 1 "kern dictionary forward declarations' payload" +#pragma clang diagnostic ignored "-Wkeyword-compat" +#pragma clang diagnostic ignored "-Wignored-attributes" +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +extern int __Cling_Autoloading_Map; +class __attribute__((annotate(R"ATTRDUMP(Abstract measurement layer class)ATTRDUMP"))) EXVKalDetector; +class __attribute__((annotate(R"ATTRDUMP(Abstract measurement layer class)ATTRDUMP"))) EXVMeasLayer; +)DICTFWDDCLS"; + static const char* payloadCode = R"DICTPAYLOAD( +#line 1 "kern dictionary payload" + +#ifndef HANDLE_DICT_EXCEPTIONS + #define HANDLE_DICT_EXCEPTIONS IGNORED_FOR_CINT +#endif + +#define _BACKWARD_BACKWARD_WARNING_H +// Inline headers +#ifndef EXVKALDETECTOR_H +#define EXVKALDETECTOR_H +//************************************************************************* +//* ====================== +//* EXVKalDetector Class +//* ====================== +//* +//* (Description) +//* Abstract detector class for Kalman filter +//* (Requires) +//* TVKalDetector +//* (Provides) +//* class EXVKalDetector +//* (Update Recored) +//* 2009/11/23 K.Ikematsu Derived from KalTest/examples/kaltest/ +//* hybrid/kern/EXVKalDetector.h +//* +//* $Id: EXVKalDetector.h,v 1.1.1.1 2009-11-24 00:13:59 ikematsu Exp $ +//************************************************************************* +// +#include <TVector3.h> +#include <kaltest/TVKalDetector.h> +#include <kaltest/TAttDrawable.h> + +class TNode; + +/** + * Base class to make a detector drawable, add a magnetic field, + * a power switch (whatever the use may be). + * + * Killenb: I removed the TAttDrawable for the moment. The TNode pointer + * stuff and the implementation of Draw belong to the TAttDrawable anyway. So if + * the drawability is needed move it to TAttDrawable and just inherit from it. + * + * \deprecated EXVKalDetector + */ +//class EXVKalDetector : public TVKalDetector, public TAttDrawable { +class EXVKalDetector : public TVKalDetector { + +public: + EXVKalDetector(Double_t bField, Int_t m = 100); + virtual ~EXVKalDetector(); + + /// Return whether the power is on. Currently hard coded to true. + inline virtual Bool_t IsPowerOn() const { return true; } + + /// Turn the power on. Currently ignored. + inline virtual void PowerOn () { fIsPowerOn = kTRUE; } + + /// Turn the power off. Currently ignored. + inline virtual void PowerOff () { fIsPowerOn = kFALSE; } + + /// Returns a single double value with a 3D point as an input. + /// Completely unphysical interface. Either the magnetic field varies with the position, + /// in which case you need a three-dimensional return value, or B can be desrcibed as single + /// value, which means it is homogeneous and thus indepenent from the position. + /// Currently it does the only reasonable thing: It ignores the argument and returns the + /// constant value given in the constructor. + virtual Double_t GetBfield (const TVector3 &xx = TVector3(0.,0.,0.)) const + { return fBfield; } + +protected: + Bool_t fIsPowerOn; // power status + Double_t fBfield; // magnetic field [T] + + ClassDef(EXVKalDetector, 1) // Abstract measurement layer class +}; +#endif +#ifndef EXVMEASLAYER_H +#define EXVMEASLAYER_H +//************************************************************************* +//* ==================== +//* EXVMeasLayer Class +//* ==================== +//* +//* (Description) +//* Abstract measurement layer class used by TVTrackHit +//* (Requires) +//* TVMeasLayer +//* (Provides) +//* class EXVMeasLayer +//* (Update Recored) +//* 2009/11/23 K.Ikematsu Derived from KalTest/examples/kaltest/ +//* hybrid/kern/EXVMeasLayer.h +//* +//* $Id: EXVMeasLayer.h,v 1.1.1.1 2009-11-24 00:13:59 ikematsu Exp $ +//************************************************************************* +// +#include <TVector3.h> +#include <kaltest/TKalMatrix.h> +#include <kaltest/TCylinder.h> +#include <kaltest/TVMeasLayer.h> +#include <kaltest/TAttDrawable.h> +#include <kaltest/KalTrackDim.h> +#include <TString.h> + +class TVTrackHit; +#include <TNode.h> + +class EXVMeasLayer : public TVMeasLayer, public TAttDrawable { + +public: + static Bool_t kActive; + static Bool_t kDummy; + + // Ctors and Dtor + + EXVMeasLayer(TMaterial &min, + TMaterial &mout, + Bool_t type = EXVMeasLayer::kActive, + const Char_t *name = "MeasL"); + virtual ~EXVMeasLayer(); + + virtual void ProcessHit(const TVector3 &xx, + TObjArray &hits) const = 0; + + inline TString GetMLName () const { return fName; } + inline TNode *GetNodePtr() const { return fNodePtr; } + + inline void SetNodePtr(TNode *nodep) { fNodePtr = nodep; } + +private: + TString fName; // layer name + TNode *fNodePtr; // node pointer + + ClassDef(EXVMeasLayer, 1) // Abstract measurement layer class +}; +#endif + +#undef _BACKWARD_BACKWARD_WARNING_H +)DICTPAYLOAD"; + static const char* classesHeaders[] = { +"EXVKalDetector", payloadCode, "@", +"EXVMeasLayer", payloadCode, "@", +nullptr +}; + static bool isInitialized = false; + if (!isInitialized) { + TROOT::RegisterModule("kern", + headers, includePaths, payloadCode, fwdDeclCode, + TriggerDictionaryInitialization_kern_Impl, {}, classesHeaders, /*hasCxxModule*/false); + isInitialized = true; + } + } + static struct DictInit { + DictInit() { + TriggerDictionaryInitialization_kern_Impl(); + } + } __TheDictionaryInitializer; +} +void TriggerDictionaryInitialization_kern() { + TriggerDictionaryInitialization_kern_Impl(); +} diff --git a/Utilities/KalDet/rootdict/kern_rdict.pcm b/Utilities/KalDet/rootdict/kern_rdict.pcm new file mode 100644 index 0000000000000000000000000000000000000000..2d88c03c21a32433e114a6356fa91325f17174b8 Binary files /dev/null and b/Utilities/KalDet/rootdict/kern_rdict.pcm differ diff --git a/Utilities/KalDet/rootdict/lctpc_gearTPC.cxx b/Utilities/KalDet/rootdict/lctpc_gearTPC.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ec4b7ea747b06c0220ed675689e93ebbc51ec324 --- /dev/null +++ b/Utilities/KalDet/rootdict/lctpc_gearTPC.cxx @@ -0,0 +1,767 @@ +// Do NOT change. Changes will be lost next time file is generated + +#define R__DICTIONARY_FILENAME dIcefsdIhiggsdIfucddIKey4hepdICEPCSWdIUtilitiesdIKalDetdIrootdictdIlctpc_gearTPC +#define R__NO_DEPRECATION + +/*******************************************************************/ +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#define G__DICTIONARY +#include "RConfig.h" +#include "TClass.h" +#include "TDictAttributeMap.h" +#include "TInterpreter.h" +#include "TROOT.h" +#include "TBuffer.h" +#include "TMemberInspector.h" +#include "TInterpreter.h" +#include "TVirtualMutex.h" +#include "TError.h" + +#ifndef G__ROOT +#define G__ROOT +#endif + +#include "RtypesImp.h" +#include "TIsAProxy.h" +#include "TFileMergeInfo.h" +#include <algorithm> +#include "TCollectionProxyInfo.h" +/*******************************************************************/ + +#include "TDataMember.h" + +// The generated code does not explicitly qualifies STL entities +namespace std {} using namespace std; + +// Header files passed as explicit arguments +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/EXTPCHit.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/EXTPCKalDetector.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/EXTPCMeasLayer.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/GearTPCCylinderHit.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/GearTPCCylinderMeasLayer.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/GearTPCHit.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/GearTPCKalDetector.h" +#include "/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC/GearTPCMeasLayer.h" + +// Header files passed via #pragma extra_include + +namespace { + void TriggerDictionaryInitialization_lctpc_gearTPC_Impl() { + static const char* headers[] = { +"0", +0 + }; + static const char* includePaths[] = { +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalTest", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/gen", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/kern", +"/cefs/higgs/fucd/Key4hep/CEPCSW/Utilities/KalDet/src/lctpc/gearTPC", +"/cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/include/", +"/cefs/higgs/fucd/Key4hep/CEPCSW/build/Utilities/KalDet/", +0 + }; + static const char* fwdDeclCode = R"DICTFWDDCLS( +#line 1 "lctpc_gearTPC dictionary forward declarations' payload" +#pragma clang diagnostic ignored "-Wkeyword-compat" +#pragma clang diagnostic ignored "-Wignored-attributes" +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +extern int __Cling_Autoloading_Map; +)DICTFWDDCLS"; + static const char* payloadCode = R"DICTPAYLOAD( +#line 1 "lctpc_gearTPC dictionary payload" + +#ifndef HANDLE_DICT_EXCEPTIONS + #define HANDLE_DICT_EXCEPTIONS IGNORED_FOR_CINT +#endif + +#define _BACKWARD_BACKWARD_WARNING_H +// Inline headers +#ifndef LCTPC_EXTPCHIT_H +#define LCTPC_EXTPCHIT_H + +#include "GearTPCCylinderHit.h" +#include <kaltest/TVMeasLayer.h> + +/** + * A backward compatibility class for GearTPCCylinderHit. + * Do not use this in new code, but use GearTPCCylinderHit directly. + * This class extends the GearTPCCylinderHit by a side, which is never used anywhere. + * + * \deprecated EXTPCHit + */ + +class EXTPCHit : public kaldet::GearTPCCylinderHit +{ + public: + /// The default constructor. + EXTPCHit(Int_t m = kMdim); + + /// Constructor initialising the original hit as 3D coordinates. + EXTPCHit(const TVMeasLayer &ms, + Double_t *x, + Double_t *dx, + Int_t side, + Double_t v, + const TVector3 &xx, + Double_t b, + Int_t m = kMdim); + + /// Constructor initialising the original hit with a reference pointer. + EXTPCHit(const TVMeasLayer &ms, + Double_t *x, + Double_t *dx, + Int_t side, + Double_t v, + const void *hitp, + Double_t b, + Int_t m = kMdim); + + /// The destructor. + virtual ~EXTPCHit(); + + /// Get the side value which has been set in the constructor. + inline Int_t GetSide () const { return fSide; } + + private: + Int_t fSide; /// (-1, +1) = (-z side, +z side) + + // ClassDef(EXTPCHit, 1) // EXTPC hit class + +}; + +#endif // LCTPC_EXTPCHIT_H +#ifndef LCTPC_EXTPCKALDETECTOR_H +#define LCTPC_EXTPCKALDETECTOR_H + +#include "GearTPCKalDetector.h" + +/** + * A backward compatibility class for GearTPCKalDetector. + * It basically provides a static instance of the detector which can be + * accessed via the GetInstance() method. + * In addition it provides the static GetVDrift() and GetBField(), which are used + * in the old code. The use of this class is highly depreciated. + * + * \deprecated EXTPCKalDetector + */ + +class EXTPCKalDetector: public kaldet::GearTPCKalDetector +{ + private: + /// As this this a singleton class the constructor is private. + EXTPCKalDetector(const gear::GearMgr& gearMgr); + +public: + /// The destructor. + virtual ~EXTPCKalDetector(); + + /// Static access function to the singleton instance. + static EXTPCKalDetector * GetInstance(); + + /// Returns the hard coded drift velocity of 76.e-3 mm/ns. + static Double_t GetVdrift() { return fgVdrift; } + + /// Static function to access the magnetic field. + static Double_t GetBfield(); + + private: + static Double_t fgVdrift; //< The drift velocity. + static EXTPCKalDetector * fgInstance; //< The singleton pointer. + + Double_t fBField; //< The magnetic field + + // ClassDef(EXTPCKalDetector, 1) // User defined detector class + +}; + +#endif // LCTPC_EXTPCKALDETECTOR_H +#ifndef LCTPC_EXTPCMEASLAYER_H +#define LCTPC_EXTPCMEASLAYER_H + +#include "GearTPCMeasLayer.h" +#include <kaltest/TCylinder.h> + +/** + * A backward compatibility class for GearTPCCylinderMeasLayer. + * It introduces one module and one row, which are associated to the layer. + * This is deprecated, the GearTPCCylinderMeasLayer provides an assiciation of several + * module-row pairs to the layer. + + * This class is an intermediate inheritance class so a GearTPCCylinderMeasLayer can be + * instantiated (as should be in the current code) and the old code can cast the + * TObject pointer, which is delivered by the detector cradle, to an EXTPCMeasLayer. + * + * \attention Do not use any of these function in new code. All new code should still run + * after this class has been removed from the ineritance chain. + * + * \deprecated EXTPCMeasLayer + */ +class EXTPCMeasLayer : public kaldet::GearTPCMeasLayer, public TCylinder +{ + +public: + /// Minimal constructor for this (partially) virtual class. + EXTPCMeasLayer(TMaterial &min, + TMaterial &mout, + Int_t module, + Int_t row, + Double_t r0, + Double_t lhalf, + TVector3 xc, + Bool_t isPerfect, + Bool_t isActive, + Double_t sigmaX0 = 0., //< the constant part of sigmaX + Double_t sigmaX1 = 0., //< the z-dependent part of sigmaX + Double_t sigmaZ0 = 0., //< the constant part of sigmaZ + Double_t sigmaZ1 = 0.); //< the z-dependent part of sigmaZ + + /// The destructor. + virtual ~EXTPCMeasLayer(); + + /** + * Get the module associated with this layer (deprecated). + * \attention Do not programme against this when using the GearTPC interface. + * This is for backward compatibility only!!! + */ + Int_t GetModuleID() const; + + /** + * Get the layer ID (i.\ e.\ row in the module) associated with this Kalman layer (deprecated). + * + * \attention Do not programme against this when using the GearTPC interface. + * This is for backward compatibility only!!! + */ + Int_t GetLayerID () const; + + /** Deprecated XvToMv which in addition to the position takes a side. + * Side is ignored and XvToMv without the side is called. + * \attention Do not programme against this when using the GearTPC interface. + * This is for backward compatibility only!!! + */ + TKalMatrix XvToMv(const TVector3 &xv, Int_t side) const; + + /** The fully virtual declaration of XvToMv. It is called within the version which also takes + * the side argument, but is implemented in GearTPCCylinderMeasLayer. + */ + virtual TKalMatrix XvToMv(const TVector3 &xv) const = 0; + + /** Smear the incoming hit in the layes measurement surface and place the result into the TObjArray + * which is given as argument. + * From a design point of view this function should not be in the detector class but in a + * simulation extension. It is only put in for compatibility reasons. + * \attention Do not programme against this when using the GearTPC interface. + * This is for backward compatibility only!!! + */ + virtual void ProcessHit(const TVector3 &xx, TObjArray &hits) const; + + //ClassDef(EXTPCMeasLayer, 1) // User defined measurement layer class +}; + +#endif // LCTPC_EXTPCMEASLAYER_H +#ifndef GEARTPCCYLINDERHIT_H +#define GEARTPCCYLINDERHIT_H + +#include <kaltest/KalTrackDim.h> +#include "GearTPCHit.h" +#include <kaltest/TVMeasLayer.h> + +namespace kaldet{ + +/** The cylindrical implementation of the GearTPCHit. + */ +class GearTPCCylinderHit : public GearTPCHit { + +public: + /// KILLENB What does this constructor do? Best throw it out, it does not + /// properly initialise the class at all, does it? + GearTPCCylinderHit(Int_t m = kMdim); + + /** Constructor to initialise the GearTPCHit using space point coordinates (TVector3) as original hit. + */ + GearTPCCylinderHit(const TVMeasLayer &ms, + Double_t *x, + Double_t *dx, + const TVector3 &xx, + Double_t b, + Double_t v, + Int_t m = kMdim); + + /** Constructor using a pointer to the original hit as reference. + */ + GearTPCCylinderHit(const TVMeasLayer &ms, + Double_t *x, + Double_t *dx, + const void *hitp, + Double_t b, + Double_t v, + Int_t m = kMdim); + + /** The dectructor. + */ + virtual ~GearTPCCylinderHit(); + + /** Implementation of the space vector (xv) to measurement vector (mv) calculation + * for a cylindrical hit. + */ + virtual TKalMatrix XvToMv(const TVector3 &xv, Double_t t0) const; + + /** Print some debug output to std err. + */ + virtual void DebugPrint(Option_t *opt = "") const; +}; + +}//namespace kaldet + +#endif //GEARTPCCYLINDERHIT_H +#ifndef GEARTPCCYLINDERMEASLAYER_H +#define GEARTPCCYLINDERMEASLAYER_H +#include <TVector3.h> +#include <kaltest/TKalMatrix.h> +#include <kaltest/TCylinder.h> +#include <EXTPCMeasLayer.h> +//#include <KalTrackDim.h> + +#include <TMath.h> + +#include <set> + +class TVTrackHit; + +namespace kaldet +{ + + /** + * A cylindrical measurement layer. + */ + class GearTPCCylinderMeasLayer + : public EXTPCMeasLayer + /* this is the original code which should be reactivated once the EXTPCMeasLayer is phased out: + : public GearTPCMeasLayer, public TCylinder + */ + { + + public: + /** The constructor. + * If the layer is perfect it is always a full circle. The constructor forces + * phiMin and phiMax to +-TMath::Pi(). Differing values will be ignored and a warning is + * printed. + * + * Note: The current implementation forces the layer to be perfect. Segmented layers are + * not supported yet. + * + * Note: for backward compatibility this is derrived from EXTPCMeasLayer. + * After the change to the GearTPC interface this should be changed to GearTPCMeasLayer and + * TCylinder, as EXTPCMeasLayer is inherrited now. + * The current version ensures compatibility for the transition phase. + */ + GearTPCCylinderMeasLayer(TMaterial &min, + TMaterial &mout, + Int_t module, + Int_t row, + Double_t r0, + Double_t lhalf, + TVector3 xc = TVector3(), + Bool_t isPerfect = true, + Bool_t isActive = true, + Double_t sigmaX0 = 0., + Double_t sigmaX1 = 0., + Double_t sigmaZ0 = 0., + Double_t sigmaZ1 = 0., + Double_t phiMin = -TMath::Pi(), + Double_t phiMax = TMath::Pi()); + + /** + * The desctructor. + */ + virtual ~GearTPCCylinderMeasLayer(); + + // Parent's pure virtuals that must be implemented + + /** Implements kaltest::TVMeasLayer's XvToMv. I have no idea why there are two arguments. + * It ignores ht and just calls XvToMv(xv). + */ + virtual TKalMatrix XvToMv (const TVTrackHit &ht, + const TVector3 &xv) const; + + /** Implements the coordinate transformation from the space vector xv to the + * measurement vector (Kalman matrix). + */ + virtual TKalMatrix XvToMv (const TVector3 &xv) const; + + /** Implements the conversion from a Kalman hit (measurement vector) to + * a 3D space point. + */ + virtual TVector3 HitToXv (const TVTrackHit &ht) const; + + /** + * Implements CalcDhDa, whatever that is. + */ + virtual void CalcDhDa (const TVTrackHit &ht, + const TVector3 &xv, + const TKalMatrix &dxphiada, + TKalMatrix &H) const; + /** Implements the sorting policy. + * The layers are first sorted by radius + offset. This offset is only + * useful for segments of a cylinder, like the LP1. + * As offsets in this case can be positive or negative, but only make sense in one + * direction (you need a continuous number), we only allow offsets in x. + * This should not be too much of a problem, you should be able to rotate your coordinates + * so the offset is in x. If not you have to extend the sorting policy. (Please thake + * care not to reduce versatility when doing so. You might want to implement your own class?) + * + * For equal radii + offset the layers are sorted by moduleID. As we have to squeeze this + * information into only one number, we multiply the radius + offset by 1e9 and add the moduleID. + * A double has a precision of 53 bits, which is 15.9 digits. So the radius can be up to 1e6.9 mm + * without causing the last digit of the the ModuleID to be cut, and for up to 1000 modules the + * layers can be distinguished down to 1 nm without the two numbers mixing, or down to 1 micron + * with up to 1.000.000 modules. + * + * The additional sorting by module is intended for cylinder segments. Here only one module/row + * per layer is allowed, so we just take the first entry in the set. In case of a perfect layer + * it does not matter because there should only be one layer at this radius, so the sort order + * should not be affected by adding an arbitrary module ID (as long as the module ID is < 1e6, as + * described above). + */ + virtual Double_t GetSortingPolicy() const; + + /** + * Creates a GearTPCCylinderHit and hands over the ownership. + */ + virtual GearTPCHit * createHit(Double_t * meas, + Double_t * dmeas, + void * hitPointer, + Double_t bField, + Double_t vDrift, + Int_t m = kMdim) const; + + + +protected: + Double_t fPhiMin; //< Minimum phi. + Double_t fPhiMax; //< Maximum phi. + +}; + +}//namespace kaldet +#endif +#ifndef GEARTPCHIT_H +#define GEARTPCHIT_H + +#include <kaltest/KalTrackDim.h> +#include <kaltest/TVTrackHit.h> +#include <kaltest/TVMeasLayer.h> + +namespace kaldet{ + +/** Base class of a hit for GearTPCKalDetector. It extends the TVTrackHit with the functionality to + * store a space point or a pointer to the original hit for reference. In addition it stores + * the local drift velocity and allows sorting of the hits (according to the distance to the + * origin). + * + * It does not implement the purely virtual functions of the TVTrackHit, which happens in the + * specialisations for cylindrical and planar measurement layers. + */ +class GearTPCHit : public TVTrackHit { + +public: + /// KILLENB What does this constructor do? Best throw it out, it does not + /// properly initialise the class at all, does it? + GearTPCHit(Int_t m = kMdim); + + /** Constructor to initialise the GearTPCHit using space point coordinates (TVector3) as original hit. + */ + GearTPCHit(const TVMeasLayer &ms, + Double_t *x, + Double_t *dx, + const TVector3 &xx, + Double_t b, + Double_t v, + Int_t m = kMdim); + + /** Constructor using a pointer to the original hit as reference. + */ + GearTPCHit(const TVMeasLayer &ms, + Double_t *x, + Double_t *dx, + const void *hitp, + Double_t b, + Double_t v, + Int_t m = kMdim); + + /** The dectructor. + */ + virtual ~GearTPCHit(); + + /** + * The sorting policy of hits is implemented as the distance to the origin. + * + * Note: The sorting of hits does not necessarily correspond to the sort order of + * the corresponding Kalman layer! + */ + virtual Double_t GetSortingPolicy() const; + + /** + * Compare two hits according to their sorting policy. + * Returns + * \li -1 if this hits sorting policy is smaller + * \li 0 if both soting policies are equal + * \li 1 if this hits hits sortin policy is larger + * + * Killenb: n.b. Who comes up with this wierd stuff? Ever head of anything like a + * `less than operator` or `comparison operator`? + */ + virtual Int_t Compare(const TObject *obj) const; + + /** + * Returns true. + */ + virtual Bool_t IsSortable() const; + + /// Get the pointer to the reference hit. 0 if the TVector3 has been used for initialisation. + inline const void *GetHitPtr() const { return fHitPtr; } + + /// Get the referece position. (0, 0, 0) if the reference pointer has been used for initialisation. + inline TVector3 GetExactX() const { return *fXXPtr; } + + /// Get the local drift velocity set in the constructor. + inline Double_t GetVdrift() const { return fVDrift; } + +protected: + const TVector3 *fXXPtr; //< pointer to exact hit + const void *fHitPtr; //< pointer to raw Hit object + + Double_t fVDrift; //< the local drift veclocity at this point + + +}; + +}//namespace kaldet + +#endif +#ifndef GEARTPCKALDETECTOR_H +#define GEARTPCKALDETECTOR_H + +#include "kaltest/TVKalDetector.h" + +#include "GearTPCMeasLayer.h" + +#include <map> + +namespace gear{ + class GearMgr ; +} + +namespace kaldet{ + + /** + * The LCTPC implementation for a TPC which is completely instantiated from GEAR. + * + */ +class GearTPCKalDetector : public TVKalDetector { + +public: + /** + * The constructor. All information to initialise the TPC is taken from GEAR. + * + * As a pragmatic approach to avoid dealing with conditions data and material databases, + * the information about the material budget and the resolution of the layers + * is taken from the GEAR file as user parameters. If the parameters are not found in the + * file the previously hard coded parameters are used as default, which ensures backward + * compatibility. + * + * The gas properties for the matrial budget can be given as user parameters + * for the TPCParameters: + * \param TPCGas_A The mean atomic mass (default 36.2740552) + * \param TPCGas_Z The mean number of protons (default 16.4) + * \param TPCGas_density The density (default 0.749e-3 in which units?) + * \param TPCGas_radlen The radiation length (default 2.392e4 in which units?) + * + * The default gas parameters (are supposed to) correspond to Ar/CH4 90/10. + * N.B.: KILLENB: I think there is a bug in the calculation, the mean A should be + * 37.6 instead of 36.3 (see source code). + * In addition the description as a single TMaterial is not good. + * Using TMixture would be better. + * + * The reslution is calculated as \f$\sigma_x = \sqrt{x_0^2 + x_1^2 \cdot z}\f$. + * This requires z to be proportional to the drift distance, i.\ e. z=0 is at the readout. + + * The resolution of the layers can be given as user parameters in each TPCModule + * section of the GEAR xml file. + * \param sigmax0 The constant part of the x resolution (default 38.3e-3 mm) + * \param sigmax1 The drift distance dependent part of the x resolution + * (default 6.74e-3 mm/sqrt(mm) ) + * \param sigmaz0 The constant part of the z resolution (default 0.5 mm) + * \param sigmaz1 The drift distance dependent part the z resolution + * (default 10.2e-3 mm/sqrt(mm) ) + */ + GearTPCKalDetector(const gear::GearMgr& gearMgr); + + /// The destructor. + virtual ~GearTPCKalDetector(); + + /** + * Get access to the measurement layers using moduleID and row. + * Do not directly access the measurement layers using At() + * because the order depends on the order in the gear file. + * Throws a gear::Exception if the row on the module is not defined. + */ + virtual GearTPCMeasLayer const * GetMeasLayer(int moduleID, int row) const; + +protected: + /// Map which contains the information which measurement layer is stored + /// at which position in the array. + std::map< std::pair<int, int >, Int_t > moduleRowToMeasurementLayerMap; +}; + +}// namespace kaldet +#endif //GEARTPCKALDETECTOR_H +#ifndef GEARTPC_MEASLAYER_H +#define GEARTPC_MEASLAYER_H + +#include <kaltest/TVMeasLayer.h> +#include <set> + +namespace kaldet +{ + + class GearTPCHit; + + /** + * The GearTPCMeasLayer class introduces the z-dependent resolutions sigmaX and sigmaZ + * as well as Gear modules and rows which correspond to this layer. + * + * If the layer is defined as a perfect layer this means all modules are perfectly alligned + * and more than one module/row can be assigned to this layer. You can add them using AddModuleRow. + * The perfect layer should contain all the moduleRows on it, so it is guaranteed that the + * user can access all neighbouring modules this way. + * + * If the layer is not defined as perfect (default) there can only be one module on this layer. + * Calling AddModuleRow will throw an exception. This is the default behaviour because Gear does + * not guarantee that the modules are alligned. Displaced modules do not make up a perfect + * cylinder / plane and have to be treated as separate segments. Finding a neighbouring module/row + * is not trivial and has to be left to the user or a future Gear version. + */ + + class GearTPCMeasLayer + : public TVMeasLayer + { + + public: + /** The constructor. + * The materials and the type (active or passive) are passed on to the + * TVMeasLayer. sigmaX0 [mm] is the constant part of sigmaX, sigmaX1 [mm/sqrt(mm)] + * the z-dependent part, accordingly for sigmaZ. + * + * Module and row have to be specified. They will be added as the first + * module/row pair of this measurement layer. + * For a perfect layer modules can be added with AddModuleRow. + * + * Note: This class cannot be instantiated because the parent's geometry dependent + * purely virtual + * functions like XvToMv are not implemented. This will happen in the cylindrical or planar + * implementations. + * + * For inactive layers you will usually leave the sigmas at 0, they have no useful meaning in + * this case. + */ + GearTPCMeasLayer(TMaterial &min, + TMaterial &mout, + Int_t module, + Int_t row, + Bool_t isPerfect, + Bool_t isActive, + Double_t sigmaX0 = 0., //< the constant part of sigmaX + Double_t sigmaX1 = 0., //< the z-dependent part of sigmaX + Double_t sigmaZ0 = 0. , //< the constant part of sigmaZ + Double_t sigmaZ1 = 0.); //< the z-dependent part of sigmaZ + + /// The destructor + virtual ~GearTPCMeasLayer(); + + /** + * A perfect measurement layer contains all the modules with rows (row segments) + * that make up the layer. + */ + virtual std::set< std::pair <int, int> > const & GetModuleRows() const; + + /** + * Add another row on another module which lies on the same cylinder. + */ + virtual void AddModuleRow(int module, int row); + + /** + * Get the measurement vector (mv) for this layer from a space point (xv) + */ + virtual TKalMatrix XvToMv (const TVector3 &xv) const = 0; + + /** + * Get the z-depenent resolution in the readout plane + * (usually x or r\f$\phi\f$). + */ + virtual Double_t GetSigmaX(Double_t z) const; + + /** + * Get the z-depenent resolution in z (drift direction). + */ + virtual Double_t GetSigmaZ(Double_t z) const; + + + /** + * Get the flag whether the layer is declared as perfect. + */ + virtual Bool_t IsPerfect() const; + + /** + * A virtual function to create the appropriate hit. Depending on the implementation + * (cylindrical or straight measurement layer) you get the appropriate implementation + * of GearTPCHit. + * It creates a new hit on the heap and hands over the ownership. + */ + virtual GearTPCHit * createHit(Double_t * meas, + Double_t * dmeas, + void * hitPointer, + Double_t bField, + Double_t vDrift, + Int_t m = kMdim) const = 0; + + protected: + Double_t fSigmaX0; // xy resolution + Double_t fSigmaX1; // xy resolution + Double_t fSigmaZ0; // z resolution + Double_t fSigmaZ1; // z resolution + + /// A set to hold all the module/row combinations associated to this layer + std::set< std::pair<int, int> > fModuleRows; + + Bool_t fIsPerfect; + }; + +}// namespace kaldet +#endif // GEARTPC_MEASLAYER_H + +#undef _BACKWARD_BACKWARD_WARNING_H +)DICTPAYLOAD"; + static const char* classesHeaders[] = { +nullptr +}; + static bool isInitialized = false; + if (!isInitialized) { + TROOT::RegisterModule("lctpc_gearTPC", + headers, includePaths, payloadCode, fwdDeclCode, + TriggerDictionaryInitialization_lctpc_gearTPC_Impl, {}, classesHeaders, /*hasCxxModule*/false); + isInitialized = true; + } + } + static struct DictInit { + DictInit() { + TriggerDictionaryInitialization_lctpc_gearTPC_Impl(); + } + } __TheDictionaryInitializer; +} +void TriggerDictionaryInitialization_lctpc_gearTPC() { + TriggerDictionaryInitialization_lctpc_gearTPC_Impl(); +} diff --git a/Utilities/KalDet/rootdict/lctpc_gearTPC_rdict.pcm b/Utilities/KalDet/rootdict/lctpc_gearTPC_rdict.pcm new file mode 100644 index 0000000000000000000000000000000000000000..19da1b90fda80849cbbaa894a8319b37d4849d73 Binary files /dev/null and b/Utilities/KalDet/rootdict/lctpc_gearTPC_rdict.pcm differ diff --git a/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.cc b/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.cc index 3ac020812669ae175d17c9f9df6c983ce506790e..799bddf94354086f1054107522e9df3e82722f21 100644 --- a/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.cc +++ b/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.cc @@ -5,6 +5,10 @@ #include <sstream> +#include "DetInterface/IGeoSvc.h" +#include "DD4hep/Detector.h" +#include "DDRec/DetectorData.h" + #include "gear/GEAR.h" #include "gear/BField.h" #include "gearimpl/Util.h" @@ -19,18 +23,23 @@ #include <UTIL/ILDConf.h> // #include "streamlog/streamlog.h" - +#include "CLHEP/Units/SystemOfUnits.h" #include "TVector3.h" -ILDFTDKalDetector::ILDFTDKalDetector( const gear::GearMgr& gearMgr ) : +ILDFTDKalDetector::ILDFTDKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ) : TVKalDetector(300), _nDisks(0) // SJA:FIXME initial size, 300 looks reasonable for ILD, though this would be better stored as a const somewhere { // streamlog_out(DEBUG1) << "ILDFTDKalDetector building FTD detector using GEAR " << std::endl ; - MaterialDataBase::Instance().registerForService(gearMgr); - setupGearGeom( gearMgr ) ; - + MaterialDataBase::Instance().registerForService(gearMgr, geoSvc); + if(geoSvc){ + setupGearGeom( geoSvc ) ; + } + else{ + setupGearGeom( gearMgr ); + } + this->build_staggered_design(); @@ -380,7 +389,7 @@ void ILDFTDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ } - + //std::cout << "=============FTD strip angle: " << strip_angle_deg << "==============" << std::endl; _nDisks = ftdlayers.getNLayers() ; // just do the first disk for now _FTDgeo.resize(_nDisks); @@ -419,6 +428,11 @@ void ILDFTDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ _FTDgeo[disk].stripAngle = 0.0 ; } + + //std::cout << _FTDgeo[disk].nPetals << " " << _FTDgeo[disk].dphi << " " << _FTDgeo[disk].phi0 << " " << _FTDgeo[disk].alpha << " " + // << _FTDgeo[disk].rInner << " " << _FTDgeo[disk].height << " " << _FTDgeo[disk].innerBaseLength << " " << _FTDgeo[disk].outerBaseLength << " " + // << _FTDgeo[disk].senThickness << " " << _FTDgeo[disk].supThickness << " " << _FTDgeo[disk].senZPos_even_front << " " << _FTDgeo[disk].senZPos_odd_front << " " + // << _FTDgeo[disk].isDoubleSided << " " << _FTDgeo[disk].isStripReadout << " " << _FTDgeo[disk].nSensors << " " << _FTDgeo[disk].stripAngle << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////////// // Assertions //////////////////////////////////////////////////////////////////////////////////// @@ -499,3 +513,116 @@ void ILDFTDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ } + +void ILDFTDKalDetector::setupGearGeom( IGeoSvc* geoSvc ){ + dd4hep::DetElement world = geoSvc->getDD4HepGeo(); + dd4hep::DetElement ftd; + const std::map<std::string, dd4hep::DetElement>& subs = world.children(); + for(std::map<std::string, dd4hep::DetElement>::const_iterator it=subs.begin();it!=subs.end();it++){ + if(it->first!="FTD") continue; + ftd = it->second; + } + dd4hep::rec::ZDiskPetalsData* ftdData = nullptr; + try{ + ftdData = ftd.extension<dd4hep::rec::ZDiskPetalsData>(); + } + catch(std::runtime_error& e){ + std::cout << e.what() << " " << ftdData << std::endl; + throw GaudiException(e.what(), "FATAL", StatusCode::FAILURE); + } + + const dd4hep::Direction& field = geoSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + _bZ = field.z(); + + double strip_angle_deg = ftdData->angleStrip/CLHEP::degree; + bool strip_angle_present = true; + + std::vector<dd4hep::rec::ZDiskPetalsData::LayerLayout>& ftdlayers = ftdData->layers; + _nDisks = ftdlayers.size() ; + + _FTDgeo.resize(_nDisks); + + double eps = 1.0e-08; + //std::cout << "=============FTD strip angle: " << strip_angle_deg << "==============" << std::endl; + for(int disk=0; disk< _nDisks; ++disk){ + dd4hep::rec::ZDiskPetalsData::LayerLayout& ftdlayer = ftdlayers[disk]; + _FTDgeo[disk].nPetals = ftdlayer.petalNumber ; + _FTDgeo[disk].dphi = 2*M_PI / _FTDgeo[disk].nPetals ; + _FTDgeo[disk].phi0 = ftdlayer.phi0 ; + _FTDgeo[disk].alpha = ftdlayer.alphaPetal ; + _FTDgeo[disk].rInner = ftdlayer.distanceSensitive*CLHEP::cm ; + _FTDgeo[disk].height = ftdlayer.lengthSensitive*CLHEP::cm ; + _FTDgeo[disk].innerBaseLength = ftdlayer.widthInnerSensitive*CLHEP::cm ; + _FTDgeo[disk].outerBaseLength = ftdlayer.widthOuterSensitive*CLHEP::cm ; + _FTDgeo[disk].senThickness = ftdlayer.thicknessSensitive*CLHEP::cm ; + _FTDgeo[disk].supThickness = ftdlayer.thicknessSupport*CLHEP::cm ; + + _FTDgeo[disk].senZPos_even_front = ftdlayer.zPosition*CLHEP::cm - ftdlayer.zOffsetSensitive*CLHEP::cm;//getSensitiveZposition(disk, 0, 1) ; + _FTDgeo[disk].senZPos_odd_front = ftdlayer.zPosition*CLHEP::cm - ftdlayer.zOffsetSensitive*CLHEP::cm - 2*ftdlayer.zOffsetSupport*CLHEP::cm;//getSensitiveZposition(disk, 1, 1) ; + + _FTDgeo[disk].isDoubleSided = ftdlayer.typeFlags[dd4hep::rec::ZDiskPetalsData::SensorType::DoubleSided]; + _FTDgeo[disk].isStripReadout = !((bool)ftdlayer.typeFlags[dd4hep::rec::ZDiskPetalsData::SensorType::Pixel]); + _FTDgeo[disk].nSensors = ftdlayer.sensorsPerPetal; + + + if (strip_angle_present) { + _FTDgeo[disk].stripAngle = strip_angle_deg * M_PI/180 ; + } else { + _FTDgeo[disk].stripAngle = 0.0 ; + } + //std::cout << _FTDgeo[disk].nPetals << " " << _FTDgeo[disk].dphi << " " << _FTDgeo[disk].phi0 << " " << _FTDgeo[disk].alpha << " " + // << _FTDgeo[disk].rInner << " " << _FTDgeo[disk].height << " " << _FTDgeo[disk].innerBaseLength << " " << _FTDgeo[disk].outerBaseLength << " " + // << _FTDgeo[disk].senThickness << " " << _FTDgeo[disk].supThickness << " " << _FTDgeo[disk].senZPos_even_front << " " << _FTDgeo[disk].senZPos_odd_front << " " + // << _FTDgeo[disk].isDoubleSided << " " << _FTDgeo[disk].isStripReadout << " " << _FTDgeo[disk].nSensors << " " << _FTDgeo[disk].stripAngle << std::endl; + + assert( _FTDgeo[disk].nPetals%2 == 0 ); + assert( fabs( ftdlayer.widthInnerSupport - ftdlayer.widthInnerSensitive ) < eps ); + assert( fabs( ftdlayer.widthOuterSupport - ftdlayer.widthOuterSensitive ) < eps ); + assert( fabs( ftdlayer.lengthSupport - ftdlayer.lengthSensitive ) < eps ); + assert( fabs( ftdlayer.distanceSupport - ftdlayer.distanceSensitive ) < eps ); + if( _FTDgeo[disk].isDoubleSided ) assert( _FTDgeo[disk].nSensors%2 == 0 ); + assert( fabs( ftdlayer.alphaPetal ) < eps ); + /* + if( _FTDgeo[disk].isDoubleSided ){ + + for( int iPetal=0; iPetal< _FTDgeo[disk].nPetals; iPetal++){ + + int sensors1Side = _FTDgeo[disk].nSensors/2; + for( int iSensor=2; iSensor <= sensors1Side; iSensor++ ){ + + assert( fabs( ftdlayers.getSensitiveZposition( disk, iPetal, iSensor) - ftdlayers.getSensitiveZposition( disk, iPetal, iSensor-1) ) < eps ); + + } + + for( int iSensor=sensors1Side + 2; iSensor <= _FTDgeo[disk].nSensors; iSensor++ ){ + + assert( fabs( ftdlayers.getSensitiveZposition( disk, iPetal, iSensor) - ftdlayers.getSensitiveZposition( disk, iPetal, iSensor-1) ) < eps ); + assert( fabs( ftdlayers.getSensitiveZposition( disk, iPetal, iSensor) ) - fabs( ftdlayers.getSensitiveZposition( disk, iPetal, iSensor-sensors1Side ) ) >= 0. ); + } + } + } + else{ + + for( int iPetal=0; iPetal< _FTDgeo[disk].nPetals; iPetal++){ + + for(int iSensor=2; iSensor <= _FTDgeo[disk].nSensors; iSensor++ ){ + + assert( fabs( ftdlayers.getSensitiveZposition( disk, iPetal, iSensor) - ftdlayers.getSensitiveZposition( disk, iPetal, iSensor-1) ) < eps ); + + } + } + } + + for( int iPetal=0; iPetal< _FTDgeo[disk].nPetals; iPetal++){ + + int side = ftdlayers.getSupportZposition( disk, iPetal ) > 0? 1 : -1; + + double endSensitive = ftdlayers.getSensitiveZposition( disk, iPetal, 1) + side * _FTDgeo[disk].senThickness/2.; + double endSupport = ftdlayers.getSupportZposition( disk, iPetal ) -side * _FTDgeo[disk].supThickness/2.; + + assert( fabs( endSensitive- endSupport ) < eps ); + + } + */ + } +} diff --git a/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.h b/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.h index 36cf54b8e5a889a09431635740c3e2c3035d6d6a..deee9061226776bfd3986fb2cc6c21b65ab469e9 100644 --- a/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.h +++ b/Utilities/KalDet/src/ild/ftd/ILDFTDKalDetector.h @@ -11,17 +11,17 @@ class TNode; class TVector3; +class IGeoSvc; namespace gear{ class GearMgr ; } - class ILDFTDKalDetector : public TVKalDetector { public: /** Initialize the FTD from GEAR */ - ILDFTDKalDetector( const gear::GearMgr& gearMgr ); + ILDFTDKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ); private: @@ -80,6 +80,7 @@ private: void setupGearGeom( const gear::GearMgr& gearMgr ) ; + void setupGearGeom( IGeoSvc* geoSvc ); int _nDisks ; double _bZ ; diff --git a/Utilities/KalDet/src/ild/set/ILDSETKalDetector.cc b/Utilities/KalDet/src/ild/set/ILDSETKalDetector.cc index a8ae3eda05e97f1c3b659f9213e505a67f1db102..f1f7c6751f3a6ff1f76719298c9d5f34a05cd717 100644 --- a/Utilities/KalDet/src/ild/set/ILDSETKalDetector.cc +++ b/Utilities/KalDet/src/ild/set/ILDSETKalDetector.cc @@ -9,12 +9,17 @@ #include <UTIL/BitField64.h> #include <UTIL/ILDConf.h> +#include "DetInterface/IGeoSvc.h" +#include "DD4hep/Detector.h" +#include "DDRec/DetectorData.h" + #include <gear/GEAR.h> #include "gear/BField.h" #include <gear/ZPlanarParameters.h> #include <gear/ZPlanarLayerLayout.h> #include "gearimpl/Util.h" +#include "CLHEP/Units/SystemOfUnits.h" #include "TMath.h" #include "math.h" @@ -22,7 +27,7 @@ // #include "streamlog/streamlog.h" -ILDSETKalDetector::ILDSETKalDetector( const gear::GearMgr& gearMgr ) +ILDSETKalDetector::ILDSETKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ) : TVKalDetector(300) // SJA:FIXME initial size, 300 looks reasonable for ILD, though this would be better stored as a const somewhere { @@ -35,7 +40,12 @@ ILDSETKalDetector::ILDSETKalDetector( const gear::GearMgr& gearMgr ) TMaterial & silicon = *MaterialDataBase::Instance().getMaterial("silicon"); TMaterial & carbon = *MaterialDataBase::Instance().getMaterial("carbon"); - this->setupGearGeom(gearMgr) ; + if(geoSvc){ + setupGearGeom( geoSvc ) ; + } + else{ + setupGearGeom( gearMgr ); + } if (_isStripDetector) { // streamlog_out(DEBUG4) << "\t\t building SET detector as STRIP Detector." << std::endl ; @@ -241,7 +251,7 @@ void ILDSETKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ // if this is not done then the exposed areas of the support would leave a carbon - air boundary, // which if traversed in the reverse direction to the next boundary then the track would be propagated through carbon // for a significant distance - + //std::cout << "=============SET strip angle: " << strip_angle_deg << "==============" << std::endl; for( int layer=0; layer < _nLayers; ++layer){ @@ -271,7 +281,9 @@ void ILDSETKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ } else { _SETgeo[layer].stripAngle = 0.0 ; } - + //std::cout << _SETgeo[layer].nLadders << " " << _SETgeo[layer].phi0 << " "<< _SETgeo[layer].dphi << " " << _SETgeo[layer].senRMin << " " << _SETgeo[layer].supRMin << " " + // << _SETgeo[layer].length << " " << _SETgeo[layer].width << " " << _SETgeo[layer].offset << " " << _SETgeo[layer].senThickness << " " << _SETgeo[layer].supThickness << " " + // << _SETgeo[layer].nSensorsPerLadder << " " << _SETgeo[layer].sensorLength << std::endl; // streamlog_out(DEBUG0) << " layer = " << layer << std::endl; // streamlog_out(DEBUG0) << " nSensorsPerLadder = " << _SETgeo[layer].nSensorsPerLadder << std::endl; // streamlog_out(DEBUG0) << " sensorLength = " << _SETgeo[layer].sensorLength << std::endl; @@ -279,8 +291,57 @@ void ILDSETKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ // streamlog_out(DEBUG0) << " _isStripDetector = " << _isStripDetector << std::endl; } - - - - +} + +void ILDSETKalDetector::setupGearGeom( IGeoSvc* geoSvc ){ + dd4hep::DetElement world = geoSvc->getDD4HepGeo(); + dd4hep::DetElement set; + const std::map<std::string, dd4hep::DetElement>& subs = world.children(); + for(std::map<std::string, dd4hep::DetElement>::const_iterator it=subs.begin();it!=subs.end();it++){ + if(it->first!="SET") continue; + set = it->second; + } + dd4hep::rec::ZPlanarData* setData = nullptr; + try{ + setData = set.extension<dd4hep::rec::ZPlanarData>(); + } + catch(std::runtime_error& e){ + std::cout << e.what() << " " << setData << std::endl; + throw GaudiException(e.what(), "FATAL", StatusCode::FAILURE); + } + + const dd4hep::Direction& field = geoSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + _bZ = field.z(); + + std::vector<dd4hep::rec::ZPlanarData::LayerLayout>& setlayers = setData->layers; + _nLayers = setlayers.size(); + _SETgeo.resize(_nLayers); + + double strip_angle_deg = setData->angleStrip/CLHEP::degree; + //std::cout << "=============SET strip angle: " << strip_angle_deg << "==============" << std::endl; + for( int layer=0; layer < _nLayers; ++layer){ + dd4hep::rec::ZPlanarData::LayerLayout& pSETLayerLayout = setlayers[layer]; + + _SETgeo[layer].nLadders = pSETLayerLayout.ladderNumber; + _SETgeo[layer].phi0 = pSETLayerLayout.phi0; + _SETgeo[layer].dphi = 2*M_PI / _SETgeo[layer].nLadders; + _SETgeo[layer].senRMin = pSETLayerLayout.distanceSensitive*CLHEP::cm; + _SETgeo[layer].supRMin = pSETLayerLayout.distanceSupport*CLHEP::cm; + _SETgeo[layer].length = pSETLayerLayout.zHalfSensitive*2.0*CLHEP::cm; // note: gear for historical reasons uses the halflength + _SETgeo[layer].width = pSETLayerLayout.widthSensitive*CLHEP::cm; + _SETgeo[layer].offset = pSETLayerLayout.offsetSensitive*CLHEP::cm; + _SETgeo[layer].senThickness = pSETLayerLayout.thicknessSensitive*CLHEP::cm; + _SETgeo[layer].supThickness = pSETLayerLayout.thicknessSupport*CLHEP::cm; + _SETgeo[layer].nSensorsPerLadder = pSETLayerLayout.sensorsPerLadder; + _SETgeo[layer].sensorLength = _SETgeo[layer].length / _SETgeo[layer].nSensorsPerLadder; + + if (_isStripDetector) { + _SETgeo[layer].stripAngle = strip_angle_deg * M_PI/180 ; + } else { + _SETgeo[layer].stripAngle = 0.0 ; + } + //std::cout << _SETgeo[layer].nLadders << " " << _SETgeo[layer].phi0 << " "<< _SETgeo[layer].dphi << " " << _SETgeo[layer].senRMin << " " << _SETgeo[layer].supRMin << " " + // << _SETgeo[layer].length << " " << _SETgeo[layer].width << " " << _SETgeo[layer].offset << " " << _SETgeo[layer].senThickness << " " << _SETgeo[layer].supThickness << " " + // << _SETgeo[layer].nSensorsPerLadder << " " << _SETgeo[layer].sensorLength << " " << pSETLayerLayout.lengthSensor << std::endl; + } } diff --git a/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.cc b/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.cc index e58b9d6e773e9afabad21e3179be18e2891f4f69..1c409d64a20b13bca6a638dc003c256d5977b3b2 100644 --- a/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.cc +++ b/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.cc @@ -9,6 +9,11 @@ #include <UTIL/BitField64.h> #include <UTIL/ILDConf.h> +#include "DetInterface/IGeoSvc.h" +#include "DD4hep/Detector.h" +#include "DDRec/DetectorData.h" +#include "CLHEP/Units/SystemOfUnits.h" + #include <gear/GEAR.h> #include "gear/BField.h" #include <gear/ZPlanarParameters.h> @@ -22,21 +27,25 @@ // #include "streamlog/streamlog.h" -ILDSITKalDetector::ILDSITKalDetector( const gear::GearMgr& gearMgr ) +ILDSITKalDetector::ILDSITKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ) : TVKalDetector(300) // SJA:FIXME initial size, 300 looks reasonable for ILD, though this would be better stored as a const somewhere { // streamlog_out(DEBUG4) << "ILDSITKalDetector building SIT detector using GEAR " << std::endl ; - MaterialDataBase::Instance().registerForService(gearMgr); - + MaterialDataBase::Instance().registerForService(gearMgr, geoSvc); + TMaterial & air = *MaterialDataBase::Instance().getMaterial("air"); TMaterial & silicon = *MaterialDataBase::Instance().getMaterial("silicon"); TMaterial & carbon = *MaterialDataBase::Instance().getMaterial("carbon"); - - this->setupGearGeom(gearMgr) ; - + if(geoSvc){ + this->setupGearGeom(geoSvc); + } + else{ + this->setupGearGeom(gearMgr) ; + } + if (_isStripDetector) { // streamlog_out(DEBUG4) << "\t\t building SIT detector as STRIP Detector." << std::endl ; } else { @@ -241,7 +250,7 @@ void ILDSITKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ // if this is not done then the exposed areas of the support would leave a carbon - air boundary, // which if traversed in the reverse direction to the next boundary then the track would be propagated through carbon // for a significant distance - + //std::cout << "=============SIT strip angle: " << strip_angle_deg << "==============" << std::endl; for( int layer=0; layer < _nLayers; ++layer){ @@ -271,7 +280,9 @@ void ILDSITKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ } else { _SITgeo[layer].stripAngle = 0.0 ; } - + //std::cout << _SITgeo[layer].nLadders << " " << _SITgeo[layer].phi0 << " "<< _SITgeo[layer].dphi << " " << _SITgeo[layer].senRMin << " " << _SITgeo[layer].supRMin << " " + // << _SITgeo[layer].length << " " << _SITgeo[layer].width << " " << _SITgeo[layer].offset << " " << _SITgeo[layer].senThickness << " " << _SITgeo[layer].supThickness << " " + // << _SITgeo[layer].nSensorsPerLadder << " " << _SITgeo[layer].sensorLength << std::endl; // streamlog_out(DEBUG0) << " layer = " << layer << std::endl; // streamlog_out(DEBUG0) << " nSensorsPerLadder = " << _SITgeo[layer].nSensorsPerLadder << std::endl; // streamlog_out(DEBUG0) << " sensorLength = " << _SITgeo[layer].sensorLength << std::endl; @@ -280,7 +291,61 @@ void ILDSITKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ } - - - +} + +void ILDSITKalDetector::setupGearGeom( IGeoSvc* geoSvc ){ + + dd4hep::DetElement world = geoSvc->getDD4HepGeo(); + dd4hep::DetElement sit; + const std::map<std::string, dd4hep::DetElement>& subs = world.children(); + for(std::map<std::string, dd4hep::DetElement>::const_iterator it=subs.begin();it!=subs.end();it++){ + if(it->first!="SIT") continue; + sit = it->second; + } + dd4hep::rec::ZPlanarData* sitData = nullptr; + try{ + sitData = sit.extension<dd4hep::rec::ZPlanarData>(); + } + catch(std::runtime_error& e){ + std::cout << e.what() << " " << sitData << std::endl; + throw GaudiException(e.what(), "FATAL", StatusCode::FAILURE); + } + + const dd4hep::Direction& field = geoSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + _bZ = field.z(); + + std::vector<dd4hep::rec::ZPlanarData::LayerLayout>& sitlayers = sitData->layers; + _nLayers = sitlayers.size(); + _SITgeo.resize(_nLayers); + + double strip_angle_deg = sitData->angleStrip/CLHEP::degree; + if(strip_angle_deg!=0){ + _isStripDetector = true; + } + //std::cout << "=============SIT strip angle: " << strip_angle_deg << "==============" << std::endl; + for( int layer=0; layer < _nLayers; ++layer){ + dd4hep::rec::ZPlanarData::LayerLayout& pSITLayerLayout = sitlayers[layer]; + + _SITgeo[layer].nLadders = pSITLayerLayout.ladderNumber; + _SITgeo[layer].phi0 = pSITLayerLayout.phi0; + _SITgeo[layer].dphi = 2*M_PI / _SITgeo[layer].nLadders; + _SITgeo[layer].senRMin = pSITLayerLayout.distanceSensitive*CLHEP::cm; + _SITgeo[layer].supRMin = pSITLayerLayout.distanceSupport*CLHEP::cm; + _SITgeo[layer].length = pSITLayerLayout.zHalfSensitive*2.0*CLHEP::cm; // note: gear for historical reasons uses the halflength + _SITgeo[layer].width = pSITLayerLayout.widthSensitive*CLHEP::cm; + _SITgeo[layer].offset = pSITLayerLayout.offsetSensitive*CLHEP::cm; + _SITgeo[layer].senThickness = pSITLayerLayout.thicknessSensitive*CLHEP::cm; + _SITgeo[layer].supThickness = pSITLayerLayout.thicknessSupport*CLHEP::cm; + _SITgeo[layer].nSensorsPerLadder = pSITLayerLayout.sensorsPerLadder; + _SITgeo[layer].sensorLength = _SITgeo[layer].length / _SITgeo[layer].nSensorsPerLadder; + + if (_isStripDetector) { + _SITgeo[layer].stripAngle = strip_angle_deg * M_PI/180 ; + } else { + _SITgeo[layer].stripAngle = 0.0 ; + } + //std::cout << _SITgeo[layer].nLadders << " " << _SITgeo[layer].phi0 << " "<< _SITgeo[layer].dphi << " " << _SITgeo[layer].senRMin << " " << _SITgeo[layer].supRMin << " " + // << _SITgeo[layer].length << " " << _SITgeo[layer].width << " " << _SITgeo[layer].offset << " " << _SITgeo[layer].senThickness << " " << _SITgeo[layer].supThickness << " " + // << _SITgeo[layer].nSensorsPerLadder << " " << _SITgeo[layer].sensorLength << " " << pSITLayerLayout.lengthSensor << std::endl; + } } diff --git a/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.h b/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.h index 639e1b27bb76512ad05c8570814b218a9480cb5b..d9eb3059b680eb16823cef7de3b315659c056272 100644 --- a/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.h +++ b/Utilities/KalDet/src/ild/sit/ILDSITKalDetector.h @@ -16,18 +16,20 @@ namespace gear{ class GearMgr ; } +class IGeoSvc; class ILDSITKalDetector : public TVKalDetector { public: /** Initialize the SIT from GEAR */ - ILDSITKalDetector( const gear::GearMgr& gearMgr ); + ILDSITKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ); private: void setupGearGeom( const gear::GearMgr& gearMgr ) ; + void setupGearGeom( IGeoSvc* geoSvc ); int _nLayers ; double _bZ ; diff --git a/Utilities/KalDet/src/ild/support/ILDSupportKalDetector.cc b/Utilities/KalDet/src/ild/support/ILDSupportKalDetector.cc index 3b59a6af44c926aaa2d88a9b8217b8e98bdec813..98a6f247b86b2f4cee58936846535205c0f5f96c 100644 --- a/Utilities/KalDet/src/ild/support/ILDSupportKalDetector.cc +++ b/Utilities/KalDet/src/ild/support/ILDSupportKalDetector.cc @@ -16,6 +16,10 @@ #include <sstream> #include <cmath> +#include "DD4hep/Detector.h" +#include "DDRec/DetectorData.h" +#include "CLHEP/Units/SystemOfUnits.h" + #include "gear/GEAR.h" #include "gear/BField.h" #include "gearimpl/Util.h" @@ -26,28 +30,33 @@ ILDSupportKalDetector::ILDSupportKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ) : TVKalDetector(10) { - + Double_t bz; + std::vector<double> z, rInner, rOuter; // streamlog_out(DEBUG1) << "ILDSupportKalDetector building beampipe using GEAR " << std::endl ; - - const gear::GearParameters& pBeamPipe = gearMgr.getGearParameters("BeamPipe"); - const Double_t bz = gearMgr.getBField().at( gear::Vector3D( 0.,0.,0.) ).z() ; - - // switch gear to dd4hep::rec, once validated, gear will been removed. - const dd4hep::rec::ConicalSupportData* pBeamPipeData = geoSvc->getBeamPipeData(); - const std::vector<dd4hep::rec::ConicalSupportData::Section>& sections = pBeamPipeData->sections; - std::cout << "======================BeamPipe===================" << std::endl; - for(int i=0;i<sections.size();i++){ - std::cout << sections[i].zPos << " " << sections[i].rInner << " " << sections[i].rOuter << std::endl; + if(geoSvc){ + const dd4hep::rec::ConicalSupportData* pBeamPipeData = geoSvc->getBeamPipeData(); + const std::vector<dd4hep::rec::ConicalSupportData::Section>& sections = pBeamPipeData->sections; + const dd4hep::Direction& field = geoSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + bz = field.z(); + for(int i=0;i<sections.size();i++){ + z.push_back(sections[i].zPos); + rInner.push_back(sections[i].rInner); + rOuter.push_back(sections[i].rOuter); + } } - std::cout << "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" << std::endl; - // the beampipe is supposed to be a chain of cut cones (cut, that means the spike is cut off, also called a cone frustum). - // as they are connected, RStart[i] == REnd[i-1]. With this all we need are the z values and the radii at the place. - const std::vector<double> z = pBeamPipe.getDoubleVals("Z"); - const std::vector<double> rInner = pBeamPipe.getDoubleVals("RInner"); //inner radius of the cone - const std::vector<double> rOuter = pBeamPipe.getDoubleVals("ROuter"); //outer radius of the cone - for(int i=0;i<sections.size();i++){ - std::cout << z[i] << " " << rInner[i] << " " << rOuter[i] << std::endl; + else{ + const gear::GearParameters& pBeamPipe = gearMgr.getGearParameters("BeamPipe"); + bz = gearMgr.getBField().at( gear::Vector3D( 0.,0.,0.) ).z() ; + + // the beampipe is supposed to be a chain of cut cones (cut, that means the spike is cut off, also called a cone frustum). + // as they are connected, RStart[i] == REnd[i-1]. With this all we need are the z values and the radii at the place. + z = pBeamPipe.getDoubleVals("Z"); + rInner = pBeamPipe.getDoubleVals("RInner"); //inner radius of the cone + rOuter = pBeamPipe.getDoubleVals("ROuter"); //outer radius of the cone } + //for(int i=0;i<sections.size();i++){ + // std::cout << z[i] << " " << rInner[i] << " " << rOuter[i] << std::endl; + //} MaterialDataBase::Instance().registerForService(gearMgr, geoSvc); TMaterial & beam = *MaterialDataBase::Instance().getMaterial("beam"); TMaterial & air = *MaterialDataBase::Instance().getMaterial("air"); diff --git a/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.cc b/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.cc index cb41bf467d2a208fbc8b6ff0587f08bf5aca2ba7..fbb5f380b9cf0b9d703e0bb334d835dee1321134 100644 --- a/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.cc +++ b/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.cc @@ -10,6 +10,11 @@ #include <sstream> +#include "DetInterface/IGeoSvc.h" +#include "DD4hep/Detector.h" +#include "DDRec/DetectorData.h" +#include "CLHEP/Units/SystemOfUnits.h" + #include "gear/GEAR.h" #include "gear/BField.h" #include "gear/TPCParameters.h" @@ -22,37 +27,69 @@ // #include "streamlog/streamlog.h" -ILDTPCKalDetector::ILDTPCKalDetector( const gear::GearMgr& gearMgr ) : +ILDTPCKalDetector::ILDTPCKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc ) : TVKalDetector(250) // SJA:FIXME initial size, 250 looks reasonable for ILD, though this would be better stored as a const somewhere { - + Double_t bz; + Int_t nlayers; + Double_t lhalf, rstep, rmin, rtub, outerr, inthick, outthick; // streamlog_out(DEBUG1) << "ILDTPCKalDetector building TPC detector using GEAR " << std::endl ; - - const gear::TPCParameters& tpcParams = gearMgr.getTPCParameters(); - - const gear::PadRowLayout2D& pL = tpcParams.getPadLayout() ; - - // streamlog_out(DEBUG1) << "ILDTPCKalDetector - got padlayout with nLayers = " << pL.getNRows() << std::endl ; + if(geoSvc){ + dd4hep::DetElement world = geoSvc->getDD4HepGeo(); + dd4hep::DetElement tpc; + const std::map<std::string, dd4hep::DetElement>& subs = world.children(); + for(std::map<std::string, dd4hep::DetElement>::const_iterator it=subs.begin();it!=subs.end();it++){ + if(it->first!="TPC") continue; + tpc = it->second; + } + dd4hep::rec::FixedPadSizeTPCData* tpcData = nullptr; + try{ + tpcData = tpc.extension<dd4hep::rec::FixedPadSizeTPCData>(); + } + catch(std::runtime_error& e){ + std::cout << e.what() << " " << tpcData << std::endl; + throw GaudiException(e.what(), "FATAL", StatusCode::FAILURE); + } - const Double_t bz = gearMgr.getBField().at( gear::Vector3D( 0.,0.,0.) ).z() ; - - static const Int_t nlayers = pL.getNRows() ; // n rows - static const Double_t lhalf = tpcParams.getMaxDriftLength() ; // half length - - static const Double_t rstep = pL.getRowHeight(0) ; // step length of radius - - // assuming that this is the radius of the first measurment layer .... - static const Double_t rmin = tpcParams.getPlaneExtent()[0] + rstep/2. ; // minimum radius - - // streamlog_out( DEBUG0 ) << tpcParams << std::endl ; + const dd4hep::Direction& field = geoSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + bz = field.z(); + nlayers = tpcData->maxRow; + lhalf = tpcData->driftLength*CLHEP::cm; + rstep = tpcData->padHeight*CLHEP::cm; + rmin = tpcData->rMinReadout*CLHEP::cm + 0.5*rstep; + rtub = tpcData->rMin*CLHEP::cm; + outerr = tpcData->rMax*CLHEP::cm; + inthick = tpcData->innerWallThickness*CLHEP::cm; + outthick = tpcData->outerWallThickness*CLHEP::cm; + //std::cout << "TPC: " << nlayers << " " << lhalf << " " << rstep << " " << rmin << " " << rtub << " " << outerr << " " << inthick << " " << outthick << std::endl; + } + else{ + const gear::TPCParameters& tpcParams = gearMgr.getTPCParameters(); - static const Double_t rtub = tpcParams.getDoubleVal("tpcInnerRadius") ; // inner r of support tube - static const Double_t outerr = tpcParams.getDoubleVal("tpcOuterRadius") ; // outer radius of TPC + const gear::PadRowLayout2D& pL = tpcParams.getPadLayout() ; + + // std::cout << "ILDTPCKalDetector - got padlayout with nLayers = " << pL.getNRows() << std::endl ; + + bz = gearMgr.getBField().at( gear::Vector3D( 0.,0.,0.) ).z() ; - static const Double_t inthick = tpcParams.getDoubleVal("tpcInnerWallThickness") ; // thickness of inner shell - static const Double_t outthick = tpcParams.getDoubleVal("tpcOuterWallThickness") ; // thickness of outer shell + nlayers = pL.getNRows() ; // n rows + lhalf = tpcParams.getMaxDriftLength() ; // half length + rstep = pL.getRowHeight(0) ; // step length of radius + + // assuming that this is the radius of the first measurment layer .... + rmin = tpcParams.getPlaneExtent()[0] + rstep/2. ; // minimum radius + + // std::cout << tpcParams << std::endl ; + + rtub = tpcParams.getDoubleVal("tpcInnerRadius") ; // inner r of support tube + outerr = tpcParams.getDoubleVal("tpcOuterRadius") ; // outer radius of TPC + + inthick = tpcParams.getDoubleVal("tpcInnerWallThickness") ; // thickness of inner shell + outthick = tpcParams.getDoubleVal("tpcOuterWallThickness") ; // thickness of outer shell + //std::cout << "TPC: " << nlayers << " " << lhalf << " " << rstep << " " << rmin << " " << rtub << " " << outerr << " " << inthick << " " << outthick << std::endl; + } - MaterialDataBase::Instance().registerForService(gearMgr); + MaterialDataBase::Instance().registerForService(gearMgr, geoSvc); TMaterial & air = *MaterialDataBase::Instance().getMaterial("air"); TMaterial & tpcgas = *MaterialDataBase::Instance().getMaterial("tpcgas"); // TMaterial & aluminium = *MaterialDataBase::Instance().getMaterial("aluminium"); diff --git a/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.h b/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.h index e5ab8db97c723357f2fbd8e964ab319ec7102ca6..a249f22ce1a7133dc88135ec233c785b54d777b7 100644 --- a/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.h +++ b/Utilities/KalDet/src/ild/tpc/ILDTPCKalDetector.h @@ -14,12 +14,13 @@ namespace gear{ class GearMgr ; } +class IGeoSvc; class ILDTPCKalDetector : public TVKalDetector { public: /** Initialize the TPC from GEAR */ - ILDTPCKalDetector( const gear::GearMgr& gearMgr ); + ILDTPCKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc=0 ); private: diff --git a/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc b/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc index a820db54985ae8936acecc432c08577a3f9324de..edf608f8d762c5763290671cf44a573a9c288e07 100644 --- a/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc +++ b/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.cc @@ -10,6 +10,11 @@ #include <UTIL/BitField64.h> #include <UTIL/ILDConf.h> +#include "DetInterface/IGeoSvc.h" +#include "DD4hep/Detector.h" +#include "DDRec/DetectorData.h" +#include "CLHEP/Units/SystemOfUnits.h" + #include <gear/GEAR.h> #include "gear/BField.h" #include <gearimpl/ZPlanarParametersImpl.h> @@ -44,8 +49,12 @@ ILDVXDKalDetector::ILDVXDKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geo _vxd_Cryostat.exists = false; - this->setupGearGeom(gearMgr, geoSvc) ; - + if(geoSvc){ + this->setupGearGeom(geoSvc) ; + } + else{ + this->setupGearGeom(gearMgr) ; + } //--The Ladder structure (realistic ladder)-- int nLadders; @@ -315,18 +324,84 @@ ILDVXDKalDetector::ILDVXDKalDetector( const gear::GearMgr& gearMgr, IGeoSvc* geo SetOwner(); } +void ILDVXDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr ){ + const gear::VXDParameters& pVXDDetMain = gearMgr.getVXDParameters(); + const gear::VXDLayerLayout& pVXDLayerLayout = pVXDDetMain.getVXDLayerLayout(); + _bZ = gearMgr.getBField().at( gear::Vector3D( 0.,0.,0.) ).z() ; + _nLayers = pVXDLayerLayout.getNLayers(); + _VXDgeo.resize(_nLayers); -void ILDVXDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc){ + for( int layer=0; layer < _nLayers; ++layer){ + _VXDgeo[layer].nLadders = pVXDLayerLayout.getNLadders(layer); + _VXDgeo[layer].phi0 = pVXDLayerLayout.getPhi0(layer); + _VXDgeo[layer].dphi = 2*M_PI / _VXDgeo[layer].nLadders; + _VXDgeo[layer].senRMin = pVXDLayerLayout.getSensitiveDistance(layer); + _VXDgeo[layer].supRMin = pVXDLayerLayout.getLadderDistance(layer); + _VXDgeo[layer].length = pVXDLayerLayout.getSensitiveLength(layer) * 2.0 ; // note: gear for historical reasons uses the halflength + _VXDgeo[layer].width = pVXDLayerLayout.getSensitiveWidth(layer); + _VXDgeo[layer].offset = pVXDLayerLayout.getSensitiveOffset(layer); + _VXDgeo[layer].senThickness = pVXDLayerLayout.getSensitiveThickness(layer); + _VXDgeo[layer].supThickness = pVXDLayerLayout.getLadderThickness(layer); + //std::cout << layer << ": " << _VXDgeo[layer].nLadders << " " << _VXDgeo[layer].phi0 << " " << _VXDgeo[layer].dphi << " " << _VXDgeo[layer].senRMin + // << " " << _VXDgeo[layer].supRMin << " " << _VXDgeo[layer].length << " " << _VXDgeo[layer].width << " " << _VXDgeo[layer].offset + // << " " << _VXDgeo[layer].senThickness << " " << _VXDgeo[layer].supThickness << std::endl; + } + + _relative_position_of_measurement_surface = 0.5 ; + + try { + _relative_position_of_measurement_surface = pVXDDetMain.getDoubleVal( "relative_position_of_measurement_surface" ); + } + catch (gear::UnknownParameterException& e) {} + try { + const gear::GearParameters& pVXDInfra = gearMgr.getGearParameters("VXDInfra"); + _vxd_Cryostat.alRadius = pVXDInfra.getDoubleVal( "CryostatAlRadius" ); + _vxd_Cryostat.alThickness = pVXDInfra.getDoubleVal( "CryostatAlThickness" ); + _vxd_Cryostat.alInnerR = pVXDInfra.getDoubleVal( "CryostatAlInnerR" ); + _vxd_Cryostat.alZEndCap = pVXDInfra.getDoubleVal( "CryostatAlZEndCap" ); + _vxd_Cryostat.alHalfZ = pVXDInfra.getDoubleVal( "CryostatAlHalfZ" ); + + _vxd_Cryostat.shellInnerR = pVXDDetMain.getShellInnerRadius(); + _vxd_Cryostat.shellThickness = pVXDDetMain.getShellOuterRadius() - _vxd_Cryostat.shellInnerR; + _vxd_Cryostat.shelllHalfZ = pVXDDetMain.getShellHalfLength(); + + _vxd_Cryostat.exists = true; + //std::cout << "VXDInfra: " << _vxd_Cryostat.alRadius << " " << _vxd_Cryostat.alThickness << " " << _vxd_Cryostat.alInnerR << " " << _vxd_Cryostat.alZEndCap << " " + // << _vxd_Cryostat.alHalfZ << " " << _vxd_Cryostat.shellInnerR << " " << _vxd_Cryostat.shellThickness << " " << _vxd_Cryostat.shelllHalfZ << std::endl; + } + catch (gear::UnknownParameterException& e) { + std::cout << e.what() << std::endl ; + _vxd_Cryostat.exists = false; + + } +} + + +void ILDVXDKalDetector::setupGearGeom( IGeoSvc* geoSvc){ + /* + dd4hep::DetElement world = geoSvc->getDD4HepGeo(); + dd4hep::DetElement vxd; + const std::map<std::string, dd4hep::DetElement>& subs = world.children(); + for(std::map<std::string, dd4hep::DetElement>::const_iterator it=subs.begin();it!=subs.end();it++){ + if(it->first!="VXD") continue; + vxd = it->second; + } + dd4hep::rec::ZPlanarData* vxdData = nullptr; + try{ + vxdData = vxd.extension<dd4hep::rec::ZPlanarData>(); + } + catch(std::runtime_error& e){ + std::cout << e.what() << " " << vxdData << std::endl; + throw GaudiException(e.what(), "FATAL", StatusCode::FAILURE); + } + */ + const dd4hep::Direction& field = geoSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + _bZ = field.z(); - const gear::VXDParameters& pVXDDetMainObject = gearMgr.getVXDParameters(); - const gear::VXDParameters* pVXDDetMain2 = &pVXDDetMainObject; const gear::ZPlanarParametersImpl* pVXDDetMain = geoSvc->getVXDParameters(); const gear::VXDLayerLayout& pVXDLayerLayout = pVXDDetMain->getVXDLayerLayout(); - const gear::VXDLayerLayout& pVXDLayerLayout2 = pVXDDetMain2->getVXDLayerLayout(); - - _bZ = gearMgr.getBField().at( gear::Vector3D( 0.,0.,0.) ).z() ; _nLayers = pVXDLayerLayout.getNLayers(); _VXDgeo.resize(_nLayers); @@ -347,42 +422,16 @@ void ILDVXDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr, IGeoSvc* ge _VXDgeo[layer].offset = pVXDLayerLayout.getSensitiveOffset(layer); _VXDgeo[layer].senThickness = pVXDLayerLayout.getSensitiveThickness(layer); _VXDgeo[layer].supThickness = pVXDLayerLayout.getLadderThickness(layer); - std::cout << layer << ": " << _VXDgeo[layer].nLadders << " " << _VXDgeo[layer].phi0 << " " << _VXDgeo[layer].dphi << " " << _VXDgeo[layer].senRMin - << " " << _VXDgeo[layer].supRMin << " " << _VXDgeo[layer].length << " " << _VXDgeo[layer].width << " " << _VXDgeo[layer].offset - << " " << _VXDgeo[layer].senThickness << " " << _VXDgeo[layer].supThickness << std::endl; - std::cout << layer << ": " << pVXDLayerLayout2.getNLadders(layer) << " " << pVXDLayerLayout2.getPhi0(layer) << " " << 2*M_PI/pVXDLayerLayout2.getNLadders(layer) - << " " << pVXDLayerLayout2.getSensitiveDistance(layer) << " " << pVXDLayerLayout2.getLadderDistance(layer) - << " " << pVXDLayerLayout2.getSensitiveLength(layer)*2 << " " << pVXDLayerLayout2.getSensitiveWidth(layer) - << " " << pVXDLayerLayout2.getSensitiveOffset(layer) << " " << pVXDLayerLayout2.getSensitiveThickness(layer) - << " " << pVXDLayerLayout2.getLadderThickness(layer) << std::endl; + //std::cout << layer << ": " << _VXDgeo[layer].nLadders << " " << _VXDgeo[layer].phi0 << " " << _VXDgeo[layer].dphi << " " << _VXDgeo[layer].senRMin + // << " " << _VXDgeo[layer].supRMin << " " << _VXDgeo[layer].length << " " << _VXDgeo[layer].width << " " << _VXDgeo[layer].offset + // << " " << _VXDgeo[layer].senThickness << " " << _VXDgeo[layer].supThickness << std::endl; } // by default, we put the measurement surface in the middle of the sensitive // layer, this can optionally be changed, e.g. in the case of the FPCCD where the // epitaxial layer is 15 mu thick (in a 50 mu wafer) _relative_position_of_measurement_surface = 0.5 ; - - try { - - _relative_position_of_measurement_surface = pVXDDetMain->getDoubleVal( "relative_position_of_measurement_surface" ); - - // streamlog_out(DEBUG) << " ILDVXDKalDetector::setupGearGeom: relative_position_of_measurement_surface parameter is provided : " << _relative_position_of_measurement_surface << std::endl ; - - } catch (gear::UnknownParameterException& e) {} - // Cryostat try { - - //const gear::GearParameters& pVXDInfraObject = gearMgr.getGearParameters("VXDInfra"); - //const gear::GearParameters* pVXDInfra = &pVXDInfraObject; - //change Gear to GeoSvc - //const gear::GearParametersImpl* pVXDInfra = geoSvc->getDetParameters("VXDInfra"); - //_vxd_Cryostat.alRadius = pVXDInfra->getDoubleVal( "CryostatAlRadius" ); - //_vxd_Cryostat.alThickness = pVXDInfra->getDoubleVal( "CryostatAlThickness" ); - //_vxd_Cryostat.alInnerR = pVXDInfra->getDoubleVal( "CryostatAlInnerR" ); - //_vxd_Cryostat.alZEndCap = pVXDInfra->getDoubleVal( "CryostatAlZEndCap" ); - //_vxd_Cryostat.alHalfZ = pVXDInfra->getDoubleVal( "CryostatAlHalfZ" ); - //change GearParametersImpl to get directly - //const std::map<std::string,double>& vxdInfra = geoSvc->getDetParameters("VXDInfra"); _vxd_Cryostat.alRadius = geoSvc->getDetParameter("VXDInfra","CryostatAlRadius"); _vxd_Cryostat.alThickness = geoSvc->getDetParameter("VXDInfra","CryostatAlThickness"); _vxd_Cryostat.alInnerR = geoSvc->getDetParameter("VXDInfra","CryostatAlInnerR"); @@ -394,10 +443,10 @@ void ILDVXDKalDetector::setupGearGeom( const gear::GearMgr& gearMgr, IGeoSvc* ge _vxd_Cryostat.shelllHalfZ = pVXDDetMain->getShellHalfLength(); _vxd_Cryostat.exists = true; + //std::cout << "VXDInfra: " << _vxd_Cryostat.alRadius << " " << _vxd_Cryostat.alThickness << " " << _vxd_Cryostat.alInnerR << " " << _vxd_Cryostat.alZEndCap << " " + // << _vxd_Cryostat.alHalfZ << " " << _vxd_Cryostat.shellInnerR << " " << _vxd_Cryostat.shellThickness << " " << _vxd_Cryostat.shelllHalfZ << std::endl; } - //catch (gear::UnknownParameterException& e) { catch (std::runtime_error& e) { - //streamlog_out( WARNING ) << "ILDVXDKalDetector Cryostat values not found in GEAR file " << std::endl ; std::cout << e.what() << std::endl ; _vxd_Cryostat.exists = false; diff --git a/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.h b/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.h index c0205e149f55b4ca2340cdfc7549b17fd020cdbc..05840c8c85477a4083404a22dfcadb652d7a0e60 100644 --- a/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.h +++ b/Utilities/KalDet/src/ild/vxd/ILDVXDKalDetector.h @@ -27,7 +27,8 @@ public: private: - void setupGearGeom( const gear::GearMgr& gearMgr, IGeoSvc* geoSvc) ; + void setupGearGeom( const gear::GearMgr& gearMgr ); + void setupGearGeom( IGeoSvc* geoSvc) ; int _nLayers ; double _bZ ; diff --git a/Utilities/KiTrack/CMakeLists.txt b/Utilities/KiTrack/CMakeLists.txt index ba301e6f28ee08c56499eba92278cc5edc6343f1..97d9248ae6117142527a7faf646da37ec24a7da4 100644 --- a/Utilities/KiTrack/CMakeLists.txt +++ b/Utilities/KiTrack/CMakeLists.txt @@ -2,10 +2,10 @@ gaudi_subdir(KiTrack v0r0) find_package(ROOT REQUIRED) find_package(CLHEP REQUIRED) -#find_package(DD4hep REQUIRED) find_package(GSL REQUIRED) find_package(EDM4HEP REQUIRED) find_package(LCIO REQUIRED) +find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) gaudi_depends_on_subdirs(Service/TrackSystemSvc Utilities/DataHelper)