1 | // If you get the message This application has failed to start because MSVCR80.dll was not found. Re-installing the application may fix this problem. |
---|
2 | // when running to run this main.cpp in debug mode then try to uncomment the line below (see also http://blogs.msdn.com/dsvc/archive/2008/08/07/part-2-troubleshooting-vc-side-by-side-problems.aspx for more details) |
---|
3 | //#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' \"") |
---|
4 | |
---|
5 | #include <iostream> |
---|
6 | #include <iomanip> |
---|
7 | #include "Benchmark.h" |
---|
8 | #include "UserAlgorithmTest.h" |
---|
9 | #include "MantidAPI/FrameworkManager.h" |
---|
10 | //#include "MantidAPI/Workspace.h" |
---|
11 | //#include "MantidDataObjects/Workspace1D.h" |
---|
12 | #include "MantidDataObjects/Workspace2D.h" |
---|
13 | |
---|
14 | #include <boost/timer.hpp> |
---|
15 | |
---|
16 | using namespace Mantid::API; |
---|
17 | using namespace Mantid::Kernel; |
---|
18 | using namespace Mantid::Geometry; |
---|
19 | using namespace Mantid::DataObjects; |
---|
20 | |
---|
21 | void test(); |
---|
22 | |
---|
23 | int main() |
---|
24 | { |
---|
25 | |
---|
26 | FrameworkManagerImpl& fm = FrameworkManager::Instance(); |
---|
27 | /* |
---|
28 | // UserAlgorithmTest userTest; |
---|
29 | // userTest.RunAllTests(); |
---|
30 | |
---|
31 | // Benchmark b; |
---|
32 | // b.RunPlusTest(10584,2000); |
---|
33 | //b.RunPlusTest(15584,2000); |
---|
34 | //b.RunPlusTest(2584,2000); |
---|
35 | |
---|
36 | //#if defined _DEBUG |
---|
37 | //NOTE: Any code in here is temporary for debugging purposes only, nothing is safe! |
---|
38 | //load a raw file |
---|
39 | IAlgorithm* loader = fm.createAlgorithm("LoadRaw"); |
---|
40 | loader->setPropertyValue("Filename", "../../../Test/Data/MER02257.raw"); |
---|
41 | |
---|
42 | std::string outputSpace = "outer"; |
---|
43 | loader->setPropertyValue("OutputWorkspace", outputSpace); |
---|
44 | loader->execute(); |
---|
45 | |
---|
46 | Workspace* w = fm.getWorkspace(outputSpace); |
---|
47 | Workspace2D* output2D = dynamic_cast<Workspace2D*>(w); |
---|
48 | const int numberOfSpectra = output2D->getNumberHistograms(); |
---|
49 | clock_t start = clock(); |
---|
50 | int FailCount =0; |
---|
51 | int SuccessCount = 0; |
---|
52 | V3D total; |
---|
53 | for (int j = 0; j <= numberOfSpectra; ++j) |
---|
54 | { |
---|
55 | try{ |
---|
56 | // Now get the detector to which this relates |
---|
57 | IDetector_const_sptr det = output2D->getDetector(j); |
---|
58 | // Solid angle should be zero if detector is masked ('dead') |
---|
59 | V3D v = det->getPos(); |
---|
60 | total += v; |
---|
61 | SuccessCount++; |
---|
62 | } |
---|
63 | catch (...) |
---|
64 | { |
---|
65 | FailCount++; |
---|
66 | } |
---|
67 | } // loop over spectra |
---|
68 | clock_t end = clock(); |
---|
69 | std::cout << double(end - start)/CLOCKS_PER_SEC << std::endl; |
---|
70 | std::cout << "Success " << SuccessCount << " | Failed " << FailCount << std::endl; |
---|
71 | std::cout << total << std::endl; |
---|
72 | //#endif |
---|
73 | */ |
---|
74 | //STEVES looking at a problem with ConvertUnits |
---|
75 | for (int i = 0 ; i < 200 ; ++i) |
---|
76 | { |
---|
77 | fm.exec("LoadRaw","Filename=C:/mantid/Test/Data/MAR11001.RAW;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe"); |
---|
78 | fm.exec("LoadDetectorInfo","Workspace=_Conv_ETrans_tempory_WS_MAR11001.spe;DataFilename=C:/mantid/Test/Data/MAR11001.RAW"); |
---|
79 | fm.exec("MaskDetectors","Workspace=_Conv_ETrans_tempory_WS_MAR11001.spe;SpectraList=1,2,3,4,4124,2526,1126,3626"); |
---|
80 | fm.exec("FlatBackground","InputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;StartX=18000;EndX=19500;Mode=Mean"); |
---|
81 | fm.exec("NormaliseToMonitor","InputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;MonitorSpectrum=1;IntegrationRangeMin=1000;IntegrationRangeMax=2000"); |
---|
82 | fm.exec("ConvertUnits","InputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;Target=DeltaE;EMode=Direct;EFixed=13"); |
---|
83 | fm.exec("Rebin","InputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;Params=1,0.1,13"); |
---|
84 | fm.exec("DetectorEfficiencyCor","InputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;IncidentEnergy=13"); |
---|
85 | fm.exec("GroupDetectors","InputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;MapFile=C:/Users/wht13119/Desktop/docs/Excitations/mari_res.map"); |
---|
86 | fm.exec("LoadRaw","Filename=C:/mantid/Test/Data/MAR11060.RAW;OutputWorkspace=_ETrans_norm_tempory_WS"); |
---|
87 | fm.exec("LoadDetectorInfo","Workspace=_ETrans_norm_tempory_WS;DataFilename=C:/mantid/Test/Data/MAR11060.RAW"); |
---|
88 | fm.exec("ConvertUnits","InputWorkspace=_ETrans_norm_tempory_WS;OutputWorkspace=_ETrans_norm_tempory_WS;Target=Energy"); |
---|
89 | fm.exec("Rebin","InputWorkspace=_ETrans_norm_tempory_WS;OutputWorkspace=_ETrans_norm_tempory_WS;Params=0,20,20"); |
---|
90 | fm.exec("GroupDetectors","InputWorkspace=_ETrans_norm_tempory_WS;OutputWorkspace=_ETrans_norm_tempory_WS;MapFile=C:/Users/wht13119/Desktop/docs/Excitations/mari_res.map"); |
---|
91 | fm.exec("Divide","LHSWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;RHSWorkspace=_ETrans_norm_tempory_WS;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe"); |
---|
92 | fm.exec("ReplaceSpecialValues","InputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;OutputWorkspace=_Conv_ETrans_tempory_WS_MAR11001.spe;NaNValue=0;InfinityValue=0"); |
---|
93 | std::cerr << i << std::endl; |
---|
94 | } |
---|
95 | |
---|
96 | fm.clear(); |
---|
97 | exit(0); |
---|
98 | |
---|
99 | } |
---|
100 | |
---|