File indexing completed on 2025-01-18 10:18:31
0001
0002
0003
0004
0005
0006
0007 #include "hpDIRCsimHitsProcessor.h"
0008 #include "services/rootfile/RootFile_service.h"
0009
0010
0011 #include <edm4hep/SimCalorimeterHitCollection.h>
0012
0013
0014 extern "C" {
0015 void InitPlugin(JApplication *app) {
0016 InitJANAPlugin(app);
0017 app->Add(new hpDIRCsimHitsProcessor);
0018 }
0019 }
0020
0021
0022
0023
0024 void hpDIRCsimHitsProcessor::InitWithGlobalRootLock(){
0025 auto rootfile_svc = GetApplication()->GetService<RootFile_service>();
0026 auto rootfile = rootfile_svc->GetHistFile();
0027 rootfile->mkdir("hpDIRCsimHits")->cd();
0028
0029
0030
0031
0032 hHitposition_direct = new TH2D("Hitposition_direct", "hit position Y vs. hit position X; hit position x (mm); hit position y (mm)", 130, 600, 990, 130, -190, 200);
0033 hnhits = new TH1D("nhits","; no. of hits per event", 400, 0, 2000);
0034 htime = new TH1D("leadtime","; photon time (ns)", 2000, 0, 100);
0035 hwavelength = new TH1D("wavelength","; wavelength of photon (nm)", 500, 0, 1000);
0036 hist_parent_pdg = new TH1I("parent_pdg","; parent PDG", 10000, -5000, 5000);
0037 }
0038
0039
0040
0041
0042 void hpDIRCsimHitsProcessor::ProcessSequential(const std::shared_ptr<const JEvent>& event) {
0043
0044
0045
0046
0047
0048
0049 Int_t count = 0;
0050
0051 for(auto hit : simhits())
0052 {
0053 int parent_pdg = hit->getMCParticle().getParents(0).getPDG();
0054 bool is_from_primary_track = hit->getMCParticle().getParents(0).getGeneratorStatus();
0055
0056 if(!is_from_primary_track) continue;
0057 hist_parent_pdg->Fill(parent_pdg);
0058
0059 hHitposition_direct->Fill(hit->getPosition()[0], hit->getPosition()[1]);
0060 count = count+1;
0061
0062
0063 double hit_energy = hit->getEDep() * 1e9;
0064 double wavelength = (1.2398 / hit_energy) * 1000;
0065 hwavelength->Fill(wavelength);
0066
0067
0068 double leadtime = hit->getTime();
0069 htime->Fill(leadtime);
0070
0071 }
0072 hnhits->Fill(count);
0073 }
0074
0075
0076
0077
0078 void hpDIRCsimHitsProcessor::FinishWithGlobalRootLock() {
0079
0080
0081 }
0082