RockRunCPT Class Reference

#include <RockRunCPT.h>

Inheritance diagram for RockRunCPT:
NuMMRun

List of all members.

Public Member Functions

 RockRunCPT (NuMMHelperCPT *helper, const TString &RMEvents, NuMatrixCPT *ndMC, NuMatrixCPT *ndData, RockMatrix *fdData)
virtual ~RockRunCPT ()
virtual Double_t ComparePredWithData (const NuMMParameters &pars)
 Generates a prediction, and then compares this with 'the data'.
virtual RockMatrixMakeFDPred (const NuMMParameters &pars, const bool display=false) const
 Makes a far detector prediction.
virtual RockMatrixFakeFDData (const NuMMParameters &pars)
 Build a fake far detector data histogram.
virtual std::vector< TH1D > WriteFDPredHistos (const NuMMParameters &) const
 Returns a vector of histograms from the building.
Int_t WriteHistos (const NuMMParameters &) const
 Writes out histograms.
RockFillerGetFiller (void)

Private Member Functions

virtual NuMatrixCPT CalculateFDFlux (const NuMatrixCPT &nd) const

Private Attributes

std::auto_ptr< NuMMHelperCPTpairfHelper
 Pointer to the helper object.
NuMatrixCPTfNDMC
 Matrix of the ND MC.
NuMatrixCPTfNDData
 Matrix of the ND data (that is extrapolated from).
NuMatrixCPTfFDFlux
 Predicted FD flux, from extrapolating MC.
NuMatrixCPTfFDFluxPred
 Predicted FD flux, from extrapolating Data.
NuMatrixCPTfFDMCCorr
 Correction to the rock MC to bring in line with prediction.
std::auto_ptr< RockMatrixfFDData
 Copy of the far detector data.
std::auto_ptr< RockFillerfRockFiller
 Keeps track of the RAF events, and builds spectra.

Detailed Description

Rock extrapolator. Mostly a clone of NuMMRunCC2010.

Definition at line 25 of file RockRunCPT.h.


Constructor & Destructor Documentation

RockRunCPT::RockRunCPT ( NuMMHelperCPT helper,
const TString &  RMEvents,
NuMatrixCPT ndMC,
NuMatrixCPT ndData,
RockMatrix fdData 
)

Constructs the rock muon extrapolator

Parameters:
helper A pointer to the Matrix Method helper object
RMEvents the filename of a RockEvents file.
ndMC blarg
ndData The near detector data spectrum, to be extrapolated
fdData The FD data to compare to

Definition at line 27 of file RockRunCPT.cxx.

References CalculateFDFlux(), NuMatrix::Complete(), NuMatrixCPT::Complete(), NuMatrix::Copy(), NuMatrixCPT::Divide(), fFDData, fFDFlux, fFDFluxPred, fFDMCCorr, fHelper, fNDData, fNDMC, fRockFiller, Msg::kError, MSG, and NuMatrixCPT::PQ().

