33 #include "canvas/Persistency/Common/FindManyP.h" 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>>();
82 std::vector<art::Ptr<recob::Cluster>> clusters;
86 std::vector<art::Ptr<recob::Cluster>>
::iterator itr = clusters.begin();
89 std::map<int, std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>> eveClusterMap;
92 for (
size_t c = 0;
c < clusters.size(); ++
c) {
94 std::pair<size_t, art::Ptr<recob::Cluster>> idxPtr(
c, clusters[
c]);
100 int eveID = floor((*itr)->ID() / 1000.);
102 eveClusterMap[eveID].push_back(idxPtr);
107 std::unique_ptr<std::vector<recob::Track>> trackcol(
new std::vector<recob::Track>);
108 std::unique_ptr<std::vector<recob::SpacePoint>> spcol(
new std::vector<recob::SpacePoint>);
109 std::unique_ptr<art::Assns<recob::Track, recob::SpacePoint>> tspassn(
111 std::unique_ptr<art::Assns<recob::Track, recob::Cluster>> tcassn(
113 std::unique_ptr<art::Assns<recob::Track, recob::Hit>> thassn(
118 for (
auto const& clusterMapItr : eveClusterMap) {
121 std::vector<std::pair<size_t, art::Ptr<recob::Cluster>>>
const& eveClusters =
122 clusterMapItr.second;
131 std::vector<TVector3> points;
132 std::vector<TVector3> moms;
135 <<
"G4 id " << clusterMapItr.first <<
" is a track with pdg code " << part->
PdgCode();
138 std::vector<size_t> idxs;
139 for (
auto const& idxPtr : eveClusters) {
141 idxs.push_back(idxPtr.first);
145 std::vector<art::Ptr<recob::Hit>> hits;
146 for (
size_t p = 0;
p < ptrvs.
size(); ++
p) {
147 std::vector<art::Ptr<recob::Hit>> chits = fmh.at(idxs[
p]);
148 if (!chits.size())
continue;
150 hits.insert(hits.end(), chits.begin(), chits.end());
154 if (hits.size() < 2)
continue;
157 size_t spStart = spcol->size();
158 for (
size_t t = 0;
t < hits.size(); ++
t) {
159 std::vector<double> xyz = bt_serv->
HitToXYZ(clockData, hits[
t]);
160 TVector3 point(xyz[0], xyz[1], xyz[2]);
161 points.push_back(point);
163 std::vector<double> xyz1;
167 if (t < hits.size() - 1) { xyz1 = bt_serv->
HitToXYZ(clockData, hits[t + 1]); }
169 xyz1 = bt_serv->
HitToXYZ(clockData, hits[t - 1]);
174 dx = std::sqrt(
std::pow(xyz1[0] - xyz[0], 2) +
std::pow(xyz1[1] - xyz[1], 2) +
181 TVector3
p(part->
Vx(itp), part->
Vy(itp), part->
Vz(itp));
182 double dr = (
p - point).Mag();
191 moms.push_back(TVector3(mom * sign * (xyz1[0] - xyz[0]) / dx,
192 mom * sign * (xyz1[1] - xyz[1]) / dx,
193 mom * sign * (xyz1[2] - xyz[2]) / dx));
213 double xyzerr[6] = {1.e-3};
216 spcol->push_back(sp);
219 size_t spEnd = spcol->size();
233 clusterMapItr.first));
240 for (
size_t p = 0;
p < ptrvs.
size(); ++
p) {
241 hits = fmh.at(idxs[
p]);
248 mf::LogInfo(
"TrackCheater") <<
"adding track: \n" << trackcol->back() <<
"\nto collection.";
unsigned int NumberTrajectoryPoints() const
std::string const fCheatedClusterLabel
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 > > SMatrixSym55
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< Vector_t > convertCollToVector(std::vector< Vector > const &coll)
EDProducer(fhicl::ParameterSet const &pset)
TrackTrajectory::Flags_t Flags_t
TrackCheater(fhicl::ParameterSet const &pset)
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
art framework interface to geometry description
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#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
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::vector< Point_t > convertCollToPoint(std::vector< Point > const &coll)
static int max(int a, int b)
const sim::ParticleList & ParticleList() const
double Vx(const int i=0) const
Declaration of signal hit object.
Provides recob::Track data product.
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
LArSoft geometry interface.
std::string const fG4ModuleLabel
label for module running G4 and making particles, etc
double Vy(const int i=0) const
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.