OscFit::TemplateCalculator Class Reference

#include <TemplateCalculator.h>

List of all members.

Public Member Functions

void GetData (Template *&myTemplate)
void GetMC (Template *&myTemplate)
void GetNCBackground (Template *&myTemplate)
void GetCosmicBackground (Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq, Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_nu, Double_t atmos_spec_cv_nubar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_nu, Double_t atmos_spec_cv_nubar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t beam_nue_norm, Double_t beam_nue_ncbkg, Double_t beam_nue_energy, Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_ratio_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_numu, Double_t atmos_spec_cv_numubar, Double_t atmos_spec_cv_nue, Double_t atmos_spec_cv_nuebar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Double_t atmos_nue_energy, Template *&myTemplate)
void GetExperiment (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t beam_nue_norm, Double_t beam_nue_ncbkg, Double_t beam_nue_energy, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_ratio_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_numu, Double_t atmos_spec_cv_numubar, Double_t atmos_spec_cv_nue, Double_t atmos_spec_cv_nuebar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Double_t atmos_nue_energy, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_nu, Double_t atmos_spec_cv_nubar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_nu, Double_t atmos_spec_cv_nubar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t beam_nue_norm, Double_t beam_nue_ncbkg, Double_t beam_nue_energy, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_ratio_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_numu, Double_t atmos_spec_cv_numubar, Double_t atmos_spec_cv_nue, Double_t atmos_spec_cv_nuebar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Double_t atmos_nue_energy, Template *&myTemplate)
void GetExpectation (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t beam_nue_norm, Double_t beam_nue_ncbkg, Double_t beam_nue_energy, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_ratio_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_numu, Double_t atmos_spec_cv_numubar, Double_t atmos_spec_cv_nue, Double_t atmos_spec_cv_nuebar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Double_t atmos_nue_energy, Template *&myTemplate)
void GetExpectationForBeamData (Double_t dmsq, Double_t sinsq, Bool_t cv, Bool_t rock, Bool_t nu, Bool_t nubar, Bool_t nc, Bool_t nue, Bool_t numu, Bool_t nutau, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Template *&myTemplate)
void GetExpectationForBeamData (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Bool_t cv, Bool_t rock, Bool_t nu, Bool_t nubar, Bool_t nc, Bool_t nue, Bool_t numu, Bool_t nutau, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t beam_nue_norm, Double_t beam_nue_ncbkg, Double_t beam_nue_energy, Template *&myTemplate)
void GetExpectationForAtmosData (Double_t dmsq, Double_t sinsq, Bool_t cv, Bool_t rock, Bool_t nu, Bool_t nubar, Bool_t nc, Bool_t nue, Bool_t numu, Bool_t nutau, Bool_t cosmic, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_nu, Double_t atmos_spec_cv_nubar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Template *&myTemplate)
void GetExpectationForAtmosData (Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, Bool_t cv, Bool_t rock, Bool_t nu, Bool_t nubar, Bool_t nc, Bool_t nue, Bool_t numu, Bool_t nutau, Bool_t cosmic, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_ratio_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_numu, Double_t atmos_spec_cv_numubar, Double_t atmos_spec_cv_nue, Double_t atmos_spec_cv_nuebar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Double_t atmos_nue_energy, Template *&myTemplate)
void CombineBins (Template *inputTemplate, Template *&outputTemplate)
void CombineRuns (Template *inputTemplate, Template *&outputTemplate)
void FillCombinedBins (Template *inputTemplate, Template *&outputTemplate)
void SwitchOffAtmosData ()
void SwitchAtmosDataOnOff (Bool_t yesno=1)
Bool_t GetSwitchForAtmosData ()
void SwitchOffBeamData ()
void SwitchBeamDataOnOff (Bool_t yesno=1)
Bool_t GetSwitchForBeamData ()
void SetDebug (Bool_t yesno=1)
void Initialise ()
void CombineResBins (Bool_t yesno=1)
void SetOverride (Bool_t yesno=1)
void GetData (TemplateArray *&myTemplateArray)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, TemplateArray *&myTemplateArray)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken, TemplateArray *&myTemplateArray)
void GetExpectation (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Bool_t cv, Bool_t cvtau, Bool_t rock, Bool_t rocktau, Bool_t ccnu, Bool_t ccnubar, Bool_t nc, Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken, TemplateArray *&myTemplateArray)
void GetExperiment (Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken, TemplateArray *&myTemplateArray)
void GetData (Run_t run, Template *&myTemplate)
void GetExpectation (Run_t run, Template *&myTemplate)
void GetExpectation (Run_t run, Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Template *&myTemplate)
void GetExpectation (Run_t run, Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken, Template *&myTemplate)
void GetExpectation (Run_t run, Double_t dmsq, Double_t sinsq, Double_t dmsqbar, Double_t sinsqbar, Bool_t cv, Bool_t cvtau, Bool_t rock, Bool_t rocktau, Bool_t ccnu, Bool_t ccnubar, Bool_t nc, Double_t norm, Double_t ncbkg, Double_t shwen, Double_t trken, Template *&myTemplate)
void BuildExpt (Template *inTemplate, Template *&outTemplate)

Static Public Member Functions

static TemplateCalculatorInstance ()
static TemplateCalculatorInstance ()

Private Member Functions

 TemplateCalculator ()
 ~TemplateCalculator ()
void BuildExpt (Template *inputTemplate, Template *&outputTemplate)
void GetExpectationForBeamData (Int_t nDmsq, Int_t nSinsq23, Int_t nSinsq13, Int_t nDeltaCP, Int_t nHierarchy, Bool_t cv, Bool_t rock, Bool_t nu, Bool_t nubar, Bool_t nc, Bool_t nue, Bool_t numu, Bool_t nutau, Double_t beam_numu_norm, Double_t beam_numu_ncbkg, Double_t beam_numu_shwen, Double_t beam_numu_trken, Double_t beam_numu_trken_exit, Double_t beam_nue_norm, Double_t beam_nue_ncbkg, Double_t beam_nue_energy, Template *&myTemplate)
void GetExpectationForAtmosData (Int_t nDmsq, Int_t nSinsq23, Int_t nSinsq13, Int_t nDeltaCP, Int_t nHierarchy, Bool_t cv, Bool_t rock, Bool_t nu, Bool_t nubar, Bool_t nc, Bool_t nue, Bool_t numu, Bool_t nutau, Bool_t cosmic, Double_t atmos_norm_cv, Double_t atmos_norm_rock, Double_t atmos_ratio_cv, Double_t atmos_ratio_rock, Double_t atmos_norm_nue, Double_t atmos_ratio_nue, Double_t atmos_norm_nc, Double_t atmos_spec_cv_numu, Double_t atmos_spec_cv_numubar, Double_t atmos_spec_cv_nue, Double_t atmos_spec_cv_nuebar, Double_t atmos_spec_rock_nu, Double_t atmos_spec_rock_nubar, Double_t atmos_zenith, Double_t atmos_numu_trken, Double_t atmos_numu_trken_exit, Double_t atmos_numu_shwen, Double_t atmos_nue_energy, Template *&myTemplate)
void GetExpectation (Int_t nDmsq, Int_t nSinsq23, Int_t nSinsq13, Int_t nDeltaCP, Int_t nHierarchy, Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Template *&myTemplate)
void GetExpectation (Int_t nDmsq, Int_t nSinsq23, Int_t nSinsq13, Int_t nDeltaCP, Int_t nHierarchy, Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Double_t ncbkg, Double_t shwen, Double_t trken, Double_t trken_exit, Double_t spec, Double_t zenith, Double_t nuencbkg, Double_t nueenergy, Template *&myTemplate)
void GetExpectation (Int_t nDmsq, Int_t nSinsq23, Int_t nSinsq13, Int_t nDeltaCP, Int_t nHierarchy, Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Systematic_t systematic, Double_t shift, Template *&myTemplate)
void GetDeltaExpectation (Int_t nDmsq, Int_t nSinsq23, Int_t nSinsq13, Int_t nDeltaCP, Int_t nHierarchy, Source_t source, Sample_t sample, Flavour_t flavour, Charge_t charge, Systematic_t systematic, Double_t shift, Template *&myTemplate)
Bool_t UsingAtmosData ()
Bool_t UsingBeamData ()
 TemplateCalculator ()
virtual ~TemplateCalculator ()
void GetExpectation (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Template *&myTemplate)
void GetExpectation (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Double_t ncbkg, Double_t shwen, Double_t trken, Template *&myTemplate)
void GetExpectation (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Double_t shift, Template *&myTemplate)
void GetDeltaExpectation (Int_t n, Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Double_t shift, Template *&myTemplate)
void CombineResBins (Template *inputTemplate, Template *&myTemplate)
void CombineResBins (Template *&myTemplate)
Bool_t OverrideWithRealData (Run_t run)

Private Attributes

TemplatefTemplateLayer0
TemplatefTemplateLayer1
TemplatefTemplateLayer2
TemplatefTemplateLayer3
TemplatefTemplateLayer4
Bool_t fInternalSwitchForAtmosData
Bool_t fInternalSwitchForBeamData
Bool_t fDebug
TemplateArrayfTemplateArrayLayer0
Bool_t fCombineResBins
Bool_t fOverrideWithRealData

Detailed Description

Definition at line 10 of file TemplateCalculator.h.


Constructor & Destructor Documentation

TemplateCalculator::TemplateCalculator (  )  [private]

Definition at line 32 of file TemplateCalculator.cxx.

References fDebug, fInternalSwitchForAtmosData, fInternalSwitchForBeamData, fTemplateLayer0, fTemplateLayer1, fTemplateLayer2, fTemplateLayer3, fTemplateLayer4, and Initialise().

Referenced by Instance().

00033 {
00034   fDebug = 0;
00035 
00036   fInternalSwitchForAtmosData = 1;
00037   fInternalSwitchForBeamData  = 1;
00038 
00039   fTemplateLayer0 = new Template();
00040   fTemplateLayer1 = new Template();
00041   fTemplateLayer2 = new Template();
00042   fTemplateLayer3 = new Template();
00043   fTemplateLayer4 = new Template();
00044 
00045   Initialise();
00046 }

TemplateCalculator::~TemplateCalculator (  )  [private]

Definition at line 48 of file TemplateCalculator.cxx.

References fTemplateLayer0, fTemplateLayer1, fTemplateLayer2, fTemplateLayer3, and fTemplateLayer4.

00049 {
00050   delete fTemplateLayer0;
00051   delete fTemplateLayer1;
00052   delete fTemplateLayer2;
00053   delete fTemplateLayer3;
00054   delete fTemplateLayer4;
00055 }

OscFit::TemplateCalculator::TemplateCalculator (  )  [private]
virtual OscFit::TemplateCalculator::~TemplateCalculator (  )  [private, virtual]

Member Function Documentation

void OscFit::TemplateCalculator::BuildExpt ( Template inTemplate,
Template *&  outTemplate 
)
void TemplateCalculator::BuildExpt ( Template inputTemplate,
Template *&  outputTemplate 
) [private]

Definition at line 2153 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), OscFit::Histogram::GetBinContent(), OscFit::Template::GetHistogram(), OscFit::Histogram::GetNbins(), OscFit::Template::GetNumHistograms(), OscFit::Template::Reset(), and OscFit::Histogram::SetBinContent().

Referenced by GetExperiment().

02154 {
02155   if( inputTemplate==0 ) return;
02156 
02157   outputTemplate->Reset();            // create the output template, 
02158   outputTemplate->Add(inputTemplate); // if it doesn't aleady exist,
02159   outputTemplate->Reset();            // then clear the output template
02160 
02161   for( UInt_t ihist=0; ihist<inputTemplate->GetNumHistograms(); ihist++ ){
02162     Histogram* inputHistogram  = inputTemplate->GetHistogram(ihist);
02163     Histogram* outputHistogram = outputTemplate->GetHistogram(ihist);
02164 
02165     if( inputHistogram && outputHistogram ){
02166       for( Int_t ibin=0; ibin<inputHistogram->GetNbins()+1; ibin++ ){ // [do overflow too]
02167         Double_t Exp = inputHistogram->GetBinContent(ibin);
02168         Double_t Obs = gRandom->Poisson(Exp);
02169         outputHistogram->SetBinContent(ibin,Obs);
02170       }
02171     }
02172   }
02173 
02174   return;
02175 }

void TemplateCalculator::CombineBins ( Template inputTemplate,
Template *&  outputTemplate 
)

Definition at line 2330 of file TemplateCalculator.cxx.

References OscFit::Template::Fill(), OscFit::GetContainmentType(), OscFit::Template::GetHistogramAtIndex(), OscFit::Template::GetIndex(), OscFit::Template::GetNumHistograms(), OscFit::GetResolutionType(), OscFit::GetSource(), OscFit::Configuration::Instance(), OscFit::Template::InvertID(), OscFit::kAtmosData, OscFit::kBeamData, OscFit::kContainedVertex, OscFit::kHiRes, OscFit::kIgnoreElectron, OscFit::kIgnoreProton, OscFit::kNoCharge, OscFit::kNothing, OscFit::kNull, OscFit::kNumu, OscFit::kResBin1, OscFit::kResBin2, OscFit::kResBin3, OscFit::kResBin4, OscFit::kResBin5, OscFit::kResBin6, OscFit::kResBin7, OscFit::kResBin8, OscFit::kRockMuon, OscFit::kUnknownCharge, OscFit::kUnknownElectronTag, OscFit::kUnknownFlavour, OscFit::kUnknownProtonTag, OscFit::kUnknownRes, OscFit::kUnknownRun, OscFit::kVanilla, n, OscFit::Template::Reset(), and run().

02331 { 
02332   if( inputTemplate==0 ) return;
02333   
02334   outputTemplate->Reset(); 
02335 
02336   for( UInt_t n=0; n<inputTemplate->GetNumHistograms(); n++ ){
02337     Int_t      index = inputTemplate->GetIndex(n);
02338     Histogram* hist  = inputTemplate->GetHistogramAtIndex(index);
02339 
02340     Run_t         run         = kUnknownRun;
02341     Containment_t containment = kNull;
02342     Flavour_t     flavour     = kUnknownFlavour;
02343     Charge_t      charge      = kUnknownCharge;
02344     Resolution_t  resolution  = kUnknownRes;
02345     Topology_t    topology    = kNothing;
02346     ProtonTag_t   proton      = kUnknownProtonTag;
02347     ElectronTag_t electron    = kUnknownElectronTag;
02348 
02349     Template::InvertID( index,
02350                         run, containment, flavour, charge, 
02351                         resolution, topology, proton, electron );
02352 
02353     // combine bins
02354     // (note: this code is currently duplicated in TemplateIO.cxx)
02355     Containment_t newContainment = containment;
02356     Charge_t      newCharge      = charge;
02357     Resolution_t  newResolution  = resolution;
02358     Topology_t    newTopology    = topology;
02359     ProtonTag_t   newProton      = proton;
02360     ElectronTag_t newElectron    = electron;
02361 
02362     if( Configuration::Instance()->DoingCombinationsInCalculator()==true ){
02363 
02364       if( Configuration::Instance()->UsingContainedVertexOnly()==true ){
02365         if( OscFit::GetContainmentType( containment )!=OscFit::kContainedVertex ){
02366           newContainment = OscFit::kNull;
02367         }
02368       }
02369   
02370       if( Configuration::Instance()->UsingHighResolutionOnly()==true ){
02371         if( OscFit::GetResolutionType( newResolution )!=OscFit::kHiRes ){
02372           newContainment = OscFit::kNull;
02373         }
02374       }
02375  
02376       if( OscFit::GetSource(run)==OscFit::kAtmosData 
02377        && Configuration::Instance()->UsingAtmosMuonNeutrinosOnly()==true ){
02378         if( flavour!=OscFit::kNumu ){
02379           newContainment = OscFit::kNull;
02380         }
02381       }
02382 
02383       if( OscFit::GetSource(run)==OscFit::kBeamData 
02384        && Configuration::Instance()->UsingBeamMuonNeutrinosOnly()==true ){
02385         if( flavour!=OscFit::kNumu ){
02386           newContainment = OscFit::kNull;
02387         }
02388       }
02389 
02390       if( OscFit::GetSource(run)==OscFit::kAtmosData 
02391        && Configuration::Instance()->UsingNewResolutionBinning()==true
02392        && OscFit::GetContainmentType( newContainment )==OscFit::kContainedVertex
02393        && flavour==OscFit::kNumu ){
02394 
02395         if( Configuration::Instance()->GetNumberOfNewResolutionBins()<8 ){
02396           if( newResolution==OscFit::kResBin5 ) newResolution=OscFit::kResBin1;
02397           if( newResolution==OscFit::kResBin6 ) newResolution=OscFit::kResBin2;
02398           if( newResolution==OscFit::kResBin7 ) newResolution=OscFit::kResBin3;
02399           if( newResolution==OscFit::kResBin8 ) newResolution=OscFit::kResBin4;
02400         }
02401      
02402         if( Configuration::Instance()->GetNumberOfNewResolutionBins()<4 ){
02403           if( newResolution==OscFit::kResBin3 ) newResolution=OscFit::kResBin1;
02404           if( newResolution==OscFit::kResBin4 ) newResolution=OscFit::kResBin2;
02405         }
02406 
02407         if( Configuration::Instance()->GetNumberOfNewResolutionBins()<2 ){
02408           if( newResolution==OscFit::kResBin2 ) newResolution=OscFit::kResBin1;
02409           if( newResolution==OscFit::kResBin1 ) newResolution=OscFit::kHiRes;
02410         }
02411        
02412         if( Configuration::Instance()->DiscardingWorstResolutionBin() ){
02413 
02414           if( Configuration::Instance()->GetNumberOfNewResolutionBins()>=8 ){
02415             if( newResolution==OscFit::kResBin8 ) newContainment = OscFit::kNull;
02416           }
02417           else if( Configuration::Instance()->GetNumberOfNewResolutionBins()>=4 ){
02418             if( newResolution==OscFit::kResBin4 ) newContainment = OscFit::kNull;
02419           }
02420           else if( Configuration::Instance()->GetNumberOfNewResolutionBins()>=2 ){
02421             if( newResolution==OscFit::kResBin2 ) newContainment = OscFit::kNull;
02422           }
02423         }
02424       }
02425 
02426       if( OscFit::GetSource(run)==OscFit::kAtmosData 
02427        && OscFit::GetContainmentType( newContainment )==OscFit::kContainedVertex
02428        && Configuration::Instance()->CombiningAtmosResBinsCV()==true ){
02429         newResolution = OscFit::GetResolutionType( resolution );
02430       }
02431 
02432       if( OscFit::GetSource(run)==OscFit::kAtmosData 
02433        && OscFit::GetContainmentType( newContainment )==OscFit::kRockMuon
02434        && Configuration::Instance()->CombiningAtmosResBinsRAF()==true ){
02435         newResolution = OscFit::GetResolutionType( resolution );
02436       }
02437  
02438       if( OscFit::GetSource(run)==OscFit::kBeamData 
02439        && OscFit::GetContainmentType( newContainment )==OscFit::kContainedVertex
02440        && Configuration::Instance()->CombiningResBins(run)==true ){
02441         newResolution = OscFit::GetResolutionType( resolution );
02442       }
02443 
02444       if( OscFit::GetSource(run)==OscFit::kAtmosData 
02445        && Configuration::Instance()->CombiningAtmosChargeBins()==true ){
02446         newCharge = OscFit::kNoCharge;
02447       }
02448 
02449       if( OscFit::GetSource(run)==OscFit::kBeamData 
02450        && Configuration::Instance()->CombiningBeamChargeBins()==true ){
02451         newCharge = OscFit::kNoCharge;
02452       }
02453 
02454       if( Configuration::Instance()->CombiningTopologies()==true ){
02455         newTopology = OscFit::kVanilla;
02456       }
02457 
02458       if( Configuration::Instance()->DoingProtonTagging()==false ){
02459         newProton = OscFit::kIgnoreProton;
02460       }
02461 
02462       if( Configuration::Instance()->DoingElectronTagging()==false ){
02463         newElectron = OscFit::kIgnoreElectron;
02464       }
02465 
02466       if( Configuration::Instance()->DoingPerfectChargeSeparation()==true ){
02467         std::cout << " *** Warning: Perfect Charge Separation will not be implemented *** " << std::endl;
02468       }
02469     }
02470 
02471     outputTemplate->Fill( run, newContainment, flavour, newCharge, 
02472                           newResolution, newTopology, newProton, newElectron,
02473                           hist );
02474   }
02475 
02476   return;
02477 }

void TemplateCalculator::CombineResBins ( Template *&  myTemplate  )  [private]

Definition at line 712 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Template::Add(), CombineResBins(), fTemplateLayer3, and OscFit::Template::Reset().

00713 {
00714   fTemplateLayer3->Reset();
00715   fTemplateLayer3->Add( myTemplate );
00716 
00717   return CombineResBins( fTemplateLayer3, myTemplate );
00718 }

void TemplateCalculator::CombineResBins ( Template inputTemplate,
Template *&  myTemplate 
) [private]

Definition at line 691 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Histogram::Add(), OscFit::GetBin(), OscFit::GetFirstResBin(), OscFit::Template::GetHistogram(), OscFit::GetLastResBin(), OscFit::GetNumBins(), OscFit::kResBin0, and OscFit::Template::Reset().

