OscFit::TemplateMaker Class Reference

#include <TemplateMaker.h>

List of all members.

Public Member Functions

void BuildFakeData (Experiment_t experiment, Source_t source, Double_t dmsq, Double_t sinsq, const char *filename)
void BuildFakeData (Experiment_t experiment, Source_t source, Double_t dmsq, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, const char *filename)
void BuildFakeData (Experiment_t experiment, Source_t source, Double_t dmsq21, Double_t dmsq32, Double_t sinsq12, Double_t sinsq23, Double_t sinsq13, Double_t deltaCP, const char *filename)
void BuildFakeData (Experiment_t experiment, Source_t source, GridPoint *gridPoint, const char *filename)
void BuildFakeBeamData (Experiment_t experiment, 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, const char *filename)
void BuildFakeAtmosData (Experiment_t experiment, 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, const char *filename)
void BuildData (Experiment_t experiment, Source_t source)
void BuildMC (Experiment_t experiment, Source_t source)
void BuildTemplates (Experiment_t experiment, Source_t source)
void BuildTemplates (Experiment_t experiment, Source_t source, Sample_t sample)
void BuildTemplates (Experiment_t experiment, RunType_t runtype, Sample_t sample)
void PrintTemplates ()
void WriteTemplates ()
void SwitchOnSystematics ()
void SwitchOffSystematics ()
void RunGridPoint (Int_t ipoint)
void RunGridPoints (Int_t ifirst, Int_t ilast)
void SetOutputPath (const char *filename)
void SetOutputFile (const char *filename)
void SetFileName (const char *filename)
void SetNumEvents (Int_t nevents)
void SetLiveTime (Double_t years)
void DoCombinedOscWeights (Bool_t yesno=1)
void RunTest ()
void BuildGrid (Int_t n, Double_t min, Double_t max)
void BuildTemplates ()
void BuildTemplates (Run_t run)
void SetSubBins (Double_t nbins)
void SetInputPath (const char *filename)
void SetInputFile (const char *filename)
void SetInputDirectoryCC2010 (const char *dirname)
void SetOutputPath (const char *filename)
void SetOutputFile (const char *filename)
void SetFileName (const char *filename)
void UseCC2010Templates ()
void UseCC2010TemplatesVeryOld ()
void BuildNuMuBar ()
void BuildFHCBAR ()
void BuildRAFOnly ()
void BuildCCOnly ()
void BuildRHCOnly ()
void BuildNUBAROnly ()
void BuildAll ()
void BuildDataOnly ()
void SwitchOnSystematics ()
void SwitchOffSystematics ()
void BuildTemplatesCC2012 (Run_t run)
void BuildTemplatesCC2012 (Run_t run, Sample_t sample, Systematic_t systematic, Shift_t shift, Bin_t bin)
void BuildTemplatesCC2010 (Run_t run)
void BuildTemplatesCC2010 (Run_t run, Sample_t sample, Systematic_t systematic, Shift_t shift, Bin_t bin)
Double_t GetDensity (TH2D *hist, Double_t Ereco, Double_t Etrue)
Double_t GetOscProb (Sample_t sample, Interaction_t interaction, Double_t Enu, Double_t dmsq, Double_t sinsq=1.0)

Static Public Member Functions

static TemplateMakerInstance ()
static TemplateMakerInstance ()
static TemplateNewTemplate ()

Private Member Functions

 TemplateMaker ()
 ~TemplateMaker ()
void SetupTemplatesForMINOS (RunType_t runtype, Sample_t sample)
void SetupTemplatesForLBNE (RunType_t runtype, Sample_t sample)
void MakeTemplate (RunType_t runtype, Sample_t sample, Containment_t recoContainment, Flavour_t recoFlavour, Charge_t recoCharge, Resolution_t recoResolution, Topology_t recoTopology, ProtonTag_t recoProton, ElectronTag_t recoElectron)
void AddData (Data *myData, Double_t myWeight=1.0, OscType_t myOscType=kNonOsc, Int_t Nevents=-1)
void AddEvent (Event *myEvent, Double_t myWeightPerEvent=1.0, OscType_t myOscType=kNonOsc, Systematic_t mySystematic=kCentre, Shift_t myShift=kNoShift)
Double_t GetOscWeight (Event *myEvent, GridPoint *gridPoint)
Double_t GetOscWeight (Int_t n, Event *myEvent)
Double_t GetCachedOscWeight (Int_t n, Event *myEvent)
void LoadCachedOscWeights (Event *myEvent)
void UnloadCachedOscWeights ()
void SetRangeOfGridPoints ()
 TemplateMaker ()
virtual ~TemplateMaker ()
void BuildTemplate (Run_t run, Bin_t bin, TH1D *hist)
void BuildTemplate (Run_t run, Sample_t sample, Interaction_t interaction, Bin_t bin, TH1D *hist)
void BuildTemplate (Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift, Bin_t bin, TH1D *hist)
void BuildTemplate (Run_t run, Sample_t sample, Interaction_t interaction, Bin_t bin, TH2D *hist)
void BuildTemplate (Run_t run, Sample_t sample, Interaction_t interaction, Systematic_t systematic, Shift_t shift, Bin_t bin, TH2D *hist)

Private Attributes

TString fOutFile
Int_t fFirstPoint
Int_t fLastPoint
Int_t fThisFirstPoint
Int_t fThisLastPoint
Bool_t fGridIsLoaded
Bool_t fDoCombinedOscWeights
Double_t fYears
Int_t fNevents
GridPointfSingleGridPoint
Double_t * fCache
Int_t fCacheCtr
TString fInputPath
TString fInputDirectoryCC2010
Bool_t fUseCC2010Templates
Bool_t fUseCC2010TemplatesVeryOld
Bool_t fBuildNuMuBar
Bool_t fBuildRAFOnly
Bool_t fBuildCCOnly
Bool_t fBuildRHCOnly
Bool_t fBuildNUBAROnly
Bool_t fBuildDataOnly
Double_t fSubBins

Detailed Description

Definition at line 14 of file TemplateMaker.h.


Constructor & Destructor Documentation

TemplateMaker::TemplateMaker (  )  [private]

Definition at line 32 of file TemplateMaker.cxx.

References fCache, fCacheCtr, fDoCombinedOscWeights, fFirstPoint, fGridIsLoaded, fLastPoint, fNevents, fOutFile, fSingleGridPoint, fThisFirstPoint, fThisLastPoint, and fYears.

Referenced by Instance().

00033 {
00034   std::cout << " *** TemplateMaker::TemplateMaker() *** " << std::endl;
00035 
00036   fOutFile = "temp.atmos.root";
00037 
00038   fFirstPoint = -1;
00039   fLastPoint  = -1;
00040 
00041   fThisFirstPoint = -1;
00042   fThisLastPoint  = -1;
00043 
00044   fGridIsLoaded = 0;
00045 
00046   fDoCombinedOscWeights = 0;
00047 
00048   fNevents = -1;
00049 
00050   fYears = 0.0;
00051 
00052   fSingleGridPoint = 0;
00053 
00054   fCache = 0;
00055   fCacheCtr = -1;
00056 }

TemplateMaker::~TemplateMaker (  )  [private]

Definition at line 58 of file TemplateMaker.cxx.

00059 {
00060   
00061 }

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

Member Function Documentation

void TemplateMaker::AddData ( Data myData,
Double_t  myWeight = 1.0,
OscType_t  myOscType = kNonOsc,
Int_t  Nevents = -1 
) [private]

Definition at line 800 of file TemplateMaker.cxx.

References AddEvent(), OscFit::AsString(), fDoCombinedOscWeights, OscFit::Data::GetEvent(), OscFit::Data::GetNumEvents(), OscFit::GetNumShifts(), OscFit::GetNumSystematics(), OscFit::GetShift(), OscFit::GetSystematic(), OscFit::kNonOsc, OscFit::kNue2Nutau, and OscFit::kNumu2Nue.

Referenced by BuildTemplates().

00801 {
00802   // sanity checks
00803   if( myData==0 || Nevents==0 || myWeight<=0 ) return;
00804 
00805   // combining NoOsc/Numu2Nue and Numu2Nutau/Nue2Nutau in single pass
00806   if( fDoCombinedOscWeights ){
00807     if( myOscType==kNumu2Nue || myOscType==kNue2Nutau ) return;
00808   }
00809 
00810   // loop over events
00811   if( myData->GetNumEvents()>0 ){  
00812 
00813     int iLast = Nevents;
00814     if( iLast<0 || iLast>myData->GetNumEvents() ){
00815       iLast = myData->GetNumEvents();
00816     }
00817 
00818     Double_t myWeightPerEvent = 1.0;
00819     if( myOscType!=kNonOsc ){
00820       myWeightPerEvent = myWeight/(Double_t)(iLast);
00821     }
00822     
00823     std::cout << "   Adding Data: " << AsString(myOscType) << " (Events=" << iLast << ", Weight=" << myWeightPerEvent << ")" << std::endl;
00824 
00825     for( Int_t ievent=0; ievent<iLast; ievent++ ){
00826       if( ievent%100000==0 ) std::cout << "    [" << ievent << "/" << iLast << "] " << std::endl;
00827 
00828       Event* myEvent = myData->GetEvent(ievent); 
00829 
00830       for( Int_t isys =0; isys<OscFit::GetNumSystematics(); isys++ ){ 
00831         for( Int_t ishift = 0; ishift<OscFit::GetNumShifts(); ishift++ ){ 
00832           Systematic_t mySystematic = OscFit::GetSystematic( isys );
00833           Shift_t      myShift      = OscFit::GetShift( ishift );
00834 
00835           this->AddEvent( myEvent, myWeightPerEvent, myOscType, mySystematic, myShift );
00836         }
00837       }
00838     }
00839 
00840     std::cout << "   Adding Data: " << AsString(myOscType) << " (Done)" << std::endl;
00841   }
00842 }

void TemplateMaker::AddEvent ( Event myEvent,
Double_t  myWeightPerEvent = 1.0,
OscType_t  myOscType = kNonOsc,
Systematic_t  mySystematic = kCentre,
Shift_t  myShift = kNoShift 
) [private]

Definition at line 844 of file TemplateMaker.cxx.

References OscFit::Event::Containment, OscFit::Event::Experiment, fThisFirstPoint, fThisLastPoint, GetCachedOscWeight(), OscFit::GetContainmentType(), GetOscWeight(), OscFit::GetResolutionType(), Instance(), OscFit::Configuration::Instance(), OscFit::kAtmosData, OscFit::kBeamData, OscFit::kCentre, OscFit::kContainedVertex, OscFit::kCV, OscFit::kHiRes, OscFit::kMINOS, OscFit::kNC, OscFit::kNCbkg, OscFit::kNoFlavour, OscFit::kNonOsc, OscFit::kNoShift, OscFit::kNue, OscFit::kNue2Nutau, OscFit::kNueEnergy, OscFit::kNueNCbkg, OscFit::kNumu, OscFit::kNumu2Nue, OscFit::kNumu2Nutau, OscFit::kRock, OscFit::kRockMuon, OscFit::kShwEn, OscFit::kSpec, OscFit::kTrkEn, OscFit::kTrkEnExit, OscFit::kZenith, LoadCachedOscWeights(), n, OscFit::Event::RecoFlavour, OscFit::Event::RecoPass, OscFit::Event::Resolution, OscFit::Event::Sample, SetRangeOfGridPoints(), OscFit::Event::Source, OscFit::Event::TrueFlavour, and OscFit::Event::Weight.

Referenced by AddData().

