6 #include "art/Framework/Core/ModuleMacros.h"
7 #include "art/Framework/Core/EDProducer.h"
8 #include "art/Framework/Principal/Handle.h"
9 #include "art/Framework/Principal/Event.h"
10 #include "canvas/Persistency/Common/Ptr.h"
11 #include "canvas/Persistency/Common/PtrVector.h"
12 #include "art/Framework/Services/Registry/ServiceHandle.h"
13 #include "art/Persistency/Common/PtrMaker.h"
14 #include "canvas/Utilities/InputTag.h"
15 #include "fhiclcpp/ParameterSet.h"
16 #include "messagefacility/MessageLogger/MessageLogger.h"
41 class CRTTrueHitProducer;
62 void produce(art::Event &
e)
override;
78 : EDProducer{p}, hitAlg(
p.get<fhicl::ParameterSet>(
"HitAlg"))
84 produces< vector<CRTHit> >();
85 produces< vector<AuxDetIDE> >();
86 produces< art::Assns<CRTHit , AuxDetIDE> >();
92 fCrtModuleLabel = (p.get<art::InputTag> (
"CrtModuleLabel"));
97 std::unique_ptr< vector<CRTHit> > CRTHitcol(
new vector<CRTHit>);
98 std::unique_ptr< vector<AuxDetIDE> > IDEcol(
new vector<AuxDetIDE>);
99 std::unique_ptr< art::Assns<CRTHit, AuxDetIDE> > Hitassn(
new art::Assns<CRTHit,AuxDetIDE>);
100 art::PtrMaker<CRTHit> makeHitPtr(event);
101 art::PtrMaker<AuxDetIDE> makeAdPtr(event);
106 art::Handle< vector<sim::AuxDetSimChannel>> adscListHandle;
107 vector<art::Ptr<sim::AuxDetSimChannel> > adscList;
109 if (event.getByLabel(fCrtModuleLabel, adscListHandle))
110 art::fill_ptr_vector(adscList, adscListHandle);
112 mf::LogInfo(
"CRTTrueHitProducer")
113 <<
"Number of AuxDetSimChannels = "<<adscList.size();
115 vector<std::pair<CRTHit, vector<AuxDetIDE>>> crtHitPairs = hitAlg.CreateCRTHits(adscList);
117 for(
auto const& crtHitPair : crtHitPairs){
119 CRTHitcol->push_back(crtHitPair.first);
120 art::Ptr<CRTHit> hitPtr = makeHitPtr(CRTHitcol->size()-1);
123 for(
auto const& ide : crtHitPair.second){
125 IDEcol->push_back(ide);
126 art::Ptr<AuxDetIDE> idePtr = makeAdPtr(IDEcol->size()-1);
127 Hitassn->addSingle(hitPtr, idePtr);
131 event.put(std::move(CRTHitcol));
132 event.put(std::move(IDEcol));
133 event.put(std::move(Hitassn));
135 mf::LogInfo(
"CRTTrueHitProducer")
136 <<
"Number of CRT hits produced = "<<nHits;
art::InputTag fCrtModuleLabel
name of crt producer
CRTTrueHitProducer(fhicl::ParameterSet const &p)
CRTTrueHitProducer & operator=(CRTTrueHitProducer const &)=delete
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.
void reconfigure(fhicl::ParameterSet const &p)
Encapsulate the construction of a single detector plane.
MC truth information to make RawDigits and do back tracking.
void produce(art::Event &e) override
art framework interface to geometry description