|
| 1 | +//////////////////////////////////////////////////////////////////////// |
| 2 | +// Class: CRTChannelMappingEventDisplay |
| 3 | +// Plugin Type: analyzer (Unknown Unknown) |
| 4 | +// File: CRTChannelMappingEventDisplay_module.cc |
| 5 | +// |
| 6 | +// Generated at Thu Oct 6 09:32:09 2022 by Henry Lay using cetskelgen |
| 7 | +// from version . |
| 8 | +//////////////////////////////////////////////////////////////////////// |
| 9 | + |
| 10 | +#include "art/Framework/Core/EDAnalyzer.h" |
| 11 | +#include "art/Framework/Core/ModuleMacros.h" |
| 12 | +#include "art/Framework/Principal/Event.h" |
| 13 | +#include "art/Framework/Principal/Handle.h" |
| 14 | +#include "art/Framework/Principal/Run.h" |
| 15 | +#include "art/Framework/Principal/SubRun.h" |
| 16 | +#include "canvas/Utilities/InputTag.h" |
| 17 | +#include "fhiclcpp/ParameterSet.h" |
| 18 | +#include "messagefacility/MessageLogger/MessageLogger.h" |
| 19 | + |
| 20 | +#include "lardata/DetectorInfoServices/DetectorClocksService.h" |
| 21 | +#include "sbndcode/CRT/CRTEventDisplay/CRTEventDisplayAlg.h" |
| 22 | + |
| 23 | +#include "TSystem.h" |
| 24 | + |
| 25 | +namespace sbnd::crt { |
| 26 | + class CRTChannelMappingEventDisplay; |
| 27 | +} |
| 28 | + |
| 29 | +class sbnd::crt::CRTChannelMappingEventDisplay : public art::EDAnalyzer { |
| 30 | +public: |
| 31 | + |
| 32 | + struct Config { |
| 33 | + using Name = fhicl::Name; |
| 34 | + using Comment = fhicl::Comment; |
| 35 | + |
| 36 | + fhicl::Table<CRTEventDisplayAlg::Config> EventDisplayConfig { |
| 37 | + Name("EventDisplayConfig"), |
| 38 | + }; |
| 39 | + |
| 40 | + fhicl::Atom<std::string> SaveDir { |
| 41 | + Name("SaveDir"), |
| 42 | + }; |
| 43 | + }; |
| 44 | + |
| 45 | + using Parameters = art::EDAnalyzer::Table<Config>; |
| 46 | + |
| 47 | + explicit CRTChannelMappingEventDisplay(Parameters const &config); |
| 48 | + |
| 49 | + CRTChannelMappingEventDisplay(CRTChannelMappingEventDisplay const&) = delete; |
| 50 | + CRTChannelMappingEventDisplay(CRTChannelMappingEventDisplay&&) = delete; |
| 51 | + CRTChannelMappingEventDisplay& operator=(CRTChannelMappingEventDisplay const&) = delete; |
| 52 | + CRTChannelMappingEventDisplay& operator=(CRTChannelMappingEventDisplay&&) = delete; |
| 53 | + |
| 54 | + void analyze(art::Event const& e) override; |
| 55 | + |
| 56 | +private: |
| 57 | + |
| 58 | + CRTEventDisplayAlg fCRTEventDisplayAlg; |
| 59 | + art::ServiceHandle<CRTGeoService> fCRTGeoService; |
| 60 | + std::string fSaveDir; |
| 61 | + std::vector<int> fChosenTaggers; |
| 62 | +}; |
| 63 | + |
| 64 | + |
| 65 | +sbnd::crt::CRTChannelMappingEventDisplay::CRTChannelMappingEventDisplay(Parameters const& config) |
| 66 | + : EDAnalyzer{config} |
| 67 | + , fCRTEventDisplayAlg(config().EventDisplayConfig()) |
| 68 | + , fSaveDir(config().SaveDir()) |
| 69 | + , fChosenTaggers(config().EventDisplayConfig().ChosenTaggers()) |
| 70 | + { |
| 71 | + gSystem->Exec(Form("mkdir -p %s", fSaveDir.c_str())); |
| 72 | + } |
| 73 | + |
| 74 | +void sbnd::crt::CRTChannelMappingEventDisplay::analyze(art::Event const& e) |
| 75 | +{ |
| 76 | + auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e); |
| 77 | + |
| 78 | + for(auto const& [ name, module ] : fCRTGeoService->GetModules()) |
| 79 | + { |
| 80 | + if(std::find(fChosenTaggers.begin(), fChosenTaggers.end(), CRTCommonUtils::GetTaggerEnum(module.taggerName)) == fChosenTaggers.end()) |
| 81 | + continue; |
| 82 | + |
| 83 | + fCRTEventDisplayAlg.SetHighlightedModules({module.adID}); |
| 84 | + |
| 85 | + fCRTEventDisplayAlg.Draw(clockData, e, Form("%s/%s", fSaveDir.c_str(), name.c_str())); |
| 86 | + } |
| 87 | +} |
| 88 | + |
| 89 | +DEFINE_ART_MODULE(sbnd::crt::CRTChannelMappingEventDisplay) |
0 commit comments