00845 {  
00846   // Checks on Data
00847   // ==============
00848   if( myInputEvent==0 
00849    || myInputEvent->RecoPass==0 
00850    || myWeightPerEvent*myInputEvent->Weight<=0 ) return;
00851 
00852   // systematics on/off
00853   if( mySystematic!=OscFit::kCentre 
00854    && Configuration::Instance()->DoingSystematics()==0 ) return;
00855 
00856   // systematics checks
00857   if( mySystematic==OscFit::kCentre && myShift!=OscFit::kNoShift ) return;
00858   if( mySystematic!=OscFit::kCentre && myShift==OscFit::kNoShift ) return;
00859   if( mySystematic!=OscFit::kCentre && myOscType==OscFit::kNonOsc ) return;
00860 
00861   // ignore systematics in sub-dominant components
00862   if( mySystematic!=OscFit::kCentre ){
00863     if( myInputEvent->Sample==OscFit::kCV  
00864      && OscFit::GetContainmentType(myInputEvent->Containment)==OscFit::kRockMuon )
00865       return;
00866     if( myInputEvent->Sample==OscFit::kRock
00867      && OscFit::GetContainmentType(myInputEvent->Containment)==OscFit::kContainedVertex ) 
00868       return;
00869   }
00870 
00871   // ignore systematics in sub-dominant components
00872   if( mySystematic!=OscFit::kCentre ){
00873     if( myInputEvent->RecoFlavour==OscFit::kNumu
00874      && myInputEvent->TrueFlavour==OscFit::kNue ) 
00875       return;
00876     if( myInputEvent->RecoFlavour==OscFit::kNue
00877      && myInputEvent->TrueFlavour==OscFit::kNumu ) 
00878       return;
00879   }
00880 
00881   // ignore shower systematics in rock muon sample
00882   if( myInputEvent->Sample==OscFit::kRock
00883    || OscFit::GetContainmentType(myInputEvent->Containment)==OscFit::kRockMuon ){
00884     if( mySystematic==OscFit::kNCbkg 
00885      || mySystematic==OscFit::kShwEn 
00886      || mySystematic==OscFit::kZenith 
00887      || mySystematic==OscFit::kNueNCbkg 
00888      || mySystematic==OscFit::kNueEnergy ) return;
00889   }
00890 
00891   // ignore electron systematics in muon sample
00892   if( myInputEvent->RecoFlavour==OscFit::kNumu
00893    || myInputEvent->TrueFlavour==OscFit::kNumu ){
00894     if( mySystematic==OscFit::kNueNCbkg 
00895      || mySystematic==OscFit::kNueEnergy ) return;
00896   }
00897   
00898   // ignore muon systematics in electron sample
00899   if( myInputEvent->RecoFlavour==OscFit::kNue
00900    || myInputEvent->TrueFlavour==OscFit::kNue ){
00901     if( mySystematic==OscFit::kNCbkg
00902      || mySystematic==OscFit::kTrkEn
00903      || mySystematic==OscFit::kTrkEnExit ) return;
00904   }
00905 
00906   // ignore non-NC systematics in NC background
00907   if( myInputEvent->TrueFlavour==OscFit::kNC ){
00908     if( mySystematic==OscFit::kSpec
00909      || mySystematic==OscFit::kZenith
00910      || mySystematic==OscFit::kShwEn
00911      || mySystematic==OscFit::kTrkEn
00912      || mySystematic==OscFit::kTrkEnExit
00913      || mySystematic==OscFit::kNueEnergy ) return;
00914   }
00915 
00916   // ignore beam systematics in atmos sample
00917   if( myInputEvent->Source==OscFit::kAtmosData ){
00918     if( mySystematic==OscFit::kNCbkg
00919      || mySystematic==OscFit::kNueNCbkg ) return;
00920   }
00921 
00922   // ignore atmos systematics in beam sample
00923   if( myInputEvent->Source==OscFit::kBeamData ){
00924     if( mySystematic==OscFit::kSpec
00925      || mySystematic==OscFit::kZenith ) return;
00926   }
00927 
00928   // ignore LBNE systematics in MINOS sample
00929   if( myInputEvent->Experiment==OscFit::kMINOS
00930    && myInputEvent->Source==OscFit::kAtmosData ){
00931     if( mySystematic==OscFit::kNueEnergy ) return;
00932   }
00933 
00934   // ignore shape systematics in low resolution sample
00935   if( mySystematic!=OscFit::kCentre ){
00936     if( OscFit::GetResolutionType(myInputEvent->Resolution)!=OscFit::kHiRes ) return;
00937   } 
00938 
00939   // check for non-oscillating sample
00940   if( myInputEvent->TrueFlavour==OscFit::kNoFlavour ){
00941     if( myOscType==OscFit::kNumu2Nue 
00942      || myOscType==OscFit::kNumu2Nutau 
00943      || myOscType==OscFit::kNue2Nutau ) return;
00944   }
00945 
00946 
00947   // Cache Oscillation Weights
00948   // =========================
00949   if( Configuration::Instance()->UsingCachedOscWeights() ){
00950     this->LoadCachedOscWeights( myInputEvent );
00951   }
00952 
00953 
00954   // Apply Systematics
00955   // =================
00956   Event* myEvent = EventCalculator::Instance()->Reweight( myInputEvent, mySystematic, myShift );
00957 
00958 
00959   // Set Range of Grid Points
00960   // ========================
00961   SetRangeOfGridPoints();
00962 
00963   Int_t nFirst = fThisFirstPoint;
00964   Int_t nLast  = fThisLastPoint; 
00965 
00966 
00967   // Build Multiple Grid Points
00968   // ==========================
00969   for( Int_t n=nFirst; n<nLast; n++ ){
00970      
00971     // check for non-oscillating sample
00972     if( myEvent->TrueFlavour==OscFit::kNoFlavour && n>0 ) continue;
00973 
00974     //
00975     //GridPoint* thisPoint = TemplateGrid::Instance()->GetGridPoint(n);
00976     //
00977     //if( n==0 
00978     // && fSingleGridPoint ) thisPoint = fSingleGridPoint;
00979     //
00980     //Double_t oscWeight = this->GetOscWeight( myEvent, thisPoint );
00981     //
00982 
00983     // calculate oscillation weight    
00984     Double_t oscWeight = 0.0;
00985 
00986     if( Configuration::Instance()->UsingCachedOscWeights() ){
00987       oscWeight = this->GetCachedOscWeight( n, myEvent );
00988     }
00989     else{
00990       oscWeight = this->GetOscWeight( n, myEvent );
00991     }
00992 
00993     // add this event
00994     OscFit::Interface::Instance()->Fill( n, 
00995                                          myEvent, 
00996                                          myWeightPerEvent*oscWeight ); // extra weight
00997   }
00998 
00999   return;
01000 }

void OscFit::TemplateMaker::BuildAll (  )  [inline]

Definition at line 94 of file twoflavours/TemplateMaker.h.

References fBuildCCOnly, fBuildNUBAROnly, and fBuildRHCOnly.

00094                     {
00095       fBuildCCOnly    = 0;
00096       fBuildRHCOnly   = 0;
00097       fBuildNUBAROnly = 0;
00098     }

void OscFit::TemplateMaker::BuildCCOnly (  )  [inline]

Definition at line 76 of file twoflavours/TemplateMaker.h.

References fBuildCCOnly, fBuildNUBAROnly, and fBuildRHCOnly.

00076                        {
00077       fBuildCCOnly    = 1;
00078       fBuildRHCOnly   = 0;
00079       fBuildNUBAROnly = 0;
00080     }

void TemplateMaker::BuildData ( Experiment_t  experiment,
Source_t  source 
)

Definition at line 529 of file TemplateMaker.cxx.

References BuildTemplates(), and OscFit::kData.

00530 {
00531   BuildTemplates( experiment, source, kData );
00532 }

void OscFit::TemplateMaker::BuildDataOnly (  )  [inline]

Definition at line 100 of file twoflavours/TemplateMaker.h.

References fBuildDataOnly.

00100                          {
00101       fBuildDataOnly = 1;
00102     }

void TemplateMaker::BuildFakeAtmosData ( Experiment_t  experiment,
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,
const char *  filename 
)

Definition at line 392 of file TemplateMaker.cxx.

References OscFit::AsString(), BuildMC(), fGridIsLoaded, fThisFirstPoint, fThisLastPoint, Instance(), OscFit::Configuration::Instance(), OscFit::kAtmosData, PrintTemplates(), SwitchOnSystematics(), and UnloadCachedOscWeights().

00393 {
00394   std::cout << " *** TemplateMaker::BuildFakeAtmosData(...) *** " << std::endl;
00395   std::cout << "   Experiment: " << AsString(experiment) << std::endl;
00396   std::cout << "   Oscillations: " << std::endl; 
00397   std::cout << "    dmsq    = " << dmsq << std::endl;
00398   std::cout << "    sinsq23 = " << sinsq23 << std::endl;
00399   std::cout << "    sinsq13 = " << sinsq13 << std::endl;
00400   std::cout << "    deltaCP = " << deltaCP << std::endl;
00401   std::cout << "   Systematics: " << std::endl; 
00402   std::cout << "    atmos_norm_cv         = " << atmos_norm_cv         << std::endl;
00403   std::cout << "    atmos_norm_rock       = " << atmos_norm_rock       << std::endl;
00404   std::cout << "    atmos_ratio_cv        = " << atmos_ratio_cv        << std::endl;
00405   std::cout << "    atmos_ratio_rock      = " << atmos_ratio_rock      << std::endl;
00406   std::cout << "    atmos_norm_nue        = " << atmos_norm_nue        << std::endl; 
00407   std::cout << "    atmos_ratio_nue       = " << atmos_ratio_nue       << std::endl; 
00408   std::cout << "    atmos_norm_nc         = " << atmos_norm_nc         << std::endl; 
00409   std::cout << "    atmos_spec_cv_numu    = " << atmos_spec_cv_numu    << std::endl; 
00410   std::cout << "    atmos_spec_cv_numubar = " << atmos_spec_cv_numubar << std::endl; 
00411   std::cout << "    atmos_spec_cv_nue     = " << atmos_spec_cv_nue     << std::endl; 
00412   std::cout << "    atmos_spec_cv_nuebar  = " << atmos_spec_cv_nuebar  << std::endl; 
00413   std::cout << "    atmos_spec_rock_nu    = " << atmos_spec_rock_nu    << std::endl; 
00414   std::cout << "    atmos_spec_rock_nubar = " << atmos_spec_rock_nubar << std::endl;  
00415   std::cout << "    atmos_zenith          = " << atmos_zenith          << std::endl;  
00416   std::cout << "    atmos_numu_trken      = " << atmos_numu_trken      << std::endl;  
00417   std::cout << "    atmos_numu_trken_exit = " << atmos_numu_trken_exit << std::endl;  
00418   std::cout << "    atmos_numu_shwen      = " << atmos_numu_shwen      << std::endl;  
00419   std::cout << "    atmos_nue_energy      = " << atmos_nue_energy      << std::endl;   
00420 
00421 
00422   // Check Experiment
00423   // ================
00424   if( experiment != Configuration::Instance()->GetExperiment() ){
00425     std::cout << "   <Warning>: This experiment doesn't make sense [return] " << std::endl;
00426     return;
00427   }
00428 
00429 
00430   // Initialisation
00431   // ==============
00432   Oscillation::Instance()->ThreeFlavours();
00433 
00434   TemplateGrid::Instance()->Reset();
00435   TemplateGrid::Instance()->BuildGridDmsq(std::fabs(dmsq));
00436   TemplateGrid::Instance()->BuildGridSinsq23(sinsq23);
00437   TemplateGrid::Instance()->BuildGridSinsq13(sinsq13);
00438   TemplateGrid::Instance()->BuildGridDeltaCP(deltaCP);
00439 
00440   fThisFirstPoint = 0;
00441   fThisLastPoint  = 3;
00442   fGridIsLoaded   = 1;
00443 
00444 
00445   Bool_t saveSyst = Configuration::Instance()->DoingSystematics();
00446 
00447   Configuration::Instance()->SwitchOnSystematics();
00448 
00449   if( Configuration::Instance()->UsingCachedOscWeights() ){
00450     UnloadCachedOscWeights();
00451   }
00452 
00453 
00454   // Build Templates
00455   // ===============
00456   BuildMC( experiment, OscFit::kAtmosData );
00457 
00458   PrintTemplates();
00459 
00460 
00461   // Write an 'input' file
00462   // =====================
00463   Template* inputTemplate  = new Template();
00464 
00465   TemplateCalculator::Instance()->GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
00466                                                   atmos_norm_cv, atmos_norm_rock, atmos_ratio_cv, atmos_ratio_rock,
00467                                                   atmos_norm_nue, atmos_ratio_nue, atmos_norm_nc, 
00468                                                   atmos_spec_cv_numu, atmos_spec_cv_numubar,
00469                                                   atmos_spec_cv_nue, atmos_spec_cv_nuebar,
00470                                                   atmos_spec_rock_nu, atmos_spec_rock_nubar,
00471                                                   atmos_zenith,
00472                                                   atmos_numu_trken, atmos_numu_trken_exit, 
00473                                                   atmos_numu_shwen, atmos_nue_energy,
00474                                                   inputTemplate);
00475 
00476   TString inputLabel = ".fakedata";
00477   TString inputFile  = filename;
00478 
00479   if( inputFile.EndsWith(".root") ){
00480     inputFile.Insert(inputFile.Length()-5,inputLabel);
00481   }
00482   else{
00483     inputFile.Append(inputLabel);
00484   }
00485 
00486   TemplateIO::Instance()->WriteAtmosData( inputTemplate, inputFile.Data() );
00487   
00488 
00489 
00490   // Write an 'output' file
00491   // ======================
00492   Template* outputTemplate = new Template();
00493    
00494   TemplateCalculator::Instance()->FillCombinedBins( inputTemplate,
00495                                                     outputTemplate );
00496 
00497   TString outputLabel = ".fakedata.output";
00498   TString outputFile  = filename;
00499 
00500   if( outputFile.EndsWith(".root") ){
00501     outputFile.Insert(outputFile.Length()-5,outputLabel);
00502   }
00503   else{
00504     outputFile.Append(outputLabel);
00505   }
00506 
00507   TemplateIO::Instance()->WriteOutput( outputTemplate, outputFile.Data() );
00508 
00509 
00510   // Reset
00511   // =====
00512   std::cout << " *** TemplateMaker::Resetting(...) *** " << std::endl;
00513   Configuration::Instance()->DoSystematics( saveSyst );
00514 
00515   fGridIsLoaded    = 0;
00516 
00517   if( Configuration::Instance()->UsingCachedOscWeights() ){
00518     UnloadCachedOscWeights();
00519   }
00520 
00521   TemplateGrid::Instance()->Reset();
00522 
00523   delete inputTemplate;
00524   delete outputTemplate;
00525 
00526   return;
00527 }

void TemplateMaker::BuildFakeBeamData ( Experiment_t  experiment,
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,
const char *  filename 
)

Definition at line 266 of file TemplateMaker.cxx.

References OscFit::AsString(), BuildMC(), fGridIsLoaded, fThisFirstPoint, fThisLastPoint, Instance(), OscFit::Configuration::Instance(), OscFit::kBeamData, PrintTemplates(), SwitchOnSystematics(), and UnloadCachedOscWeights().

