42 #include "Utilities/AssociationUtil.h" 115 bool isProng,
unsigned int slice,
unsigned int id);
168 fTrainTree = tfs->
make<TTree>(
"CVNTrainTree",
"Training records");
191 const std::vector<rb::Cluster> & clusters = *clusterHandle;
193 for(
unsigned int i=0;
i<clusterHandle->size(); ++
i){
202 std::vector<int> bestNuId;
203 std::vector<cheat::NeutrinoWithIndex> nus;
204 std::vector<std::vector<cheat::NeutrinoEffPur>> sEffPur;
210 for(
size_t iClust = 0; iClust < clusters.size(); ++iClust){
215 std::vector< art::Ptr<caf::StandardRecord> > srs;
219 srs = fmpSR.at(iClust);
227 if(!fmPixelMap.isValid())
continue;
229 const std::vector<art::Ptr<PixelMap>> pixelMaps = fmPixelMap.at(iClust);
230 if(pixelMaps.empty())
continue;
233 if(bestNuId[iClust] != -1) truth = sEffPur[iClust][bestNuId[iClust]].neutrinoInt;
237 float nuEnergy, lepEnergy;
239 interaction =
SliceClassify(truth, cluster, nuEnergy, lepEnergy, vtxx, vtxy, vtxz);
243 train =
TrainingData(interaction, finalstate, finalstateprongs, nuEnergy, lepEnergy, *pixelMaps[0]);
254 std::vector< art::Ptr<rb::Prong> > prongs3D;
255 std::vector< art::Ptr<rb::Prong> > prongs2D;
256 std::vector< art::Ptr<rb::Vertex> > vert;
258 if(fmProng2D.isValid() ) prongs2D = fmProng2D.at(iClust);
259 if(fmProng3D.isValid() ) prongs3D = fmProng3D.at(iClust);
260 if(fmv.isValid() ) vert = fmv.at(iClust);
261 if(!fmProng2D.isValid() && !fmProng3D.isValid())
continue;
268 if(!vert.empty() ) v = vert[0]->GetXYZ();
269 else v.SetXYZ(-999.,-999.,-999.);
278 for(
unsigned int iProng = 0; iProng < prongs3D.size(); ++iProng){
283 if(!fmPixelMap3D.isValid())
continue;
285 const std::vector< art::Ptr<PixelMap> > pixelMaps3D = fmPixelMap3D.at(iProng);
286 if(pixelMaps3D.empty())
continue;
294 std::vector< art::Ptr<rb::Shower> > showers;
295 showers.push_back(shower);
298 if (foShLID.isValid()){
301 gap = showerLID->Gap();
308 double purity3D, purityX, purityY, recE;
309 unsigned int ncellX, ncellY;
312 TrainingData pmtrain(interaction, finalstate, finalstateprongs,
313 nuEnergy, lepEnergy, *pixelMaps3D[0]);
315 length = prongs3D[iProng]->TotalLength();
316 angle = prongdir*beamdir;
318 ptype3D =
ProngClassify(*prongs3D[iProng], &ptype3D, &ptypeX, &ptypeY,
319 &isprimary, &purity3D, &purityX, &purityY,
320 &recE, &ncellX, &ncellY);
323 purity3D, purityX, purityY, recE,
324 ncellX, ncellY, v.X(), v.Y(), v.Z(),
325 length, (double)angle, gap, *pixelMaps3D[0]);
337 for(
unsigned int iProng2 = 0; iProng2 < prongs2D.size(); ++iProng2){
339 if(!fmPixelMap2D.isValid())
continue;
341 const std::vector< art::Ptr<PixelMap> > pixelMaps2D = fmPixelMap2D.at(iProng2);
342 if(pixelMaps2D.empty())
continue;
346 double purity2D, purityX2D, purityY2D, recE;
347 unsigned int ncellX, ncellY;
350 ptype2D =
ProngClassify(*prongs2D[iProng2], &ptype2D, &ptypeX2D, &ptypeY2D,
351 &isprimary, &purity2D, &purityX2D, &purityY2D,
352 &recE, &ncellX, &ncellY);
355 purity2D, purityX2D, purityY2D, recE,
356 ncellX, ncellY, v.X(), v.Y(), v.Z(),
357 0.0, 0.0, 0.0, *pixelMaps2D[0]);
373 bool isProng,
unsigned int slice,
unsigned int id)
378 TString
data =
"ProngPixelMap";
379 if (!isProng) data =
"SlicePixelMap";
387 TH2F* histWrite = tfs->
make<TH2F>(*hist);
389 TH2F* histWriteX = tfs->
make<TH2F>(*histX);
391 TH2F* histWriteY = tfs->
make<TH2F>(*histY);
std::string fPixelMapInput
void reconfigure(const fhicl::ParameterSet &pset)
SubRunNumber_t subRun() const
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)
enum cvn::PType ProngType
FinalStateType GetFinalStateType(const art::Ptr< simb::MCTruth > truth)
TH2F * SingleViewToTH2(const unsigned int &view, TString name) const
The EventLabeledPMaps objects contains a PixelMap and the output class type, and any other bit that g...
std::vector< NeutrinoWithIndex > allMCTruth() const
std::string fClusterLabel
A collection of associated CellHits.
std::string fClusterPMLabel
Instance label for cluster pixelmaps.
enum cvn::Interaction InteractionType
recovalid::CAFCutter fCAFCutter
CAFCutter helper class.
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 fCAFLabel
label for process that made standard records
Something else. Tau? Hopefully we don't use this.
PixelMap fPMap
PixelMap for the event.
const XML_Char const XML_Char * data
std::string fProngPMLabel
Instance label for prong pixelmaps.
std::vector< int > SliceToOrderedNuIdsByEnergy(const std::vector< cheat::NeutrinoWithIndex > &nusWithIdx, const std::vector< std::vector< cheat::NeutrinoEffPur >> &slTruthTable) const
CVNEventProngDump(fhicl::ParameterSet const &pset)
TH2F * ToTH2(TString name) const
bool passCuts(int cut, const caf::StandardRecord *sr)
std::string fShowerLabel
Instance label for showers.
std::string fVertexLabel
Instance label for vertex.
void push_back(Ptr< U > const &p)
TrainingData fSliceLabeledPM
Class of the event.
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"?
EventNumber_t event() const
std::string fProng2DLabel
Instance label for input 2D prongs.
EDAnalyzer(Table< Config > const &config)
enum cvn::FinalState FinalStateType
Vertex location in position and time.
EventLabeledPMaps * fEventPMapsData
bool fApplyCAFCuts
do you want to apply CAF-level cuts?
The TrainingData objects contains a PixelMap and the output class type, and any other bit that goes i...
PixelMap fProngPMap
PixelMap for the event.
TVector3 NuMIBeamDirection() const
Direction of neutrinos from the NuMI beam (unit vector)
Something else. Tau? Hopefully we don't use this.
void analyze(const art::Event &evt)
void WriteMapTH2(const art::Event &evt, const PixelMap &pm, bool isProng, unsigned int slice, unsigned int id)
Function to extract TH2 from PixelMap and write to TFile.
T * make(ARGS...args) const
ProngTrainingData fProngLabeledPMs
PixelMap for the event.
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)
PixelMap, basic input to CVN neural net.
int fCutType
what cuts do you want to apply? (see CAFCutter.h)
std::string fShowerLIDLabel
Instance label for showers.
enum cvn::FinalStateProngs FinalStateProngsType
art::ServiceHandle< cheat::BackTracker > fBT
Helper class for Reco Validation modules.
std::vector< std::string > fPreselectionLabels
std::string to_string(ModuleType mt)
std::string fProngModLabel
Module label for input prongs.
Encapsulate the geometry of one entire detector (near, far, ndos)
std::string fProng3DLabel
Instance label for input 3D prongs.
bool fMapProngs
Option to save maps for prongs.