Public Member Functions | Private Attributes | Friends | List of all members
cmf::Location Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-05-05/CovarianceMatrixFit/dataProducts/Parameter.h"

Public Member Functions

 Location ()
 
 Location (std::vector< ParameterSpaceLoc > const &locations)
 
 Location (std::set< cmf::DetType_t > const &dets)
 
 Location (cmf::OscillationParameterMap const &oscPars, std::set< cmf::DetType_t > const &dets)
 
cmf::OscillationParameterMap AsOscillationParameterMap (cmf::DetType_t const &det=cmf::kFARDET) const
 
std::vector< ParameterOscillationParameters (cmf::DetType_t const &det=cmf::kFARDET) const
 
std::vector< ParameterSystematicParameters (cmf::DetType_t const &det=cmf::kFARDET) const
 
cmf::ParameterSpaceLoc const & DetectorLocation (cmf::DetType_t const &det) const
 
std::vector< ParameterSpaceLoc > const & DetectorLocations () const
 
void InsertParameter (cmf::Parameter const &par)
 
void SetParameterValue (std::string const &parName, double const &value, cmf::DetType_t const &det)
 

Private Attributes

std::vector< ParameterSpaceLocfDetLocs
 

Friends

std::ostream & operator<< (std::ostream &o, cmf::Location const &loc)
 

Detailed Description

Definition at line 172 of file Parameter.h.

Constructor & Destructor Documentation

cmf::Location::Location ( )
inline

Definition at line 176 of file Parameter.h.

177  {}
cmf::Location::Location ( std::vector< ParameterSpaceLoc > const &  locations)
inline

Definition at line 179 of file Parameter.h.

References fillBadChanDBTables::det, msf_helper::dets, and cmf::kFARDET.

180  : fDetLocs(locations)
181  {}
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203
cmf::Location::Location ( std::set< cmf::DetType_t > const &  dets)

Definition at line 253 of file Parameter.cxx.

References fillBadChanDBTables::det.

254  {
255  for(auto const& det : dets) fDetLocs.emplace_back(det, std::vector<cmf::Parameter>());
256  }
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203
cmf::Location::Location ( cmf::OscillationParameterMap const &  oscPars,
std::set< cmf::DetType_t > const &  dets 
)

Definition at line 259 of file Parameter.cxx.

References cmf::cOscParams_Strings(), fDetLocs, cmf::kFARDET, cmf::kL, cmf::kMINOSFAR, cmf::kMINOSNEAR, cmf::kNEARDET, and moon_position_table_new3::second.

261  : Location(dets)
262  {
263  std::map<cmf::DetType_t, double> detBaseline({{cmf::kNEARDET, 1. },
264  {cmf::kFARDET, 810.},
265  {cmf::kMINOSNEAR, 1.02},
266  {cmf::kMINOSFAR, 735.}});
267 
268  float parVal;
269 
270  for(auto const& itr : oscPars){
271  parVal = itr.second;
272  for(auto & locItr : fDetLocs){
273  if(itr.first == cmf::kL) parVal = detBaseline.find(locItr.Detector())->second;
274 
275  locItr.InsertParameter(cmf::Parameter(cmf::cOscParams_Strings[itr.first],
276  locItr.Detector(),
277  parVal,
278  true,
279  0,
280  parVal,
281  0,
282  false,
283  false,
284  0.,
285  1.));
286  } // end loop over locations
287  } // end loop over oscillation parameters
288  }
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203
const std::vector< std::string > cOscParams_Strings({"L","Rho","Dmsq21","Dmsq32","Th12","Th13","Th23","dCP","Th14","Th24","Th34","Dmsq41","d24","Eps_ee","Eps_emu","Eps_etau","Eps_mumu","Eps_mutau","Eps_tautau","Delta_emu","Delta_etau","Delta_mutau"})

Member Function Documentation

cmf::OscillationParameterMap cmf::Location::AsOscillationParameterMap ( cmf::DetType_t const &  det = cmf::kFARDET) const

Definition at line 321 of file Parameter.cxx.

References DetectorLocation().