00267 {
00268   std::cout << " *** TemplateMaker::BuildFakeBeamData(...) *** " << std::endl;
00269   std::cout << "   Experiment: " << AsString(experiment) << std::endl;
00270   std::cout << "   Oscillations: " << std::endl; 
00271   std::cout << "    dmsq    = " << dmsq << std::endl;
00272   std::cout << "    sisnq23 = " << sinsq23 << std::endl;
00273   std::cout << "    sinsq13 = " << sinsq13 << std::endl;
00274   std::cout << "    deltaCP = " << deltaCP << std::endl;
00275   std::cout << "   Systematics: " << std::endl; 
00276   std::cout << "    beam_numu_norm       = " << beam_numu_norm       << std::endl;
00277   std::cout << "    beam_numu_ncbkg      = " << beam_numu_ncbkg      << std::endl;
00278   std::cout << "    beam_numu_shwen      = " << beam_numu_shwen      << std::endl;
00279   std::cout << "    beam_numu_trken      = " << beam_numu_trken      << std::endl;
00280   std::cout << "    beam_numu_trken_exit = " << beam_numu_trken_exit << std::endl;
00281   std::cout << "    beam_nue_norm        = " << beam_nue_norm        << std::endl;
00282   std::cout << "    beam_nue_ncbkg       = " << beam_nue_ncbkg       << std::endl;
00283   std::cout << "    beam_nue_energy      = " << beam_nue_energy      << std::endl;
00284 
00285 
00286   // Check Experiment
00287   // ================
00288   if( experiment != Configuration::Instance()->GetExperiment() ){
00289     std::cout << "   <Warning>: This experiment doesn't make sense [return] " << std::endl;
00290     return;
00291   }
00292 
00293 
00294   // Initialisation
00295   // ==============
00296   Oscillation::Instance()->ThreeFlavours();
00297 
00298   TemplateGrid::Instance()->Reset();
00299   TemplateGrid::Instance()->BuildGridDmsq(std::fabs(dmsq));
00300   TemplateGrid::Instance()->BuildGridSinsq23(sinsq23);
00301   TemplateGrid::Instance()->BuildGridSinsq13(sinsq13);
00302   TemplateGrid::Instance()->BuildGridDeltaCP(deltaCP);
00303 
00304   fThisFirstPoint = 0;
00305   fThisLastPoint  = 3;
00306   fGridIsLoaded   = 1;
00307 
00308 
00309   Bool_t saveSyst = Configuration::Instance()->DoingSystematics();
00310 
00311   Configuration::Instance()->SwitchOnSystematics();
00312 
00313   if( Configuration::Instance()->UsingCachedOscWeights() ){
00314     UnloadCachedOscWeights();
00315   }
00316 
00317 
00318   // Build Templates
00319   // ===============
00320   
00321   BuildMC( experiment, OscFit::kBeamData );
00322 
00323   PrintTemplates();
00324 
00325 
00326   // Write an 'input' file
00327   // =====================
00328   Template* inputTemplate  = new Template();
00329 
00330   TemplateCalculator::Instance()->GetExpectation( dmsq, sinsq23, sinsq13, deltaCP,
00331                                                   beam_numu_norm,  beam_numu_ncbkg, 
00332                                                   beam_numu_shwen, beam_numu_trken,   
00333                                                   beam_numu_trken_exit, 
00334                                                   beam_nue_norm,   beam_nue_ncbkg, 
00335                                                   beam_nue_energy, 
00336                                                   inputTemplate );
00337 
00338   TString inputLabel = ".fakedata";
00339   TString inputFile  = filename;
00340 
00341   if( inputFile.EndsWith(".root") ){
00342     inputFile.Insert(inputFile.Length()-5,inputLabel);
00343   }
00344   else{
00345     inputFile.Append(inputLabel);
00346   }
00347 
00348   TemplateIO::Instance()->WriteBeamData( inputTemplate, inputFile.Data() );
00349   
00350 
00351 
00352   // Write an 'output' file
00353   // ======================
00354   Template* outputTemplate = new Template();
00355    
00356   TemplateCalculator::Instance()->FillCombinedBins( inputTemplate,
00357                                                     outputTemplate );
00358 
00359   TString outputLabel = ".fakedata.output";
00360   TString outputFile  = filename;
00361 
00362   if( outputFile.EndsWith(".root") ){
00363     outputFile.Insert(outputFile.Length()-5,outputLabel);
00364   }
00365   else{
00366     outputFile.Append(outputLabel);
00367   }
00368 
00369   TemplateIO::Instance()->WriteOutput( outputTemplate, outputFile.Data() );
00370 
00371 
00372   // Reset
00373   // =====
00374   std::cout << " *** TemplateMaker::Resetting(...) *** " << std::endl;
00375   Configuration::Instance()->DoSystematics( saveSyst );
00376 
00377   fGridIsLoaded    = 0;
00378 
00379   if( Configuration::Instance()->UsingCachedOscWeights() ){
00380     UnloadCachedOscWeights();
00381   }
00382 
00383   TemplateGrid::Instance()->Reset();
00384 
00385   delete inputTemplate;
00386   delete outputTemplate;
00387 
00388   return;
00389 }

void TemplateMaker::BuildFakeData ( Experiment_t  experiment,
Source_t  source,
GridPoint gridPoint,
const char *  filename 
)

Definition at line 160 of file TemplateMaker.cxx.

References OscFit::AsString(), BuildMC(), fGridIsLoaded, fSingleGridPoint, fThisFirstPoint, fThisLastPoint, Instance(), OscFit::Configuration::Instance(), OscFit::kAtmosData, OscFit::kBeamData, OscFit::GridPoint::PrintParams(), PrintTemplates(), SwitchOffSystematics(), and UnloadCachedOscWeights().

00161 {
00162   if( gridPoint==0 ) return;
00163 
00164   std::cout << " *** TemplateMaker::BuildFakeData(...) *** " << std::endl;
00165   std::cout << "   Experiment: " << AsString(experiment) << " Source: " << AsString(source) << std::endl;
00166   std::cout << "   Params: "; gridPoint->PrintParams();
00167 
00168   // Check Experiment
00169   // ================
00170   if( experiment != Configuration::Instance()->GetExperiment() ){
00171     std::cout << "   <Warning>: This experiment doesn't make sense [return] " << std::endl;
00172     return;
00173   }
00174 
00175   // Initialisation
00176   // ==============
00177   TemplateGrid::Instance()->Reset();
00178 
00179   fSingleGridPoint = gridPoint;
00180 
00181   fThisFirstPoint = 0;
00182   fThisLastPoint  = 1;
00183   fGridIsLoaded   = 1;
00184 
00185   Bool_t saveSyst = Configuration::Instance()->DoingSystematics();
00186 
00187   Configuration::Instance()->SwitchOffSystematics();
00188 
00189   if( Configuration::Instance()->UsingCachedOscWeights() ){
00190     UnloadCachedOscWeights();
00191   }
00192 
00193   // Build Templates
00194   // ===============
00195   
00196   BuildMC( experiment, source );
00197 
00198   PrintTemplates();
00199 
00200 
00201   // Write an 'input' file
00202   // =====================
00203   Template* inputTemplate  = new Template();
00204 
00205   TemplateCalculator::Instance()->GetMC( inputTemplate ); 
00206 
00207   TString inputLabel = ".fakedata";
00208   TString inputFile  = filename;
00209 
00210   if( inputFile.EndsWith(".root") ){
00211     inputFile.Insert(inputFile.Length()-5,inputLabel);
00212   }
00213   else{
00214     inputFile.Append(inputLabel);
00215   }
00216 
00217   if( source==OscFit::kAtmosData ){
00218     TemplateIO::Instance()->WriteAtmosData( inputTemplate, inputFile.Data() );
00219   }
00220 
00221   if( source==OscFit::kBeamData ){
00222     TemplateIO::Instance()->WriteBeamData( inputTemplate, inputFile.Data() );
00223   }
00224 
00225 
00226   // Write an 'output' file
00227   // ======================
00228   Template* outputTemplate = new Template();
00229    
00230   TemplateCalculator::Instance()->FillCombinedBins( inputTemplate,
00231                                                     outputTemplate );
00232 
00233   TString outputLabel = ".fakedata.output";
00234   TString outputFile  = filename;
00235 
00236   if( outputFile.EndsWith(".root") ){
00237     outputFile.Insert(outputFile.Length()-5,outputLabel);
00238   }
00239   else{
00240     outputFile.Append(outputLabel);
00241   }
00242 
00243   TemplateIO::Instance()->WriteOutput( outputTemplate, outputFile.Data() );
00244 
00245 
00246   // Reset
00247   // =====
00248   std::cout << " *** TemplateMaker::Resetting(...) *** " << std::endl;
00249   Configuration::Instance()->DoSystematics( saveSyst );
00250 
00251   fSingleGridPoint = 0;
00252   fGridIsLoaded    = 0;
00253 
00254   if( Configuration::Instance()->UsingCachedOscWeights() ){
00255     UnloadCachedOscWeights();
00256   }
00257 
00258   TemplateGrid::Instance()->Reset();
00259 
00260   delete inputTemplate;
00261   delete outputTemplate;
00262 
00263   return; 
00264 }

void TemplateMaker::BuildFakeData ( Experiment_t  experiment,
Source_t  source,
Double_t  dmsq21,
Double_t  dmsq32,
Double_t  sinsq12,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
const char *  filename 
)

Definition at line 139 of file TemplateMaker.cxx.

References BuildFakeData(), Instance(), and OscFit::GridPoint::SetParams().

00140 {
00141   Oscillation::Instance()->ThreeFlavours();
00142 
00143   GridPoint* gridPoint = new GridPoint();
00144   
00145   Double_t th12 = asin(sqrt(sinsq12));
00146   Double_t th23 = asin(sqrt(sinsq23));
00147   Double_t th13 = asin(sqrt(sinsq13));
00148 
00149   gridPoint->SetParams( dmsq21, dmsq32, 
00150                         th12, th23, th13, deltaCP );
00151  
00152   BuildFakeData( experiment, source, 
00153                  gridPoint, filename );
00154 
00155   delete gridPoint;
00156 
00157   return;
00158 }

void TemplateMaker::BuildFakeData ( Experiment_t  experiment,
Source_t  source,
Double_t  dmsq,
Double_t  sinsq23,
Double_t  sinsq13,
Double_t  deltaCP,
const char *  filename 
)

Definition at line 120 of file TemplateMaker.cxx.

References BuildFakeData(), Instance(), and OscFit::GridPoint::SetParams().

00121 {
00122   Oscillation::Instance()->ThreeFlavours();
00123 
00124   GridPoint* gridPoint = new GridPoint();
00125   
00126   Double_t th13 = asin(sqrt(sinsq13));
00127   Double_t th23 = asin(sqrt(sinsq23));
00128 
00129   gridPoint->SetParams( dmsq, th23, th13, deltaCP );
00130  
00131   BuildFakeData( experiment, source, 
00132                  gridPoint, filename );
00133 
00134   delete gridPoint;
00135 
00136   return;
00137 }

void TemplateMaker::BuildFakeData ( Experiment_t  experiment,
Source_t  source,
Double_t  dmsq,
Double_t  sinsq,
const char *  filename 
)

Definition at line 100 of file TemplateMaker.cxx.

References Instance(), and OscFit::GridPoint::SetParams().

Referenced by BuildFakeData().

00101 {
00102   Oscillation::Instance()->TwoFlavours();
00103 
00104   GridPoint* gridPoint = new GridPoint();
00105 
00106   Double_t th23 = 0.5*asin(sqrt(sinsq));
00107 
00108   gridPoint->SetParams( 0.0, dmsq,    // dmsq12, dmsq23 
00109                         0.0, th23,    // th12, th23
00110                         0.0, 0.0 );   // th13, dcp
00111 
00112   BuildFakeData( experiment, source, 
00113                  gridPoint, filename );
00114 
00115   delete gridPoint;
00116 
00117   return;
00118 }

void OscFit::TemplateMaker::BuildFHCBAR (  )  [inline]

Definition at line 68 of file twoflavours/TemplateMaker.h.

References BuildNuMuBar().

00068                       {
00069       BuildNuMuBar();
00070     }

void TemplateMaker::BuildGrid ( Int_t  n,
Double_t  min,
Double_t  max 
)

Definition at line 74 of file twoflavours/TemplateMaker.cxx.

References BuildGrid(), and Instance().

Referenced by BuildGrid().

00075 {
00076   return TemplateMap::Instance()->BuildGrid( n, min, max );
00077 }

void TemplateMaker::BuildMC ( Experiment_t  experiment,
Source_t  source 
)

Definition at line 534 of file TemplateMaker.cxx.

References BuildTemplates(), OscFit::kCosmic, OscFit::kCV, and OscFit::kRock.

Referenced by BuildFakeAtmosData(), BuildFakeBeamData(), and BuildFakeData().

00535 {
00536   BuildTemplates( experiment, source, kCV ); 
00537   BuildTemplates( experiment, source, kRock );
00538   BuildTemplates( experiment, source, kCosmic );
00539 }

void OscFit::TemplateMaker::BuildNUBAROnly (  )  [inline]

Definition at line 88 of file twoflavours/TemplateMaker.h.

References fBuildCCOnly, fBuildNUBAROnly, and fBuildRHCOnly.

00088                           {
00089       fBuildCCOnly    = 0;
00090       fBuildRHCOnly   = 0;
00091       fBuildNUBAROnly = 1;
00092     }

void OscFit::TemplateMaker::BuildNuMuBar (  )  [inline]

Definition at line 64 of file twoflavours/TemplateMaker.h.

References fBuildNuMuBar.

Referenced by BuildFHCBAR().

00064                        {
00065       fBuildNuMuBar = 1;
00066     }

void OscFit::TemplateMaker::BuildRAFOnly (  )  [inline]

Definition at line 72 of file twoflavours/TemplateMaker.h.

References fBuildRAFOnly.

00072                        {
00073       fBuildRAFOnly   = 1;
00074     }

void OscFit::TemplateMaker::BuildRHCOnly (  )  [inline]

Definition at line 82 of file twoflavours/TemplateMaker.h.

References fBuildCCOnly, fBuildNUBAROnly, and fBuildRHCOnly.

00082                         {
00083       fBuildCCOnly    = 0;
00084       fBuildRHCOnly   = 1;
00085       fBuildNUBAROnly = 0;
00086     }

void TemplateMaker::BuildTemplate ( Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift,
Bin_t  bin,
TH2D *  hist 
) [private]

Definition at line 637 of file twoflavours/TemplateMaker.cxx.