00692 {
00693   myTemplate->Reset();
00694 
00695   for( Int_t ibin=0; ibin<OscFit::GetNumBins(); ibin++ ){
00696     Bin_t inputBin = OscFit::GetBin(ibin);
00697 
00698     Bin_t myBin = inputBin;
00699     if( ibin>=OscFit::GetFirstResBin()
00700      && ibin<=OscFit::GetLastResBin() ){
00701       myBin = OscFit::kResBin0;
00702     }
00703 
00704     Histogram* inputHistogram = inputTemplate->GetHistogram(inputBin);
00705     Histogram* myHistogram    = myTemplate->GetHistogram(myBin);
00706     if( inputHistogram ) myHistogram->Add(inputHistogram);
00707   }
00708 
00709   return;
00710 }

void TemplateCalculator::CombineResBins ( Bool_t  yesno = 1  ) 

Definition at line 59 of file twoflavours/TemplateCalculator.cxx.

References fCombineResBins.

Referenced by CombineResBins(), GetData(), and GetExpectation().

00060 { 
00061   std::cout << " *** TemplateCalculator::CombineResBins(...) *** " << std::endl;
00062   std::cout << "  Combining Resolution Bins: "; if( yesno ) std::cout << "ON"; else std::cout << "OFF"; std::cout << std::endl;
00063 
00064   fCombineResBins = yesno; 
00065 }

void TemplateCalculator::CombineRuns ( Template inputTemplate,
Template *&  outputTemplate 
)

Definition at line 2292 of file TemplateCalculator.cxx.

References OscFit::Template::Fill(), OscFit::Template::GetHistogramAtIndex(), OscFit::Template::GetIndex(), OscFit::Template::GetNumHistograms(), OscFit::GetRunType(), OscFit::GetSource(), OscFit::Template::InvertID(), OscFit::kAntiNeutrino, OscFit::kBeamData, OscFit::kFHC, OscFit::kNeutrino, OscFit::kNothing, OscFit::kNull, OscFit::kRHC, OscFit::kUnknownCharge, OscFit::kUnknownElectronTag, OscFit::kUnknownFlavour, OscFit::kUnknownProtonTag, OscFit::kUnknownRes, OscFit::kUnknownRun, n, OscFit::Template::Reset(), and run().

02293 { 
02294   if( inputTemplate==0 ) return;
02295   
02296   outputTemplate->Reset();
02297 
02298   for( UInt_t n=0; n<inputTemplate->GetNumHistograms(); n++ ){
02299     Int_t      index = inputTemplate->GetIndex(n);
02300     Histogram* hist  = inputTemplate->GetHistogramAtIndex(index);
02301 
02302     Run_t         run         = kUnknownRun;
02303     Containment_t containment = kNull;
02304     Flavour_t     flavour     = kUnknownFlavour;
02305     Charge_t      charge      = kUnknownCharge;
02306     Resolution_t  resolution  = kUnknownRes;
02307     Topology_t    topology    = kNothing;
02308     ProtonTag_t   proton      = kUnknownProtonTag;
02309     ElectronTag_t electron    = kUnknownElectronTag;
02310 
02311     Template::InvertID( index,
02312                         run, containment, flavour, charge, 
02313                         resolution, topology, proton, electron );
02314 
02315     Run_t newRun = run;
02316 
02317     if( OscFit::GetSource(run)==kBeamData ){
02318       if( OscFit::GetRunType(run)==OscFit::kFHC ) newRun = kNeutrino;
02319       if( OscFit::GetRunType(run)==OscFit::kRHC ) newRun = kAntiNeutrino;
02320     }
02321 
02322     outputTemplate->Fill( newRun, containment, flavour, charge, 
02323                           resolution, topology, proton, electron,
02324                           hist );
02325   }
02326 
02327   return;
02328 }

void TemplateCalculator::FillCombinedBins ( Template inputTemplate,
Template *&  outputTemplate 
)

Definition at line 2479 of file TemplateCalculator.cxx.

References OscFit::Template::Fill(), OscFit::Template::GetHistogramAtIndex(), OscFit::Template::GetIndex(), OscFit::Template::GetNumHistograms(), OscFit::GetResolutionType(), OscFit::GetRunType(), OscFit::GetSource(), OscFit::Template::InvertID(), OscFit::kAntiNeutrino, OscFit::kAny, OscFit::kAtmosData, OscFit::kBeamData, OscFit::kFHC, OscFit::kHiRes, OscFit::kIgnoreElectron, OscFit::kIgnoreProton, OscFit::kNeutrino, OscFit::kNothing, OscFit::kNull, OscFit::kRHC, OscFit::kUnknownCharge, OscFit::kUnknownElectronTag, OscFit::kUnknownFlavour, OscFit::kUnknownProtonTag, OscFit::kUnknownRes, OscFit::kUnknownRun, OscFit::kVanilla, OscFit::Template::LoopFill(), n, OscFit::Template::Reset(), and run().

02480 { 
02481   if( inputTemplate==0 ) return;
02482   
02483   outputTemplate->Reset(); 
02484 
02485   for( UInt_t n=0; n<inputTemplate->GetNumHistograms(); n++ ){
02486     Int_t      index = inputTemplate->GetIndex(n);
02487     Histogram* hist  = inputTemplate->GetHistogramAtIndex(index);
02488 
02489     Run_t         run         = kUnknownRun;
02490     Containment_t containment = kNull;
02491     Flavour_t     flavour     = kUnknownFlavour;
02492     Charge_t      charge      = kUnknownCharge;
02493     Resolution_t  resolution  = kUnknownRes;
02494     Topology_t    topology    = kNothing;
02495     ProtonTag_t   proton      = kUnknownProtonTag;
02496     ElectronTag_t electron    = kUnknownElectronTag;
02497 
02498     Template::InvertID( index,
02499                         run, containment, flavour, charge, 
02500                         resolution, topology, proton, electron );
02501 
02502     // Fill old bins
02503     outputTemplate->Fill( run, containment, flavour, charge, 
02504                           resolution, topology, proton, electron,
02505                           hist );
02506 
02507     // Get new bins
02508     Run_t         newRun        = run; 
02509     Charge_t      newCharge     = charge;
02510     Topology_t    newTopology   = kVanilla;
02511     ProtonTag_t   newProton     = kIgnoreProton;
02512     ElectronTag_t newElectron   = kIgnoreElectron;
02513     Resolution_t  newResolution = OscFit::GetResolutionType( resolution );
02514 
02515     if( OscFit::GetSource(run)==kBeamData ){
02516       if( OscFit::GetRunType(run)==OscFit::kFHC ) newRun = kNeutrino;
02517       if( OscFit::GetRunType(run)==OscFit::kRHC ) newRun = kAntiNeutrino;
02518     }
02519 
02520     if( OscFit::GetSource(run)==kAtmosData ){
02521       if( newResolution==OscFit::kHiRes ) newCharge = kAny;
02522     }
02523 
02524     // Fill new bins (1)
02525     if( !( newRun==run ) ){
02526       outputTemplate->LoopFill( newRun, containment, flavour, charge, 
02527                             resolution, topology, proton, electron,
02528                             hist );
02529     }
02530 
02531     if( !( newCharge==charge ) ){
02532       outputTemplate->LoopFill( run, containment, flavour, newCharge, 
02533                             resolution, topology, proton, electron,
02534                             hist );
02535     }
02536 
02537     if( !( newResolution==resolution && newTopology==topology 
02538         && newProton==proton && newElectron==electron ) ){
02539       outputTemplate->LoopFill( run, containment, flavour, charge, 
02540                             newResolution, newTopology, newProton, newElectron,
02541                             hist );
02542     }
02543 
02544     // LoopFill new bins (2)
02545     if( !( newRun==run ) 
02546      && !( newCharge==charge ) ){
02547       outputTemplate->LoopFill( newRun, containment, flavour, newCharge, 
02548                             resolution, topology, proton, electron,
02549                             hist );
02550     }
02551 
02552     if( !( newCharge==charge ) 
02553      && !( newResolution==resolution && newTopology==topology 
02554         && newProton==proton && newElectron==electron ) ){
02555       outputTemplate->LoopFill( run, containment, flavour, newCharge, 
02556                             newResolution, newTopology, newProton, newElectron,
02557                             hist );
02558     }
02559 
02560     if( !( newRun==run ) 
02561      && !( newResolution==resolution && newTopology==topology 
02562         && newProton==proton && newElectron==electron ) ){
02563       outputTemplate->LoopFill( newRun, containment, flavour, charge, 
02564                             newResolution, newTopology, newProton, newElectron,
02565                             hist );
02566     }
02567 
02568     // Fill new bins (3)
02569     if( !( newRun==run )
02570      && !( newCharge==charge )  
02571      && !( newResolution==resolution && newTopology==topology 
02572         && newProton==proton && newElectron==electron ) ){
02573       outputTemplate->LoopFill( newRun, containment, flavour, newCharge, 
02574                             newResolution, newTopology, newProton, newElectron,
02575                             hist );
02576     }
02577 
02578   }
02579 
02580   return;
02581 }

void TemplateCalculator::GetCosmicBackground ( Template *&  myTemplate  ) 

Definition at line 203 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer0, GetExpectationForAtmosData(), OscFit::Template::Reset(), and UsingAtmosData().

00204 {
00205   // reset template
00206   myTemplate->Reset();
00207 
00208   // atmospheric neutrinos
00209   if( UsingAtmosData() ){
00210     GetExpectationForAtmosData(0, 0, 0, 0, 0, //
00211                                1, 1, 1, 1,    // cv, rock, nu, nubar
00212                                0, 0, 0, 0,    // nc, nue, numu, nutau
00213                                1,             // cosmic
00214                                0.0,  0.0,     // atmos_norm_cv,      atmos_norm_rock
00215                                0.0,  0.0,     // atmos_ratio_cv,     atmos_ratio_rock,
00216                                0.0,  0.0,     // atmos_norm_nue,     atmos_ratio_nue,
00217                                0.0,           // atmos_norm_nc,      
00218                                0.0,  0.0,     // atmos_spec_cv_numu, atmos_spec_cv_numubar,  
00219                                0.0,  0.0,     // atmos_spec_cv_nue,  atmos_spec_cv_nuebar,  
00220                                0.0,  0.0,     // atmos_spec_rock_nu, atmos_spec_rock_nubar,  
00221                                0.0,           // atmos_zenith 
00222                                0.0,  0.0,     // atmos_numu_trken,   atmos_numu_trken_exit,
00223                                0.0,  0.0,     // atmos_numu_shwen,   atmos_nue_energy   
00224                                fTemplateLayer0 );
00225     myTemplate->Add( fTemplateLayer0 );
00226   }
00227 
00228   // beam neutrinos
00229   // (neglect cosmic muon background...)
00230  
00231   return;                                 
00232 } 

void TemplateCalculator::GetData ( Run_t  run,
Template *&  myTemplate 
)

Definition at line 210 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Template::Add(), CombineResBins(), fCombineResBins, GetData(), Instance(), and OscFit::Template::Reset().

00211 {
00212   myTemplate->Reset();
00213 
00214   Template* theData = TemplateMap::Instance()->GetData(run);
00215 
00216   myTemplate->Add( theData );
00217 
00218   if( fCombineResBins ){
00219     CombineResBins( myTemplate );
00220   }
00221 
00222   return;
00223 }

void TemplateCalculator::GetData ( TemplateArray *&  myTemplateArray  ) 

Definition at line 67 of file twoflavours/TemplateCalculator.cxx.

References OscFit::TemplateArray::AddTemplate(), OscFit::Template::BuildHistograms(), fTemplateLayer0, GetData(), OscFit::GetNumRuns(), OscFit::GetRun(), OscFit::TemplateArray::GetTemplate(), OscFit::TemplateMap::Instance(), OscFit::TemplateArray::Reset(), and run().

00068 {
00069   // reset template array
00070   myTemplateArray->Reset();
00071 
00072   // loop over runs
00073   for( Int_t irun = 0; irun<OscFit::GetNumRuns(); irun++ ){
00074     Run_t run = OscFit::GetRun(irun);    
00075 
00076     // check for data
00077     if( TemplateMap::Instance()->TouchData(run)==0 ) continue;    
00078 
00079     // build new template
00080     fTemplateLayer0 = myTemplateArray->GetTemplate(run);
00081 
00082     if( fTemplateLayer0==0 ){
00083       fTemplateLayer0 = new Template();
00084       fTemplateLayer0->BuildHistograms();
00085       myTemplateArray->AddTemplate(run,fTemplateLayer0);
00086     }
00087 
00088     // generate template
00089     this->GetData(run,fTemplateLayer0);
00090   }
00091 
00092   return;
00093 }

void TemplateCalculator::GetData ( Template *&  myTemplate  ) 

Definition at line 92 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), OscFit::TemplateMap::GetTemplate(), OscFit::Configuration::Instance(), Instance(), OscFit::kAtmosData, OscFit::kBeamData, OscFit::kCentre, OscFit::kData, OscFit::kNoCharge, OscFit::kNoFlavour, OscFit::kNoShift, OscFit::Template::Reset(), UsingAtmosData(), and UsingBeamData().

Referenced by GetData(), and GetExperiment().

00093 {
00094   std::cout<<"TemplateCalculator::GetData"<<std::endl;
00095   // reset template
00096   myTemplate->Reset();
00097 
00098   // (no oscillations)
00099   TemplateMap* tempMap = 0;
00100 
00101   if( Configuration::Instance()->DoingDynamicLoading()==0 ){
00102     tempMap = TemplateGrid::Instance()->GetTemplate(0,0,0,0,0);
00103   }
00104   else{
00105     tempMap = TemplateReader::Instance()->GetTemplate(0,0,0,0,0);
00106   }
00107 
00108   // atmospheric neutrinos
00109   if( UsingAtmosData() ){
00110     Template* tempAtmos = tempMap->GetTemplate(kAtmosData,kData,kNoFlavour,kNoCharge,kCentre,kNoShift);
00111     myTemplate->Add( tempAtmos );
00112   }
00113 
00114   // beam neutrinos
00115   if( UsingBeamData() ){
00116     Template* tempBeam  = tempMap->GetTemplate(kBeamData,kData,kNoFlavour,kNoCharge,kCentre,kNoShift);
00117     myTemplate->Add( tempBeam );
00118   }
00119  
00120   return;
00121 }

void TemplateCalculator::GetDeltaExpectation ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Double_t  shift,
Template *&  myTemplate 
) [private]

Definition at line 658 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Template::Add(), Instance(), OscFit::Interpolate(), OscFit::kMinus1, OscFit::kMinus2, OscFit::kNoShift, OscFit::kPlus1, OscFit::kPlus2, and OscFit::Template::Reset().

00659 {
00660   myTemplate->Reset();  
00661 
00662   Template* temp_m2 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kMinus2);
00663   Template* temp_m1 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kMinus1);
00664   Template* temp_0  = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kNoShift);
00665   Template* temp_p1 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kPlus1);
00666   Template* temp_p2 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kPlus2);
00667 
00668   if( temp_m2 && temp_m1 && temp_p1 && temp_p2 ){
00669 
00670     Double_t w_m2 = 0.0;
00671     Double_t w_m1 = 0.0;
00672     Double_t w_0  = 1.0;
00673     Double_t w_p1 = 0.0;
00674     Double_t w_p2 = 0.0;
00675 
00676     if( temp_0 ){
00677       OscFit::Interpolate( shift,
00678                            w_m2, w_m1, w_0, w_p1, w_p2 );
00679     }
00680 
00681     myTemplate->Add( temp_m2, w_m2 );
00682     myTemplate->Add( temp_m1, w_m1 );
00683     myTemplate->Add( temp_0,  w_0-1.0  );
00684     myTemplate->Add( temp_p1, w_p1 );
00685     myTemplate->Add( temp_p2, w_p2 );
00686   }
00687 
00688   return;
00689 }

void TemplateCalculator::GetDeltaExpectation ( Int_t  nDmsq,
Int_t  nSinsq23,
Int_t  nSinsq13,
Int_t  nDeltaCP,
Int_t  nHierarchy,
Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Systematic_t  systematic,
Double_t  shift,
Template *&  myTemplate 
) [private]

Definition at line 2083 of file TemplateCalculator.cxx.

References OscFit::TemplateMap::GetTemplate(), OscFit::Configuration::Instance(), Instance(), OscFit::Interpolate(), OscFit::kCentre, OscFit::kCosmic, OscFit::kData, OscFit::kMinus1, OscFit::kMinus2, OscFit::kNoFlavour, OscFit::kNoShift, OscFit::kPlus1, OscFit::kPlus2, OscFit::Template::Reset(), OscFit::Template::SpecialAdd(), and OscFit::TemplateMap::TouchSystematics().

Referenced by GetExpectation().

02084 {
02085   myTemplate->Reset();  
02086   
02087   Int_t n0 = nDmsq;
02088   Int_t n1 = nSinsq23;
02089   Int_t n2 = nSinsq13;
02090   Int_t n3 = nDeltaCP;
02091   Int_t n4 = nHierarchy;
02092 
02093   // data or non-oscillating samples (use null oscillations)
02094   if( sample==kData || sample==kCosmic || flavour==kNoFlavour ){
02095     n0=0; n1=0; n2=0; n3=0; n4=0;
02096   }
02097 
02098   // two-flavour oscillations
02099   if( n0>0 && n1==0 && n2==0 && n3==0 && n4==0 ){
02100     n1=1; n2=1; n3=1; n4=1;
02101   }  
02102 
02103   // look up grid point
02104   TemplateMap* tempMap = 0;
02105 
02106   if( Configuration::Instance()->DoingDynamicLoading()==0 ){
02107     tempMap = TemplateGrid::Instance()->GetTemplate(n0,n1,n2,n3,n4);
02108   }
02109   else{
02110     tempMap = TemplateReader::Instance()->GetTemplate(n0,n1,n2,n3,n4);
02111   }
02112 
02113   // sanity check
02114   assert( tempMap );
02115  
02116   // Print Warning if there are no systematics
02117   if( tempMap->TouchSystematics()==0 ){
02118     std::cout << "   <Warning>: Systematics requested, but not loaded. " << std::endl
02119               << "              Reverting to no systematics." << std::endl;
02120   }
02121 
02122   // get systematic shifts
02123   Template* temp_m2 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kMinus2);
02124   Template* temp_m1 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kMinus1);
02125   Template* temp_0  = tempMap->GetTemplate(source,sample,flavour,charge,kCentre,kNoShift);
02126   Template* temp_p1 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kPlus1);
02127   Template* temp_p2 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kPlus2); 
02128 
02129   // run interpolation
02130   if( temp_m2 && temp_m1 && temp_p1 && temp_p2 ){
02131 
02132     Double_t w_m2 = 0.0;
02133     Double_t w_m1 = 0.0;
02134     Double_t w_0  = 1.0;
02135     Double_t w_p1 = 0.0;
02136     Double_t w_p2 = 0.0;
02137 
02138     if( temp_0 ){
02139       OscFit::Interpolate( shift,
02140                            w_m2, w_m1, w_0, w_p1, w_p2 );
02141     }
02142 
02143     myTemplate->SpecialAdd( temp_0, temp_m2, w_m2 );
02144     myTemplate->SpecialAdd( temp_0, temp_m1, w_m1 );
02145     myTemplate->SpecialAdd( temp_0, temp_0,  w_0-1.0  );
02146     myTemplate->SpecialAdd( temp_0, temp_p1, w_p1 );
02147     myTemplate->SpecialAdd( temp_0, temp_p2, w_p2 );
02148   }
02149 
02150   return;
02151 } 

void TemplateCalculator::GetExpectation ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Double_t  shift,
Template *&  myTemplate 
) [private]

Definition at line 625 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Template::Add(), Instance(), OscFit::Interpolate(), OscFit::kMinus1, OscFit::kMinus2, OscFit::kNoShift, OscFit::kPlus1, OscFit::kPlus2, and OscFit::Template::Reset().

00626 {
00627   myTemplate->Reset();  
00628   
00629   Template* temp_m2 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kMinus2);
00630   Template* temp_m1 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kMinus1);
00631   Template* temp_0  = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kNoShift);
00632   Template* temp_p1 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kPlus1);
00633   Template* temp_p2 = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,systematic,kPlus2);
00634 
00635   if( temp_0 ){
00636 
00637     Double_t w_m2 = 0.0;
00638     Double_t w_m1 = 0.0;
00639     Double_t w_0  = 1.0;
00640     Double_t w_p1 = 0.0;
00641     Double_t w_p2 = 0.0;
00642 
00643     if( temp_m2 && temp_m1 && temp_p1 && temp_p2 ){
00644       OscFit::Interpolate( shift,
00645                            w_m2, w_m1, w_0, w_p1, w_p2 );
00646     }
00647 
00648     myTemplate->Add( temp_m2, w_m2 );
00649     myTemplate->Add( temp_m1, w_m1 );
00650     myTemplate->Add( temp_0,  w_0  );
00651     myTemplate->Add( temp_p1, w_p1 );
00652     myTemplate->Add( temp_p2, w_p2 );
00653   }
00654 
00655   return;
00656 }

void TemplateCalculator::GetExpectation ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
Template *&  myTemplate 
) [private]

Definition at line 575 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer2, GetDeltaExpectation(), GetExpectation(), OscFit::GetNumSystematics(), OscFit::kNCbkg, OscFit::kShwEn, OscFit::kTrkEn, and OscFit::Template::Reset().

