Skip to content

Commit a8c63bd

Browse files
committed
plug postprocessing in to recon-util
1 parent 8acf154 commit a8c63bd

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
public class EngineProcessor {
2828

2929
public static final String ENGINE_CLASS_BG = "org.jlab.service.bg.BackgroundEngine";
30+
public static final String ENGINE_CLASS_PP = "org.jlab.service.pp.PostprocEngine";
3031

3132
private final Map<String,ReconstructionEngine> processorEngines = new LinkedHashMap<>();
3233
private static final Logger LOGGER = Logger.getLogger(EngineProcessor.class.getPackage().getName());
@@ -45,7 +46,7 @@ private ReconstructionEngine findEngine(String clazz) {
4546
return null;
4647
}
4748

48-
public void setBackgroundFiles(String filenames) {
49+
private void setBackgroundFiles(String filenames) {
4950
if (findEngine(ENGINE_CLASS_BG) == null) {
5051
LOGGER.info("Adding BackgroundEngine for -B option.");
5152
addEngine("BG",ENGINE_CLASS_BG);
@@ -54,6 +55,15 @@ public void setBackgroundFiles(String filenames) {
5455
findEngine(ENGINE_CLASS_BG).init();
5556
}
5657

58+
private void setPreloadFiles(String filenames) {
59+
if (findEngine(ENGINE_CLASS_PP) == null) {
60+
LOGGER.info("Adding PostprocEngine for -P option.");
61+
addEngine("BG",ENGINE_CLASS_PP);
62+
}
63+
findEngine(ENGINE_CLASS_PP).engineConfigMap.put("preloadFile", filenames);
64+
findEngine(ENGINE_CLASS_PP).init();
65+
}
66+
5767
private void updateDictionary(HipoDataSource source, HipoDataSync sync){
5868
SchemaFactory fsync = sync.getWriter().getSchemaFactory();
5969
SchemaFactory fsrc = source.getReader().getSchemaFactory();
@@ -343,6 +353,7 @@ public static void main(String[] args){
343353
parser.addOption("-d","1","Debug level [0 - OFF, 1 - ON/default]");
344354
parser.addOption("-S",null,"schema directory");
345355
parser.addOption("-B",null,"background file");
356+
parser.addOption("-P",null,"preload file for post-processing");
346357

347358
parser.parse(args);
348359

@@ -401,6 +412,10 @@ else if (config>0){
401412
// command-line filename for background merging overrides YAML:
402413
if (parser.getOption("-B").stringValue() != null)
403414
proc.setBackgroundFiles(parser.getOption("-B").stringValue());
415+
416+
// command-line filename for post-processing overrides YAML:
417+
if (parser.getOption("-P").stringValue() != null)
418+
proc.setPreloadFiles(parser.getOption("-P").stringValue());
404419

405420
proc.processFile(inputFile,outputFile,nskip,nevents);
406421
}

0 commit comments

Comments
 (0)