File indexing completed on 2025-01-30 10:30:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #define CHECKCLUSTPAREPPROCESSOR_CC
0011
0012
0013 #include "CheckClustParEPProcessor.h"
0014
0015
0016 extern "C" {
0017 void InitPlugin(JApplication *app) {
0018 InitJANAPlugin(app);
0019 app -> Add(new CheckClustParEPProcessor);
0020 }
0021 }
0022
0023
0024
0025
0026
0027 void CheckClustParEPProcessor::InitWithGlobalRootLock() {
0028
0029
0030 auto rootfile_svc = GetApplication() -> GetService<RootFile_service>();
0031 auto rootfile = rootfile_svc -> GetHistFile();
0032 rootfile -> mkdir(m_config.sPlugin.data()) -> cd();
0033
0034
0035 const tuple<size_t, float, float> epBins = make_tuple(1000, 0., 10.);
0036
0037
0038 const vector<string> vecHistNames = {
0039 "hNHCalEP",
0040 "hNECalEP",
0041 "hBHCalEP",
0042 "hBECalEP",
0043 "hPHCalEP",
0044 "hPECalEP"
0045 };
0046
0047
0048 TH1::SetDefaultSumw2(true);
0049
0050
0051 for (const string& name : vecHistNames) {
0052 m_vecHistEP.push_back(
0053 new TH1D(name.data(), "", get<0>(epBins), get<1>(epBins), get<2>(epBins))
0054 );
0055 }
0056 return;
0057
0058 }
0059
0060
0061
0062 void CheckClustParEPProcessor::ProcessSequential(const std::shared_ptr<const JEvent>& event) {
0063
0064
0065 const auto& particles = *(event -> GetCollection<edm4hep::MCParticle>(m_config.sMCPars.data()));
0066
0067
0068 for (size_t iCalo = 0; iCalo < m_config.sClustAndAssocs.size(); iCalo++) {
0069
0070
0071 const auto& clusters = *(event -> GetCollection<edm4eic::Cluster>(m_config.sClustAndAssocs.at(iCalo).first.data()));
0072 const auto& assocs = *(event -> GetCollection<edm4eic::MCRecoClusterParticleAssociation>(m_config.sClustAndAssocs.at(iCalo).second.data()));
0073
0074
0075 for (auto cluster : clusters) {
0076 for (auto assoc : assocs) {
0077
0078
0079 const bool isSameClust = (assoc.getRecID() == cluster.getObjectID().index);
0080 if (!isSameClust) continue;
0081
0082
0083 auto mcPar = assoc.getSim();
0084
0085
0086 const double ep = cluster.getEnergy() / edm4hep::utils::magnitude(mcPar.getMomentum());
0087 m_vecHistEP.at(iCalo) -> Fill(ep);
0088
0089 }
0090 }
0091 }
0092 return;
0093
0094 }
0095
0096
0097
0098 void CheckClustParEPProcessor::FinishWithGlobalRootLock() {
0099
0100
0101
0102 }
0103
0104