00576 {
00577   // reset template
00578   myTemplate->Reset();
00579 
00580   // Central Prediction
00581   GetExpectation(n,run,sample,interaction,fTemplateLayer2);  
00582   myTemplate->Add( fTemplateLayer2 );
00583 
00584   // Increment from NC Background
00585   if( ncbkg !=0 ){
00586     GetDeltaExpectation(n,run,sample,interaction, 
00587                         OscFit::kNCbkg,ncbkg,fTemplateLayer2);
00588     myTemplate->Add( fTemplateLayer2 );
00589   }
00590 
00591   // Increment from Shower Energy
00592   if( shwen !=0 ){
00593     GetDeltaExpectation(n,run,sample,interaction, 
00594                         OscFit::kShwEn,shwen,fTemplateLayer2);
00595     myTemplate->Add( fTemplateLayer2 );
00596   }
00597   
00598   // Increment from Track Energy
00599   if( trken !=0 ){
00600     GetDeltaExpectation(n,run,sample,interaction, 
00601                         OscFit::kTrkEn,trken,fTemplateLayer2);
00602     myTemplate->Add( fTemplateLayer2 );
00603   }
00604 
00605   // Other Systematics Go Here
00606   if( OscFit::GetNumSystematics()>3 ){ // NCBkg, ShwEn, TrkEn
00607     std::cout << " <warning> not accounting for all systematics - abort! " << std::endl;
00608     assert(0);
00609   }
00610 
00611   return;
00612 }

void TemplateCalculator::GetExpectation ( Int_t  n,
Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Template *&  myTemplate 
) [private]

Definition at line 614 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Template::Add(), Instance(), OscFit::kCentre, OscFit::kNoShift, and OscFit::Template::Reset().

00615 {
00616   myTemplate->Reset();
00617 
00618   Template* temp = TemplateMap::Instance()->GetTemplate(n,run,sample,interaction,
00619                                                         OscFit::kCentre,OscFit::kNoShift);
00620   myTemplate->Add( temp );
00621 
00622   return;
00623 }

void TemplateCalculator::GetExpectation ( Run_t  run,
Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Bool_t  cv,
Bool_t  cvtau,
Bool_t  rock,
Bool_t  rocktau,
Bool_t  ccnu,
Bool_t  ccnubar,
Bool_t  nc,
Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
Template *&  myTemplate 
)

Definition at line 273 of file twoflavours/TemplateCalculator.cxx.

References OscFit::Template::Add(), CombineResBins(), fCombineResBins, fTemplateLayer1, GetExpectation(), OscFit::GetNormError(), Instance(), OscFit::TemplateMap::Instance(), OscFit::kCCnu, OscFit::kCCnubar, OscFit::kCV, OscFit::kCVTau, OscFit::kNC, OscFit::kRock, OscFit::kRockTau, n, and OscFit::Template::Reset().

00274 {
00275   // reset template
00276   myTemplate->Reset();
00277 
00278   // Take Absolute Value of Dm2
00279   // --------------------------
00280   Double_t input_dmsq = fabs(dmsq);
00281   Double_t input_dmsqbar = fabs(dmsqbar);
00282 
00283   // Check for Oscillations
00284   // ----------------------
00285   Bool_t checkNuOsc = 0;    if( input_dmsq>0.0 ) checkNuOsc = 1;
00286   Bool_t checkNuBarOsc = 0; if( input_dmsqbar>0.0 ) checkNuBarOsc = 1;
00287 
00288   // Print Warning if there is no Grid
00289   // ---------------------------------
00290   if( (checkNuOsc||checkNuBarOsc)
00291    && (TemplateMap::Instance()->TouchGrid()==0) ){
00292     std::cout << "   <Warning>: Oscillated spectra requested, but no grid loaded. " << std::endl
00293               << "              Reverting to null oscillations [Return] " << std::endl;
00294   }
00295 
00296   // Dm2        bin,  weight   | bin,    weight
00297   // ------------------------------------------
00298   // dmsq    -> n,    alpha    | n+1,    1.0-alpha
00299   // dmsqbar -> nbar, alphabar | nbar+1, 1.0-alphabar
00300 
00301   Double_t interp_n    = TemplateMap::Instance()->GetInterpolatedPoint(input_dmsq);
00302   Double_t interp_nbar = TemplateMap::Instance()->GetInterpolatedPoint(input_dmsqbar);
00303 
00304   Int_t N = TemplateMap::Instance()->GetNumPoints();
00305 
00306   Int_t n = (Int_t)(TMath::Floor(interp_n));    
00307   if( n<1 ) n = 1; if( n>N ) n = N;
00308 
00309   Int_t nbar = (Int_t)(TMath::Floor(interp_nbar)); 
00310   if( nbar<1 ) nbar = 1; if( nbar>N ) nbar = N;
00311 
00312   Double_t y    = TMath::Floor(interp_n) - TMath::Floor(n);
00313   Double_t ybar = TMath::Floor(interp_nbar) - TMath::Floor(nbar);
00314 
00315   Double_t x    = interp_n - TMath::Floor(interp_n);
00316   Double_t xbar = interp_nbar - TMath::Floor(interp_nbar);
00317 
00318   // Interpolation between [0] and [n]
00319   // ---------------------------------
00320   // [0] corresponds to: 1
00321   // [n] corresponds to: 1-S, where: S=sin^2(1.267*dmsq*L/E)
00322   //   => 1*[0] - sinsq*[0] + sinsq*[n]
00323   //       = (1-sinsq) + sinsq*(1-S) = 1-sinsq*S   
00324   // Therefore, for an oscillation probability 1-sinsq*S, 
00325   // need to weight [0] by (1-sinsq), and [n] by sinsq.
00326 
00327   // Interpolation between [n] and [n+1]
00328   // -----------------------------------
00329   // Require y to be continuous at bounadries:
00330   //   y: (0,0) -> (0.5,0.5) -> (1,1)
00331   // Also, prefer dy/dx to be continuous at boundaries.
00332   // Using [n] and [n+1] only, can do this as follows;
00333   //   dy/dx: (0,0) -> (0.5,1+epsilon) -> (1,0)
00334   // This ensures continuous dlogL/dx(=0) at boundaries.
00335   // Potentially, can do better by interpolating between 
00336   // [n-1], [n], [n+1], [n+2], and not just [n], [n+1].
00337 
00338   // Quadratic Interpolation
00339   // (Gives dy/dx=0 at boundaries)
00340   //  y = 3*x*x*(1-(2/3)*x)
00341   // -----------------------
00342   // Double_t w = 3.0*x*x*( 1.0 - (2.0/3.0)*x );
00343   // Double_t wbar = 3.0*xbar*xbar*( 1.0 - (2.0/3.0)*xbar );
00344 
00345   // Truncated Linear Interpolation
00346   // (Gives dy/dx=0 at boundaries)
00347   //  y = ( (1+2*d)*x + d*(-1+exp(-x/L)-exp(-(1-x)/L)+exp(-1/L)) ) / (1+2*d*exp(-1/L))
00348   //  where: L = d/(1+2*d) and d << 1
00349   // ---------------------------------
00350   // Double_t d = 0.25;
00351   // Double_t L = d/(1+2.0*d);
00352   // Double_t w = ((1+2*d)*x + d*(-1+exp(-x/L)-exp(-(1-x)/L)+exp(-1/L)))/(1+2*d*exp(-1/L));
00353   // Double_t wbar = ((1+2*d)*xbar + d*(-1+exp(-xbar/L)-exp(-(1-xbar)/L)+exp(-1/L)))/(1+2*d*exp(-1/L));
00354   
00355   // Simple Linear Interpolation
00356   // (Don't worry about dy/dx at boundaries!)
00357   //  y = x 
00358   // -------
00359   Double_t w = x;
00360   Double_t wbar = xbar;
00361 
00362   Double_t alpha    = -y + 1.0 - w;
00363   Double_t alphabar = -ybar + 1.0 - wbar;
00364 
00365   // Normalisation
00366   // -------------
00367   Double_t Norm  = norm  * OscFit::GetNormError();
00368 
00369   // CV NC
00370   // -----
00371   if( cv && nc ){
00372     GetExpectation( 0, run, OscFit::kCV, OscFit::kNC, 
00373                     ncbkg, shwen, trken,
00374                     fTemplateLayer1 );
00375     myTemplate->Add( fTemplateLayer1, (1.0+Norm) );  // assume that (1.0+NCBkg) term is
00376   }                                                  // already included in templates
00377 
00378   // CV CCnu
00379   // -------
00380   if( cv && ccnu ){
00381     GetExpectation( 0, run, OscFit::kCV, OscFit::kCCnu, 
00382                     ncbkg, shwen, trken,
00383                     fTemplateLayer1 );
00384     myTemplate->Add( fTemplateLayer1, (1.0+Norm) );
00385 
00386     // oscillations
00387     if( checkNuOsc
00388      && TemplateMap::Instance()->TouchGrid() ){
00389       GetExpectation( 0, run, OscFit::kCV, OscFit::kCCnu, 
00390                       ncbkg, shwen, trken,
00391                       fTemplateLayer1 );
00392       myTemplate->Add( fTemplateLayer1, (1.0+Norm)*(0.0-sinsq) );
00393 
00394       GetExpectation( n, run, OscFit::kCV, OscFit::kCCnu, 
00395                       ncbkg, shwen, trken,
00396                       fTemplateLayer1 );
00397       myTemplate->Add( fTemplateLayer1, alpha*(1.0+Norm)*sinsq );
00398 
00399       GetExpectation( n+1, run, OscFit::kCV, OscFit::kCCnu, 
00400                       ncbkg, shwen, trken,
00401                       fTemplateLayer1 );
00402       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*(1.0+Norm)*sinsq );
00403     }
00404   }
00405 
00406   // CV CCnubar
00407   // ----------
00408   if( cv && ccnubar ){
00409     GetExpectation( 0, run, OscFit::kCV, OscFit::kCCnubar, 
00410                     ncbkg, shwen, trken,
00411                     fTemplateLayer1 );
00412     myTemplate->Add( fTemplateLayer1, (1.0+Norm) );
00413 
00414     // oscillations
00415     if( checkNuBarOsc
00416      && TemplateMap::Instance()->TouchGrid() ){
00417       GetExpectation( 0, run, OscFit::kCV, OscFit::kCCnubar, 
00418                       ncbkg, shwen, trken,
00419                       fTemplateLayer1 );
00420       myTemplate->Add( fTemplateLayer1, (1.0+Norm)*(0.0-sinsqbar) );
00421 
00422       GetExpectation( nbar, run, OscFit::kCV, OscFit::kCCnubar, 
00423                       ncbkg, shwen, trken, 
00424                       fTemplateLayer1 );
00425       myTemplate->Add( fTemplateLayer1, alphabar*(1.0+Norm)*sinsqbar );
00426 
00427       GetExpectation( nbar+1, run, OscFit::kCV, OscFit::kCCnubar, 
00428                       ncbkg, shwen, trken,  
00429                       fTemplateLayer1 );
00430       myTemplate->Add( fTemplateLayer1, (1.0-alphabar)*(1.0+Norm)*sinsqbar );
00431     }
00432   }
00433 
00434   // Rock NC
00435   // -------
00436   if( rock && nc ){
00437     GetExpectation( 0, run, OscFit::kRock, OscFit::kNC, 
00438                     ncbkg, shwen, trken,
00439                     fTemplateLayer1 );
00440     myTemplate->Add( fTemplateLayer1, (1.0+Norm) );  // assume that (1.0+NCBkg) term is
00441   }                                                  // already included in templates
00442 
00443   // Rock CCnu
00444   // ---------
00445   if( rock && ccnu ){
00446     GetExpectation( 0, run, OscFit::kRock, OscFit::kCCnu, 
00447                     ncbkg, shwen, trken,  
00448                     fTemplateLayer1 );
00449     myTemplate->Add( fTemplateLayer1, (1.0+Norm) );
00450 
00451     // oscillations
00452     if( checkNuOsc
00453      && TemplateMap::Instance()->TouchGrid() ){
00454       GetExpectation( 0, run, OscFit::kRock, OscFit::kCCnu, 
00455                       ncbkg, shwen, trken,  
00456                       fTemplateLayer1 );
00457       myTemplate->Add( fTemplateLayer1, (1.0+Norm)*(0.0-sinsq) );
00458 
00459       GetExpectation( n, run, OscFit::kRock, OscFit::kCCnu, 
00460                       ncbkg, shwen, trken,   
00461                       fTemplateLayer1 );
00462       myTemplate->Add( fTemplateLayer1, alpha*(1.0+Norm)*sinsq );
00463 
00464       GetExpectation( n+1, run, OscFit::kRock, OscFit::kCCnu, 
00465                       ncbkg, shwen, trken,  
00466                       fTemplateLayer1 );
00467       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*(1.0+Norm)*sinsq );
00468     }
00469   }
00470 
00471   // Rock CCnubar
00472   // ------------
00473   if( rock && ccnubar ){
00474     GetExpectation( 0, run, OscFit::kRock, OscFit::kCCnubar, 
00475                     ncbkg, shwen, trken,  
00476                     fTemplateLayer1 );
00477     myTemplate->Add( fTemplateLayer1, (1.0+Norm) );
00478 
00479     // oscillations
00480     if( checkNuBarOsc
00481      && TemplateMap::Instance()->TouchGrid() ){
00482       GetExpectation( 0, run, OscFit::kRock, OscFit::kCCnubar, 
00483                       ncbkg, shwen, trken,  
00484                       fTemplateLayer1 );
00485       myTemplate->Add( fTemplateLayer1, (1.0+Norm)*(0.0-sinsqbar) );
00486 
00487       GetExpectation( nbar, run, OscFit::kRock, OscFit::kCCnubar, 
00488                       ncbkg, shwen, trken,  
00489                       fTemplateLayer1 );
00490       myTemplate->Add( fTemplateLayer1, alphabar*(1.0+Norm)*sinsqbar );
00491 
00492       GetExpectation( nbar+1, run, OscFit::kRock, OscFit::kCCnubar, 
00493                       ncbkg, shwen, trken,  
00494                       fTemplateLayer1 );
00495       myTemplate->Add( fTemplateLayer1, (1.0-alphabar)*(1.0+Norm)*sinsqbar );
00496     }
00497   }
00498 
00499   // CVTau CCnu (with no systematics)
00500   // --------------------------------
00501   if( cvtau && ccnu ){
00502  
00503     // oscillations
00504     if( checkNuOsc
00505      && TemplateMap::Instance()->TouchGrid() ){
00506       GetExpectation( n, run, OscFit::kCVTau, OscFit::kCCnu, 
00507                       fTemplateLayer1 );
00508       myTemplate->Add( fTemplateLayer1, alpha*(1.0+Norm)*sinsq );
00509 
00510       GetExpectation( n+1, run, OscFit::kCVTau, OscFit::kCCnu, 
00511                       fTemplateLayer1 );
00512       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*(1.0+Norm)*sinsq );
00513     }
00514   }
00515 
00516   // CVTau CCnubar (with no systematics)
00517   // -----------------------------------
00518   if( cvtau && ccnubar ){
00519 
00520     // oscillations
00521     if( checkNuBarOsc
00522      && TemplateMap::Instance()->TouchGrid() ){
00523       GetExpectation( nbar, run, OscFit::kCVTau, OscFit::kCCnubar,  
00524                       fTemplateLayer1 );
00525       myTemplate->Add( fTemplateLayer1, alphabar*(1.0+Norm)*sinsqbar );
00526 
00527       GetExpectation( nbar+1, run, OscFit::kCVTau, OscFit::kCCnubar, 
00528                       fTemplateLayer1 );
00529       myTemplate->Add( fTemplateLayer1, (1.0-alphabar)*(1.0+Norm)*sinsqbar );
00530     }
00531   }
00532 
00533   // RockTau CCnu (with no systematics)
00534   // ----------------------------------
00535   if( rocktau && ccnu ){
00536  
00537     // oscillations
00538     if( checkNuOsc
00539      && TemplateMap::Instance()->TouchGrid() ){
00540       GetExpectation( n, run, OscFit::kRockTau, OscFit::kCCnu, 
00541                       fTemplateLayer1 );
00542       myTemplate->Add( fTemplateLayer1, alpha*(1.0+Norm)*sinsq );
00543 
00544       GetExpectation( n+1, run, OscFit::kRockTau, OscFit::kCCnu, 
00545                       fTemplateLayer1 );
00546       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*(1.0+Norm)*sinsq );
00547     }
00548   }
00549 
00550   // RockTau CCnubar (with no systematics)
00551   // -------------------------------------
00552   if( rocktau && ccnubar ){
00553 
00554     // oscillations
00555     if( checkNuBarOsc
00556      && TemplateMap::Instance()->TouchGrid() ){
00557       GetExpectation( nbar, run, OscFit::kRockTau, OscFit::kCCnubar,  
00558                       fTemplateLayer1 );
00559       myTemplate->Add( fTemplateLayer1, alphabar*(1.0+Norm)*sinsqbar );
00560 
00561       GetExpectation( nbar+1, run, OscFit::kRockTau, OscFit::kCCnubar, 
00562                       fTemplateLayer1 );
00563       myTemplate->Add( fTemplateLayer1, (1.0-alphabar)*(1.0+Norm)*sinsqbar );
00564     }
00565   }
00566 
00567   // Combine Resolution Bins
00568   if( fCombineResBins ){
00569     CombineResBins( myTemplate );
00570   }
00571 
00572   return;
00573 }

void TemplateCalculator::GetExpectation ( Run_t  run,
Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
Template *&  myTemplate 
)

Definition at line 262 of file twoflavours/TemplateCalculator.cxx.

References GetExpectation().

00263 {
00264   return GetExpectation(run,
00265                         dmsq,sinsq,dmsqbar,sinsqbar,
00266                         1,1,1,1,            // cv,   cvtau,   rock, rocktau  
00267                         1,1,1,              // ccnu, ccnubar, nc
00268                         norm,ncbkg,         // norm,  ncbkg
00269                         shwen,trken,        // shwen, trken
00270                         myTemplate);
00271 }

void TemplateCalculator::GetExpectation ( Run_t  run,
Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Template *&  myTemplate 
)

Definition at line 253 of file twoflavours/TemplateCalculator.cxx.

References GetExpectation().

00254 {
00255   return GetExpectation(run,
00256                         dmsq,sinsq,dmsqbar,sinsqbar,
00257                         0.0,0.0,
00258                         0.0,0.0,
00259                         myTemplate);
00260 }

void TemplateCalculator::GetExpectation ( Run_t  run,
Template *&  myTemplate 
)

Definition at line 245 of file twoflavours/TemplateCalculator.cxx.

References GetExpectation().

00246 {
00247   return GetExpectation(run,
00248                         0.0,0.0,
00249                         0.0,0.0,
00250                         myTemplate);
00251 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Bool_t  cv,
Bool_t  cvtau,
Bool_t  rock,
Bool_t  rocktau,
Bool_t  ccnu,
Bool_t  ccnubar,
Bool_t  nc,
Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
TemplateArray *&  myTemplateArray 
)

Definition at line 112 of file twoflavours/TemplateCalculator.cxx.

References OscFit::TemplateArray::AddTemplate(), OscFit::Template::BuildHistograms(), fTemplateLayer0, GetExpectation(), OscFit::GetNumRuns(), OscFit::GetRun(), OscFit::TemplateArray::GetTemplate(), OscFit::TemplateMap::Instance(), OscFit::TemplateArray::Reset(), and run().

00113 {
00114   // reset template array
00115   myTemplateArray->Reset();
00116   
00117   // loop over runs
00118   for( Int_t irun = 0; irun<OscFit::GetNumRuns(); irun++ ){
00119     Run_t run = OscFit::GetRun(irun);  
00120 
00121     // check for MC  
00122     if( TemplateMap::Instance()->TouchMC(run)==0 ) continue;    
00123 
00124     // build new template
00125     fTemplateLayer0 = myTemplateArray->GetTemplate(run); 
00126 
00127     if( fTemplateLayer0==0 ){
00128       fTemplateLayer0 = new Template();
00129       fTemplateLayer0->BuildHistograms();
00130       myTemplateArray->AddTemplate(run,fTemplateLayer0);
00131     }
00132 
00133     // generate template
00134     this->GetExpectation(run,
00135                          dmsq,sinsq,
00136                          dmsqbar,sinsqbar,
00137                          cv,cvtau,rock,rocktau,
00138                          ccnu,ccnubar,nc, 
00139                          norm,ncbkg,
00140                          shwen,trken,
00141                          fTemplateLayer0); 
00142   }
00143 
00144   return;
00145 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
TemplateArray *&  myTemplateArray 
)

Definition at line 102 of file twoflavours/TemplateCalculator.cxx.

References GetExpectation().

00103 {
00104   return GetExpectation(dmsq, sinsq, dmsqbar, sinsqbar,
00105                         1,1,1,1,            // cv,   cvtau,   rock, rocktau
00106                         1,1,1,              // ccnu, ccnubar, nc
00107                         norm,ncbkg,         // norm,  ncbkg
00108                         shwen,trken,        // shwen, trken
00109                         myTemplateArray);
00110 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
TemplateArray *&  myTemplateArray 
)

Definition at line 95 of file twoflavours/TemplateCalculator.cxx.

References GetExpectation().

00096 {
00097   return GetExpectation(dmsq, sinsq, dmsqbar, sinsqbar,
00098                         0.0, 0.0, 0.0, 0.0,
00099                         myTemplateArray);
00100 }

void TemplateCalculator::GetExpectation ( Int_t  nDmsq,
Int_t  nSinsq23,
Int_t  nSinsq13,
Int_t  nDeltaCP,
Int_t  nHierarchy,
Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Systematic_t  systematic,
Double_t  shift,
Template *&  myTemplate 
) [private]

Definition at line 2010 of file TemplateCalculator.cxx.

