8 #include "art/Framework/Core/EDProducer.h"
9 #include "art/Framework/Core/ModuleMacros.h"
10 #include "art/Framework/Principal/Handle.h"
11 #include "art/Framework/Principal/Event.h"
12 #include "canvas/Persistency/Common/Ptr.h"
13 #include "canvas/Persistency/Common/PtrVector.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "art_root_io/TFileService.h"
17 #include "art_root_io/TFileDirectory.h"
18 #include "art/Framework/Services/Registry/ServiceHandle.h"
19 #include "art/Framework/Core/ModuleMacros.h"
20 #include "canvas/Persistency/Common/FindManyP.h"
21 #include "art/Persistency/Common/PtrMaker.h"
22 #include "canvas/Utilities/InputTag.h"
23 #include "fhiclcpp/ParameterSet.h"
24 #include "messagefacility/MessageLogger/MessageLogger.h"
25 #include "canvas/Utilities/Exception.h"
55 #include "TGeoManager.h"
79 void produce(art::Event &
e)
override;
100 : EDProducer{p}, hitAlg(
p.get<fhicl::ParameterSet>(
"HitAlg"))
105 produces< vector<CRTHit> >();
106 produces< art::Assns<CRTHit, CRTData> >();
126 std::unique_ptr< vector<CRTHit> > CRTHitcol(
new vector<CRTHit>);
127 std::unique_ptr< art::Assns<CRTHit, CRTData> > Hitassn(
new art::Assns<CRTHit, CRTData>);
128 art::PtrMaker<sbn::crt::CRTHit> makeHitPtr(event);
133 art::Handle< std::vector<CRTData>> crtListHandle;
134 vector<art::Ptr<CRTData> > crtList;
137 art::fill_ptr_vector(crtList, crtListHandle);
142 art::Handle<sbn::ExtraTriggerInfo> trigger_handle;
144 if( trigger_handle.isValid() )
147 mf::LogError(
"CRTSimHitProducer") <<
"No raw::Trigger associated to label: " <<
fTriggerLabel.label() <<
"\n" ;
152 mf::LogInfo(
"CRTSimHitProducer")
153 <<
"Number of SiPM hits = "<<crtList.size();
156 mf::LogInfo(
"CRTSimHitProducer")
157 <<
"Number of SiPM hits = "<<crtList.size();
164 mf::LogInfo(
"CRTSimHitProducer")
165 <<
"Number of CRTHit,data indices pairs = " << crtHitPairs.size();
167 for(
auto const& crtHitPair : crtHitPairs){
169 CRTHitcol->push_back(crtHitPair.first);
170 art::Ptr<CRTHit> hitPtr = makeHitPtr(CRTHitcol->size()-1);
173 for(
auto const& data_i : crtHitPair.second){
175 Hitassn->addSingle(hitPtr, crtList[data_i]);
179 event.put(std::move(CRTHitcol));
180 event.put(std::move(Hitassn));
182 mf::LogInfo(
"CRTSimHitProducer")
183 <<
"Number of CRT hits produced = "<<nHits;
art::InputTag fCrtModuleLabel
name of crt producer
CRTSimHitProducer(fhicl::ParameterSet const &p)
void reconfigure(fhicl::ParameterSet const &p)
uint64_t m_trigger_timestamp
art::InputTag fTriggerLabel
name of trigger producer
void produce(art::Event &e) override
vector< art::Ptr< CRTData > > PreselectCRTData(const vector< art::Ptr< CRTData >> &crtList, uint64_t trigger_timestamp)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Access the description of detector geometry.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
art framework interface to geometry description for auxiliary detectors
Definition of data types for geometry description.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
CRTSimHitProducer & operator=(CRTSimHitProducer const &)=delete
Collection of Physical constants used in LArSoft.
art framework interface to geometry description
BEGIN_PROLOG could also be cout
vector< pair< CRTHit, vector< int > > > CreateCRTHits(vector< art::Ptr< CRTData >> crtList, uint64_t trigger_timestamp)