do_extrap.h File Reference

#include "MCReweight/MCReweight.h"
#include "MCReweight/NeugenWeightCalculator.h"
#include "NCUtils/Extrapolation/NCExtrapolationModule.h"
#include "NCUtils/NCOscProb.h"
#include "NCUtils/NCType.h"
#include "TString.h"
#include <iostream>

Go to the source code of this file.

Enumerations

enum  EFitType { kRealData, kFakeData, kFakeDataSplitMC, kMockData }

Functions

TString add_to_output_name (TString s, bool appendSep=true)
void set_msg_levels ()
void set_beam_types (TString beamTypes)
void set_near_run_limits (int dataLimit, int mcLimit)
void set_far_run_limits (int dataLimit, int mcLimit)
void set_run_to_use (int run)
void set_data_mc_type (EFitType fitType, int mockDataRun=-1, int mockDataSubRun=-2)
void set_data_mc_path (TString uDSTDir)
void set_mc_exposure_for_beam (BeamType::BeamType_t beamType, NC::RunUtil::ERunType run, double pot)
void set_extraction (TString name)
void set_use_custom_pid_cut_and_value (bool useCustom, float value=-9999)
void set_prediction (bool makePred, bool writeFDData=false)
void set_syst_study_params (bool doSystStudy, float shiftInSigma)
void turn_off_systematic_params ()
void adjust_systematic (NCType::EFitParam syst)
void adjust_systematic (NCType::EFitParam syst, float adjVal)
void fit_systematic (NCType::EFitParam syst)
TString get_model_short_name (NCType::EOscModel m)
TString get_param_string (NCType::EFitParam p)
void fit_osc_param (NCType::EFitParam p)
void fix_osc_param (NCType::EFitParam p, double value)
void set_osc_pars (NC::OscProb::OscPars *oscPars)
void set_model_to_fit (NCType::EOscModel m)
void use_fitter_confidence (int confidenceLevel, bool wanted=true)
void set_fitter_params (float precScale=1.)
void add_contour (NCType::EFitParam x, NCType::EFitParam y)
void add_projection (NCType::EFitParam proj)
void do_syst_interpolation (bool interp)
void make_shifted_beams (bool make)
void force_best_fit_to_truth (bool force)
void farnear_smooth_width (double smoothingWidth)
void pid_emulate_farnear (bool emulate)
void pid_true_bin_factor (int factor)
void pid_binning (int nbins, double minpid, double maxpid)
void add_neugen_weight_calculator ()
void run ()

Variables

NCExtrapolationModule extrapMod
Registry reg

Enumeration Type Documentation

enum EFitType
Enumerator:
kRealData 
kFakeData 
kFakeDataSplitMC 
kMockData 

Definition at line 14 of file do_extrap.h.

00014               {
00015   kRealData,
00016   kFakeData,
00017   kFakeDataSplitMC,
00018   kMockData
00019 };


Function Documentation

void add_contour ( NCType::EFitParam  x,
NCType::EFitParam  y 
)

Definition at line 296 of file do_extrap.h.

References Form(), and Registry::Set().

00297 {
00298   static TString contoursList("");
00299   contoursList+=Form("(%d,%d) ", x, y);
00300 
00301   reg.Set("ContoursList", contoursList);
00302 }

void add_neugen_weight_calculator (  ) 

Definition at line 358 of file do_extrap.h.

References MCReweight::AddWeightCalculator(), and MCReweight::Instance().

Referenced by run().

00359 {
00360   MCReweight &mcReweight = MCReweight::Instance();
00361   NeugenWeightCalculator *fNeugenWeightCal = new NeugenWeightCalculator;
00362   mcReweight.AddWeightCalculator(fNeugenWeightCal);
00363 }

void add_projection ( NCType::EFitParam  proj  ) 

Definition at line 304 of file do_extrap.h.

References Plot::Format(), and Registry::Set().

00305 {
00306   static TString projsList;
00307   projsList += TString::Format("%d ", proj);
00308   reg.Set("ProjectionsList", projsList);
00309 }

TString add_to_output_name ( TString  s,
bool  appendSep = true 
)

Definition at line 30 of file do_extrap.h.

Referenced by run(), set_data_mc_type(), set_model_to_fit(), and set_osc_pars().