References OscFit::TemplateMap::GetTemplate(), OscFit::TemplateGrid::Instance(), OscFit::Configuration::Instance(), Instance(), OscFit::Interpolate(), OscFit::kCentre, OscFit::kCosmic, OscFit::kData, OscFit::kMinus1, OscFit::kMinus2, OscFit::kNoFlavour, OscFit::kNoShift, OscFit::kPlus1, OscFit::kPlus2, OscFit::Template::Reset(), OscFit::Template::SpecialAdd(), and OscFit::TemplateMap::TouchSystematics().

02011 {
02012   myTemplate->Reset();  
02013   
02014   Int_t n0 = nDmsq;
02015   Int_t n1 = nSinsq23;
02016   Int_t n2 = nSinsq13;
02017   Int_t n3 = nDeltaCP;
02018   Int_t n4 = nHierarchy;
02019 
02020   // data or non-oscillating samples (use null oscillations)
02021   if( sample==kData || sample==kCosmic || flavour==kNoFlavour ){
02022     n0=0; n1=0; n2=0; n3=0; n4=0;
02023   }
02024 
02025   // two-flavour oscillations
02026   if( n0>0 && n1==0 && n2==0 && n3==0 && n4==0 ){
02027     n1=1; n2=1; n3=1; n4=1;
02028   }
02029 
02030   // look up grid point
02031   TemplateMap* tempMap = 0;
02032 
02033   if( Configuration::Instance()->DoingDynamicLoading()==0 ){
02034     tempMap = TemplateGrid::Instance()->GetTemplate(n0,n1,n2,n3,n4);
02035   }
02036   else{
02037     if( TemplateGrid::Instance()->GetNumTemplates()>Configuration::Instance()->GetMaximumLoad() )
02038       TemplateGrid::Instance()->UnloadTemplates();
02039 
02040     tempMap = TemplateReader::Instance()->GetTemplate(n0,n1,n2,n3,n4);
02041   }
02042 
02043   // sanity check
02044   assert( tempMap );
02045 
02046   // Print Warning if there are no systematics
02047   if( tempMap->TouchSystematics()==0 ){
02048     std::cout << "   <Warning>: Systematics requested, but not loaded. " << std::endl
02049               << "              Reverting to no systematics." << std::endl;
02050   }
02051 
02052   // get systematic shifts
02053   Template* temp_m2 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kMinus2);
02054   Template* temp_m1 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kMinus1);
02055   Template* temp_0  = tempMap->GetTemplate(source,sample,flavour,charge,kCentre,kNoShift);
02056   Template* temp_p1 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kPlus1);
02057   Template* temp_p2 = tempMap->GetTemplate(source,sample,flavour,charge,systematic,kPlus2);
02058 
02059   // run interpolation
02060   if( temp_0 ){
02061 
02062     Double_t w_m2 = 0.0;
02063     Double_t w_m1 = 0.0;
02064     Double_t w_0  = 1.0;
02065     Double_t w_p1 = 0.0;
02066     Double_t w_p2 = 0.0;
02067 
02068     if( temp_m2 && temp_m1 && temp_p1 && temp_p2 ){
02069       OscFit::Interpolate( shift,
02070                            w_m2, w_m1, w_0, w_p1, w_p2 );
02071     }
02072 
02073     myTemplate->SpecialAdd( temp_0, temp_m2, w_m2 );
02074     myTemplate->SpecialAdd( temp_0, temp_m1, w_m1 );
02075     myTemplate->SpecialAdd( temp_0, temp_0,  w_0  );
02076     myTemplate->SpecialAdd( temp_0, temp_p1, w_p1 );
02077     myTemplate->SpecialAdd( temp_0, temp_p2, w_p2 );
02078   }
02079 
02080   return;
02081 }

void TemplateCalculator::GetExpectation ( Int_t  nDmsq,
Int_t  nSinsq23,
Int_t  nSinsq13,
Int_t  nDeltaCP,
Int_t  nHierarchy,
Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
Double_t  trken_exit,
Double_t  spec,
Double_t  zenith,
Double_t  nuencbkg,
Double_t  nueenergy,
Template *&  myTemplate 
) [private]

Definition at line 1874 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer3, GetDeltaExpectation(), GetExpectation(), OscFit::GetNumSystematics(), OscFit::kNCbkg, OscFit::kNueEnergy, OscFit::kNueNCbkg, OscFit::kShwEn, OscFit::kSpec, OscFit::kTrkEn, OscFit::kTrkEnExit, OscFit::kZenith, and OscFit::Template::Reset().

01875 {
01876   // reset template
01877   myTemplate->Reset();
01878 
01879   // Central Prediction
01880   GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01881                   source, sample, flavour, charge,
01882                   fTemplateLayer3 );  
01883   myTemplate->Add( fTemplateLayer3 );
01884 
01885   // Increment from Numu NC Background
01886   if( ncbkg !=0 ){
01887     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01888                          source, sample, flavour, charge,
01889                          OscFit::kNCbkg, ncbkg,
01890                          fTemplateLayer3 );
01891     myTemplate->Add( fTemplateLayer3 );
01892   }
01893 
01894   // Increment from Hadronic Energy
01895   if( shwen !=0 ){
01896     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01897                          source, sample, flavour, charge,
01898                          OscFit::kShwEn, shwen,
01899                          fTemplateLayer3 );
01900     myTemplate->Add( fTemplateLayer3 );
01901   }
01902   
01903   // Increment from Muon Energy (Stopping)
01904   if( trken !=0 ){
01905     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01906                          source, sample, flavour, charge,
01907                          OscFit::kTrkEn, trken,
01908                          fTemplateLayer3 );
01909     myTemplate->Add( fTemplateLayer3 );
01910   }
01911 
01912   // Increment from Muon Energy (Exiting)
01913   if( trken_exit !=0 ){
01914     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01915                          source, sample, flavour, charge,
01916                          OscFit::kTrkEnExit, trken_exit,
01917                          fTemplateLayer3 );
01918     myTemplate->Add( fTemplateLayer3 );
01919   }
01920 
01921   // Increment from Spectrum
01922   if( spec !=0 ){
01923     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01924                          source, sample, flavour, charge,
01925                          OscFit::kSpec, spec,
01926                          fTemplateLayer3 );
01927     myTemplate->Add( fTemplateLayer3 );
01928   }
01929 
01930   // Increment from Zenith Angle
01931   if( zenith !=0 ){
01932     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01933                          source, sample, flavour, charge,
01934                          OscFit::kZenith, zenith,
01935                          fTemplateLayer3 );
01936     myTemplate->Add( fTemplateLayer3 );
01937   }
01938 
01939   // Increment from Nue NC Background
01940   if( nuencbkg !=0 ){
01941     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01942                          source, sample, flavour, charge,
01943                          OscFit::kNueNCbkg, nuencbkg,
01944                          fTemplateLayer3 );
01945     myTemplate->Add( fTemplateLayer3 );
01946   }
01947 
01948   // Increment from Electromagnetic Energy
01949   if( nueenergy !=0 ){
01950     GetDeltaExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy,
01951                          source, sample, flavour, charge,
01952                          OscFit::kNueEnergy, nueenergy,
01953                          fTemplateLayer3 );
01954     myTemplate->Add( fTemplateLayer3 );
01955   }
01956 
01957   // Other Systematics Go Here
01958   if( OscFit::GetNumSystematics()-1>8 ){ // (0) Centre, (1) NCbkg, (2) ShwEn,  (3) TrkEn,    (4) TrkEnExit, 
01959                                          //             (5) Spec,  (6) Zenith, (7) NueNCbkg, (8) NueEnergy
01960     std::cout << " <warning> not accounting for all systematics - abort! " << std::endl;
01961     assert(0);
01962   }
01963 
01964   return;
01965 }   

void TemplateCalculator::GetExpectation ( Int_t  nDmsq,
Int_t  nSinsq23,
Int_t  nSinsq13,
Int_t  nDeltaCP,
Int_t  nHierarchy,
Source_t  source,
Sample_t  sample,
Flavour_t  flavour,
Charge_t  charge,
Template *&  myTemplate 
) [private]

Definition at line 1967 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), OscFit::TemplateMap::GetTemplate(), OscFit::TemplateGrid::Instance(), OscFit::Configuration::Instance(), Instance(), OscFit::kCentre, OscFit::kCosmic, OscFit::kData, OscFit::kNoFlavour, OscFit::kNoShift, and OscFit::Template::Reset().

01968 {
01969   myTemplate->Reset();  
01970   
01971   Int_t n0 = nDmsq;
01972   Int_t n1 = nSinsq23;
01973   Int_t n2 = nSinsq13;
01974   Int_t n3 = nDeltaCP;
01975   Int_t n4 = nHierarchy;
01976 
01977   // data or non-oscillating samples (use null oscillations)
01978   if( sample==kData || sample==kCosmic || flavour==kNoFlavour ){
01979     n0=0; n1=0; n2=0; n3=0; n4=0;
01980   }
01981 
01982   // two-flavour oscillations
01983   if( n0>0 && n1==0 && n2==0 && n3==0 && n4==0 ){
01984     n1=1; n2=1; n3=1; n4=1;
01985   }
01986 
01987   // look up grid point
01988   TemplateMap* tempMap = 0;
01989 
01990   if( Configuration::Instance()->DoingDynamicLoading()==0 ){
01991     tempMap = TemplateGrid::Instance()->GetTemplate(n0,n1,n2,n3,n4);
01992   }
01993   else{
01994     if( TemplateGrid::Instance()->GetNumTemplates()>Configuration::Instance()->GetMaximumLoad() )
01995       TemplateGrid::Instance()->UnloadTemplates();
01996 
01997     tempMap = TemplateReader::Instance()->GetTemplate(n0,n1,n2,n3,n4);
01998   }
01999 
02000   // sanity check
02001   assert( tempMap );
02002 
02003   // central prediction
02004   Template* temp  = tempMap->GetTemplate(source,sample,flavour,charge,kCentre,kNoShift);
02005   myTemplate->Add( temp );
02006  
02007   return;
02008 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  beam_nue_norm,
Double_t  beam_nue_ncbkg,
Double_t  beam_nue_energy,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_ratio_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_numu,
Double_t  atmos_spec_cv_numubar,
Double_t  atmos_spec_cv_nue,
Double_t  atmos_spec_cv_nuebar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Double_t  atmos_nue_energy,
Template *&  myTemplate 
)

Definition at line 346 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer0, GetExpectationForAtmosData(), GetExpectationForBeamData(), OscFit::Template::Reset(), UsingAtmosData(), and UsingBeamData().

00347 { 
00348   myTemplate->Reset();
00349 
00350   // atmospheric neutrinos
00351   if( UsingAtmosData() ){
00352     GetExpectationForAtmosData( dmsq, sinsq23,
00353                                 sinsq13, deltaCP,
00354                                 1, 1, 1, 1, 
00355                                 1, 1, 1, 1, 
00356                                 1,
00357                                 atmos_norm_cv,      atmos_norm_rock,
00358                                 atmos_ratio_cv,     atmos_ratio_rock,
00359                                 atmos_norm_nue,     atmos_ratio_nue,
00360                                 atmos_norm_nc,      
00361                                 atmos_spec_cv_numu, atmos_spec_cv_numubar,
00362                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
00363                                 atmos_spec_rock_nu, atmos_spec_rock_nubar,
00364                                 atmos_zenith,
00365                                 atmos_numu_trken,   atmos_numu_trken_exit,
00366                                 atmos_numu_shwen,   atmos_nue_energy, 
00367                                 fTemplateLayer0 );
00368     myTemplate->Add( fTemplateLayer0 );
00369   }
00370 
00371   // beam neutrinos
00372   if( UsingBeamData() ){
00373     GetExpectationForBeamData( dmsq, sinsq23,
00374                                sinsq13, deltaCP,
00375                                1, 1, 1, 1, 
00376                                1, 1, 1, 1, 
00377                                beam_numu_norm,  beam_numu_ncbkg, 
00378                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00379                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00380                                fTemplateLayer0 );
00381     myTemplate->Add( fTemplateLayer0 );
00382   }
00383 
00384   return;
00385 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_ratio_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_numu,
Double_t  atmos_spec_cv_numubar,
Double_t  atmos_spec_cv_nue,
Double_t  atmos_spec_cv_nuebar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Double_t  atmos_nue_energy,
Template *&  myTemplate 
)

Definition at line 291 of file TemplateCalculator.cxx.

References GetExpectation().

00292 {
00293   return GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
00294                          0.0, 0.0, 0.0, 0.0, 0.0,
00295                          0.0, 0.0, 0.0,
00296                          atmos_norm_cv,      atmos_norm_rock,
00297                          atmos_ratio_cv,     atmos_ratio_rock,     
00298                          atmos_norm_nue,     atmos_ratio_nue,
00299                          atmos_norm_nc, 
00300                          atmos_spec_cv_numu, atmos_spec_cv_numubar,
00301                          atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
00302                          atmos_spec_rock_nu, atmos_spec_rock_nubar,
00303                          atmos_zenith,
00304                          atmos_numu_trken,   atmos_numu_trken_exit,
00305                          atmos_numu_shwen,   atmos_nue_energy,  
00306                          myTemplate );
00307 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  beam_nue_norm,
Double_t  beam_nue_ncbkg,
Double_t  beam_nue_energy,
Template *&  myTemplate 
)

Definition at line 280 of file TemplateCalculator.cxx.

References GetExpectation().

00281 {
00282   return GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
00283                          beam_numu_norm, beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
00284                          beam_nue_norm,  beam_nue_ncbkg,  beam_nue_energy,
00285                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 
00286                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 
00287                          0.0, 0.0, 0.0, 0.0,
00288                          myTemplate );
00289 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Template *&  myTemplate 
)

Definition at line 269 of file TemplateCalculator.cxx.

References GetExpectation().

00270 {
00271   return GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
00272                          0.0, 0.0, 0.0, 0.0, 0.0,
00273                          0.0, 0.0, 0.0, 
00274                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 
00275                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 
00276                          0.0, 0.0, 0.0, 0.0,
00277                          myTemplate );
00278 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_nu,
Double_t  atmos_spec_cv_nubar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Template *&  myTemplate 
)

Definition at line 309 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer0, GetExpectationForAtmosData(), GetExpectationForBeamData(), OscFit::Template::Reset(), UsingAtmosData(), and UsingBeamData().

00310 {
00311   myTemplate->Reset();
00312 
00313   // atmospheric neutrinos
00314   if( UsingAtmosData() ){
00315     GetExpectationForAtmosData( dmsq, sinsq, 
00316                                 1, 1, 1, 1, 
00317                                 1, 1, 1, 1, 
00318                                 1,
00319                                 atmos_norm_cv,      atmos_norm_rock,
00320                                 atmos_ratio_cv,     atmos_ratio_rock,
00321                                 atmos_norm_nue,     atmos_norm_nc,      
00322                                 atmos_spec_cv_nu,   atmos_spec_cv_nubar,
00323                                 atmos_spec_rock_nu, atmos_spec_rock_nubar,
00324                                 atmos_zenith,
00325                                 atmos_numu_trken,   atmos_numu_trken_exit,
00326                                 atmos_numu_shwen,  
00327                                 fTemplateLayer0 );
00328     myTemplate->Add( fTemplateLayer0 );
00329   }
00330 
00331   // beam neutrinos
00332   if( UsingBeamData() ){
00333     GetExpectationForBeamData( dmsq, sinsq, 
00334                                1, 1, 1, 1, 
00335                                1, 1, 1, 1, 
00336                                beam_numu_norm,  beam_numu_ncbkg, 
00337                                beam_numu_shwen, beam_numu_trken, 
00338                                beam_numu_trken_exit, 
00339                                fTemplateLayer0 );
00340     myTemplate->Add( fTemplateLayer0 );
00341   }
00342 
00343   return;
00344 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_nu,
Double_t  atmos_spec_cv_nubar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Template *&  myTemplate 
)

Definition at line 254 of file TemplateCalculator.cxx.

References GetExpectation().

00255 {
00256   return GetExpectation( dmsq, sinsq,
00257                          0.0, 0.0, 0.0, 0.0, 0.0, 
00258                          atmos_norm_cv,      atmos_norm_rock,
00259                          atmos_ratio_cv,     atmos_ratio_rock,
00260                          atmos_norm_nue,     atmos_norm_nc,      
00261                          atmos_spec_cv_nu,   atmos_spec_cv_nubar,
00262                          atmos_spec_rock_nu, atmos_spec_rock_nubar,
00263                          atmos_zenith,
00264                          atmos_numu_trken,   atmos_numu_trken_exit,
00265                          atmos_numu_shwen,  
00266                          myTemplate );
00267 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Template *&  myTemplate 
)

Definition at line 244 of file TemplateCalculator.cxx.

References GetExpectation().

00245 {
00246   return GetExpectation( dmsq, sinsq,
00247                          beam_numu_norm, beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00248                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
00249                          0.0, 0.0, 0.0, 0.0, 0.0, 
00250                          0.0, 0.0, 0.0,
00251                          myTemplate );
00252 }

void TemplateCalculator::GetExpectation ( Double_t  dmsq,
Double_t  sinsq,
Template *&  myTemplate 
)

Definition at line 234 of file TemplateCalculator.cxx.

Referenced by GetExpectation(), GetExpectationForAtmosData(), GetExpectationForBeamData(), and GetExperiment().

00235 {
00236   return GetExpectation( dmsq, sinsq,
00237                          0.0, 0.0, 0.0, 0.0, 0.0,
00238                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
00239                          0.0, 0.0, 0.0, 0.0, 0.0, 
00240                          0.0, 0.0, 0.0,
00241                          myTemplate );
00242 }

void TemplateCalculator::GetExpectationForAtmosData ( Int_t  nDmsq,
Int_t  nSinsq23,
Int_t  nSinsq13,
Int_t  nDeltaCP,
Int_t  nHierarchy,
Bool_t  cv,
Bool_t  rock,
Bool_t  nu,
Bool_t  nubar,
Bool_t  nc,
Bool_t  nue,
Bool_t  numu,
Bool_t  nutau,
Bool_t  cosmic,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_ratio_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_numu,
Double_t  atmos_spec_cv_numubar,
Double_t  atmos_spec_cv_nue,
Double_t  atmos_spec_cv_nuebar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Double_t  atmos_nue_energy,
Template *&  myTemplate 
) [private]

Definition at line 1709 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer2, GetExpectation(), OscFit::kAtmosData, OscFit::kCosmic, OscFit::kCV, OscFit::kNC, OscFit::kNoCharge, OscFit::kNoFlavour, OscFit::kNu, OscFit::kNuBar, OscFit::kNue, OscFit::kNumu, OscFit::kNutau, OscFit::kRock, OscFit::Template::Reset(), OscFit::Syst_Atmos_CV_FlavRatio(), OscFit::Syst_Atmos_CV_NCRatio(), OscFit::Syst_Atmos_CV_Norm(), OscFit::Syst_Atmos_CV_NueChgRatio(), OscFit::Syst_Atmos_CV_NumuChgRatio(), OscFit::Syst_Atmos_Rock_ChgRatio(), OscFit::Syst_Atmos_Rock_Norm(), and UsingAtmosData().

