6 #include "cetlib_except/exception.h" 8 #include "NovaDAQConventions/DAQConventions.h" 49 <<
" is not recognized";
56 std::vector<long> & binMap,
67 for(
auto const& dbsItr : detBeamSelSet){
68 for(
auto const& selItr : dbsItr.Selections() ){
85 for(
int b = offset;
b < bins +
offset; ++
b){
86 binMap.emplace_back(key);
92 << offsetMap.find(key)->second
109 std::map<double, int> ebMap;
110 for (
size_t i = 0;
i < vec.size(); ++
i)
111 ebMap[vec.at(
i)] =
i;
202 <<
"Fill All Selection Offset and Bin maps";
209 <<
"Fill run time Selection Offset and Bin maps";
218 <<
" bins for analysis out of a possible " 248 std::map<int, double> & selectionBinToEnergy,
252 double lowerBound = lowestBound;
253 for(
auto const& itr : selectionHighEdges){
254 selectionBinToEnergy[itr.second] = lowerBound + (itr.first - lowerBound) * 0.5;
257 <<
"FillBinToEnergyMap energy " 262 << selectionBinToEnergy.find(itr.second)->second;
264 lowerBound = itr.first;
334 <<
" there are numu (each quartile): " 340 <<
" nue peripheral: " 346 <<
" total bins for all selections: " 348 <<
" total bins for run time selections: " 434 std::vector<double> &
bins)
436 std::vector<double> tmpbins;
440 for(
auto const& itr : highEdgeMap) tmpbins.push_back(itr.first);
455 std::map<long, int>
const& offsetMap)
458 if(offsetMap.count(key) < 1)
460 <<
"could not find offset in map for key " 469 return offsetMap.find(key)->second;
485 auto const& itr = edgeMap.upper_bound(energy);
486 if(itr != edgeMap.end())
return itr->second;
559 auto const btoEItr = binToEnergy.find(bin - offset);
561 if(btoEItr == binToEnergy.end())
569 <<
" is not in bin to energy map for key " 584 return btoEItr->second;
590 std::vector<int> emptyBins;
592 for (
int i = 0;
i < mat.GetNrows();
i++){
597 for (
int j = 0;
j < mat.GetNcols();
j++)
601 emptyBins.push_back(
i);
610 int nRowsAndColumns = mat.GetNcols() - emptyBins.size();
611 TMatrixD compactMatrix(nRowsAndColumns, nRowsAndColumns);
612 TMatrixD semiCompactMatrix(nRowsAndColumns, mat.GetNcols());
616 for (
int i = 0;
i < nRowsAndColumns; ++
i){
618 bool isXEmptyBin =
false;
619 for (
size_t ieb = 0; ieb < emptyBins.size(); ++ieb){
620 if (emptyBins.at(ieb) == itest)
624 for (
int j = 0;
j < mat.GetNcols(); ++
j){
625 semiCompactMatrix(
i,
j) =
mat(itest,
j);
637 for (
int j = 0;
j < nRowsAndColumns; ++
j){
639 bool isYEmptyBin =
false;
640 for (
size_t ieb = 0; ieb < emptyBins.size(); ++ieb){
641 if (emptyBins.at(ieb) == jtest)
645 for (
int i = 0;
i < semiCompactMatrix.GetNrows(); ++
i){
646 compactMatrix(
i,
j) = semiCompactMatrix(
i, jtest);
656 return compactMatrix;
#define LOG_DEBUG(stream)
std::map< int, double > const & SelectionBinToEnergy(long key)
std::vector< int > EmptyBins(TMatrixD mat)
std::map< double, int > const & NuMuHighEdges()
int KeyToOffset(long const &key, bool allSels=false)
std::map< double, int > fNuMuHighEdges
high side of the numu bins
void SelectionHistBinning(cmf::MetaData const &md, std::vector< double > &bins)
std::map< double, int > fNCHighEdges
high side of the nc bins
const std::string cSelectionType_Strings[12]
double fNuEFDLowEdge
low side of the first nune bin in FD
double fNuMuLowEdge
low side of the first numu bin
double const & SelectionLowEdge(cmf::MetaData const &md)
static long DetectorBeamSelectionTypesToKey(cmf::DetType_t const &det, cmf::BeamType_t const &bt, cmf::SelectionType_t const &sel)
static SelectionUtility * Instance()
void FillOffsetAndBinMaps(std::map< long, int > &offsetMap, std::vector< long > &binMap, cmf::SelectionUtility::DetBeamSelSet const &detBeamSelSet)
TMatrixD CompactMatrix(TMatrixD mat, std::vector< int > emptyBins)
enum cmf::det_type DetType_t
::xsd::cxx::tree::exception< char > exception
long BinToKey(int const &bin, bool allSels=false)
std::map< int, double > fNuEPeriphBinToEnergy
map energy bin to central value
std::map< int, double > fNuMuBinToEnergy
map energy bin to central value
void SetBinning(fhicl::ParameterSet const &fBinConfig, cmf::SelectionType_t const &selType)
static cmf::BeamType_t KeyToBeamType(long const &key)
enum cmf::sel_type SelectionType_t
std::map< double, int > EnergyBinMap(std::vector< double > const &vec)
static bool IsNuESelected(cmf::SelectionType_t const &sel)
double fNCNDLowEdge
low side of the first nc bin in ND
std::vector< long > fAllSelsBinToKey
map bin numbers to keys for different samples
std::map< int, double > fNCNDBinToEnergy
map energy bin to central value (2020ana)
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
int EnergyToBin(double const &energy, cmf::MetaData const &md)
double BinToEnergy(int const &bin, bool allSels=false)
static bool IsNuMuSelected(cmf::SelectionType_t const &sel)
std::map< double, int > fNuEPeriphHighEdges
high side of the nue bins in FD
std::map< double, int > fNCFDHighEdges
high side of the nc bins in FD (2020ana)
std::vector< long > fBinToKey
map bin numbers to keys for different samples
static cmf::DetType_t KeyToDetectorType(long const &key)
T get(std::string const &key) const
std::map< double, int > fNuEFDHighEdges
high side of the nue bins in FD
cmf::SelectionType_t BinToSelection(int const &bin, bool allSels=false)
std::map< double, int > fNuENDHighEdges
high side of the nue bins in ND
void Initialize(fhicl::ParameterSet const &pset)
static CovarianceBinUtility * gCovBinUtil
std::map< double, int > const & NCHighEdges(cmf::DetType_t const &det)
std::map< long, int > fAllSelsOffsetMap
map of keys to offset for different samples
std::map< int, double > fNuENDBinToEnergy
map energy bin to central value
double fNuEPeriphLowEdge
low side of the first nue bin in FD
size_t TotalBins(bool allSels=false)
std::map< long, int > fOffsetMap
map of keys to offset for different samples
Module to combine a set of results into a single file currently only does one data product type at a ...
double const & NuELowEdge(cmf::MetaData const &md)
std::map< double, int > const & SelectionHighEdges(cmf::MetaData const &md)
double const & NCLowEdge(cmf::DetType_t const &det)
std::map< int, double > fNuEFDBinToEnergy
map energy bin to central value
std::map< int, double > fNCFDBinToEnergy
map energy bin to central value (2020ana)
double const & NuMuLowEdge()
std::map< double, int > fNCNDHighEdges
high side of the nc bins in ND (2020ana)
cmf::DetType_t BinToDetector(int const &bin, bool allSels=false)
enum cmf::beam_type BeamType_t
static cmf::SelectionType_t KeyToSelectionType(long const &key)
int EnergyToHistogramBin(double const &energy, cmf::MetaData const &md)
static void FillBinToEnergyMap(std::map< double, int > const &selectionHighEdges, std::map< int, double > &selectionBinToEnergy, double lowestBound)
#define LOG_VERBATIM(category)
double fNuENDLowEdge
low side of the first nue bin in ND
std::set< cmf::SelectionUtility::DetBeamSels > DetBeamSelSet
const std::string cDetType_Strings[5]
double fNCFDLowEdge
low side of the first nc bin in FD
const std::string cBeamType_Strings[4]
std::map< double, int > const & NuEHighEdges(cmf::DetType_t const &det)
int NumSelectionBins(cmf::SelectionType_t const &selType, cmf::DetType_t const &detType)
cmf::BeamType_t BinToBeamType(int const &bin, bool allSels=false)
static std::string KeyToString(long const &key)
static CovarianceBinUtility * Instance()