00031 {
00032   static TString outputName;
00033   outputName.Append(s);
00034   if (appendSep) outputName.Append("_");
00035 
00036   return outputName;
00037 }

void adjust_systematic ( NCType::EFitParam  syst,
float  adjVal 
)

Definition at line 204 of file do_extrap.h.

References NCType::kParams, and Registry::Set().

00205 {
00206   reg.Set("ChangeMCAsData"+NCType::kParams[syst].name, true);
00207   reg.Set("Adjust"+NCType::kParams[syst].name, adjVal);
00208 }

void adjust_systematic ( NCType::EFitParam  syst  ) 

Definition at line 199 of file do_extrap.h.

References NCType::kParams, and Registry::Set().

00200 {
00201   reg.Set("ChangeMCAsData"+NCType::kParams[syst].name, true);
00202 }

void do_syst_interpolation ( bool  interp  ) 

Definition at line 311 of file do_extrap.h.

References Registry::Set().

00312 {
00313   reg.Set("DoSystematicInterpolation", interp);
00314 }

void farnear_smooth_width ( double  smoothingWidth  ) 

Definition at line 331 of file do_extrap.h.

References Registry::Set().

00332 {
00333   reg.Set("FarNearSmoothingWidth", smoothingWidth);
00334 }

void fit_osc_param ( NCType::EFitParam  p  ) 

Definition at line 255 of file do_extrap.h.

References get_param_string(), and Registry::Set().

00256 {
00257   const TString paramString=get_param_string(p);
00258   reg.Set("Fit"+paramString, true);
00259 }

void fit_systematic ( NCType::EFitParam  syst  ) 

Definition at line 210 of file do_extrap.h.

References NCType::kParams, and Registry::Set().

00211 {
00212   reg.Set("Fit"+NCType::kParams[syst].name, true);
00213 }

void fix_osc_param ( NCType::EFitParam  p,
double  value 
)

Definition at line 261 of file do_extrap.h.

References get_param_string(), and Registry::Set().

00262 {
00263   const TString paramString=get_param_string(p);
00264   reg.Set("Fit"+paramString, false);
00265   reg.Set(paramString+"Val", value);
00266 }

void force_best_fit_to_truth ( bool  force  ) 

Definition at line 322 of file do_extrap.h.

References Registry::Set().

00323 {
00324   reg.Set("ForceBestFitToTruth", force);
00325 }

TString get_model_short_name ( NCType::EOscModel  m  ) 

Definition at line 219 of file do_extrap.h.

References NCType::kDecay, NCType::kDecoherence, NCType::kFourFlavorDelta41Is0, NCType::kFourFlavorDelta43Is0, NCType::kFourFlavorDelta43IsBig, NCType::kFourFlavorGeneral, NCType::kNoOscillations, NCType::kSterileFraction, and NCType::kThreeFlavor.

Referenced by set_model_to_fit(), and set_osc_pars().

00220 {
00221   switch(m) {
00222   case NCType::kThreeFlavor: return "3flavor";
00223   case NCType::kNoOscillations: return "noOsc";
00224   case NCType::kFourFlavorGeneral: return "4flavorGen";
00225   case NCType::kFourFlavorDelta43IsBig: return "delta43IsBig";
00226   case NCType::kFourFlavorDelta41Is0: return "delta41Is0";
00227   case NCType::kFourFlavorDelta43Is0: return "delta43Is0";
00228   case NCType::kSterileFraction: return "sFrac";
00229   case NCType::kDecay: return "decay";
00230   case NCType::kDecoherence: return "decoherence";
00231   default:
00232     assert(0 && "Unknown oscmodel");
00233     return "Unknown";
00234   }
00235 }

TString get_param_string ( NCType::EFitParam  p  ) 

Definition at line 237 of file do_extrap.h.

References NCType::kDelta1, NCType::kDelta2, NCType::kFs, NCType::kTheta13, NCType::kTheta14, NCType::kTheta23, NCType::kTheta24, and NCType::kUE3Sqr.

Referenced by fit_osc_param(), and fix_osc_param().

