Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-28 07:03:01

0001 #include "TrackingOccupancy_processor.h"
0002 
0003 #include <JANA/JApplication.h>
0004 #include <JANA/JEvent.h>
0005 #include <JANA/Services/JGlobalRootLock.h>
0006 #include <TDirectory.h>
0007 #include <string>
0008 
0009 #include "benchmarks/reconstruction/tracking_occupancy/HitReconstructionAnalysis.h"
0010 #include "benchmarks/reconstruction/tracking_occupancy/TrackingOccupancyAnalysis.h"
0011 #include "services/log/Log_service.h"
0012 #include "services/rootfile/RootFile_service.h"
0013 
0014 //------------------
0015 // OccupancyAnalysis (Constructor)
0016 //------------------
0017 TrackingOccupancy_processor::TrackingOccupancy_processor(JApplication *app) :
0018         JEventProcessor(app)
0019 {
0020 }
0021 
0022 //------------------
0023 // Init
0024 //------------------
0025 void TrackingOccupancy_processor::Init()
0026 {
0027     std::string plugin_name=("tracking_occupancy");
0028 
0029     // Get JANA application
0030     auto *app = GetApplication();
0031 
0032     // Ask service locator a file to write histograms to
0033     auto root_file_service = app->GetService<RootFile_service>();
0034 
0035     // Get TDirectory for histograms root file
0036     auto globalRootLock = app->GetService<JGlobalRootLock>();
0037     globalRootLock->acquire_write_lock();
0038     auto *file = root_file_service->GetHistFile();
0039     globalRootLock->release_lock();
0040 
0041     // Create a directory for this plugin. And subdirectories for series of histograms
0042     m_dir_main = file->mkdir(plugin_name.c_str());
0043 
0044     // Occupancy analysis
0045     m_occupancy_analysis.init(app, m_dir_main);
0046     m_hit_reco_analysis.init(app, m_dir_main);
0047 
0048     // Get logger
0049     m_log = app->GetService<Log_service>()->logger(plugin_name);
0050 }
0051 
0052 
0053 //------------------
0054 // Process
0055 //------------------
0056 void TrackingOccupancy_processor::Process(const std::shared_ptr<const JEvent>& event)
0057 {
0058     // Process raw hits from DD4Hep
0059     m_occupancy_analysis.process(event);
0060 
0061     // Process hits reconstructed with
0062     m_hit_reco_analysis.process(event);
0063 }
0064 
0065 
0066 //------------------
0067 // Finish
0068 //------------------
0069 void TrackingOccupancy_processor::Finish()
0070 {
0071         // Nothing to do here
0072 }