Public Types | Public Member Functions | Public Attributes | List of all members
fnex::CalibSyst Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/FNEX/core/ShifterAndWeighter.h"

Public Types

enum  { kND, kFD, kNumDets }
 
enum  { kFHC, kRHC, kNumCurrents }
 
enum  { kNueSel, kNumuSel, kNumSels }
 
enum  {
  kQ1, kQ2, kQ3, kQ4,
  kNumQuantiles
}
 
enum  { kMinus, kPlus, kNumSigns }
 
enum  {
  kNumu, kAntiNumu, kNue, kAntiNue,
  kNC, kNumInteractions
}
 

Public Member Functions

 CalibSyst ()
 
void LoadCalibSystHists (std::string CalibFilename)
 
void Load2018CalibSystHists (std::string CalibFilename)
 
std::map< float, float > CalcCalibSystWeights (std::string const &systName, fnex::MetaData currentMD, double trueE)
 

Public Attributes

std::map< std::string, std::vector< std::vector< std::vector< std::vector< std::vector< TH1D * > > > > > > fCalibSystHists
 

Detailed Description

Definition at line 58 of file ShifterAndWeighter.h.

Member Enumeration Documentation

anonymous enum
Enumerator
kND 
kFD 
kNumDets 

Definition at line 70 of file ShifterAndWeighter.h.

anonymous enum
anonymous enum
anonymous enum
anonymous enum
anonymous enum

Constructor & Destructor Documentation

fnex::CalibSyst::CalibSyst ( )

Definition at line 1330 of file ShifterAndWeighter.cxx.

1331  {
1332  //Default constructor, may need to zero some things
1333  }

Member Function Documentation

std::map< float, float > fnex::CalibSyst::CalcCalibSystWeights ( std::string const &  systName,
fnex::MetaData  currentMD,
double  trueE 
)

Definition at line 1697 of file ShifterAndWeighter.cxx.

References fnex::MetaData::BeamType(), fnex::cSelectionType_Strings, febshutoff_auto::curr, fnex::ShifterAndWeighter::fCalibSystHists, GetXaxis(), fnex::MetaData::interactionType, fnex::MetaData::IsNuESelected(), fnex::MetaData::IsNuMuSelected(), ana::DecompType::kAntiNue, ana::DecompType::kAntiNumu, fnex::kCosmicMuon, fnex::kFHC, fnex::kNC, fc::kNue, fnex::kNuEBarCC, fnex::kNuECC, fnex::kNuESelectionHighPID, fnex::kNuESelectionLowPID, fnex::kNuESelectionMidPID, fnex::kNuESelectionPeripheral, fc::kNumu, fnex::kNuMuBarCC, fnex::kNuMuCC, fnex::kNuMuSelectionQ1, fnex::kNuMuSelectionQ2, fnex::kNuMuSelectionQ3, fnex::kNuMuSelectionQ4, fnex::kNuTauBarCC, fnex::kNuTauCC, ana::covmx::kQ1, ana::covmx::kQ2, ana::covmx::kQ3, ana::covmx::kQ4, fnex::kRHC, LOG_DEBUG, LOG_WARNING, scale, fnex::MetaData::selectionType, and canMan::sign().

Referenced by fnex::ShifterAndWeighter::CalibSystWeight().