00032                       : NuMMRun(),
00033                         fHelper(0),
00034                         fNDMC(ndMC),
00035                         fNDData(ndData),
00036                         fFDFlux(0),
00037                         fFDFluxPred(0),
00038                         fFDMCCorr(0),
00039                         fFDData(0),
00040                         fRockFiller(0)
00041 {
00042   // Validate we got all input. Start with the helper
00043   if (!helper) {
00044     MSG("RockRunCPT",Msg::kError) << "NuMMHelper object is invalid. ND Extrapolation will be blank" << endl;
00045   }
00046   // Make a new helper object!
00047   fHelper = auto_ptr<NuMMHelperCPTpair>(new NuMMHelperCPTpair(helper));
00048 
00049   // We MUST have an ND MCspectrum
00050   if (!ndMC || !ndMC->Complete()) {
00051     MSG("RockRunCPT",Msg::kError) << "ndMC object is invalid. Cannot continue without ND MC spectrum" << endl;
00052     throw runtime_error("Blank ndData object");
00053   }
00054 
00055   // We MUST have an ND spectrum
00056   if (!ndData || !ndData->Complete()) {
00057     MSG("RockRunCPT",Msg::kError) << "ndData object is invalid. Cannot continue without ND data spectrum" << endl;
00058     throw runtime_error("Blank ndData object");
00059   }
00060 
00061   // We MUST have FD data, because we use it as a RockMatrix template
00062   if (!fdData || !fdData->Complete())
00063   {
00064     MSG("RockRunCPT",Msg::kError) << "fdData object is invalid. Cannot continue without FD Rock spectrum" << endl;
00065     throw runtime_error("Blank fdData object");
00066   }
00067 
00068   // Copy the FD Data
00069   // fFDData =  dynamic_cast<RockMatrix*>(fdData->Copy());
00070   fFDData.reset(dynamic_cast<RockMatrix*>(fdData->Copy()));
00071 
00072 
00073 
00074   // Pre-calculate the FD flux
00075   fFDFluxPred = new NuMatrixCPT(CalculateFDFlux(*fNDData));
00076 
00077   // Calculate the flux from extrapolating MC
00078   fFDFlux = new NuMatrixCPT(CalculateFDFlux(*fNDMC));
00079 
00080   // Calculate the flux prediction correction, for the Rock Muons
00081   fFDMCCorr = new NuMatrixCPT(*fFDFluxPred);
00082 
00083 
00084   fFDMCCorr->Divide(*fFDFlux);
00085 
00086   // // If we have passed no FD Flux, then assume no weighting of MC
00087   // if (fFDFluxMC) {
00088   //   fFDMCCorr->Divide(*fFDFluxMC);
00089   // } else {
00090   //   // weight of 1: No correction!
00091   // fFDMCCorr->SetValue(1.0);
00092   // }
00093 
00094   // Build the rock filler from the ND energy spectrum and FD RockMatrix
00095   fRockFiller.reset(new RockFiller(*dynamic_cast<NuMatrix1D*>(ndData->PQ()), *fFDData));
00096 
00097   if (RMEvents != "") {
00098     fRockFiller->AddFile(RMEvents);
00099   }
00100 }

RockRunCPT::~RockRunCPT (  )  [virtual]

Definition at line 102 of file RockRunCPT.cxx.

References fFDFlux, fFDFluxPred, and fFDMCCorr.

00103 {
00104   if (fFDFluxPred) delete fFDFluxPred; fFDFluxPred = 0;
00105 
00106   // if (fFDData) delete fFDData; fFDData = 0;
00107 
00108   if (fFDMCCorr) delete fFDMCCorr; fFDMCCorr = 0;
00109 
00110   if (fFDFlux) delete fFDFlux; fFDFlux = 0;
00111 }


Member Function Documentation

NuMatrixCPT RockRunCPT::CalculateFDFlux ( const NuMatrixCPT nd  )  const [private, virtual]

Definition at line 131 of file RockRunCPT.cxx.

References NuMatrixCPT::Divide(), NuMatrixCPT::ExtrapolateNDToFD(), fHelper, NuMMRun::fNDFidMass, NuMatrix::GetPOT(), NuMatrixCPT::Multiply(), and NuMatrixCPT::RecoToTrue().

Referenced by RockRunCPT().

00132 {
00133   NuMatrixCPT pred = ndd;
00134 
00135   pred.Multiply(fHelper->NDPurity());
00136   pred.RecoToTrue(fHelper->NDRecoVsTrue());
00137   pred.Divide(fHelper->NDEfficiency());
00138   pred.Divide(fHelper->XSecGraph());
00139   pred.Divide(ndd.GetPOT());
00140   pred.Divide(fNDFidMass);
00141   pred.ExtrapolateNDToFD(fHelper->BeamMatrix());
00142 
00143   return pred;
00144 }

Double_t RockRunCPT::ComparePredWithData ( const NuMMParameters pars  )  [virtual]

Generates a prediction, and then compares this with 'the data'.

Implements NuMMRun.

Definition at line 148 of file RockRunCPT.cxx.

References fFDData, NuMMRun::fJessFile, MakeFDPred(), NuMatrix::StatsLikelihood(), and NuMatrix::Write().

