CheckRaw.cpp

00001 #include "Sct/IS/IOManagerIS.h"
00002 #include "SctData/RawScanResult.h"
00003 #include "SctData/ScanPoints.h"
00004 #include "SctData/ModuleConfiguration.h"
00005 #include <TH2.h>
00006 #include <ipc/core.h>
00007 
00008 using namespace Sct;
00009 using namespace Sct::IS;
00010 using namespace SctData;
00011 using namespace std;
00012 using namespace boost;
00013 
00014 class CheckRaw {
00015 public:
00016     unsigned int runNumber;
00017     unsigned int scanNumber;
00018     string moduleName;
00019     unsigned char groupID;
00020     float chip5CalFactor;
00021     unsigned char chip4Target;
00022     unsigned char chip11Threshold;
00023     unsigned char chip0Chan0Trim;
00024     unsigned int nPoints;
00025     double point0;
00026     double bin00;
00027     double bin4930;
00028     int exitCode;    
00029     
00030     CheckRaw() {
00031     exitCode = 0;
00032     }
00033     
00034     void compare(string name) {
00035     shared_ptr<Serializable> s = IOManagerIS::instance().read(name, 0);
00036     cout << name << ": " << s->getClassName() << endl;
00037     RawScanResult& r = *dynamic_pointer_cast<RawScanResult>(s);
00038     
00039     if (r.getHeader().getRunNumber() != runNumber) {
00040         cout << "RunNumber not equal. Got: " << r.getHeader().getRunNumber() << " expected: " << runNumber << endl;
00041         ++exitCode;
00042     }
00043     
00044     if (r.getHeader().getScanNumber() != scanNumber) {
00045         cout << "ScanNumber not equal. Got: " << r.getHeader().getScanNumber() << " expected: " << scanNumber << endl;
00046         ++exitCode;
00047     }
00048 
00049     if (r.getHeader().getModuleName() != moduleName) {
00050         cout << "ModuleName not equal. Got: " << r.getHeader().getModuleName() << " expected: " << moduleName << endl;
00051         ++exitCode;
00052     }
00053 
00054     if (r.getConfiguration().getGroupId() != groupID) {
00055         cout << "GroupId not equal. Got: " << (int)r.getConfiguration().getGroupId() << " expected: " << (int)groupID << endl;
00056         ++exitCode;    
00057     }
00058     if (r.getConfiguration().getChipConfiguration(5).getCalFactor() != chip5CalFactor) {
00059         cout << "chip5CalFactor not equal. Got: " << r.getConfiguration().getChipConfiguration(5).getCalFactor() << " expected: " << chip5CalFactor << endl;
00060         ++exitCode;    
00061     }
00062     if (r.getConfiguration().getChipConfiguration(4).getTrimTarget() != chip4Target) {
00063         cout << "chip4Target not equal. Got: " << (int)r.getConfiguration().getChipConfiguration(4).getTrimTarget() << " expected: " << (int)chip4Target << endl;
00064         ++exitCode;    
00065     }
00066     if (r.getConfiguration().getChipConfiguration(11).getThreshold() != chip11Threshold) {
00067         cout << "chip11Threshold not equal. Got: " << (int)r.getConfiguration().getChipConfiguration(11).getThreshold() << " expected: " << (int)chip11Threshold << endl;
00068         ++exitCode;    
00069     }   
00070     if (r.getConfiguration().getChipConfiguration(0).getTrim(0) != chip0Chan0Trim) {
00071         cout << "chip0Chan0Trim not equal. Got: " << (int)r.getConfiguration().getChipConfiguration(0).getTrim(0) << " expected: " << (int)chip0Chan0Trim << endl;
00072         ++exitCode;    
00073     }
00074     
00075     if (r.getPoints().getNPoints() != nPoints) {
00076         cout << "nPoints not equal. Got: " << r.getPoints().getNPoints() << " expected: " << nPoints << endl;
00077         ++exitCode;        
00078     }
00079     if (r.getPoints().getPoint(0) != point0) {
00080         cout << "point0 not equal. Got: " << r.getPoints().getPoint(0) << " expected: " << point0 << endl;
00081         ++exitCode;        
00082     }
00083     
00084     if (fabs(r.getScanData(0).GetBinContent(1, 1) - bin00) > 0.1) {
00085         cout << "bin00 not equal. Got: " << r.getScanData(0).GetBinContent(1, 1) << " expected: " << bin00 << endl;
00086         ++exitCode; 
00087     }
00088     if (fabs(r.getScanData(1).GetBinContent(50, 31) - bin4930) > 0.1) {
00089         cout << "bin4930 not equal. Got: " << r.getScanData(1).GetBinContent(50, 31) << " expected: " << bin4930 << endl;
00090         ++exitCode; 
00091     }
00092     cout << endl;
00093     }
00094 };
00095 
00096 int main(int argc, char** argv) {
00097  IPCCore::init(argc, argv);
00098    CheckRaw cr;
00099     try {
00100     cr.runNumber = 1047;
00101     cr.scanNumber = 6;
00102     cr.moduleName = "20220330200015";
00103     cr.groupID = 0;
00104     cr.chip5CalFactor = 1.0f;
00105     cr.chip4Target = 38;
00106     cr.chip11Threshold = 38;
00107     cr.chip0Chan0Trim = 2;  
00108     cr.nPoints = 57;
00109     cr.point0 = 60; 
00110     cr.bin00 = 1000;    
00111     cr.bin4930 = 209;
00112     cr.compare("EventData.SctData::RawScanResult.1047.6.20220330200015");
00113     
00114     cr.runNumber = 1048;
00115     cr.scanNumber = 16;
00116     cr.moduleName = "20220330200015";
00117     cr.groupID = 0;
00118     cr.chip5CalFactor = 1.0f;
00119     cr.chip4Target = 38;
00120     cr.chip11Threshold = 38;
00121     cr.chip0Chan0Trim = 2;  
00122     cr.nPoints = 57;
00123     cr.point0 = 60; 
00124     cr.bin00 = 1000;    
00125     cr.bin4930 = 209;
00126     cr.compare("EventData.SctData::RawScanResult.1048.16.20220330200015");
00127     
00128     /*
00129     cr.runNumber = 1;
00130     cr.scanNumber = 1;
00131     cr.moduleName = "20220170100053";
00132     cr.groupID = 0;
00133     cr.chip5CalFactor = 1.0f;
00134     cr.chip4Target = 0;
00135     cr.chip11Threshold = 40;
00136     cr.chip0Chan0Trim = 7;  
00137     cr.nPoints = 64;
00138     cr.point0 = 0;  
00139     cr.bin00 = 0;   
00140     cr.bin4930 = 200;
00141     cr.compare("EventData.SctData::RawScanResult.1.1.20220170100053");
00142     
00143     
00144     cr.runNumber = 1;
00145     cr.scanNumber = 3;
00146     cr.moduleName = "20220170100053";
00147     cr.groupID = 0;
00148     cr.chip5CalFactor = 1.0f;
00149     cr.chip4Target = 0;
00150     cr.chip11Threshold = 40;
00151     cr.chip0Chan0Trim = 7;  
00152     cr.nPoints = 64;
00153     cr.point0 = 0;  
00154     cr.bin00 = 0;   
00155     cr.bin4930 = 1000;
00156     cr.compare("EventData.SctData::RawScanResult.1.3.20220170100053");
00157     
00158     
00159     cr.runNumber = 1;
00160     cr.scanNumber = 4;
00161     cr.moduleName = "20220170100028";
00162     cr.groupID = 2;
00163     cr.chip5CalFactor = 1.0f;
00164     cr.chip4Target = 0;
00165     cr.chip11Threshold = 40;
00166     cr.chip0Chan0Trim = 4;  
00167     cr.nPoints = 64;
00168     cr.point0 = 0;  
00169     cr.bin00 = 0;   
00170     cr.bin4930 = 995;
00171     cr.compare("EventData.SctData::RawScanResult.1.4.20220170100028");*/
00172     
00173     } catch (Exception& e) {
00174     e.sendToMrs(MRS_ERROR);
00175     return -2;
00176     }   
00177 }

Generated on Mon Feb 6 14:01:17 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6