References OscFit::Template::Fill(), fSubBins, GetDensity(), GetOscProb(), Instance(), MakeTemplate(), and n.

00638 {
00639   // Building a Template With Oscillations
00640   if( hist==0 ) return;
00641 
00642   // Loop Over Reco Energy (y-axis)
00643   for( Int_t ireco=0; ireco<hist->GetYaxis()->GetNbins(); ireco++ ){
00644     Double_t Ereco = hist->GetYaxis()->GetBinCenter( ireco+1 );
00645 
00646     // Load True Energy Distribution
00647     Spectrum::Instance()->LoadHistogram( hist, Ereco );
00648 
00649     // Loop over True Energy (x-axis)
00650     for( Int_t itrue=0; itrue<hist->GetXaxis()->GetNbins(); itrue++ ){
00651       Double_t Emin = hist->GetXaxis()->GetBinLowEdge( itrue+1 );
00652       Double_t Emax = hist->GetXaxis()->GetBinUpEdge( itrue+1 );
00653       
00654       for( Int_t i=0; i<fSubBins; i++ ){
00655         Double_t dE = (1.0/double(fSubBins))*(Emax-Emin);
00656         Double_t Etrue = Emin + ((double)(i+0.5)/(double)(fSubBins))*(Emax-Emin); 
00657 
00658         // Calculate dN=(dN/dE)*dE at this point
00659         // Double_t dNdE = this->GetDensity( hist, Ereco, Etrue );
00660         Double_t dNdE = Spectrum::Instance()->GetDensity( Etrue ); 
00661         Double_t Exp = dNdE*dE;
00662 
00663         // Fill Templates
00664         for( Int_t n=0; n<=TemplateMap::Instance()->GetNumPoints()+1; n++ ){
00665           Double_t dmsq = TemplateMap::Instance()->GetGridPoint(n);
00666           Double_t Osc = this->GetOscProb( sample, interaction, Etrue, dmsq );
00667 
00668           // Get Template
00669           Template* temp = TemplateMap::Instance()->MakeTemplate( n, run, sample, interaction, systematic, shift );
00670           if( temp ) temp->Fill( bin, Ereco, Exp*Osc );
00671         }
00672       }
00673 
00674     }
00675   }
00676 
00677   return;
00678 }

void TemplateMaker::BuildTemplate ( Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Bin_t  bin,
TH2D *  hist 
) [private]

Definition at line 632 of file twoflavours/TemplateMaker.cxx.

References BuildTemplate(), OscFit::kCentre, and OscFit::kNoShift.

00633 {
00634   return this->BuildTemplate( run, sample, interaction, OscFit::kCentre, OscFit::kNoShift, bin, hist );
00635 }

void TemplateMaker::BuildTemplate ( Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Systematic_t  systematic,
Shift_t  shift,
Bin_t  bin,
TH1D *  hist 
) [private]

Definition at line 613 of file twoflavours/TemplateMaker.cxx.

References OscFit::Template::Fill(), Instance(), MakeTemplate(), and n.

00614 {
00615   // Building a Template With No Oscillations
00616   if( hist==0 ) return;
00617 
00618   // Get Template
00619   Template* temp = TemplateMap::Instance()->MakeTemplate( 0, run, sample, interaction, systematic, shift );
00620   if( temp==0 ) return;
00621 
00622   // Fill Histogram
00623   for( Int_t n=0; n<hist->GetXaxis()->GetNbins(); n++ ){
00624     Double_t Ereco = hist->GetXaxis()->GetBinCenter(n+1);
00625     Double_t Exp = hist->GetBinContent(n+1);
00626     temp->Fill( bin, Ereco, Exp );
00627   }
00628   
00629   return;
00630 }

void TemplateMaker::BuildTemplate ( Run_t  run,
Sample_t  sample,
Interaction_t  interaction,
Bin_t  bin,
TH1D *  hist 
) [private]

Definition at line 608 of file twoflavours/TemplateMaker.cxx.

References BuildTemplate(), OscFit::kCentre, and OscFit::kNoShift.

00609 {
00610   return this->BuildTemplate( run, sample, interaction, OscFit::kCentre, OscFit::kNoShift, bin, hist );
00611 }

void TemplateMaker::BuildTemplate ( Run_t  run,
Bin_t  bin,
TH1D *  hist 
) [private]

Definition at line 589 of file twoflavours/TemplateMaker.cxx.

References OscFit::Template::Fill(), Instance(), OscFit::kCentre, OscFit::kData, OscFit::kNoShift, OscFit::kNull, MakeTemplate(), and n.

Referenced by BuildTemplate(), BuildTemplatesCC2010(), and BuildTemplatesCC2012().

00590 {
00591   // Building a Template From Data
00592   if( hist==0 ) return;
00593 
00594   // Get Template
00595   Template* temp = TemplateMap::Instance()->MakeTemplate(0,run,OscFit::kData,OscFit::kNull,OscFit::kCentre,OscFit::kNoShift);
00596   if( temp==0 ) return;
00597 
00598   // Fill Histogram
00599   for( Int_t n=0; n<hist->GetXaxis()->GetNbins(); n++ ){
00600     Double_t Ereco = hist->GetXaxis()->GetBinCenter(n+1);
00601     Double_t Obs = hist->GetBinContent(n+1);
00602     temp->Fill( bin, Ereco, Obs );
00603   }
00604 
00605   return;
00606 }

void TemplateMaker::BuildTemplates ( Run_t  run  ) 

Definition at line 87 of file twoflavours/TemplateMaker.cxx.

References OscFit::AsString(), BuildTemplatesCC2012(), fOutFile, Instance(), PrintTemplates(), and WriteTemplates().

00088 {
00089   std::cout << " *** TemplateMaker::BuildTemplates() *** " << std::endl;
00090   std::cout << "  Building Templates for: " << OscFit::AsString(run) << std::endl;
00091 
00092   // Reset
00093   TemplateMap::Instance()->Reset();
00094 
00095   // Switch Systematics On/Off [Default: ON]
00096   // TemplateMap::Instance()->SwitchOffSystematics();   // [OFF]
00097   // TemplateMap::Instance()->SwitchOnSystematics();    // [ON]
00098  
00099   // Build Templates 
00100   BuildTemplatesCC2012( run );
00101 
00102   // Print Templates
00103   TemplateMap::Instance()->PrintTemplates();
00104 
00105   // Write Templates
00106   TemplateMap::Instance()->WriteTemplates( fOutFile.Data() );
00107 
00108   return;
00109 }

void TemplateMaker::BuildTemplates (  ) 

Definition at line 79 of file twoflavours/TemplateMaker.cxx.

References OscFit::GetNumRuns(), OscFit::GetRun(), and run().

Referenced by BuildData(), BuildMC(), and BuildTemplates().

00080 {
00081   for( Int_t irun=0; irun<OscFit::GetNumRuns(); irun++ ){
00082     Run_t run = OscFit::GetRun(irun);
00083     BuildTemplates( run );
00084   }
00085 }

void TemplateMaker::BuildTemplates ( Experiment_t  experiment,
RunType_t  runtype,
Sample_t  sample 
)

Definition at line 560 of file TemplateMaker.cxx.

References AddData(), OscFit::AsString(), fDoCombinedOscWeights, fNevents, fYears, OscFit::Oscillation::Instance(), OscFit::DataInterface::Instance(), Instance(), OscFit::Configuration::Instance(), OscFit::kCosmic, OscFit::kCV, OscFit::kData, OscFit::kLBNE, OscFit::kMINOS, OscFit::kNonOsc, OscFit::kNoOsc, OscFit::kNue2Nutau, OscFit::kNumu2Nue, OscFit::kNumu2Nutau, OscFit::kRock, SetRangeOfGridPoints(), SetupTemplatesForLBNE(), and SetupTemplatesForMINOS().

00561 {  
00562   // Check For Data
00563   // ============== 
00564   if( DataInterface::Instance()->TouchData( myRunType, mySample )==0 ){
00565     return;
00566   }
00567 
00568   // Check Experiment
00569   // ================
00570   if( myExperiment != Configuration::Instance()->GetExperiment() ){
00571     std::cout << "   <Warning>: This experiment doesn't make sense [return] " << std::endl;
00572     return;
00573   }
00574 
00575   // Set Range of Grid Points
00576   // ========================
00577   SetRangeOfGridPoints();
00578 
00579   // Set up Templates
00580   // ================
00581   if( myExperiment==OscFit::kMINOS ){
00582     SetupTemplatesForMINOS( myRunType, mySample ); // MINOS 
00583   }
00584 
00585   if( myExperiment==OscFit::kLBNE ){
00586     SetupTemplatesForLBNE( myRunType, mySample );  // LBNE 
00587   }
00588 
00589   std::cout << " *** TemplateMaker::BuildTemplates() *** " << std::endl;
00590   std::cout << "   Building Templates: [" << AsString(myRunType) << "][" << AsString(mySample) << "]" << std::endl;
00591 
00592   // Build Templates
00593   // ===============
00594   Data*     myData    = 0;
00595   OscType_t myOscType = kNonOsc;
00596   Double_t  myWeight  = fYears;
00597 
00598   // real data or background
00599   if( mySample==kData || mySample==kCosmic ){
00600 
00601     // data or cosmic
00602     myOscType = kNonOsc;
00603     myData = DataInterface::Instance()->GetData( myRunType, mySample, myOscType );
00604     this->AddData( myData ); 
00605   }
00606 
00607   // beam or atmospheric neutrinos
00608   if( mySample==kCV || mySample==kRock ){
00609 
00610     // nominal spectrum
00611     myOscType = kNoOsc;
00612     myData = DataInterface::Instance()->GetData( myRunType, mySample, myOscType );
00613     this->AddData( myData, myWeight, myOscType, fNevents ); 
00614 
00615     // numu->nutau sample
00616     myOscType = kNumu2Nutau;
00617     myData = DataInterface::Instance()->GetData( myRunType, mySample, myOscType );
00618     this->AddData( myData, myWeight, myOscType, fNevents ); 
00619 
00620     // nue->nutau sample
00621     myOscType = kNue2Nutau;
00622     myData = DataInterface::Instance()->GetData( myRunType, mySample, myOscType );
00623     this->AddData( myData, myWeight, myOscType, fNevents ); 
00624 
00625     // numu<->nue sample
00626     myOscType = kNumu2Nue;
00627     myData = DataInterface::Instance()->GetData( myRunType, mySample, myOscType );
00628     this->AddData( myData, myWeight, myOscType, fNevents ); 
00629 
00630     // add sanity check on numu<->nue sample
00631     assert( Oscillation::Instance()->UsingTwoFlavours()
00632          || fDoCombinedOscWeights || myData ); 
00633   }
00634 }

void TemplateMaker::BuildTemplates ( Experiment_t  experiment,
Source_t  source,
Sample_t  sample 
)

Definition at line 549 of file TemplateMaker.cxx.

References BuildTemplates(), OscFit::GetNumRunTypes(), OscFit::GetRunType(), and OscFit::GetSource().

00550 {
00551   for( Int_t iruntype = 0; iruntype<OscFit::GetNumRunTypes(); iruntype++ ){
00552     RunType_t myRunType = OscFit::GetRunType( iruntype );
00553     
00554     if( OscFit::GetSource(myRunType) == mySource ){
00555       BuildTemplates( myExperiment, myRunType, mySample );
00556     }
00557   }
00558 }

void TemplateMaker::BuildTemplates ( Experiment_t  experiment,
Source_t  source 
)

Definition at line 541 of file TemplateMaker.cxx.

References BuildTemplates(), OscFit::kCosmic, OscFit::kCV, OscFit::kData, and OscFit::kRock.

00542 {
00543   BuildTemplates( experiment, source, kData );
00544   BuildTemplates( experiment, source, kCV ); 
00545   BuildTemplates( experiment, source, kRock );
00546   BuildTemplates( experiment, source, kCosmic );
00547 }

void TemplateMaker::BuildTemplatesCC2010 ( Run_t  run,
Sample_t  sample,
Systematic_t  systematic,
Shift_t  shift,
Bin_t  bin 
)

Definition at line 387 of file twoflavours/TemplateMaker.cxx.

References OscFit::AsString(), BuildTemplate(), fBuildCCOnly, fBuildDataOnly, fBuildNuMuBar, fBuildRAFOnly, fInputDirectoryCC2010, fUseCC2010TemplatesVeryOld, OscFit::GetChargeSign(), OscFit::GetRunNumber(), OscFit::GetRunType(), gSystem(), OscFit::TemplateMap::Instance(), OscFit::kCCnu, OscFit::kCCnubar, OscFit::kCentre, OscFit::kCV, OscFit::kCVTau, OscFit::kData, OscFit::kFHC, OscFit::kMinus1, OscFit::kMinus2, OscFit::kNC, OscFit::kNCbkg, OscFit::kNoRun, OscFit::kNoShift, OscFit::kNull, OscFit::kOppositeSign, OscFit::kPlus1, OscFit::kPlus2, OscFit::kPositive, OscFit::kRAF, OscFit::kResBin0, OscFit::kResBin1, OscFit::kResBin2, OscFit::kResBin3, OscFit::kResBin4, OscFit::kRHC, OscFit::kRock, OscFit::kRockTau, OscFit::kRunI, OscFit::kRunIHE, OscFit::kRunII, OscFit::kRunIII, OscFit::kRunIVFHC, OscFit::kRunV, OscFit::kRunVI, OscFit::kRunVIII, OscFit::kRunX, OscFit::kShwEn, and OscFit::kTrkEn.

