From e9d47ae9d44edc32428c050a8cf0c246b3745276 Mon Sep 17 00:00:00 2001 From: Cao Guangjie <gjcao@lxslc614.ihep.ac.cn> Date: Wed, 18 Sep 2019 09:17:16 +0800 Subject: [PATCH] Recovery of PlcioReadAlg & Update config python file --- Examples/options/LCIO_read.py | 3 +++ Examples/options/plcio_write.py | 2 +- Examples/src/PlcioTest/PlcioReadAlg.cpp | 20 ++++++++++++-------- Examples/src/PlcioTest/PlcioReadAlg.h | 4 +++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Examples/options/LCIO_read.py b/Examples/options/LCIO_read.py index 0a3a9428..372754e2 100644 --- a/Examples/options/LCIO_read.py +++ b/Examples/options/LCIO_read.py @@ -7,9 +7,12 @@ dsvc = LCIODataSvc("EventDataSvc", input="/cefs/data/FullSim/CEPC240/CEPC_v4/hig from Configurables import PlcioReadAlg alg = PlcioReadAlg("PlcioReadAlg") +alg.InputCol.Path = "MCParticle" +alg.HeaderCol.Path = "EventHeader" from Configurables import LCIOInput lcioinput = LCIOInput("LCIOReader", collections=[ + "EventHeader", "MCParticle", "COILCollection", "EcalBarrelSiliconCollection", diff --git a/Examples/options/plcio_write.py b/Examples/options/plcio_write.py index e2619218..0096c2df 100644 --- a/Examples/options/plcio_write.py +++ b/Examples/options/plcio_write.py @@ -7,7 +7,7 @@ dsvc = CEPCDataSvc("EventDataSvc") from Configurables import PlcioWriteAlg alg = PlcioWriteAlg("PlcioWriteAlg") -alg.OutputCol.Path = "MCParticleCol" +alg.OutputCol.Path = "MCParticle" from Configurables import PodioOutput out = PodioOutput("out") diff --git a/Examples/src/PlcioTest/PlcioReadAlg.cpp b/Examples/src/PlcioTest/PlcioReadAlg.cpp index 59d420dd..5921731c 100644 --- a/Examples/src/PlcioTest/PlcioReadAlg.cpp +++ b/Examples/src/PlcioTest/PlcioReadAlg.cpp @@ -1,4 +1,5 @@ #include "PlcioReadAlg.h" +#include "plcio/EventHeaderCollection.h" #include "plcio/MCParticleCollection.h" DECLARE_COMPONENT(PlcioReadAlg) @@ -6,7 +7,8 @@ DECLARE_COMPONENT(PlcioReadAlg) PlcioReadAlg::PlcioReadAlg(const std::string& name, ISvcLocator* svcLoc) : GaudiAlgorithm(name, svcLoc) { - declareProperty("MCParticleCol", m_hdl, "MCParticle collection (input)"); + declareProperty("HeaderCol", m_headerCol); + declareProperty("InputCol", m_mcParCol, "MCParticle collection (input)"); } StatusCode PlcioReadAlg::initialize() @@ -18,19 +20,21 @@ StatusCode PlcioReadAlg::initialize() StatusCode PlcioReadAlg::execute() { debug() << "begin execute PlcioReadAlg" << endmsg; - auto mcCol = m_hdl.get(); -// debug() << "testing loop..." <<endmsg; + auto headers = m_headerCol.get(); + auto header = headers->at(0); + auto mcCol = m_mcParCol.get(); + + info() << "Run " << header.getRunNumber() << " Event " << header.getEventNumber() << " { "; for ( auto p : *mcCol ) { - debug() << p.getObjectID().index << " : ["; + info() << p.getObjectID().index << " : ["; for ( auto it = p.daughters_begin(), end = p.daughters_end(); it != end; ++it ) { - debug() << " " << it->getObjectID().index; + info() << " " << it->getObjectID().index; } - debug() << " ]; "; + info() << " ]; "; } - debug() << endmsg; + info() << "}" << endmsg; -// debug() << "end execute PlcioReadAlg" << endmsg; return StatusCode::SUCCESS; } diff --git a/Examples/src/PlcioTest/PlcioReadAlg.h b/Examples/src/PlcioTest/PlcioReadAlg.h index 07d0eae4..5b9ec815 100644 --- a/Examples/src/PlcioTest/PlcioReadAlg.h +++ b/Examples/src/PlcioTest/PlcioReadAlg.h @@ -5,6 +5,7 @@ #include "GaudiAlg/GaudiAlgorithm.h" namespace plcio { + class EventHeaderCollection; class MCParticleCollection; } @@ -22,7 +23,8 @@ class PlcioReadAlg : public GaudiAlgorithm private : - DataHandle<plcio::MCParticleCollection> m_hdl{"MCParticle", Gaudi::DataHandle::Reader, this}; + DataHandle<plcio::EventHeaderCollection> m_headerCol{"EventHeaderCol", Gaudi::DataHandle::Reader, this}; + DataHandle<plcio::MCParticleCollection> m_mcParCol{"MCParticleCol", Gaudi::DataHandle::Reader, this}; }; -- GitLab