52 fG4ModuleLabel = pset.get<std::string>(
"G4ModuleLabel",
"largeant");
54 produces<std::vector<recob::Vertex>>();
55 produces<art::Assns<recob::Vertex, recob::Shower>>();
56 produces<art::Assns<recob::Vertex, recob::Track>>();
57 produces<art::Assns<recob::Vertex, recob::Hit>>();
74 std::vector<art::Ptr<recob::Shower>> showers;
88 std::vector<art::Ptr<recob::Track>> tracks;
100 std::vector<art::Ptr<recob::Shower>>
::iterator shwitr = showers.begin();
101 std::vector<art::Ptr<recob::Track>>
::iterator trkitr = tracks.begin();
104 if (tracks.size() < 1) trkitr = tracks.end();
105 if (showers.size() < 1) shwitr = showers.end();
108 std::map<int, std::vector<std::pair<size_t, art::Ptr<recob::Shower>>>> eveShowerMap;
109 std::map<int, std::vector<std::pair<size_t, art::Ptr<recob::Track>>>> eveTrackMap;
112 std::vector<int> eveIDs;
115 for (
size_t s = 0; s < showers.size(); ++s) {
117 std::pair<size_t, art::Ptr<recob::Shower>> idxShw(s, showers[s]);
122 int prongID = showers[s]->ID();
127 int eveID = plist[prongID]->Mother();
128 if (eveID < 1) eveID = prongID;
130 if (std::find(eveIDs.begin(), eveIDs.end(), eveID) == eveIDs.end()) eveIDs.push_back(eveID);
135 eveShowerMap[eveID].push_back(idxShw);
137 mf::LogInfo(
"VertexCheater") <<
"shower: " << prongID <<
" has mother " << eveID;
142 for (
size_t t = 0; t < tracks.size(); ++t) {
144 std::pair<size_t, art::Ptr<recob::Track>> idxTrk(t, tracks[t]);
149 int prongID = tracks[t]->ID();
154 int eveID = plist[prongID]->Mother();
155 if (eveID < 1) eveID = prongID;
157 if (std::find(eveIDs.begin(), eveIDs.end(), eveID) == eveIDs.end()) eveIDs.push_back(eveID);
162 eveTrackMap[eveID].push_back(idxTrk);
164 mf::LogInfo(
"VertexCheater") <<
"track: " << prongID <<
" has mother " << eveID;
168 std::unique_ptr<std::vector<recob::Vertex>> vertexcol(
new std::vector<recob::Vertex>);
169 std::unique_ptr<art::Assns<recob::Vertex, recob::Shower>> vsassn(
171 std::unique_ptr<art::Assns<recob::Vertex, recob::Track>> vtassn(
173 std::unique_ptr<art::Assns<recob::Vertex, recob::Hit>> vhassn(
177 for (
auto const& eveID : eveIDs) {
183 std::vector<size_t> idxShw;
184 std::vector<size_t> idxTrk;
187 if (eveShowerMap.find(eveID) != eveShowerMap.end()) {
188 auto const& eveShowers = eveShowerMap[eveID];
189 for (
auto const& is : eveShowers) {
191 idxShw.push_back(is.first);
196 if (eveTrackMap.find(eveID) != eveTrackMap.end()) {
197 auto const& eveTracks = eveTrackMap[eveID];
198 for (
auto const& it : eveTracks) {
200 idxTrk.push_back(it.first);
204 double xyz[3] = {plist[eveID]->Vx(), plist[eveID]->Vy(), plist[eveID]->Vz()};
211 if (ptrvtrk.
size() > 0) {
215 for (
auto const& i : idxTrk) {
216 std::vector<art::Ptr<recob::Hit>>
hits = fmht.at(i);
221 if (ptrvshw.
size() > 0) {
224 for (
auto const& i : idxShw) {
225 std::vector<art::Ptr<recob::Hit>>
hits = fmhs.at(i);
230 mf::LogInfo(
"VertexCheater") <<
"adding vertex: \n" 231 << vertexcol->back() <<
"\nto collection.";
235 evt.
put(std::move(vertexcol));
236 evt.
put(std::move(vsassn));
237 evt.
put(std::move(vtassn));
238 evt.
put(std::move(vhassn));
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
std::string fCheatedTrackLabel
label for module creating recob::Track objects
std::string fG4ModuleLabel
label for module running G4 and making particles, etc
Definition of vertex object for LArSoft.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
#define DEFINE_ART_MODULE(klass)
void push_back(Ptr< U > const &p)
Provides recob::Track data product.
const sim::ParticleList & ParticleList() const
std::string fCheatedShowerLabel
label for module creating recob::Shower objects
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
VertexCheater(fhicl::ParameterSet const &pset)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Particle list in DetSim contains Monte Carlo particle information.
cet::coded_exception< error, detail::translate > exception
void produce(art::Event &evt)