public void DealwithTwoEmptySubsAndKeepSpacesCorrectly() { // Create the plot var p = PlottingUtils.MakePlotterSpec <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(10, 0.0, 10.0, evt => evt.jets.Select(j => j.myvectorofint).First(), "dude{0}{1}abides", "fork {0}{1} this over"); // Create the query. We aren't very intersted in the result, but rather the result. var q = new QueriableDummy <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(p, "", "hi"); var resultVar = DummyQueryExectuor.FinalResult.ResultValue as DeclarableParameter; var rootObj = resultVar.InitialValue as ROOTObjectStaticHolder; Assert.AreEqual("dudehiabides", rootObj.OriginalName); Assert.AreEqual("fork hi this over", rootObj.OriginalTitle); }
public void RemoveSpacesFromNames() { // Create the plot var p = PlottingUtils.MakePlotterSpec <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(10, 0.0, 10.0, evt => evt.jets.Select(j => j.myvectorofint).First(), "dude{0}", "fork {0}"); // Create the query. We aren't very intersted in the result, but rather the result. var q = new QueriableDummy <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(p, " is hell"); var resultVar = DummyQueryExectuor.FinalResult.ResultValue as DeclarableParameter; var rootObj = resultVar.InitialValue as ROOTObjectStaticHolder; Assert.AreEqual("dudeishell", rootObj.OriginalName); Assert.AreEqual("fork is hell", rootObj.OriginalTitle); }
public void TestPlotFromTemplateWithWeight() { // Create the plot var p = PlottingUtils.MakePlotterSpec <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupe>(10, 0.0, 10.0, evt => evt.run, "dude", "fork", weight: evt => 0.5); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupe>(); var r = q.Plot(p, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.CodeBody.CodeItUp().Where(l => l.Contains("Fill(((double)(*this).run),0.5*1.0)")).Any(), "no line contains the proper size call!"); }
public void TestFromTemplateWithStraightSequenceDefinition() { // Create the plot var p = PlottingUtils.MakePlotterSpec <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(10, 0.0, 10.0, evt => evt.jets.Select(j => (double)j.myvectorofint), "dude", "fork"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(p, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.DumpCode().Where(l => l.Contains("(*(*this).myvectorofint).size()")).Any(), "no line contains the proper size call!"); }
public void TestPlotFromTemplateNullNameAndDescrip() { // Create the plot. var pRaw = PlottingUtils.MakePlotterSpec <TTreeQueryExecutorTest.TestNtupeArrJets>(10, 0.0, 10.0, v => v.myvectorofint); var pEvent = pRaw.FromManyOfType((LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents evt) => evt.jets, "more jets"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(pEvent, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.CodeBody.CodeItUp().Where(l => l.Contains("(*(*this).myvectorofint).size()")).Any(), "no line contains the proper size call!"); }
public void TestPlotFromTemplateForTranslated() { // Create the plot var p = PlottingUtils.MakePlotterSpec <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(10, 0.0, 10.0, evt => evt.jets.Select(j => j.myvectorofint).First(), "dude", "fork"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(p, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.CodeBody.CodeItUp().Concat(DummyQueryExectuor.FinalResult.QMFunctions.SelectMany(qmf => qmf.StatementBlock.CodeItUp())).Where(l => l.Contains("(*(*this).myvectorofint).size()")).Any(), "no line contains the proper size call!"); }
public void TestPlotFromTemplateWithWeight() { // Create the plot var p = PlottingUtils.MakePlotterSpec<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupe>(10, 0.0, 10.0, evt => evt.run, "dude", "fork", weight: evt => 0.5); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupe>(); var r = q.Plot(p, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.CodeBody.CodeItUp().Where(l => l.Contains("Fill(((double)(*this).run),0.5*1.0)")).Any(), "no line contains the proper size call!"); }
public void TestPlotFromTemplateFromTypeConvertAndWeight() { // Create the plot. var pRaw1 = PlottingUtils.MakePlotterSpec <double>(10, 0.0, 10.0, v => v, "dude", "fork"); var pRaw = pRaw1.FromType((TTreeQueryExecutorTest.TestNtupeArrJets j) => j.myvectorofint, weight: j => 0.5); var pEvent = pRaw.FromManyOfType((LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents evt) => evt.jets, "more jets"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy <LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(pEvent, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.CodeBody.CodeItUp().Where(l => l.Contains("0.5")).Any(), "no line contains the proper size call!"); }
public void TestCachingOfSimpleHistoWithNameTitleChange() { /// Do two identical queries. Make sure only one causes an actual run! var rootFile = TestUtils.CreateFileOfInt(5); /// /// Generate a proxy .h file that we can use /// var proxyFile = TestUtils.GenerateROOTProxy(rootFile, "dude"); /// /// Ok, now we can actually see if we can make it "go". /// ntuple._gProxyFile = proxyFile.FullName; var exe = new TTreeQueryExecutor(new[] { rootFile }, "dude", typeof(ntuple), typeof(TestNtupe)); Assert.AreEqual(0, exe.CountExecutionRuns, "exe runs initialization"); Assert.AreEqual(0, exe.CountCacheHits, "cache hits initialization"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy<TestNtupe>(); var dude = q.Plot("hi", "there", 10, 0.0, 20.0, d => d.run); var query = DummyQueryExectuor.LastQueryModel; DummyQueryExectuor.FinalResult.DumpCodeToConsole(); var result = exe.ExecuteScalar<ROOTNET.Interface.NTH1>(query); Assert.AreEqual(1, exe.CountExecutionRuns, "after exe run"); Assert.AreEqual(0, exe.CountCacheHits, "after exe run"); /// /// Re-run a slightly different query. Should still be cached. /// var dude2 = q.Plot("there", "high", 10, 0.0, 20.0, d => d.run); var query2 = DummyQueryExectuor.LastQueryModel; var result2 = exe.ExecuteScalar<ROOTNET.Interface.NTH1>(query2); Assert.AreEqual(1, exe.CountExecutionRuns, "after exe and cache run"); Assert.AreEqual(1, exe.CountCacheHits, "after exe and cache run"); }
public void TestFromTemplateWithStraightSequenceDefinition() { // Create the plot var p = PlottingUtils.MakePlotterSpec<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(10, 0.0, 10.0, evt => evt.jets.Select(j => (double)j.myvectorofint), "dude", "fork"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(p, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.DumpCode().Where(l => l.Contains("(*(*this).myvectorofint).size()")).Any(), "no line contains the proper size call!"); }
public void TestPlotFromTemplateFromTypeNothing() { // Create the plot. var pRaw1 = PlottingUtils.MakePlotterSpec<double>(10, 0.0, 10.0, v => v, "dude", "fork"); var pRaw2 = pRaw1.FromType(); var pRaw = pRaw2.FromType((TTreeQueryExecutorTest.TestNtupeArrJets j) => j.myvectorofint); var pEvent = pRaw.FromManyOfType((LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents evt) => evt.jets, "more jets"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(pEvent, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.CodeBody.CodeItUp().All(l => !l.Contains("0.5")), "no line contains the proper size call!"); }
public void TestPlotFromTemplateNullNameAndDescrip() { // Create the plot. var pRaw = PlottingUtils.MakePlotterSpec<TTreeQueryExecutorTest.TestNtupeArrJets>(10, 0.0, 10.0, v => v.myvectorofint); var pEvent = pRaw.FromManyOfType((LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents evt) => evt.jets, "more jets"); /// /// Get a simple query we can "play" with /// var q = new QueriableDummy<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(pEvent, "fork"); DummyQueryExectuor.FinalResult.DumpCodeToConsole(); Assert.IsTrue(DummyQueryExectuor.FinalResult.CodeBody.CodeItUp().Where(l => l.Contains("(*(*this).myvectorofint).size()")).Any(), "no line contains the proper size call!"); }
public void DealwithTwoEmptySubsAndKeepSpacesCorrectly() { // Create the plot var p = PlottingUtils.MakePlotterSpec<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(10, 0.0, 10.0, evt => evt.jets.Select(j => j.myvectorofint).First(), "dude{0}{1}abides", "fork {0}{1} this over"); // Create the query. We aren't very intersted in the result, but rather the result. var q = new QueriableDummy<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(p, "", "hi"); var resultVar = DummyQueryExectuor.FinalResult.ResultValue as DeclarableParameter; var rootObj = resultVar.InitialValue as ROOTObjectStaticHolder; Assert.AreEqual("dudehiabides", rootObj.OriginalName); Assert.AreEqual("fork hi this over", rootObj.OriginalTitle); }
public void RemoveSpacesFromNames() { // Create the plot var p = PlottingUtils.MakePlotterSpec<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(10, 0.0, 10.0, evt => evt.jets.Select(j => j.myvectorofint).First(), "dude{0}", "fork {0}"); // Create the query. We aren't very intersted in the result, but rather the result. var q = new QueriableDummy<LINQToTTreeLib.TTreeQueryExecutorTest.TestNtupeArrEvents>(); var r = q.Plot(p, " is hell"); var resultVar = DummyQueryExectuor.FinalResult.ResultValue as DeclarableParameter; var rootObj = resultVar.InitialValue as ROOTObjectStaticHolder; Assert.AreEqual("dudeishell", rootObj.OriginalName); Assert.AreEqual("fork is hell", rootObj.OriginalTitle); }