01710 {
01711   // reset template
01712   myTemplate->Reset(); 
01713 
01714   // check data set
01715   if( UsingAtmosData()==0 ) return;
01716 
01717  
01718   //
01719   // could give antineutrinos a larger weight in charge ratio systematic:
01720   // (i) antineutrino uncertainties are greater than neutrino uncertainties
01721   // (ii) charge ratio would become independent of normalisation
01722   //
01723   // Double_t chargeWeight  = +0.33;
01724   // Double_t norm_cv_numu    = 1.0 - 0.5*(1.0-chargeWeight)*atmos_ratio_shift;
01725   // Double_t norm_cv_numubar = 1.0 + 0.5*(1.0+chargeWeight)*atmos_ratio_shift;
01726   //  
01727 
01728   // normalisations (contained vertex)
01729   Double_t norm_cv_nc      = ( 1.0 + atmos_norm_cv*OscFit::Syst_Atmos_CV_Norm() )
01730                            * ( 1.0 + atmos_norm_nc*OscFit::Syst_Atmos_CV_NCRatio() ); 
01731   Double_t norm_cv_nue     = ( 1.0 + atmos_norm_cv*OscFit::Syst_Atmos_CV_Norm() )
01732                            * ( 1.0 + atmos_norm_nue*OscFit::Syst_Atmos_CV_FlavRatio() )
01733                            * ( 1.0 - 0.5*atmos_ratio_nue*OscFit::Syst_Atmos_CV_NueChgRatio() ); 
01734   Double_t norm_cv_nuebar  = ( 1.0 + atmos_norm_cv*OscFit::Syst_Atmos_CV_Norm() )
01735                            * ( 1.0 + atmos_norm_nue*OscFit::Syst_Atmos_CV_FlavRatio() )
01736                            * ( 1.0 + 0.5*atmos_ratio_nue*OscFit::Syst_Atmos_CV_NueChgRatio() );  
01737   Double_t norm_cv_numu    = ( 1.0 + atmos_norm_cv*OscFit::Syst_Atmos_CV_Norm() )
01738                            * ( 1.0 - 0.5*atmos_ratio_cv*OscFit::Syst_Atmos_CV_NumuChgRatio() ); 
01739   Double_t norm_cv_numubar = ( 1.0 + atmos_norm_cv*OscFit::Syst_Atmos_CV_Norm() )
01740                            * ( 1.0 + 0.5*atmos_ratio_cv*OscFit::Syst_Atmos_CV_NumuChgRatio() ); 
01741   
01742   // normalisations (rock)
01743   Double_t norm_rock_nu    = ( 1.0 + atmos_norm_rock*OscFit::Syst_Atmos_Rock_Norm() )
01744                            * ( 1.0 - 0.5*atmos_ratio_rock*OscFit::Syst_Atmos_Rock_ChgRatio() ); 
01745   Double_t norm_rock_nubar = ( 1.0 + atmos_norm_rock*OscFit::Syst_Atmos_Rock_Norm() )
01746                            * ( 1.0 + 0.5*atmos_ratio_rock*OscFit::Syst_Atmos_Rock_ChgRatio() ); 
01747   
01748   
01749   // contained vertex (neutrinos)
01750   if( cv && nu ){
01751 
01752     if( nc ){
01753       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01754                       kAtmosData, kCV, kNC, kNu, 
01755                       0.0, 0.0, 0.0, 0.0, 
01756                       0.0, 0.0, 0.0, 0.0,
01757                       fTemplateLayer2 );
01758       myTemplate->Add( fTemplateLayer2, norm_cv_nc );
01759       std::cout<<"cv nu nc "<<norm_cv_nc<<std::endl;
01760     }
01761 
01762     if( nue ){
01763       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01764                       kAtmosData, kCV, kNue, kNu, 
01765                       0.0, 0.0, 0.0, 0.0, 
01766                       atmos_spec_cv_nue, atmos_zenith, 0.0, atmos_nue_energy, 
01767                       fTemplateLayer2 );
01768       myTemplate->Add( fTemplateLayer2, norm_cv_nue );
01769       std::cout<<"cv nu nue "<<norm_cv_nue<<std::endl;
01770     }
01771 
01772     if( numu ){
01773       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01774                       kAtmosData, kCV, kNumu, kNu, 
01775                       0.0, atmos_numu_shwen, atmos_numu_trken, atmos_numu_trken_exit, 
01776                       atmos_spec_cv_numu, atmos_zenith, 0.0, 0.0,
01777                       fTemplateLayer2 );
01778       myTemplate->Add( fTemplateLayer2, norm_cv_numu );
01779       std::cout<<"cv nu numu "<<norm_cv_numu<<std::endl;
01780     }
01781 
01782     if( nutau ){
01783       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01784                       kAtmosData, kCV, kNutau, kNu, 
01785                       0.0, 0.0, 0.0, 0.0, 
01786                       0.0, 0.0, 0.0, 0.0,
01787                       fTemplateLayer2 );
01788       myTemplate->Add( fTemplateLayer2, norm_cv_numu );
01789       std::cout<<"cv nu nutau "<<norm_cv_numu<<std::endl;
01790     }
01791   }
01792 
01793   // contained vertex (anti-neutrinos)
01794   if( cv && nubar ){
01795 
01796     if( nc ){
01797       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01798                       kAtmosData, kCV, kNC, kNuBar, 
01799                       0.0, 0.0, 0.0, 0.0, 
01800                       0.0, 0.0, 0.0, 0.0,
01801                       fTemplateLayer2 );
01802       myTemplate->Add( fTemplateLayer2, norm_cv_nc );
01803       std::cout<<"cv nubar nc "<<norm_cv_nc<<std::endl;
01804     }
01805 
01806     if( nue ){
01807       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01808                       kAtmosData, kCV, kNue, kNuBar, 
01809                       0.0, 0.0, 0.0, 0.0, 
01810                       atmos_spec_cv_nuebar, atmos_zenith, 0.0, atmos_nue_energy, 
01811                       fTemplateLayer2 );
01812       myTemplate->Add( fTemplateLayer2, norm_cv_nuebar );
01813       std::cout<<"cv nubar nue "<<norm_cv_nuebar<<std::endl;
01814     }
01815 
01816     if( numu ){
01817       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01818                       kAtmosData, kCV, kNumu, kNuBar, 
01819                       0.0, atmos_numu_shwen, atmos_numu_trken, atmos_numu_trken_exit, 
01820                       atmos_spec_cv_numubar, atmos_zenith, 0.0, 0.0,
01821                       fTemplateLayer2 );
01822       myTemplate->Add( fTemplateLayer2, norm_cv_numubar );
01823       std::cout<<"cv nubar numu "<<norm_cv_numubar<<std::endl;
01824     }
01825 
01826     if( nutau ){
01827       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01828                       kAtmosData, kCV, kNutau, kNuBar, 
01829                       0.0, 0.0, 0.0, 0.0, 
01830                       0.0, 0.0, 0.0, 0.0,
01831                       fTemplateLayer2 );
01832       myTemplate->Add( fTemplateLayer2, norm_cv_numubar );
01833       std::cout<<"cv nubar nutau "<<norm_cv_numubar<<std::endl;
01834     }
01835   }
01836 
01837   // rock muons (neutrinos)
01838   if( rock && nu ){
01839     if( numu ){
01840       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01841                       kAtmosData, kRock, kNumu, kNu, 
01842                       0.0, 0.0, 0.0, 0.0, 
01843                       atmos_spec_rock_nu, 0.0, 0.0, 0.0,  
01844                       fTemplateLayer2 );
01845       myTemplate->Add( fTemplateLayer2, norm_rock_nu );
01846     }
01847   }
01848 
01849   // rock muons (anti-neutrinos)
01850   if( rock && nubar ){
01851     if( numu ){
01852       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01853                       kAtmosData, kRock, kNumu, kNuBar, 
01854                       0.0, 0.0, 0.0, 0.0, 
01855                       atmos_spec_rock_nubar, 0.0, 0.0, 0.0,  
01856                       fTemplateLayer2 );
01857       myTemplate->Add( fTemplateLayer2, norm_rock_nubar );
01858     }
01859   }
01860 
01861   // cosmic muon background
01862   if( cosmic ){
01863     GetExpectation( 0, 0, 0, 0, 0, 
01864                     kAtmosData, kCosmic, kNoFlavour, kNoCharge, 
01865                     0.0, 0.0, 0.0, 0.0, 
01866                     0.0, 0.0, 0.0, 0.0,
01867                     fTemplateLayer2 );
01868     myTemplate->Add( fTemplateLayer2 );
01869   }
01870 
01871   return;
01872 }

void TemplateCalculator::GetExpectationForAtmosData ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Bool_t  cv,
Bool_t  rock,
Bool_t  nu,
Bool_t  nubar,
Bool_t  nc,
Bool_t  nue,
Bool_t  numu,
Bool_t  nutau,
Bool_t  cosmic,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_ratio_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_numu,
Double_t  atmos_spec_cv_numubar,
Double_t  atmos_spec_cv_nue,
Double_t  atmos_spec_cv_nuebar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Double_t  atmos_nue_energy,
Template *&  myTemplate 
)

Definition at line 1056 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fDebug, fTemplateLayer1, GetExpectationForAtmosData(), OscFit::TemplateGrid::Instance(), OscFit::Oscillation::Instance(), Instance(), n, OscFit::Template::Reset(), and UsingAtmosData().

01057 {
01058 
01059   // Reset template
01060   // --------------
01061   myTemplate->Reset();
01062 
01063   // Check data set
01064   // --------------
01065   if( UsingAtmosData()==0 ) return;
01066 
01067   // Check oscillations
01068   // ------------------
01069   Bool_t checkOsc = 0;  if( fabs(dmsq)>0.0 ) checkOsc = 1;
01070 
01071   // Print Warning if there is no Grid
01072   // ---------------------------------
01073   if( checkOsc 
01074    && TemplateGrid::Instance()->TouchGrid()==0 ){
01075     std::cout << "   <Warning>: Oscillated spectra requested, but no grid loaded. " << std::endl
01076               << "              Reverting to null oscillations." << std::endl;
01077   }
01078 
01079   // Check that grid is set up for three flavours
01080   // --------------------------------------------  
01081   if( TemplateGrid::Instance()->TouchGrid() ){
01082     assert( Oscillation::Instance()->UsingThreeFlavours() );
01083   }
01084 
01085   // Interpolation for Oscillations
01086   // ------------------------------
01087   Int_t nDmsq = 0;
01088   Int_t nSinsq23 = 0;
01089   Int_t nSinsq13 = 0;
01090   Int_t nDeltaCP = 0;
01091   Int_t nHierarchy = 0;
01092  
01093   Double_t alphaDmsq = 1.0;
01094   Double_t alphaSinsq23 = 1.0;
01095   Double_t alphaSinsq13 = 1.0;
01096   Double_t alphaDeltaCP = 1.0;
01097 
01098   Bool_t usingDmsq    = 0;
01099   Bool_t usingSinsq23 = 0;
01100   Bool_t usingSinsq13 = 0;
01101   Bool_t usingDeltaCP = 0;
01102 
01103   if( checkOsc ){
01104 
01105     // Which Parameters
01106     // ----------------
01107     usingDmsq    = TemplateGrid::Instance()->UsingDmsq();
01108     usingSinsq23 = TemplateGrid::Instance()->UsingSinsq23();
01109     usingSinsq13 = TemplateGrid::Instance()->UsingSinsq13();
01110     usingDeltaCP = TemplateGrid::Instance()->UsingDeltaCP();
01111 
01112 
01113     // Interpolation between [n] and [n+1]
01114     // -----------------------------------
01115     // Use simple Linear Interpolation
01116 
01117     // bin,  weight   | bin,    weight
01118     // -----------------------------------
01119     // n,    alpha    | n+1,    1.0-alpha
01120 
01121     nDmsq = 1;
01122     alphaDmsq = 1.0;
01123 
01124     nSinsq23 = 1;
01125     alphaSinsq23 = 1.0;
01126 
01127     nSinsq13 = 1;
01128     alphaSinsq13 = 1.0;
01129     
01130     nDeltaCP = 1;
01131     alphaDeltaCP = 1.0;
01132 
01133     if( dmsq>=0 ) nHierarchy = 1;  // normal
01134     else          nHierarchy = 2;  // inverted
01135 
01136     // dmsq
01137     // ----
01138     if( usingDmsq ){
01139       Double_t input_dmsq = fabs(dmsq);
01140       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinDmsq(input_dmsq);
01141       Int_t N = TemplateGrid::Instance()->GetDmsqBins() - 2;
01142       Int_t n = (Int_t)(TMath::Floor(interp_n));    
01143 
01144       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
01145       nDmsq = n;  alphaDmsq = 1.0 - (interp_n-n);    
01146     }
01147 
01148     // sinsq23
01149     // -------
01150     if( usingSinsq23 ){
01151       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinSinsq23(sinsq23);
01152       Int_t N = TemplateGrid::Instance()->GetSinsq23Bins() - 2;
01153       Int_t n = (Int_t)(TMath::Floor(interp_n));    
01154 
01155       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
01156       nSinsq23 = n;  alphaSinsq23 = 1.0 - (interp_n-n);    
01157     }
01158 
01159     // sinsq13
01160     // -------
01161     if( usingSinsq13 ){
01162       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinSinsq13(sinsq13);
01163       Int_t N = TemplateGrid::Instance()->GetSinsq13Bins() - 2;
01164       Int_t n = (Int_t)(TMath::Floor(interp_n));    
01165 
01166       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
01167       nSinsq13 = n;  alphaSinsq13 = 1.0 - (interp_n-n);    
01168     }
01169 
01170     // deltaCP
01171     // -------
01172     if( usingDeltaCP ){
01173       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinDeltaCP(deltaCP);
01174       Int_t N = TemplateGrid::Instance()->GetDeltaCPBins() - 2;
01175       Int_t n = (Int_t)(TMath::Floor(interp_n));    
01176 
01177       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
01178       nDeltaCP = n;  alphaDeltaCP = 1.0 - (interp_n-n);    
01179     }
01180   }
01181 
01182   // --- debug ---
01183   if( fDebug ){
01184     std::cout << " TemplateCalculator::Debug " << std::endl;
01185     std::cout << "   dmsq=" << dmsq << " sinsq23=" << sinsq23 << " sinsq13=" << sinsq13 << " deltaCP=" << deltaCP << std::endl;
01186     std::cout << "   nDmsq=" << nDmsq << " nSinsq23=" << nSinsq23 << " nSinsq13=" << nSinsq13 << " nDeltaCP=" << nDeltaCP << " nHierarchy=" << nHierarchy << std::endl;
01187     std::cout << "   alphaDmsq=" << alphaDmsq << " alphaSinsq23=" << alphaSinsq23 << " alphaSinsq13=" << alphaSinsq13 << " alphaDeltaCP=" << alphaDeltaCP << std::endl;
01188   }
01189 
01190   // non-oscillating samples
01191   // -----------------------
01192   GetExpectationForAtmosData( 0, 0, 0, 0, 0,
01193                               cv, rock, nu, nubar,  
01194                               nc, 0, 0, 0, 
01195                               cosmic,
01196                               atmos_norm_cv,      atmos_norm_rock,
01197                               atmos_ratio_cv,     atmos_ratio_rock,
01198                               atmos_norm_nue,     atmos_ratio_nue,
01199                               atmos_norm_nc,   
01200                               atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01201                               atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01202                               atmos_spec_rock_nu, atmos_spec_rock_nubar,
01203                               atmos_zenith,
01204                               atmos_numu_trken,   atmos_numu_trken_exit,
01205                               atmos_numu_shwen,   atmos_nue_energy,
01206                               fTemplateLayer1 );
01207   myTemplate->Add( fTemplateLayer1 );  
01208 
01209 
01210   // oscillating samples
01211   // -------------------
01212   GetExpectationForAtmosData( nDmsq, nSinsq23, nSinsq13, nDeltaCP, 
01213                               nHierarchy,
01214                               cv, rock, nu, nubar,  
01215                               0,  nue, numu, nutau, 
01216                               0,
01217                               atmos_norm_cv,      atmos_norm_rock,
01218                               atmos_ratio_cv,     atmos_ratio_rock,
01219                               atmos_norm_nue,     atmos_ratio_nue,
01220                               atmos_norm_nc,    
01221                               atmos_spec_cv_numu, atmos_spec_cv_numubar,  
01222                               atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01223                               atmos_spec_rock_nu, atmos_spec_rock_nubar,
01224                               atmos_zenith,
01225                               atmos_numu_trken,   atmos_numu_trken_exit,
01226                               atmos_numu_shwen,   atmos_nue_energy,  
01227                               fTemplateLayer1 );
01228   myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*alphaSinsq13*alphaDeltaCP );  
01229 
01230   if( usingDeltaCP ){
01231     GetExpectationForAtmosData( nDmsq, nSinsq23, nSinsq13, nDeltaCP+1, 
01232                                 nHierarchy,
01233                                 cv, rock, nu, nubar,  
01234                                 0, nue, numu, nutau, 
01235                                 0,
01236                                 atmos_norm_cv,      atmos_norm_rock,
01237                                 atmos_ratio_cv,     atmos_ratio_rock,
01238                                 atmos_norm_nue,     atmos_ratio_nue,
01239                                 atmos_norm_nc,   
01240                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01241                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar, 
01242                                 atmos_spec_rock_nu, atmos_spec_rock_nubar,
01243                                 atmos_zenith,
01244                                 atmos_numu_trken,   atmos_numu_trken_exit,
01245                                 atmos_numu_shwen,   atmos_nue_energy,  
01246                                 fTemplateLayer1 );
01247     myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*alphaSinsq13*(1.0-alphaDeltaCP) );   
01248   }
01249 
01250   if( usingSinsq13 ){
01251     GetExpectationForAtmosData( nDmsq, nSinsq23, nSinsq13+1, nDeltaCP, 
01252                                 nHierarchy,
01253                                 cv, rock, nu, nubar,  
01254                                 0,  nue, numu, nutau, 
01255                                 0,
01256                                 atmos_norm_cv,      atmos_norm_rock,
01257                                 atmos_ratio_cv,     atmos_ratio_rock,  
01258                                 atmos_norm_nue,     atmos_ratio_nue,
01259                                 atmos_norm_nc, 
01260                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01261                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar, 
01262                                 atmos_spec_rock_nu, atmos_spec_rock_nubar,
01263                                 atmos_zenith,
01264                                 atmos_numu_trken,   atmos_numu_trken_exit,
01265                                 atmos_numu_shwen,   atmos_nue_energy,   
01266                                 fTemplateLayer1 );
01267     myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*(1.0-alphaSinsq13)*alphaDeltaCP );  
01268   }
01269   
01270   if( usingSinsq13 && usingDeltaCP ){
01271     GetExpectationForAtmosData( nDmsq, nSinsq23, nSinsq13+1, nDeltaCP+1, 
01272                                 nHierarchy,
01273                                 cv, rock, nu, nubar,  
01274                                 0,  nue, numu, nutau, 
01275                                 0,
01276                                 atmos_norm_cv,      atmos_norm_rock,
01277                                 atmos_ratio_cv,     atmos_ratio_rock,
01278                                 atmos_norm_nue,     atmos_ratio_nue,
01279                                 atmos_norm_nc,      
01280                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01281                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar, 
01282                                 atmos_spec_rock_nu, atmos_spec_rock_nubar,
01283                                 atmos_zenith,
01284                                 atmos_numu_trken,   atmos_numu_trken_exit,
01285                                 atmos_numu_shwen,   atmos_nue_energy,   
01286                                 fTemplateLayer1 );
01287     myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
01288   }
01289 
01290   if( usingSinsq23 ){
01291     GetExpectationForAtmosData( nDmsq, nSinsq23+1, nSinsq13, nDeltaCP, 
01292                                 nHierarchy,
01293                                 cv, rock, nu, nubar,  
01294                                 0,  nue, numu, nutau, 
01295                                 0,
01296                                 atmos_norm_cv,      atmos_norm_rock,
01297                                 atmos_ratio_cv,     atmos_ratio_rock,
01298                                 atmos_norm_nue,     atmos_ratio_nue,
01299                                 atmos_norm_nc,      
01300                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01301                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01302                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01303                                 atmos_zenith,
01304                                 atmos_numu_trken,   atmos_numu_trken_exit,
01305                                 atmos_numu_shwen,   atmos_nue_energy, 
01306                                 fTemplateLayer1 );
01307     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*alphaSinsq13*alphaDeltaCP );  
01308   }
01309 
01310   if( usingSinsq23 && usingDeltaCP ){
01311     GetExpectationForAtmosData( nDmsq, nSinsq23+1, nSinsq13, nDeltaCP+1, 
01312                                 nHierarchy,
01313                                 cv, rock, nu, nubar,  
01314                                 0,  nue, numu, nutau, 
01315                                 0,
01316                                 atmos_norm_cv,      atmos_norm_rock,
01317                                 atmos_ratio_cv,     atmos_ratio_rock, 
01318                                 atmos_norm_nue,     atmos_ratio_nue,
01319                                 atmos_norm_nc,    
01320                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01321                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01322                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01323                                 atmos_zenith,
01324                                 atmos_numu_trken,   atmos_numu_trken_exit,
01325                                 atmos_numu_shwen,   atmos_nue_energy,  
01326                                 fTemplateLayer1 );
01327     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*alphaSinsq13*(1.0-alphaDeltaCP) );   
01328   }
01329 
01330   if( usingSinsq23 && usingSinsq13 ){
01331     GetExpectationForAtmosData( nDmsq, nSinsq23+1, nSinsq13+1, nDeltaCP, 
01332                                 nHierarchy,
01333                                 cv, rock, nu, nubar,  
01334                                 0,  nue, numu, nutau, 
01335                                 0,
01336                                 atmos_norm_cv,      atmos_norm_rock,
01337                                 atmos_ratio_cv,     atmos_ratio_rock,
01338                                 atmos_norm_nue,     atmos_ratio_nue,
01339                                 atmos_norm_nc,      
01340                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01341                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01342                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01343                                 atmos_zenith,
01344                                 atmos_numu_trken,   atmos_numu_trken_exit,
01345                                 atmos_numu_shwen,   atmos_nue_energy,  
01346                                 fTemplateLayer1 );
01347     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*alphaDeltaCP );  
01348   }
01349 
01350   if( usingSinsq23 && usingSinsq13 && usingDeltaCP ){
01351     GetExpectationForAtmosData( nDmsq, nSinsq23+1, nSinsq13+1, nDeltaCP+1, 
01352                                 nHierarchy,
01353                                 cv, rock, nu, nubar,  
01354                                 0,  nue, numu, nutau, 
01355                                 0,
01356                                 atmos_norm_cv,      atmos_norm_rock,
01357                                 atmos_ratio_cv,     atmos_ratio_rock,
01358                                 atmos_norm_nue,     atmos_ratio_nue,
01359                                 atmos_norm_nc,      
01360                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01361                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01362                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01363                                 atmos_zenith,
01364                                 atmos_numu_trken,   atmos_numu_trken_exit,
01365                                 atmos_numu_shwen,   atmos_nue_energy,  
01366                                 fTemplateLayer1 );
01367     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
01368   }
01369 
01370   if( usingDmsq ){
01371     GetExpectationForAtmosData( nDmsq+1, nSinsq23, nSinsq13, nDeltaCP, 
01372                                 nHierarchy,
01373                                 cv, rock, nu, nubar,  
01374                                 0,  nue, numu, nutau, 
01375                                 0,
01376                                 atmos_norm_cv,      atmos_norm_rock,
01377                                 atmos_ratio_cv,     atmos_ratio_rock,
01378                                 atmos_norm_nue,     atmos_ratio_nue,
01379                                 atmos_norm_nc,    
01380                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01381                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01382                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01383                                 atmos_zenith,
01384                                 atmos_numu_trken,   atmos_numu_trken_exit,
01385                                 atmos_numu_shwen,   atmos_nue_energy,
01386                                 fTemplateLayer1 );
01387     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*alphaSinsq13*alphaDeltaCP );  
01388   }
01389 
01390   if( usingDmsq && usingDeltaCP ){
01391     GetExpectationForAtmosData( nDmsq+1, nSinsq23, nSinsq13, nDeltaCP+1, 
01392                                 nHierarchy,
01393                                 cv, rock, nu, nubar,  
01394                                 0,  nue, numu, nutau, 
01395                                 0,
01396                                 atmos_norm_cv,      atmos_norm_rock,
01397                                 atmos_ratio_cv,     atmos_ratio_rock,
01398                                 atmos_norm_nue,     atmos_ratio_nue,
01399                                 atmos_norm_nc,      
01400                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01401                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01402                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01403                                 atmos_zenith,
01404                                 atmos_numu_trken,   atmos_numu_trken_exit,
01405                                 atmos_numu_shwen,   atmos_nue_energy, 
01406                                 fTemplateLayer1 );
01407     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*alphaSinsq13*(1.0-alphaDeltaCP) );   
01408   }
01409 
01410   if( usingDmsq && usingSinsq13 ){
01411     GetExpectationForAtmosData( nDmsq+1, nSinsq23, nSinsq13+1, nDeltaCP, 
01412                                 nHierarchy,
01413                                 cv, rock, nu, nubar,  
01414                                 0,  nue, numu, nutau, 
01415                                 0,
01416                                 atmos_norm_cv,      atmos_norm_rock,
01417                                 atmos_ratio_cv,     atmos_ratio_rock,
01418                                 atmos_norm_nue,     atmos_ratio_nue,
01419                                 atmos_norm_nc,      
01420                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01421                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01422                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01423                                 atmos_zenith,
01424                                 atmos_numu_trken,   atmos_numu_trken_exit,
01425                                 atmos_numu_shwen,   atmos_nue_energy,  
01426                                 fTemplateLayer1 );
01427     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*(1.0-alphaSinsq13)*alphaDeltaCP );  
01428   }
01429 
01430   if( usingDmsq && usingSinsq13 && usingDeltaCP ){
01431     GetExpectationForAtmosData( nDmsq+1, nSinsq23, nSinsq13+1, nDeltaCP+1, 
01432                                 nHierarchy,
01433                                 cv, rock, nu, nubar,  
01434                                 0,  nue, numu, nutau, 
01435                                 0,
01436                                 atmos_norm_cv,      atmos_norm_rock,
01437                                 atmos_ratio_cv,     atmos_ratio_rock,
01438                                 atmos_norm_nue,     atmos_ratio_nue,
01439                                 atmos_norm_nc,      
01440                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01441                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01442                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01443                                 atmos_zenith,
01444                                 atmos_numu_trken,   atmos_numu_trken_exit,
01445                                 atmos_numu_shwen,   atmos_nue_energy,  
01446                                 fTemplateLayer1 );
01447     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
01448   }
01449 
01450   if( usingDmsq && usingSinsq23 ){
01451     GetExpectationForAtmosData( nDmsq+1, nSinsq23+1, nSinsq13, nDeltaCP, 
01452                                 nHierarchy,
01453                                 cv, rock, nu, nubar,  
01454                                 0,  nue, numu, nutau, 
01455                                 0,
01456                                 atmos_norm_cv,      atmos_norm_rock,
01457                                 atmos_ratio_cv,     atmos_ratio_rock,
01458                                 atmos_norm_nue,     atmos_ratio_nue,
01459                                 atmos_norm_nc,      
01460                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01461                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01462                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01463                                 atmos_zenith,
01464                                 atmos_numu_trken,   atmos_numu_trken_exit,
01465                                 atmos_numu_shwen,   atmos_nue_energy, 
01466                                 fTemplateLayer1 );
01467     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*alphaSinsq13*alphaDeltaCP );  
01468   }
01469 
01470   if( usingDmsq && usingSinsq23 && usingDeltaCP ){
01471     GetExpectationForAtmosData( nDmsq+1, nSinsq23+1, nSinsq13, nDeltaCP+1, 
01472                                 nHierarchy,
01473                                 cv, rock, nu, nubar,  
01474                                 0,  nue, numu, nutau, 
01475                                 0,
01476                                 atmos_norm_cv,      atmos_norm_rock,
01477                                 atmos_ratio_cv,     atmos_ratio_rock,
01478                                 atmos_norm_nue,     atmos_ratio_nue,
01479                                 atmos_norm_nc,     
01480                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01481                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01482                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01483                                 atmos_zenith,
01484                                 atmos_numu_trken,   atmos_numu_trken_exit,
01485                                 atmos_numu_shwen,   atmos_nue_energy,  
01486                                 fTemplateLayer1 );
01487     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*alphaSinsq13*(1.0-alphaDeltaCP) ); 
01488   }  
01489 
01490   if( usingDmsq && usingSinsq23 && usingSinsq13 ){
01491     GetExpectationForAtmosData( nDmsq+1, nSinsq23+1, nSinsq13+1, nDeltaCP, 
01492                                 nHierarchy,
01493                                 cv, rock, nu, nubar,  
01494                                 0,  nue, numu, nutau, 
01495                                 0,
01496                                 atmos_norm_cv,      atmos_norm_rock,
01497                                 atmos_ratio_cv,     atmos_ratio_rock,
01498                                 atmos_norm_nue,     atmos_ratio_nue,
01499                                 atmos_norm_nc,     
01500                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01501                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01502                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01503                                 atmos_zenith,
01504                                 atmos_numu_trken,   atmos_numu_trken_exit,
01505                                 atmos_numu_shwen,   atmos_nue_energy,  
01506                                 fTemplateLayer1 );
01507     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*alphaDeltaCP );  
01508   }
01509 
01510   if( usingDmsq && usingSinsq23 && usingSinsq13 && usingDeltaCP ){
01511     GetExpectationForAtmosData( nDmsq+1, nSinsq23+1, nSinsq13+1, nDeltaCP+1, 
01512                                 nHierarchy,
01513                                 cv, rock, nu, nubar,  
01514                                 0,  nue, numu, nutau, 
01515                                 0,
01516                                 atmos_norm_cv,      atmos_norm_rock,
01517                                 atmos_ratio_cv,     atmos_ratio_rock,
01518                                 atmos_norm_nue,     atmos_ratio_nue,
01519                                 atmos_norm_nc,      
01520                                 atmos_spec_cv_numu, atmos_spec_cv_numubar, 
01521                                 atmos_spec_cv_nue,  atmos_spec_cv_nuebar,
01522                                 atmos_spec_rock_nu, atmos_spec_rock_nubar, 
01523                                 atmos_zenith,
01524                                 atmos_numu_trken,   atmos_numu_trken_exit,
01525                                 atmos_numu_shwen,   atmos_nue_energy, 
01526                                 fTemplateLayer1 );
01527     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
01528   }
01529 
01530   return;
01531 }