00238 {
00239   switch(p) {
00240   case NCType::kUE3Sqr:  return "UE3Sqr";
00241   case NCType::kTheta13: return "Theta13";
00242   case NCType::kDelta1:  return "Delta1";
00243   case NCType::kDelta2:  return "Delta2";
00244   case NCType::kTheta14: return "Theta14";
00245   case NCType::kTheta24: return "Theta24";
00246   case NCType::kTheta23: return "Theta23";
00247   case NCType::kFs:      return "Fs";
00248   default:
00249     assert(0 && "No String for parameter");
00250     return "Unknown";
00251   }
00252 
00253 }

void make_shifted_beams ( bool  make  ) 

Definition at line 316 of file do_extrap.h.

References Registry::Set().

00317 {
00318   reg.Set("MakeShiftedBeams", make);
00319   reg.Set("ShiftedBeamsSimpleOnly", make);
00320 }

void pid_binning ( int  nbins,
double  minpid,
double  maxpid 
)

Definition at line 346 of file do_extrap.h.

References Registry::Set().

00347 {
00348   // Number of bins in PID to use
00349   reg.Set("PIDFitPIDNbins",          nbins);
00350   // Minimum, maximum value of PID
00351   reg.Set("PIDFitPIDmin",          minpid);
00352   reg.Set("PIDFitPIDmax",          maxpid);
00353 }

void pid_emulate_farnear ( bool  emulate  ) 

Definition at line 336 of file do_extrap.h.

References Registry::Set().

00337 {
00338   reg.Set("PIDFitEmulateFarNear", emulate);
00339 }

void pid_true_bin_factor ( int  factor  ) 

Definition at line 341 of file do_extrap.h.

References Registry::Set().

00342 {
00343   reg.Set("PIDFitTrueBinFactor", factor);
00344 }

void run (  ) 

Definition at line 365 of file do_extrap.h.

References add_neugen_weight_calculator(), add_to_output_name(), NCExtrapolationModule::Config(), NCExtrapolationModule::DefaultConfig(), Registry::Merge(), NCExtrapolationModule::Run(), Registry::Set(), and Registry::UnLockValues().

