5 #include "OscLib/OscCalc.h"
6 #include "OscLib/OscCalcDumb.h"
7 #include "OscLib/OscCalcGeneral.h"
8 #include "OscLib/OscCalcPMNS.h"
9 #include "OscLib/OscCalcPMNSOpt.h"
10 #include "OscLib/OscCalcSterile.h"
11 #include "OscLib/OscCalcPMNS_NSI.h"
13 #include "TObjString.h"
21 template<> std::unique_ptr<osc::IOscCalc>
22 LoadFrom<osc::IOscCalc>(TDirectory*
dir)
24 TObjString* ptag = (TObjString*)
dir->Get(
"type");
26 const TString tag = ptag->GetString();
28 if(tag ==
"NoOscillations")
return std::unique_ptr<osc::IOscCalc>(
new osc::NoOscillations);
29 if(tag ==
"OscCalculatorDumb")
return std::unique_ptr<osc::IOscCalc>(
new osc::OscCalcDumb);
31 TVectorD* params = (TVectorD*)
dir->Get(
"params");
36 if(tag ==
"OscCalculator") ret =
new osc::OscCalc;
37 if(tag ==
"OscCalculatorGeneral") ret =
new osc::OscCalcGeneral;
38 if(tag ==
"OscCalculatorPMNS") ret =
new osc::OscCalcPMNS;
39 if(tag ==
"OscCalculatorPMNSOpt") ret =
new osc::OscCalcPMNSOpt;
40 if(tag ==
"OscCalculatorSterile") ret =
new osc::OscCalcSterile;
41 if(tag ==
"OscCalculatorPMNS_NSI") ret =
new osc::OscCalcPMNS_NSI;
42 if(tag ==
"OscCalcSterileApprox"){
43 assert(params->GetNrows() == 4);
46 ret->calc.SetSinSq2ThetaMuMu((*params)[1]);
47 ret->calc.SetSinSq2ThetaMuE((*params)[2]);
48 ret->calc.SetL((*params)[3]);
49 return std::unique_ptr<osc::IOscCalcAdjustable>(ret);
53 std::cout <<
"LoadFrom not implemented for " << tag << std::endl;
58 if(tag ==
"OscCalculatorSterile") {
59 std::vector<double>
state;
60 for (
int i = 0; i < params->GetNrows(); ++i) {
61 state.push_back( (*params)[i] );
63 dynamic_cast<osc::OscCalcSterile*
>(ret)->SetState(state);
64 return std::unique_ptr<osc::IOscCalcAdjustable>(ret);
67 if(tag ==
"OscCalculatorPMNS_NSI") {
68 std::vector<double>
state;
69 for (
int i = 0; i < params->GetNrows(); ++i) {
70 state.push_back( (*params)[i] );
72 dynamic_cast<osc::OscCalcPMNS_NSI*
>(ret)->SetState(state);
73 return std::unique_ptr<osc::IOscCalcAdjustable>(ret);
76 assert(params->GetNrows() == 8);
78 ret->SetL ((*params)[0]);
79 ret->SetRho ((*params)[1]);
80 ret->SetDmsq21((*params)[2]);
81 ret->SetDmsq32((*params)[3]);
82 ret->SetTh12 ((*params)[4]);
83 ret->SetTh13 ((*params)[5]);
84 ret->SetTh23 ((*params)[6]);
85 ret->SetdCP ((*params)[7]);
87 return std::unique_ptr<osc::IOscCalcAdjustable>(ret);
93 TDirectory* tmp = gDirectory;
97 if(dynamic_cast<const osc::NoOscillations*>(&x)){
98 TObjString(
"NoOscillations").Write(
"type");
103 if(dynamic_cast<const osc::OscCalcDumb*>(&x)){
104 TObjString(
"OscCalculatorDumb").Write(
"type");
111 TObjString(
"OscCalcSterileApprox").Write(
"type");
117 params.Write(
"params");
124 std::cout <<
"Unknown calculator in SaveTo " <<
typeid(
x).
name() << std::endl;
128 const osc::OscCalcSterile* tmpSterile =
dynamic_cast<const osc::OscCalcSterile*
>(&
x);
130 TObjString(
"OscCalculatorSterile").Write(
"type");
131 std::vector<double>
state = tmpSterile->GetState();
132 TVectorD params(state.size());
133 for (
unsigned int i = 0; i < state.size(); ++i) params[i] = state[i];
134 params.Write(
"params");
140 const osc::OscCalcPMNS_NSI* tmpNSI =
dynamic_cast<const osc::OscCalcPMNS_NSI*
>(&
x);
142 TObjString(
"OscCalcPMNS_NSI").Write(
"type");
143 std::vector<double>
state = tmpNSI->GetState();
144 TVectorD params(state.size());
145 for (
unsigned int i = 0; i < state.size(); ++i) params[i] = state[i];
146 params.Write(
"params");
151 if(dynamic_cast<const osc::OscCalc*>(&x)) TObjString(
"OscCalculatorPMNS").Write(
"type");
152 else if(dynamic_cast<const osc::OscCalcGeneral*>(&x)) TObjString(
"OscCalculatorGeneral").Write(
"type");
153 else if(dynamic_cast<const osc::OscCalcPMNS*>(&x)) TObjString(
"OscCalculatorPMNS").Write(
"type");
154 else if(dynamic_cast<const osc::OscCalcPMNSOpt*>(&x)) TObjString(
"OscCalculatorPMNSOpt").Write(
"type");
156 std::cout <<
"Unimplemented calculator in SaveTo " <<
typeid(
x).
name() << std::endl;
162 params[0] = y->GetL();
163 params[1] = y->GetRho();
164 params[2] = y->GetDmsq21();
165 params[3] = y->GetDmsq32();
166 params[4] = y->GetTh12();
167 params[5] = y->GetTh13();
168 params[6] = y->GetTh23();
169 params[7] = y->GetdCP();
171 params.Write(
"params");
process_name opflash particleana ie x
process_name opflashCryoW ana
double GetSinSq2ThetaMuE() const
process_name opflash particleana ie ie y
double GetSinSq2ThetaMuMu() const
OscCalcSterileApprox calc
void SaveTo(const osc::IOscCalc &x, TDirectory *dir)
BEGIN_PROLOG could also be cout