Referenced by cmf::RandomUniverses::beginJob(), cmf::FakeUniverse::FakeUniverse(), and cmf::ShifterAndWeighter::SetOscillationVals().

322  {
324 
325  // The oscillation parameters should be the same for all detectors,
326  // except of course the baseline. Make the map with the NOvA far detector
327  // by default
328  for(auto const& itr : this->DetectorLocation(det).Parameters()){
329  if(!itr.IsOscPar()) continue;
330 
331  oscMap.emplace((cmf::OscParm_t)itr.Key(),
332  itr.Value());
333  }
334 
335  return std::move(oscMap);
336  }
enum cmf::osc_params OscParm_t
std::map< cmf::OscParm_t, float > OscillationParameterMap
Definition: Constants.h:748
cmf::ParameterSpaceLoc const & DetectorLocation(cmf::DetType_t const &det) const
Definition: Parameter.cxx:339
cmf::ParameterSpaceLoc const & cmf::Location::DetectorLocation ( cmf::DetType_t const &  det) const

Definition at line 339 of file Parameter.cxx.

References cmf::cDetType_Strings(), fillBadChanDBTables::det, and fDetLocs.

Referenced by AsOscillationParameterMap(), cmf::RandomUniverseUtility::CreateLocationWithVariedSystematics(), cmf::ShifterAndWeighter::CurrentParameterValue(), cmf::ParameterUtility::Initialize(), cmf::ShifterAndWeighter::InitShiftsAndWeightsToUse(), and cmf::CovarianceMatrixMaker::SetSystematicParameter().

340  {
341  for(auto const& itr : fDetLocs){
342  if(itr.Detector() == det) return itr;
343  }
344 
345  // if we got here there is a problem because the detector is not in the
346  // collection
347  throw cet::exception("Location")
348  << "no cmf::ParameterSpaceLoc for "
350 
351  // the compiler will complain if we don't pretend to return what we
352  // say we will
353  return fDetLocs.front();
354  }
const std::vector< std::string > cDetType_Strings({"UnknownDet","NearDet","FarDet","MINOSNear","MINOSFar","AllDetectors"})
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203
std::vector<ParameterSpaceLoc> const& cmf::Location::DetectorLocations ( ) const
inline
void cmf::Location::InsertParameter ( cmf::Parameter const &  par)

Definition at line 291 of file Parameter.cxx.

References cmf::Parameter::Detector(), fDetLocs, cmf::Parameter::Name(), and cmf::Parameter::Value().

Referenced by cmf::ParameterSetToLocation().

292  {
293  for(auto & itr : fDetLocs){
294  if(itr.Detector() == par.Detector()){
295  if(itr.count(par.Name()) < 1) itr.InsertParameter(par);
296  else itr.SetParameterValue(par.Name(), par.Value());
297  }
298  }
299  }
Int_t par
Definition: SimpleIterate.C:24
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203
std::vector< Parameter > cmf::Location::OscillationParameters ( cmf::DetType_t const &  det = cmf::kFARDET) const

Definition at line 357 of file Parameter.cxx.

References cmf::cDetType_Strings(), fillBadChanDBTables::det, fDetLocs, and MF_LOG_DEBUG.

Referenced by cmf::RandomUniverseUtility::CreateLocationWithVariedOscParameters(), and cmf::ShifterAndWeighter::SetOscillationVals().

358  {
359  std::vector<Parameter> oscPars;
360 
361  MF_LOG_DEBUG("Location")
362  << "Get oscillation parameters from collection of "
363  << fDetLocs.size()
364  << " detector locations";
365 
366  for(auto const& itr : fDetLocs){
367  if(itr.Detector() == det){
368  MF_LOG_DEBUG("Location")
369  << "Oscillation Parameters for "
370  << cmf::cDetType_Strings[itr.Detector()];
371  for(auto const& parItr : itr.Parameters()){
372  if(parItr.IsOscPar()){
373  oscPars.emplace_back(parItr);
374  MF_LOG_DEBUG("Location")
375  << parItr;
376  }
377  }
378  }
379  }
380 
381  return std::move(oscPars);
382  }
const std::vector< std::string > cDetType_Strings({"UnknownDet","NearDet","FarDet","MINOSNear","MINOSFar","AllDetectors"})
#define MF_LOG_DEBUG(id)
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203
void cmf::Location::SetParameterValue ( std::string const &  parName,
double const &  value,
cmf::DetType_t const &  det 
)