00388 {  
00389   // sanity check
00390   if( run==OscFit::kNoRun ) return;
00391 
00392   // only generate templates for FHC Analysis
00393   if( OscFit::GetRunType(run) != OscFit::kFHC ){
00394     std::cout << "  Only generating Templates for CC Analysis [return] " << std::endl;
00395     return;
00396   }
00397 
00398   // only generate templates up to Run X
00399   if( OscFit::GetRunNumber(run)>OscFit::GetRunNumber(OscFit::kRunX) ){
00400     std::cout << "  Only have Templates up to Run: " << OscFit::AsString(OscFit::kRunX) << " [return] " << std::endl;
00401     return;
00402   }
00403 
00404   // not using these run periods
00405   if( run==OscFit::kRunIVFHC ) return;
00406   if( run==OscFit::kRunVIII  ) return;
00407 
00408   // not mixing fiducial/RAF samples
00409   if( sample==OscFit::kCV      && bin==OscFit::kRAF ) return;
00410   if( sample==OscFit::kCVTau   && bin==OscFit::kRAF ) return;
00411   if( sample==OscFit::kRock    && bin!=OscFit::kRAF ) return;
00412   if( sample==OscFit::kRockTau && bin!=OscFit::kRAF ) return;
00413 
00414   // build Data templates only
00415   if( fBuildDataOnly && sample!=OscFit::kData ) return;
00416 
00417   // build RAF templates only
00418   if( fBuildRAFOnly && bin!=OscFit::kRAF ) return;
00419 
00420   // build CC templates only
00421   if( fBuildCCOnly ){
00422     if( OscFit::GetRunType(run)==OscFit::kRHC ) return;
00423     if( OscFit::GetChargeSign(run,bin)==OscFit::kPositive
00424      && fBuildNuMuBar==1 ) return;
00425   }
00426 
00427   // systematics on/off
00428   if( systematic!=OscFit::kCentre
00429    && TemplateMap::Instance()->DoingSystematics()==0 ) return;
00430 
00431   // systematic checks
00432   if( sample==OscFit::kData && systematic!=OscFit::kCentre  )  return;
00433   if( sample==OscFit::kCVTau && systematic!=OscFit::kCentre )   return;
00434   if( sample==OscFit::kRockTau && systematic!=OscFit::kCentre )  return;
00435 
00436   // systematic checks
00437   if( systematic==OscFit::kCentre && shift!=OscFit::kNoShift ) return;
00438   if( systematic!=OscFit::kCentre && shift==OscFit::kNoShift ) return;
00439 
00440   // ignoring pHE PQ events
00441   if( run==OscFit::kRunIHE 
00442    && OscFit::GetChargeSign(run,bin)==OscFit::kPositive ) return;
00443 
00444   // ignoring RAF PQ events
00445   if( bin==OscFit::kRAF 
00446    && OscFit::GetChargeSign(run,bin)==OscFit::kPositive ) return;
00447 
00448  
00449   // construct file name (these are hard-coded, sorry)
00450   TString filename = fInputDirectoryCC2010;  // Top Level Directory
00451 
00452   // Use the Original 2010 Templates, in the CC 2010 Format
00453   if( fUseCC2010TemplatesVeryOld ){  
00454 
00455          if( sample==OscFit::kData )  filename.Append("");
00456     else if( sample==OscFit::kCV )    filename.Append("");
00457     else if( sample==OscFit::kCVTau ) filename.Append("");
00458     else return;
00459 
00460          if( systematic==OscFit::kCentre ) filename.Append("/Data");  // OR Nominal
00461     else if( systematic==OscFit::kNCbkg )  filename.Append("/NCBackground");
00462     else if( systematic==OscFit::kShwEn )  filename.Append("/ShowerEnergyFunctionBoth");
00463     else if( systematic==OscFit::kTrkEn )  filename.Append("/TrackEnergyOverall");
00464     else return;
00465 
00466          if( shift==OscFit::kMinus2 ) filename.Append("/Down2");
00467     else if( shift==OscFit::kMinus1 ) filename.Append("/Down1");
00468     else if( shift==OscFit::kPlus1  ) filename.Append("/Up1");
00469     else if( shift==OscFit::kPlus2  ) filename.Append("/Up2");
00470 
00471          if( run==OscFit::kRunI   )   filename.Append("/jess_1LE");
00472     else if( run==OscFit::kRunIHE )   filename.Append("/jess_1pHE");
00473     else if( run==OscFit::kRunII  )   filename.Append("/jess_2LE");
00474     else if( run==OscFit::kRunIII )   filename.Append("/jess_3LE");
00475     else return;
00476 
00477          if( bin==OscFit::kResBin0 )  filename.Append("_NQ_0.root");
00478     else if( bin==OscFit::kResBin1 )  filename.Append("_NQ_1.root");
00479     else if( bin==OscFit::kResBin2 )  filename.Append("_NQ_2.root");
00480     else if( bin==OscFit::kResBin3 )  filename.Append("_NQ_3.root");
00481     else if( bin==OscFit::kResBin4 )  filename.Append("_NQ_4.root");
00482     else if( bin==OscFit::kOppositeSign ) filename.Append("_PQ.root");
00483     else return;
00484   }
00485 
00486   // Use the New 2012 Templates, in the CC 2010 Format
00487   else{ 
00488 
00489          if( sample==OscFit::kData )    filename.Append("");
00490     else if( sample==OscFit::kCV )      filename.Append("");
00491     else if( sample==OscFit::kCVTau )   filename.Append("");
00492     else if( sample==OscFit::kRock )    filename.Append("");
00493     else if( sample==OscFit::kRockTau ) filename.Append("");
00494     else return;
00495 
00496          if( systematic==OscFit::kCentre ) filename.Append("/Data");  // OR Nominal
00497     else if( systematic==OscFit::kNCbkg )  filename.Append("/NCBackground");
00498     else if( systematic==OscFit::kShwEn )  filename.Append("/ShowerEnergyBoth");
00499     else if( systematic==OscFit::kTrkEn )  filename.Append("/TrackEnergyOverall");
00500     else return;
00501 
00502          if( shift==OscFit::kMinus2 ) filename.Append("/DOWN2");
00503     else if( shift==OscFit::kMinus1 ) filename.Append("/DOWN1");
00504     else if( shift==OscFit::kPlus1  ) filename.Append("/UP1");
00505     else if( shift==OscFit::kPlus2  ) filename.Append("/UP2");
00506 
00507          if( run==OscFit::kRunI   )   filename.Append("/jess_run_1LE");
00508     else if( run==OscFit::kRunIHE )   filename.Append("/jess_run_1pHE");
00509     else if( run==OscFit::kRunII  )   filename.Append("/jess_run_2LE");
00510     else if( run==OscFit::kRunIII )   filename.Append("/jess_run_3LE");
00511     else if( run==OscFit::kRunV   )   filename.Append("/jess_run_5LE");
00512     else if( run==OscFit::kRunVI  )   filename.Append("/jess_run_6LE");
00513     else if( run==OscFit::kRunX   )   filename.Append("/jess_run_10LE");
00514     else return;
00515 
00516          if( bin==OscFit::kResBin0 )  filename.Append("_NQ_res0.root");
00517     else if( bin==OscFit::kResBin1 )  filename.Append("_NQ_res1.root");
00518     else if( bin==OscFit::kResBin2 )  filename.Append("_NQ_res2.root");
00519     else if( bin==OscFit::kResBin3 )  filename.Append("_NQ_res3.root");
00520     else if( bin==OscFit::kResBin4 )  filename.Append("_NQ_res4.root");
00521     else if( bin==OscFit::kOppositeSign ) filename.Append("_PQ.root");
00522     else if( bin==OscFit::kRAF )      filename.Append("_RAF.root");
00523     else return;
00524   }
00525 
00526   // build template
00527   std::cout << " Building Template: " << std::endl;
00528   std::cout << "  Using CC2010 Analysis Templates " << std::endl;
00529   std::cout << "  Template: [" << OscFit::AsString(run) << "][" << OscFit::AsString(sample) << "][" << OscFit::AsString(systematic) << "][" << OscFit::AsString(shift) << "][" << OscFit::AsString(bin) << "]" << std::endl;
00530   std::cout << "  FileName: " << filename.Data() << std::endl;
00531             
00532   if( gSystem->AccessPathName(filename) ) { // returns kTrue if non-existent
00533     std::cout << "  Warning: failed to find input file " << std::endl;
00534     return;
00535   }
00536     
00537   // open file
00538   TDirectory* tmpd = gDirectory;
00539   TFile* file = new TFile(filename,"read");
00540 
00541   if( sample==OscFit::kData ){
00542     if( bin==OscFit::kRAF ){
00543       TH1D* hData = (TH1D*)( file->Get("data_allreco") );
00544       this->BuildTemplate( run, sample, OscFit::kNull, systematic, shift, bin, hData );
00545     }
00546     else{
00547       TH1D* hData = (TH1D*)( file->Get("data") );
00548       this->BuildTemplate( run, sample, OscFit::kNull, systematic, shift, bin, hData );
00549     }
00550   }
00551 
00552   else if( sample==OscFit::kCV ){
00553     TH2D* hCCPrediction = (TH2D*)( file->Get("nuPrediction") );
00554     this->BuildTemplate( run, sample, OscFit::kCCnu, systematic, shift, bin, hCCPrediction );
00555 
00556     TH2D* hWSBackground = (TH2D*)( file->Get("wsBackground") );
00557     this->BuildTemplate( run, sample, OscFit::kCCnubar, systematic, shift, bin, hWSBackground );
00558 
00559     TH1D* hNCBackground = (TH1D*)( file->Get("ncBackground") );
00560     this->BuildTemplate( run, sample, OscFit::kNC, systematic, shift, bin, hNCBackground );
00561   }
00562 
00563   else if( sample==OscFit::kCVTau ){
00564     TH2D* hTauPrediction = (TH2D*)( file->Get("potentialTaus") );
00565     this->BuildTemplate( run, sample, OscFit::kCCnu, systematic, shift, bin, hTauPrediction );
00566   }
00567 
00568   else if( sample==OscFit::kRock ){
00569     TH2D* hRockCCPrediction = (TH2D*)( file->Get("mc_jess_ccmu") );
00570     this->BuildTemplate( run, sample, OscFit::kCCnu, systematic, shift, bin, hRockCCPrediction );
00571 
00572     TH1D* hRockNCPrediction = (TH1D*)( file->Get("mc_jess_no") );
00573     this->BuildTemplate( run, sample, OscFit::kNC, systematic, shift, bin, hRockNCPrediction );
00574   }
00575 
00576   else if( sample==OscFit::kRockTau ){
00577     TH2D* hRockTauPrediction = (TH2D*)( file->Get("mc_jess_cctau") );
00578     this->BuildTemplate( run, sample, OscFit::kCCnu, systematic, shift, bin, hRockTauPrediction );
00579   }
00580 
00581   file->Close();
00582   tmpd->cd();
00583  
00584   std::cout << "  Building Template... Done! " << std::endl;
00585 
00586   return;
00587 }

void TemplateMaker::BuildTemplatesCC2010 ( Run_t  run  ) 

Definition at line 363 of file twoflavours/TemplateMaker.cxx.

References OscFit::AsString(), OscFit::GetBin(), OscFit::GetNumBins(), OscFit::GetNumSamples(), OscFit::GetNumShifts(), OscFit::GetNumSystematics(), OscFit::GetSample(), OscFit::GetShift(), and OscFit::GetSystematic().

Referenced by BuildTemplatesCC2012().

00364 { 
00365   std::cout << " *** TemplateMaker::BuildTemplates() *** " << std::endl;
00366   std::cout << "  Building Templates for: " << OscFit::AsString(run) << std::endl;
00367 
00368   for( Int_t isample=0; isample<OscFit::GetNumSamples(); isample++ ){
00369     for( Int_t isys=0; isys<OscFit::GetNumSystematics()+1; isys++ ){ // [include central prediction]
00370       for( Int_t ishift=0; ishift<OscFit::GetNumShifts()+1; ishift++ ){ // [include central prediction]
00371         for( Int_t ibin=0; ibin<OscFit::GetNumBins(); ibin++ ){ 
00372     
00373           Sample_t sample = OscFit::GetSample(isample);
00374           Systematic_t systematic = OscFit::GetSystematic(isys);
00375           Shift_t shift = OscFit::GetShift(ishift);
00376           Bin_t bin = OscFit::GetBin(ibin);
00377 
00378           BuildTemplatesCC2010( run, sample, systematic, shift, bin );
00379         }
00380       }
00381     }
00382   }
00383 
00384   return;
00385 }

void TemplateMaker::BuildTemplatesCC2012 ( Run_t  run,
Sample_t  sample,
Systematic_t  systematic,
Shift_t  shift,
Bin_t  bin 
)

Definition at line 135 of file twoflavours/TemplateMaker.cxx.

References OscFit::AsString(), BuildTemplate(), BuildTemplatesCC2010(), fBuildCCOnly, fBuildDataOnly, fBuildNUBAROnly, fBuildNuMuBar, fBuildRAFOnly, fBuildRHCOnly, fInputPath, fUseCC2010Templates, OscFit::GetChargeSign(), OscFit::GetRunNumber(), OscFit::GetRunType(), gSystem(), OscFit::TemplateMap::Instance(), OscFit::kCCnu, OscFit::kCCnubar, OscFit::kCentre, OscFit::kCV, OscFit::kCVTau, OscFit::kData, OscFit::kFHC, OscFit::kMinus1, OscFit::kMinus2, OscFit::kNC, OscFit::kNCbkg, OscFit::kNegative, OscFit::kNoRun, OscFit::kNoShift, OscFit::kNull, OscFit::kOppositeSign, OscFit::kPlus1, OscFit::kPlus2, OscFit::kPositive, OscFit::kRAF, OscFit::kResBin0, OscFit::kResBin1, OscFit::kResBin2, OscFit::kResBin3, OscFit::kResBin4, OscFit::kRHC, OscFit::kRock, OscFit::kRockTau, OscFit::kRunI, OscFit::kRunIHE, OscFit::kRunII, OscFit::kRunIII, OscFit::kRunIV, OscFit::kRunIVFHC, OscFit::kRunIX, OscFit::kRunV, OscFit::kRunVI, OscFit::kRunVII, OscFit::kRunVIII, OscFit::kRunX, OscFit::kShwEn, and OscFit::kTrkEn.