void TemplateCalculator::GetExpectationForAtmosData ( Double_t  dmsq,
Double_t  sinsq,
Bool_t  cv,
Bool_t  rock,
Bool_t  nu,
Bool_t  nubar,
Bool_t  nc,
Bool_t  nue,
Bool_t  numu,
Bool_t  nutau,
Bool_t  cosmic,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_nu,
Double_t  atmos_spec_cv_nubar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Template *&  myTemplate 
)

Definition at line 530 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer1, OscFit::TemplateGrid::Instance(), OscFit::Oscillation::Instance(), Instance(), n, OscFit::Template::Reset(), and UsingAtmosData().

Referenced by GetCosmicBackground(), GetExpectation(), GetExpectationForAtmosData(), GetMC(), and GetNCBackground().

00531 {
00532   // Reset template
00533   // --------------
00534   myTemplate->Reset();
00535 
00536   // Check data set
00537   // --------------
00538   if( UsingAtmosData()==0 ) return;
00539 
00540   // Take Absolute Value of Dm2
00541   // --------------------------
00542   Double_t input_dmsq = fabs(dmsq);
00543 
00544   // Check for Oscillations
00545   // ----------------------
00546   Bool_t checkOsc = 0;  if( input_dmsq>0.0 ) checkOsc = 1;
00547 
00548   // Print Warning if there is no Grid
00549   // ---------------------------------
00550   if( checkOsc 
00551    && TemplateGrid::Instance()->TouchGrid()==0 ){
00552     std::cout << "   <Warning>: Oscillated spectra requested, but no grid loaded. " << std::endl
00553               << "              Reverting to null oscillations." << std::endl;
00554   }
00555 
00556   // Check that grid is set up for two flavours
00557   // ------------------------------------------  
00558   if( TemplateGrid::Instance()->TouchGrid() ){
00559     assert( Oscillation::Instance()->UsingTwoFlavours() );
00560   }
00561 
00562   // Interpolation between [0] and [n]
00563   // ---------------------------------
00564   // [0] corresponds to: 1
00565   // [n] corresponds to: 1-S, where: S=sin^2(1.267*dmsq*L/E)
00566   //   => 1*[0] - sinsq*[0] + sinsq*[n]
00567   //       = (1-sinsq) + sinsq*(1-S) = 1-sinsq*S   
00568   // Therefore, for an oscillation probability 1-sinsq*S, 
00569   // need to weight [0] by (1-sinsq), and [n] by sinsq.
00570 
00571   // Interpolation between [n] and [n+1]
00572   // -----------------------------------
00573   // Use simple Linear Interpolation
00574 
00575   // bin,  weight   | bin,    weight
00576   // -----------------------------------
00577   // n,    alpha    | n+1,    1.0-alpha
00578 
00579   Int_t    nDmsq = 1;
00580   Double_t alpha = 1.0;
00581   Bool_t   usingDmsq = TemplateGrid::Instance()->UsingDmsq();
00582 
00583   if( checkOsc && usingDmsq ){
00584     Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinDmsq(input_dmsq);
00585     Int_t N = TemplateGrid::Instance()->GetDmsqBins() - 2;
00586     Int_t n = (Int_t)(TMath::Floor(interp_n));    
00587 
00588     if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
00589     nDmsq = n;  alpha = 1.0 - (interp_n-n);
00590   }
00591   
00592 
00593   // NC + Nue CC + Cosmics
00594   // ---------------------
00595   GetExpectationForAtmosData( 0, 0, 0, 0, 0,
00596                               cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00597                               nc, nue, 0, 0,        // nc, nue, numu, nutau
00598                               cosmic,               // cosmics
00599                               atmos_norm_cv,      atmos_norm_rock,
00600                               atmos_ratio_cv,     atmos_ratio_rock,
00601                               atmos_norm_nue, 0.0,  // atmos_ratio_nue
00602                               atmos_norm_nc,     
00603                               atmos_spec_cv_nu,   atmos_spec_cv_nubar,
00604                               0.0, 0.0, // atmos_spec_cv_nue, atmos_spec_cv_nuebar,
00605                               atmos_spec_rock_nu, atmos_spec_rock_nubar,
00606                               atmos_zenith,
00607                               atmos_numu_trken,   atmos_numu_trken_exit,
00608                               atmos_numu_shwen,  0.0, // atmos_nue_energy
00609                               fTemplateLayer1 );
00610   myTemplate->Add( fTemplateLayer1 );  
00611                                    
00612   // Numu CC + Nutau CC (no oscillations)
00613   // ------------------------------------
00614   GetExpectationForAtmosData( 0, 0, 0, 0, 0,
00615                               cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00616                               0, 0, numu, 0,        // nc, nue, numu, nutau
00617                               0,                    // cosmics
00618                               atmos_norm_cv,      atmos_norm_rock,
00619                               atmos_ratio_cv,     atmos_ratio_rock,  
00620                               atmos_norm_nue, 0.0,  // atmos_ratio_nue
00621                               atmos_norm_nc,    
00622                               atmos_spec_cv_nu,   atmos_spec_cv_nubar,
00623                               0.0, 0.0, // atmos_spec_cv_nue, atmos_spec_cv_nuebar,
00624                               atmos_spec_rock_nu, atmos_spec_rock_nubar,
00625                               atmos_zenith,
00626                               atmos_numu_trken,   atmos_numu_trken_exit,
00627                               atmos_numu_shwen,   0.0, // atmos_nue_energy
00628                               fTemplateLayer1 );
00629   myTemplate->Add( fTemplateLayer1 );  
00630 
00631   // Numu CC + Nutau CC (oscillations)
00632   // ---------------------------------
00633   if( checkOsc
00634    && TemplateGrid::Instance()->TouchGrid() ){
00635 
00636     GetExpectationForAtmosData( 0, 0, 0, 0, 0,
00637                                 cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00638                                 0, 0, numu, 0,        // nc, nue, numu, nutau
00639                                 0,                    // cosmics
00640                                 atmos_norm_cv,      atmos_norm_rock,
00641                                 atmos_ratio_cv,     atmos_ratio_rock,
00642                                 atmos_norm_nue, 0.0,  // atmos_ratio_nue
00643                                 atmos_norm_nc,    
00644                                 atmos_spec_cv_nu,   atmos_spec_cv_nubar,
00645                                 0.0, 0.0, // atmos_spec_cv_nue, atmos_spec_cv_nuebar,
00646                                 atmos_spec_rock_nu, atmos_spec_rock_nubar,
00647                                 atmos_zenith,
00648                                 atmos_numu_trken,   atmos_numu_trken_exit,
00649                                 atmos_numu_shwen,   0.0, // atmos_nue_energy
00650                                 fTemplateLayer1 );
00651     myTemplate->Add( fTemplateLayer1, (0.0-sinsq) );
00652 
00653     GetExpectationForAtmosData( nDmsq, 0, 0, 0, 0,
00654                                 cv, rock, nu, nubar,  // cv, rock, nu, nubar 
00655                                 0, 0, numu, 0,        // nc, nue, numu, nutau
00656                                 0,                    // cosmics
00657                                 atmos_norm_cv,      atmos_norm_rock,
00658                                 atmos_ratio_cv,     atmos_ratio_rock,
00659                                 atmos_norm_nue, 0.0,  // atmos_ratio_nue
00660                                 atmos_norm_nc,      
00661                                 atmos_spec_cv_nu,   atmos_spec_cv_nubar,
00662                                 0.0, 0.0, // atmos_spec_cv_nue, atmos_spec_cv_nuebar,
00663                                 atmos_spec_rock_nu, atmos_spec_rock_nubar,
00664                                 atmos_zenith,
00665                                 atmos_numu_trken,   atmos_numu_trken_exit,
00666                                 atmos_numu_shwen,   0.0, // atmos_nue_energy
00667                                 fTemplateLayer1 );
00668     myTemplate->Add( fTemplateLayer1, alpha*sinsq );
00669 
00670     if( usingDmsq ){
00671       GetExpectationForAtmosData( nDmsq+1, 0, 0, 0, 0,
00672                                   cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00673                                   0, 0, numu, 0,        // nc, nue, numu, nutau
00674                                   0,                    // cosmics
00675                                   atmos_norm_cv,      atmos_norm_rock,
00676                                   atmos_ratio_cv,     atmos_ratio_rock,  
00677                                   atmos_norm_nue, 0.0,  // atmos_ratio_nue
00678                                   atmos_norm_nc,    
00679                                   atmos_spec_cv_nu,   atmos_spec_cv_nubar,
00680                                   0.0, 0.0, // atmos_spec_cv_nue, atmos_spec_cv_nuebar,
00681                                   atmos_spec_rock_nu, atmos_spec_rock_nubar,
00682                                   atmos_zenith,
00683                                   atmos_numu_trken,   atmos_numu_trken_exit,
00684                                   atmos_numu_shwen,   0.0, // atmos_nue_energy
00685                                   fTemplateLayer1 );
00686       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*sinsq );
00687     }
00688 
00689     GetExpectationForAtmosData( nDmsq, 0, 0, 0, 0,
00690                                 cv, rock, nu, nubar,  // cv, rock, nu, nubar 
00691                                 0, 0, 0, nutau,       // nc, nue, numu, nutau
00692                                 0,                    // cosmics
00693                                 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
00694                                 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
00695                                 0.0, 0.0, 0.0, 0.0,
00696                                 fTemplateLayer1 );
00697     myTemplate->Add( fTemplateLayer1, alpha*sinsq );
00698 
00699     if( usingDmsq ){
00700       GetExpectationForAtmosData( nDmsq+1, 0, 0, 0, 0,
00701                                   cv, rock, nu, nubar,  // cv, rock, nu, nubar
00702                                   0, 0, 0, nutau,       // nc, nue, numu, nutau
00703                                   0,                    // cosmics
00704                                   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
00705                                   0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
00706                                   0.0, 0.0, 0.0, 0.0,
00707                                   fTemplateLayer1 );
00708       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*sinsq );
00709     }
00710   }
00711 
00712   return;
00713 }

void TemplateCalculator::GetExpectationForBeamData ( Int_t  nDmsq,
Int_t  nSinsq23,
Int_t  nSinsq13,
Int_t  nDeltaCP,
Int_t  nHierarchy,
Bool_t  cv,
Bool_t  rock,
Bool_t  nu,
Bool_t  nubar,
Bool_t  nc,
Bool_t  nue,
Bool_t  numu,
Bool_t  nutau,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  beam_nue_norm,
Double_t  beam_nue_ncbkg,
Double_t  beam_nue_energy,
Template *&  myTemplate 
) [private]

Definition at line 1533 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer2, GetExpectation(), OscFit::kBeamData, OscFit::kCV, OscFit::kNC, OscFit::kNu, OscFit::kNuBar, OscFit::kNue, OscFit::kNumu, OscFit::kNutau, OscFit::kRock, OscFit::Template::Reset(), OscFit::Syst_Beam_Nue_Norm(), OscFit::Syst_Beam_Numu_Norm(), and UsingBeamData().

01534 {
01535   // reset template
01536   myTemplate->Reset();
01537 
01538   // check data set
01539   if( UsingBeamData()==0 ) return;
01540 
01541   // absolute normalisations
01542   Double_t numu_norm = 1.0 + beam_numu_norm*OscFit::Syst_Beam_Numu_Norm();
01543   Double_t nue_norm  = 1.0 + beam_nue_norm*OscFit::Syst_Beam_Nue_Norm();
01544 
01545   // contained vertex (neutrinos)
01546   if( cv && nu ){
01547 
01548     if( nc ){
01549       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01550                       kBeamData, kCV, kNC, kNu, 
01551                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01552                       0.0, 0.0, beam_nue_ncbkg, beam_nue_energy,
01553                       fTemplateLayer2 );
01554       myTemplate->Add( fTemplateLayer2, 1.0 );
01555     }
01556 
01557     if( nue ){
01558       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01559                       kBeamData, kCV, kNue, kNu, 
01560                       0.0, beam_numu_shwen, 0.0, 0.0, 
01561                       0.0, 0.0, beam_nue_ncbkg, beam_nue_energy,
01562                       fTemplateLayer2 );
01563       myTemplate->Add( fTemplateLayer2, nue_norm );
01564     }
01565 
01566     if( numu ){
01567       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01568                       kBeamData, kCV, kNumu, kNu, 
01569                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01570                       0.0, 0.0, 0.0, 0.0,
01571                       fTemplateLayer2 );
01572       myTemplate->Add( fTemplateLayer2, numu_norm );
01573     }
01574 
01575     if( nutau ){
01576       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01577                       kBeamData, kCV, kNutau, kNu, 
01578                       0.0, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01579                       0.0, 0.0, 0.0, 0.0,
01580                       fTemplateLayer2 );
01581       myTemplate->Add( fTemplateLayer2, numu_norm );
01582     }
01583   }
01584 
01585   // contained vertex (anti-neutrinos)
01586   if( cv && nubar ){
01587 
01588     if( nc ){
01589       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01590                       kBeamData, kCV, kNC, kNuBar, 
01591                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01592                       0.0, 0.0, beam_nue_ncbkg, beam_nue_energy,
01593                       fTemplateLayer2 );
01594       myTemplate->Add( fTemplateLayer2, 1.0 );
01595     }
01596 
01597     if( nue ){
01598       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01599                       kBeamData, kCV, kNue, kNuBar, 
01600                       0.0, beam_numu_shwen, 0.0, 0.0, 
01601                       0.0, 0.0, beam_nue_ncbkg, beam_nue_energy,
01602                       fTemplateLayer2 );
01603       myTemplate->Add( fTemplateLayer2, nue_norm );
01604     }
01605 
01606     if( numu ){
01607       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01608                       kBeamData, kCV, kNumu, kNuBar, 
01609                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01610                       0.0, 0.0, 0.0, 0.0, 
01611                       fTemplateLayer2 );
01612       myTemplate->Add( fTemplateLayer2, numu_norm );
01613     }
01614 
01615     if( nutau ){
01616       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01617                       kBeamData, kCV, kNutau, kNuBar, 
01618                       0.0, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01619                       0.0, 0.0, 0.0, 0.0,
01620                       fTemplateLayer2 );
01621       myTemplate->Add( fTemplateLayer2, numu_norm );
01622     }
01623   }
01624 
01625   // rock muons (neutrinos)
01626   if( rock && nu ){
01627 
01628    if( nc ){
01629       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01630                       kBeamData, kRock, kNC, kNu, 
01631                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01632                       0.0, 0.0, 0.0, 0.0, 
01633                       fTemplateLayer2 );
01634       myTemplate->Add( fTemplateLayer2, numu_norm );
01635     }
01636 
01637     if( nue ){
01638       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01639                       kBeamData, kRock, kNue, kNu, 
01640                       0.0, 0.0, 0.0, 0.0, 
01641                       0.0, 0.0, 0.0, 0.0, 
01642                       fTemplateLayer2 );
01643       myTemplate->Add( fTemplateLayer2, numu_norm );
01644     }
01645 
01646     if( numu ){
01647       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01648                       kBeamData, kRock, kNumu, kNu, 
01649                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01650                       0.0, 0.0, 0.0, 0.0, 
01651                       fTemplateLayer2 );
01652       myTemplate->Add( fTemplateLayer2, numu_norm );
01653     }
01654 
01655     if( nutau ){
01656       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01657                       kBeamData, kRock, kNutau, kNu, 
01658                       0.0, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01659                       0.0, 0.0, 0.0, 0.0,
01660                       fTemplateLayer2 );
01661       myTemplate->Add( fTemplateLayer2, numu_norm );
01662     }
01663 
01664   }
01665 
01666   // rock muons (anti-neutrinos)
01667   if( rock && nubar ){
01668 
01669     if( nc ){
01670       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01671                       kBeamData, kRock, kNC, kNuBar, 
01672                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01673                       0.0, 0.0, 0.0, 0.0,
01674                       fTemplateLayer2 );
01675       myTemplate->Add( fTemplateLayer2, numu_norm );
01676     }
01677 
01678     if( nue ){
01679       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01680                       kBeamData, kRock, kNue, kNuBar, 
01681                       0.0, 0.0, 0.0, 0.0, 
01682                       0.0, 0.0, 0.0, 0.0,
01683                       fTemplateLayer2 );
01684       myTemplate->Add( fTemplateLayer2, numu_norm );
01685     }
01686 
01687     if( numu ){
01688       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01689                       kBeamData, kRock, kNumu, kNuBar, 
01690                       beam_numu_ncbkg, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01691                       0.0, 0.0, 0.0, 0.0,
01692                       fTemplateLayer2 );
01693       myTemplate->Add( fTemplateLayer2, numu_norm );
01694     }
01695 
01696     if( nutau ){
01697       GetExpectation( nDmsq, nSinsq23, nSinsq13, nDeltaCP, nHierarchy, 
01698                       kBeamData, kRock, kNutau, kNuBar, 
01699                       0.0, beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01700                       0.0, 0.0, 0.0, 0.0,
01701                       fTemplateLayer2 );
01702       myTemplate->Add( fTemplateLayer2, numu_norm );
01703     }
01704   }
01705 
01706   return;
01707 }

