22 #include "art_root_io/TFileDirectory.h" 23 #include "art_root_io/TFileService.h" 29 #include "canvas/Persistency/Common/FindManyP.h" 138 fHitsModuleLabel (pset.
get<
std::
string> (
"HitsModuleLabel")),
139 fClusterPMLabel (pset.
get<
std::
string> (
"ClusterPMLabel")),
140 fMinClusterHits (pset.
get<unsigned short> (
"MinClusterHits")),
141 fTdcWidth (pset.
get<unsigned short> (
"TdcWidth")),
142 fWireLength (pset.
get<unsigned short> (
"WireLength")),
143 fTimeResolution (pset.
get<unsigned short> (
"TimeResolution")),
144 fWireResolution (pset.
get<unsigned short> (
"WireResolution")),
145 fGlobalWireMethod (pset.
get<
int> (
"GlobalWireMethod")),
146 fUseRecoVertex (pset.
get<
int> (
"UseRecoVertex")),
147 fProngTagMethod (pset.
get<
int> (
"ProngTagMethod")),
148 fUseThreeDMap (pset.
get<
int> (
"UseThreeDMap")),
149 fCropped (pset.
get<
bool> (
"Cropped")),
150 fProngOnly (pset.
get<
bool> (
"ProngOnly")),
151 fUnitX (pset.
get<
int> (
"UnitX")),
152 fUnitY (pset.
get<
int> (
"UnitY")),
153 fUnitZ (pset.
get<
int> (
"UnitZ")),
154 fXResolution (pset.
get<double> (
"XResolution")),
155 fYResolution (pset.
get<double> (
"YResolution")),
156 fZResolution (pset.
get<double> (
"ZResolution")),
157 fByHit (pset.
get<
bool> (
"ByHit")),
158 fShowerModuleLabel(pset.
get<
std::
string> (
"ShowerModuleLabel")),
159 fTrackModuleLabel (pset.
get<
std::
string> (
"TrackModuleLabel")),
160 fVertexModuleLabel(pset.
get<
std::
string> (
"VertexModuleLabel")),
161 fPFParticleModuleLabel(pset.
get<
std::
string> (
"PFParticleModuleLabel")),
162 fPandoraNuVertexModuleLabel(pset.
get<
std::
string>(
"PandoraNuVertexModuleLabel")),
163 fRegCNNResultLabel (pset.
get<
std::
string> (
"RegCNNResultLabel")),
164 fRegCNNModuleLabel (pset.
get<
std::
string> (
"RegCNNModuleLabel")),
165 fProducer(
RegPixelMapProducer(fWireLength, fWireResolution, fTdcWidth, fTimeResolution, fGlobalWireMethod, fProngOnly, fByHit)),
166 fProducer3D(
RegPixelMap3DProducer(fUnitX, fUnitY, fUnitZ, fXResolution, fYResolution, fZResolution, fCropped, fProngOnly))
173 mf::LogError(
"RegCNNMapper::RegCNNMapper")<<
"RegCNNMapper accepts 0 or 1 for fUseThreeDMap"<<
std::endl;
200 std::vector< art::Ptr< recob::Hit > > hitlist;
209 unsigned short nhits = hitlist.size();
212 std::vector<art::Ptr<recob::Vertex> > vertex_list;
221 std::unique_ptr< std::vector<cnn::RegPixelMap> >
222 pmCol(
new std::vector<cnn::RegPixelMap>);
224 std::unique_ptr< std::vector<cnn::RegPixelMap3D> >
225 pm3DCol(
new std::vector<cnn::RegPixelMap3D>);
240 auto cnnresultListHandle = evt.
getHandle<std::vector<cnn::RegCNNResult>>(itag1);
241 std::vector<float> vtx(3, -99999);
242 if (!cnnresultListHandle.failedToGet())
244 if (!cnnresultListHandle->empty())
246 const std::vector<float>& v = (*cnnresultListHandle)[0].fOutput;
247 for (
unsigned int ii = 0; ii < 3; ii++){
249 std::cout<<
"vertex "<<ii<<
" : "<<vtx[ii]<<
std::endl;
268 int n_pand_particles = particleVector.size();
270 double xyz_temp[3] = {0.0, 0.0, 0.0};
271 std::vector<float> vtx(3, -99999);
272 for (
int ipfp = 0; ipfp< n_pand_particles; ipfp++) {
278 if (particlesToVertices.end() != vIter) {
280 if (!vertexVector.empty()) {
281 if (vertexVector.size()!=1)
282 std::cout<<
" Warning: Found particle with more than one associated vertex "<<
std::endl;
285 vertex_pfp->
XYZ(xyz_temp);
286 for (
unsigned int ii=0; ii<3; ++ii) {
287 vtx[ii] = xyz_temp[ii];
296 std::cout<<
"FIXME: CreateMap from fmshwhit and pandora vtx"<<
std::endl;
304 auto cnnresultListHandle = evt.
getHandle<std::vector<cnn::RegCNNResult>>(itag2);
305 std::vector<float> vtx(6, -99999);
306 if (!cnnresultListHandle.failedToGet())
308 if (!cnnresultListHandle->empty())
310 const std::vector<float>& v = (*cnnresultListHandle)[0].fOutput;
311 for (
unsigned int ii = 0; ii < 6; ii++){
323 if (pm.
fInPM) pmCol->push_back(pm);
328 std::cout<<
"Making 3D pixel maps ......"<<
std::endl;
337 int n_pand_particles = particleVector.size();
339 double xyz_temp[3] = {0.0, 0.0, 0.0};
340 std::vector<float> vtx(3, -99999);
341 for (
int ipfp = 0; ipfp< n_pand_particles; ipfp++) {
347 if (particlesToVertices.end() != vIter) {
349 if (!vertexVector.empty()) {
350 if (vertexVector.size()!=1)
351 std::cout<<
" Warning: Found particle with more than one associated vertex "<<std::endl;
354 vertex_pfp->
XYZ(xyz_temp);
355 for (
unsigned int ii=0; ii<3; ++ii) {
356 vtx[ii] = xyz_temp[ii];
368 if (pm.
fInPM) pm3DCol->push_back(pm);
void XYZ(double *xyz) const
Legacy method to access vertex position, preserved to avoid breaking code. Please try to use Vertex::...
RegPixelMap3D Create3DMap(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit > > const &cluster, art::FindManyP< recob::SpacePoint > const &fmSPFromHits, art::FindManyP< recob::Track > const &fmtrkhit, const std::vector< float > &vtx)
int fUseThreeDMap
choose to create 3D pixel maps
RegPixelMap CreateMap(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit > > const &cluster, art::FindManyP< recob::Wire > const &fmwire)
void produce(art::Event &evt)
Producer algorithm for RegPixelMap3D, input to CVN neural net.
Handle< PROD > getHandle(SelectorBase const &) const
std::string fPFParticleModuleLabel
RegPixelMap, basic input to CNN neural net.
std::string fHitsModuleLabel
Module lablel for input clusters.
std::string fShowerModuleLabel
Producer algorithm for RegPixelMap, input to CVN neural net.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::string fRegCNNResultLabel
std::map< art::Ptr< recob::PFParticle >, VertexVector > PFParticlesToVertices
RegPixelMap3DProducer fProducer3D
#define DEFINE_ART_MODULE(klass)
int fProngTagMethod
select how to tag prong
RegPixelMapProducer for RegCNN modified from PixelMapProducer.h.
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
static void CollectVertices(const art::Event &evt, const std::string &label, VertexVector &vertexVector, PFParticlesToVertices &particlesToVertices)
Collect the reconstructed PFParticles and associated Vertices from the ART event record.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool IsPrimary() const
Returns whether the particle is the root of the flow.
RegPixelMap3D for RegCNN modified from PixelMap.h.
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
RegPixelMap3DProducer for RegCNN modified from PixelMapProducer.h.
int fUseRecoVertex
select how to choose center of pixel map
unsigned short fMinClusterHits
Minimum number of hits for cluster to be converted to pixel map.
Defines an enumeration for cellhit classification.
std::string fPandoraNuVertexModuleLabel
RegCNNResult for RegCNN modified from Result.h.
Declaration of signal hit object.
unsigned short fWireLength
Length of pixel map in wires.
std::string fTrackModuleLabel
Provides recob::Track data product.
std::string fClusterPMLabel
Instance lablel for cluster pixelmaps.
std::string fRegCNNModuleLabel
std::vector< art::Ptr< recob::Vertex > > VertexVector
Declaration of basic channel signal object.
int fGlobalWireMethod
Use unwrapped pixel maps?
RegPixelMapProducer fProducer
PixelMapProducer does the work for us.
RegPixelMap3D, input to 3D CNN neural net.
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
RegPixelMap for RegCNN modified from PixelMap.h.
helper function for LArPandoraInterface producer module
QTextStream & endl(QTextStream &s)
std::string fVertexModuleLabel