Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
cmf::ParameterUtility Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/CovarianceMatrixFit/utilities/ParameterUtility.h"

Public Member Functions

void Initialize (fhicl::ParameterSet const &pset)
 
bool UseSysPar (std::string const &parName)
 
cmf::Parameter const & ParameterInfo (std::string const &parName)
 
cmf::Parameter const & OscParameterInfo (std::string const &parName, cmf::DetType_t const &det) const
 
cmf::Parameter const & SysParameterInfo (std::string const &parName) const
 
cmf::Location ParametersAsLocation ()
 
std::vector< std::stringSysParNames () const
 
std::vector< long > SysParKeys () const
 
size_t NumSysPars () const
 
cmf::ParameterSpaceLoc const & SysParameters () const
 

Static Public Member Functions

static ParameterUtilityInstance ()
 

Private Member Functions

 ParameterUtility ()
 
 ~ParameterUtility ()
 

Private Attributes

cmf::ParameterSpaceLoc fNDOscParameters
 values for the oscillation parameters in ND More...
 
cmf::ParameterSpaceLoc fFDOscParameters
 values for the oscillation parameters in FD More...
 
cmf::ParameterSpaceLoc fSysParameters
 values for the systematic parameters, same in both detectors More...
 

Detailed Description

Definition at line 24 of file ParameterUtility.h.

Constructor & Destructor Documentation

cmf::ParameterUtility::ParameterUtility ( )
private

Definition at line 154 of file ParameterUtility.cxx.

Referenced by Instance(), and SysParameters().

155  {
156  }
cmf::ParameterUtility::~ParameterUtility ( )
private

Referenced by SysParameters().

Member Function Documentation

void cmf::ParameterUtility::Initialize ( fhicl::ParameterSet const &  pset)

Definition at line 159 of file ParameterUtility.cxx.

References fFDOscParameters, fNDOscParameters, fSysParameters, fhicl::ParameterSet::get(), cmf::kFARDET, cmf::kNEARDET, LOG_DEBUG, LOG_VERBATIM, and cmf::ParameterSetToLocation().

Referenced by cmf::PredictionLibraryMaker::PredictionLibraryMaker(), cmf::CMFSpectraMaker::reconfigure(), cmf::CovarianceMatrixMaker::reconfigure(), cmf::RandomUniverses::reconfigure(), cmf::FitFeldmanCousinsPoint::reconfigure(), cmf::ContourFromLibrary::reconfigure(), cmf::CAFToEventList::reconfigure(), and cmf::CovarianceMatrixFitter::~CovarianceMatrixFitter().