00149 {
00150   Double_t like = 0.0;
00151 
00152   // got here
00153 
00154   RockMatrix *rm = this->MakeFDPred(pars, bool(fJessFile));
00155 
00156   if(fJessFile){
00157     rm->Write("mc");
00158     fFDData->Write("data");
00159   }
00160 
00161   like += rm->StatsLikelihood(fFDData.get());
00162   delete rm;
00163 
00164   return like;
00165 }

RockMatrix * RockRunCPT::FakeFDData ( const NuMMParameters pars  )  [virtual]

Build a fake far detector data histogram.

Definition at line 229 of file RockRunCPT.cxx.

References fFDData, and MakeFDPred().

00230 {
00231   // Make a FD data RockMatrix
00232   fFDData.reset(MakeFDPred(pars));
00233   return fFDData.get();
00234 }

RockFiller* RockRunCPT::GetFiller ( void   )  [inline]

Definition at line 57 of file RockRunCPT.h.

References fRockFiller.

00057 { return fRockFiller.get(); }

RockMatrix * RockRunCPT::MakeFDPred ( const NuMMParameters pars,
const bool  display = false 
) const [virtual]

Makes a far detector prediction.

We want to oscillate the NuMatrix1D, then build a RockMatrix with this oscillation

Definition at line 118 of file RockRunCPT.cxx.

References NuMMRun::fDisappearanceModel, fFDMCCorr, and fRockFiller.

Referenced by ComparePredWithData(), and FakeFDData().

00119 {
00120   // Make a copy of the correction histogram
00121   NuMatrixCPT osccorr(*fFDMCCorr);
00122 
00123   // Build the RockMatrix
00124   RockMatrix *rm = dynamic_cast<RockMatrix*>
00125     (fRockFiller->GetRockMatrix(pars, &osccorr, fDisappearanceModel, display));
00126 
00127   // Pass this rock matrix back to the user
00128   return rm;
00129 }

std::vector< TH1D > RockRunCPT::WriteFDPredHistos ( const NuMMParameters  )  const [virtual]

Returns a vector of histograms from the building.

Implements NuMMRun.

Definition at line 169 of file RockRunCPT.cxx.

References fFDFlux, fFDFluxPred, fFDMCCorr, fNDData, fNDMC, NuMatrixCPT::NQ(), NuMatrixCPT::PQ(), and NuMatrix::Spectrum().

Referenced by WriteHistos().

