TestExperimentGenerator Class Reference

#include <TestExperimentGenerator.h>

List of all members.

Public Member Functions

void setUp ()
void tearDown ()
void testInitialisation (void)
void testNDGenSingleEvent (void)
void setUp ()
void tearDown ()
void testBuildSummaries (void)
void testFailSummaryAccess (void)
void testAccessSummary (void)

Private Attributes

NuMMHelperCPT helper
NuMMRunrun
NuFCRunInforunInfo
NuFCEventManagerem

Detailed Description

Definition at line 25 of file TestExperimentGenerator.h.


Member Function Documentation

void TestExperimentGenerator::setUp (  )  [inline]

Definition at line 35 of file TestRunInfo.h.

References em, NuFCRunInfo::Events(), NuMMHelperCPT::FDNuPurity(), helper, run, and runInfo.

00036   {
00037     // Reinitialise the 'perfect' helper
00038     helper = NuMMHelperCPT("data/PerfectHelper.root", "data/xsec_minos_modbyrs4_v3_5_0_mk.root");
00039     NuMatrixSpectrum blank(*helper.FDNuPurity(), 1E20);
00040     blank.Scale(0.0);
00041     run = new NuMMRunFC(&helper, &blank, &blank, &blank, &blank);
00042     
00043     // Create a template NuMMRun object
00044     runInfo = new NuFCRunInfo(run, "TestRun");
00045     
00046     // Grab the event manager pointer
00047     em = const_cast<NuFCEventManager*>(&runInfo->Events());
00048   }

void TestExperimentGenerator::setUp (  )  [inline]

Definition at line 37 of file TestExperimentGenerator.h.

References em, NuFCRunInfo::Events(), NuMMHelperCPT::FDNuPurity(), helper, run, and runInfo.

00038   {
00039     // Reinitialise the 'perfect' helper
00040     helper = NuMMHelperCPT("data/PerfectHelper.root", "data/xsec_minos_modbyrs4_v3_5_0_mk.root");
00041     NuMatrixSpectrum blank(*helper.FDNuPurity(), 1E20);
00042     blank.Scale(0.0);
00043     run = new NuMMRunFC(&helper, &blank, &blank, &blank, &blank);
00044     
00045     // Create a template NuMMRun object
00046     runInfo = new NuFCRunInfo(run, "TestRun");
00047     
00048     // Grab the event manager pointer
00049     em = const_cast<NuFCEventManager*>(&runInfo->Events());
00050   }

void TestExperimentGenerator::tearDown (  )  [inline]

Definition at line 50 of file TestRunInfo.h.

References em, run, and runInfo.

00051   {
00052     // Give up our class-pointer event manager
00053     em = 0;
00054     if (run) delete run; run = 0;
00055     if (runInfo) delete runInfo; runInfo = 0;
00056     
00057   }

void TestExperimentGenerator::tearDown (  )  [inline]

Definition at line 52 of file TestExperimentGenerator.h.

References em, run, and runInfo.

00053   {
00054     // Give up our class-pointer event manager
00055     em = 0;
00056     if (run) delete run; run = 0;
00057     if (runInfo) delete runInfo; runInfo = 0;
00058     
00059   }

void TestExperimentGenerator::testAccessSummary ( void   )  [inline]

Definition at line 83 of file TestRunInfo.h.

References MuELoss::a, NuFCEventManager::AddEvent(), NuFCRunInfo::BuildSummaries(), NuEvent::charge, NuMatrix1D::Complete(), NuEvent::detector, MuELoss::e, em, NuEvent::energyMC, NuFCRunInfo::GetNoRWSummary(), NuFCRunInfo::GetSummary(), NuEvent::iaction, NuMatrixSpectrum::Integral(), NuEvent::inu, Detector::kFar, Sample::kSignalPQ, runInfo, NuEvent::rw, NuEvent::shwEn, and NuMatrixSpectrum::Spectrum().

