18 #include "art/Framework/Core/EDProducer.h"
19 #include "art/Framework/Core/ModuleMacros.h"
20 #include "art/Framework/Principal/Handle.h"
21 #include "art/Framework/Principal/Event.h"
22 #include "canvas/Persistency/Common/Ptr.h"
23 #include "canvas/Persistency/Common/PtrVector.h"
24 #include "art/Framework/Principal/Run.h"
25 #include "art/Framework/Principal/SubRun.h"
26 #include "art_root_io/TFileService.h"
27 #include "art_root_io/TFileDirectory.h"
28 #include "art/Framework/Services/Registry/ServiceHandle.h"
29 #include "art/Framework/Core/ModuleMacros.h"
30 #include "canvas/Persistency/Common/FindManyP.h"
31 #include "art/Persistency/Common/PtrMaker.h"
33 #include "canvas/Utilities/InputTag.h"
34 #include "fhiclcpp/ParameterSet.h"
35 #include "messagefacility/MessageLogger/MessageLogger.h"
66 #include "TGeoManager.h"
86 void produce(art::Event &
e)
override;
115 produces< std::vector<sbn::crt::CRTHit> >();
116 produces< art::Assns<sbn::crt::CRTHit , sbnd::crt::CRTData> >();
140 std::unique_ptr< std::vector<sbn::crt::CRTHit> > CRTHitcol(
new std::vector<sbn::crt::CRTHit>);
141 std::unique_ptr< art::Assns<sbn::crt::CRTHit, sbnd::crt::CRTData> > Hitassn(
new art::Assns<sbn::crt::CRTHit, sbnd::crt::CRTData>);
142 art::PtrMaker<sbn::crt::CRTHit> makeHitPtr(event);
147 art::Handle< std::vector<sbnd::crt::CRTData>> crtListHandle;
148 std::vector<art::Ptr<sbnd::crt::CRTData> > crtList;
150 art::fill_ptr_vector(crtList, crtListHandle);
152 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event);
153 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event, clockData);
158 mf::LogInfo(
"CRTSimHitProducer")
159 <<
"Number of SiPM hits = "<<crtList.size();
161 std::vector<std::pair<sbn::crt::CRTHit, std::vector<int>>> crtHitPairs =
hitAlg.
CreateCRTHits(taggerStrips);
163 for(
auto const& crtHitPair : crtHitPairs){
164 CRTHitcol->push_back(crtHitPair.first);
165 art::Ptr<sbn::crt::CRTHit> hitPtr = makeHitPtr(CRTHitcol->size()-1);
167 for(
auto const& data_i : crtHitPair.second){
168 Hitassn->addSingle(hitPtr, crtList[data_i]);
173 event.put(std::move(CRTHitcol));
174 event.put(std::move(Hitassn));
176 mf::LogInfo(
"CRTSimHitProducer")
177 <<
"Number of CRT hits produced = "<<nHits;
services DetectorClocksService
CRTSimHitProducer & operator=(CRTSimHitProducer const &)=delete
Access the description of detector geometry.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
void reconfigure(fhicl::ParameterSet const &p)
void produce(art::Event &e) override
CRTSimHitProducer(fhicl::ParameterSet const &p)
art framework interface to geometry description for auxiliary detectors
std::map< std::pair< std::string, unsigned >, std::vector< CRTStrip > > CreateTaggerStrips(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< sbnd::crt::CRTData >> data)
std::vector< std::pair< sbn::crt::CRTHit, std::vector< int > > > CreateCRTHits(std::map< std::pair< std::string, unsigned >, std::vector< CRTStrip >> taggerStrips)
Definition of data types for geometry description.
Encapsulate the geometry of a wire.
Encapsulate the construction of a single detector plane.
createEngine fG4RefTime(art::ServiceHandle< detinfo::DetectorClocksService const >() ->DataForJob().G4ToElecTime(0)*1e3)
object containing MC truth information necessary for making RawDigits and doing back tracking ...
stream1 can override from command line with o or output services user sbnd
art::InputTag fCrtModuleLabel
name of crt producer
Collection of Physical constants used in LArSoft.
art framework interface to geometry description