00170 {
00171   vector<TH1D> hists;
00172   // Push all the histograms back
00173 
00174   //
00175   // NuMatrixCPT *fNDMC;    ///< Matrix of the ND MC
00176   // NuMatrixCPT *fNDData;    ///< Matrix of the ND data (that is extrapolated from)
00177   // NuMatrixCPT *fFDFlux;
00178   // NuMatrixCPT *fFDFluxPred;  ///< Predicted FD flux
00179   // NuMatrixCPT *fFDMCCorr; ///< Correction to the rock MC to bring in line with prediction
00180   // RockMatrix  *fFDData; ///< Copy of the far detector data
00181   //
00182 
00183   // ND MC
00184   fNDMC->NQ()->Spectrum()->SetNameTitle("fNDMCNQ","CC Reco spectrum from ND MC");
00185   hists.push_back(*dynamic_cast<TH1D *>(fNDMC->NQ()->Spectrum()));
00186   fNDMC->PQ()->Spectrum()->SetNameTitle("fNDMCPQ","Anti-CC Reco Spectrum form ND MC");
00187   hists.push_back(*dynamic_cast<TH1D *>(fNDMC->PQ()->Spectrum()));
00188 
00189   // ND Data
00190   fNDData->NQ()->Spectrum()->SetNameTitle("fNDDataNQ","CC Reco spectrum from ND MC");
00191   hists.push_back(*dynamic_cast<TH1D *>(fNDData->NQ()->Spectrum()));
00192   fNDData->PQ()->Spectrum()->SetNameTitle("fNDDataPQ","Anti-CC Reco Spectrum form ND MC");
00193   hists.push_back(*dynamic_cast<TH1D *>(fNDData->PQ()->Spectrum()));
00194 
00195   // Base MC flux
00196   fFDFlux->NQ()->Spectrum()->SetNameTitle("fFDFluxNu","CC Flux from MM on ND MC");
00197   hists.push_back(*dynamic_cast<TH1D *>(fFDFlux->NQ()->Spectrum()));
00198   fFDFlux->PQ()->Spectrum()->SetNameTitle("fFDFluxNubar","Anti-CC Flux from MM on ND MC");
00199   hists.push_back(*dynamic_cast<TH1D *>(fFDFlux->PQ()->Spectrum()));
00200 
00201   // Far flux prediction, from data
00202   fFDFluxPred->NQ()->Spectrum()->SetNameTitle("fFDFluxPredNu","CC Flux prediction from MM");
00203   hists.push_back(*dynamic_cast<TH1D *>(fFDFluxPred->NQ()->Spectrum()));
00204   fFDFluxPred->PQ()->Spectrum()->SetNameTitle("fFDFluxPredNubar","Anti-CC Flux prediction from MM");
00205   hists.push_back(*dynamic_cast<TH1D *>(fFDFluxPred->PQ()->Spectrum()));
00206 
00207   // MC Correction
00208   fFDMCCorr->NQ()->Spectrum()->SetNameTitle("fFDMCCorrNu", "Correction to FD MC");
00209   hists.push_back(*dynamic_cast<TH1D *>(fFDMCCorr->NQ()->Spectrum()));
00210   fFDMCCorr->PQ()->Spectrum()->SetNameTitle("fFDMCCorrNubar", "Correction to FD Anti-MC");
00211   hists.push_back(*dynamic_cast<TH1D *>(fFDMCCorr->PQ()->Spectrum()));
00212 
00213 
00214   return hists;
00215 }

Int_t RockRunCPT::WriteHistos ( const NuMMParameters pars  )  const

Writes out histograms.

Definition at line 218 of file RockRunCPT.cxx.

References WriteFDPredHistos().

00219 {
00220   std::vector<TH1D> hists = WriteFDPredHistos(pars);
00221 
00222   for (UInt_t i = 0; i < hists.size(); ++i)
00223     hists[i].Write();
00224 
00225   return hists.size();
00226 }


Member Data Documentation

std::auto_ptr<RockMatrix> RockRunCPT::fFDData [private]

Copy of the far detector data.

Reimplemented from NuMMRun.

Definition at line 70 of file RockRunCPT.h.

Referenced by ComparePredWithData(), FakeFDData(), and RockRunCPT().

Predicted FD flux, from extrapolating MC.

Definition at line 67 of file RockRunCPT.h.

Referenced by RockRunCPT(), WriteFDPredHistos(), and ~RockRunCPT().

Predicted FD flux, from extrapolating Data.

Definition at line 68 of file RockRunCPT.h.

Referenced by RockRunCPT(), WriteFDPredHistos(), and ~RockRunCPT().

Correction to the rock MC to bring in line with prediction.

Definition at line 69 of file RockRunCPT.h.

Referenced by MakeFDPred(), RockRunCPT(), WriteFDPredHistos(), and ~RockRunCPT().

std::auto_ptr<NuMMHelperCPTpair> RockRunCPT::fHelper [private]

Pointer to the helper object.

Reimplemented from NuMMRun.

Definition at line 62 of file RockRunCPT.h.

Referenced by CalculateFDFlux(), and RockRunCPT().

Matrix of the ND data (that is extrapolated from).

Reimplemented from NuMMRun.

Definition at line 66 of file RockRunCPT.h.

Referenced by RockRunCPT(), and WriteFDPredHistos().

Matrix of the ND MC.

Definition at line 65 of file RockRunCPT.h.

Referenced by RockRunCPT(), and WriteFDPredHistos().

std::auto_ptr<RockFiller> RockRunCPT::fRockFiller [private]

Keeps track of the RAF events, and builds spectra.

Definition at line 71 of file RockRunCPT.h.

Referenced by GetFiller(), MakeFDPred(), and RockRunCPT().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1