Referenced by OscFit::Template::Add(), NCExtrapolation::AddEvent(), NtpEventViewer::AddList(), AtNuEventViewer::AddList(), AtNuEventSelector::AddList(), OscFit::TemplateWriter::AddToFile(), DemoSnarlList::AddUsingFile(), NtpMaker::Ana(), MakeAlignmentModule::Ana(), GetFidModule::Ana(), FiltMBSpillModule::Ana(), EvtAddRawDigitBlockModule::Ana(), DemoSnarlList::Ana(), CountPot::Ana(), ChopModule::Ana(), Blinder::Ana(), AltDeMuxDisplay::Ana(), RotoObjectifier::BuildDaqHeaderBlock(), OscFit::TemplatesForBeamData::BuildData(), ParticleDisplay::BuildDisplay(), NueDisplayModule::BuildDisplay(), OscFit::TemplatesForBeamData::BuildMC(), RotoObjectifier::BuildRecord(), RotoObjectifier::BuildSnarlHeaderBlock(), OscFit::Configuration::BuildSummaryOfData(), OscFit::TemplatesForBeamData::BuildTemplates(), OscFit::TemplateMap::BuildTemplates(), OscFit::TemplateMaker::BuildTemplates(), cfgtest(), RotoServer::ChooseStreamName(), OscFit::Configuration::CombineBeamResBinsCV(), OscFit::TemplateCalculator::CombineBins(), OscFit::TemplateCalculator::CombineRuns(), OscFit::Configuration::CombiningBeamResBinsCV(), ComparisonResult::ComparisonResult(), OscFit::Template::ConditionalAdd(), JobCEnv::ContinueRun(), NtpEventViewer::controlGoTo(), AtNuEventViewer::controlGoTo(), MadTVAnalysis::CreatePAN(), MadTestAnalysis::CreatePAN(), MadPIDAnalysis::CreatePAN(), MadMKAnalysis::CreatePAN(), MadDpAnalysis::CreatePAN(), MadAnalysis::CreatePAN(), NtpStEventGrabber::DoGather(), Anp::SelectSpill::End(), AlignmentRunSummary::Fill(), OscFit::TemplateCalculator::FillCombinedBins(), FillEntry(), NuPlots::FillGeneralHistos(), MeuHistos::FillGeneralHistos(), AlignmentRunSummary::FillSummaryTree(), MakeAlignmentModule::FitTrackLessOne(), DetectorAlignment::FitTrackLessOne(), ToyMCModule::Get(), RerootToTruthModule::Get(), RerootToRawDataModule::Get(), RerootFlsDigitToDigiPE::Get(), RecordSetupModule::Get(), MCMerge::Get(), DigitListModule::Get(), DetSim::Get(), CustomLightInjector::Get(), get_run_number(), NueDisplayModule::GetBasicInfo(), OscFit::TemplateCalculator::GetData(), NuDSTAna::GetEvent(), NuDSTAna::GetEventND(), OscFit::TemplateCalculator::GetExpectation(), OscFit::TemplateCalculator::GetExperiment(), OscFit::Fitter::GetLnL(), OscFit::Fitter::GetLnLNoRes(), CDAnalysis::GetLowUpTimeCuts(), DataUtil::GetRun(), GetRunNumber(), DataUtil::GetSubRun(), DemoSnarlList::HandleCommand(), NavPrimerGenerator::IsOutOfDate(), MadScanDisplay::JumpTo(), MadEvDisplay::JumpTo(), LoadBeamMomentum(), LoadCERRange(), LoadCERTimeWin(), NtpStEventGrabber::LoadFileList(), LoadOverlapWin(), LoadTOFRange(), RunQualityUtil::MakeRunList(), MeuAnalysis::MakeSummaryTreeWithNtpStOneSnarl(), MadEdAnalysis::MyCreatePAN(), MadEdAnalysis::MyCreatePANData(), MadEdAnalysis::MyMakeQEFile(), MsgStream::operator()(), AtNuEventViewer::PassFail(), Anp::SelectSpill::PassList(), LITuning::PrintAll(), EVD::PrintCanvas(), OscFit::TwoFlavourFitter::PrintExpt(), OscFit::ThreeFlavourFitter::PrintExpt(), OscFit::Template::PrintHistograms(), OscFit::TemplateArray::PrintTemplates(), FillNearRunQuality::ProcessHeader(), FillFarRunQuality::ProcessHeader(), FillBadChannelDB::ProcessHeader(), NuFCRunner::ProcessPredictions(), DbuDaqMonitorModule::ProcessRawRecord(), DbuDaqFileModule::ProcessRawRecord(), RotoClientModule::Put(), MadScanDisplay::ReadEventsFile(), MadEvDisplay::ReadEventsFile(), OscFit::TemplateIO::ReadFromFile(), IoInputModule::ReadHeader(), OscFit::TemplateMap::ReadTemplates(), FillPIDFromText::ReadTextFile(), PTSimModule::Reco(), OltNewModule::Reco(), OltDataIntegrity::Reco(), DemuxFast::Reco(), DataQualityReader::Reco(), Blinder::Reco(), AutoPIDMaker::Reco(), UserHist::Refresh(), DemoSnarlList::RemoveUsingFile(), RunSnarlEntry::RSEntryHandler(), NuFCRunner::RunExperiments(), TridPageDisplay::RunSnarlEntryHandler(), sepruns(), NueAnalysisCuts::SetInfoObject(), Extrapolate2D::SetRunPeriod(), OscFit::Template::SpecialAdd(), RecValidate::TestDataRecord(), RunSnarlEntry::Update(), EVD::Update(), ParticleDisplay::UpdateDisplay(), NueDisplayModule::UpdateDisplay(), EVD::UpdateSummary(), EVD::UpdateTime(), OscFit::TemplateMap::WriteTemplates(), and OscFit::TemplateIO::WriteToFile().

00366 {
00367 
00368   // Add the .root to the end of the output filename and set it in the module
00369   reg.Set("FileName", add_to_output_name(".root", false));
00370 
00371   add_neugen_weight_calculator();
00372 
00373   Registry def = extrapMod.DefaultConfig();
00374   def.UnLockValues();
00375 
00376   def.Merge(reg);
00377   extrapMod.Config(def);
00378 
00379   extrapMod.Run();
00380 }

void set_beam_types ( TString  beamTypes  ) 

Definition at line 54 of file do_extrap.h.

References Registry::Set().

00055 {
00056   reg.Set("BeamType", beamTypes);
00057 }

void set_data_mc_path ( TString  uDSTDir  ) 

Definition at line 127 of file do_extrap.h.