void TemplateCalculator::GetExpectationForBeamData ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Bool_t  cv,
Bool_t  rock,
Bool_t  nu,
Bool_t  nubar,
Bool_t  nc,
Bool_t  nue,
Bool_t  numu,
Bool_t  nutau,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  beam_nue_norm,
Double_t  beam_nue_ncbkg,
Double_t  beam_nue_energy,
Template *&  myTemplate 
)

Definition at line 715 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fDebug, fTemplateLayer1, GetExpectationForBeamData(), OscFit::TemplateGrid::Instance(), OscFit::Oscillation::Instance(), Instance(), n, OscFit::Template::Reset(), and UsingBeamData().

00716 {
00717 
00718   // Reset template
00719   // --------------
00720   myTemplate->Reset();
00721   
00722   // Check data set
00723   // --------------
00724   if( UsingBeamData()==0 ) return;
00725 
00726   // Check for Oscillations
00727   // ----------------------
00728   Bool_t checkOsc = 0;  if( fabs(dmsq)>0.0 ) checkOsc = 1;
00729 
00730   // Print Warning if there is no Grid
00731   // ---------------------------------
00732   if( checkOsc 
00733    && TemplateGrid::Instance()->TouchGrid()==0 ){
00734     std::cout << "   <Warning>: Oscillated spectra requested, but no grid loaded. " << std::endl
00735               << "              Reverting to null oscillations." << std::endl;
00736   }
00737 
00738   // Check that grid is set up for three flavours
00739   // --------------------------------------------  
00740   if( TemplateGrid::Instance()->TouchGrid() ){
00741     assert( Oscillation::Instance()->UsingThreeFlavours() );
00742   }
00743 
00744   // Interpolation for Oscillations
00745   // ------------------------------
00746   Int_t nDmsq = 0;
00747   Int_t nSinsq23 = 0;
00748   Int_t nSinsq13 = 0;
00749   Int_t nDeltaCP = 0;
00750   Int_t nHierarchy = 0;
00751  
00752   Double_t alphaDmsq = 1.0;
00753   Double_t alphaSinsq23 = 1.0;
00754   Double_t alphaSinsq13 = 1.0;
00755   Double_t alphaDeltaCP = 1.0;
00756 
00757   Bool_t usingDmsq    = 0;
00758   Bool_t usingSinsq23 = 0;
00759   Bool_t usingSinsq13 = 0;
00760   Bool_t usingDeltaCP = 0;
00761 
00762   if( checkOsc ) {
00763 
00764     // Which Parameters
00765     // ----------------
00766     usingDmsq    = TemplateGrid::Instance()->UsingDmsq();
00767     usingSinsq23 = TemplateGrid::Instance()->UsingSinsq23();
00768     usingSinsq13 = TemplateGrid::Instance()->UsingSinsq13();
00769     usingDeltaCP = TemplateGrid::Instance()->UsingDeltaCP();
00770 
00771 
00772     // Interpolation between [n] and [n+1]
00773     // -----------------------------------
00774     // Use simple Linear Interpolation
00775 
00776     // bin,  weight   | bin,    weight
00777     // -----------------------------------
00778     // n,    alpha    | n+1,    1.0-alpha
00779  
00780     nDmsq = 1;
00781     alphaDmsq = 1.0;
00782     
00783     nSinsq23 = 1;
00784     alphaSinsq23 = 1.0;
00785 
00786     nSinsq13 = 1;
00787     alphaSinsq13 = 1.0;
00788     
00789     nDeltaCP = 1;
00790     alphaDeltaCP = 1.0;
00791    
00792     if( dmsq>=0 ) nHierarchy = 1;  // normal
00793     else          nHierarchy = 2;  // inverted
00794 
00795     // dmsq
00796     // ----
00797     if( usingDmsq ){
00798       Double_t input_dmsq = fabs(dmsq);
00799       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinDmsq(input_dmsq);
00800       Int_t N = TemplateGrid::Instance()->GetDmsqBins() - 2;
00801       Int_t n = (Int_t)(TMath::Floor(interp_n));    
00802 
00803       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
00804       nDmsq = n;  alphaDmsq = 1.0 - (interp_n-n);     
00805     }
00806 
00807     // sinsq23
00808     // -------
00809     if( usingSinsq23 ){
00810       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinSinsq23(sinsq23);
00811       Int_t N = TemplateGrid::Instance()->GetSinsq23Bins() - 2;
00812       Int_t n = (Int_t)(TMath::Floor(interp_n));    
00813 
00814       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
00815       nSinsq23 = n;  alphaSinsq23 = 1.0 - (interp_n-n);    
00816     }
00817 
00818     // sinsq13
00819     // -------
00820     if( usingSinsq13 ){
00821       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinSinsq13(sinsq13);
00822       Int_t N = TemplateGrid::Instance()->GetSinsq13Bins() - 2;
00823       Int_t n = (Int_t)(TMath::Floor(interp_n));    
00824 
00825       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
00826       nSinsq13 = n;  alphaSinsq13 = 1.0 - (interp_n-n);    
00827     }
00828 
00829     // deltaCP
00830     // -------
00831     if( usingDeltaCP ){
00832       Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinDeltaCP(deltaCP);
00833       Int_t N = TemplateGrid::Instance()->GetDeltaCPBins() - 2;
00834       Int_t n = (Int_t)(TMath::Floor(interp_n));    
00835 
00836       if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
00837       nDeltaCP = n;  alphaDeltaCP = 1.0 - (interp_n-n);    
00838     }
00839   }
00840 
00841   // --- debug ---
00842   if( fDebug ){
00843     std::cout << " TemplateCalculator::Debug " << std::endl;
00844     std::cout << "   dmsq=" << dmsq << " sinsq23=" << sinsq23 << " sinsq13=" << sinsq13 << " deltaCP=" << deltaCP << std::endl;
00845     std::cout << "   nDmsq=" << nDmsq << " nSinsq23=" << nSinsq23 << " nSinsq13=" << nSinsq13 << " nDeltaCP=" << nDeltaCP << " nHierarchy=" << nHierarchy << std::endl;
00846     std::cout << "   alphaDmsq=" << alphaDmsq << " alphaSinsq23=" << alphaSinsq23 << " alphaSinsq13=" << alphaSinsq13 << " alphaDeltaCP=" << alphaDeltaCP << std::endl;
00847   }
00848 
00849   // non-oscillating samples
00850   // -----------------------
00851   GetExpectationForBeamData( 0, 0, 0, 0, 0,
00852                              cv, rock, nu, nubar,  
00853                              nc, 0, 0, 0, 
00854                              beam_numu_norm,  beam_numu_ncbkg, 
00855                              beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00856                              beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00857                              fTemplateLayer1 );
00858   myTemplate->Add( fTemplateLayer1 );
00859 
00860 
00861   // oscillating samples
00862   // --------------------
00863   GetExpectationForBeamData( nDmsq, nSinsq23, nSinsq13, nDeltaCP, 
00864                              nHierarchy,
00865                              cv, rock, nu, nubar,  
00866                              0,  nue, numu, nutau, 
00867                              beam_numu_norm,  beam_numu_ncbkg, 
00868                              beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00869                              beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00870                              fTemplateLayer1 );
00871   myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*alphaSinsq13*alphaDeltaCP );  
00872 
00873   if( usingDeltaCP ){
00874     GetExpectationForBeamData( nDmsq, nSinsq23, nSinsq13, nDeltaCP+1, 
00875                                nHierarchy,
00876                                cv, rock, nu, nubar,  
00877                                0,  nue, numu, nutau, 
00878                                beam_numu_norm,  beam_numu_ncbkg, 
00879                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00880                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00881                                fTemplateLayer1 );
00882     myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*alphaSinsq13*(1.0-alphaDeltaCP) );   
00883   }
00884 
00885   if( usingSinsq13 ){
00886     GetExpectationForBeamData( nDmsq, nSinsq23, nSinsq13+1, nDeltaCP, 
00887                                nHierarchy,
00888                                cv, rock, nu, nubar,  
00889                                0,  nue, numu, nutau, 
00890                                beam_numu_norm,  beam_numu_ncbkg, 
00891                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00892                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00893                                fTemplateLayer1 );
00894     myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*(1.0-alphaSinsq13)*alphaDeltaCP );  
00895   }
00896   
00897   if( usingSinsq13 && usingDeltaCP ){
00898     GetExpectationForBeamData( nDmsq, nSinsq23, nSinsq13+1, nDeltaCP+1, 
00899                                nHierarchy,
00900                                cv, rock, nu, nubar,  
00901                                0,  nue, numu, nutau, 
00902                                beam_numu_norm,  beam_numu_ncbkg, 
00903                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00904                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00905                                fTemplateLayer1 );
00906     myTemplate->Add( fTemplateLayer1, alphaDmsq*alphaSinsq23*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
00907   }
00908 
00909   if( usingSinsq23 ){
00910     GetExpectationForBeamData( nDmsq, nSinsq23+1, nSinsq13, nDeltaCP, 
00911                                nHierarchy,
00912                                cv, rock, nu, nubar,  
00913                                0,  nue, numu, nutau, 
00914                                beam_numu_norm,  beam_numu_ncbkg, 
00915                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00916                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00917                                fTemplateLayer1 );
00918     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*alphaSinsq13*alphaDeltaCP );  
00919   }
00920 
00921   if( usingSinsq23 && usingDeltaCP ){
00922     GetExpectationForBeamData( nDmsq, nSinsq23+1, nSinsq13, nDeltaCP+1, 
00923                                nHierarchy,
00924                                cv, rock, nu, nubar,  
00925                                0,  nue, numu, nutau, 
00926                                beam_numu_norm,  beam_numu_ncbkg, 
00927                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00928                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00929                                fTemplateLayer1 );
00930     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*alphaSinsq13*(1.0-alphaDeltaCP) );   
00931   }
00932 
00933   if( usingSinsq23 && usingSinsq13 ){
00934     GetExpectationForBeamData( nDmsq, nSinsq23+1, nSinsq13+1, nDeltaCP, 
00935                                nHierarchy,
00936                                cv, rock, nu, nubar,  
00937                                0,  nue, numu, nutau, 
00938                                beam_numu_norm,  beam_numu_ncbkg, 
00939                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00940                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00941                                fTemplateLayer1 );
00942     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*alphaDeltaCP );  
00943   }
00944 
00945   if( usingSinsq23 && usingSinsq13 && usingDeltaCP ){
00946     GetExpectationForBeamData( nDmsq, nSinsq23+1, nSinsq13+1, nDeltaCP+1, 
00947                                nHierarchy,
00948                                cv, rock, nu, nubar,  
00949                                0,  nue, numu, nutau, 
00950                                beam_numu_norm,  beam_numu_ncbkg, 
00951                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00952                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00953                                fTemplateLayer1 );
00954     myTemplate->Add( fTemplateLayer1, alphaDmsq*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
00955   }
00956 
00957   if( usingDmsq ){
00958     GetExpectationForBeamData( nDmsq+1, nSinsq23, nSinsq13, nDeltaCP, 
00959                                nHierarchy,
00960                                cv, rock, nu, nubar,  
00961                                0,  nue, numu, nutau, 
00962                                beam_numu_norm,  beam_numu_ncbkg, 
00963                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00964                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00965                                fTemplateLayer1 );
00966     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*alphaSinsq13*alphaDeltaCP );  
00967   }
00968 
00969   if( usingDmsq && usingDeltaCP ){
00970     GetExpectationForBeamData( nDmsq+1, nSinsq23, nSinsq13, nDeltaCP+1, 
00971                                nHierarchy,
00972                                cv, rock, nu, nubar,  
00973                                0,  nue, numu, nutau, 
00974                                beam_numu_norm,  beam_numu_ncbkg, 
00975                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
00976                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
00977                                fTemplateLayer1 );
00978     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*alphaSinsq13*(1.0-alphaDeltaCP) );   
00979   }
00980 
00981   if( usingDmsq && usingSinsq13 ){
00982     GetExpectationForBeamData( nDmsq+1, nSinsq23, nSinsq13+1, nDeltaCP, 
00983                                nHierarchy,
00984                                cv, rock, nu, nubar,  
00985                                0,  nue, numu, nutau, 
00986                                beam_numu_norm,  beam_numu_ncbkg, 
00987                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
00988                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy, 
00989                                fTemplateLayer1 );
00990     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*(1.0-alphaSinsq13)*alphaDeltaCP );  
00991   }
00992 
00993   if( usingDmsq && usingSinsq13 && usingDeltaCP ){
00994     GetExpectationForBeamData( nDmsq+1, nSinsq23, nSinsq13+1, nDeltaCP+1, 
00995                                nHierarchy,
00996                                cv, rock, nu, nubar,  
00997                                0,  nue, numu, nutau, 
00998                                beam_numu_norm,  beam_numu_ncbkg, 
00999                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
01000                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy, 
01001                                fTemplateLayer1 );
01002     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*alphaSinsq23*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
01003   }
01004 
01005   if( usingDmsq && usingSinsq23 ){
01006     GetExpectationForBeamData( nDmsq+1, nSinsq23+1, nSinsq13, nDeltaCP, 
01007                                nHierarchy,
01008                                cv, rock, nu, nubar,  
01009                                0,  nue, numu, nutau, 
01010                                beam_numu_norm,  beam_numu_ncbkg, 
01011                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01012                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
01013                                fTemplateLayer1 );
01014     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*alphaSinsq13*alphaDeltaCP );  
01015   }
01016 
01017   if( usingDmsq && usingSinsq23 && usingDeltaCP ){
01018     GetExpectationForBeamData( nDmsq+1, nSinsq23+1, nSinsq13, nDeltaCP+1, 
01019                                nHierarchy,
01020                                cv, rock, nu, nubar,  
01021                                0,  nue, numu, nutau, 
01022                                beam_numu_norm,  beam_numu_ncbkg, 
01023                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01024                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
01025                                fTemplateLayer1 );
01026     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*alphaSinsq13*(1.0-alphaDeltaCP) ); 
01027   }  
01028 
01029   if( usingDmsq && usingSinsq23 && usingSinsq13 ){
01030     GetExpectationForBeamData( nDmsq+1, nSinsq23+1, nSinsq13+1, nDeltaCP, 
01031                                nHierarchy,
01032                                cv, rock, nu, nubar,  
01033                                0,  nue, numu, nutau, 
01034                                beam_numu_norm,  beam_numu_ncbkg, 
01035                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
01036                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy,
01037                                fTemplateLayer1 );
01038     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*alphaDeltaCP );  
01039   }
01040 
01041   if( usingDmsq && usingSinsq23 && usingSinsq13 && usingDeltaCP ){
01042     GetExpectationForBeamData( nDmsq+1, nSinsq23+1, nSinsq13+1, nDeltaCP+1, 
01043                                nHierarchy,
01044                                cv, rock, nu, nubar,  
01045                                0,  nue, numu, nutau, 
01046                                beam_numu_norm,  beam_numu_ncbkg, 
01047                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
01048                                beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy, 
01049                                fTemplateLayer1 );
01050     myTemplate->Add( fTemplateLayer1, (1.0-alphaDmsq)*(1.0-alphaSinsq23)*(1.0-alphaSinsq13)*(1.0-alphaDeltaCP) );  
01051   }
01052 
01053   return;
01054 }

void TemplateCalculator::GetExpectationForBeamData ( Double_t  dmsq,
Double_t  sinsq,
Bool_t  cv,
Bool_t  rock,
Bool_t  nu,
Bool_t  nubar,
Bool_t  nc,
Bool_t  nue,
Bool_t  numu,
Bool_t  nutau,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Template *&  myTemplate 
)

Definition at line 387 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer1, OscFit::TemplateGrid::Instance(), OscFit::Oscillation::Instance(), Instance(), n, OscFit::Template::Reset(), and UsingBeamData().

Referenced by GetExpectation(), GetExpectationForBeamData(), GetMC(), and GetNCBackground().

00388 {
00389   // Reset template
00390   // --------------
00391   myTemplate->Reset();
00392   
00393   // Check data set
00394   // --------------
00395   if( UsingBeamData()==0 ) return;
00396 
00397   // Take Absolute Value of Dm2
00398   // --------------------------
00399   Double_t input_dmsq = fabs(dmsq);
00400 
00401   // Check for Oscillations
00402   // ----------------------
00403   Bool_t checkOsc = 0;  if( input_dmsq>0.0 ) checkOsc = 1;
00404 
00405   // Print Warning if there is no Grid
00406   // ---------------------------------
00407   if( checkOsc 
00408    && TemplateGrid::Instance()->TouchGrid()==0 ){
00409     std::cout << "   <Warning>: Oscillated spectra requested, but no grid loaded. " << std::endl
00410               << "              Reverting to null oscillations." << std::endl;
00411   }
00412 
00413   // Check that grid is set up for two flavours
00414   // ------------------------------------------  
00415   if( TemplateGrid::Instance()->TouchGrid() ){
00416     assert( Oscillation::Instance()->UsingTwoFlavours() );
00417   }
00418 
00419   // Interpolation between [0] and [n]
00420   // ---------------------------------
00421   // [0] corresponds to: 1
00422   // [n] corresponds to: 1-S, where: S=sin^2(1.267*dmsq*L/E)
00423   //   => 1*[0] - sinsq*[0] + sinsq*[n]
00424   //       = (1-sinsq) + sinsq*(1-S) = 1-sinsq*S   
00425   // Therefore, for an oscillation probability 1-sinsq*S, 
00426   // need to weight [0] by (1-sinsq), and [n] by sinsq.
00427 
00428   // Interpolation between [n] and [n+1]
00429   // -----------------------------------
00430   // Use simple Linear Interpolation
00431 
00432   // Dm2        bin,  weight   | bin,    weight
00433   // ------------------------------------------
00434   // dmsq    -> n,    alpha    | n+1,    1.0-alpha
00435 
00436   Int_t    nDmsq = 1;
00437   Double_t alpha = 1.0;
00438   Bool_t   usingDmsq = TemplateGrid::Instance()->UsingDmsq();
00439 
00440   if( checkOsc && usingDmsq ){
00441     Double_t interp_n = TemplateGrid::Instance()->FindInterpolatedBinDmsq(input_dmsq);
00442     Int_t N = TemplateGrid::Instance()->GetDmsqBins() - 2;
00443     Int_t n = (Int_t)(TMath::Floor(interp_n));    
00444 
00445     if( N<1 ) N = 1; if( n<1 ) n = 1; if( n>N ) n = N;
00446     nDmsq = n;  alpha = 1.0 - (interp_n-n);
00447   }
00448   
00449 
00450   // NC + Nue CC
00451   // -----------
00452   GetExpectationForBeamData( 0, 0, 0, 0, 0,
00453                              cv, rock, nu, nubar,  // cv, rock, nu, nubar
00454                              nc, nue, 0, 0,        // nc, nue, numu, nutau
00455                              beam_numu_norm,  beam_numu_ncbkg, 
00456                              beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
00457                              0.0, 0.0, 0.0,        // beam_nue_norm, beam_nue_ncbkg, beam_nue_energy 
00458                              fTemplateLayer1 );
00459   myTemplate->Add( fTemplateLayer1 );
00460 
00461   
00462   // Numu CC + Nutau CC (no oscillations)
00463   // ------------------------------------
00464   GetExpectationForBeamData( 0, 0, 0, 0, 0,
00465                              cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00466                              0, 0, numu, 0,        // nc, nue, numu, nutau
00467                              beam_numu_norm,  beam_numu_ncbkg, 
00468                              beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
00469                              0.0, 0.0, 0.0,        // beam_nue_norm, beam_nue_ncbkg, beam_nue_energy 
00470                              fTemplateLayer1 );
00471   myTemplate->Add( fTemplateLayer1 );  
00472 
00473 
00474   // Numu CC + Nutau CC (oscillations)
00475   // ---------------------------------
00476   if( checkOsc
00477    && TemplateGrid::Instance()->TouchGrid() ){
00478 
00479     GetExpectationForBeamData( 0, 0, 0, 0, 0,
00480                                cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00481                                0, 0, numu, 0,        // nc, nue, numu, nutau
00482                                beam_numu_norm,  beam_numu_ncbkg, 
00483                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
00484                                0.0, 0.0, 0.0,        // beam_nue_norm, beam_nue_ncbkg, beam_nue_energy 
00485                                fTemplateLayer1 );
00486     myTemplate->Add( fTemplateLayer1, (0.0-sinsq) );
00487 
00488     GetExpectationForBeamData( nDmsq, 0, 0, 0, 0,
00489                                cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00490                                0, 0, numu, 0,        // nc, nue, numu, nutau
00491                                beam_numu_norm,  beam_numu_ncbkg, 
00492                                beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
00493                                0.0, 0.0, 0.0,        // beam_nue_norm, beam_nue_ncbkg, beam_nue_energy 
00494                                fTemplateLayer1 );
00495     myTemplate->Add( fTemplateLayer1, alpha*sinsq );
00496 
00497     if( usingDmsq ){
00498       GetExpectationForBeamData( nDmsq+1, 0, 0, 0, 0,
00499                                  cv, rock, nu, nubar,  // cv, rock, nu, nubar  
00500                                  0, 0, numu, 0,        // nc, nue, numu, nutau
00501                                  beam_numu_norm,  beam_numu_ncbkg, 
00502                                  beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit,
00503                                  0.0, 0.0, 0.0,        // beam_nue_norm, beam_nue_ncbkg, beam_nue_energy 
00504                                  fTemplateLayer1 );
00505       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*sinsq );
00506     }
00507 
00508     GetExpectationForBeamData( nDmsq, 0, 0, 0, 0,
00509                                cv, rock, nu, nubar,  // cv, rock, nu, nubar 
00510                                0, 0, 0, nutau,       // nc, nue, numu, nutau
00511                                beam_numu_norm, 0.0, 0.0, 0.0, 0.0,
00512                                0.0, 0.0, 0.0,        // beam_nue_norm, beam_nue_ncbkg, beam_nue_energy 
00513                                fTemplateLayer1 );
00514     myTemplate->Add( fTemplateLayer1, alpha*sinsq );
00515 
00516     if( usingDmsq ){
00517       GetExpectationForBeamData( nDmsq+1, 0, 0, 0, 0,
00518                                  cv, rock, nu, nubar,  // cv, rock, nu, nubar 
00519                                  0, 0, 0, nutau,       // nc, nue, numu, nutau
00520                                  beam_numu_norm, 0.0, 0.0, 0.0, 0.0,
00521                                  0.0, 0.0, 0.0,        // beam_nue_norm, beam_nue_ncbkg, beam_nue_energy 
00522                                  fTemplateLayer1 );
00523       myTemplate->Add( fTemplateLayer1, (1.0-alpha)*sinsq );
00524     }
00525   }
00526 
00527   return;  
00528 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq,
Double_t  dmsqbar,
Double_t  sinsqbar,
Double_t  norm,
Double_t  ncbkg,
Double_t  shwen,
Double_t  trken,
TemplateArray *&  myTemplateArray 
)

