-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
197 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2023, Christopher Dilks | ||
// Subject to the terms in the LICENSE file found in the top-level directory. | ||
|
||
#include "PhotoMultiplierHitDigiAnalysis.h" | ||
|
||
// AlgorithmInit | ||
//--------------------------------------------------------------------------- | ||
void eicrecon::PhotoMultiplierHitDigiAnalysis::AlgorithmInit(std::shared_ptr<spdlog::logger>& logger) { | ||
m_log = logger; | ||
|
||
// define histograms | ||
m_adc_dist = new TH1D("adc_dist", "ADC Distribution;counts", adc_max, 0, adc_max); | ||
m_tdc_dist = new TH1D("tdc_dist", "TDC Distribution;counts", tdc_max, 0, tdc_max); | ||
m_tdc_vs_adc = new TH2D("tdc_vs_adc", "TDC vs. ADC;ADC counts;TDC counts", | ||
adc_max/2, 0, adc_max/2, | ||
tdc_max/2, 0, tdc_max/2 | ||
); | ||
|
||
// format histograms | ||
auto format1D = [] (auto h) { | ||
h->SetLineColor(kBlack); | ||
h->SetFillColor(kBlack); | ||
}; | ||
format1D(m_adc_dist); | ||
format1D(m_tdc_dist); | ||
} | ||
|
||
|
||
// AlgorithmProcess | ||
//--------------------------------------------------------------------------- | ||
void eicrecon::PhotoMultiplierHitDigiAnalysis::AlgorithmProcess(std::vector<const edm4eic::RawPMTHit*> hits) { | ||
m_log->trace("{:=^70}"," call PhotoMultiplierHitDigiAnalysis::AlgorithmProcess "); | ||
|
||
// loop over `CherenkovParticleID` objects | ||
for(const auto& hit : hits) { | ||
auto adc = hit->getIntegral(); | ||
auto tdc = hit->getTimeStamp(); | ||
m_adc_dist->Fill(adc); | ||
m_tdc_dist->Fill(tdc); | ||
m_tdc_vs_adc->Fill(adc,tdc); | ||
} | ||
} | ||
|
||
|
||
// AlgorithmFinish | ||
//--------------------------------------------------------------------------- | ||
void eicrecon::PhotoMultiplierHitDigiAnalysis::AlgorithmFinish() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2023, Christopher Dilks | ||
// Subject to the terms in the LICENSE file found in the top-level directory. | ||
|
||
#pragma once | ||
|
||
// ROOT | ||
#include <TH1D.h> | ||
#include <TH2D.h> | ||
#include <TMath.h> | ||
|
||
// data model | ||
#include <edm4eic/RawPMTHitCollection.h> | ||
|
||
// EICrecon | ||
#include <spdlog/spdlog.h> | ||
|
||
namespace eicrecon { | ||
|
||
class PhotoMultiplierHitDigiAnalysis { | ||
|
||
private: | ||
|
||
// binning | ||
const int adc_max = std::pow(2,10); | ||
const int tdc_max = std::pow(2,10); | ||
|
||
// histograms | ||
TH1D *m_adc_dist; | ||
TH1D *m_tdc_dist; | ||
TH2D *m_tdc_vs_adc; | ||
|
||
public: | ||
PhotoMultiplierHitDigiAnalysis() = default; | ||
~PhotoMultiplierHitDigiAnalysis() {} | ||
|
||
// algorithm methods | ||
void AlgorithmInit(std::shared_ptr<spdlog::logger>& logger); | ||
void AlgorithmProcess(std::vector<const edm4eic::RawPMTHit*> hits); | ||
void AlgorithmFinish(); | ||
|
||
private: | ||
std::shared_ptr<spdlog::logger> m_log; | ||
|
||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2022, Christopher Dilks | ||
// Subject to the terms in the LICENSE file found in the top-level directory. | ||
|
||
#include "Digitizer_processor.h" | ||
|
||
//------------------------------------------- | ||
// InitWithGlobalRootLock | ||
//------------------------------------------- | ||
void eicrecon::Digitizer_processor::InitWithGlobalRootLock() { | ||
auto app = GetApplication(); | ||
|
||
// input tags | ||
auto plugin_name = eicrecon::str::ReplaceAll(GetPluginName(), ".so", ""); | ||
|
||
// set logger | ||
InitLogger(plugin_name, "info"); | ||
m_log->debug("Initializing plugin {}",plugin_name); | ||
|
||
// set ROOT TDirectory | ||
auto rootfile_svc = app->GetService<RootFile_service>(); | ||
auto rootfile = rootfile_svc->GetHistFile(); | ||
rootfile->mkdir("pid_digi")->cd(); | ||
|
||
// initialize underlying algorithms | ||
m_analysis_algo.AlgorithmInit(m_log); | ||
} | ||
|
||
//------------------------------------------- | ||
// ProcessSequential | ||
//------------------------------------------- | ||
void eicrecon::Digitizer_processor::ProcessSequential(const std::shared_ptr<const JEvent>& event) { | ||
m_analysis_algo.AlgorithmProcess(m_digi_hits()); | ||
} | ||
|
||
//------------------------------------------- | ||
// FinishWithGlobalRootLock | ||
//------------------------------------------- | ||
void eicrecon::Digitizer_processor::FinishWithGlobalRootLock() { | ||
m_analysis_algo.AlgorithmFinish(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2022, Christopher Dilks | ||
// Subject to the terms in the LICENSE file found in the top-level directory. | ||
|
||
#pragma once | ||
|
||
// JANA | ||
#include <JANA/JEventProcessorSequentialRoot.h> | ||
|
||
// data model | ||
#include <edm4eic/CherenkovParticleID.h> | ||
|
||
// algorithms | ||
#include <algorithms/digi/PhotoMultiplierHitDigiAnalysis.h> | ||
|
||
// services | ||
#include <services/rootfile/RootFile_service.h> | ||
#include <services/log/Log_service.h> | ||
#include <extensions/spdlog/SpdlogExtensions.h> | ||
#include <extensions/spdlog/SpdlogMixin.h> | ||
#include <extensions/string/StringHelpers.h> | ||
|
||
namespace eicrecon { | ||
class Digitizer_processor : | ||
public JEventProcessorSequentialRoot, | ||
public SpdlogMixin<Digitizer_processor> | ||
{ | ||
|
||
public: | ||
|
||
Digitizer_processor() { SetTypeName(NAME_OF_THIS); } | ||
void InitWithGlobalRootLock() override; | ||
void ProcessSequential(const std::shared_ptr<const JEvent>& event) override; | ||
void FinishWithGlobalRootLock() override; | ||
|
||
private: | ||
|
||
// input collections // FIXME: generalize for other RICHes | ||
PrefetchT<edm4eic::RawPMTHit> m_digi_hits = {this, "DRICHRawHits"}; | ||
|
||
// underlying algorithms | ||
eicrecon::PhotoMultiplierHitDigiAnalysis m_analysis_algo; | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters