40 #include "Utilities/AssociationUtil.h" 110 produces< std::vector<cvn::ProngTrainingData> >(
fProngTDLabel);
111 produces< std::vector<cvn::TrainingData> >(
fPMapTDLabel);
113 produces< art::Assns<cvn::TrainingData, rb::Cluster> >();
114 produces< art::Assns<cvn::ProngTrainingData, rb::Prong> >();
115 produces< art::Assns<cvn::TrainingData, cvn::PixelMap> >();
116 produces< art::Assns<cvn::ProngTrainingData, cvn::PixelMap> >();
171 const std::vector<rb::Cluster> & clusters = *clusterHandle;
173 for(
unsigned int i = 0;
i < clusterHandle->size(); ++
i){
177 std::unique_ptr<std::vector<TrainingData>>
178 trainData(
new std::vector<TrainingData>);
179 std::unique_ptr<std::vector<ProngTrainingData>>
180 prongtrainData(
new std::vector<ProngTrainingData>);
181 std::unique_ptr<std::vector<TrainingData>>
182 pmaptrainData(
new std::vector<TrainingData>);
183 std::unique_ptr<std::vector<ProngTrainingData>>
184 pmapprongtrainData(
new std::vector<ProngTrainingData>);
185 std::unique_ptr< art::Assns<TrainingData, rb::Cluster> >
187 std::unique_ptr< art::Assns<ProngTrainingData, rb::Prong> >
189 std::unique_ptr< art::Assns<TrainingData, PixelMap> >
191 std::unique_ptr< art::Assns<ProngTrainingData, PixelMap> >
195 std::vector<int> bestNuId;
196 std::vector<cheat::NeutrinoWithIndex> nus;
197 std::vector< std::vector<cheat::NeutrinoEffPur> > sEffPur;
206 for(
size_t iClust = 0; iClust < clusters.size(); ++iClust){
211 std::vector< art::Ptr<caf::StandardRecord> > records;
217 if(!fmPixelMap.isValid())
continue;
219 const std::vector< art::Ptr<PixelMap> > pixelMaps = fmPixelMap.at(iClust);
221 if(pixelMaps.empty())
continue;
232 double vtxx = std::numeric_limits<double>::lowest();
233 double vtxy = std::numeric_limits<double>::lowest();
234 double vtxz = std::numeric_limits<double>::lowest();
238 if(bestNuId[iClust] != -1) {
239 truth = sEffPur[iClust][bestNuId[iClust]].neutrinoInt;
241 interaction =
SliceClassify(truth, cluster, nuEnergy, lepEnergy,
244 lepEnergy, vtxx, vtxy, vtxz);
268 finalstateprongs, particles_type, nuEnergy,
269 lepEnergy, vtxx, vtxy, vtxz, *pixelMaps[0]);
270 trainData->push_back(train);
271 pmaptrainData->push_back(train);
282 std::vector<art::Ptr<rb::Prong>> prongs3D;
283 std::vector<art::Ptr<rb::Prong>> prongs2D;
284 std::vector< art::Ptr<rb::Vertex> > vert;
286 if( fmProng2D.isValid() ) prongs2D = fmProng2D.at(iClust);
287 if( fmProng3D.isValid() ) prongs3D = fmProng3D.at(iClust);
288 if(fmv.isValid() ) vert = fmv.at(iClust);
296 if(!vert.empty() ) v = vert[0]->GetXYZ();
297 else v.SetXYZ(-999.,-999.,-999.);
305 for(
unsigned int iProng = 0; iProng < prongs3D.size(); ++iProng ){
310 if(!fmPixelMap3D.isValid())
continue;
312 const std::vector< art::Ptr<PixelMap> > pixelMaps3D = fmPixelMap3D.at(iProng);
313 if(pixelMaps3D.empty())
continue;
320 std::vector< art::Ptr<rb::Shower> > showers;
321 showers.push_back(shower);
324 if (foShLID.isValid()){
327 gap = showerLID->Gap();
333 double purity3D, purityX, purityY, recE;
334 unsigned int ncellX, ncellY;
337 ptype3D =
ProngClassify(*prongs3D[iProng], &ptype3D, &ptypeX, &ptypeY,
338 &isprimary, &purity3D, &purityX, &purityY,
339 &recE, &ncellX, &ncellY);
342 purity3D, purityX, purityY, recE,
343 ncellX, ncellY, v.X(), v.Y(), v.Z(),
344 length, (double)angle, gap, *pixelMaps3D[0]);
346 prongtrainData->push_back(p_train);
347 pmapprongtrainData->push_back(p_train);
349 prongs3D[iProng], *(prong_assoc.get()), UINT_MAX,
fProngTDLabel);
354 for(
unsigned int iProng2 = 0; iProng2 < prongs2D.size(); ++iProng2 ){
356 if(!fmPixelMap2D.isValid())
continue;
358 const std::vector< art::Ptr<PixelMap> > pixelMaps2D = fmPixelMap2D.at(iProng2);
359 if(pixelMaps2D.empty())
continue;
363 double purity2D, purityX2D, purityY2D, recE;
364 unsigned int ncellX, ncellY;
367 ptype2D =
ProngClassify(*prongs2D[iProng2], &ptype2D, &ptypeX2D, &ptypeY2D,
368 &isprimary, &purity2D, &purityX2D, &purityY2D,
369 &recE, &ncellX, &ncellY);
372 purity2D, purityX2D, purityY2D, recE,
373 ncellX, ncellY, v.X(), v.Y(), v.Z(),
374 0.0, 0.0, 0.0, *pixelMaps2D[0]);
376 prongtrainData->push_back(p2_train);
377 pmapprongtrainData->push_back(p2_train);
379 prongs2D[iProng2], *(prong_assoc.get()), UINT_MAX,
fProngTDLabel);
390 evt.
put(std::move(slice_assoc));
391 evt.
put(std::move(prong_assoc));
392 evt.
put(std::move(pmap_assoc));
393 evt.
put(std::move(prongpmap_assoc));
std::string fProngPMapTDLabel
back track the reconstruction to the simulation
InteractionType SliceClassify(const art::Ptr< simb::MCTruth > truth, const rb::Cluster &slice, float &nuEnergy, float &lepEnergy, double &vtxx, double &vtxy, double &vtxz)
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
The TrainingData objects contains a PixelMap and the output class type, and any other bit that goes i...
enum cvn::PType ProngType
std::string fClusterLabel
std::string fProng2DLabel
FinalStateType GetFinalStateType(const art::Ptr< simb::MCTruth > truth)
std::vector< NeutrinoWithIndex > allMCTruth() const
A collection of associated CellHits.
enum cvn::Interaction InteractionType
std::string fChooseLabels
ParticlesType ParticlesSliceClassify(const art::Ptr< simb::MCTruth > truth, const rb::Cluster &slice, float &nuEnergy, float &lepEnergy, double &vtxx, double &vtxy, double &vtxz)
DEFINE_ART_MODULE(TestTMapFile)
Defines an enumeration for prong classification.
std::vector< std::vector< cheat::NeutrinoEffPur > > SlicesToMCTruthsTable(const std::vector< const rb::Cluster * > &sliceList) const
Given ALL the slices in an event, including the noise slice, returns a vector of vector of structures...
std::string fProng3DLabel
Something else. Tau? Hopefully we don't use this.
ProductID put(std::unique_ptr< PROD > &&product)
std::vector< int > SliceToOrderedNuIdsByEnergy(const std::vector< cheat::NeutrinoWithIndex > &nusWithIdx, const std::vector< std::vector< cheat::NeutrinoEffPur >> &slTruthTable) const
void reconfigure(const fhicl::ParameterSet &pset)
ParentParticleType GetParentParticleType(const art::Ptr< simb::MCTruth > truth, const art::Event &evt)
void push_back(Ptr< U > const &p)
std::string fProngTDLabel
Something else. Tau? Hopefully we don't use this.
T get(std::string const &key) const
FinalStateProngsType GetFinalStateProngsType(const art::Ptr< simb::MCTruth > truth)
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
enum cvn::FinalState FinalStateType
Vertex location in position and time.
std::string fProngModLabel
enum cvn::Particles ParticlesType
The TrainingData objects contains a PixelMap and the output class type, and any other bit that goes i...
TVector3 NuMIBeamDirection() const
Direction of neutrinos from the NuMI beam (unit vector)
Something else. Tau? Hopefully we don't use this.
Catch all term, shouldn't be used.
enum cvn::ParentParticle ParentParticleType
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
The TrainingData objects contains a PixelMap and the output class type, and any other bit that goes i...
ProngType ProngClassify(const rb::Prong &prong, ProngType *pType3D, ProngType *pTypeX, ProngType *pTypeY, bool *isprimary, double *purity3D, double *purityX, double *purityY, double *recE, unsigned int *ncellX, unsigned int *ncellY)
void produce(art::Event &evt)
CVNAddTrainingData(fhicl::ParameterSet const &pset)
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
art::ServiceHandle< cheat::BackTracker > fBT
std::vector< std::string > fPreselectionLabels
enum cvn::FinalStateProngs FinalStateProngsType
std::string fClusterTDLabel
bool fObeyPreselection
Check rb::IsFiltered?
std::string fPixelMapInput
std::string fShowerLIDLabel
ParticlesTrainingData * fParticlesTrain
Encapsulate the geometry of one entire detector (near, far, ndos)