References Registry::Set().

00128 {
00129   reg.Set("DataMCPath", uDSTDir);
00130 }

void set_data_mc_type ( EFitType  fitType,
int  mockDataRun = -1,
int  mockDataSubRun = -2 
)

Definition at line 80 of file do_extrap.h.

References add_to_output_name(), Form(), kFakeData, kFakeDataSplitMC, kMockData, kRealData, and Registry::Set().

00085 {
00086 
00087   if (fitType!=kMockData &&
00088       (mockDataRun!=-1 || mockDataSubRun!=-2))
00089     assert(0 && "Mock data parameters set when fit type is not mock data");
00090 
00091   if (fitType==kMockData &&
00092       (mockDataRun==-1 || mockDataSubRun==-2))
00093     assert(0 && "Mock data parameters not set when fit type is mock data");
00094 
00095   switch (fitType) {
00096   case kRealData:
00097     reg.Set("UseMCAsData", false);
00098     reg.Set("UseMockData", false);
00099     add_to_output_name("data");
00100     break;
00101   case kFakeData:
00102     reg.Set("UseMCAsData", true);
00103     reg.Set("UseMockData", false);
00104     reg.Set("SplitMC",     false);
00105     add_to_output_name("mconly");
00106     break;
00107   case kFakeDataSplitMC:
00108     reg.Set("UseMCAsData", true);
00109     reg.Set("UseMockData", false);
00110     reg.Set("SplitMC",     true);
00111     add_to_output_name("splitmc");
00112     break;
00113   case kMockData:
00114     reg.Set("UseMCAsData", false);
00115     reg.Set("UseMockData", true);
00116     reg.Set("MockDataSet", Form("F%d", mockDataRun));
00117     reg.Set("MockDataSubRun", mockDataSubRun);
00118     add_to_output_name("mock");
00119     add_to_output_name(Form("run%d", mockDataRun));
00120     add_to_output_name(Form("%d", mockDataSubRun));
00121     break;
00122   default:
00123     assert(0 && "Invalid fit type");
00124   }
00125 }

void set_extraction ( TString  name  ) 

Definition at line 137 of file do_extrap.h.

References NCType::kExtractionNames, NCType::kNumExtractions, and Registry::Set().

00138 {
00139   // Add a dot at the end if we missed it
00140   if (!name.EndsWith(".")) name+=".";
00141 
00142   // pick the extraction to use - use only 1 at a time
00143   // in this module.
00144   //Loop through extractions and use the one we want
00145   for (Int_t i = 0; i < NCType::kNumExtractions; ++i){
00146     if(name == NCType::kExtractionNames[i]){
00147       reg.Set("ExtractionType", i);
00148       return;
00149     }
00150   }
00151 
00152   assert(0 && "Specified extraction not found");
00153 }

void set_far_run_limits ( int  dataLimit,
int  mcLimit 
)

Definition at line 65 of file do_extrap.h.

References Registry::Set().

00066 {
00067   reg.Set("RunLimitFarData", dataLimit);
00068   reg.Set("RunLimitFarMC",   mcLimit);
00069 }

void set_fitter_params ( float  precScale = 1.  ) 

Definition at line 287 of file do_extrap.h.

References Registry::Set(), and use_fitter_confidence().

00288 {
00289   use_fitter_confidence(68);
00290   use_fitter_confidence(90);
00291   use_fitter_confidence(99, false);
00292 
00293   reg.Set("PrecScale", precScale);
00294 }

void set_mc_exposure_for_beam ( BeamType::BeamType_t  beamType,
NC::RunUtil::ERunType  run,
double  pot 
)

Definition at line 132 of file do_extrap.h.

References NCExtrapolationModule::SetMCExposureForBeam().

00133 {
00134   extrapMod.SetMCExposureForBeam(NCBeam::Info(beamType, run), pot);
00135 }

void set_model_to_fit ( NCType::EOscModel  m  ) 

Definition at line 275 of file do_extrap.h.

References add_to_output_name(), get_model_short_name(), and Registry::Set().

00276 {
00277   reg.Set("OscillationModel", int(m));
00278   add_to_output_name(get_model_short_name(m)+"Fit");
00279 }

void set_msg_levels (  ) 

Definition at line 43 of file do_extrap.h.

