Skip to content

Commit 17bd1a7

Browse files
Merge pull request JeffersonLab#599 from JeffersonLab/development
Go to master for new production release
2 parents e95ff38 + 60e341c commit 17bd1a7

85 files changed

Lines changed: 2013 additions & 1319 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build-coatjava.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ mkdir -p coatjava/lib/services
7373
### clean up any cache copies ###
7474
rm -rf ~/.m2/repository/org/hep/hipo
7575
rm -rf ~/.m2/repository/org/jlab
76+
cd common-tools/coat-lib; $mvn clean; cd -
7677

7778
unset CLAS12DIR
7879
if [ $runUnitTests == "yes" ]; then

common-tools/clas-analysis/pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.jlab.clas</groupId>
55
<artifactId>clas-analysis</artifactId>
6-
<version>6.5.9-SNAPSHOT</version>
6+
<version>6.5.11-SNAPSHOT</version>
77
<packaging>jar</packaging>
88

99
<parent>
1010
<groupId>org.jlab.clas</groupId>
1111
<artifactId>clas12rec</artifactId>
1212
<relativePath>../../parent/pom.xml</relativePath>
13-
<version>6.5.9-SNAPSHOT</version>
13+
<version>6.5.11-SNAPSHOT</version>
1414
</parent>
1515

1616
<build>
@@ -30,31 +30,31 @@
3030
<dependency>
3131
<groupId>org.jlab.clas</groupId>
3232
<artifactId>clas-utils</artifactId>
33-
<version>6.5.9-SNAPSHOT</version>
33+
<version>6.5.11-SNAPSHOT</version>
3434
</dependency>
3535

3636
<dependency>
3737
<groupId>org.jlab.clas</groupId>
3838
<artifactId>clas-physics</artifactId>
39-
<version>6.5.9-SNAPSHOT</version>
39+
<version>6.5.11-SNAPSHOT</version>
4040
</dependency>
4141

4242
<dependency>
4343
<groupId>org.jlab.clas</groupId>
4444
<artifactId>clas-io</artifactId>
45-
<version>6.5.9-SNAPSHOT</version>
45+
<version>6.5.11-SNAPSHOT</version>
4646
</dependency>
4747

4848
<dependency>
4949
<groupId>org.jlab.clas</groupId>
5050
<artifactId>clas-geometry</artifactId>
51-
<version>6.5.9-SNAPSHOT</version>
51+
<version>6.5.11-SNAPSHOT</version>
5252
</dependency>
5353

5454
<dependency>
5555
<groupId>org.jlab.clas</groupId>
5656
<artifactId>clas-detector</artifactId>
57-
<version>6.5.9-SNAPSHOT</version>
57+
<version>6.5.11-SNAPSHOT</version>
5858
</dependency>
5959

6060
<dependency>

common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/FilterFcup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.jlab.analysis.eventmerger;
22
import java.util.LinkedHashMap;
33
import java.util.Map;
4-
import org.jlab.detector.decode.DaqScalersSequence;
4+
import org.jlab.detector.scalers.DaqScalersSequence;
55
import org.jlab.jnp.hipo4.data.*;
66
import org.jlab.jnp.hipo4.io.HipoReader;
77
import org.jlab.jnp.utils.data.TextHistogram;

common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/FilterTrigger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.jlab.analysis.eventmerger;
2-
import org.jlab.detector.decode.DaqScalersSequence;
2+
import org.jlab.detector.scalers.DaqScalersSequence;
33
import org.jlab.jnp.hipo4.data.*;
44
import org.jlab.jnp.hipo4.io.HipoReader;
55
import org.jlab.jnp.utils.data.*;

common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/RandomTriggerFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.jlab.analysis.eventmerger;
22
import java.util.List;
3-
import org.jlab.detector.decode.DaqScalersSequence;
3+
import org.jlab.detector.scalers.DaqScalersSequence;
44
import org.jlab.jnp.hipo4.data.*;
55
import org.jlab.jnp.hipo4.io.HipoReader;
66
import org.jlab.jnp.hipo4.io.HipoWriterSorted;

