diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml new file mode 100644 index 0000000..564008d --- /dev/null +++ b/.github/workflows/coverity.yml @@ -0,0 +1,21 @@ +name: coverity + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + run-coverity: + runs-on: ubuntu-latest + if: github.repository == 'iLCSoft/DDMarlinPandora' + steps: + - uses: actions/checkout@v2 + - uses: cvmfs-contrib/github-action-cvmfs@v2 + - uses: aidasoft/run-lcg-view@v3 + with: + coverity-cmake-command: 'cmake -C $ILCSOFT/ILCSoft.cmake ..' + coverity-project: 'iLCSoft%2FDDMarlinPandora' + coverity-project-token: ${{ secrets.DDMARLINPANDORA_COVERITY_TOKEN }} + github-pat: ${{ secrets.READ_COVERITY_IMAGE }} + view-path: "/cvmfs/clicdp.cern.ch/iLCSoft/lcg/100/nightly/x86_64-centos7-gcc10-opt" + setup-script: "init_ilcsoft.sh" diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..a8d799b --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,29 @@ +name: linux +on: [push, pull_request] + +jobs: + centos7: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + COMPILER: [gcc10, clang11] + LCG: [100] + include: + - COMPILER: gcc8 + LCG: 99python2 + + steps: + - uses: actions/checkout@v2 + - uses: cvmfs-contrib/github-action-cvmfs@v2 + - uses: aidasoft/run-lcg-view@v3 + with: + view-path: "/cvmfs/clicdp.cern.ch/iLCSoft/lcg/${{ matrix.LCG }}/nightly/x86_64-centos7-${{ matrix.COMPILER }}-opt" + setup-script: "init_ilcsoft.sh" + run: | + mkdir build + cd build + cmake -GNinja -C ${ILCSOFT}/ILCSoft.cmake -DCMAKE_CXX_FLAGS=" -fdiagnostics-color=always " .. + ninja -k0 + ctest --output-on-failure + ninja install diff --git a/.travis-ci.d/compile_and_test.sh b/.travis-ci.d/compile_and_test.sh deleted file mode 100755 index 0247546..0000000 --- a/.travis-ci.d/compile_and_test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -ILCSOFT=/cvmfs/clicdp.cern.ch/iLCSoft/builds/current/CI_${COMPILER} -source $ILCSOFT/init_ilcsoft.sh - -cd /Package -mkdir build -cd build -cmake -GNinja -C $ILCSOFT/ILCSoft.cmake -DCMAKE_CXX_FLAGS="-fdiagnostics-color=always" .. && \ -ninja -k 0 && \ -ninja install && \ -ctest --output-on-failure diff --git a/.travis-ci.d/coverity_scan.sh b/.travis-ci.d/coverity_scan.sh deleted file mode 100755 index 8ee8bf1..0000000 --- a/.travis-ci.d/coverity_scan.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -ILCSOFT=/cvmfs/clicdp.cern.ch/iLCSoft/builds/current/CI_${COMPILER} -source $ILCSOFT/init_ilcsoft.sh - -cd /Package -mkdir build -cd build -cmake -C $ILCSOFT/ILCSoft.cmake -DCMAKE_CXX_FLAGS="-fdiagnostics-color=always" .. && \ -export PATH=/Package/cov-analysis-linux64/bin:$PATH && \ -cov-build --dir cov-int make -j2 && \ -tar czvf myproject.tgz cov-int diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 51b6d14..0000000 --- a/.travis.yml +++ /dev/null @@ -1,72 +0,0 @@ -sudo: required -dist: trusty - -services: - - docker - -language: cpp - -env: - matrix: - - COMPILER=gcc - - COMPILER=llvm - - -before_install: - - wget https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest_all.deb - - sudo dpkg -i cvmfs-release-latest_all.deb - - sudo apt-get update - - sudo apt-get install cvmfs cvmfs-config-default - - rm -f cvmfs-release-latest_all.deb - - wget https://lcd-data.web.cern.ch/lcd-data/CernVM/default.local - - sudo mkdir -p /etc/cvmfs - - sudo mv default.local /etc/cvmfs/default.local - - sudo /etc/init.d/autofs stop - - sudo cvmfs_config setup - - sudo mkdir -p /cvmfs/clicdp.cern.ch - - sudo mkdir -p /cvmfs/geant4.cern.ch - - sudo mkdir -p /cvmfs/sft.cern.ch - - sudo mount -t cvmfs clicdp.cern.ch /cvmfs/clicdp.cern.ch - - sudo mount -t cvmfs geant4.cern.ch /cvmfs/geant4.cern.ch - - sudo mount -t cvmfs sft.cern.ch /cvmfs/sft.cern.ch - - ls /cvmfs/clicdp.cern.ch - - ls /cvmfs/geant4.cern.ch - - ls /cvmfs/sft.cern.ch/lcg - -# command to install dependencies -install: - - shopt -s extglob dotglob - - mkdir Package - - mv !(Package) Package - - shopt -u dotglob - - export PKGDIR=${PWD}/Package - - export description=`date` - - export COVERITY_REPO=`echo ${TRAVIS_REPO_SLUG} | sed 's/\//\%2F/g'` - - if [[ "${TRAVIS_EVENT_TYPE}" == "cron" && "${COMPILER}" == "gcc" ]]; - then wget https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_SCAN_TOKEN}&project=${COVERITY_REPO}" -O Package/coverity_tool.tgz; cd Package; mkdir cov-analysis-linux64; tar -xf coverity_tool.tgz -C cov-analysis-linux64 --strip-components=1; - fi - -# command to run tests -script: - - docker run -it --name CI_container -v $PKGDIR:/Package -e COMPILER=$COMPILER -v /cvmfs:/cvmfs -d clicdp/cc7-lcg /bin/bash - - if [[ "${TRAVIS_EVENT_TYPE}" == "cron" && "${COMPILER}" == "gcc" ]]; - then docker exec -it CI_container /bin/bash -c "./Package/.travis-ci.d/coverity_scan.sh"; - elif [[ "${TRAVIS_EVENT_TYPE}" == "cron" && "${COMPILER}" == "llvm" ]]; - then echo "Running the weekly Coverity Scan, no LLVM/Clang build this time"; - else docker exec -it CI_container /bin/bash -c "./Package/.travis-ci.d/compile_and_test.sh"; - fi - - if [[ "${TRAVIS_EVENT_TYPE}" == "cron" && "${COMPILER}" == "gcc" ]]; - then curl --form token=${COVERITY_SCAN_TOKEN} --form email=noreply@cern.ch --form file=@${PKGDIR}/build/myproject.tgz --form version="master" --form description="${description}" https://scan.coverity.com/builds?project=${COVERITY_REPO} ; - fi - -# Trigger to rebuild iLCSoft -after_success: - - if [[ "${TRAVIS_EVENT_TYPE}" != "cron" && "${TRAVIS_EVENT_TYPE}" != "pull_request" && "${COMPILER}" == "gcc" && "${TRAVIS_REPO_SLUG%/*}" == "iLCSoft" && -z ${TRAVIS_TAG} ]]; - then curl -X POST -F token=$GITLAB_TOKEN -F ref=master https://gitlab.cern.ch/api/v4/projects/7828/trigger/pipeline; - fi - -# Don't send e-mail notifications -notifications: - email: - on_success: never - on_failure: always diff --git a/CMakeLists.txt b/CMakeLists.txt index c519173..6f8393f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ PROJECT( DDMarlinPandora ) # project version# continuing from MarlinPandora version 2.0.0 revision 1934 SET( DDMarlinPandora_VERSION_MAJOR 0 ) -SET( DDMarlinPandora_VERSION_MINOR 13 ) +SET( DDMarlinPandora_VERSION_MINOR 14 ) SET( DDMarlinPandora_VERSION_PATCH 0 ) diff --git a/doc/ReleaseNotes.md b/doc/ReleaseNotes.md index b1847b8..f60147c 100644 --- a/doc/ReleaseNotes.md +++ b/doc/ReleaseNotes.md @@ -1,3 +1,12 @@ +# v00-12 + +* 2021-09-06 Placido Fernandez Declara ([PR#21](https://github.com/iLCSoft/DDMarlinPandora/pull/21)) + - DDCaloDigi: Add setting of the fromType and toType parameters for the LCRelation collection between CaloHit and SimCaloHit + - DDSimpleMuonDigi: Add setting of the fromType and toType parameters for the LCRelation collection between CaloHit and SimCaloHit + +* 2021-08-23 Andre Sailer ([PR#22](https://github.com/iLCSoft/DDMarlinPandora/pull/22)) + - CI: build against LCG_99python2 gcc8 and LCG_100 gcc10, clang11 + # v00-11 * 2019-12-11 Ete Remi ([PR#19](https://github.com/iLCSoft/DDMarlinPandora/pull/19)) diff --git a/src/DDCaloDigi.cc b/src/DDCaloDigi.cc index 407d91d..2ce2ef1 100644 --- a/src/DDCaloDigi.cc +++ b/src/DDCaloDigi.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -684,7 +685,10 @@ void DDCaloDigi::processRunHeader( LCRunHeader* /*run*/) { void DDCaloDigi::processEvent( LCEvent * evt ) { // create the output collections - LCCollectionVec *relcol = new LCCollectionVec(LCIO::LCRELATION); + + // Relation collection CalorimeterHit, SimCalorimeterHit + LCCollection* chschcol = 0; + UTIL::LCRelationNavigator calohitNav = UTIL::LCRelationNavigator( LCIO::CALORIMETERHIT, LCIO::SIMCALORIMETERHIT ); // copy the flags from the input collection _flag.setBit(LCIO::CHBIT_LONG); @@ -901,8 +905,10 @@ void DDCaloDigi::processEvent( LCEvent * evt ) { calhit->setType( CHT( CHT::em, CHT::ecal , caloLayout , layer ) ); calhit->setRawHit(hit); ecalcol->addElement(calhit); - LCRelationImpl *rel = new LCRelationImpl(calhit,hit,1.0); - relcol->addElement( rel ); + + // Set relation with LCRelationNavigator + calohitNav.addRelation(calhit, hit, 1.0); + }else{ // if(caloLayout==CHT::barrel)std::cout << " Drop ECAL Barrel hit : " << timei << " " << calibr_coeff*energyi << std::endl; } @@ -932,8 +938,9 @@ void DDCaloDigi::processEvent( LCEvent * evt ) { calhit->setType( CHT( CHT::em, CHT::ecal , caloLayout , layer ) ); calhit->setRawHit(hit); ecalcol->addElement(calhit); - LCRelationImpl *rel = new LCRelationImpl(calhit,hit,1.0); - relcol->addElement( rel ); + + // Set relation with LCRelationNavigator + calohitNav.addRelation(calhit, hit, 1.0); } // timing if...else @@ -1128,8 +1135,10 @@ void DDCaloDigi::processEvent( LCEvent * evt ) { calhit->setType( CHT( CHT::had, CHT::hcal , caloLayout , layer ) ); calhit->setRawHit(hit); hcalcol->addElement(calhit); - LCRelationImpl *rel = new LCRelationImpl(calhit,hit,1.0); - relcol->addElement( rel ); + + // Set relation with LCRelationNavigator + calohitNav.addRelation(calhit, hit, 1.0); + }else{ // std::cout << "Drop HCAL hit : " << timei << " " << calibr_coeff*energyi << std::endl; } @@ -1159,8 +1168,8 @@ void DDCaloDigi::processEvent( LCEvent * evt ) { calhit->setType( CHT( CHT::had, CHT::hcal , caloLayout , layer ) ); calhit->setRawHit(hit); hcalcol->addElement(calhit); - LCRelationImpl *rel = new LCRelationImpl(calhit,hit,1.0); - relcol->addElement( rel ); + + calohitNav.addRelation(calhit, hit, 1.0); } // std::cout << hit->getTimeCont(0) << " count = " << count << " EHCAL = " << energyCal << " - " << eCellInTime << " - " << eCellOutput << std::endl; @@ -1175,8 +1184,9 @@ void DDCaloDigi::processEvent( LCEvent * evt ) { } } - // add relation collection for ECAL/HCAL to event - evt->addCollection(relcol,_outputRelCollection.c_str()); + // Create and add relation collection for ECAL/HCAL to event + chschcol = calohitNav.createLCCollection(); + evt->addCollection(chschcol,_outputRelCollection.c_str()); _nEvt++; diff --git a/src/DDSimpleMuonDigi.cc b/src/DDSimpleMuonDigi.cc index 1177dd8..caee371 100644 --- a/src/DDSimpleMuonDigi.cc +++ b/src/DDSimpleMuonDigi.cc @@ -7,6 +7,7 @@ #include #include #include +#include // #include // #include @@ -178,7 +179,9 @@ void DDSimpleMuonDigi::processEvent( LCEvent * evt ) { LCCollectionVec *muoncol = new LCCollectionVec(LCIO::CALORIMETERHIT); - LCCollectionVec *relcol = new LCCollectionVec(LCIO::LCRELATION); + // Relation collection CalorimeterHit, SimCalorimeterHit + LCCollection* chschcol = 0; + UTIL::LCRelationNavigator calohitNav = UTIL::LCRelationNavigator( LCIO::CALORIMETERHIT, LCIO::SIMCALORIMETERHIT ); LCFlagImpl flag; @@ -227,8 +230,7 @@ void DDSimpleMuonDigi::processEvent( LCEvent * evt ) { calhit->setTime( computeHitTime(hit) ); calhit->setRawHit(hit); muoncol->addElement(calhit); - LCRelationImpl *rel = new LCRelationImpl(calhit,hit,1.); - relcol->addElement( rel ); + calohitNav.addRelation(calhit, hit, 1.0); } } @@ -238,7 +240,9 @@ void DDSimpleMuonDigi::processEvent( LCEvent * evt ) { } muoncol->parameters().setValue(LCIO::CellIDEncoding,initString); evt->addCollection(muoncol,_outputMuonCollection.c_str()); - evt->addCollection(relcol,_outputRelCollection.c_str()); + // Create and add relation collection for ECAL/HCAL to event + chschcol = calohitNav.createLCCollection(); + evt->addCollection(chschcol,_outputRelCollection.c_str()); _nEvt++;