Skip to content

Commit

Permalink
Fix imports in python files and other minor changes (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Sep 27, 2024
1 parent 39780c4 commit f116219
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 42 deletions.
9 changes: 4 additions & 5 deletions k4ProjectTemplate/options/createExampleEventData.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
#
from Gaudi.Configuration import INFO
from Configurables import CreateExampleEventData
from k4FWCore import ApplicationMgr
from k4FWCore import IOSvc
from k4FWCore import ApplicationMgr, IOSvc

iosvc = IOSvc("IOSvc")
iosvc.output = "output_k4test_exampledata.root"
iosvc = IOSvc()
iosvc.Output = "output_k4test_exampledata.root"
iosvc.outputCommands = ["keep *"]

producer = CreateExampleEventData()
producer = CreateExampleEventData("CreateExampleEventData")

ApplicationMgr(TopAlg=[producer],
EvtSel="NONE",
Expand Down
17 changes: 8 additions & 9 deletions k4ProjectTemplate/options/createHelloWorld.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from Gaudi.Configuration import *

from Gaudi.Configuration import INFO
from Configurables import HelloWorldAlg
from k4FWCore import ApplicationMgr

producer = HelloWorldAlg()
producer.PerEventPrintMessage = "Hello World !"

from Configurables import ApplicationMgr
ApplicationMgr( TopAlg=[producer],
EvtSel="NONE",
EvtMax=1,
OutputLevel=INFO,
)

ApplicationMgr(TopAlg=[producer],
EvtSel="NONE",
EvtMax=1,
OutputLevel=INFO,
)
28 changes: 11 additions & 17 deletions k4ProjectTemplate/options/readExampleEventData.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,17 @@
# limitations under the License.
#
from Gaudi.Configuration import DEBUG
from Configurables import k4DataSvc
from Configurables import CreateExampleEventData
from Configurables import PodioInput
from Configurables import ApplicationMgr
from k4FWCore import ApplicationMgr
from k4FWCore import IOSvc

podioevent = k4DataSvc("EventDataSvc")
podioevent.input = "output_k4test_exampledata.root"
producer = CreateExampleEventData()

inp = PodioInput("InputReader")
inp.collections = ["ExampleParticles"]

ApplicationMgr( TopAlg=[inp],
EvtSel="NONE",
EvtMax=100,
ExtSvc=[podioevent],
OutputLevel=DEBUG,
)
iosvc = IOSvc("IOSvc")
iosvc.input = "output_k4test_exampledata.root"

iosvc.CollectionNames = ["ExampleParticles"]

ApplicationMgr(TopAlg=[],
EvtSel="NONE",
EvtMax=100,
ExtSvc=[iosvc],
OutputLevel=DEBUG,
)
6 changes: 2 additions & 4 deletions k4ProjectTemplate/src/components/ExampleConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@

struct ExampleConsumer final : k4FWCore::Consumer<void(const edm4hep::MCParticleCollection&)> {
ExampleConsumer(const std::string& name, ISvcLocator* svcLoc)
: Consumer(name, svcLoc, {KeyValues("ExampleConsumerInputLocation", {"/ExampleInt"})}) {}
: Consumer(name, svcLoc, KeyValues("ExampleConsumerInputLocation", {"/ExampleInt"})) {}

void operator()(const edm4hep::MCParticleCollection& input) const override {
info() << "ExampleInt = " << input << endmsg;
}
void operator()(const edm4hep::MCParticleCollection& input) const override { info() << input << endmsg; }
};

DECLARE_COMPONENT(ExampleConsumer)
11 changes: 4 additions & 7 deletions k4ProjectTemplate/src/components/ExampleTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
* limitations under the License.
*/

#include "edm4hep/MCParticleCollection.h"
#include "k4FWCore/Transformer.h"

#include "edm4hep/MCParticleCollection.h"

#include <string>

struct ExampleTransformer final
Expand All @@ -29,12 +30,8 @@ struct ExampleTransformer final
{KeyValues("ExampleTransformerOutputLocation", {"/OutputExampleInt"})}) {}

edm4hep::MCParticleCollection operator()(const edm4hep::MCParticleCollection& input) const override {
info() << "ExampleInt = " << input << endmsg;
auto out = edm4hep::MCParticleCollection();
for (const auto& mc : input) {
out.push_back(mc);
}
return out;
info() << input << endmsg;
return edm4hep::MCParticleCollection();
}
};

Expand Down

0 comments on commit f116219

Please sign in to comment.