00001 import Sct.IS.*;
00002 import Sct.*;
00003 import SctData.*;
00004 import hep.aida.*;
00005 import hep.aida.ref.histogram.*;
00006
00007 public class CheckRaw {
00008 public int runNumber;
00009 public int scanNumber;
00010 public String moduleName;
00011 public byte groupID;
00012 public float chip5CalFactor;
00013 public byte chip4Target;
00014 public byte chip11Threshold;
00015 public byte chip0Chan0Trim;
00016 public int nPoints;
00017 public double point0;
00018 public double bin00;
00019 public double bin4930;
00020 public int exitCode = 0;
00021 RawScanResult r;
00022
00023 public void compare(String name) throws java.io.IOException{
00024 Serializable s = ObjectManagerIS.getInstance().readObject(name);
00025 System.out.println(name + " " + s.getClassName());
00026 r = (RawScanResult)s;
00027
00028 if (r.getHeader().getRunNumber() != runNumber) {
00029 System.err.println("RunNumber not equal. Got: " + r.getHeader().getRunNumber() + " expected: " + runNumber);
00030 ++exitCode;
00031 }
00032
00033 if (r.getHeader().getScanNumber() != scanNumber) {
00034 System.err.println("ScanNumber not equal. Got: " + r.getHeader().getScanNumber() + " expected: " + scanNumber);
00035 ++exitCode;
00036 }
00037
00038 if (!r.getHeader().getModuleName().equals(moduleName)) {
00039 System.err.println("ModuleName not equal. Got: " + r.getHeader().getModuleName() + " expected: " + moduleName);
00040 ++exitCode;
00041 }
00042
00043 if (r.getConfiguration().getGroupId() != groupID) {
00044 System.err.println("GroupId not equal. Got: " + r.getConfiguration().getGroupId() + " expected: " + groupID);
00045 ++exitCode;
00046 }
00047 if (r.getConfiguration().getChipConfiguration(5).getCalFactor() != chip5CalFactor) {
00048 System.err.println("chip5CalFactor not equal. Got: " + r.getConfiguration().getChipConfiguration(5).getCalFactor() + " expected: " + chip5CalFactor);
00049 ++exitCode;
00050 }
00051 if (r.getConfiguration().getChipConfiguration(4).getTrimTarget() != chip4Target) {
00052 System.err.println("chip4Target not equal. Got: " + r.getConfiguration().getChipConfiguration(4).getTrimTarget() + " expected: " + chip4Target);
00053 ++exitCode;
00054 }
00055 if (r.getConfiguration().getChipConfiguration(11).getThreshold() != chip11Threshold) {
00056 System.err.println("chip11Threshold not equal. Got: " + r.getConfiguration().getChipConfiguration(11).getThreshold() + " expected: " + chip11Threshold);
00057 ++exitCode;
00058 }
00059 if (r.getConfiguration().getChipConfiguration(0).getTrim(0) != chip0Chan0Trim) {
00060 System.err.println("chip0Chan0Trim not equal. Got: " + r.getConfiguration().getChipConfiguration(0).getTrim(0) + " expected: " + chip0Chan0Trim);
00061 ++exitCode;
00062 }
00063
00064 if (r.getPoints().getNPoints() != nPoints) {
00065 System.err.println("nPoints not equal. Got: " + r.getPoints().getNPoints() + " expected: " + nPoints);
00066 ++exitCode;
00067 }
00068 if (r.getPoints().getPoint(0) != point0) {
00069 System.err.println("point0 not equal. Got: " + r.getPoints().getPoint(0) + " expected: " + point0);
00070 ++exitCode;
00071 }
00072
00073 if (r.getData().binHeight(0, 0) != bin00) {
00074 System.err.println("bin00 not equal. Got: " + r.getData().binHeight(0, 0) + " expected: " + bin00);
00075 ++exitCode;
00076 }
00077 if (r.getData().binHeight(768+49, 30) != bin4930) {
00078 System.err.println("bin4930 not equal. Got: " + r.getData().binHeight(768+49, 30) + " expected: " + bin4930);
00079 ++exitCode;
00080 }
00081 }
00082
00083 public void plot() {
00084 IAnalysisFactory af = IAnalysisFactory.create();
00085 ITree tree = af.createTreeFactory().create();
00086
00087
00088 IPlotter iplotter = af.createPlotterFactory().create();
00089 iplotter.show();
00090 iplotter.createRegion().plot(r.getData());
00091 }
00092
00093 public static void main(String[] args) {
00094 CheckRaw cr = new CheckRaw();
00095 try {
00096 cr.runNumber = 1047;
00097 cr.scanNumber = 6;
00098 cr.moduleName = "20220330200015";
00099 cr.groupID = 0;
00100 cr.chip5CalFactor = 1.0f;
00101 cr.chip4Target = 38;
00102 cr.chip11Threshold = 38;
00103 cr.chip0Chan0Trim = 2;
00104 cr.nPoints = 57;
00105 cr.point0 = 60;
00106 cr.bin00 = 1000;
00107 cr.bin4930 = 209;
00108 cr.compare("EventData.SctData::RawScanResult.1047.6.20220330200015");
00109
00110 cr.runNumber = 1048;
00111 cr.scanNumber = 16;
00112 cr.moduleName = "20220330200015";
00113 cr.groupID = 0;
00114 cr.chip5CalFactor = 1.0f;
00115 cr.chip4Target = 38;
00116 cr.chip11Threshold = 38;
00117 cr.chip0Chan0Trim = 2;
00118 cr.nPoints = 57;
00119 cr.point0 = 60;
00120 cr.bin00 = 1000;
00121 cr.bin4930 = 209;
00122 cr.compare("EventData.SctData::RawScanResult.1048.16.20220330200015");
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182 } catch (Exception e) {
00183 e.printStackTrace();
00184 System.exit(2);
00185 }
00186
00187 if (args.length > 0) cr.plot();
00188 else System.exit(cr.exitCode);
00189 }
00190
00191 }
00192