00136 {  
00137   // sanity check
00138   if( run==OscFit::kNoRun ) return;
00139 
00140   // generate templates up to Run X
00141   if( OscFit::GetRunNumber(run)>OscFit::GetRunNumber(OscFit::kRunX) ){
00142     std::cout << "  Only have Templates up to: " << OscFit::AsString(OscFit::kRunX) << " [return] " << std::endl;
00143     return;
00144   }
00145 
00146   // not using these runs
00147   if( run==OscFit::kRunIVFHC ) return;
00148   if( run==OscFit::kRunVIII  ) return;
00149 
00150   // not mixing fiducial/RAF samples
00151   if( sample==OscFit::kCV      && bin==OscFit::kRAF ) return;
00152   if( sample==OscFit::kCVTau   && bin==OscFit::kRAF ) return;
00153   if( sample==OscFit::kRock    && bin!=OscFit::kRAF ) return;
00154   if( sample==OscFit::kRockTau && bin!=OscFit::kRAF ) return;
00155 
00156   // build Data templates only
00157   if( fBuildDataOnly ){
00158     if( sample!=OscFit::kData ) return;
00159   }
00160 
00161   // build RAF templates only
00162   if( fBuildRAFOnly ){
00163     if( bin!=OscFit::kRAF ) return;
00164   }
00165  
00166   // build CC templates only
00167   if( fBuildCCOnly ){
00168     if( OscFit::GetRunType(run)==OscFit::kRHC ) return;
00169     if( OscFit::GetChargeSign(run,bin)==OscFit::kPositive
00170      && fBuildNuMuBar==1 ) return;
00171   }
00172 
00173   // build RHC templates only
00174   if( fBuildRHCOnly ){
00175     if( OscFit::GetRunType(run)==OscFit::kFHC ) return;
00176     if( OscFit::GetChargeSign(run,bin)==OscFit::kNegative ) return;
00177   }
00178 
00179   // build NUBAR templates only
00180   if( fBuildNUBAROnly ){
00181     if( OscFit::GetRunType(run)==OscFit::kRHC ) return;
00182     if( OscFit::GetChargeSign(run,bin)==OscFit::kNegative
00183      || fBuildNuMuBar==0 ) return;
00184   }
00185 
00186   // systematics on/off
00187   if( systematic!=OscFit::kCentre
00188    && TemplateMap::Instance()->DoingSystematics()==0 ) return;
00189 
00190   // systematics checks
00191   if( sample==OscFit::kData && systematic!=OscFit::kCentre )    return;
00192   if( sample==OscFit::kCVTau && systematic!=OscFit::kCentre )   return;
00193   if( sample==OscFit::kRockTau && systematic!=OscFit::kCentre )  return;
00194 
00195   // systematics checks
00196   if( systematic==OscFit::kCentre && shift!=OscFit::kNoShift ) return;
00197   if( systematic!=OscFit::kCentre && shift==OscFit::kNoShift ) return;
00198 
00199   // ignoring RHC NQ events 
00200   if( OscFit::GetRunType(run)==OscFit::kRHC
00201    && OscFit::GetChargeSign(run,bin)==OscFit::kNegative ) return;
00202 
00203   // ignoring FHC pHE PQ events
00204   if( run==OscFit::kRunIHE
00205    && OscFit::GetChargeSign(run,bin)==OscFit::kPositive ) return;
00206 
00207   // ignoring RAF PQ events
00208   if( bin==OscFit::kRAF 
00209    && OscFit::GetChargeSign(run,bin)==OscFit::kPositive ) return;
00210 
00211   // if still using templates from 2010 CC analysis,
00212   // then intercept FHC events here 
00213   if( fUseCC2010Templates ){
00214     if( OscFit::GetRunType(run)==OscFit::kFHC 
00215      && ( OscFit::GetChargeSign(run,bin)==OscFit::kNegative
00216        || fBuildNuMuBar==0 ) ){
00217       return BuildTemplatesCC2010( run, sample, systematic, shift, bin );
00218     }
00219   }
00220 
00221   // construct file name
00222   TString filename = fInputPath;
00223   TString tag = "";
00224 
00225        if( sample==OscFit::kData  ) tag.Append("");
00226   else if( sample==OscFit::kCV    ) tag.Append("");
00227   else if( sample==OscFit::kCVTau ) tag.Append("");
00228   else return;
00229 
00230        if( run==OscFit::kRunI   )  tag.Append("_Run01");
00231   else if( run==OscFit::kRunIHE )  tag.Append("_Run01HE");
00232   else if( run==OscFit::kRunII  )  tag.Append("_Run02");
00233   else if( run==OscFit::kRunIII )  tag.Append("_Run03");
00234   else if( run==OscFit::kRunIV  )  tag.Append("_Run04");
00235   else if( run==OscFit::kRunV   )  tag.Append("_Run05");
00236   else if( run==OscFit::kRunVI  )  tag.Append("_Run06");
00237   else if( run==OscFit::kRunVII )  tag.Append("_Run07");
00238   else if( run==OscFit::kRunIX  )  tag.Append("_Run09");
00239   else if( run==OscFit::kRunX   )  tag.Append("_Run10");
00240   else return;
00241 
00242        if( bin==OscFit::kResBin0 )      tag.Append("_NQ_0");
00243   else if( bin==OscFit::kResBin1 )      tag.Append("_NQ_1");
00244   else if( bin==OscFit::kResBin2 )      tag.Append("_NQ_2");
00245   else if( bin==OscFit::kResBin3 )      tag.Append("_NQ_3");
00246   else if( bin==OscFit::kResBin4 )      tag.Append("_NQ_4");
00247   else if( bin==OscFit::kOppositeSign ) tag.Append("_PQ");
00248   else return;
00249 
00250   if( fBuildNuMuBar
00251    && OscFit::GetRunType(run)==OscFit::kFHC ) tag.Append("_NuMuBar");
00252 
00253        if( systematic==OscFit::kCentre ) tag.Append("_Nominal");  // OR Nominal
00254   else if( systematic==OscFit::kNCbkg )  tag.Append("_NCBackground");
00255   else if( systematic==OscFit::kShwEn )  tag.Append("_ShowerEnergy");
00256   else if( systematic==OscFit::kTrkEn )  tag.Append("_TrackEnergy");
00257   else return;
00258 
00259        if( shift==OscFit::kMinus2 ) tag.Append("_Down2");
00260   else if( shift==OscFit::kMinus1 ) tag.Append("_Down1");
00261   else if( shift==OscFit::kPlus1  ) tag.Append("_Up1");
00262   else if( shift==OscFit::kPlus2  ) tag.Append("_Up2");
00263 
00264   if( filename.EndsWith(".root") ){
00265     filename.Insert(filename.Length()-5,tag);
00266   }
00267   else{
00268     filename.Append(tag);
00269   }
00270 
00271   // build template
00272   std::cout << " Building Template: " << std::endl;
00273   std::cout << "  Template: [" << OscFit::AsString(run) << "][" << OscFit::AsString(sample) << "][" << OscFit::AsString(systematic) << "][" << OscFit::AsString(shift) << "][" << OscFit::AsString(bin) << "]" << std::endl;
00274   std::cout << "  FileName: " << filename.Data() << std::endl;
00275             
00276   if( gSystem->AccessPathName(filename) ) { // returns kTrue if non-existent
00277     std::cout << "  Warning: failed to find input file " << std::endl;
00278     return;
00279   }
00280 
00281   // histogram names
00282   // ===============  
00283 
00284   // Neutrinos (NQ)
00285   //  [TH2D] hNQfromCCTau
00286   //  [TH2D] hNQFromCCTauBar
00287   //  [TH1D] hNQFromNC
00288   //  [TH2D] hNQFromCCMu
00289   //  [TH2D] hNQFromCCMuBar
00290   //  [TH1D] hNQData
00291   
00292   // Anti-Neutrinos (PQ)
00293   //  [TH2D] hPQfromCCTau
00294   //  [TH2D] hPQFromCCTauBar
00295   //  [TH1D] hPQFromNC
00296   //  [TH2D] hPQFromCCMu
00297   //  [TH2D] hPQFromCCMuBar
00298   //  [TH1D] hPQData
00299 
00300   TString histname_cc_nutau    = "";
00301   TString histname_cc_nutaubar = "";
00302   TString histname_cc_numu     = "";
00303   TString histname_cc_numubar  = "";
00304   TString histname_nc          = "";
00305   TString histname_data        = "";
00306 
00307   if( OscFit::GetChargeSign(run,bin) == OscFit::kPositive ){
00308     histname_cc_nutau    = "hPQfromCCTau"; // Note: little 'f'!!
00309     histname_cc_nutaubar = "hPQFromCCTauBar";
00310     histname_cc_numu     = "hPQFromCCMu";
00311     histname_cc_numubar  = "hPQFromCCMuBar";
00312     histname_nc          = "hPQFromNC";
00313     histname_data        = "hPQData";
00314   }
00315   
00316   if( OscFit::GetChargeSign(run,bin) == OscFit::kNegative ){
00317     histname_cc_nutau    = "hNQfromCCTau"; // Note: little 'f'!!
00318     histname_cc_nutaubar = "hNQFromCCTauBar";
00319     histname_cc_numu     = "hNQFromCCMu";
00320     histname_cc_numubar  = "hNQFromCCMuBar";
00321     histname_nc          = "hNQFromNC";
00322     histname_data        = "hNQData";
00323   }
00324 
00325   // build histograms
00326   // ================
00327 
00328   TDirectory* tmpd = gDirectory;
00329   TFile* file = new TFile(filename,"read");
00330 
00331   if( sample==OscFit::kCV ){
00332     TH2D* histFromCCMuBar = (TH2D*)( file->Get( histname_cc_numubar.Data() ) );
00333     this->BuildTemplate( run, sample, OscFit::kCCnubar, systematic, shift, bin, histFromCCMuBar );
00334 
00335     TH2D* histFromCCMu = (TH2D*)( file->Get( histname_cc_numu.Data() ) );
00336     this->BuildTemplate( run, sample, OscFit::kCCnu, systematic, shift, bin, histFromCCMu );
00337 
00338     TH1D* histFromNC = (TH1D*)( file->Get( histname_nc.Data() ) );
00339     this->BuildTemplate( run, sample, OscFit::kNC, systematic, shift, bin, histFromNC );
00340   }
00341 
00342   if( sample==OscFit::kCVTau ){
00343     TH2D* histFromCCTauBar = (TH2D*)( file->Get( histname_cc_nutaubar.Data() ) ); 
00344     this->BuildTemplate( run, sample, OscFit::kCCnubar, systematic, shift, bin, histFromCCTauBar );
00345 
00346     TH2D* histFromCCTau = (TH2D*)( file->Get( histname_cc_nutau.Data() ) );
00347     this->BuildTemplate( run, sample, OscFit::kCCnu, systematic, shift, bin, histFromCCTau );
00348   }
00349 
00350   if( sample==OscFit::kData ){
00351     TH1D* histData = (TH1D*)( file->Get( histname_data.Data() ) );
00352     this->BuildTemplate( run, sample, OscFit::kNull, systematic, shift, bin, histData );
00353   }
00354 
00355   file->Close();
00356   tmpd->cd();
00357  
00358   std::cout << "  Building Template... Done! " << std::endl;
00359 
00360   return;
00361 }

void TemplateMaker::BuildTemplatesCC2012 ( Run_t  run  ) 

Definition at line 111 of file twoflavours/TemplateMaker.cxx.

References OscFit::AsString(), OscFit::GetBin(), OscFit::GetNumBins(), OscFit::GetNumSamples(), OscFit::GetNumShifts(), OscFit::GetNumSystematics(), OscFit::GetSample(), OscFit::GetShift(), and OscFit::GetSystematic().

Referenced by BuildTemplates().

00112 {
00113   std::cout << " *** TemplateMaker::BuildTemplates() *** " << std::endl;
00114   std::cout << "  Building CC2012 Templates for: " << OscFit::AsString(run) << std::endl;
00115 
00116   for( Int_t isample=0; isample<OscFit::GetNumSamples(); isample++ ){
00117     for( Int_t isys=0; isys<OscFit::GetNumSystematics()+1; isys++ ){ // [include central prediction]
00118       for( Int_t ishift=0; ishift<OscFit::GetNumShifts()+1; ishift++ ){ // [include central prediction]
00119         for( Int_t ibin=0; ibin<OscFit::GetNumBins(); ibin++ ){ 
00120     
00121           Sample_t sample = OscFit::GetSample(isample);
00122           Systematic_t systematic = OscFit::GetSystematic(isys);
00123           Shift_t shift = OscFit::GetShift(ishift);
00124           Bin_t bin = OscFit::GetBin(ibin);
00125   
00126           BuildTemplatesCC2012( run, sample, systematic, shift, bin );
00127         }
00128       }
00129     }
00130   }
00131 
00132   return;
00133 }

void OscFit::TemplateMaker::DoCombinedOscWeights ( Bool_t  yesno = 1  )  [inline]

Definition at line 103 of file TemplateMaker.h.

References fDoCombinedOscWeights.

00103                                                  {
00104       fDoCombinedOscWeights = yesno;
00105     }

Double_t TemplateMaker::GetCachedOscWeight ( Int_t  n,
Event myEvent 
) [private]

Definition at line 1018 of file TemplateMaker.cxx.

References OscFit::Event::Ctr, fCache, fCacheCtr, fThisFirstPoint, fThisLastPoint, GetOscWeight(), SetRangeOfGridPoints(), and OscFit::Event::ShiftedEnergy.