Definition at line 302 of file Parameter.cxx.

References cmf::cDetType_Strings(), fillBadChanDBTables::det, fDetLocs, cmf::kALLDET, and MF_LOG_WARNING.

Referenced by cmf::RandomUniverseUtility::CreateLocationWithVariedOscParameters(), cmf::RandomUniverseUtility::CreateLocationWithVariedSystematics(), cmf::CMFSpectraMaker::endJob(), cmf::ShifterAndWeighter::SetCurrentVals(), and cmf::CovarianceMatrixMaker::SetSystematicParameter().

305  {
306  for(auto & itr : fDetLocs){
307  if(itr.Detector() == det ||
308  cmf::kALLDET == det ){
309  if(itr.count(parName) > 0)
310  itr.SetParameterValue(parName, value);
311  else
312  MF_LOG_WARNING("Location")
313  << parName
314  << " is not a recognized parameter for the "
316  }
317  } // end loop over the ParameterSpaceLocs
318  }
const std::vector< std::string > cDetType_Strings({"UnknownDet","NearDet","FarDet","MINOSNear","MINOSFar","AllDetectors"})
const XML_Char int const XML_Char * value
Definition: expat.h:331
#define MF_LOG_WARNING(category)
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203
std::vector< Parameter > cmf::Location::SystematicParameters ( cmf::DetType_t const &  det = cmf::kFARDET) const

Definition at line 385 of file Parameter.cxx.

References fillBadChanDBTables::det, and fDetLocs.

386  {
387  std::vector<Parameter> systPars;
388 
389  for(auto const& itr : fDetLocs){
390  if(itr.Detector() == det){
391  for(auto const& parItr : itr.Parameters()){
392  if(!parItr.IsOscPar()) systPars.emplace_back(parItr);
393  }
394  }
395  }
396 
397  return std::move(systPars);
398  }
std::vector< ParameterSpaceLoc > fDetLocs
Definition: Parameter.h:203

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
cmf::Location const &  loc 
)
friend

Definition at line 201 of file Parameter.cxx.

202  {
203  auto const& detLocs = loc.DetectorLocations();
204 
205  std::set<std::string> parsDone;
206 
207  o << std::endl;
208  for(auto const& itr : detLocs){
209  for(auto const& parItr : itr.Parameters()){
210 
211  if(parsDone.find(parItr.Name()) != parsDone.end()) continue;
212 
213  parsDone.insert(parItr.Name());
214 
215  o << " -- parameter: "
216  << std::setw(30)
217  << parItr.Name()
218  << std::setw(15)
219  << " val "
220  << cmf::cDetType_Strings[itr.Detector()]
221  << ": "
222  << parItr.Value()
223  << " fixed: "
224  << std::setw(5)
225  << parItr.IsFixed();
226 
227  // see if this parameter is set for other detectors too
228  for(auto const& itr2 : detLocs){
229  if(itr2.Detector() == itr.Detector()) continue;
230  if(itr2.count(parItr.Name()) > 0){
231  auto const& par2 = itr2.Parameter(parItr.Name());
232  o << std::setw(15)
233  << " val "
234  << cmf::cDetType_Strings[itr2.Detector()]
235  << ": "
236  << std::setw(15)
237  << " "
238  << par2.Value()
239  << " fixed: "
240  << std::setw(5)
241  << par2.IsFixed();
242  }
243  } // end loop over other detectors
244  o << std::endl;
245  } // end loop over parameters
246  o << std::endl;
247  } // end loop over the current detector
248 
249  return o;
250  }
const std::vector< std::string > cDetType_Strings({"UnknownDet","NearDet","FarDet","MINOSNear","MINOSFar","AllDetectors"})

Member Data Documentation

std::vector<ParameterSpaceLoc> cmf::Location::fDetLocs
private

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