57 ,
fG4ModuleLabel{pset.get<std::string>(
"G4ModuleLabel",
"largeant")}
59 produces<std::vector<recob::Track>>();
60 produces<std::vector<recob::SpacePoint>>();
61 produces<art::Assns<recob::Track, recob::Cluster>>();
62 produces<art::Assns<recob::Track, recob::SpacePoint>>();
63 produces<art::Assns<recob::Track, recob::Hit>>();
81 std::vector<art::Ptr<recob::Cluster>> clusters;
85 std::vector<art::Ptr<recob::Cluster>>
::iterator itr = clusters.begin();
88 std::map<int, std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>> eveClusterMap;
91 for (
size_t c = 0; c < clusters.size(); ++c) {
93 std::pair<size_t, art::Ptr<recob::Cluster>> idxPtr(c, clusters[c]);
99 int eveID = floor((*itr)->ID() / 1000.);
101 eveClusterMap[eveID].push_back(idxPtr);
106 std::unique_ptr<std::vector<recob::Track>> trackcol(
new std::vector<recob::Track>);
107 std::unique_ptr<std::vector<recob::SpacePoint>> spcol(
new std::vector<recob::SpacePoint>);
108 std::unique_ptr<art::Assns<recob::Track, recob::SpacePoint>> tspassn(
110 std::unique_ptr<art::Assns<recob::Track, recob::Cluster>> tcassn(
112 std::unique_ptr<art::Assns<recob::Track, recob::Hit>> thassn(
117 for (
auto const& clusterMapItr : eveClusterMap) {
120 std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>
const& eveClusters =
121 clusterMapItr.second;
130 std::vector<TVector3> points;
131 std::vector<TVector3> moms;
134 <<
"G4 id " << clusterMapItr.first <<
" is a track with pdg code " << part->
PdgCode();
137 std::vector<size_t> idxs;
138 for (
auto const& idxPtr : eveClusters) {
140 idxs.push_back(idxPtr.first);
144 std::vector<art::Ptr<recob::Hit>>
hits;
145 for (
size_t p = 0; p < ptrvs.
size(); ++p) {
146 std::vector<art::Ptr<recob::Hit>> chits = fmh.at(idxs[p]);
147 if (!chits.size())
continue;
149 hits.insert(hits.end(), chits.begin(), chits.end());
153 if (hits.size() < 2)
continue;
156 size_t spStart = spcol->size();
157 for (
size_t t = 0; t < hits.size(); ++t) {
158 std::vector<double> xyz = bt_serv->
HitToXYZ(clockData, hits[t]);
159 TVector3 point(xyz[0], xyz[1], xyz[2]);
160 points.push_back(point);
162 std::vector<double> xyz1;
166 if (t < hits.size() - 1) { xyz1 = bt_serv->
HitToXYZ(clockData, hits[t + 1]); }
168 xyz1 = bt_serv->
HitToXYZ(clockData, hits[t - 1]);
173 dx = std::sqrt(std::pow(xyz1[0] - xyz[0], 2) + std::pow(xyz1[1] - xyz[1], 2) +
174 std::pow(xyz1[2] - xyz[2], 2));
178 double drmin = std::numeric_limits<double>::max();
180 TVector3 p(part->
Vx(itp), part->
Vy(itp), part->
Vz(itp));
181 double dr = (p - point).Mag();
190 moms.push_back(TVector3(mom * sign * (xyz1[0] - xyz[0]) / dx,
191 mom * sign * (xyz1[1] - xyz[1]) / dx,
192 mom * sign * (xyz1[2] - xyz[2]) / dx));
212 double xyzerr[6] = {1.e-3};
215 spcol->push_back(sp);
218 size_t spEnd = spcol->size();
232 clusterMapItr.first));
239 for (
size_t p = 0; p < ptrvs.
size(); ++p) {
240 hits = fmh.at(idxs[p]);
247 mf::LogInfo(
"TrackCheater") <<
"adding track: \n" << trackcol->back() <<
"\nto collection.";
253 evt.
put(std::move(trackcol));
254 evt.
put(std::move(spcol));
255 evt.
put(std::move(tcassn));
256 evt.
put(std::move(thassn));
257 evt.
put(std::move(tspassn));
unsigned int NumberTrajectoryPoints() const
std::string const fCheatedClusterLabel
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< Vector_t > convertCollToVector(std::vector< Vector > const &coll)
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
TrackTrajectory::Flags_t Flags_t
constexpr auto abs(T v)
Returns the absolute value of the argument.
TrackCheater(fhicl::ParameterSet const &pset)
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 >> SMatrixSym55
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={})
#define DEFINE_ART_MODULE(klass)
void push_back(Ptr< U > const &p)
A trajectory in space reconstructed from hits.
double P(const int i=0) const
Provides recob::Track data product.
std::vector< Point_t > convertCollToPoint(std::vector< Point > const &coll)
Declaration of cluster object.
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.
double Vx(const int i=0) const
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
double Vz(const int i=0) const
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void produce(art::Event &evt) override
Namespace collecting geometry-related classes utilities.
std::string const fG4ModuleLabel
label for module running G4 and making particles, etc
double Vy(const int i=0) const
art framework interface to geometry description
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Signal from collection planes.