Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 07:56:29

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