40 #include "Utilities/AssociationUtil.h" 109 static bool byScore (std::pair<int,float>
i,std::pair<int,float>
j){
110 return ( (i.second > j.second) );
191 const std::vector<rb::Cluster> & clusters = *sliceHandle;
193 for (
unsigned int i=0;
i<sliceHandle->size(); ++
i )
197 if ( !foSliceCVN.isValid() )
return;
201 if ( !foNumuE.isValid() )
return;
204 std::vector<cheat::NeutrinoWithIndex> nus =
bt->
allMCTruth();
208 for (
size_t iSlice = 0; iSlice < clusters.size(); ++iSlice ) {
215 if ( sliceNuId[iSlice] == -1 )
continue;
216 if ( slice.
IsNoise() )
continue;
222 truth = slTruth[iSlice][sliceNuId[iSlice]].neutrinoInt;
235 if (!cvnSliceResult)
continue;
244 std::vector<art::Ptr<rb::Prong>> prongs3D;
247 if ( !fmProng3D.isValid() )
continue;
248 if ( fmProng3D.isValid() ) prongs3D = fmProng3D.at(iSlice);
251 std::sort(prongs3D.begin(),prongs3D.end(),
CompareE);
264 for (
unsigned int iProng = 0; iProng <
Nprongs; ++iProng ){
266 if (fmCVNID.isValid()) {
267 std::vector< art::Ptr<rb::PID> > cvnPIDs = fmCVNID.at(iProng);
270 std::sort(cvnPIDs.begin(), cvnPIDs.end(),
scoreCompare);
271 for(
unsigned int iPID = 0; iPID < cvnPIDs.size(); ++iPID ){
280 double purity3D, purityX, purityY, recE;
281 unsigned int ncellX, ncellY;
284 ptype3D =
ProngClassify(*prongs3D[iProng], &ptype3D, &ptypeX, &ptypeY, &isprimary,
285 &purity3D, &purityX, &purityY, &recE, &ncellX, &ncellY);
292 if(purPDG.size()==0)
continue;
293 for(
int iPur = 0; iPur <
std::min((
int)purPDG.size(),20); ++iPur ){
303 if ((
int)purPDG[0].first == 13 || (
int)purPDG[0].first == 2212 || (
int)purPDG[0].first == 211){
306 for(
unsigned int h = 0;
h < prongs3D[iProng]->NCell(); ++
h){
312 for(
unsigned int hpr = 0; hpr < hitsMPP.
NCell(); ++hpr) {
314 if((*pronghit) == (*prongHitInList)) {
321 if(!onlist) hitsMPP.
Add(prongs3D[iProng]->Cell(
h));
329 for(
unsigned int h = 0;
h < prongs3D[iProng]->NCell(); ++
h){
335 for(
unsigned int hpr = 0; hpr < hitsMPP.
NCell(); ++hpr) {
337 if((*pronghit) == (*prongHitInList)) {
345 for(
unsigned int hpr = 0; hpr < hits3DProngsOther.
NCell(); ++hpr) {
347 if((*pronghit) == (*prongHitInList)) {
355 if(!onlist) hits3DProngsOther.
Add(prongs3D[iProng]->Cell(
h));
360 if ( foSh.isValid() ){
364 std::vector<art::Ptr<rb::Shower>> showers;
365 showers.push_back(shower);
368 if ( foShLID.isValid() ){
371 if ( roShLID.ref() ) {
380 if(purPDGs.size()==0)
continue;
381 for(
int iPur = 0; iPur <
std::min((
int)purPDGs.size(),20); ++iPur ){
392 std::vector< art::Ptr< rb::Track > > tracks;
393 if (!fmTrack.isValid())
continue;
394 tracks = fmTrack.at(iProng);
399 for (
unsigned int itrack = 0; itrack < tracks.size(); ++itrack ){
400 std::vector< art::Ptr< rb::FitSum > > fitsums;
401 if ( fitsumFMP.isValid() ) fitsums = fitsumFMP.at(itrack);
402 if ( fitsums.size() != 1 )
continue;
407 if(phi<0.0) phi += 360.0;
419 if(purPDG.size() == 0)
continue;
420 for(
int iMatch = 0; iMatch <
std::min((
int)purPDG.size(),20); ++iMatch) {
429 if(fmBPFTrackBPFPid.isValid()) {
430 std::vector<art::Ptr<bpfit::BPFPId>> bpfpids = fmBPFTrackBPFPid.at(itrack);
431 if(bpfpids.size() < 1)
continue;
463 std::vector< art::Ptr<rb::Track> > sliceKalmanTracks;
464 if ( fmSliceKalman.isValid() ){
466 sliceKalmanTracks = fmSliceKalman.at(iSlice);
469 for(
int iTrk = 0; iTrk <
std::min((
int)sliceKalmanTracks.size(),20); ++iTrk) {
476 if(phi<0.0) phi += 360.0;
483 if(purPDG.size() == 0)
continue;
484 for(
int iMatch = 0; iMatch <
std::min((
int)purPDG.size(),20); ++iMatch) {
493 if(foKalmanRemid.isValid()) {
502 std::vector<art::Ptr<rb::Prong>> prongs2D;
507 if ( fmProng2D.isValid() ) {
508 prongs2D = fmProng2D.at(iSlice);
510 std::sort(prongs2D.begin(),prongs2D.end(),
CompareE);
513 for (
unsigned int iProng = 0; iProng <
Nprongs2D; ++iProng){
518 if(purPDG.size()==0)
continue;
519 for (
int iPur = 0; iPur <
std::min((
int)purPDG.size(),20); ++iPur ){
526 for(
unsigned int h2D = 0; h2D < prongs2D[iProng]->NCell(); ++ h2D){
530 for(
unsigned int hpr = 0; hpr < hitsMPP.
NCell(); ++hpr) {
532 if((*pronghit) == (*prongHitInList)) {
540 for(
unsigned int hpr = 0; hpr < hits3DProngsOther.
NCell(); ++hpr) {
542 if((*pronghit) == (*prongHitInList)) {
551 for(
unsigned int hpr = 0; hpr < hits2DProngs.
NCell(); ++hpr) {
553 if((*pronghit) == (*prongHitInList)) {
559 if (!onlist) hits2DProngs.
Add(prongs2D[iProng]->Cell(h2D));
575 for (
unsigned int hsl = 0; hsl < slice.
NCell(); ++hsl) {
580 for(
unsigned int hpr = 0; hpr < hitsMPP.
NCell(); ++hpr) {
582 if((*sliceHit) == (*prongHitInList)) {
590 for(
unsigned int hpr = 0; hpr < hits3DProngsOther.
NCell(); ++hpr) {
592 if((*sliceHit) == (*prongHitInList)) {
601 for(
unsigned int hpr = 0; hpr < hits2DProngs.
NCell(); ++hpr) {
603 if((*sliceHit) == (*prongHitInList)) {
611 orphanedHits.
Add(slice.
Cell(hsl));
620 if (fmCosRej.isValid()) {
621 const std::vector<art::Ptr<cosrej::CosRejObj> >
cosrej = fmCosRej.at(iSlice);
622 if (cosrej.size() > 0){
double E(const int i=0) const
void beginRun(art::Run const &)
std::vector< std::pair< int, double > > Get2DProngPurityByPDG(const rb::Cluster &prong)
std::string fShowerLIDLabel
SubRunNumber_t subRun() const
back track the reconstruction to the simulation
enum cvn::PType ProngType
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
const simb::MCNeutrino & GetNeutrino() const
double prng_trueE[20][20]
std::vector< std::string > fPreselectionLabels
double trkBPF_truepur[20][3][20]
const art::ProductToken< std::vector< rb::Cluster > > fClusterToken
const simb::MCParticle & Nu() const
std::vector< NeutrinoWithIndex > allMCTruth() const
double trkBPF_theta[20][3]
double trkBPF_trueeff[20][3][20]
std::vector< std::pair< int, double > > Get2DProngEfficiencyByPDG(const rb::Cluster &prong, const rb::Cluster &slice)
std::string fPixelMapInput
A collection of associated CellHits.
int prng2D_missingpln[20]
std::string fProng3DLabel
DEFINE_ART_MODULE(TestTMapFile)
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 fEnergyModuleLabel
std::vector< float > fOutput
Vector of outputs from neural net.
double prng_truepur[20][20]
std::vector< std::pair< int, double > > GetProngEfficiencyByPDG(const rb::Cluster &prong, const rb::Cluster &slice)
float RecoTrkCCHadE() const
double shwLID_truepur[20][20]
std::vector< int > SliceToOrderedNuIds(const std::vector< cheat::NeutrinoWithIndex > &nusWithIdx, const std::vector< std::vector< cheat::NeutrinoEffPur >> &slTruthTable, std::function< double(const cheat::NeutrinoEffPur &)> slMetric, std::function< double(const cheat::NeutrinoEffPur &)> nuMetric) const
Given a vector of indexed neutrino interaction and a vector of slice truth tables, returns a vector of neutrino interaction indices ordered by best match to the corresponding slice. Here, best match is determined according to the given cheat::NeutrinoEffPur functions for the slice and the nu.
double prng2D_truepur[20][20]
art::ServiceHandle< cheat::BackTracker > bt
virtual void Add(const art::Ptr< rb::CellHit > &cell, double weight=1)
static bool CompareE(const art::Ptr< rb::Prong > &a, const art::Ptr< rb::Prong > &b)
virtual double TotalLength() const
Length (cm) of all the track segments.
unsigned short Cell() const
std::vector< std::pair< int, double > > Get2DProngEnergyByPDG(const rb::Cluster &prong)
double prng_cvnscore[20][20]
virtual double TotalLength() const
Distance along prong to reach last cell hit.
const simb::MCParticle & Lepton() const
void reconfigure(const fhicl::ParameterSet &pset)
void push_back(Ptr< U > const &p)
Summarize Slice information.
double prng2D_trueE[20][20]
double prng_trueeff[20][20]
T get(std::string const &key) const
virtual TVector3 Dir() const
Unit vector describing prong direction.
double EnergyMetric(const cheat::NeutrinoEffPur &ep)
Function for NeutrinoEffPur's nu interaction to slice energy.
void analyze(const art::Event &evt)
static bool scoreCompare(const art::Ptr< rb::PID > &pidA, const art::Ptr< rb::PID > &pidB)
bool IsFiltered(const art::Event &evt, art::Ptr< T > x, const std::vector< std::string > &labels)
Is this Ptr marked "filtered out"?
EDAnalyzer(Table< Config > const &config)
BPFCVNAna(fhicl::ParameterSet const &pset)
std::string fProng2DLabel
Perform a "2 point" Hough transform on a collection of hits.
double trkKal_trueeff[20][20]
EventNumber_t event() const
int NMissingPlanes(geo::View_t view) const
Total number of missing planes in cluster.
int trkBPF_truePDG[20][3][20]
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Cosmic Rejection PIDs for Numu analysis.
A rawdata::RawDigit with channel information decoded.
T * make(ARGS...args) const
std::vector< std::pair< int, double > > GetProngPurityByPDG(const rb::Cluster &prong)
int prng2D_truePDG[20][20]
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)
double prng2D_trueeff[20][20]
static bool byScore(std::pair< int, float > i, std::pair< int, float > j)
double TotalGeV(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple sum of the estimated GeV of all the hits.
double trkKal_truepur[20][20]
std::string fCVNSliceLabel
int shwLID_truePDG[20][20]
double shwLID_trueeff[20][20]
T min(const caf::Proxy< T > &a, T b)
bool IsNoise() const
Is the noise flag set?
bool getByToken(ProductToken< PROD > const &token, Handle< PROD > &result) const
Event generator information.
ProductToken< T > consumes(InputTag const &)
std::string fProngModLabel
std::vector< std::pair< int, double > > GetProngEnergyByPDG(const rb::Cluster &prong)
double prng2D_totalGeV[20]
int trkKal_truePDG[20][20]