OscCalcPMNS_CPT.cxx
Go to the documentation of this file.
1 /////////////////////////////////////////////////////////////////////////////
2 // \file OscCalcPMNS_CPT.cxx
3 // \brief Source file for PMNS oscillation calculation
4 // \version $Id: OscCalcPMNS_CPT.cxx,v 1.0 2013-11-21 11:17:35 tamsett Exp $
5 // \author Matthew Tamsett
6 /////////////////////////////////////////////////////////////////////////////
8 
9 #include <cassert>
10 #include <cstdlib>
11 #include <iostream>
12 
13 namespace osc
14 {
16  : fMixDirty(true), fDmDirty(true), fPropDirty(true), fPrevAnti(0),
17  fMixDirty_bar(true), fDmDirty_bar(true), fPropDirty_bar(true), fPrevAnti_bar(0)
18  {
19  }
20 
22  {
23  }
24 
26  {
27  return new OscCalcPMNS_CPT(*this);
28  }
29 
30  double OscCalcPMNS_CPT::P(int flavBefore, int flavAfter, double E)
31  {
32  const int anti = (flavBefore > 0) ? +1 : -1;
33  assert(flavAfter/anti > 0);
34  // We will now forward to the appropriate calculator depending on anti
35  if (anti == -1){
36  if(anti != fPrevAnti_bar) fPropDirty_bar = true;
37  int i = -1, j = -1;
38  if(abs(flavBefore) == 12) i = 0;
39  if(abs(flavBefore) == 14) i = 1;
40  if(abs(flavBefore) == 16) i = 2;
41  if(abs(flavAfter) == 12) j = 0;
42  if(abs(flavAfter) == 14) j = 1;
43  if(abs(flavAfter) == 16) j = 2;
44  assert(i >= 0 && j >= 0);
45 
46  if(fMixDirty_bar){
48  fMixDirty_bar = false;
49  }
50  if(fDmDirty_bar){
52  fDmDirty_bar = false;
53  }
54 
55  if(fPropDirty_bar || E != fPrevE_bar){
56  fPMNS_bar.Reset();
57  // Assume Z/A=0.5
58  const double Ne = fRho/2;
59  fPMNS_bar.PropMatter(fL, E, Ne, anti);
60 
61  fPropDirty_bar = false;
62  fPrevE_bar = E;
63  fPrevAnti_bar = anti;
64  }
65 
66  return fPMNS_bar.P(i, j);
67  } else {
68  if(anti != fPrevAnti) fPropDirty = true;
69 
70  int i = -1, j = -1;
71  if(abs(flavBefore) == 12) i = 0;
72  if(abs(flavBefore) == 14) i = 1;
73  if(abs(flavBefore) == 16) i = 2;
74  if(abs(flavAfter) == 12) j = 0;
75  if(abs(flavAfter) == 14) j = 1;
76  if(abs(flavAfter) == 16) j = 2;
77  assert(i >= 0 && j >= 0);
78 
79  if(fMixDirty){
81  fMixDirty = false;
82  }
83  if(fDmDirty){
85  fDmDirty = false;
86  }
87 
88  if(fPropDirty || E != fPrevE){
89  fPMNS.Reset();
90  // Assume Z/A=0.5
91  const double Ne = fRho/2;
92  fPMNS.PropMatter(fL, E, Ne, anti);
93 
94  fPropDirty = false;
95  fPrevE = E;
96  fPrevAnti = anti;
97  }
98 
99  return fPMNS.P(i, j);
100  }
101  }
103  {
104  const std::string& txt = "PMNSBar";
105  TMD5* ret = new TMD5;
106  ret->Update((unsigned char*)txt.c_str(), txt.size());
107  const int kNumParams = 8;
108  double buf[kNumParams] = {fRho, fL, fDmsq21_bar, fDmsq32_bar,
110  ret->Update((unsigned char*)buf, sizeof(double)*kNumParams);
111  ret->Final();
112  return ret;
113  }
114 
115 } // namespace
TMD5 * GetParamsHashDefaultBar() const
void abs(TH1 *hist)
virtual IOscCalcAdjustable * Copy() const override
Float_t E
Definition: plot.C:20
void PropMatter(double L, double E, double Ne, int anti)
Definition: PMNS.cxx:504
const double j
Definition: BetheBloch.cxx:29
void Reset()
Definition: PMNS.cxx:588
Oscillation probability calculators.
Definition: Calcs.h:5
virtual double P(int flavBefore, int flavAfter, double E) override
E in GeV; flavors as PDG codes (so, neg==>antinu)
assert(nhit_max >=nhit_nbins)
void SetMix(const T &th12, const T &th23, const T &th13, const T &deltacp)
Definition: PMNS.cxx:97
void SetDeltaMsqrs(const T &dm21, const T &dm32)
Definition: PMNS.cxx:187
T P(int i, int j) const
Definition: PMNS.cxx:606
enum BeamMode string