Referenced by AddEvent().

01019 {
01020   // Deal with Shifted Energy
01021   if( myEvent->ShiftedEnergy ) 
01022     return GetOscWeight( n, myEvent );
01023 
01024   // Range of Grid Points
01025   SetRangeOfGridPoints();
01026 
01027   // Lookup Entry in Cache
01028   assert( n>=fThisFirstPoint && n<fThisLastPoint
01029        && myEvent->Ctr == fCacheCtr );
01030 
01031   return fCache[n-fThisFirstPoint];
01032 }

Double_t TemplateMaker::GetDensity ( TH2D *  hist,
Double_t  Ereco,
Double_t  Etrue 
)

Definition at line 680 of file twoflavours/TemplateMaker.cxx.

Referenced by BuildTemplate().

00681 {
00682   return OscFit::GetDensity( hist, Ereco, Etrue );
00683 }

Double_t TemplateMaker::GetOscProb ( Sample_t  sample,
Interaction_t  interaction,
Double_t  Enu,
Double_t  dmsq,
Double_t  sinsq = 1.0 
)

Definition at line 685 of file twoflavours/TemplateMaker.cxx.

References OscFit::kCVTau, OscFit::kData, OscFit::kNC, OscFit::kNull, and OscFit::kRockTau.

Referenced by BuildTemplate().

00686 {
00687   if( sample==OscFit::kData                       // Data
00688    || interaction==OscFit::kNull ) return 1.0;    // Null Interaction
00689 
00690   if( interaction==OscFit::kNC ){                 // NC
00691     if( sample==OscFit::kCVTau 
00692      || sample==OscFit::kRockTau ) return 0.0;    // Tau
00693     else return 1.0;                              // CV, Rock
00694   }
00695 
00696   // ND->FD BaseLine: 734.3 km
00697   Double_t Lnu = 734.3;
00698   Double_t pOsc = sinsq*pow(sin(1.267*dmsq*Lnu/Enu),2.0);
00699 
00700   if( sample==OscFit::kCVTau 
00701    || sample==OscFit::kRockTau ) return pOsc;     // NuTau Appearance Probability
00702   else return 1.0 - pOsc;                         // NuMu  Survival Probability
00703 } 

Double_t TemplateMaker::GetOscWeight ( Int_t  n,
Event myEvent 
) [private]

Definition at line 1007 of file TemplateMaker.cxx.

References fSingleGridPoint, GetOscWeight(), and Instance().

01008 {
01009   // Get grid point
01010   GridPoint* thisPoint = TemplateGrid::Instance()->GetGridPoint(n);
01011 
01012   if( n==0 
01013    && fSingleGridPoint ) thisPoint = fSingleGridPoint;
01014 
01015   return this->GetOscWeight( myEvent, thisPoint );
01016 }

Double_t TemplateMaker::GetOscWeight ( Event myEvent,
GridPoint gridPoint 
) [private]

Definition at line 1002 of file TemplateMaker.cxx.

References fDoCombinedOscWeights, GetOscWeight(), and Instance().

Referenced by AddEvent(), GetCachedOscWeight(), GetOscWeight(), and LoadCachedOscWeights().

01003 {
01004   return EventCalculator::Instance()->GetOscWeight( myEvent, gridPoint, fDoCombinedOscWeights );
01005 }

static TemplateMaker* OscFit::TemplateMaker::Instance (  )  [static]
TemplateMaker * TemplateMaker::Instance (  )  [static]
void TemplateMaker::LoadCachedOscWeights ( Event myEvent  )  [private]

Definition at line 1034 of file TemplateMaker.cxx.

References OscFit::Event::Ctr, fCache, fCacheCtr, fThisFirstPoint, fThisLastPoint, GetOscWeight(), n, SetRangeOfGridPoints(), and OscFit::Event::ShiftedEnergy.

Referenced by AddEvent().

01035 {
01036   // Check for New Event
01037   if( myEvent->Ctr == fCacheCtr ) return;
01038 
01039   // Deal with Shifted Energy
01040   assert( myEvent->Ctr>=0
01041        && myEvent->ShiftedEnergy==false );
01042 
01043   // Range of Grid Points
01044   SetRangeOfGridPoints();
01045 
01046   // Build Cache
01047   if( fCache==NULL ){
01048     fCache = new Double_t[1+fThisLastPoint-fThisFirstPoint];
01049   }
01050 
01051   for( Int_t n=fThisFirstPoint; n<fThisLastPoint; n++ ){ 
01052     fCache[n-fThisFirstPoint] = GetOscWeight( n, myEvent );
01053   }
01054 
01055   fCacheCtr = myEvent->Ctr;
01056 
01057   return;
01058 }

void TemplateMaker::MakeTemplate ( RunType_t  runtype,
Sample_t  sample,
Containment_t  recoContainment,
Flavour_t  recoFlavour,
Charge_t  recoCharge,
Resolution_t  recoResolution,
Topology_t  recoTopology,
ProtonTag_t  recoProton,
ElectronTag_t  recoElectron 
) [private]

Definition at line 737 of file TemplateMaker.cxx.

References fThisFirstPoint, fThisLastPoint, OscFit::GetRunPeriod(), OscFit::GetSource(), OscFit::DataInterface::Instance(), Instance(), OscFit::kCentre, OscFit::kCV, OscFit::kNoCharge, OscFit::kNoFlavour, OscFit::kNoShift, OscFit::kNu, OscFit::kNuBar, OscFit::kRock, n, runPeriod, and SetRangeOfGridPoints().

Referenced by BuildTemplate(), SetupTemplatesForLBNE(), and SetupTemplatesForMINOS().

00738 {
00739   // Set Range of Grid Points
00740   SetRangeOfGridPoints();
00741 
00742   Int_t nFirst = fThisFirstPoint; 
00743   Int_t nLast  = fThisLastPoint; 
00744 
00745   Source_t source    = OscFit::GetSource( runtype );
00746   Run_t    runPeriod = OscFit::GetRunPeriod( runtype );
00747 
00748   if( DataInterface::Instance()->TouchData( runtype, sample ) ){
00749 
00750     // atmospheric/beam neutrinos
00751     if( sample==OscFit::kCV || sample==OscFit::kRock ){
00752 
00753       // build multiple grid points
00754       for( Int_t n=nFirst; n<nLast; n++ ){
00755 
00756         // neutrinos
00757         OscFit::Interface::Instance()->Make(n,
00758                                             source, sample,
00759                                             recoFlavour, kNu,
00760                                             kCentre, kNoShift,
00761                                             runPeriod, recoContainment,
00762                                             recoFlavour, recoCharge,
00763                                             recoResolution, recoTopology,
00764                                             recoProton, recoElectron );
00765 
00766         // anti-neutrinos
00767         OscFit::Interface::Instance()->Make(n,
00768                                             source, sample,
00769                                             recoFlavour, kNuBar,
00770                                             kCentre, kNoShift,
00771                                             runPeriod, recoContainment,
00772                                             recoFlavour, recoCharge,
00773                                             recoResolution, recoTopology,
00774                                             recoProton, recoElectron );
00775       }
00776     }
00777 
00778     // non-neutrinos
00779     else {
00780 
00781       // build first grid point
00782       if( nFirst==0 ){
00783 
00784         // data or cosmic
00785         OscFit::Interface::Instance()->Make(0,
00786                                             source, sample,
00787                                             kNoFlavour, kNoCharge,
00788                                             kCentre, kNoShift,
00789                                             runPeriod, recoContainment,
00790                                             recoFlavour, recoCharge,
00791                                             recoResolution, recoTopology,
00792                                             recoProton, recoElectron );
00793       }
00794     }
00795   }
00796 
00797   return;
00798 }

Template * TemplateMaker::NewTemplate (  )  [static]

Definition at line 57 of file twoflavours/TemplateMaker.cxx.

References OscFit::Template::BuildHistograms().

00058 {
00059   Template* temp = new Template();
00060   temp->BuildHistograms();
00061   return temp;
00062 }

void TemplateMaker::PrintTemplates (  ) 

Definition at line 73 of file TemplateMaker.cxx.

References OscFit::TemplateGrid::Instance(), Instance(), and PrintTemplates().

Referenced by BuildFakeAtmosData(), BuildFakeBeamData(), BuildFakeData(), BuildTemplates(), and PrintTemplates().

00074 {
00075   if( TemplateGrid::Instance()->TouchAtmosData()==0 
00076    && TemplateGrid::Instance()->TouchBeamData()==0 ){
00077     std::cout << " --- NO TEMPLATES LOADED --- " << std::endl;
00078     return;
00079   }
00080 
00081   TemplateGrid::Instance()->PrintTemplates();
00082 }

void OscFit::TemplateMaker::RunGridPoint ( Int_t  ipoint  )  [inline]

Definition at line 74 of file TemplateMaker.h.

References RunGridPoints().

Referenced by RunGridPoints().

00074                                      {
00075       RunGridPoints( ipoint, ipoint+1 );
00076     }

void OscFit::TemplateMaker::RunGridPoints ( Int_t  ifirst,
Int_t  ilast 
) [inline]

Definition at line 78 of file TemplateMaker.h.

References fFirstPoint, fLastPoint, and RunGridPoint().

Referenced by RunGridPoint().

00078                                                    {
00079       if( ifirst>=0 && ilast<0 ) return RunGridPoint( ifirst );
00080       fFirstPoint = ifirst;  fLastPoint = ilast;
00081     }

void TemplateMaker::RunTest (  ) 

Definition at line 1095 of file TemplateMaker.cxx.

01096 {
01097   std::cout << " *** TemplateMaker::RunTest() *** " << std::endl;
01098 }

void OscFit::TemplateMaker::SetFileName ( const char *  filename  )  [inline]

Definition at line 48 of file twoflavours/TemplateMaker.h.

References fOutFile.

00048                                             {
00049       fOutFile = filename;
00050     }

void OscFit::TemplateMaker::SetFileName ( const char *  filename  )  [inline]

Definition at line 91 of file TemplateMaker.h.

References fOutFile.

Referenced by SetOutputFile(), and SetOutputPath().

00091                                             {
00092       fOutFile = filename;
00093     }

void OscFit::TemplateMaker::SetInputDirectoryCC2010 ( const char *  dirname  )  [inline]

Definition at line 36 of file twoflavours/TemplateMaker.h.

References fInputDirectoryCC2010.

00036                                                        {
00037       fInputDirectoryCC2010 = dirname;
00038     }

void OscFit::TemplateMaker::SetInputFile ( const char *  filename  )  [inline]

Definition at line 32 of file twoflavours/TemplateMaker.h.

References SetInputPath().

00032                                              {
00033       SetInputPath( filename );
00034     }

void OscFit::TemplateMaker::SetInputPath ( const char *  filename  )  [inline]

Definition at line 28 of file twoflavours/TemplateMaker.h.

References fInputPath.

Referenced by SetInputFile().

00028                                              {
00029       fInputPath = filename;
00030     }

void OscFit::TemplateMaker::SetLiveTime ( Double_t  years  )  [inline]

Definition at line 99 of file TemplateMaker.h.

References fYears.

00099                                       {
00100       fYears = years;
00101     }

void OscFit::TemplateMaker::SetNumEvents ( Int_t  nevents  )  [inline]

Definition at line 95 of file TemplateMaker.h.

References fNevents.

00095                                       {
00096       fNevents = nevents;
00097     }

void OscFit::TemplateMaker::SetOutputFile ( const char *  filename  )  [inline]

Definition at line 44 of file twoflavours/TemplateMaker.h.

References SetFileName().

00044                                               {
00045       SetFileName( filename );
00046     }

void OscFit::TemplateMaker::SetOutputFile ( const char *  filename  )  [inline]

Definition at line 87 of file TemplateMaker.h.

References SetFileName().

00087                                               {
00088       SetFileName( filename );
00089     }

void OscFit::TemplateMaker::SetOutputPath ( const char *  filename  )  [inline]

Definition at line 40 of file twoflavours/TemplateMaker.h.

References SetFileName().

00040                                               {
00041       SetFileName( filename );
00042     }

void OscFit::TemplateMaker::SetOutputPath ( const char *  filename  )  [inline]

Definition at line 83 of file TemplateMaker.h.

References SetFileName().

00083                                               {
00084       SetFileName( filename );
00085     }

void TemplateMaker::SetRangeOfGridPoints (  )  [private]

Definition at line 1071 of file TemplateMaker.cxx.

References fFirstPoint, fGridIsLoaded, fLastPoint, fThisFirstPoint, fThisLastPoint, OscFit::TemplateGrid::Instance(), and Instance().

Referenced by AddEvent(), BuildTemplates(), GetCachedOscWeight(), LoadCachedOscWeights(), and MakeTemplate().

01072 {
01073   if( fGridIsLoaded ) return;
01074  
01075   fThisFirstPoint = fFirstPoint;
01076   if( fThisFirstPoint<0 ) fThisFirstPoint = 0;
01077 
01078   fThisLastPoint = fLastPoint;
01079   if( fThisLastPoint<0 
01080    || fThisLastPoint>=TemplateGrid::Instance()->GetNumGridPoints() ){
01081     fThisLastPoint = TemplateGrid::Instance()->GetNumGridPoints();
01082   }
01083 
01084   std::cout << " *** TemplateMaker::SetRangeOfGridPoints() *** " << std::endl;
01085   std::cout << "  First: " << fThisFirstPoint << std::endl;
01086   std::cout << "  Last:  " << fThisLastPoint << std::endl;
01087   std::cout << " (Total: " << TemplateGrid::Instance()->GetNumGridPoints() << ")" << std::endl;
01088 
01089   assert( fThisLastPoint>fThisFirstPoint 
01090        && fThisFirstPoint<TemplateGrid::Instance()->GetNumGridPoints() );
01091 
01092   fGridIsLoaded = 1;
01093 }