1700  {
1701  //FHC or RHC?
1702  int curr = currentMD.BeamType();
1703  //if it's an unknown beam type, default to using FHC
1704  if(curr > kRHC) curr = kFHC;
1705  LOG_DEBUG("ShifterAndWeighter")
1706  <<"Starting to CalcCalibSystWeights for "
1707  << systName
1708  << ", "
1709  << curr;
1710 
1711  // Need different histogram per detector, don't bother doing
1712  // anything if we have a bogus detector
1713  // int det = currentMD.detector;
1714  // if(det != novadaq::cnv::kNEARDET && det != novadaq::cnv::kFARDET) {
1715  // LOG_DEBUG("CalibSystFileError")
1716  // << "Wrong detector; ignore";
1717  // return { {-1.0, 1.0}, {0.0, 1.0}, {1.0, 1.0} };
1718  // }
1719  // else if(det == novadaq::cnv::kNEARDET) det = kND;
1720  // else if(det == novadaq::cnv::kFARDET ) det = kFD;
1721  // LOG_DEBUG("ShifterAndWeighter")
1722  // << "Detector " << det;
1723 
1724  // Need different histograms based on selection
1725  int sel = 0;
1726  int subsel = -999.;//quantile or cvn
1727  if(currentMD.IsNuMuSelected()){
1728  sel = kNumuSel;
1729  // find which quantile this event is in
1730  if (currentMD.selectionType == fnex::kNuMuSelectionQ1) subsel = kQ1;
1731  else if(currentMD.selectionType == fnex::kNuMuSelectionQ2) subsel = kQ2;
1732  else if(currentMD.selectionType == fnex::kNuMuSelectionQ3) subsel = kQ3;
1733  else if(currentMD.selectionType == fnex::kNuMuSelectionQ4) subsel = kQ4;
1734  else {
1735  LOG_DEBUG("CalibSystFileError")
1736  << "Selection type "
1738  << " is not a quantile; ignore";
1739  return {{-1.0, 1.0},
1740  {0.0, 1.0},
1741  {1.0, 1.0}};
1742  }
1743  }
1744  else if(currentMD.IsNuESelected()){
1745  sel = kNueSel;
1746  // find which cvn bin this event is in
1747  if (currentMD.selectionType == fnex::kNuESelectionLowPID) subsel = kQ1;
1748  else if(currentMD.selectionType == fnex::kNuESelectionMidPID) subsel = kQ2;
1749  else if(currentMD.selectionType == fnex::kNuESelectionHighPID) subsel = kQ3;
1750  else if(currentMD.selectionType == fnex::kNuESelectionPeripheral) subsel = kQ4;
1751  else {
1752  LOG_DEBUG("CalibSystFileError")
1753  << "Selection type "
1755  << " is not a CVN bin; ignore";
1756  return {{-1.0, 1.0},
1757  {0.0, 1.0},
1758  {1.0, 1.0}};
1759  }
1760 
1761  }
1762 
1763  // if it's any of the interactions we're not interested in then just return 1
1764  int interaction = currentMD.interactionType;
1765  if(interaction == fnex::kCosmicMuon ||
1766  interaction == fnex::kNuTauCC ||
1767  interaction == fnex::kNuTauBarCC )
1768  return { {-1.0, 1.0}, {0.0, 1.0}, {1.0, 1.0} };
1769  else if(interaction == fnex::kNuMuCC ) interaction = kNumu;
1770  else if(interaction == fnex::kNuMuBarCC) interaction = kAntiNumu;
1771  else if(interaction == fnex::kNuECC ) interaction = kNue;
1772  else if(interaction == fnex::kNuEBarCC ) interaction = kAntiNue;
1773  else if(interaction == fnex::kNC ) interaction = kNC;
1774  else {
1775  LOG_DEBUG("CalibSystFileError")
1776  << "Not expecting interaction type"
1777  << interaction
1778  << ", so we're ignoring it.";
1779  return { {-1.0, 1.0}, {0.0, 1.0}, {1.0, 1.0} };
1780  }
1781 
1782  // there are no NC histograms for CalibrationShape with the
1783  // nue selection so if we have that combination, just return
1784  // no change
1785  if(sel == kNueSel &&
1786  interaction == kNC &&
1787  systName == "CalibShape")
1788  return { {-1.0, 1.0}, {0.0, 1.0}, {1.0, 1.0} };
1789 
1790  // find the right histogram for the detector and sign
1791  double scale[2] = {1, 1};
1792  TH1D* hPlusMinus[2] = {0, 0};
1793 
1794  int sign = kPlus;
1795  while(sign >= kMinus){
1796 
1797  // cherenkov and calibshape only have histograms for +1 sigma
1798  if(sign == kMinus && (systName == "Cherenkov" || systName == "CalibShape")) {
1799  scale[sign] = 1.0;
1800  break;
1801  }
1802 
1803  LOG_DEBUG("ShifterAndWeighter")
1804  << "Looking for fCalibSystHists[" << systName
1805  << "][" << curr
1806  << "][" << sel
1807  << "][" << subsel
1808  << "][" << sign
1809  << "][" << interaction
1810  << "]";
1811  hPlusMinus[sign] = fCalibSystHists.find(systName)->second[curr][sel][subsel][sign][interaction];
1812 
1813  if(hPlusMinus[sign] == 0){
1814  LOG_WARNING("CalibSystFileError")
1815  << ": Can't find desired histogram for sign: "
1816  << sign
1817  << " systematic: "
1818  << systName
1819  << "[" << curr
1820  << "][" << sel
1821  << "][" << subsel
1822  << "][" << sign
1823  << "][" << interaction
1824  << "], ignore";
1825  // return { {-1.0, 1.0}, {0.0, 1.0}, {1.0, 1.0} };
1826  scale[sign] = 1.0;
1827  }
1828 
1829  //Only use weights if the energy is in the range of the histogram
1830  else if (trueE > hPlusMinus[sign]->GetXaxis()->GetXmin() &&
1831  trueE < hPlusMinus[sign]->GetXaxis()->GetXmax() ){
1832  scale[sign] = hPlusMinus[sign]->Interpolate(trueE);
1833 
1834  // assume a scale of 0 really means that there just
1835  // isn't a change to be applied
1836  if(scale[sign] == 0.) scale[sign] = 1.;
1837  }
1838  --sign;
1839  }
1840  LOG_DEBUG("ShifterAndWeighter")
1841  << "Neg scale: " << scale[kMinus]
1842  << "\t Pos scale: " << scale[kPlus];
1843 
1844  // Only want light level systematic to be one-sided but don't want to totally
1845  // restructure code since minus > plus for it
1846  if(systName == "LightLevel") {
1847  scale[kPlus] = scale[kMinus];
1848  scale[kMinus] = 1.0;
1849  }
1850 
1851  return { {-1.0, scale[kMinus]}, {0.0, 1.0}, {1.0, scale[kPlus]} };
1852  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
bool IsNuESelected() const
Definition: Structs.cxx:265
bool IsNuMuSelected() const
Definition: Structs.cxx:256
std::map< std::string, std::vector< std::vector< std::vector< std::vector< std::vector< TH1D * > > > > > > fCalibSystHists
Double_t scale
Definition: plot.C:25
correl_xv GetXaxis() -> SetDecimals()
#define LOG_WARNING(category)
fnex::SelectionType_t selectionType
Definition: Structs.h:52
fnex::InteractionType_t interactionType
Definition: Structs.h:53
fnex::BeamType_t const BeamType() const
Definition: Structs.cxx:165
const std::string cSelectionType_Strings[11]
Definition: Constants.h:101
def sign(x)
Definition: canMan.py:197
void fnex::CalibSyst::Load2018CalibSystHists ( std::string  CalibFilename)

Definition at line 1504 of file ShifterAndWeighter.cxx.

References plot_validation_datamc::c, febshutoff_auto::curr, dir, dirName, fnex::ShifterAndWeighter::fCalibSystHists, fin, cet::search_path::find_file(), analysePickle::hist, compareCafs::histName, ana::DecompType::kAntiNue, ana::DecompType::kAntiNumu, fnex::kFHC, fnex::kNC, fc::kNue, kNumQuantiles, ana::kNumSels, fc::kNumu, ana::covmx::kQ1, ana::covmx::kQ2, ana::covmx::kQ3, ana::covmx::kQ4, fnex::kRHC, LOG_DEBUG, LOG_VERBATIM, canMan::sign(), string, and systNames.

Referenced by fnex::ShifterAndWeighter::LoadCalibrationSystHists().

1505  {
1506  // Someone already called us
1507  if(!fCalibSystHists.empty()) return;
1508 
1509  LOG_VERBATIM("ShifterAndWeighter")
1510  << "Load2018CalibSystHists";
1511 
1512  std::string fileCalib;
1513  // std::string tempfileCalib;
1514  // tempfileCalib = CalibFilename;
1515 
1516  LOG_DEBUG("ShifterAndWeighter")
1517  << "Looking for calib syst file "
1518  << CalibFilename;
1519 
1520  cet::search_path sp("FW_SEARCH_PATH");
1521  if(!sp.find_file(CalibFilename, fileCalib)){
1522  throw cet::exception("CalibSystematicFileError")
1523  << "Cannot find calib systematics file "
1524  << CalibFilename
1525  << " bail ungracefully\n\n"
1526  << __FILE__ << ":" << __LINE__;
1527  }
1528 
1529  LOG_DEBUG("ShifterAndWeighter")
1530  << "Found "
1531  << CalibFilename
1532  << " as "
1533  << fileCalib;
1534 
1535  TFile fin(fileCalib.c_str(), "read");
1536  if(fin.IsZombie()){
1537  throw cet::exception("Weighters")
1538  << "Warning: couldn't open "
1539  << fileCalib
1540  << ". Crashing";
1541  }
1542 
1543  LOG_DEBUG("ShifterAndWeighter")
1544  << "Opened file, apparently";
1545 
1546  //Check that desired systematic is in file
1547  // Loop through the detector folder, over all histograms
1548  TIter iterDir(gDirectory->GetListOfKeys());
1549  TKey *keyDir;
1550  TKey *keySystDir;
1551 
1552  std::vector <std::string> systNames{"CalibShape",
1553  "LightLevel",
1554  "Cherenkov",
1555  "AbsCalibration",
1556  "RelCalibration"};
1557 
1558  for(auto systName : systNames){
1559  LOG_DEBUG("ShifterAndWeighter")
1560  << "systName = " << systName
1561  << ", kNumCurrents = " << kNumCurrents
1562  << ", kNumSels = " << kNumSels
1563  << ", kNumQuantiles = " << kNumQuantiles
1564  << ", kNumSigns = " << kNumSigns
1565  << ", kNumInteractions = " << kNumInteractions;
1566  //resize to fhc/rhc
1567  fCalibSystHists[systName].resize(kNumCurrents);
1568  //resize to nue/numu selection
1569  for(size_t c = 0; c < fCalibSystHists[systName].size(); ++c){
1570  fCalibSystHists[systName][c].resize(kNumSels);
1571  //resize to quantile OR low/mid/high/peri cvn
1572  for(size_t s = 0; s < fCalibSystHists[systName][c].size(); ++s){
1573  fCalibSystHists[systName][c][s].resize(kNumQuantiles);
1574  //resize to positive/negative sigma shift
1575  for(size_t q = 0; q < fCalibSystHists[systName][c][s].size(); ++q){
1576  fCalibSystHists[systName][c][s][q].resize(kNumSigns);
1577  //resize to number of different true interactions
1578  for(size_t pm = 0; pm < fCalibSystHists[systName][c][s][q].size(); ++pm){
1579  fCalibSystHists[systName][c][s][q][pm].resize(kNumInteractions);
1580  }
1581  }
1582  }
1583  }
1584  }
1585 
1586  //will loop over numuFHC, numuRHC, nueFHC, nueRHC
1587  while((keyDir = (TKey *) iterDir())){
1588  TString dirName = keyDir->GetName(); // Get directory name
1589  LOG_DEBUG("ShifterAndWeighter")
1590  << "Looking in directory " << dirName;
1591  TDirectory *dir = fin.GetDirectory(dirName);
1592  TIter iterSystDir(dir->GetListOfKeys());
1593 
1594  while((keySystDir = (TKey *) iterSystDir())){
1595  TString systDirName = keySystDir->GetName(); // Get directory name
1596  LOG_DEBUG("ShifterAndWeighter")
1597  << "\tin subdirectory "
1598  << systDirName;
1599 
1600  for(auto systName : systNames){
1601  LOG_DEBUG("ShifterAndWeighter")
1602  << "\tlooking for syst "
1603  << systName;
1604  if(systDirName.Contains(systName)){ //is it the desired syst
1605  LOG_DEBUG("ShifterAndWeighter")
1606  << "\tFound " << systName;
1607  TDirectory *systDir = dir->GetDirectory(systDirName);
1608  LOG_DEBUG("ShifterAndWeighter")
1609  << "\tGot directory " << systDirName;
1610  TIter iterHist(systDir->GetListOfKeys());
1611  TKey *keyHist;
1612 
1613  while((keyHist = (TKey *) iterHist())){
1614  TString histName = keyHist->GetName();
1615  LOG_DEBUG("ShifterAndWeighter")
1616  << "histName is "
1617  << histName;
1618 
1619  // int det = 0;
1620  // if(histName.Contains("ND")) det = kND;
1621  // if(histName.Contains("FD")) det = kFD;
1622 
1623  int curr = 0;
1624  if(dirName.Contains("FHC")) curr = kFHC;
1625  if(dirName.Contains("RHC")) curr = kRHC;
1626 
1627  int sel = 0;
1628  if(dirName.Contains("Nue")) sel = kNueSel;
1629  if(dirName.Contains("Numu")) sel = kNumuSel;
1630 
1631  int quant = 0;
1632  //numu quantiles
1633  if(histName.Contains("quant1")) quant = kQ1;
1634  if(histName.Contains("quant2")) quant = kQ2;
1635  if(histName.Contains("quant3")) quant = kQ3;
1636  if(histName.Contains("quant4")) quant = kQ4;
1637  //nue cvn bins
1638  if(histName.Contains("Low")) quant = kQ1;
1639  if(histName.Contains("Mid")) quant = kQ2;
1640  if(histName.Contains("High")) quant = kQ3;
1641  if(histName.Contains("Peripheral")) quant = kQ4;
1642 
1643  int sign = 0;
1644  if(histName.Contains("minus")) sign = kMinus;
1645  if(histName.Contains("plus")) sign = kPlus;
1646 
1647  int interaction = 0;
1648  if(histName.Contains("numuCC")) interaction = kNumu;
1649  if(histName.Contains("nueCC")) interaction = kNue;
1650  if(histName.Contains("anumuCC")) interaction = kAntiNumu;
1651  if(histName.Contains("anueCC")) interaction = kAntiNue;
1652  if(histName.Contains("NC")) interaction = kNC;
1653 
1654  LOG_DEBUG("ShifterAndWeighter")
1655  << "Get histogram " << histName;
1656  // grab the histogram
1657  TH1D *hist = (TH1D *) systDir->Get(histName)->Clone();
1658 
1659  if(hist){
1660  // disassociate histogram from file
1661  hist->SetDirectory(0);
1662  //store relevant histograms
1663  LOG_DEBUG("ShifterAndWeighter")
1664  << "Store as fCalibSystHists "
1665  << systName
1666  << ", "
1667  << curr
1668  << ", "
1669  << sel
1670  << ", "
1671  << quant
1672  << ", "
1673  << sign
1674  << ", "
1675  << interaction;
1676 
1677  fCalibSystHists[systName][curr][sel][quant][sign][interaction] = hist;
1678  LOG_DEBUG("ShifterAndWeighter")
1679  << "Stored";
1680  }
1681  else{
1682  throw cet::exception("Weighters")
1683  << "Calibration systematic histogram "
1684  << histName
1685  << " doesn't seem to exist. Oh no.";
1686  } // end if statement checking histogram exists
1687  } // end loop through histograms in dir
1688  } // end check of hist name for syst
1689  } // end loop thru syst names
1690  } // end while loop through syst directories
1691  }//end while loop through syst directories
1692 
1693  LOG_DEBUG("CalibSyst") << "Calib histograms loaded!";
1694  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
TString fin
Definition: Style.C:24
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< std::string, std::vector< std::vector< std::vector< std::vector< std::vector< TH1D * > > > > > > fCalibSystHists
const XML_Char * s
Definition: expat.h:262
std::string dirName
Definition: PlotSpectra.h:47
TDirectory * dir
Definition: macro.C:5
std::map< std::string, std::string > systNames
Definition: PlotUnfolding.C:32
#define LOG_VERBATIM(category)
def sign(x)
Definition: canMan.py:197
enum BeamMode string
void fnex::CalibSyst::LoadCalibSystHists ( std::string  CalibFilename)

Definition at line 1336 of file ShifterAndWeighter.cxx.

References febshutoff_auto::curr, d, fillBadChanDBTables::det, dir, dirName, fnex::ShifterAndWeighter::fCalibSystHists, fin, cet::search_path::find_file(), analysePickle::hist, compareCafs::histName, ana::DecompType::kAntiNue, ana::DecompType::kAntiNumu, fnex::kNC, fc::kNue, kNumQuantiles, fc::kNumu, ana::covmx::kQ1, ana::covmx::kQ2, ana::covmx::kQ3, ana::covmx::kQ4, LOG_DEBUG, LOG_VERBATIM, canMan::sign(), string, and systNames.

1337  {
1338  // Someone already called us
1339  if(!fCalibSystHists.empty()) return;
1340 
1341  LOG_DEBUG("ShifterAndWeighter")
1342  << "LoadCalibSystHists";
1343 
1344  //const std::string kCalibSystFile = "FNEX/data/calibration/CalibrationSystematics2017.root";
1345 
1346  //loop over FHC and RHC
1347  for (int curr = 0; curr < kNumCurrents; ++curr){
1348 
1349  std::string fileCalib;
1350  std::string tempfileCalib;
1351  // if(curr == kFHC)
1352  tempfileCalib = CalibFilename;
1353 
1354  LOG_DEBUG("ShifterAndWeighter")
1355  << "curr = " << curr
1356  << ". Looking for file "
1357  << tempfileCalib;
1358 
1359  cet::search_path sp("FW_SEARCH_PATH");
1360  if(!sp.find_file(tempfileCalib, fileCalib)){
1361  throw cet::exception("CalibSystematicFileError")
1362  << "Cannot find calib systematics file "
1363  << tempfileCalib
1364  << " bail ungracefully\n\n"
1365  << __FILE__ << ":" << __LINE__;
1366  }
1367 
1368  LOG_DEBUG("ShifterAndWeighter")
1369  << "Found "
1370  << tempfileCalib
1371  << " as "
1372  << fileCalib;
1373 
1374  TFile fin(fileCalib.c_str(), "read");
1375  if(fin.IsZombie()){
1376  throw cet::exception("Weighters")
1377  << "Warning: couldn't open "
1378  << fileCalib
1379  << ". Crashing";
1380  }
1381 
1382  LOG_DEBUG("ShifterAndWeighter")
1383  << "Opened file, apparently";
1384 
1385  //Check that desired systematic is in file
1386  // Loop through the detector folder, over all histograms
1387  TIter iterDir(gDirectory->GetListOfKeys());
1388  TKey *keyDir;
1389 
1390  std::vector <std::string> systNames{"CalibShape",
1391  "LightLevel",
1392  "Cherenkov",
1393  "AbsCalibration",
1394  "RelCalibration"};
1395 
1396  for(auto systName : systNames){
1397  LOG_DEBUG("ShifterAndWeighter")
1398  << "systName = " << systName
1399  << ", kNumCurrents = " << kNumCurrents
1400  << ", kNumDets = " << kNumDets
1401  << ", kNumQuantiles = " << kNumQuantiles
1402  << ", kNumSigns = " << kNumSigns
1403  << ", kNumInteractions = " << kNumInteractions;
1404  fCalibSystHists[systName].resize(kNumCurrents);
1405  fCalibSystHists[systName][curr].resize(kNumDets);
1406  for(size_t d = 0; d < fCalibSystHists[systName][curr].size(); ++d){
1407  fCalibSystHists[systName][curr][d].resize(kNumQuantiles);
1408  for(size_t q = 0; q < fCalibSystHists[systName][curr][d].size(); ++q){
1409  fCalibSystHists[systName][curr][d][q].resize(kNumSigns);
1410  for(size_t pm = 0; pm < fCalibSystHists[systName][curr][d][q].size(); ++pm){
1411  fCalibSystHists[systName][curr][d][q][pm].resize(kNumInteractions);
1412  }
1413  }
1414  }
1415  }
1416 
1417  while((keyDir = (TKey *) iterDir())){
1418  TString dirName = keyDir->GetName(); // Get directory name
1419  LOG_DEBUG("ShifterAndWeighter")
1420  << "Looking in directory " << dirName;
1421  // for(auto systName : systNames) {
1422  // if(dirName.Contains(systName)){ //is it the desired syst
1423  TDirectory *dir = fin.GetDirectory(dirName);
1424  TIter iterSystDir(dir->GetListOfKeys());
1425  TKey *keySystDir;
1426  while((keySystDir = (TKey *) iterSystDir())){
1427  TString systDirName = keySystDir->GetName();
1428  LOG_DEBUG("ShifterAndWeighter")
1429  << "\tLooking in directory " << systDirName;
1430  TDirectory *systDir = dir->GetDirectory(systDirName);
1431  for(auto systName : systNames){
1432  if(systDirName.Contains(systName)){
1433  TIter iterHist(systDir->GetListOfKeys());
1434  TKey *keyHist;
1435 
1436  while((keyHist = (TKey *) iterHist())){
1437  TString histName = keyHist->GetName();
1438  LOG_DEBUG("ShifterAndWeighter")
1439  << "histName is " << histName;
1440 
1441  int det = 0;
1442  if(histName.Contains("ND")) det = kND;
1443  if(histName.Contains("FD")) det = kFD;
1444 
1445  int sign = 0;
1446  if(histName.Contains("minus")) sign = kMinus;
1447  if(histName.Contains("plus")) sign = kPlus;
1448 
1449  int quant = 0;
1450  if(histName.Contains("quant1")) quant = kQ1;
1451  if(histName.Contains("quant2")) quant = kQ2;
1452  if(histName.Contains("quant3")) quant = kQ3;
1453  if(histName.Contains("quant4")) quant = kQ4;
1454 
1455  int interaction = 0;
1456  if(histName.Contains("numuCC") ) interaction = kNumu;
1457  if(histName.Contains("nueCC") ) interaction = kNue;
1458  if(histName.Contains("anumuCC")) interaction = kAntiNumu;
1459  if(histName.Contains("anueCC") ) interaction = kAntiNue;
1460  if(histName.Contains("NC") ) interaction = kNC;
1461 
1462  LOG_DEBUG("ShifterAndWeighter")
1463  << "Get histogram " << histName;
1464  // grab the histogram
1465  TH1D *hist = (TH1D *) dir->Get(histName)->Clone();
1466 
1467  if(hist){
1468  // disassociate histogram from file
1469  hist->SetDirectory(0);
1470  //store relevant histograms
1471  LOG_DEBUG("ShifterAndWeighter")
1472  << "Store as fCalibSystHists "
1473  << systName
1474  << ", "
1475  << curr
1476  << ", "
1477  << det
1478  << ", "
1479  << quant
1480  << ", "
1481  << sign
1482  << ", "
1483  << interaction;
1484 
1485  fCalibSystHists[systName][curr][det][quant][sign][interaction] = hist;
1486  LOG_DEBUG("ShifterAndWeighter")
1487  << "Stored";
1488  }
1489  else{
1490  throw cet::exception("Weighters")
1491  << "Calibration systematic histogram "
1492  << histName
1493  << " doesn't seem to exist. Oh no.";
1494  } // end if statement checking histogram exists
1495  } // end loop through histograms in dir
1496  } // end check of hist name for syst
1497  } // end loop thru syst names
1498  } // end while loop through directories
1499  }//end loop over horn currents
1500  }
1501  LOG_VERBATIM("CalibSyst") << "Calib histograms loaded!";
1502  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
TString fin
Definition: Style.C:24
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< std::string, std::vector< std::vector< std::vector< std::vector< std::vector< TH1D * > > > > > > fCalibSystHists
Float_t d
Definition: plot.C:236
std::string dirName
Definition: PlotSpectra.h:47
TDirectory * dir
Definition: macro.C:5
std::map< std::string, std::string > systNames
Definition: PlotUnfolding.C:32
#define LOG_VERBATIM(category)
def sign(x)
Definition: canMan.py:197
enum BeamMode string

Member Data Documentation

std::map<std::string, std::vector< std::vector< std::vector< std::vector< std::vector< TH1D*> > > > > > fnex::CalibSyst::fCalibSystHists

Definition at line 68 of file ShifterAndWeighter.h.


The documentation for this class was generated from the following files: