Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

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

Generated on Thu Jul 15 09:50:44 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5