52 ,
fG4ModuleLabel{pset.get<std::string>(
"G4ModuleLabel",
"largeant")}
54 produces<std::vector<recob::Shower>>();
55 produces<std::vector<recob::SpacePoint>>();
56 produces<art::Assns<recob::Shower, recob::Cluster>>();
57 produces<art::Assns<recob::Shower, recob::SpacePoint>>();
58 produces<art::Assns<recob::Shower, recob::Hit>>();
59 produces<art::Assns<recob::Hit, recob::SpacePoint>>();
77 std::vector<art::Ptr<recob::Cluster>> clusters;
81 std::map<int, std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>> eveClusterMap;
84 for (
size_t c = 0; c < clusters.size(); ++c) {
90 int eveID = floor(clusters[c]->ID() / 1000.);
92 std::pair<size_t, art::Ptr<recob::Cluster>> indexPtr(c, clusters[c]);
94 eveClusterMap[eveID].push_back(indexPtr);
99 std::unique_ptr<std::vector<recob::Shower>> showercol(
new std::vector<recob::Shower>);
100 std::unique_ptr<std::vector<recob::SpacePoint>> spcol(
new std::vector<recob::SpacePoint>);
101 std::unique_ptr<art::Assns<recob::Shower, recob::Cluster>> scassn(
103 std::unique_ptr<art::Assns<recob::Shower, recob::Hit>> shassn(
105 std::unique_ptr<art::Assns<recob::Shower, recob::SpacePoint>> sspassn(
107 std::unique_ptr<art::Assns<recob::Hit, recob::SpacePoint>> sphassn(
112 for (
auto const& clusterMapItr : eveClusterMap) {
115 std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>
const& eveClusters =
116 clusterMapItr.second;
118 size_t startSPIndx = spcol->size();
120 std::vector<art::Ptr<recob::Cluster>> ptrvs;
121 std::vector<size_t> idxs;
123 for (
auto const& idxPtr : eveClusters) {
124 idxs.push_back(idxPtr.first);
125 ptrvs.push_back(idxPtr.second);
132 std::vector<art::Ptr<recob::Hit>>
const&
hits = fmh.at(idxPtr.first);
134 for (
size_t h = 0; h < hits.size(); ++h) {
137 std::vector<double> xyz = bt_serv->
HitToXYZ(clockData, hit);
138 double sperr[6] = {0.01, 0.01, 0.1, 0.001, 0.001, 0.001};
143 spcol->push_back(sp);
151 size_t endSPIndx = spcol->size();
160 <<
"prong of " << clusterMapItr.first <<
" is a shower with pdg code " 161 << pi_serv->
ParticleList()[clusterMapItr.first]->PdgCode();
165 const TLorentzVector initmom = pi_serv->
ParticleList()[clusterMapItr.first]->Momentum();
167 initmom.Px() / initmom.Mag(), initmom.Py() / initmom.Mag(), initmom.Pz() / initmom.Mag());
168 TVector3 dcosErr(1.
e-3, 1.
e-3, 1.
e-3);
177 s.
set_id(showercol->size());
180 showercol->push_back(s);
185 for (
size_t i = 0; i < idxs.size(); ++i) {
186 std::vector<art::Ptr<recob::Hit>>
hits = fmh.at(i);
191 util::CreateAssn(evt, *showercol, *spcol, *sspassn, startSPIndx, endSPIndx);
193 mf::LogInfo(
"ShowerCheater") <<
"adding shower: \n" 194 << showercol->back() <<
"\nto collection.";
199 evt.
put(std::move(showercol));
200 evt.
put(std::move(spcol));
201 evt.
put(std::move(scassn));
202 evt.
put(std::move(shassn));
203 evt.
put(std::move(sspassn));
204 evt.
put(std::move(sphassn));
void produce(art::Event &evt) override
void set_direction_err(const TVector3 &dir_e)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
constexpr auto abs(T v)
Returns the absolute value of the argument.
ShowerCheater(fhicl::ParameterSet const &pset)
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void set_id(const int id)
void set_direction(const TVector3 &dir)
#define DEFINE_ART_MODULE(klass)
Declaration of cluster object.
std::string const fCheatedClusterLabel
Detector simulation of raw signals on wires.
const sim::ParticleList & ParticleList() const
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.
std::string const fG4ModuleLabel
label for module running G4 and making particles, etc
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Namespace collecting geometry-related classes utilities.
art framework interface to geometry description