Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:17:52

0001 #include "TrackingOccupancy_processor.h"
0002 
0003 #include <JANA/JApplication.h>
0004 #include <JANA/JApplicationFwd.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 // Init
0016 //------------------
0017 void TrackingOccupancy_processor::Init() {
0018   std::string plugin_name = ("tracking_occupancy");
0019 
0020   // Get JANA application
0021   auto* app = GetApplication();
0022 
0023   // Ask service locator a file to write histograms to
0024   auto root_file_service = app->GetService<RootFile_service>();
0025 
0026   // Get TDirectory for histograms root file
0027   auto globalRootLock = app->GetService<JGlobalRootLock>();
0028   globalRootLock->acquire_write_lock();
0029   auto* file = root_file_service->GetHistFile();
0030   globalRootLock->release_lock();
0031 
0032   // Create a directory for this plugin. And subdirectories for series of histograms
0033   m_dir_main = file->mkdir(plugin_name.c_str());
0034 
0035   // Occupancy analysis
0036   m_occupancy_analysis.init(app, m_dir_main);
0037   m_hit_reco_analysis.init(app, m_dir_main);
0038 
0039   // Get logger
0040   m_log = app->GetService<Log_service>()->logger(plugin_name);
0041 }
0042 
0043 //------------------
0044 // Process
0045 //------------------
0046 void TrackingOccupancy_processor::Process(const std::shared_ptr<const JEvent>& event) {
0047   // Process raw hits from DD4Hep
0048   m_occupancy_analysis.process(event);
0049 
0050   // Process hits reconstructed with
0051   m_hit_reco_analysis.process(event);
0052 }
0053 
0054 //------------------
0055 // Finish
0056 //------------------
0057 void TrackingOccupancy_processor::Finish() {
0058   // Nothing to do here
0059 }