void AngleScan_V::completeView(SmartRefVector<Minerva::IDCluster>& unusedViewClusters, SmartRefVector<Minerva::IDCluster>& showerCand, double vtxT) { if (unusedViewClusters.empty()) return; double z_min = 10000; double z_max = -10000; double angle_min = 180; double angle_max = -180; SmartRefVector<Minerva::IDCluster> viewShowerCand; SmartRefVector<Minerva::IDCluster>::iterator it_view = unusedViewClusters.begin(); for (SmartRefVector<Minerva::IDCluster>::iterator c = showerCand.begin(); c != showerCand.end(); ++c){ if ( (*c)->view() == (*it_view)->view() ) viewShowerCand.push_back(*c); if ( (*c)->view() == Minerva::IDCluster::U && (*c)->z() < z_min ) z_min = (*c)->z(); if ( (*c)->view() == Minerva::IDCluster::U && (*c)->z() > z_max ) z_max = (*c)->z(); } if (viewShowerCand.empty()) { std::cout << "\tAngleScan_V::completeView: no view cluster" << std::endl; return; } for ( it_view = viewShowerCand.begin(); it_view != viewShowerCand.end(); ++it_view){ const double z = (*it_view)->z() - fZ; const double u = (*it_view)->position() - vtxT; const double ang = std::atan2(u,z)*TMath::RadToDeg(); if ( ang >= angle_max ) angle_max = ang; if ( ang <= angle_min ) angle_min = ang; } z_min = z_min - 100; z_max = z_max + 100; angle_max = angle_max + 10.0; angle_min = angle_min - 10.0; /* Move clusters between (angle_min,angle_max) and (z_min,z_max) from 'unusedClusters' to blob */ std::cout << "\tAngleScan_V::completeView:oldsize: " << showerCand.size() << std::endl; coneView(unusedViewClusters, showerCand, vtxT, angle_min, angle_max, z_min, z_max ); std::cout << "\tAngleScan_V::completeView:newsize: " << showerCand.size() << std::endl; }
void AngleScan_V::FormVShowerCand() { for (std::vector<TVector2>::const_iterator peak = fPeaks.begin(); peak != fPeaks.end(); ++peak) { const double lower_edge = peak->X(); const double upper_edge = peak->Y(); const double zmin = 4500.0; const double zmax = 10000.0; SmartRefVector<Minerva::IDCluster> showerCand; coneView(fRemainingVClusters, showerCand, fV, lower_edge, upper_edge, zmin, zmax); if (showerCand.empty()) continue; if (showerCand.size() == 1 && showerCand.front()->pe() > 30) { fVShowerCandidates.push_back(showerCand); fGoodPeaks.push_back(*peak); } else if (showerCand.size() > 1) { fVShowerCandidates.push_back(showerCand); fGoodPeaks.push_back(*peak); } } // Calculate the distance from the shower candidates to the event vertex // Try two definitions of distance: closest and energy weighted for (std::vector<SmartRefVector<Minerva::IDCluster> >::iterator s = fVShowerCandidates.begin(); s != fVShowerCandidates.end(); ++s) { SmartRefVector<Minerva::IDCluster>& vshowerCand = *s; double d_min = 1.e6; double d_weighted = 0.0; double total_energy = 0.0; for (SmartRefVector<Minerva::IDCluster>::iterator c = vshowerCand.begin(); c != vshowerCand.end(); ++c) { double v = (*c)->position(); double z = (*c)->z(); double d = std::sqrt(std::pow(v-fV,2) + std::pow(z-fZ,2)); if (d < d_min) { d_min = d; } d_weighted += d * (*c)->energy(); total_energy += (*c)->energy(); } fVShowerClosestDistances.push_back(d_min); fVShowerWeightedDistances.push_back(d_weighted/total_energy); } std::sort(fVShowerCandidates.begin(),fVShowerCandidates.end(), greaterShower()); }