00084   {
00085     // Set up a basic event in the event manager
00086     NuEvent b;
00087     b.rw = 1.7;
00088     b.detector = Detector::kFar;
00089     b.energyMC = 42.0;
00090     b.shwEn = 0.0;
00091     b.charge = 1;
00092     b.inu = -14;
00093     b.iaction = 1;
00094     NuFCEvent2 c(b);
00095     em->AddEvent(c,1E20);
00096     runInfo->BuildSummaries();
00097     
00098     // Try to get the written event back
00099     NuMatrixSpectrum a = runInfo->GetSummary(Sample::kSignalPQ);
00100     TS_ASSERT(a.Complete());
00101     TS_ASSERT_DELTA(a.Integral(), b.rw, 1e-15);
00102     // Check that the bin for the right energy was filled
00103     TS_ASSERT_DELTA(a.Spectrum()->GetBinContent(a.Spectrum()->FindBin(b.energyMC)),b.rw, 1e-15);
00104     
00105     NuMatrixSpectrum aNoRW = runInfo->GetNoRWSummary(Sample::kSignalPQ);
00106     TS_ASSERT(aNoRW.Complete());
00107     TS_ASSERT_DELTA(aNoRW.Integral(), 1.0, 1e-15);
00108     // Check that the bin for the right energy was filled
00109     TS_ASSERT_DELTA(aNoRW.Spectrum()->GetBinContent(aNoRW.Spectrum()->FindBin(b.energyMC)),1.0, 1e-15);
00110     
00111   }

void TestExperimentGenerator::testBuildSummaries ( void   )  [inline]

Definition at line 60 of file TestRunInfo.h.

References NuFCEventManager::AddEvent(), NuFCRunInfo::BuildSummaries(), NuEvent::charge, NuEvent::detector, em, NuEvent::iaction, NuEvent::inu, Detector::kFar, runInfo, NuEvent::rw, NuEvent::shwEn, and NuEvent::trkEn.

00061   {
00062     // Set up a basic event in the event manager
00063     NuEvent b;
00064     b.rw = 1.7;
00065     b.detector = Detector::kFar;
00066     b.trkEn = 42.0;
00067     b.shwEn = 0.0;
00068     b.charge = 1;
00069     b.inu = -14;
00070     b.iaction = 1;
00071     NuFCEvent2 c(b);
00072     em->AddEvent(c,1E20);
00073     
00074     runInfo->BuildSummaries();
00075   }

void TestExperimentGenerator::testFailSummaryAccess ( void   )  [inline]

Definition at line 78 of file TestRunInfo.h.

References NuFCRunInfo::GetSummary(), and runInfo.

00079   {
00080     TS_ASSERT_THROWS(runInfo->GetSummary(0), std::runtime_error);
00081   }

void TestExperimentGenerator::testInitialisation ( void   )  [inline]

Definition at line 61 of file TestExperimentGenerator.h.

References MuELoss::a, and runInfo.

00062   {
00063     NuMMParameters pars;
00064     NuFCExperimentGenerator a(*runInfo, pars);
00065   }

void TestExperimentGenerator::testNDGenSingleEvent ( void   )  [inline]

Definition at line 68 of file TestExperimentGenerator.h.

References MuELoss::a, NuFCEventManager::AddEvent(), NuEvent::charge, NuEvent::detector, MuELoss::e, em, NuFCExperimentGenerator::GenerateND(), Detector::kNear, NuMatrixCPT::PQ(), runInfo, NuEvent::rw, NuEvent::shwEn, NuMatrix::Spectrum(), and NuEvent::trkEn.

00069   {
00070     NuMMParameters pars;
00071     NuFCExperimentGenerator a(*runInfo, pars);
00072     
00073     // Set up a basic event in the event manager
00074     NuEvent b;
00075     b.rw = 1.7;
00076     b.detector = Detector::kNear;
00077     b.trkEn = 42.0;
00078     b.shwEn = 0.0;
00079     b.charge = 1;
00080     NuFCEvent2 c(b);
00081     em->AddEvent(c,1E20);
00082     
00083     NuSystematicShifts shifts;
00084     
00085     // Now, try to get this event
00086     auto_ptr<NuMatrix> nd = a.GenerateND(shifts);
00087     NuMatrixCPT *ndCpt = dynamic_cast<NuMatrixCPT*>(nd.get());
00088     NuMatrix *pq = ndCpt->PQ();
00089     // Test this event got into our spectrum
00090     TS_ASSERT_DELTA(pq->Spectrum()->Integral(), b.rw, 1e-15);
00091     
00092     // Check it went to the right bin
00093     TS_ASSERT_DELTA(pq->Spectrum()->GetBinContent(pq->Spectrum()->FindBin(b.trkEn)), b.rw, 1e-15);
00094   }


Member Data Documentation

Definition at line 28 of file TestExperimentGenerator.h.

Referenced by setUp().

Definition at line 30 of file TestExperimentGenerator.h.

Referenced by setUp(), and tearDown().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1