Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

CheckRaw.java

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 bin4949;
00020     public int exitCode = 0;
00021     RawScanResult r;
00022     
00023     public static void main(String[] args) {
00024         CheckRaw cr = new CheckRaw();
00025         cr.runNumber = 1000;
00026         cr.scanNumber = 100;
00027         cr.moduleName = "TestSubmit";
00028         cr.groupID = 4;
00029         cr.chip5CalFactor = 5.3f;
00030         cr.chip4Target = 20;
00031         cr.chip11Threshold = 123;
00032         cr.chip0Chan0Trim = 15;
00033         cr.nPoints = 64;
00034         cr.point0 = 13.5;
00035         cr.bin00 = 1000;
00036         cr.bin4949 = 2000;
00037         
00038         try {
00039             cr.compare("EventData.SctData::RawScanResult.1000.100.TestSubmit");
00040         } catch (Exception e) {
00041             e.printStackTrace();
00042             System.exit(2);
00043         }
00044         
00045         if (args.length > 0) cr.plot();
00046         else System.exit(cr.exitCode);
00047     }
00048   
00049     
00050     public void compare(String name) throws java.io.IOException{
00051         Serializable s = ObjectManagerIS.getInstance().readObject(name);
00052         System.out.println(s.getClassName());
00053         r = (RawScanResult)s;
00054         
00055         if (r.getHeader().getRunNumber() != runNumber) {
00056             System.err.println("RunNumber not equal. Got: " + r.getHeader().getRunNumber() + " expected: " + runNumber);
00057             ++exitCode;
00058         }
00059         
00060         if (r.getHeader().getScanNumber() != scanNumber) {
00061             System.err.println("ScanNumber not equal. Got: " + r.getHeader().getScanNumber() + " expected: " + scanNumber);
00062             ++exitCode;
00063         }
00064 
00065         if (!r.getHeader().getModuleName().equals(moduleName)) {
00066             System.err.println("ModuleName not equal. Got: " + r.getHeader().getModuleName() + " expected: " + moduleName);
00067             ++exitCode;
00068         }
00069 
00070         if (r.getConfiguration().getGroupId() != groupID) {
00071             System.err.println("GroupId not equal. Got: " + r.getConfiguration().getGroupId() + " expected: " + groupID);
00072             ++exitCode;    
00073         }
00074         if (r.getConfiguration().getChipConfiguration(5).getCalFactor() != chip5CalFactor) {
00075             System.err.println("chip5CalFactor not equal. Got: " + r.getConfiguration().getChipConfiguration(5).getCalFactor() + " expected: " + chip5CalFactor);
00076             ++exitCode;    
00077         }
00078         if (r.getConfiguration().getChipConfiguration(4).getTrimTarget() != chip4Target) {
00079             System.err.println("chip4Target not equal. Got: " + r.getConfiguration().getChipConfiguration(4).getTrimTarget() + " expected: " + chip4Target);
00080             ++exitCode;    
00081         }
00082         if (r.getConfiguration().getChipConfiguration(11).getThreshold() != chip11Threshold) {
00083             System.err.println("chip11Threshold not equal. Got: " + r.getConfiguration().getChipConfiguration(11).getThreshold() + " expected: " + chip11Threshold);
00084             ++exitCode;    
00085         }       
00086         if (r.getConfiguration().getChipConfiguration(0).getTrim(0) != chip0Chan0Trim) {
00087             System.err.println("chip0Chan0Trim not equal. Got: " + r.getConfiguration().getChipConfiguration(0).getTrim(0) + " expected: " + chip0Chan0Trim);
00088             ++exitCode;    
00089         }
00090         
00091         if (r.getPoints().getNPoints() != nPoints) {
00092             System.err.println("nPoints not equal. Got: " + r.getPoints().getNPoints() + " expected: " + nPoints);
00093             ++exitCode;        
00094         }
00095         if (r.getPoints().getPoint(0) != point0) {
00096             System.err.println("point0 not equal. Got: " + r.getPoints().getPoint(0) + " expected: " + point0);
00097             ++exitCode;        
00098         }
00099         
00100         if (r.getData().binHeight(0, 0) != bin00) {
00101             System.err.println("bin00 not equal. Got: " + r.getData().binHeight(0, 0) + " expected: " + bin00);
00102             ++exitCode; 
00103         }
00104         if (r.getData().binHeight(768+49, 49) != bin4949) {
00105             System.err.println("bin4949 not equal. Got: " + r.getData().binHeight(768+49, 49) + " expected: " + bin4949);
00106             ++exitCode; 
00107         }
00108     }
00109     
00110     public void plot() {
00111         IAnalysisFactory af = IAnalysisFactory.create();
00112         ITree tree = af.createTreeFactory().create();            
00113 
00114         // Create an IPlotter 
00115         IPlotter iplotter = af.createPlotterFactory().create();  
00116         iplotter.show();
00117         iplotter.createRegion().plot(r.getData());
00118     }
00119 }
00120 

Generated on Thu Jul 15 09:55:40 2004 for SCT DAQ/DCS Software - Java by doxygen 1.3.5