Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix imports in python files and other minor changes #25

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading