diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt index 01a0267f1890ca67df4831a5067719b65e73d88c..dade7622c8f3144db1a18916bd5af4852739efdd 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt +++ b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt @@ -11,6 +11,7 @@ gaudi_add_module(GaudiPandora LINK EventSeeder GearSvc DataHelperLib + DecoderHelperLib DetInterface Gaudi::GaudiKernel k4FWCore::k4FWCore diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp index 29b9adcbfa023d2abbb5280e7a028e4aff224439..bb63363fe1b6719569888bcdfeaa91d39a1a6481 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp @@ -21,7 +21,7 @@ #include "PandoraPFAlg.h" #include "CaloHitCreator.h" - +#include "DecoderHelper/DD4hep2Lcio.h" #include <algorithm> #include <cmath> #include <limits> @@ -322,7 +322,8 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col } else{ Stave = m_decoder->get(pCaloHit->getCellID(), "stave"); - Stave = Stave <=2 ? Stave+5 : Stave-3 ;//change to correct style + Stave = DD4hep2Lcio::CEPCv4::getEcalStave(Stave); + //Stave = Stave <=2 ? Stave+5 : Stave-3 ;//change to correct style } //std::cout<<"0Stave="<<Stave<<",0layer="<<caloHitParameters.m_layer.Get()<<std::endl; if (Stave<0) throw "wrong Stave"; @@ -449,7 +450,8 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col } else{ Stave = m_decoder->get(pCaloHit->getCellID(), "stave"); - Stave = Stave ==0 ? Stave+7 : Stave-1 ;//correct, same with LCIO + Stave = DD4hep2Lcio::CEPCv4::getHcalStave(Stave); + //Stave = Stave ==0 ? Stave+7 : Stave-1 ;//correct, same with LCIO /* 1 0 **** **** @@ -583,7 +585,8 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col } else{ Stave = m_decoder->get(pCaloHit->getCellID(), "stave"); - Stave = 12 - Stave ;//correct to be same with LCIO + Stave = DD4hep2Lcio::CEPCv4::getMuonStave(Stave); + //Stave = 12 - Stave ;//correct to be same with LCIO if(Stave<0) throw("throw wrong stave number?"); } diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 7558d9c2f012f9e95edddcec2811687f25450506..fd5eb932fd7ba2bdce7640d104ca0c8ea8eac86d 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -2,4 +2,5 @@ add_subdirectory(DataHelper) add_subdirectory(KalTest) add_subdirectory(KalDet) add_subdirectory(KiTrack) +add_subdirectory(DecoderHelper) diff --git a/Utilities/DecoderHelper/CMakeLists.txt b/Utilities/DecoderHelper/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c3f4ca9ec0729ade291be0428a6cb5348a61814 --- /dev/null +++ b/Utilities/DecoderHelper/CMakeLists.txt @@ -0,0 +1,10 @@ + +gaudi_add_library(DecoderHelperLib + SOURCES src/DD4hep2Lcio.cc +) + +install(TARGETS DecoderHelperLib + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Utilities/DecoderHelper/include/DecoderHelper/DD4hep2Lcio.h b/Utilities/DecoderHelper/include/DecoderHelper/DD4hep2Lcio.h new file mode 100644 index 0000000000000000000000000000000000000000..a5a2210df3e94839bff9f1988311a01195520844 --- /dev/null +++ b/Utilities/DecoderHelper/include/DecoderHelper/DD4hep2Lcio.h @@ -0,0 +1,14 @@ +#ifndef DD4HEP2LCIO_H +#define DD4HEP2LCIO_H + +namespace DD4hep2Lcio { + namespace CEPCv4 { + int getEcalLayer(int dd4hep_layer); + int getEcalStave(int dd4hep_stave); + int getHcalLayer(int dd4hep_layer); + int getHcalStave(int dd4hep_stave); + int getMuonLayer(int dd4hep_layer); + int getMuonStave(int dd4hep_stave); + } +} +#endif diff --git a/Utilities/DecoderHelper/src/DD4hep2Lcio.cc b/Utilities/DecoderHelper/src/DD4hep2Lcio.cc new file mode 100644 index 0000000000000000000000000000000000000000..30dba288134e03f2b89f5b8452f3c4e7dee24fe3 --- /dev/null +++ b/Utilities/DecoderHelper/src/DD4hep2Lcio.cc @@ -0,0 +1,36 @@ +#include "DecoderHelper/DD4hep2Lcio.h" + +int DD4hep2Lcio::CEPCv4::getEcalLayer(int dd4hep_layer){ + return dd4hep_layer - 1 ; +} +int DD4hep2Lcio::CEPCv4::getEcalStave(int dd4hep_stave){ + int lcio_stave = dd4hep_stave <=2 ? dd4hep_stave+5 : dd4hep_stave-3 ; + return lcio_stave ; +} +int DD4hep2Lcio::CEPCv4::getHcalLayer(int dd4hep_layer){ + return dd4hep_layer - 1 ; +} +int DD4hep2Lcio::CEPCv4::getHcalStave(int dd4hep_stave){ + + int lcio_stave = dd4hep_stave ==0 ? dd4hep_stave+7 : dd4hep_stave-1 ; + /* + 1 0 + **** **** + 2 * * 0 1 * * 7 + * * * * + 3* * 7 ---> 2* * 6 + * * * * + 4 * * 6 3 * * 5 + **** **** + 5 4 + + + */ + return lcio_stave ; +} +int DD4hep2Lcio::CEPCv4::getMuonLayer(int dd4hep_layer){ + return dd4hep_layer - 1 ; +} +int DD4hep2Lcio::CEPCv4::getMuonStave(int dd4hep_stave){ + return 12 - dd4hep_stave ; +}