void OscFit::TemplateMaker::SetSubBins ( Double_t  nbins  )  [inline]

Definition at line 24 of file twoflavours/TemplateMaker.h.

References fSubBins.

00024                                      {
00025       fSubBins = nbins;
00026     }

void TemplateMaker::SetupTemplatesForLBNE ( RunType_t  runtype,
Sample_t  sample 
) [private]

Definition at line 685 of file TemplateMaker.cxx.

References OscFit::GetSource(), OscFit::Configuration::Instance(), OscFit::kAtmosData, OscFit::kBeamData, OscFit::kElectron, OscFit::kFullyContained, OscFit::kHiRes, OscFit::kIgnoreElectron, OscFit::kIgnoreProton, OscFit::kNoCharge, OscFit::kNoElectron, OscFit::kNoProton, OscFit::kNue, OscFit::kNumu, OscFit::kPartiallyContained, OscFit::kProton, OscFit::kResBin1, OscFit::kVanilla, and MakeTemplate().

Referenced by BuildTemplates().

00686 {
00687   
00688   // LBNE Atmospheric Neutrinos
00689   if( OscFit::GetSource(myRunType)==OscFit::kAtmosData ){
00690     std::cout << " --- setting up templates for LBNE atmospheric neutrinos --- " << std::endl;
00691 
00692     if( Configuration::Instance()->CombiningAtmosResBinsCV()==true ){
00693       MakeTemplate( myRunType, mySample, kFullyContained,     kNue,  kNoCharge, kHiRes,   kVanilla, kNoProton, kNoElectron );
00694       MakeTemplate( myRunType, mySample, kFullyContained,     kNue,  kNoCharge, kHiRes,   kVanilla, kProton,   kNoElectron );
00695 
00696       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kHiRes,   kVanilla, kNoProton, kNoElectron );
00697       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kHiRes,   kVanilla, kProton,   kNoElectron );
00698       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kHiRes,   kVanilla, kNoProton, kElectron   );
00699       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kHiRes,   kVanilla, kProton,   kElectron   );
00700 
00701       MakeTemplate( myRunType, mySample, kPartiallyContained, kNumu, kNoCharge, kHiRes,   kVanilla, kNoProton, kNoElectron );
00702       MakeTemplate( myRunType, mySample, kPartiallyContained, kNumu, kNoCharge, kHiRes,   kVanilla, kProton,   kNoElectron );
00703     }
00704     else{
00705       MakeTemplate( myRunType, mySample, kFullyContained,     kNue,  kNoCharge, kResBin1, kVanilla, kNoProton, kNoElectron );
00706       MakeTemplate( myRunType, mySample, kFullyContained,     kNue,  kNoCharge, kResBin1, kVanilla, kProton,   kNoElectron );
00707 
00708       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kResBin1, kVanilla, kNoProton, kNoElectron );
00709       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kResBin1, kVanilla, kProton,   kNoElectron );
00710       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kResBin1, kVanilla, kNoProton, kElectron   );
00711       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kResBin1, kVanilla, kProton,   kElectron   );
00712 
00713       MakeTemplate( myRunType, mySample, kPartiallyContained, kNumu, kNoCharge, kResBin1, kVanilla, kNoProton, kNoElectron );
00714       MakeTemplate( myRunType, mySample, kPartiallyContained, kNumu, kNoCharge, kResBin1, kVanilla, kProton,   kNoElectron );
00715     }
00716   }
00717 
00718   // LBNE Beam Neutrinos
00719   if( OscFit::GetSource(myRunType)==OscFit::kBeamData ){
00720     std::cout << " --- setting up templates for LBNE beam neutrinos --- " << std::endl;
00721 
00722     if( Configuration::Instance()->CombiningBeamResBinsCV()==true ){
00723       MakeTemplate( myRunType, mySample, kFullyContained,     kNue,  kNoCharge, kHiRes,   kVanilla, kIgnoreProton, kIgnoreElectron );
00724       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kHiRes,   kVanilla, kIgnoreProton, kIgnoreElectron );
00725       MakeTemplate( myRunType, mySample, kPartiallyContained, kNumu, kNoCharge, kHiRes,   kVanilla, kIgnoreProton, kIgnoreElectron );
00726     }
00727     else{
00728       MakeTemplate( myRunType, mySample, kFullyContained,     kNue,  kNoCharge, kResBin1, kVanilla, kIgnoreProton, kIgnoreElectron );
00729       MakeTemplate( myRunType, mySample, kFullyContained,     kNumu, kNoCharge, kResBin1, kVanilla, kIgnoreProton, kIgnoreElectron );
00730       MakeTemplate( myRunType, mySample, kPartiallyContained, kNumu, kNoCharge, kResBin1, kVanilla, kIgnoreProton, kIgnoreElectron );
00731     }
00732   }
00733   
00734   return;
00735 }

void TemplateMaker::SetupTemplatesForMINOS ( RunType_t  runtype,
Sample_t  sample 
) [private]

Definition at line 636 of file TemplateMaker.cxx.

References OscFit::GetSource(), OscFit::Configuration::Instance(), OscFit::kAmbig, OscFit::kAtmosData, OscFit::kContainedVertex, OscFit::kIgnoreElectron, OscFit::kIgnoreProton, OscFit::kLoRes, OscFit::kNu, OscFit::kNuBar, OscFit::kNue, OscFit::kNumu, OscFit::kResBin1, OscFit::kResBin2, OscFit::kResBin3, OscFit::kResBin4, OscFit::kResBin5, OscFit::kResBin6, OscFit::kResBin7, OscFit::kResBin8, OscFit::kRockMuon, OscFit::kVanilla, and MakeTemplate().

Referenced by BuildTemplates().

00637 {
00638   
00639   // MINOS Atmospheric Neutrinos
00640   if( OscFit::GetSource(myRunType)==OscFit::kAtmosData ){
00641     std::cout << " --- setting up templates for MINOS atmospheric neutrinos --- " << std::endl;
00642 
00643     MakeTemplate( myRunType, mySample, kContainedVertex, kNue,  kAmbig, kLoRes,   kVanilla, kIgnoreProton, kIgnoreElectron );
00644     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kLoRes,   kVanilla, kIgnoreProton, kIgnoreElectron );
00645 
00646     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin1, kVanilla, kIgnoreProton, kIgnoreElectron );
00647     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin2, kVanilla, kIgnoreProton, kIgnoreElectron );
00648     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin3, kVanilla, kIgnoreProton, kIgnoreElectron );
00649     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin4, kVanilla, kIgnoreProton, kIgnoreElectron );
00650     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin1, kVanilla, kIgnoreProton, kIgnoreElectron );
00651     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin2, kVanilla, kIgnoreProton, kIgnoreElectron );
00652     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin3, kVanilla, kIgnoreProton, kIgnoreElectron );
00653     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin4, kVanilla, kIgnoreProton, kIgnoreElectron );
00654     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin1, kVanilla, kIgnoreProton, kIgnoreElectron );
00655     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin2, kVanilla, kIgnoreProton, kIgnoreElectron );
00656     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin3, kVanilla, kIgnoreProton, kIgnoreElectron );
00657     MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin4, kVanilla, kIgnoreProton, kIgnoreElectron );  
00658 
00659     MakeTemplate( myRunType, mySample, kRockMuon,        kNumu, kAmbig, kResBin3, kVanilla, kIgnoreProton, kIgnoreElectron );
00660     MakeTemplate( myRunType, mySample, kRockMuon,        kNumu, kAmbig, kResBin4, kVanilla, kIgnoreProton, kIgnoreElectron );
00661     MakeTemplate( myRunType, mySample, kRockMuon,        kNumu, kNu,    kResBin3, kVanilla, kIgnoreProton, kIgnoreElectron );
00662     MakeTemplate( myRunType, mySample, kRockMuon,        kNumu, kNu,    kResBin4, kVanilla, kIgnoreProton, kIgnoreElectron );
00663     MakeTemplate( myRunType, mySample, kRockMuon,        kNumu, kNuBar, kResBin3, kVanilla, kIgnoreProton, kIgnoreElectron );
00664     MakeTemplate( myRunType, mySample, kRockMuon,        kNumu, kNuBar, kResBin4, kVanilla, kIgnoreProton, kIgnoreElectron );
00665 
00666     if( Configuration::Instance()->UsingNewResolutionBinning() ){
00667       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin5, kVanilla, kIgnoreProton, kIgnoreElectron );
00668       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin6, kVanilla, kIgnoreProton, kIgnoreElectron );
00669       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin7, kVanilla, kIgnoreProton, kIgnoreElectron );
00670       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kAmbig, kResBin8, kVanilla, kIgnoreProton, kIgnoreElectron );
00671       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin5, kVanilla, kIgnoreProton, kIgnoreElectron );
00672       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin6, kVanilla, kIgnoreProton, kIgnoreElectron );
00673       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin7, kVanilla, kIgnoreProton, kIgnoreElectron );
00674       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNu,    kResBin8, kVanilla, kIgnoreProton, kIgnoreElectron );
00675       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin5, kVanilla, kIgnoreProton, kIgnoreElectron );
00676       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin6, kVanilla, kIgnoreProton, kIgnoreElectron );
00677       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin7, kVanilla, kIgnoreProton, kIgnoreElectron );
00678       MakeTemplate( myRunType, mySample, kContainedVertex, kNumu, kNuBar, kResBin8, kVanilla, kIgnoreProton, kIgnoreElectron );  
00679     }
00680   }
00681 
00682   return;
00683 }

void OscFit::TemplateMaker::SwitchOffSystematics (  ) 
void TemplateMaker::SwitchOffSystematics (  ) 

Definition at line 68 of file TemplateMaker.cxx.

References Instance(), and SwitchOffSystematics().

Referenced by BuildFakeData(), and SwitchOffSystematics().

00069 { 
00070   Configuration::Instance()->SwitchOffSystematics();
00071 }

void OscFit::TemplateMaker::SwitchOnSystematics (  ) 
void TemplateMaker::SwitchOnSystematics (  ) 

Definition at line 63 of file TemplateMaker.cxx.

References Instance(), and SwitchOnSystematics().

Referenced by BuildFakeAtmosData(), BuildFakeBeamData(), and SwitchOnSystematics().

00064 { 
00065   Configuration::Instance()->SwitchOnSystematics();
00066 }

void TemplateMaker::UnloadCachedOscWeights (  )  [private]

Definition at line 1060 of file TemplateMaker.cxx.

References fCache, and fCacheCtr.

Referenced by BuildFakeAtmosData(), BuildFakeBeamData(), and BuildFakeData().

01061 {
01062   std::cout << " *** TemplateMaker::UnloadCachedOscWeights() *** " << std::endl;
01063 
01064   if( fCache ) delete [] fCache; 
01065 
01066   fCache = NULL; fCacheCtr = -1;
01067 
01068   return;
01069 }

void OscFit::TemplateMaker::UseCC2010Templates (  )  [inline]

Definition at line 52 of file twoflavours/TemplateMaker.h.

References fUseCC2010Templates, and fUseCC2010TemplatesVeryOld.

00053     {
00054       fUseCC2010Templates = 1;
00055       fUseCC2010TemplatesVeryOld = 0;
00056     }

void OscFit::TemplateMaker::UseCC2010TemplatesVeryOld (  )  [inline]

Definition at line 58 of file twoflavours/TemplateMaker.h.

References fUseCC2010Templates, and fUseCC2010TemplatesVeryOld.

00059     {
00060       fUseCC2010Templates = 1;
00061       fUseCC2010TemplatesVeryOld = 1;
00062     }

void TemplateMaker::WriteTemplates (  ) 

Definition at line 84 of file TemplateMaker.cxx.

References fOutFile, OscFit::TemplateGrid::Instance(), and Instance().

Referenced by BuildTemplates().

00085 {
00086   if( TemplateGrid::Instance()->TouchAtmosData()==0 
00087    && TemplateGrid::Instance()->TouchBeamData()==0  ){
00088     std::cout << " --- NO TEMPLATES LOADED --- " << std::endl;
00089     return;
00090   }
00091 
00092   std::cout << " *** TemplateMaker::WriteTemplates() *** " << std::endl;
00093   std::cout << "  OutFile = " << fOutFile.Data() << std::endl;
00094 
00095   TemplateIO::Instance()->Write( fOutFile.Data() );
00096 
00097   return;
00098 }


Member Data Documentation

Double_t* OscFit::TemplateMaker::fCache [private]

Definition at line 161 of file TemplateMaker.h.

Referenced by RunGridPoints(), SetRangeOfGridPoints(), and TemplateMaker().

Definition at line 174 of file twoflavours/TemplateMaker.h.

Referenced by BuildTemplatesCC2010(), and SetInputDirectoryCC2010().

Definition at line 173 of file twoflavours/TemplateMaker.h.

Referenced by BuildTemplatesCC2012(), and SetInputPath().

Definition at line 162 of file TemplateMaker.h.

Referenced by RunGridPoints(), SetRangeOfGridPoints(), and TemplateMaker().

Definition at line 172 of file TemplateMaker.h.

Referenced by BuildTemplates(), SetNumEvents(), and TemplateMaker().

Definition at line 159 of file TemplateMaker.h.

Referenced by BuildTemplates(), SetFileName(), TemplateMaker(), and WriteTemplates().

Definition at line 174 of file TemplateMaker.h.

Referenced by BuildFakeData(), GetOscWeight(), and TemplateMaker().

Double_t OscFit::TemplateMaker::fSubBins [private]

Definition at line 190 of file twoflavours/TemplateMaker.h.

Referenced by BuildTemplate(), and SetSubBins().

Double_t OscFit::TemplateMaker::fYears [private]

Definition at line 170 of file TemplateMaker.h.

Referenced by BuildTemplates(), SetLiveTime(), and TemplateMaker().


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

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1