Page MenuHomeHEPForge

No OneTemporary

Size
13 KB
Referenced Files
None
Subscribers
None
diff --git a/src/InputHandler/GeneratorUtils.cxx b/src/InputHandler/GeneratorUtils.cxx
index 0a17f3e1..7e06b626 100644
--- a/src/InputHandler/GeneratorUtils.cxx
+++ b/src/InputHandler/GeneratorUtils.cxx
@@ -1,58 +1,60 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NUISANCE.
*
* NUISANCE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUISANCE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include <iostream>
#include "GeneratorUtils.h"
#include "FitLogger.h"
#ifdef __NIWG_ENABLED__
-niwg::rew::NIWGEvent * GeneratorUtils::GetNIWGEvent(NeutVect* nvect)
-{
- niwg::rew::NIWGEvent * fDummyNIWGEvent = NULL;
+#ifdef __NEUT_ENABLED__
- fDummyNIWGEvent = new niwg::rew::NIWGEvent();
- fDummyNIWGEvent->detid = 1; // MiniBooNE (apply CCQE LowE variations)
- fDummyNIWGEvent->neutmode = nvect->Mode;
- fDummyNIWGEvent->targetA = nvect->TargetA;
- fDummyNIWGEvent->recenu_ccqe_sk = -1;
- if (nvect->Ibound==0) fDummyNIWGEvent->targetA = 1;//RT: identifies as H, rather than O16
+// niwg::rew::NIWGEvent * GeneratorUtils::GetNIWGEventLocal(NeutVect* nvect)
+// {
+// niwg::rew::NIWGEvent * fDummyNIWGEvent = NULL;
- // Fill initial particle stack
- for (int ip=0; ip<nvect->Npart(); ++ip) {
+// fDummyNIWGEvent = new niwg::rew::NIWGEvent();
+// fDummyNIWGEvent->detid = 1; // MiniBooNE (apply CCQE LowE variations)
+// fDummyNIWGEvent->neutmode = nvect->Mode;
+// fDummyNIWGEvent->targetA = nvect->TargetA;
+// fDummyNIWGEvent->recenu_ccqe_sk = -1;
+// if (nvect->Ibound==0) fDummyNIWGEvent->targetA = 1;//RT: identifies as H, rather than O16
- niwg::rew::NIWGPartStack fDummyPartStack;
+// // Fill initial particle stack
+// for (int ip=0; ip<nvect->Npart(); ++ip) {
- fDummyPartStack.p = (nvect->PartInfo(ip)->fP)*0.001; // Convert to GeV
+// niwg::rew::NIWGPartStack fDummyPartStack;
- fDummyPartStack.pdg = nvect->PartInfo(ip)->fPID;
- fDummyPartStack.chase = nvect->PartInfo(ip)->fIsAlive;
- fDummyPartStack.parent = nvect->ParentIdx(ip)-1; // WARNING: this needs to be tested with a NeutRoot file
+// fDummyPartStack.p = (nvect->PartInfo(ip)->fP)*0.001; // Convert to GeV
- fDummyNIWGEvent->part_stack.push_back(fDummyPartStack);
- }
- fDummyNIWGEvent->CalcKinematics();
+// fDummyPartStack.pdg = nvect->PartInfo(ip)->fPID;
+// fDummyPartStack.chase = nvect->PartInfo(ip)->fIsAlive;
+// fDummyPartStack.parent = nvect->ParentIdx(ip)-1; // WARNING: this needs to be tested with a NeutRoot file
- return fDummyNIWGEvent;
-}
-#endif // neut enabled
+// fDummyNIWGEvent->part_stack.push_back(fDummyPartStack);
+// }
+// fDummyNIWGEvent->CalcKinematics();
+
+// return fDummyNIWGEvent;
+// }
+#endif
+#endif
-// #endif
diff --git a/src/InputHandler/GeneratorUtils.h b/src/InputHandler/GeneratorUtils.h
index ea5fa12e..568378de 100644
--- a/src/InputHandler/GeneratorUtils.h
+++ b/src/InputHandler/GeneratorUtils.h
@@ -1,38 +1,68 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NUISANCE.
*
* NUISANCE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NUISANCE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NUISANCE. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef GENERATOR_UTILS_H
#define GENERATOR_UTILS_H
/*!
* \addtogroup InputHandler
* @{
*/
#ifdef __NIWG_ENABLED__
+#ifdef __NEUT_ENABLED__
#include "NIWGEvent.h"
#include "NIWGSyst.h"
+#include "InputHandler.h"
+#include "TargetUtils.h"
+#include "neutpart.h"
+#include "neutvect.h"
+#include "PlotUtils.h"
+#include "TTreePerfStats.h"
+#include "nefillverC.h"
+#include "necardC.h"
+#include "neutmodelC.h"
+#include "neutparamsC.h"
+#include "neworkC.h"
+#include "fsihistC.h"
+#include "neutcrsC.h"
+#include "neutvect.h"
+#include "neutpart.h"
+#include "neutfsipart.h"
+#include "neutfsivert.h"
+#include "neutrootTreeSingleton.h"
+#include "NModeDefn.h"
+#include "NSyst.h"
+#include "NFortFns.h" // Contains all the NEUT common blocks
+#ifdef __NEUT_NUCFSI_ENABLED__
+#include "nucleonfsihistC.h"
+#include "neutnucfsivert.h"
+#include "neutnucfsistep.h"
#endif
-namespace GeneratorUtils {
-#ifdef __NIWG_ENABLED__
- niwg::rew::NIWGEvent* GetNIWGEvent(NeutVect* nvect);
+#endif
#endif
-};
+// namespace GeneratorUtils {
+// #ifdef __NIWG_ENABLED__
+// #ifdef __NEUT_ENABLED__
+// niwg::rew::NIWGEvent* GetNIWGEventLocal(NeutVect* nvect);
+// #endif
+// #endif
+// };
/*! @} */
#endif
diff --git a/src/Reweight/NIWGWeightEngine.cxx b/src/Reweight/NIWGWeightEngine.cxx
index bdce7ae5..2c3a6808 100644
--- a/src/Reweight/NIWGWeightEngine.cxx
+++ b/src/Reweight/NIWGWeightEngine.cxx
@@ -1,158 +1,195 @@
-#include "NEUTWeightEngine.h"
+#include "NIWGWeightEngine.h"
NIWGWeightEngine::NIWGWeightEngine(std::string name) {
#ifdef __NIWG_ENABLED__
#ifdef __NEUT_ENABLED__
// Setup the NEUT Reweight engien
fCalcName = name;
LOG(FIT) << "Setting up NIWG RW : " << fCalcName << std::endl;
// Create RW Engine suppressing cout
StopTalking();
fNIWGRW = new niwg::rew::NIWGReWeight();
// Get List of Veto Calcs (For Debugging)
std::string rw_engine_list =
FitPar::Config().GetParS("FitWeight.fNIWGRW_veto");
bool niwg_2012a = rw_engine_list.find("niwg_2012a") == std::string::npos;
bool niwg_2014a = rw_engine_list.find("niwg_2014a") == std::string::npos;
bool niwg_pimult = rw_engine_list.find("niwg_pimult") == std::string::npos;
bool niwg_mec = rw_engine_list.find("niwg_mec") == std::string::npos;
bool niwg_rpa = rw_engine_list.find("niwg_rpa") == std::string::npos;
bool niwg_eff_rpa = rw_engine_list.find("niwg_eff_rpa") == std::string::npos;
bool niwg_proton =
rw_engine_list.find("niwg_protonFSIbug") == std::string::npos;
bool niwg_hadron =
rw_engine_list.find("niwg_HadronMultSwitch") == std::string::npos;
// Add the RW Calcs
if (niwg_2012a)
fNIWGRW->AdoptWghtCalc("niwg_2012a", new niwg::rew::NIWGReWeight2012a);
if (niwg_2014a)
fNIWGRW->AdoptWghtCalc("niwg_2014a", new niwg::rew::NIWGReWeight2014a);
if (niwg_pimult)
fNIWGRW->AdoptWghtCalc("niwg_pimult", new niwg::rew::NIWGReWeightPiMult);
if (niwg_mec)
fNIWGRW->AdoptWghtCalc("niwg_mec", new niwg::rew::NIWGReWeightMEC);
if (niwg_rpa)
fNIWGRW->AdoptWghtCalc("niwg_rpa", new niwg::rew::NIWGReWeightRPA);
if (niwg_eff_rpa)
fNIWGRW->AdoptWghtCalc("niwg_eff_rpa",
new niwg::rew::NIWGReWeightEffectiveRPA);
if (niwg_proton)
fNIWGRW->AdoptWghtCalc("niwg_protonFSIbug",
new niwg::rew::NIWGReWeightProtonFSIbug);
if (niwg_hadron)
fNIWGRW->AdoptWghtCalc("niwg_HadronMultSwitch",
new niwg::rew::NIWGReWeightHadronMultSwitch);
fNIWGRW->Reconfigure();
// Set Abs Twk Config
fIsAbsTwk = (FitPar::Config().GetParB("setabstwk"));
// allow cout again
StartTalking();
#else
ERR(FTL) << "NIWG RW Enabled but NEUT RW is not!" << std::endl;
#endif
#else
ERR(FTL) << "NIWG RW NOT ENABLED!" << std::endl;
#endif
};
void NIWGWeightEngine::IncludeDial(std::string name, double startval) {
#ifdef __NIWG_ENABLED__
+#ifdef __NEUT_ENABLED__
// Get NEUT Syst.
niwg::rew::NIWGSyst_t gensyst = niwg::rew::NIWGSyst::FromString(name);
int nuisenum = Reweight::ConvDial(name, kNIWG);
// Fill Maps
int index = fValues.size();
fValues.push_back(0.0);
fNIWGSysts.push_back(gensyst);
fEnumIndex[nuisenum] = index;
fNameIndex[name] = index;
// Initialize dial
fNIWGRW->Systematics().Init( fNIWGSysts[index] );
// If Absolute
if (fIsAbsTwk) {
niwg::rew::NIWGSystUncertainty::Instance()->SetUncertainty( fNIWGSysts[index], 1.0, 1.0 );
}
// Set Value if given
if (startval != -999.9) {
SetDialValue(nuisenum, startval);
}
#endif
+#endif
}
void NIWGWeightEngine::SetDialValue(int nuisenum, double val) {
#ifdef __NIWG_ENABLED__
+#ifdef __NEUT_ENABLED__
fValues[fEnumIndex[nuisenum]] = val;
fNIWGRW->Systematics().Set(fNIWGSysts[fEnumIndex[nuisenum]], val);
#endif
+#endif
}
void NIWGWeightEngine::SetDialValue(std::string name, double val) {
#ifdef __NIWG_ENABLED__
+#ifdef __NEUT_ENABLED__
fValues[fNameIndex[name]] = val;
fNIWGRW->Systematics().Set(fNIWGSysts[fNameIndex[name]], val);
#endif
+#endif
}
void NIWGWeightEngine::Reconfigure(bool silent) {
#ifdef __NIWG_ENABLED__
+#ifdef __NEUT_ENABLED__
// Hush now...
if (silent) StopTalking();
// Reconf
fNIWGRW->Reconfigure();
// Shout again
if (silent) StartTalking();
#endif
+#endif
}
double NIWGWeightEngine::CalcWeight(BaseFitEvt* evt) {
double rw_weight = 1.0;
#ifdef __NEUT_ENABLED__
#ifdef __NIWG_ENABLED__
// Skip Non GENIE
if (evt->fType != kNEUT) return 1.0;
// Hush now
StopTalking();
- niwg::rew::NIWGEvent* niwg_event = GeneratorUtils::GetNIWGEvent(evt->fNeutVect);
+ niwg::rew::NIWGEvent* niwg_event = NIWGWeightEngine::GetNIWGEventLocal(evt->fNeutVect);
rw_weight *= fNIWGRW->CalcWeight(*niwg_event);
delete niwg_event;
// Speak Now
StartTalking();
#endif
#endif
// Return rw_weight
return rw_weight;
}
+#ifdef __NEUT_ENABLED__
+#ifdef __NIWG_ENABLED__
+niwg::rew::NIWGEvent * NIWGWeightEngine::GetNIWGEventLocal(NeutVect* nvect)
+{
+ niwg::rew::NIWGEvent * fDummyNIWGEvent = NULL;
+
+ fDummyNIWGEvent = new niwg::rew::NIWGEvent();
+ fDummyNIWGEvent->detid = 1; // MiniBooNE (apply CCQE LowE variations)
+ fDummyNIWGEvent->neutmode = nvect->Mode;
+ fDummyNIWGEvent->targetA = nvect->TargetA;
+ fDummyNIWGEvent->recenu_ccqe_sk = -1;
+ if (nvect->Ibound==0) fDummyNIWGEvent->targetA = 1;//RT: identifies as H, rather than O16
+
+ // Fill initial particle stack
+ for (int ip=0; ip<nvect->Npart(); ++ip) {
+
+ niwg::rew::NIWGPartStack fDummyPartStack;
+ fDummyPartStack.p = (nvect->PartInfo(ip)->fP)*0.001; // Convert to GeV
+ fDummyPartStack.pdg = nvect->PartInfo(ip)->fPID;
+ fDummyPartStack.chase = nvect->PartInfo(ip)->fIsAlive;
+ fDummyPartStack.parent = nvect->ParentIdx(ip)-1; // WARNING: this needs to be tested with a NeutRoot file
+ fDummyNIWGEvent->part_stack.push_back(fDummyPartStack);
+ }
+ fDummyNIWGEvent->CalcKinematics();
+
+ return fDummyNIWGEvent;
+}
+#endif
+#endif
diff --git a/src/Reweight/NIWGWeightEngine.h b/src/Reweight/NIWGWeightEngine.h
index 8703b342..396af79f 100644
--- a/src/Reweight/NIWGWeightEngine.h
+++ b/src/Reweight/NIWGWeightEngine.h
@@ -1,52 +1,72 @@
#ifndef WEIGHT_ENGINE_NIWG_H
#define WEIGHT_ENGINE_NIWG_H
#ifdef __NIWG_ENABLED__
+#ifdef __NEUT_ENABLED__
#include "NIWGReWeight.h"
#include "NIWGReWeight1piAngle.h"
#include "NIWGReWeight2010a.h"
#include "NIWGReWeight2012a.h"
#include "NIWGReWeight2014a.h"
#include "NIWGReWeightDeltaMass.h"
#include "NIWGReWeightEffectiveRPA.h"
#include "NIWGReWeightHadronMultSwitch.h"
#include "NIWGReWeightMEC.h"
#include "NIWGReWeightPiMult.h"
#include "NIWGReWeightProtonFSIbug.h"
#include "NIWGReWeightRPA.h"
#include "NIWGReWeightSpectralFunc.h"
#include "NIWGReWeightSplineEnu.h"
#include "NIWGSyst.h"
#include "NIWGSystUncertainty.h"
+#include "NReWeight.h"
+#include "NReWeightCasc.h"
+#include "NReWeightNuXSecCCQE.h"
+#include "NReWeightNuXSecCCRES.h"
+#include "NReWeightNuXSecCOH.h"
+#include "NReWeightNuXSecDIS.h"
+#include "NReWeightNuXSecNC.h"
+#include "NReWeightNuXSecNCEL.h"
+#include "NReWeightNuXSecNCRES.h"
+#include "NReWeightNuXSecRES.h"
+#include "NReWeightNuclPiless.h"
+#include "NSyst.h"
+#include "NSystUncertainty.h"
+#include "neutpart.h"
+#include "neutvect.h"
+#include "NEUTInputHandler.h"
+#endif
#endif
#include "FitLogger.h"
#include "GeneratorUtils.h"
#include "WeightEngineBase.h"
#include "FitWeight.h"
class NIWGWeightEngine : public WeightEngineBase {
public:
NIWGWeightEngine(std::string name);
~NIWGWeightEngine() {};
void IncludeDial(std::string name, double startval);
void SetDialValue(std::string name, double val);
void SetDialValue(int nuisenum, double val);
void Reconfigure(bool silent = false);
double CalcWeight(BaseFitEvt* evt);
inline bool NeedsEventReWeight() { return true; };
-
#ifdef __NIWG_ENABLED__
+#ifdef __NEUT_ENABLED__
std::vector<niwg::rew::NIWGSyst_t> fNIWGSysts;
+ niwg::rew::NIWGEvent* GetNIWGEventLocal(NeutVect* nvect);
niwg::rew::NIWGReWeight* fNIWGRW;
#endif
+#endif
};
#endif

File Metadata

Mime Type
text/x-diff
Expires
Tue, Sep 30, 5:44 AM (1 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6566305
Default Alt Text
(13 KB)

Event Timeline