Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:35

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 #ifndef JANA2_JCOMPONENTMANAGER_H
0006 #define JANA2_JCOMPONENTMANAGER_H
0007 
0008 #include <JANA/JEventSourceGenerator.h>
0009 #include <JANA/Services/JParameterManager.h>
0010 #include <JANA/Components/JComponentSummary.h>
0011 #include <JANA/Services/JServiceLocator.h>
0012 
0013 #include <vector>
0014 
0015 class JEventProcessor;
0016 class JEventUnfolder;
0017 
0018 class JComponentManager : public JService {
0019 public:
0020 
0021     explicit JComponentManager();
0022     ~JComponentManager() override;
0023     void Init() override;
0024 
0025     // Called during plugin loading
0026     void next_plugin(std::string plugin_name);
0027 
0028     void add(std::string event_source_name);
0029     void add(JEventSourceGenerator* source_generator);
0030     void add(JFactoryGenerator* factory_generator);
0031     void add(JEventSource* event_source);
0032     void add(JEventProcessor* processor);
0033     void add(JEventUnfolder* unfolder);
0034 
0035     // Called after plugin loading
0036     void configure_components();
0037 
0038     // Helpers
0039     void preinitialize_components();
0040     void resolve_event_sources();
0041     void initialize_components();
0042     JEventSourceGenerator* resolve_user_event_source_generator() const;
0043     JEventSourceGenerator* resolve_event_source(std::string source_name) const;
0044 
0045     // Called after JApplication::Initialize() finishes
0046     const JComponentSummary& get_component_summary();
0047 
0048     std::vector<JEventSourceGenerator*>& get_evt_src_gens();
0049     std::vector<JEventSource*>& get_evt_srces();
0050     std::vector<JEventProcessor*>& get_evt_procs();
0051     std::vector<JFactoryGenerator*>& get_fac_gens();
0052     std::vector<JEventUnfolder*>& get_unfolders();
0053 
0054     void configure_event(JEvent& event);
0055 
0056 private:
0057 
0058     Service<JParameterManager> m_params {this};
0059 
0060     std::string m_current_plugin_name;
0061     std::vector<std::string> m_src_names;
0062     std::vector<JEventSourceGenerator*> m_src_gens;
0063     std::vector<JFactoryGenerator*> m_fac_gens;
0064     std::vector<JEventSource*> m_evt_srces;
0065     std::vector<JEventProcessor*> m_evt_procs;
0066     std::vector<JEventUnfolder*> m_unfolders;
0067 
0068     std::map<std::string, std::string> m_default_tags;
0069     bool m_enable_call_graph_recording = false;
0070     std::string m_autoactivate;
0071 
0072     uint64_t m_nskip=0;
0073     uint64_t m_nevents=0;
0074     std::string m_user_evt_src_typename = "";
0075     JEventSourceGenerator* m_user_evt_src_gen = nullptr;
0076 
0077     JComponentSummary m_summary;
0078 };
0079 
0080 
0081 #endif //JANA2_JCOMPONENTMANAGER_H