References MsgService::GetStream(), MsgService::Instance(), Msg::kFatal, Msg::kInfo, Munits::m, and MsgStream::SetLogLevel().

00044 {
00045   MsgService* m=MsgService::Instance();
00046   m->GetStream("NCExtrapolationModule")->SetLogLevel(Msg::kInfo);
00047   m->GetStream("NCAnalysisCuts")->SetLogLevel(Msg::kInfo);
00048   m->GetStream("NCUtils")->SetLogLevel(Msg::kInfo);
00049   //m->GetStream("NCExtrapolation"->SetLogLevel(Msg::kInfo);
00050   //m->GetStream("MinosMinimization"->SetLogLevel(Msg::kDebug);
00051   m->GetStream("Registry")->SetLogLevel(Msg::kFatal);
00052 }

void set_near_run_limits ( int  dataLimit,
int  mcLimit 
)

Definition at line 59 of file do_extrap.h.

References Registry::Set().

00060 {
00061   reg.Set("RunLimitNearData", dataLimit);
00062   reg.Set("RunLimitNearMC",   mcLimit);
00063 }

void set_osc_pars ( NC::OscProb::OscPars oscPars  ) 

Definition at line 268 of file do_extrap.h.

References add_to_output_name(), get_model_short_name(), NC::OscProb::OscPars::OscillationModel(), and Registry::Set().

00269 {
00270   assert(sizeof(oscPars) == sizeof(int));
00271   reg.Set("OscPars", int(oscPars));
00272   add_to_output_name(get_model_short_name(oscPars->OscillationModel()));
00273 }

void set_prediction ( bool  makePred,
bool  writeFDData = false 
)

Definition at line 163 of file do_extrap.h.

References Registry::Set().

00164 {
00165   reg.Set("Prediction", makePred);
00166   if(writeFDData) reg.Set("PredictionWriteData", writeFDData);
00167 }

void set_run_to_use ( int  run  ) 

Definition at line 71 of file do_extrap.h.

References Registry::Set().

00072 {
00073   //set which runs to use - see NCRunUtil.h for the numbering
00074   reg.Set("RunToUse", run);
00075 }

void set_syst_study_params ( bool  doSystStudy,
float  shiftInSigma 
)

Definition at line 174 of file do_extrap.h.

References Registry::Set().

00175 {
00176   //Whether or not to do syst study.
00177   //If true, Adjust conditions are ignored in favor of SystShift(sigma).
00178   reg.Set("DoSystStudy", doSystStudy);
00179   reg.Set("SystShift", shiftInSigma);
00180 }

void set_use_custom_pid_cut_and_value ( bool  useCustom,
float  value = -9999 
)

Definition at line 155 of file do_extrap.h.

References Registry::Set().

00157 {
00158   reg.Set("UsePIDCustomCut", useCustom);
00159   if (useCustom)
00160     reg.Set("PIDCustomCut", value);
00161 }

void turn_off_systematic_params (  ) 

Definition at line 182 of file do_extrap.h.

References NCType::kNumSystematicParameters, NCType::kParams, and Registry::Set().

00183 {
00184   // This is mostly copy-pasted from NCExtrapolationModule, so we don't
00185   // actually *have* to do it. Anyway, it doesn't hurt to make it
00186   // explicit in the macro
00187 
00188   TString adjust   = "Adjust";
00189   TString mcAsData = "ChangeMCAsData";
00190   TString fit      = "Fit";
00191   for(int i = 0; i < NCType::kNumSystematicParameters; ++i){
00192     reg.Set(NCType::kParams[i].name,         false);
00193     reg.Set(mcAsData + NCType::kParams[i].name, false);
00194     reg.Set(fit + NCType::kParams[i].name,      false);
00195   }
00196 }

void use_fitter_confidence ( int  confidenceLevel,
bool  wanted = true 
)

Definition at line 281 of file do_extrap.h.

References Form(), and Registry::Set().

Referenced by set_fitter_params().

00282 {
00283   assert(confidenceLevel==68 || confidenceLevel==90 || confidenceLevel==99);
00284   reg.Set(Form("LazyContoursWant%d", confidenceLevel), wanted);
00285 }


Variable Documentation

Definition at line 23 of file do_extrap.h.


Generated on 19 Jan 2018 for loon by  doxygen 1.6.1