diff --git a/Generator/src/GenAlgo.cpp b/Generator/src/GenAlgo.cpp index 07b6c32246ea2cc74d8043d877c9264e7e739112..2d8ec8972668e5565960654176bd71d3d11d870c 100644 --- a/Generator/src/GenAlgo.cpp +++ b/Generator/src/GenAlgo.cpp @@ -18,7 +18,7 @@ DECLARE_COMPONENT(GenAlgo) GenAlgo::GenAlgo(const std::string& name, ISvcLocator* pSvcLocator): GaudiAlgorithm(name, pSvcLocator) { - declareProperty("MCParticle", m_hdl, "MCParticle collection (output)"); + declareProperty("MCParticleGen", m_hdl, "MCParticle collection (at Generator phase)"); declareProperty("GenTools", m_genToolNames, "List of GenTools"); m_evtid = 0; diff --git a/Generator/src/GenAlgo.h b/Generator/src/GenAlgo.h index 9723e896995c34736afda7964074974681d66026..2fa42bfa2af8eb4e9615ec3663fff798083373bf 100644 --- a/Generator/src/GenAlgo.h +++ b/Generator/src/GenAlgo.h @@ -36,7 +36,7 @@ private: int m_evtid; int m_evtMax; //MyHepMC::GenEvent m_event; - DataHandle<edm4hep::MCParticleCollection> m_hdl{"MCParticle", Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::MCParticleCollection> m_hdl{"MCParticleGen", Gaudi::DataHandle::Writer, this}; }; diff --git a/Generator/src/GenWriter.cpp b/Generator/src/GenWriter.cpp deleted file mode 100644 index f1f93a571dabc98f710c660754ae6507248c0212..0000000000000000000000000000000000000000 --- a/Generator/src/GenWriter.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "GenWriter.h" -#include "GenEvent.h" - -#include "podio/EventStore.h" //podio -#include "podio/ROOTWriter.h" - - -#include "plcio/MCParticleCollection.h"//plico -#include "plcio/EventHeaderCollection.h" - - -GenWriter::GenWriter(string name){ - m_output_name = name; - store = new podio::EventStore(); - writer = new podio::ROOTWriter(m_output_name, store); - ehc = &store->create<plcio::EventHeaderCollection>("EvtHeaders"); - mcc = &store->create<plcio::MCParticleCollection>("MCParticles"); - - writer->registerForWrite("EvtHeaders"); - writer->registerForWrite("MCParticles"); -} - -GenWriter::~GenWriter(){ -} - -bool GenWriter::mutate(MyHepMC::GenEvent& event){ - std::cout << "write mc info for event "<< event.getID() << ", mc size ="<< event.m_mc_vec.size() << std::endl; - mcc=&event.m_mc_vec; - auto header = plcio::EventHeader(event.getID(), event.getRun(), event.getTime(), event.getName()); - ehc->push_back(header); - writer->writeEvent(); - store->clearCollections(); - return true; -} - -bool GenWriter::configure(){ -return true; -} - -bool GenWriter::finish(){ - writer->finish(); - std::cout<<"Saved root "<<m_output_name<<std::endl; - return true; -} diff --git a/Generator/src/GenWriter.h b/Generator/src/GenWriter.h deleted file mode 100644 index 30e6db4365343c44f0f7de97781774f0e5700db3..0000000000000000000000000000000000000000 --- a/Generator/src/GenWriter.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef GenWriter_h -#define GenWriter_h 1 - -#include "GenEvent.h" -#include "IGenTool.h" - -#include "podio/EventStore.h" //podio -#include "podio/ROOTWriter.h" - - -#include "plcio/MCParticleCollection.h"//plico -#include "plcio/EventHeaderCollection.h" - - - -using namespace std; - -class GenWriter: public IGenTool{ - - public: - GenWriter(string name); - ~GenWriter(); - bool configure() override; - bool mutate(MyHepMC::GenEvent& event) override; - bool finish() override; - private: - string m_output_name; - podio::EventStore* store ; - podio::ROOTWriter* writer; - plcio::EventHeaderCollection* ehc ; - plcio::MCParticleCollection* mcc ; - -}; - -#endif diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h index 7b992d3076c0ddfa7b7bd9f5d8639274ba0538b1..937869b4a7a1f19d0c26c7828976934f12e8e8c2 100644 --- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h +++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h @@ -42,10 +42,10 @@ public: private: // In order to associate MCParticle with contribution, we need to access MC Particle. // - collection MCParticle: the particles in Generator - DataHandle<edm4hep::MCParticleCollection> m_mcParGenCol{"MCParticle", + DataHandle<edm4hep::MCParticleCollection> m_mcParGenCol{"MCParticleGen", Gaudi::DataHandle::Writer, this}; // - collection MCParticleG4: the simulated particles in Geant4 - DataHandle<edm4hep::MCParticleCollection> m_mcParCol{"MCParticleG4", + DataHandle<edm4hep::MCParticleCollection> m_mcParCol{"MCParticle", Gaudi::DataHandle::Writer, this}; edm4hep::MCParticleCollection* mcCol; diff --git a/Simulation/DetSimCore/src/G4PrimaryCnvTool.h b/Simulation/DetSimCore/src/G4PrimaryCnvTool.h index 1e47772177fd0c5f2e57029bae512a2c12f7813e..70b143fc57409b0f1010a86636b5db84d3391855 100644 --- a/Simulation/DetSimCore/src/G4PrimaryCnvTool.h +++ b/Simulation/DetSimCore/src/G4PrimaryCnvTool.h @@ -16,7 +16,7 @@ public: bool mutate(G4Event* anEvent) override; private: - DataHandle<edm4hep::MCParticleCollection> m_mcParCol{"MCParticle", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::MCParticleCollection> m_mcParCol{"MCParticleGen", Gaudi::DataHandle::Reader, this}; Gaudi::Property<double> m_chargedgeantino_mass{this, "ChargedGeantinoMass"}; };