151 std::unique_ptr< vector<CRTData> > triggeredCRTHits (
152 new vector<CRTData>);
154 std::unique_ptr< vector<sim::AuxDetIDE> > ides (
155 new vector<sim::AuxDetIDE>);
157 std::unique_ptr< art::Assns<CRTData,sim::AuxDetIDE> > dataAssn (
158 new art::Assns<CRTData,sim::AuxDetIDE> );
159 art::PtrMaker<CRTData> makeDataPtr(event);
160 art::PtrMaker<sim::AuxDetIDE> makeIDEPtr(event);
166 art::Handle< vector<sim::AuxDetSimChannel> > adChanHandle;;
167 vector< art::Ptr<sim::AuxDetSimChannel> > adChanList;
169 art::fill_ptr_vector(adChanList, adChanHandle);
171 mf::LogInfo(
"CRTDetSimProducer")
172 <<
"Number of AuxDetChannels = " << adChanList.size();
175 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(event);
176 for(
auto const& adsc : adChanList) {
178 auto const& auxDetIDEs = adsc->AuxDetIDEs();
179 if(auxDetIDEs.size()>0) {
181 detAlg.
FillTaggers(clockData, adsc->AuxDetID(), adsc->AuxDetSensitiveID(), auxDetIDEs);
189 vector<std::pair<CRTData,vector<sim::AuxDetIDE>>> data =
detAlg.
CreateData();
191 std::sort(data.begin(),data.end(),
192 [](
const std::pair<CRTData,vector<sim::AuxDetIDE>>& d1,
193 const std::pair<CRTData,vector<sim::AuxDetIDE>>& d2) {
194 return d1.first.fTs0 < d2.first.fTs0;
197 for(
auto const& dataPair : data){
199 triggeredCRTHits->push_back(dataPair.first);
200 art::Ptr<CRTData> dataPtr = makeDataPtr(triggeredCRTHits->size()-1);
203 for(
auto const& ide : dataPair.second){
204 ides->push_back(ide);
205 art::Ptr<sim::AuxDetIDE> idePtr = makeIDEPtr(ides->size()-1);
206 dataAssn->addSingle(dataPtr, idePtr);
213 mf::LogWarning(
"CRTDetSimProducer")
214 <<
"0 CRTData produced (expected for most neutrino events, never for cosmics)";
217 event.put(std::move(triggeredCRTHits));
218 event.put(std::move(ides));
219 event.put(std::move(dataAssn));
221 mf::LogInfo(
"CRTDetSimProducer")
222 <<
"Number of CRT data produced = "<< nData <<
'\n'
223 <<
" from " << nide <<
" AuxDetIDEs";
vector< pair< CRTData, vector< AuxDetIDE > > > CreateData()
void FillTaggers(detinfo::DetectorClocksData const &clockData, const uint32_t adid, const uint32_t adsid, const vector< AuxDetIDE > &ides)