common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/RebuildScalers.java

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import java.util.List;
77
import org.jlab.detector.calib.utils.ConstantsManager;
88
import org.jlab.detector.calib.utils.RCDBConstants;
9-
import org.jlab.detector.decode.DaqScalers;
9+
import org.jlab.detector.scalers.DaqScalers;
10+
import org.jlab.detector.helicity.HelicitySequenceManager;
1011
import org.jlab.jnp.hipo4.data.Bank;
1112
import org.jlab.jnp.hipo4.data.Event;
1213
import org.jlab.jnp.hipo4.io.HipoReader;
@@ -23,6 +24,7 @@
2324
public class RebuildScalers {
2425

2526
static final String CCDB_FCUP_TABLE="/runcontrol/fcup";
27+
static final String CCDB_SLM_TABLE="/runcontrol/slm";
2628

2729
public static void main(String[] args) {
2830

@@ -36,6 +38,8 @@ public static void main(String[] args) {
3638
System.exit(1);
3739
}
3840

41+
HelicitySequenceManager helSeq = new HelicitySequenceManager(8,inputList);
42+
3943
HipoWriterSorted writer = new HipoWriterSorted();
4044
writer.getSchemaFactory().initFromDirectory(ClasUtilsFile.getResourceDir("COATJAVA", "etc/bankdefs/hipo4"));
4145
writer.setCompressionType(1);
@@ -44,54 +48,64 @@ public static void main(String[] args) {
4448
Event event = new Event();
4549
Bank rawScalerBank = new Bank(writer.getSchemaFactory().getSchema("RAW::scaler"));
4650
Bank runScalerBank = new Bank(writer.getSchemaFactory().getSchema("RUN::scaler"));
51+
Bank helScalerBank = new Bank(writer.getSchemaFactory().getSchema("HEL::scaler"));
4752
Bank runConfigBank = new Bank(writer.getSchemaFactory().getSchema("RUN::config"));
4853

4954
ConstantsManager conman = new ConstantsManager();
50-
conman.init(Arrays.asList(new String[]{CCDB_FCUP_TABLE}));
55+
conman.init(Arrays.asList(new String[]{CCDB_FCUP_TABLE,CCDB_SLM_TABLE}));
5156

5257
for (String filename : inputList) {
5358

5459
HipoReader reader = new HipoReader();
5560
reader.open(filename);
5661

5762
RCDBConstants rcdb = null;
58-
IndexedTable ccdb = null;
63+
IndexedTable ccdb_fcup = null;
64+
IndexedTable ccdb_slm = null;
5965

6066
while (reader.hasNext()) {
6167

6268
// read the event and necessary banks:
6369
reader.nextEvent(event);
6470
event.read(runConfigBank);
6571
event.read(runScalerBank);
72+
event.read(helScalerBank);
6673
event.read(rawScalerBank);
6774

6875
// this is the bank we're here to rebuild:
6976
event.remove(runScalerBank.getSchema());
77+
event.remove(helScalerBank.getSchema());
7078

7179
// get CCDB/RCDB constants:
7280
if (runConfigBank.getInt("run",0) >= 100) {
73-
ccdb = conman.getConstants(runConfigBank.getInt("run",0),CCDB_FCUP_TABLE);
81+
ccdb_fcup = conman.getConstants(runConfigBank.getInt("run",0),CCDB_FCUP_TABLE);
82+
ccdb_slm = conman.getConstants(runConfigBank.getInt("run",0),CCDB_SLM_TABLE);
7483
rcdb = conman.getRcdbConstants(runConfigBank.getInt("run",0));
7584
}
7685

7786
// now rebuild the RUN::scaler bank:
78-
if (rcdb!=null && ccdb !=null && rawScalerBank.getRows()>0) {
87+
if (rcdb!=null && ccdb_fcup !=null && rawScalerBank.getRows()>0) {
7988

80-
// Run duration in seconds. Nasty but works, until RCDB (uses java.sql.Time)
81-
// is changed to support full date and not just HH:MM:SS. Meanwhile just
82-
// requires that runs last less than 24 hours.
83-
Date uet = new Date(runConfigBank.getInt("unixtime",0)*1000L);
89+
// Inputs for calculation run duration in seconds, since for
90+
// some run periods the DSC2 clock rolls over during a run.
8491
Time rst = rcdb.getTime("run_start_time");
85-
final double s1 = rst.getSeconds()+60*rst.getMinutes()+60*60*rst.getHours();
86-
final double s2 = uet.getSeconds()+60*uet.getMinutes()+60*60*uet.getHours();
87-
final double seconds = s2<s1 ? s2+60*60*24-s1 : s2-s1;
88-
89-
// modify RUN::scaler and put it back in the event:
90-
DaqScalers ds = DaqScalers.create(rawScalerBank, ccdb, seconds);
91-
runScalerBank.putFloat("fcupgated",0,ds.getBeamChargeGated());
92-
runScalerBank.putFloat("fcup",0,ds.getBeamCharge());
93-
runScalerBank.putFloat("livetime",0,ds.getLivetime());
92+
Date uet = new Date(runConfigBank.getInt("unixtime",0)*1000L);
93+
94+
DaqScalers ds = DaqScalers.create(rawScalerBank, ccdb_fcup, ccdb_slm, rst, uet);
95+
runScalerBank = ds.createRunBank(writer.getSchemaFactory());
96+
helScalerBank = ds.createHelicityBank(writer.getSchemaFactory());
97+
98+
// the scaler banks always are slightly after the helicity changes, so
99+
// assign the previous (delay-corrected) helicity state to this scaler reading:
100+
helScalerBank.putByte("helicity",0,helSeq.search(event,-1).value());
101+
if (helSeq.getHalfWavePlate(event))
102+
helScalerBank.putByte("helicityRaw",0,(byte)(-1*helSeq.search(event,-1).value()));
103+
else
104+
helScalerBank.putByte("helicityRaw",0,helSeq.search(event,-1).value());
105+
106+
// put modified HEL/RUN::scaler back in the event:
94107
event.write(runScalerBank);
108+
event.write(helScalerBank);
95109
}
96110

97111
writer.addEvent(event, event.getEventTag());

common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
import org.jlab.utils.system.ClasUtilsFile;
1313

14-
import org.jlab.detector.decode.DaqScalers;
15-
import org.jlab.detector.decode.DaqScalersSequence;
14+
import org.jlab.detector.scalers.DaqScalers;
15+
import org.jlab.detector.scalers.DaqScalersSequence;
1616

1717
import org.jlab.detector.helicity.HelicityBit;
1818
import org.jlab.detector.helicity.HelicitySequenceManager;
@@ -40,6 +40,7 @@ public static void main(String[] args) {
4040
OptionParser parser = new OptionParser("postprocess");
4141
parser.addOption("-q","0","do beam charge and livetime (0/1=false/true)");
4242
parser.addOption("-d","0","do delayed helicity (0/1=false/true)");
43+
parser.addOption("-f","0","do global offline helicity flip (0/1=false/true)");
4344
parser.addRequired("-o","output.hipo");
4445
parser.parse(args);
4546

@@ -57,13 +58,14 @@ public static void main(String[] args) {
5758
// helicity / beamcharge options:
5859
final boolean doHelicity = parser.getOption("-d").intValue() != 0;
5960
final boolean doBeamCharge = parser.getOption("-q").intValue() != 0;
61+
final boolean doHelicityFlip = parser.getOption("-f").intValue() != 0;
6062
if (!doHelicity && !doBeamCharge) {
6163
parser.printUsage();
6264
System.err.println("\n >>>>> error : at least one of -q/-d must be specified\n");
6365
System.exit(1);
6466
}
6567

66-
HelicitySequenceManager helSeq = new HelicitySequenceManager(8,inputList);
68+
HelicitySequenceManager helSeq = new HelicitySequenceManager(8,inputList,doHelicityFlip);
6769
DaqScalersSequence chargeSeq = DaqScalersSequence.readSequence(inputList);
6870

6971
HipoWriterSorted writer = new HipoWriterSorted();
@@ -75,9 +77,9 @@ public static void main(String[] args) {
7577

7678
// we're going to modify this bank:
7779
Bank recEventBank = new Bank(writer.getSchemaFactory().getSchema("REC::Event"));
78-
79-
// FIXME: we shouldn't need this bank, but just the event:
80-
Bank runConfigBank = new Bank(writer.getSchemaFactory().getSchema("RUN::config"));
80+
81+
// we're going to modify this bank if doHelicityFlip is set:
82+
Bank helFlipBank = new Bank(writer.getSchemaFactory().getSchema("HEL::flip"));
8183

8284
long badCharge = 0;
8385
long goodCharge = 0;
@@ -93,19 +95,26 @@ public static void main(String[] args) {
9395

9496
reader.nextEvent(event);
9597
event.read(recEventBank);
98+
event.read(helFlipBank);
99+
96100
event.remove(recEventBank.getSchema());
97101

98-
// FIXME: we shouldn't need this bank, but just the event:
99-
event.read(runConfigBank);
100-
final long timestamp = runConfigBank.getLong("timestamp", 0);
102+
if (doHelicityFlip && helFlipBank.getRows()>0) {
103+
event.remove(helFlipBank.getSchema());
104+
helFlipBank.setByte("helicity", 0, (byte)-helFlipBank.getByte("helicity",0));
105+
helFlipBank.setByte("helicityRaw", 0, (byte)-helFlipBank.getByte("helicityRaw",0));
106+
event.write(helFlipBank);
107+
}
101108

102109
// do the lookups:
103110
HelicityBit hb = helSeq.search(event);
104-
DaqScalers ds = chargeSeq.get(timestamp);
111+
DaqScalers ds = chargeSeq.get(event);
105112

106-
// write heliicty to REC::Event:
113+
// count helicity good/bad;
107114
if (Math.abs(hb.value())==1) goodHelicity++;
108115
else badHelicity++;
116+
117+
// write heliicty to REC::Event:
109118
if (doHelicity) {
110119
recEventBank.putByte("helicity",0,hb.value());
111120
}
@@ -115,8 +124,8 @@ public static void main(String[] args) {
115124
else {
116125
goodCharge++;
117126
if (doBeamCharge) {
118-
recEventBank.putFloat("beamCharge",0,ds.getBeamChargeGated());
119-
recEventBank.putDouble("liveTime",0,ds.getLivetime());
127+
recEventBank.putFloat("beamCharge",0, (float) ds.dsc2.getBeamChargeGated());
128+
recEventBank.putDouble("liveTime",0,ds.dsc2.getLivetime());
120129
}
121130
}
122131

common-tools/clas-detector/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.jlab.clas</groupId>
55
<artifactId>clas-detector</artifactId>
6-
<version>6.5.9-SNAPSHOT</version>
6+
<version>6.5.11-SNAPSHOT</version>
77
<packaging>jar</packaging>
88

99
<parent>
1010
<groupId>org.jlab.clas</groupId>
1111
<artifactId>clas12rec</artifactId>
1212
<relativePath>../../parent/pom.xml</relativePath>
13-
<version>6.5.9-SNAPSHOT</version>
13+
<version>6.5.11-SNAPSHOT</version>
1414
</parent>
1515

1616
<build>
@@ -30,7 +30,7 @@
3030
<dependency>
3131
<groupId>org.jlab.clas</groupId>
3232
<artifactId>clas-utils</artifactId>
33-
<version>6.5.9-SNAPSHOT</version>
33+
<version>6.5.11-SNAPSHOT</version>
3434
</dependency>
3535

3636
<dependency>
@@ -42,13 +42,13 @@
4242
<dependency>
4343
<groupId>org.jlab.clas</groupId>
4444
<artifactId>clas-io</artifactId>
45-
<version>6.5.9-SNAPSHOT</version>
45+
<version>6.5.11-SNAPSHOT</version>
4646
</dependency>
4747

4848
<dependency>
4949
<groupId>org.jlab.clas</groupId>
5050
<artifactId>clas-geometry</artifactId>
51-
<version>6.5.9-SNAPSHOT</version>
51+
<version>6.5.11-SNAPSHOT</version>
5252
</dependency>
5353

5454
<dependency>

0 commit comments

Comments
 (0)