Page History
...
Here is the minimal example of the module class declaration with only the event()
method implemented and many non-essential details are skipped:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#include "psana/Module.h" namespace Package { class ExampleModule: public Module { public: // Constructor takes module name as a parameter ExampleModule(const std::string& name); // Implementation of event() from base class virtual void event(Event& evt, Env& env); }; } // namespace Package |
Definition of the factory function and methods:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#include "Package/ExampleModule.h" #include "MsgLogger/MsgLogger.h" #include "PSEvt/EventId.h" // define factory function using namespace Package; PSANA_MODULE_FACTORY(ExampleModule) // Constructor ExampleModule::ExampleModule(const std::string& name) : Module(name) { } void ExampleModule::event(Event& evt, Env& env) { // get event ID shared_ptr<EventId> eventId = evt.get(); if (not eventId.get()) { MsgLog(name(), info, "event ID not found"); } else { MsgLog(name(), info, "event ID: " << *eventId); } } |
...
A set of psana modules is available in current release as explained in Psana Module Catalog - Old. Part of them demonstrates how data can be accessed from user module code . Other modules can be used in data analysis or event filtering. Example of application for these modules are available in separate document:
- Psana Module Examples - Old - for advanced modules for analysis and event filtering
...
Overview
Content Tools