160  {
161  // have default empty vectors for these which is what we expect if
162  // making the event lists
163  std::vector<std::string> psetNames({"OscillationParameters",
164  "SystematicParameters"});
165 
166  for(auto const& nameItr : psetNames){
167  if(nameItr.find("Systematic") != std::string::npos){
169  }
170  else if(nameItr.find("Oscillation") != std::string::npos){
173  }
174  LOG_DEBUG("ParameterUtility")
175  << nameItr
176  << " "
177  << fNDOscParameters.size()
178  << " "
179  << fFDOscParameters.size()
180  << " "
181  << fSysParameters.size();
182  } // end loop over oscillation or systematic parameter sets
183 
184  LOG_VERBATIM("cmf::CovarianceMatrixMaker")
185  << "\n-------------------------------------------------------"
186  << "\nPARAMETER SUMMARY"
187  << "\n-------------------------------------------------------"
188  << "\n\nRunning with systematic parameters set to \n";
189  for(auto const& itr : fSysParameters){
190  LOG_VERBATIM("ParameterUtility")
191  << " -- parameter: "
192  << std::setw(30)
193  << itr.first
194  << " val: "
195  << std::setw(15)
196  << itr.second.Value()
197  << " fixed: "
198  << std::setw(3)
199  << itr.second.IsFixed();
200  }
201 
202  LOG_VERBATIM("ParameterUtility")
203  << "\nRunning with oscillation parameters set to \n";
204  for(auto const& itr : fNDOscParameters){
205  LOG_VERBATIM("ParameterUtility")
206  << " -- parameter: "
207  << std::setw(30)
208  << itr.first
209  << " val ND: "
210  << std::setw(15)
211  << itr.second.Value()
212  << " val FD: "
213  << std::setw(15)
214  << fFDOscParameters.find(itr.first)->second.Value()
215  << " fixed: "
216  << std::setw(3)
217  << itr.second.IsFixed();
218  }
219 
220  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
cmf::ParameterSpaceLoc fNDOscParameters
values for the oscillation parameters in ND
cmf::ParameterSpaceLoc fFDOscParameters
values for the oscillation parameters in FD
void ParameterSetToLocation(fhicl::ParameterSet const &pset, cmf::DetType_t const &det, cmf::Location &loc)
#define LOG_VERBATIM(category)
ParameterUtility * cmf::ParameterUtility::Instance ( )
static

Definition at line 146 of file ParameterUtility.cxx.

References cmf::gParUtil, and ParameterUtility().

Referenced by cmf::ShifterAndWeighter::AbsNormWeight(), cmf::CovarianceMatrixMaker::beginJob(), cmf::RandomUniverses::beginJob(), cmf::FitFeldmanCousinsPoint::beginJob(), cmf::ShifterAndWeighter::BirksNormWeight(), cmf::ChiSqrCalculator::ChiSqrNuisance(), cmf::CMFDecorrelator::CMFDecorrelator(), cmf::ShifterAndWeighter::COHScale2018Weight(), cmf::ShifterAndWeighter::CosmicMuNormWeight(), cmf::ShifterAndWeighter::CosmicOverlayNormWeight(), cmf::CMFSpectraMaker::endJob(), cmf::CovarianceMatrixFitter::FillDataSpectrum(), cmf::EventListManipulator::FillEventList(), cmf::ShifterAndWeighter::HornNormWeight(), cmf::SpectrumPredictionMaker::Initialize(), cmf::CovarianceFitHelper::InitializeGlobalVars(), cmf::CovarianceFitHelper::InitializeMinimizer(), cmf::CovarianceFitHelper::InitializeShifterAndWeighter(), cmf::ShifterAndWeighter::MECNormWeight(), cmf::CovarianceFitHelper::MinimizeCP(), cmf::ShifterAndWeighter::NCNormWeight(), cmf::ShifterAndWeighter::NoiseFarNormWeight(), cmf::PredictionLibraryMaker::PredictionLibraryMaker(), cmf::CMFSpectraMaker::reconfigure(), cmf::CovarianceMatrixMaker::reconfigure(), cmf::RandomUniverses::reconfigure(), cmf::FitFeldmanCousinsPoint::reconfigure(), cmf::ContourFromLibrary::reconfigure(), cmf::CAFToEventList::reconfigure(), cmf::ShifterAndWeighter::RelNormWeight(), cmf::ShifterAndWeighter::RockNormOnFidWeight(), cmf::CovarianceMatrixMaker::SetSystematicParameter(), cmf::ShifterAndWeighter::TauScaleSystWeight(), cmf::CovarianceMatrixMaker::writeResults(), and cmf::CovarianceMatrixFitter::~CovarianceMatrixFitter().

146  {
147  if(gParUtil == nullptr)
148  gParUtil = new ParameterUtility();
149 
150  return gParUtil;
151  }
static ParameterUtility * gParUtil
size_t cmf::ParameterUtility::NumSysPars ( ) const
inline

Definition at line 47 of file ParameterUtility.h.

References fSysParameters.

47 { return fSysParameters.size(); }
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
cmf::Parameter const & cmf::ParameterUtility::OscParameterInfo ( std::string const &  parName,
cmf::DetType_t const &  det 
) const

Definition at line 223 of file ParameterUtility.cxx.

References fFDOscParameters, fNDOscParameters, and cmf::kNEARDET.

225  {
226  if(fNDOscParameters.count(parName) < 1)
227  throw cet::exception("ParameterUtility")
228  << "oscillation parameter "
229  << parName
230  << " is not in the list";
231 
232  if(det == cmf::kNEARDET)
233  return fNDOscParameters.find(parName)->second;
234 
235  return fFDOscParameters.find(parName)->second;
236  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
cmf::ParameterSpaceLoc fNDOscParameters
values for the oscillation parameters in ND
cmf::ParameterSpaceLoc fFDOscParameters
values for the oscillation parameters in FD
cmf::Parameter const & cmf::ParameterUtility::ParameterInfo ( std::string const &  parName)

Definition at line 251 of file ParameterUtility.cxx.

References fNDOscParameters, and fSysParameters.

Referenced by cmf::ShifterAndWeighter::AbsNormWeight(), cmf::ShifterAndWeighter::BirksNormWeight(), cmf::ChiSqrCalculator::ChiSqrNuisance(), cmf::ShifterAndWeighter::COHScale2018Weight(), cmf::ShifterAndWeighter::CosmicMuNormWeight(), cmf::ShifterAndWeighter::CosmicOverlayNormWeight(), cmf::ShifterAndWeighter::HornNormWeight(), cmf::CovarianceFitHelper::InitializeMinimizer(), cmf::ShifterAndWeighter::MECNormWeight(), cmf::CovarianceFitHelper::MinimizeCP(), cmf::ShifterAndWeighter::NCNormWeight(), cmf::ShifterAndWeighter::NoiseFarNormWeight(), cmf::ShifterAndWeighter::RelNormWeight(), cmf::ShifterAndWeighter::RockNormOnFidWeight(), and cmf::ShifterAndWeighter::TauScaleSystWeight().

252  {
253  // the oscillation parameters are the same in the ND and FD
254  if(fNDOscParameters.count(parName) > 0)
255  return fNDOscParameters.find(parName)->second;
256 
257  // the systematic parameters could be different, so check the ND list
258  // first and then return from the FD list
259  if(fSysParameters.count(parName) > 0)
260  return fSysParameters.find(parName)->second;
261 
262  throw cet::exception("ParameterUtility")
263  << "ParameterUtility does not know about parameter "
264  << parName;
265 
266  // the following line is to keep the compiler happy
267  return fSysParameters.find(parName)->second;
268  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
cmf::ParameterSpaceLoc fNDOscParameters
values for the oscillation parameters in ND
cmf::Location cmf::ParameterUtility::ParametersAsLocation ( )

Definition at line 279 of file ParameterUtility.cxx.

References fFDOscParameters, fNDOscParameters, fSysParameters, cmf::Location::InsertParameter(), cmf::kNEARDET, and PandAna.Demos.demo0::loc.

Referenced by cmf::RandomUniverses::beginJob(), cmf::FitFeldmanCousinsPoint::beginJob(), cmf::CMFDecorrelator::CMFDecorrelator(), cmf::SpectrumPredictionMaker::Initialize(), cmf::CovarianceFitHelper::InitializeGlobalVars(), cmf::CovarianceFitHelper::InitializeShifterAndWeighter(), cmf::CMFSpectraMaker::reconfigure(), and cmf::CovarianceMatrixMaker::writeResults().

280  {
282 
283  for(auto const& parItr : fSysParameters){
284  loc.InsertParameter(parItr.second);
285 
286  // the fSysParameters map just has the FD location, we
287  // want the systematic uncertainties to be in the ND location too
288  loc.InsertParameter(cmf::Parameter(parItr.second.Name(),
290  parItr.second.Value(),
291  parItr.second.IsFixed(),
292  parItr.second.Sigma(),
293  parItr.second.CentralValue(),
294  parItr.second.Variance(),
295  parItr.second.IsNuisance(),
296  parItr.second.IsConstrained(),
297  parItr.second.LowerBound(),
298  parItr.second.UpperBound()));
299  }
300 
301  return std::move(loc);
302  }
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
cmf::ParameterSpaceLoc fNDOscParameters
values for the oscillation parameters in ND
cmf::ParameterSpaceLoc fFDOscParameters
values for the oscillation parameters in FD
cmf::Parameter const & cmf::ParameterUtility::SysParameterInfo ( std::string const &  parName) const

Definition at line 239 of file ParameterUtility.cxx.

References fSysParameters.

240  {
241  if(fSysParameters.count(parName) < 1)
242  throw cet::exception("ParameterUtility")
243  << "systematic parameter "
244  << parName
245  << " is not in the list";
246 
247  return fSysParameters.find(parName)->second;
248  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
cmf::ParameterSpaceLoc const& cmf::ParameterUtility::SysParameters ( ) const
inline

Definition at line 48 of file ParameterUtility.h.

References fSysParameters, ParameterUtility(), and ~ParameterUtility().

Referenced by cmf::EventListManipulator::FillEventList().

48 { return fSysParameters; }
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
std::vector< long > cmf::ParameterUtility::SysParKeys ( ) const

Definition at line 314 of file ParameterUtility.cxx.

References fSysParameters, and cmf::VarNameToKey().

Referenced by cmf::EventListManipulator::FillEventList().

315  {
316  std::vector<long> parKeys;
317  for(auto const& parItr : fSysParameters) parKeys.emplace_back(cmf::VarNameToKey(parItr.first));
318 
319  return std::move(parKeys);
320  }
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
static uint8_t VarNameToKey(std::string const &name)
Definition: StaticFuncs.h:385
std::vector< std::string > cmf::ParameterUtility::SysParNames ( ) const

Definition at line 305 of file ParameterUtility.cxx.

References fSysParameters.

Referenced by cmf::CMFSpectraMaker::endJob(), and cmf::CovarianceMatrixMaker::writeResults().

306  {
307  std::vector<std::string> parNames;
308  for(auto const& parItr : fSysParameters) parNames.emplace_back(parItr.first);
309 
310  return std::move(parNames);
311  }
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors
bool cmf::ParameterUtility::UseSysPar ( std::string const &  parName)

Definition at line 271 of file ParameterUtility.cxx.

References fSysParameters.

272  {
273  // the systematic parameters could be different, so check the ND list
274  // first and then return from the FD list
275  return fSysParameters.count(parName) > 0;
276  }
cmf::ParameterSpaceLoc fSysParameters
values for the systematic parameters, same in both detectors

Member Data Documentation

cmf::ParameterSpaceLoc cmf::ParameterUtility::fFDOscParameters
private

values for the oscillation parameters in FD

Definition at line 56 of file ParameterUtility.h.

Referenced by Initialize(), OscParameterInfo(), and ParametersAsLocation().

cmf::ParameterSpaceLoc cmf::ParameterUtility::fNDOscParameters
private

values for the oscillation parameters in ND

Definition at line 55 of file ParameterUtility.h.

Referenced by Initialize(), OscParameterInfo(), ParameterInfo(), and ParametersAsLocation().

cmf::ParameterSpaceLoc cmf::ParameterUtility::fSysParameters
private

values for the systematic parameters, same in both detectors

Definition at line 57 of file ParameterUtility.h.

Referenced by Initialize(), NumSysPars(), ParameterInfo(), ParametersAsLocation(), SysParameterInfo(), SysParameters(), SysParKeys(), SysParNames(), and UseSysPar().


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