Skip to content

Commit a21a23e

Browse files
committed
update
1 parent 79c713a commit a21a23e

7 files changed

Lines changed: 301 additions & 27 deletions

File tree

common-tools/clara-io/src/main/java/org/jlab/io/clara/Clas12Writer.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import org.jlab.analysis.postprocess.Processor;
99
import org.jlab.clara.std.services.EventWriterException;
1010
import org.jlab.detector.calib.utils.ConstantsManager;
11-
import org.jlab.detector.calib.utils.OccupancyTable.OccupancyProcessor;
1211
import org.jlab.detector.decode.CLASDecoder4;
1312
import org.jlab.detector.helicity.HelicitySequence;
1413
import org.jlab.detector.helicity.HelicitySequenceDelayed;
@@ -44,7 +43,6 @@ public class Clas12Writer extends HipoToHipoWriter {
4443
TreeSet<HelicityState> helicities;
4544
DaqScalersSequence scalers;
4645
SchemaFactory schema;
47-
OccupancyProcessor occupancy;
4846
boolean postprocess;
4947

5048
private void init(JSONObject opts) {
@@ -63,7 +61,6 @@ private void init(JSONObject opts) {
6361
tag1banks = new Bank[TAG1BANKS.length];
6462
for (int i=0; i<tag1banks.length; ++i)
6563
tag1banks[i] = new Bank(schema.getSchema(TAG1BANKS[i]));
66-
occupancy = new OccupancyProcessor(schema, opts.optInt("occupancyPrescale",100));
6764
}
6865

6966
@Override
@@ -90,7 +87,6 @@ protected void writeEvent(Object event) throws EventWriterException {
9087
int evno = runConfig.getInt("event",0);
9188
if (unix > 0 && evno > 0) eventUnix.put(evno, unix);
9289
}
93-
occupancy.process(e);
9490
helicities.add(HelicityState.createFromFadcBank(helicityAdc, runConfig, conman));
9591
Event t = CLASDecoder4.createTaggedEvent(e, runConfig, tag1banks);
9692
if (!t.isEmpty()) writer.addEvent(t, 1);

common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/OccupancyTable.java renamed to common-tools/clas-detector/src/main/java/org/jlab/detector/calib/utils/OccupanceTable.java

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@
1414
*
1515
* @author baltzell
1616
*/
17-
public class OccupancyTable {
17+
public class OccupanceTable {
1818

1919
protected Bank hitBank;
2020
protected Bank occBank;
2121
protected IndexedTable table;
2222
protected String[] valueNames = {"occ/F"};
2323
protected int[] indices = {0,1,2};
2424

25-
public OccupancyTable(SchemaFactory schema, String hits, String occupancy, int... index) {
25+
public OccupanceTable(SchemaFactory schema, String hits, String occupancy, int... index) {
2626
indices = index;
2727
hitBank = schema.getBank(hits);
2828
occBank = schema.getBank(occupancy);
2929
reset();
3030
}
3131

32-
public OccupancyTable(SchemaFactory schema, String hits, String occupancy) {
32+
public OccupanceTable(SchemaFactory schema, String hits, String occupancy) {
3333
hitBank = schema.getBank(hits);
3434
occBank = schema.getBank(occupancy);
3535
reset();
@@ -139,6 +139,14 @@ public void fill(DataBank bank) {
139139
}
140140
}
141141

142+
/**
143+
* Fill occupancy table from the hit bank, unweighted.
144+
* @param event
145+
*/
146+
public void fill(DataEvent event) {
147+
fill(event.getBank(hitBank.getSchema().getName()));
148+
}
149+
142150
/**
143151
* Create an occupancy bank.
144152
* @param events
@@ -181,31 +189,56 @@ public Bank create(long events) {
181189
return b;
182190
}
183191

184-
public static final class OccupancyProcessor {
192+
public static final class OccupanceDriver {
185193
int events=0,prescale;
186-
OccupancyTable[] tables;
187-
public OccupancyProcessor(SchemaFactory schema, int prescale) {
194+
OccupanceTable[] tables;
195+
public OccupanceDriver(SchemaFactory schema, int prescale) {
188196
this.prescale = prescale;
189-
tables = new OccupancyTable[]{
190-
new OccupancyTable(schema,"DC::tot","DC::occ"),
191-
new OccupancyTable(schema,"ECAL::adc","ECAL::adc:occ"),
192-
new OccupancyTable(schema,"ECAL::tdc","ECAL::tdc:occ"),
193-
new OccupancyTable(schema,"FTOF::adc","FTOF::adc:occ"),
194-
new OccupancyTable(schema,"FTOF::tdc","FTOF::tdc:occ"),
197+
tables = new OccupanceTable[]{
198+
new OccupanceTable(schema,"DC::tot","DC::occ"),
199+
new OccupanceTable(schema,"ECAL::adc","ECAL::aocc"),
200+
new OccupanceTable(schema,"ECAL::tdc","ECAL::tocc"),
201+
new OccupanceTable(schema,"FTOF::adc","FTOF::aocc"),
202+
new OccupanceTable(schema,"FTOF::tdc","FTOF::tocc"),
203+
new OccupanceTable(schema,"CTOF::adc","CTOF::aocc"),
204+
new OccupanceTable(schema,"CTOF::tdc","CTOF::tocc"),
205+
new OccupanceTable(schema,"HTCC::adc","HTCC::aocc"),
206+
new OccupanceTable(schema,"HTCC::tdc","HTCC::tocc"),
207+
new OccupanceTable(schema,"LTCC::adc","LTCC::aocc"),
208+
new OccupanceTable(schema,"LTCC::tdc","LTCC::tocc"),
209+
new OccupanceTable(schema,"SVT::adc","SVT::occ"),
210+
new OccupanceTable(schema,"BMT::adc","BMT::occ"),
211+
new OccupanceTable(schema,"FTC::adc","FTC::occ"),
212+
new OccupanceTable(schema,"FTH::adc","FTH::occ"),
213+
new OccupanceTable(schema,"FTT::adc","FTT::occ"),
214+
new OccupanceTable(schema,"RICH::tdc","RICH::occ"),
215+
new OccupanceTable(schema,"BAND::tdc","BAND::occ"),
195216
};
196217
}
197218
public void process(Event event) {
198-
for (OccupancyTable t : tables)
199-
t.fill(event);
219+
for (OccupanceTable t : tables) t.fill(event);
200220
if (events++ % prescale == 0) {
201-
for (OccupancyTable t : tables) {
202-
Bank b = t.create(events);
203-
if (b.getRows() > 0) event.write(b);
221+
for (OccupanceTable t : tables) {
222+
if (t.getRows() > 0) event.write(t.create(events));
204223
t.reset();
205224
}
206225
events = 0;
207226
}
208227
}
228+
public void process(DataEvent event) {
229+
for (OccupanceTable t : tables) t.fill(event);
230+
if (events++ % prescale == 0) {
231+
for (OccupanceTable t : tables) {
232+
if (t.getRows() > 0) event.appendBank(t.create(events, event));
233+
t.reset();
234+
}
235+
events = 0;
236+
}
237+
}
238+
public void reset() {
239+
for (OccupanceTable t : tables) t.reset();
240+
events = 0;
241+
}
209242
}
210243

211244
}

common-tools/clas-reco/src/main/java/org/jlab/clas/reco/EngineProcessor.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void initDefault(){
115115
String[] names = new String[]{
116116
"MAGFIELDS",
117117
"DCCR","DCHB","FTOFHB","EC","HTCC","EBHB",
118-
"DCTB","FTOFTB","EBTB","VTX"
118+
"DCTB","FTOFTB","EBTB","OCC"
119119
};
120120

121121
String[] services = new String[]{
@@ -129,7 +129,7 @@ public void initDefault(){
129129
"org.jlab.service.dc.DCTBEngine",
130130
"org.jlab.service.ftof.FTOFTBEngine",
131131
"org.jlab.service.eb.EBTBEngine",
132-
"org.jlab.rec.service.vtx.VTXEngine"
132+
"org.jlab.calibration.service.OccupanceEngine",
133133
};
134134

135135
for(int i = 0; i < names.length; i++){
@@ -145,7 +145,7 @@ public void initAll(){
145145
"CVTFP","CTOF","CND","BAND",
146146
"HTCC","LTCC","EBHB",
147147
"DCTB","FMT","FTOFTB","CVT","EBTB",
148-
"RICHEB","RTPC","AHDC","ATOF","ALERT", "MC","VTX"
148+
"RICHEB","RTPC","AHDC","ATOF","ALERT", "MC","VTX","OCC"
149149
};
150150

151151
String[] services = new String[]{
@@ -178,7 +178,8 @@ public void initAll(){
178178
"org.jlab.service.atof.ATOFEngine",
179179
"org.jlab.service.alert.ALERTEngine",
180180
"org.jlab.service.mc.TruthMatch",
181-
"org.jlab.rec.service.vtx.VTXEngine"
181+
"org.jlab.rec.service.vtx.VTXEngine",
182+
"org.jlab.calibration.service.OccupanceEngine",
182183
};
183184
if(names.length!=services.length)
184185
LOGGER.log(Level.SEVERE, "initAll : the list of services does not match the list of service names... ");

etc/bankdefs/hipo4/occupancy.json

Lines changed: 206 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,213 @@
11
[
22
{
33
"name": "DC::occ",
4-
"group": 20600,
4+
"group": 500,
5+
"item": 10,
6+
"info": "Occupancy Bank",
7+
"entries": [
8+
{ "name":"sector" , "type":"B", "info":"sector"},
9+
{ "name":"layer" , "type":"B", "info":"layer"},
10+
{ "name":"component" , "type":"S", "info":"component"},
11+
{ "name":"hits" , "type":"F", "info":"number of hits"}
12+
]
13+
},
14+
{
15+
"name": "ECAL::tocc",
16+
"group": 500,
17+
"item": 11,
18+
"info": "Occupancy Bank",
19+
"entries": [
20+
{ "name":"sector" , "type":"B", "info":"sector"},
21+
{ "name":"layer" , "type":"B", "info":"layer"},
22+
{ "name":"component" , "type":"S", "info":"component"},
23+
{ "name":"hits" , "type":"F", "info":"number of hits"}
24+
]
25+
},
26+
{
27+
"name": "ECAL::aocc",
28+
"group": 500,
29+
"item": 12,
30+
"info": "Occupancy Bank",
31+
"entries": [
32+
{ "name":"sector" , "type":"B", "info":"sector"},
33+
{ "name":"layer" , "type":"B", "info":"layer"},
34+
{ "name":"component" , "type":"S", "info":"component"},
35+
{ "name":"hits" , "type":"F", "info":"number of hits"}
36+
]
37+
},
38+
{
39+
"name": "FTOF:tocc",
40+
"group": 500,
41+
"item": 13,
42+
"info": "Occupancy Bank",
43+
"entries": [
44+
{ "name":"sector" , "type":"B", "info":"sector"},
45+
{ "name":"layer" , "type":"B", "info":"layer"},
46+
{ "name":"component" , "type":"S", "info":"component"},
47+
{ "name":"hits" , "type":"F", "info":"number of hits"}
48+
]
49+
},
50+
{
51+
"name": "FTOF::aocc",
52+
"group": 500,
53+
"item": 14,
54+
"info": "Occupancy Bank",
55+
"entries": [
56+
{ "name":"sector" , "type":"B", "info":"sector"},
57+
{ "name":"layer" , "type":"B", "info":"layer"},
58+
{ "name":"component" , "type":"S", "info":"component"},
59+
{ "name":"hits" , "type":"F", "info":"number of hits"}
60+
]
61+
},
62+
{
63+
"name": "CTOF::tocc",
64+
"group": 500,
65+
"item": 15,
66+
"info": "Occupancy Bank",
67+
"entries": [
68+
{ "name":"sector" , "type":"B", "info":"sector"},
69+
{ "name":"layer" , "type":"B", "info":"layer"},
70+
{ "name":"component" , "type":"S", "info":"component"},
71+
{ "name":"hits" , "type":"F", "info":"number of hits"}
72+
]
73+
},
74+
{
75+
"name": "CTOF::aocc",
76+
"group": 500,
77+
"item": 16,
78+
"info": "Occupancy Bank",
79+
"entries": [
80+
{ "name":"sector" , "type":"B", "info":"sector"},
81+
{ "name":"layer" , "type":"B", "info":"layer"},
82+
{ "name":"component" , "type":"S", "info":"component"},
83+
{ "name":"hits" , "type":"F", "info":"number of hits"}
84+
]
85+
},
86+
{
87+
"name": "HTCC::aocc",
88+
"group": 500,
89+
"item": 17,
90+
"info": "Occupancy Bank",
91+
"entries": [
92+
{ "name":"sector" , "type":"B", "info":"sector"},
93+
{ "name":"layer" , "type":"B", "info":"layer"},
94+
{ "name":"component" , "type":"S", "info":"component"},
95+
{ "name":"hits" , "type":"F", "info":"number of hits"}
96+
]
97+
},
98+
{
99+
"name": "HTCC::tocc",
100+
"group": 500,
101+
"item": 18,
102+
"info": "Occupancy Bank",
103+
"entries": [
104+
{ "name":"sector" , "type":"B", "info":"sector"},
105+
{ "name":"layer" , "type":"B", "info":"layer"},
106+
{ "name":"component" , "type":"S", "info":"component"},
107+
{ "name":"hits" , "type":"F", "info":"number of hits"}
108+
]
109+
},
110+
{
111+
"name": "LTCC::aocc",
112+
"group": 500,
113+
"item": 19,
114+
"info": "Occupancy Bank",
115+
"entries": [
116+
{ "name":"sector" , "type":"B", "info":"sector"},
117+
{ "name":"layer" , "type":"B", "info":"layer"},
118+
{ "name":"component" , "type":"S", "info":"component"},
119+
{ "name":"hits" , "type":"F", "info":"number of hits"}
120+
]
121+
},
122+
{
123+
"name": "LTCC::tocc",
124+
"group": 500,
5125
"item": 20,
6-
"info": "Event Header Bank",
126+
"info": "Occupancy Bank",
127+
"entries": [
128+
{ "name":"sector" , "type":"B", "info":"sector"},
129+
{ "name":"layer" , "type":"B", "info":"layer"},
130+
{ "name":"component" , "type":"S", "info":"component"},
131+
{ "name":"hits" , "type":"F", "info":"number of hits"}
132+
]
133+
},
134+
{
135+
"name": "SVT::occ",
136+
"group": 500,
137+
"item": 21,
138+
"info": "Occupancy Bank",
139+
"entries": [
140+
{ "name":"sector" , "type":"B", "info":"sector"},
141+
{ "name":"layer" , "type":"B", "info":"layer"},
142+
{ "name":"component" , "type":"S", "info":"component"},
143+
{ "name":"hits" , "type":"F", "info":"number of hits"}
144+
]
145+
},
146+
{
147+
"name": "BMT::occ",
148+
"group": 500,
149+
"item": 22,
150+
"info": "Occupancy Bank",
151+
"entries": [
152+
{ "name":"sector" , "type":"B", "info":"sector"},
153+
{ "name":"layer" , "type":"B", "info":"layer"},
154+
{ "name":"component" , "type":"S", "info":"component"},
155+
{ "name":"hits" , "type":"F", "info":"number of hits"}
156+
]
157+
},
158+
{
159+
"name": "FTC::occ",
160+
"group": 500,
161+
"item": 23,
162+
"info": "Occupancy Bank",
163+
"entries": [
164+
{ "name":"sector" , "type":"B", "info":"sector"},
165+
{ "name":"layer" , "type":"B", "info":"layer"},
166+
{ "name":"component" , "type":"S", "info":"component"},
167+
{ "name":"hits" , "type":"F", "info":"number of hits"}
168+
]
169+
},
170+
{
171+
"name": "FTH::occ",
172+
"group": 500,
173+
"item": 24,
174+
"info": "Occupancy Bank",
175+
"entries": [
176+
{ "name":"sector" , "type":"B", "info":"sector"},
177+
{ "name":"layer" , "type":"B", "info":"layer"},
178+
{ "name":"component" , "type":"S", "info":"component"},
179+
{ "name":"hits" , "type":"F", "info":"number of hits"}
180+
]
181+
},
182+
{
183+
"name": "FTT::occ",
184+
"group": 500,
185+
"item": 25,
186+
"info": "Occupancy Bank",
187+
"entries": [
188+
{ "name":"sector" , "type":"B", "info":"sector"},
189+
{ "name":"layer" , "type":"B", "info":"layer"},
190+
{ "name":"component" , "type":"S", "info":"component"},
191+
{ "name":"hits" , "type":"F", "info":"number of hits"}
192+
]
193+
},
194+
{
195+
"name": "RICH::occ",
196+
"group": 500,
197+
"item": 26,
198+
"info": "Occupancy Bank",
199+
"entries": [
200+
{ "name":"sector" , "type":"B", "info":"sector"},
201+
{ "name":"layer" , "type":"B", "info":"layer"},
202+
{ "name":"component" , "type":"S", "info":"component"},
203+
{ "name":"hits" , "type":"F", "info":"number of hits"}
204+
]
205+
},
206+
{
207+
"name": "BAND::occ",
208+
"group": 500,
209+
"item": 27,
210+
"info": "Occupancy Bank",
7211
"entries": [
8212
{ "name":"sector" , "type":"B", "info":"sector"},
9213
{ "name":"layer" , "type":"B", "info":"layer"},

0 commit comments

Comments
 (0)