28 #include "canvas/Persistency/Common/FindManyP.h" 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>>();
78 std::vector<art::Ptr<recob::Cluster>> clusters;
82 std::map<int, std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>> eveClusterMap;
85 for (
size_t c = 0;
c < clusters.size(); ++
c) {
91 int eveID = floor(clusters[
c]->
ID() / 1000.);
93 std::pair<size_t, art::Ptr<recob::Cluster>> indexPtr(
c, clusters[
c]);
95 eveClusterMap[eveID].push_back(indexPtr);
100 std::unique_ptr<std::vector<recob::Shower>> showercol(
new std::vector<recob::Shower>);
101 std::unique_ptr<std::vector<recob::SpacePoint>> spcol(
new std::vector<recob::SpacePoint>);
102 std::unique_ptr<art::Assns<recob::Shower, recob::Cluster>> scassn(
104 std::unique_ptr<art::Assns<recob::Shower, recob::Hit>> shassn(
106 std::unique_ptr<art::Assns<recob::Shower, recob::SpacePoint>> sspassn(
108 std::unique_ptr<art::Assns<recob::Hit, recob::SpacePoint>> sphassn(
113 for (
auto const& clusterMapItr : eveClusterMap) {
116 std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>
const& eveClusters =
117 clusterMapItr.second;
119 size_t startSPIndx = spcol->size();
121 double totalCharge = 0.;
123 std::vector<art::Ptr<recob::Cluster>> ptrvs;
124 std::vector<size_t> idxs;
126 for (
auto const& idxPtr : eveClusters) {
127 idxs.push_back(idxPtr.first);
128 ptrvs.push_back(idxPtr.second);
135 std::vector<art::Ptr<recob::Hit>>
const& hits = fmh.at(idxPtr.first);
137 for (
size_t h = 0;
h < hits.size(); ++
h) {
141 std::vector<double> xyz = bt_serv->
HitToXYZ(clockData, hit);
142 double sperr[6] = {0.01, 0.01, 0.1, 0.001, 0.001, 0.001};
147 spcol->push_back(sp);
155 size_t endSPIndx = spcol->size();
164 <<
"prong of " << clusterMapItr.first <<
" is a shower with pdg code " 165 << pi_serv->
ParticleList()[clusterMapItr.first]->PdgCode();
169 const TLorentzVector initmom = pi_serv->
ParticleList()[clusterMapItr.first]->Momentum();
171 initmom.Px() / initmom.Mag(), initmom.Py() / initmom.Mag(), initmom.Pz() / initmom.Mag());
172 TVector3 dcosErr(1.
e-3, 1.
e-3, 1.
e-3);
181 s.
set_id(showercol->size());
188 showercol->push_back(s);
193 for (
size_t i = 0; i < idxs.size(); ++i) {
194 std::vector<art::Ptr<recob::Hit>> hits = fmh.at(i);
199 util::CreateAssn(*
this, evt, *showercol, *spcol, *sspassn, startSPIndx, endSPIndx);
201 mf::LogInfo(
"ShowerCheater") <<
"adding shower: \n" 202 << showercol->back() <<
"\nto collection.";
void produce(art::Event &evt) override
void set_direction_err(const TVector3 &dir_e)
geo::SigType_t SignalType() const
Signal type for the plane of the hit.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDProducer(fhicl::ParameterSet const &pset)
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
ShowerCheater(fhicl::ParameterSet const &pset)
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
art framework interface to geometry description
void set_id(const int id)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
void set_direction(const TVector3 &dir)
#define DEFINE_ART_MODULE(klass)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
std::string const fCheatedClusterLabel
Detector simulation of raw signals on wires.
const sim::ParticleList & ParticleList() const
Declaration of signal hit object.
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)
LArSoft geometry interface.
Signal from collection planes.