From 3d5fa5ca634c8428a5506f023f3276fc3f1032b8 Mon Sep 17 00:00:00 2001 From: lintao <lintao51@gmail.com> Date: Fri, 24 Sep 2021 22:46:20 +0800 Subject: [PATCH] WIP: let CEPCSW work with the key4hep nightlies 2021-09-20. --- Analysis/TotalInvMass/CMakeLists.txt | 3 +++ Analysis/TrackInspect/CMakeLists.txt | 3 ++- Detector/GeomSvc/CMakeLists.txt | 4 ++++ Digitisers/DCHDigi/src/DCHDigiAlg.cpp | 15 +++++++++++---- Utilities/DataHelper/CMakeLists.txt | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Analysis/TotalInvMass/CMakeLists.txt b/Analysis/TotalInvMass/CMakeLists.txt index 6a9be88e..25c509a0 100644 --- a/Analysis/TotalInvMass/CMakeLists.txt +++ b/Analysis/TotalInvMass/CMakeLists.txt @@ -11,6 +11,9 @@ gaudi_add_module(TotalInvMass ${ROOT_LIBRARIES} ) +target_include_directories(TotalInvMass + PUBLIC ${LCIO_INCLUDE_DIRS}) + install(TARGETS TotalInvMass EXPORT CEPCSWTargets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin diff --git a/Analysis/TrackInspect/CMakeLists.txt b/Analysis/TrackInspect/CMakeLists.txt index fa42c050..da2f2ed5 100644 --- a/Analysis/TrackInspect/CMakeLists.txt +++ b/Analysis/TrackInspect/CMakeLists.txt @@ -2,7 +2,8 @@ # Modules gaudi_add_module(TrackInspect SOURCES src/TrackInspectAlg.cpp - LINK DataHelperLib + LINK DataHelperLib + k4FWCore::k4FWCore Gaudi::GaudiKernel EDM4HEP::edm4hep ${ROOT_LIBRARIES} diff --git a/Detector/GeomSvc/CMakeLists.txt b/Detector/GeomSvc/CMakeLists.txt index 137aa0e5..997f9e97 100644 --- a/Detector/GeomSvc/CMakeLists.txt +++ b/Detector/GeomSvc/CMakeLists.txt @@ -14,6 +14,10 @@ gaudi_add_module(GeomSvc ${ROOT_LIBRARIES} ) +target_include_directories(GeomSvc + PUBLIC ${GEAR_INCLUDE_DIRS} +) + install(TARGETS GeomSvc EXPORT CEPCSWTargets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin diff --git a/Digitisers/DCHDigi/src/DCHDigiAlg.cpp b/Digitisers/DCHDigi/src/DCHDigiAlg.cpp index 01fb9406..4a68a1ea 100644 --- a/Digitisers/DCHDigi/src/DCHDigiAlg.cpp +++ b/Digitisers/DCHDigi/src/DCHDigiAlg.cpp @@ -93,14 +93,21 @@ StatusCode DCHDigiAlg::execute() info() << "Processing " << _nEvt << " events " << endmsg; m_evt = _nEvt; - std::map<unsigned long long, std::vector<edm4hep::SimTrackerHit> > id_hits_map; edm4hep::TrackerHitCollection* Vec = w_DigiDCHCol.createAndPut(); edm4hep::MCRecoTrackerAssociationCollection* AssoVec = w_AssociationCol.createAndPut(); const edm4hep::SimTrackerHitCollection* SimHitCol = r_SimDCHCol.get(); + if (SimHitCol->size() == 0) { + return StatusCode::SUCCESS; + } debug()<<"input sim hit size="<< SimHitCol->size() <<endmsg; + + auto SimHit0 = SimHitCol->at(0); + std::map<unsigned long long, std::vector<decltype(SimHit0)> > id_hits_map; + //std::map<unsigned long long, std::vector<edm4hep::ConstSimTrackerhit> > id_hits_map; + for( int i = 0; i < SimHitCol->size(); i++ ) { - edm4hep::SimTrackerHit SimHit = SimHitCol->at(i); + auto SimHit = SimHitCol->at(i); unsigned long long id = SimHit.getCellID(); float sim_hit_mom = sqrt( SimHit.getMomentum()[0]*SimHit.getMomentum()[0] + SimHit.getMomentum()[1]*SimHit.getMomentum()[1] + SimHit.getMomentum()[2]*SimHit.getMomentum()[2] );//GeV if(sim_hit_mom < m_mom_threshold) continue; @@ -109,7 +116,7 @@ StatusCode DCHDigiAlg::execute() if ( id_hits_map.find(id) != id_hits_map.end()) id_hits_map[id].push_back(SimHit); else { - std::vector<edm4hep::SimTrackerHit> vhit; + std::vector< decltype(SimHit) > vhit; vhit.push_back(SimHit); id_hits_map[id] = vhit ; } @@ -118,7 +125,7 @@ StatusCode DCHDigiAlg::execute() m_n_sim = 0; m_n_digi = 0 ; } - for(std::map<unsigned long long, std::vector<edm4hep::SimTrackerHit> >::iterator iter = id_hits_map.begin(); iter != id_hits_map.end(); iter++) + for(auto iter = id_hits_map.begin(); iter != id_hits_map.end(); iter++) { unsigned long long wcellid = iter->first; auto trkHit = Vec->create(); diff --git a/Utilities/DataHelper/CMakeLists.txt b/Utilities/DataHelper/CMakeLists.txt index c2d23702..8398a655 100644 --- a/Utilities/DataHelper/CMakeLists.txt +++ b/Utilities/DataHelper/CMakeLists.txt @@ -18,7 +18,7 @@ gaudi_add_library(DataHelperLib src/TrackerHitHelper.cpp LINK EDM4HEP::edm4hep EDM4HEP::edm4hepDict - ${GSL_LIBRARIES} + GSL::gsl ${CLHEP_LIBRARIES} Identifier ) -- GitLab