3131 */
3232public class Processor {
3333
34- static final Logger logger = Logger .getLogger (Util .class .getName ());
35-
3634 public static final String CCDB_TABLES [] = {"/runcontrol/fcup" ,"/runcontrol/slm" ,
3735 "/runcontrol/helicity" ,"/daq/config/scalers/dsc1" ,"/runcontrol/hwp" };
3836 public static final String DEF_PRELOAD_GLOB = "*.{hipo,h5}" ;
@@ -45,32 +43,29 @@ public class Processor {
4543 private DaqScalersSequence chargeSequence = null ;
4644 private HelicitySequenceDelayed helicitySequence = null ;
4745
48- public Processor (File file , boolean restream ) {
49- configure (restream , Arrays .asList (file .getAbsolutePath ()));
46+ public Processor (File file , boolean restream , boolean rebuild ) {
47+ configure (Arrays .asList (file .getAbsolutePath ()), restream , rebuild );
5048 }
5149
52- public Processor (String dir , boolean restream ) {
53- configure (restream , findPreloadFiles (dir ,DEF_PRELOAD_GLOB ));
50+ public Processor (String dir , boolean restream , boolean rebuild ) {
51+ configure (findPreloadFiles (dir ,DEF_PRELOAD_GLOB ), restream , rebuild );
5452 }
5553
56- public Processor (String dir , String glob , boolean restream ) {
57- configure (restream , findPreloadFiles (dir ,glob ));
54+ public Processor (String dir , String glob , boolean restream , boolean rebuild ) {
55+ configure (findPreloadFiles (dir ,glob ), restream , rebuild );
5856 }
5957
60- private void configure (boolean restream , List <String > preloadFiles ) {
61- if (preloadFiles .isEmpty ()) {
62- logger .warning ("<<<< No preload files found, postprocessing disabled." );
63- initialized = false ;
64- } else {
58+ private void configure (List <String > preloadFiles , boolean restream , boolean rebuild ) {
59+ if (!preloadFiles .isEmpty ()) {
6560 HipoReader r = new HipoReader ();
6661 r .open (preloadFiles .get (0 ));
6762 conman = new ConstantsManager ();
6863 conman .init (CCDB_TABLES );
6964 schemaFactory = r .getSchemaFactory ();
7065 helicitySequence = Util .getHelicity (preloadFiles , schemaFactory , restream , conman );
71- chargeSequence = DaqScalersSequence .readSequence (preloadFiles );
66+ if (rebuild ) chargeSequence = DaqScalersSequence .rebuildSequence (1 , conman , preloadFiles );
67+ else chargeSequence = DaqScalersSequence .readSequence (preloadFiles );
7268 r .close ();
73- initialized = true ;
7469 }
7570 }
7671
@@ -223,17 +218,9 @@ private static void replace(Map<String,String> files) {
223218 }
224219 }
225220
226- /**
227- * Replace preload files with rebuilt ones.
228- */
229- private void rebuildAndReplace (List <String > preloadFiles ) {
230- replace (rebuild ("." ,preloadFiles ));
231- }
232-
233221 public static void main (String args []) {
234222 DefaultLogger .debug ();
235- Processor p = new Processor (System .getenv ("HOME" )+"/tmp" ,"r*.hipo" ,false );
236- //p.rebuildAndReplace();
223+ Processor p = new Processor (System .getenv ("HOME" )+"/tmp" ,"r*.hipo" ,false ,false );
237224 }
238225
239226}
0 commit comments