89 std::unique_ptr<std::vector<sbnd::crt::CRTData>> crt_data_v(
new std::vector<sbnd::crt::CRTData>);
90 std::unique_ptr<art::Assns<sbnd::crt::CRTData, sbnd::crt::FEBData>> crtdata_to_febdata_assns
91 (
new art::Assns<sbnd::crt::CRTData, sbnd::crt::FEBData>);
92 std::unique_ptr<art::Assns<sbnd::crt::CRTData, sim::AuxDetIDE>> crtdata_to_ide_assns
93 (
new art::Assns<sbnd::crt::CRTData, sim::AuxDetIDE>);
95 art::Handle<std::vector<sbnd::crt::FEBData>> feb_data_h;
99 if (!feb_data_h.isValid()) {
100 throw art::Exception(art::errors::Configuration) <<
"could not locate FEBData." << std::endl;;
103 std::vector<art::Ptr<sbnd::crt::FEBData>> feb_data_v;
104 art::fill_ptr_vector(feb_data_v, feb_data_h);
106 art::FindManyP<sim::AuxDetIDE, sbnd::crt::FEBTruthInfo> febdata_to_ides (feb_data_h,
e,
_feb_data_producer);
108 art::PtrMaker<sbnd::crt::CRTData> makeDataPtr(
e);
110 for (
size_t feb_i = 0; feb_i < feb_data_v.size(); feb_i++) {
112 auto const feb_data = feb_data_v[feb_i];
113 mf::LogDebug(
"CRTSlimmer") <<
"FEB " << feb_i <<
" with mac " << feb_data->Mac5() << std::endl;
115 auto ides = febdata_to_ides.at(feb_data.key());
116 mf::LogDebug(
"CRTSlimmer") <<
"We have " << ides.size() <<
" IDEs." << std::endl;
121 std::map<int, std::vector<int>> sipm_to_ideids;
122 for (
size_t j = 0; j < 32; j++) sipm_to_ideids[j] = std::vector<int>();
123 for (
size_t ide_i = 0; ide_i < febdata_to_ides.data(feb_i).size(); ide_i++) {
125 sipm_to_ideids[fti->
GetChannel()].push_back(ide_i);
126 mf::LogDebug(
"CRTSlimmer") <<
"ide_i " << ide_i <<
" ene " << ides[ide_i]->energyDeposited <<
" fti->GetChannel() " << fti->
GetChannel() << std::endl;
129 auto adcs = feb_data->ADC();
131 for (
size_t i = 0; i < adcs.size(); i+=2) {
138 for (
size_t sipm = 0; sipm < 2; sipm++) {
144 mf::LogDebug(
"CRTSlimmer") <<
"Adding SiPM " << i + sipm <<
" with mac " << feb_data->Mac5()
145 <<
" mapped to channel " << crt_data.
Channel() << std::endl;
147 crt_data_v->emplace_back(std::move(crt_data));
149 art::Ptr<sbnd::crt::CRTData> crt_data_p = makeDataPtr(crt_data_v->size() - 1);
152 crtdata_to_febdata_assns->addSingle(crt_data_p, feb_data);
155 auto & ide_ids = sipm_to_ideids[i];
156 for (
auto ide_id: ide_ids) {
157 auto ide = ides[ide_id];
158 mf::LogDebug(
"CRTSlimmer") <<
"Adding IDE with ID " << ide_id << std::endl;
159 crtdata_to_ide_assns->addSingle(crt_data_p, ide);
165 mf::LogInfo(
"CRTSlimmer") <<
"Creating " << crt_data_v->size()
166 <<
" CRTData products." << std::endl;
168 e.put(std::move(crt_data_v));
169 e.put(std::move(crtdata_to_febdata_assns));
170 e.put(std::move(crtdata_to_ide_assns));
std::string _feb_data_producer
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)