Definition at line 147 of file twoflavours/TemplateCalculator.cxx.

References OscFit::TemplateArray::AddTemplate(), BuildExpt(), OscFit::Template::BuildHistograms(), fTemplateArrayLayer0, fTemplateLayer0, GetData(), GetExpectation(), OscFit::GetNumRuns(), OscFit::GetRun(), OscFit::TemplateArray::GetTemplate(), OverrideWithRealData(), OscFit::TemplateArray::Reset(), and run().

00148 {
00149   // reset template array
00150   myTemplateArray->Reset();
00151 
00152   // generate template
00153   this->GetExpectation(dmsq,sinsq,
00154                        dmsqbar,sinsqbar,
00155                        norm,ncbkg,
00156                        shwen,trken,
00157                        fTemplateArrayLayer0);
00158 
00159   // loop over runs
00160   for( Int_t irun = 0; irun<OscFit::GetNumRuns(); irun++ ){
00161     Run_t run = OscFit::GetRun(irun);  
00162 
00163     // get template
00164     Template* temp = fTemplateArrayLayer0->GetTemplate(run);
00165     if( temp==0 ) continue;   
00166 
00167     // build new template
00168     fTemplateLayer0 = myTemplateArray->GetTemplate( run );
00169 
00170     if( fTemplateLayer0==0 ){
00171       fTemplateLayer0 = new Template();
00172       fTemplateLayer0->BuildHistograms();
00173       myTemplateArray->AddTemplate( run, fTemplateLayer0 );
00174     }
00175 
00176     // add fluctuations
00177     this->BuildExpt( temp, fTemplateLayer0 ); 
00178 
00179     // ---- TEST ----
00180     if( OverrideWithRealData(run) ){
00181       this->GetData( run, fTemplateLayer0 );
00182     }
00183   }
00184   
00185   return;
00186 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  beam_nue_norm,
Double_t  beam_nue_ncbkg,
Double_t  beam_nue_energy,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_ratio_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_numu,
Double_t  atmos_spec_cv_numubar,
Double_t  atmos_spec_cv_nue,
Double_t  atmos_spec_cv_nuebar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Double_t  atmos_nue_energy,
Template *&  myTemplate 
)

Definition at line 2269 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02270 {
02271   GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
02272                   beam_numu_norm,      beam_numu_ncbkg, 
02273                   beam_numu_shwen,     beam_numu_trken, 
02274                   beam_numu_trken_exit,   
02275                   beam_nue_norm,       beam_nue_ncbkg,
02276                   beam_nue_energy,
02277                   atmos_norm_cv,       atmos_norm_rock,
02278                   atmos_ratio_cv,      atmos_ratio_rock, 
02279                   atmos_norm_nue,      atmos_ratio_nue,
02280                   atmos_norm_nc,       
02281                   atmos_spec_cv_numu,  atmos_spec_cv_numubar, 
02282                   atmos_spec_cv_nue,   atmos_spec_cv_nuebar, 
02283                   atmos_spec_rock_nu,  atmos_spec_rock_nubar, 
02284                   atmos_zenith,  
02285                   atmos_numu_trken,    atmos_numu_trken_exit, 
02286                   atmos_numu_shwen,    atmos_nue_energy,   
02287                   fTemplateLayer4 );
02288 
02289   return BuildExpt( fTemplateLayer4, myTemplate );
02290 }   

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_ratio_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_numu,
Double_t  atmos_spec_cv_numubar,
Double_t  atmos_spec_cv_nue,
Double_t  atmos_spec_cv_nuebar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Double_t  atmos_nue_energy,
Template *&  myTemplate 
)

Definition at line 2251 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02252 {
02253   GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
02254                   atmos_norm_cv,       atmos_norm_rock,
02255                   atmos_ratio_cv,      atmos_ratio_rock,   
02256                   atmos_norm_nue,      atmos_ratio_nue,
02257                   atmos_norm_nc,     
02258                   atmos_spec_cv_numu,  atmos_spec_cv_numubar, 
02259                   atmos_spec_cv_nue,   atmos_spec_cv_nuebar, 
02260                   atmos_spec_rock_nu,  atmos_spec_rock_nubar, 
02261                   atmos_zenith,
02262                   atmos_numu_trken,    atmos_numu_trken_exit, 
02263                   atmos_numu_shwen,    atmos_nue_energy,
02264                   fTemplateLayer4 );
02265 
02266   return BuildExpt( fTemplateLayer4, myTemplate );
02267 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  beam_nue_norm,
Double_t  beam_nue_ncbkg,
Double_t  beam_nue_energy,
Template *&  myTemplate 
)

Definition at line 2240 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02241 {
02242   GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
02243                   beam_numu_norm,  beam_numu_ncbkg, 
02244                   beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit, 
02245                   beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy, 
02246                   fTemplateLayer4 );
02247 
02248   return BuildExpt( fTemplateLayer4, myTemplate );
02249 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
Template *&  myTemplate 
)

Definition at line 2231 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02232 {
02233   GetExpectation( dmsq, sinsq23,
02234                   sinsq13, deltaCP,
02235                   fTemplateLayer4 );
02236 
02237   return BuildExpt( fTemplateLayer4, myTemplate );
02238 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_nu,
Double_t  atmos_spec_cv_nubar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Template *&  myTemplate 
)

Definition at line 2212 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02213 {
02214   GetExpectation( dmsq, sinsq,
02215                   beam_numu_norm,      beam_numu_ncbkg, 
02216                   beam_numu_shwen,     beam_numu_trken, 
02217                   beam_numu_trken_exit,    
02218                   atmos_norm_cv,       atmos_norm_rock,
02219                   atmos_ratio_cv,      atmos_ratio_rock,   
02220                   atmos_norm_nue,      atmos_norm_nc,     
02221                   atmos_spec_cv_nu,    atmos_spec_cv_nubar, 
02222                   atmos_spec_rock_nu,  atmos_spec_rock_nubar, 
02223                   atmos_zenith,   
02224                   atmos_numu_trken,    atmos_numu_trken_exit,
02225                   atmos_numu_shwen, 
02226                   fTemplateLayer4 );
02227 
02228   return BuildExpt( fTemplateLayer4, myTemplate );
02229 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq,
Double_t  atmos_norm_cv,
Double_t  atmos_norm_rock,
Double_t  atmos_ratio_cv,
Double_t  atmos_ratio_rock,
Double_t  atmos_norm_nue,
Double_t  atmos_norm_nc,
Double_t  atmos_spec_cv_nu,
Double_t  atmos_spec_cv_nubar,
Double_t  atmos_spec_rock_nu,
Double_t  atmos_spec_rock_nubar,
Double_t  atmos_zenith,
Double_t  atmos_numu_trken,
Double_t  atmos_numu_trken_exit,
Double_t  atmos_numu_shwen,
Template *&  myTemplate 
)

Definition at line 2196 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02197 {
02198   GetExpectation( dmsq, sinsq,
02199                   atmos_norm_cv,      atmos_norm_rock,
02200                   atmos_ratio_cv,     atmos_ratio_rock, 
02201                   atmos_norm_nue,     atmos_norm_nc, 
02202                   atmos_spec_cv_nu,   atmos_spec_cv_nubar, 
02203                   atmos_spec_rock_nu, atmos_spec_rock_nubar, 
02204                   atmos_zenith,
02205                   atmos_numu_trken,   atmos_numu_trken_exit,
02206                   atmos_numu_shwen, 
02207                   fTemplateLayer4 );
02208 
02209   return BuildExpt( fTemplateLayer4, myTemplate );
02210 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq,
Double_t  beam_numu_norm,
Double_t  beam_numu_ncbkg,
Double_t  beam_numu_shwen,
Double_t  beam_numu_trken,
Double_t  beam_numu_trken_exit,
Template *&  myTemplate 
)

Definition at line 2185 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02186 {
02187   GetExpectation( dmsq, sinsq,
02188                   beam_numu_norm,  beam_numu_ncbkg, 
02189                   beam_numu_shwen, beam_numu_trken, 
02190                   beam_numu_trken_exit,
02191                   fTemplateLayer4 );
02192 
02193   return BuildExpt( fTemplateLayer4, myTemplate );
02194 }

void TemplateCalculator::GetExperiment ( Double_t  dmsq,
Double_t  sinsq,
Template *&  myTemplate 
)

Definition at line 2177 of file TemplateCalculator.cxx.

References BuildExpt(), fTemplateLayer4, and GetExpectation().

02178 {
02179   GetExpectation( dmsq, sinsq, 
02180                   fTemplateLayer4 );
02181 
02182   return BuildExpt( fTemplateLayer4, myTemplate );
02183 }

void TemplateCalculator::GetMC ( Template *&  myTemplate  ) 

Definition at line 123 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer0, GetExpectationForAtmosData(), GetExpectationForBeamData(), OscFit::Template::Reset(), UsingAtmosData(), and UsingBeamData().

00124 {
00125   // reset template
00126   myTemplate->Reset();
00127 
00128   // atmospheric neutrinos
00129   if( UsingAtmosData() ){
00130     GetExpectationForAtmosData(0, 0, 0, 0, 0, //
00131                                1, 1, 1, 1,    // cv, rock, nu, nubar
00132                                1, 1, 1, 1,    // nc, nue, numu, nutau
00133                                1,             // cosmic
00134                                0.0,  0.0,     // atmos_norm_cv,      atmos_norm_rock
00135                                0.0,  0.0,     // atmos_ratio_cv,     atmos_ratio_rock,
00136                                0.0,  0.0,     // atmos_norm_nue,     atmos_ratio_nue,
00137                                0.0,           // atmos_norm_nc,      
00138                                0.0,  0.0,     // atmos_spec_cv_numu, atmos_spec_cv_numubar, 
00139                                0.0,  0.0,     // atmos_spec_cv_nue,  atmos_spec_cv_nuebar, 
00140                                0.0,  0.0,     // atmos_spec_rock_nu, atmos_spec_rock_nubar,   
00141                                0.0,           // atmos_zenith 
00142                                0.0,  0.0,     // atmos_numu_trken,   atmos_numu_trken_exit,
00143                                0.0,  0.0,     // atmos_numu_shwen,   atmos_nue_energy   
00144                                fTemplateLayer0 );
00145     myTemplate->Add( fTemplateLayer0 );
00146   }
00147 
00148   // beam neutrinos
00149   if( UsingBeamData() ){
00150     GetExpectationForBeamData(0, 0, 0, 0, 0,    //
00151                               1, 1, 1, 1,       // cv, rock, nu, nubar
00152                               1, 1, 1, 1,       // nc, nue, numu, nutau
00153                               0.0,  0.0,        // beam_numu_norm,  beam_numu_ncbkg, 
00154                               0.0,  0.0,  0.0,  // beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit
00155                               0.0,  0.0,  0.0,  // beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy
00156                               fTemplateLayer0 );
00157     myTemplate->Add( fTemplateLayer0 );
00158   }
00159  
00160   return;                                 
00161 } 

void TemplateCalculator::GetNCBackground ( Template *&  myTemplate  ) 

Definition at line 163 of file TemplateCalculator.cxx.

References OscFit::Template::Add(), fTemplateLayer0, GetExpectationForAtmosData(), GetExpectationForBeamData(), OscFit::Template::Reset(), UsingAtmosData(), and UsingBeamData().

00164 {
00165   // reset template
00166   myTemplate->Reset();
00167 
00168   // atmospheric neutrinos
00169   if( UsingAtmosData() ){
00170     GetExpectationForAtmosData(0, 0, 0, 0, 0, //
00171                                1, 1, 1, 1,    // cv, rock, nu, nubar
00172                                1, 0, 0, 0,    // nc, nue, numu, nutau
00173                                0,             // cosmic
00174                                0.0,  0.0,     // atmos_norm_cv,      atmos_norm_rock
00175                                0.0,  0.0,     // atmos_ratio_cv,     atmos_ratio_rock,
00176                                0.0,  0.0,     // atmos_norm_nue,     atmos_ratio_nue,
00177                                0.0,           // atmos_norm_nc,   
00178                                0.0,  0.0,     // atmos_spec_cv_numu, atmos_spec_cv_numubar, 
00179                                0.0,  0.0,     // atmos_spec_cv_nue,  atmos_spec_cv_nuebar,  
00180                                0.0,  0.0,     // atmos_spec_rock_nu, atmos_spec_rock_nubar,   
00181                                0.0,           // atmos_zenith 
00182                                0.0,  0.0,     // atmos_numu_trken,   atmos_numu_trken_exit,
00183                                0.0,  0.0,     // atmos_numu_shwen,   atmos_nue_energy   
00184                                fTemplateLayer0 );
00185     myTemplate->Add( fTemplateLayer0 );
00186   }
00187 
00188   // beam neutrinos
00189   if( UsingBeamData() ){
00190     GetExpectationForBeamData(0, 0, 0, 0, 0,    //
00191                               1, 1, 1, 1,       // cv, rock, nu, nubar
00192                               1, 0, 0, 0,       // nc, nue, numu, nutau
00193                               0.0,  0.0,        // beam_numu_norm,  beam_numu_ncbkg, 
00194                               0.0,  0.0,  0.0,  // beam_numu_shwen, beam_numu_trken, beam_numu_trken_exit
00195                               0.0,  0.0,  0.0,  // beam_nue_norm,   beam_nue_ncbkg,  beam_nue_energy
00196                               fTemplateLayer0 );
00197     myTemplate->Add( fTemplateLayer0 );
00198   }
00199  
00200   return;                                 
00201 } 

Bool_t OscFit::TemplateCalculator::GetSwitchForAtmosData (  )  [inline]

Definition at line 254 of file TemplateCalculator.h.

References fInternalSwitchForAtmosData.

Referenced by UsingAtmosData().

00254 { return fInternalSwitchForAtmosData; }

Bool_t OscFit::TemplateCalculator::GetSwitchForBeamData (  )  [inline]

Definition at line 259 of file TemplateCalculator.h.

References fInternalSwitchForBeamData.

Referenced by UsingBeamData().

00259 { return fInternalSwitchForBeamData; }

void TemplateCalculator::Initialise (  ) 

Definition at line 57 of file TemplateCalculator.cxx.

References OscFit::Configuration::Instance(), and Instance().

Referenced by TemplateCalculator().

00058 {
00059   std::cout << " *** TemplateCalculator::Initialise() *** " << std::endl;
00060 
00061   // check templates
00062   if( Configuration::Instance()->DoingFileChecks() ){
00063     TemplateReader::Instance()->CheckTemplates();
00064   }
00065 
00066   // load first point
00067   if( Configuration::Instance()->DoingDynamicLoading() ){
00068     TemplateReader::Instance()->LoadFirstGridPoint();
00069   }
00070 
00071   // load everything
00072   else{
00073     TemplateReader::Instance()->LoadTemplates();
00074   }
00075   std::cout << " *** TemplateCalculator::Initialise() *** DONE *** " << std::endl;
00076 }

static TemplateCalculator* OscFit::TemplateCalculator::Instance (  )  [static]
TemplateCalculator * TemplateCalculator::Instance (  )  [static]
Bool_t TemplateCalculator::OverrideWithRealData ( Run_t  run  )  [private]

Definition at line 193 of file twoflavours/TemplateCalculator.cxx.

References fOverrideWithRealData, OscFit::kRunI, OscFit::kRunIHE, OscFit::kRunII, and OscFit::kRunIII.

Referenced by GetExperiment().

00194 {
00195   if( !fOverrideWithRealData ){
00196     return 0;
00197   }
00198 
00199   if( run==OscFit::kRunI
00200    || run==OscFit::kRunIHE
00201    || run==OscFit::kRunII
00202    || run==OscFit::kRunIII ) {
00203     return 1;
00204   }
00205   else {
00206     return 0;
00207   }
00208 }

void OscFit::TemplateCalculator::SetDebug ( Bool_t  yesno = 1  )  [inline]

Definition at line 262 of file TemplateCalculator.h.

References fDebug.

00262 { fDebug = yesno; }

void TemplateCalculator::SetOverride ( Bool_t  yesno = 1  ) 

Definition at line 188 of file twoflavours/TemplateCalculator.cxx.

References fOverrideWithRealData.

00189 {
00190   fOverrideWithRealData = yesno;
00191 }

void OscFit::TemplateCalculator::SwitchAtmosDataOnOff ( Bool_t  yesno = 1  )  [inline]

Definition at line 253 of file TemplateCalculator.h.

References fInternalSwitchForAtmosData.

Referenced by SwitchOffAtmosData().

00253 { fInternalSwitchForAtmosData = yesno; }

void OscFit::TemplateCalculator::SwitchBeamDataOnOff ( Bool_t  yesno = 1  )  [inline]

Definition at line 258 of file TemplateCalculator.h.

References fInternalSwitchForBeamData.

Referenced by SwitchOffBeamData().

00258 { fInternalSwitchForBeamData = yesno; }

void OscFit::TemplateCalculator::SwitchOffAtmosData (  )  [inline]

Definition at line 252 of file TemplateCalculator.h.

References SwitchAtmosDataOnOff().

00252 { SwitchAtmosDataOnOff(false); }

void OscFit::TemplateCalculator::SwitchOffBeamData (  )  [inline]

Definition at line 257 of file TemplateCalculator.h.

References SwitchBeamDataOnOff().

00257 { SwitchBeamDataOnOff(false); }

Bool_t TemplateCalculator::UsingAtmosData (  )  [private]
Bool_t TemplateCalculator::UsingBeamData (  )  [private]

Member Data Documentation

Definition at line 116 of file twoflavours/TemplateCalculator.h.

Referenced by CombineResBins(), GetData(), and GetExpectation().

Definition at line 118 of file twoflavours/TemplateCalculator.h.

Referenced by OverrideWithRealData(), and SetOverride().

Definition at line 114 of file twoflavours/TemplateCalculator.h.

Referenced by GetExperiment().

Definition at line 334 of file TemplateCalculator.h.

Referenced by GetExperiment(), TemplateCalculator(), and ~TemplateCalculator().


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

Generated on 16 Apr 2018 for loon by  doxygen 1.6.1