LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  March 2016

HPS-SVN March 2016

Subject:

r4309 - /java/trunk/users/src/main/java/org/hps/users/meeg/SVTPhaseOffsetReader.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Sat, 19 Mar 2016 01:37:42 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (124 lines)

Author: [log in to unmask]
Date: Fri Mar 18 18:37:41 2016
New Revision: 4309

Log:
max events flag, etc.

Modified:
    java/trunk/users/src/main/java/org/hps/users/meeg/SVTPhaseOffsetReader.java

Modified: java/trunk/users/src/main/java/org/hps/users/meeg/SVTPhaseOffsetReader.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/meeg/SVTPhaseOffsetReader.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/meeg/SVTPhaseOffsetReader.java	Fri Mar 18 18:37:41 2016
@@ -30,6 +30,7 @@
         Options options = new Options();
         options.addOption(new Option("d", false, "debug"));
         options.addOption(new Option("o", true, "output ROOT file name"));
+        options.addOption(new Option("n", true, "max events"));
 
         // Parse the command line options.
         if (args.length == 0) {
@@ -48,14 +49,19 @@
         }
 
         AIDA aida = AIDA.defaultInstance();
-        IHistogram2D ratioVsPhase = aida.histogram2D("ratio vs phase", 200, -1.0, 2.0, 6, 0.0, 24.0);
+        IHistogram2D ratioVsPhase = aida.histogram2D("ratio vs phase", 100, -1.0, 2.0, 6, 0.0, 24.0);
         IHistogram1D[] ratios = new IHistogram1D[6];
+        IHistogram2D hitsVsPhase = aida.histogram2D("hits vs phase", 300, 0.0, 300.0, 35, 0.0, 840.0);
         for (int i = 0; i < 6; i++) {
-            ratios[i] = aida.histogram1D("ratio, phase " + i, 200, -1.0, 2.0);
+            ratios[i] = aida.histogram1D("ratio, phase " + i, 100, -1.0, 2.0);
         }
 
         boolean debug = cl.hasOption("d");
         boolean seqRead = true;
+        int maxEvents = -1;
+        if (cl.hasOption("n")) {
+            maxEvents = Integer.parseInt(cl.getOptionValue("n"));
+        }
 
         IntBankDefinition tiBankDefinition = new IntBankDefinition(TIData.class, new int[]{0x2e, 0xe10a});
 
@@ -68,7 +74,6 @@
         try {
             org.jlab.coda.jevio.EvioReader reader = new org.jlab.coda.jevio.EvioReader(evioFile, true, seqRead);
             int eventN = 1;
-            fileLoop:
             while (true) {
                 if (debug) {
                     System.out.println("Reading event " + eventN);
@@ -76,10 +81,11 @@
                 try {
                     EvioEvent event = reader.nextEvent();
                     if (event == null) {
-                        break fileLoop;
+                        break;
                     }
                     reader.parseEvent(event);
                     //printBytes(event.getRawBytes()); // DEBUG
+                    int nHits = 0;
                     if (EvioEventUtilities.isPhysicsEvent(event)) {
                         BaseStructure tiBank = tiBankDefinition.findBank(event);
                         TIData tiData = null;
@@ -97,6 +103,7 @@
                                 if (SvtEvioUtils.isMultisampleHeader(multisample) || SvtEvioUtils.isMultisampleTail(multisample)) {
                                     continue;
                                 }
+                                nHits++;
                                 short[] samples = SvtEvioUtils.getSamples(multisample);
 //                                    System.out.format("%d %d %d %d %d %d\n", samples[0], samples[1], samples[2], samples[3], samples[4], samples[5]);
 
@@ -107,18 +114,25 @@
                                 }
                             }
                         }
+                        if (tiData != null) {
+                            hitsVsPhase.fill(nHits, tiData.getTime() % 840);
+
+                        }
                     }
                 } catch (Exception e) {
                     System.out.println("Caught Exception processing event " + eventN + " which was...");
                     e.printStackTrace();
                 }
                 ++eventN;
+                if (maxEvents > 0 && eventN > maxEvents) {
+                    break;
+                }
                 if (debug) {
                     System.out.println("-------");
                 }
             }
             double[] peaks = new double[6];
-            double minPeak = Double.MIN_VALUE;
+            double minPeak = Double.MAX_VALUE;
             int minPhase = -1;
             for (int i = 0; i < 6; i++) {
                 peaks[i] = -1;
@@ -136,14 +150,18 @@
                 }
             }
             boolean isGood = true;
-            System.out.format("phase %d: peak at %f\n", (minPhase) % 6, peaks[(minPhase) % 6]);
+            for (int i = 0; i < 6; i++) {
+                System.out.format("phase %d: mean %f, peak at %f\n", (minPhase + i) % 6, ratios[(minPhase + i) % 6].mean(), peaks[(minPhase + i) % 6]);
+            }
             for (int i = 0; i < 5; i++) {
-                System.out.format("phase %d: peak at %f\n", (minPhase + i + 1) % 6, peaks[(minPhase + i + 1) % 6]);
-                if (peaks[(minPhase + i) % 6] > peaks[(minPhase + i + 1) % 6]) {
+                if (peaks[(minPhase + i + 1) % 6] - peaks[(minPhase + i) % 6] < 0.1) { //should be strictly increasing
+                    isGood = false;
+                }
+                if (ratios[(minPhase + i + 1) % 6].mean() < ratios[(minPhase + i) % 6].mean()) { //should be strictly increasing
                     isGood = false;
                 }
             }
-            System.out.format("offset phase %d, isGood = %b,\n", minPhase, isGood);
+            System.out.format("offset phase %d, isGood = %b\n", minPhase, isGood);
             reader.close();
         } catch (Exception e) {
             e.printStackTrace();

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use