23 std::bitset<14> binary){
27 int testDB = (plane / 64);
28 int minblock = testDB;
29 int maxblock = testDB;
31 for (
int i = testDB - 1;
i >=0 ; --
i){
32 if (binary[
i]) minblock =
i;
35 for (
int i = testDB + 1;
i < 14; ++
i){
36 if (binary[
i]) maxblock =
i;
39 return std::pair<int, int>(64 * (minblock), 64 * (maxblock + 1) - 1);
66 std::vector<rb::Track const*> & tracks,
67 std::vector<rb::Shower const*> & showers,
68 std::vector<rb::Prong const*> & prongs,
69 std::vector<slid::ShowerLID const*> & slids,
103 size_t cellsFromEdge =
std::min((
unsigned int)ch->Cell(), geom->
Plane(ch->Plane())->Ncells() - 1 - ch->
Cell());
107 << geom->
Plane(ch->Plane())->Ncells()-1-ch->
Cell()
120 if(cellsFromEdge < 10) {
161 if(showers.size()>0){
213 int cvnOutputSize = cvn.
fOutput.size();
215 if( cvnOutputSize == 16 ) {
221 }
else if( cvnOutputSize == 392 ) {
230 if(state.
nuPdg == 14) numuid += prob;
241 float nShowerHit = 0.;
242 if(showers.size() > 1)
244 (
fShowerDir.Mag() * showers[1]->Dir().Mag()));
249 for(
auto prg : prongs){
254 for(
auto shw : showers){
255 nShowerHit += 1.*shw->NCell();
256 auto vtx = shw->Start();
257 auto end = shw->Stop();
274 for(
size_t itrk=0; itrk<tracks.size(); ++itrk){
276 if( itrk == bestPIDTrack )
continue;
278 auto vtx = tracks[itrk]->Start();
279 auto end = tracks[itrk]->Stop();
290 unsigned int dibfirst = 0;
292 unsigned int firstDBPlane = 0;
297 iD=0;
while (!((dibmask>>iD)&1)) iD++; dibfirst=iD+1;
300 firstDBPlane = (dibfirst - 1) * 64;
304 std::bitset<14> binary(dibmask);
316 <<
"Inside: ParametersNumu.cxx--" 387 std::vector<rb::Track const*> & tracks,
388 std::vector<rb::Shower const*> & showers,
389 std::vector<rb::Prong const*> & prongs,
390 std::vector<slid::ShowerLID const*> & slids,
450 std::vector<rb::Track const*> & tracks,
451 std::vector<rb::Shower const*> & showers,
452 std::vector<rb::Prong const*> & prongs,
453 std::vector<slid::ShowerLID const*> & slids,
543 std::map<std::string, std::pair<double, double> >
comps;
619 double fracDiff = 0.;
621 for(
auto itr : comps){
623 auto skimSR = itr.second;
625 fracDiff =
std::abs((skimSR.first - skimSR.second)/skimSR.first);
626 if( fracDiff > 1.
e-3)
721 LOG_VERBATIM(
"ParametersNumu") <<
"Pos out of range, return -99999";
727 MinDistToEdge = (
fEdgeBackYZ - Pos.Z() ) / Dir.Z();
728 LOG_VERBATIM(
"ParametersNumu") <<
"Z dist to back = " << MinDistToEdge <<
"\t or \t";
729 if(MinDistToEdge < 0)MinDistToEdge = (
fEdgeFrontYZ - Pos.Z() ) /Dir.Z();
735 float YDist = (
fEdgeTopYZ - Pos.Y() ) / Dir.Y();
736 LOG_VERBATIM(
"ParametersNumu") <<
"Y dist to top =" << YDist <<
"\t or \t";
739 if(YDist < MinDistToEdge) MinDistToEdge = YDist;
745 LOG_VERBATIM(
"ParametersNumu") <<
"X dist to East = " << XDist <<
"\t or \t";
748 if(XDist < MinDistToEdge) MinDistToEdge = XDist;
751 if(MinDistToEdge==99999 || MinDistToEdge < 0)MinDistToEdge = -99999;
752 LOG_VERBATIM(
"ParametersNumu") <<
"MinDist = " << MinDistToEdge ;
753 return MinDistToEdge;
762 double xyz1[3], xyz2[3];
765 LOG_VERBATIM(
"ParametersNumu") <<
"UNKNOWN DETECTOR!!!";
825 float maxtime = 0.001;
829 size_t trackCellsFromEdge = 1e6;
830 int closestEdge = -5;
832 for(
unsigned int i = 0;
i < track.
NCell();
i++)
834 auto chit = track.
Cell(
i);
835 if(chit->TNS() < mintime){
836 mintime = chit->
TNS();
838 geom->
Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
839 mintimepos.SetXYZ(xyz[0], xyz[1], xyz[2]);
841 if (chit->TNS() > maxtime){
842 maxtime = chit->TNS();
844 geom->
Plane(chit->Plane())->Cell(chit->Cell())->GetCenter(xyz);
845 maxtimepos.SetXYZ(xyz[0], xyz[1], xyz[2]);
848 size_t cellsFromEdge =
std::min((
unsigned int)chit->Cell(), geom->
Plane(chit->Plane())->Ncells() - 1 - chit->
Cell());
850 if( cellsFromEdge < trackCellsFromEdge ){
851 trackCellsFromEdge = cellsFromEdge;
852 if(chit->View() ==
geo::kX && cellsFromEdge == chit->Cell())closestEdge = 0;
853 else if(chit->View() ==
geo::kX && cellsFromEdge == geom->
Plane(chit->Plane())->Ncells() - 1 - chit->
Cell()) closestEdge = 1;
854 else if(chit->View() ==
geo::kY && cellsFromEdge == chit->Cell())closestEdge = 2;
855 else if(chit->View() ==
geo::kY && cellsFromEdge == geom->
Plane(chit->Plane())->Ncells() - 1 - chit->
Cell()) closestEdge = 3;
856 else closestEdge = -5;
862 if(cellsFromEdge < 10) {
868 if(cellsFromEdge < 10) {
874 return std::pair<TVector3, TVector3> (mintimepos, maxtimepos);
TVector3 fTrackDir
track direction (unit vector) at start point
float fShowerMaxVtxZ
maximum Z position of all showers
T max(const caf::Proxy< T > &a, T b)
#define LOG_DEBUG(stream)
int fTrackNHitsNearEdge[10]
float fShowerEndY
end of the primary shower
A 3D position and time representing an interaction vertex.
float fNumShowersLID
size of showerLIDs in a slice
float fFracShowerHits
fraction of slice hits in the primary shower
TVector3 fTrackStop
track end position (cm)
float fShowerMaxY
max y for all shower end points
float fDistAllBottom
distance of all showers in slice from the bottom edge of detector
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
void GetCenter(double *xyz, double localz=0.0) const
Energy estimators for CC events.
float fPlanesToFront
number of planes to the front of detector
double StopMinDistToBottom() const
Minimum perpendicular distance of all prongs stop points to the bottom edge of the detector...
float fDistAllFront
distance of all showers in slice from the front edge of detector
float fDistAllEast
distance of all showers in slice from the east edge of detector
float KalYPosAtTrans() const
float fNeutrinoE
neutrino energy
float fShowerMinY
min y for all shower end points
float fDistAllTop
distance of all showers in slice from the top edge of detector
float fSliceMaxPlane
maximum plane of the slice
float fTrackStopTime
track end time (ns)
float fCosRejKalFwdCellND
float fVertexZ
vertex of the interaction
float fShowerEndX
end of the primary shower
const CellGeo * Cell(int icell) const
double StopMinDistToWest() const
Minimum perpendicular distance of all prongs stop points to the west edge of the detector (west is po...
static Var numuid(const std::shared_ptr< CAFAnaModel > &model)
float fShowerNumXCell
number of x cells in slice
double StartMinDistToTop() const
Minimum perpendicular distance of all prongs start points.
Vertical planes which measure X.
unsigned int Ncells() const
Number of cells in this plane.
float fCosShowers
cosine of angle between showers in slice
A collection of associated CellHits.
float fCVN2017Val
value of the Old (2017) CVN PID //Analysis 2018
float fVertexX
vertex of the interaction
float fOtherTrackMaxVtxZ
maximum Z position of non Best-RemID tracks
float fShowerMinEndZ
minimum Z position of all showers
float fSliceHits
hits in the slice
A rb::Prong with full reconstructed trajectory.
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
const PlaneGeo * Plane(unsigned int i) const
NumuCutParameters const & ParametersStruct() const
virtual TVector3 Start() const
Defines an enumeration for prong classification.
std::vector< float > fOutput
Vector of outputs from neural net.
Module to create a summary of total POT seen in a job.
float fCosRejCosSpeed
inverse speed of the timing fit of the cosmic track
Horizontal planes which measure Y.
int fTrackClosestEdge
0:-x, 1:+x, 2:-y or 3:+y
float fDiffLastFirstLiveDiblock
float fTrackStopZ
track end z position
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
float fSliceCellsFromEdge
minimum cells to edge of detector
TVector3 fTrackLatestHitPos
position (cm) or track's latest hit in time
float fDistAllBack
distance of all showers in slice from the back edge of detector
double StopMinDistToTop() const
Minimum perpendicular distance of all prongs stop points to the top edge of the detector.
double TotalADC() const
Sum of the ADC of all the contained hits.
float ProjectDistToEdge(TVector3 Pos, TVector3 Dir)
Far Detector at Ash River, MN.
double StartMinDistToEast() const
Minimum perpendicular distance of all prongs start points to the east edge of the detector (east is n...
double StopMinDistToEast() const
Minimum perpendicular distance of all prongs stop points to the east edge of the detector (east is ne...
double CalorimetricEnergy(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple estimate of neutrino energy.
double StartMinDistToBottom() const
Minimum perpendicular distance of all prongs start points to the bottom edge of the detector...
float fCosRejKalBakCell
just what it looks like
int fCosTrackNCellsFromEdge
std::pair< int, int > calcFirstLastLivePlane(int plane, std::bitset< 14 > binary)
double StartMinDistToBack() const
Minimum perpendicular distance of all prongs start points to the back edge of the detector...
float fShowerMinX
min x for all shower end points
float fVertexY
vertex of the interaction
float fVertexMaxW
maximum w value of the vertex
float fTrackStartZ
track starting z position
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
virtual TVector3 Dir() const
Unit vector describing prong direction.
TVector3 fTrackEarliestHitPos
position (cm) or track's earliest hit in time
Near Detector in the NuMI cavern.
float fSliceClosestEdge
0:-x, 1:+x, 2:-y or 3:+y
float fShowerDirX
direction of the primary shower in slice
friend std::ostream & operator<<(std::ostream &o, ParametersNumu const &p)
float fTrackStartTime
track starting (ns)
float fCosRejKalSpeed
inverse speed of the timing fit of the kalman track
float fCVNVal
value of the CVN PID
float fShowerVertexY
vertex of the primary shower
float fNumShowers
number of showers in slice
float fCosRejKalYPosAtTrans
just what it looks like
std::vector< std::string > comps
double StartMinDistToWest() const
Minimum perpendicular distance of all prongs start points to the west edge of the detector (west is p...
float fShowerVtxDist
distance between the shower vertex and interaction vertex
TVector3 fCosmicTrackLatestHitPos
double StopMinDistToFront() const
Minimum perpendicular distance of all prongs stop points to the front edge of the detector...
float fNDHadronicCal
hadronic energy in the ND
float fShowerEndZ
end of the primary shower
float fShowerMinVtxZ
minimum Z position of all showers
float NDHadCalTran() const
double StartMinDistToFront() const
Minimum perpendicular distance of all prongs start points to the front edge of the detector...
TVector3 fCosmicTrackEarliestHitPos
static float min(const float a, const float b, const float c)
unsigned int NYCell() const
Number of cells in the y-view.
unsigned int MinPlane(geo::View_t view=geo::kXorY) const
float fShowerCalE
calorimetric energy in primary shower in slice
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.
TVector3 fCosmicTrackStart
void Compare(NumuCutParameters const &compCuts)
float fSliceContigPlanes
contiguous planes in slice
Result, basic output of CVN neural net.
const int kNumCVNFinalStates
float fOtherTrackMaxEndZ
maximum Z position of non Best-RemID tracks
A container for energy information.
double ProngTransMom() const
Transverse component of the energy-weighted average of prong directions.
float fCosRejCosDirScore
difference between hough scores for timing fits of the cosmic track going forward and backwards ...
float fQePIDVal
value of QePId parameter
float fShowerMaxEndZ
maximum Z position of all showers
unsigned int NXCell() const
Number of cells in the x-view.
float fProngLength
length of largest prong in slice
int MostContiguousPlanes(geo::View_t view) const
Longest run of adjacent planes with hits.
float fTrackCCE
track CC energy
float fBestPIDTrack
track with the best PID
float fCosRejKalBakCellND
TVector3 fCosmicTrackStop
TVector3 fTrackStart
track starting position (cm)
double TotalGeV(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple sum of the estimated GeV of all the hits.
float fQePIDNTracks
number of tracks for QePID
float fCosRejKalFwdCell
just what it looks like
unsigned int MaxPlane(geo::View_t view=geo::kXorY) const
float fDistAllWest
distance of all showers in slice from the west edge of detector
const CVNFinalState cvnStates[kNumCVNFinalStates]
float fShowerVertexX
vertex of the primary shower
NumuCutParameters fParameters
the relevant parameters to cut on for a numu selection
#define LOG_VERBATIM(category)
float fShowerNumYCell
number of y cells in slice
unsigned int NPlanes() const
float fSliceMinPlane
minimum plane of the slice
double StopMinDistToBack() const
Minimum perpendicular distance of all prongs stop points to the back edge of the detector.
T min(const caf::Proxy< T > &a, T b)
TVector3 Stop() const
Position of the final trajectory point.
int GoodDiBlockMask(int subrun=-1, bool reload=false)
virtual ~ParametersNumu()
float fCosTrackTotalCalorimetricEnergy
std::pair< TVector3, TVector3 > EarliestLatestHitPos(rb::Track const &track, bool cosmictrack)
float fShowerPt
shower transverse momentum
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
int fCosTrackNHitsNearEdge[10]
int fSliceNHitsNearEdge[10]
fSliceNHitsNearEdge[i] = Number of hits within i cells of the x or y edges
float NDHadCalCat() const
float fShowerDirZ
direction of the primary shower in slice
double fReMIdVal
value of ReMId parameter
Encapsulate the geometry of one entire detector (near, far, ndos)
fvar< T > ceil(const fvar< T > &x)
float fShowerTotalE
TotalE energy in primary shower in slice.
float fShowerMaxX
max x for all shower end points
float fShowerVertexZ
vertex of the primary shower
float fShowerDirY
direction of the primary shower in slice
float fPlanesToBack
number of planes to the back of the detector