@@ -38,7 +38,7 @@ public static void main(String[] args) {
3838 OptionParser parser = new OptionParser ("postprocess" );
3939 parser .useExternalLogger (); // necessary, since we have `LOGGER` here
4040 parser .addOption ("-q" ,"0" ,"do beam charge and livetime (0/1=false/true)" );
41- parser .addOption ("-d" ,"0" ,"do delayed helicity (0/1=false/true )" );
41+ parser .addOption ("-d" ,"0" ,"(ignored, old API )" );
4242 parser .addOption ("-f" ,"0" ,"rebuild the HEL::flip banks (0/1=false/true)" );
4343 parser .addRequired ("-o" ,"output.hipo" );
4444 parser .parse (args );
@@ -48,19 +48,23 @@ public static void main(String[] args) {
4848 LOGGER .severe ("No input file(s) specified." );
4949 System .exit (1 );
5050 }
51- final boolean doHelicityDelay = parser .getOption ("-d" ).intValue () != 0 ;
5251 final boolean doBeamCharge = parser .getOption ("-q" ).intValue () != 0 ;
5352 final boolean doRebuildFlips = parser .getOption ("-f" ).intValue () != 0 ;
54- if (!doHelicityDelay && !doBeamCharge && !doRebuildFlips ) {
55- parser .printUsage ();
56- LOGGER .severe ("At least one of -q/-d/-f is required." );
57- System .exit (1 );
58- }
5953
6054 // Initialize event counters:
6155 long badCharge =0 , goodCharge =0 ;
6256 long badHelicity =0 , goodHelicity =0 ;
6357
58+ // Prepare to read from CCDB:
59+ LOGGER .info ("\n >>> Initializing helicity configuration from CCDB ...\n " );
60+ ConstantsManager conman = new ConstantsManager ();
61+ conman .init ("/runcontrol/hwp" ,"/runcontrol/helicity" );
62+ final int run = Util .getRunNumber (parser .getInputList ().get (0 ));
63+
64+ // Determine whether to apply delay correction:
65+ IndexedTable helTable = conman .getConstants (run , "/runcontrol/helicity" );
66+ final boolean doHelicityDelay = helTable .getIntValue ("delay" , 0 ,0 ,0 ) != 0 ;
67+
6468 try (HipoWriterSorted writer = new HipoWriterSorted ()) {
6569
6670 // Setup the output file writer:
@@ -77,13 +81,6 @@ public static void main(String[] args) {
7781 Bank helScalerBank = new Bank (schema .getSchema ("HEL::scaler" ));
7882 Bank helFlipBank = new Bank (schema .getSchema ("HEL::flip" ));
7983 Bank [] configBanks = new Bank []{new Bank (schema .getSchema (ReconstructionEngine .CONFIG_BANK_NAME ))};
80-
81- // Prepare to read from CCDB:
82- LOGGER .info ("\n >>> Initializing helicity configuration from CCDB ...\n " );
83- ConstantsManager conman = new ConstantsManager ();
84- conman .init ("/runcontrol/hwp" ,"/runcontrol/helicity" );
85- final int run = Util .getRunNumber (parser .getInputList ().get (0 ));
86- IndexedTable helTable = conman .getConstants (run , "/runcontrol/helicity" );
8784
8885 // Initialize the scaler sequence from tag-1 events:
8986 LOGGER .info ("\n >>> Initializing scaler sequence from RUN/HEL::scaler ...\n " );
0 commit comments