TestEventManager Class Reference

#include <TestEventManager.h>

List of all members.

Public Member Functions

void testInitialisation (void)
void testFileAdd (void)
void testEventAddND (void)
void testEventAddFD (void)
void testReweightSamplesPerBin (void)

Detailed Description

Definition at line 13 of file TestEventManager.h.


Member Function Documentation

void TestEventManager::testEventAddFD ( void   )  [inline]

Definition at line 59 of file TestEventManager.h.

References NuFCEventManager::AddEvent(), NuEvent::charge, NuEvent::detector, MuELoss::e, NuFCEventManager::FDEvents(), NuEvent::iaction, NuEvent::inu, Sample::kSignalPQ, NuFCEventManager::Samples(), and NuEvent::trkEn.

00060   {
00061     NuFCEventManager man;
00062     
00063     NuEvent nu;
00064     nu.detector = 2;
00065     nu.trkEn = 42.0;
00066     nu.inu = -14;
00067     nu.iaction = 1;
00068     nu.charge = 1;
00069     NuFCEvent2 fc(nu);
00070     man.AddEvent(fc, 1E20);
00071     
00072     // Test we added an event
00073     TS_ASSERT_EQUALS(man.Samples().size(), 1);
00074     TS_ASSERT_EQUALS(man.FDEvents(Sample::kSignalPQ).size(), 1);
00075 
00076     // Test retrieving this event
00077     NuEvent newNu;
00078     man.FDEvents(Sample::kSignalPQ)[0].Expand(newNu);
00079     TS_ASSERT_DELTA(newNu.trkEn, nu.trkEn, 1e-9);
00080   }

void TestEventManager::testEventAddND ( void   )  [inline]

Definition at line 40 of file TestEventManager.h.

References NuFCEventManager::AddEvent(), NuEvent::detector, MuELoss::e, NuFCEventManager::NDEvents(), and NuEvent::trkEn.

00041   {
00042     NuFCEventManager man;
00043     
00044     NuEvent nu;
00045     nu.detector = 1;
00046     nu.trkEn = 42.0;
00047     
00048     NuFCEvent2 fc(nu);
00049     man.AddEvent(fc, 1E20);
00050     // Test we added an event
00051     TS_ASSERT_EQUALS(man.NDEvents().size(), 1);
00052     // Test retrieving this event
00053     NuEvent newNu;
00054     man.NDEvents()[0].Expand(newNu);
00055     TS_ASSERT_DELTA(newNu.trkEn, nu.trkEn, 1e-9);
00056   }

void TestEventManager::testFileAdd ( void   )  [inline]

Definition at line 30 of file TestEventManager.h.

References NuFCEventManager::AddFile().

00031   {
00032     NuFCEventManager man;
00033     
00034     man.AddFile("data/FCETest.root");
00035 
00036     // man.Print();
00037   }

void TestEventManager::testInitialisation ( void   )  [inline]

Definition at line 25 of file TestEventManager.h.

00026   {
00027     NuFCEventManager man;
00028   }

void TestEventManager::testReweightSamplesPerBin ( void   )  [inline]

Definition at line 82 of file TestEventManager.h.

References NuFCEventManager::AddEvent(), NuEvent::charge, NuEvent::detector, MuELoss::e, NuEvent::energyMC, NuFCEventManager::FDEvents(), NuEvent::iaction, NuEvent::inu, Sample::kSignalPQ, NuFCEventManager::ReweightSamplesPerBin(), NuEvent::rw, and NuEvent::trkEn.

00083   {
00084     // Build a test spectrum with three bins
00085     TH1D hist("test","test",3,0,3);
00086     NuMatrix1D testMatrix(hist);
00087     // Create the event manager
00088     NuFCEventManager man;
00089     // Set up the basic event - only test one sample
00090     NuEvent nu;
00091     nu.detector = 2;
00092     nu.trkEn = 0.0;
00093     nu.inu = -14;
00094     nu.iaction = 1;
00095     nu.charge = 1;
00096     // Push back some known, fake events
00097     nu.energyMC = 0.5;
00098     nu.rw = 1.0;
00099     man.AddEvent(NuFCEvent2(nu),1E20); // 0
00100     nu.rw = 2.0;
00101     man.AddEvent(NuFCEvent2(nu),1E20); // 1
00102     
00103     nu.energyMC = 1.5;
00104     nu.rw = 1.0;
00105     man.AddEvent(NuFCEvent2(nu),1E20); // 2
00106     
00107     nu.energyMC = 2.5;
00108     nu.rw = 1.35;
00109     man.AddEvent(NuFCEvent2(nu),1E20); //3
00110     
00111     // Do the reweighting procedure
00112     man.ReweightSamplesPerBin(testMatrix);
00113     
00114     // Now, validate that this did what we expect
00115     const vector<NuFCEvent2> &evts = man.FDEvents(Sample::kSignalPQ);
00116     TS_ASSERT_DELTA(evts[0].Rw(), 0.5, 1e-9);
00117     TS_ASSERT_DELTA(evts[1].Rw(), 1.0, 1e-9);
00118     TS_ASSERT_DELTA(evts[2].Rw(), 1.0, 1e-9);
00119     TS_ASSERT_DELTA(evts[3].Rw(), 1.0, 1e-9);    
00120   }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1