@@ -36,7 +36,7 @@ public static void main(String[] args) {
3636
3737 OptionParser parser = new OptionParser ("postprocess" );
3838 parser .addOption ("-q" ,"0" ,"do beam charge and livetime (0/1=false/true)" );
39- parser .addOption ("-d" ,"0" ,"do delayed helicity (0/1=false/true )" );
39+ parser .addOption ("-d" ,"0" ,"(ignored, old API )" );
4040 parser .addOption ("-f" ,"0" ,"rebuild the HEL::flip banks (0/1=false/true)" );
4141 parser .addRequired ("-o" ,"output.hipo" );
4242 parser .parse (args );
@@ -46,19 +46,23 @@ public static void main(String[] args) {
4646 LOGGER .severe ("No input file(s) specified." );
4747 System .exit (1 );
4848 }
49- final boolean doHelicityDelay = parser .getOption ("-d" ).intValue () != 0 ;
5049 final boolean doBeamCharge = parser .getOption ("-q" ).intValue () != 0 ;
5150 final boolean doRebuildFlips = parser .getOption ("-f" ).intValue () != 0 ;
52- if (!doHelicityDelay && !doBeamCharge && !doRebuildFlips ) {
53- parser .printUsage ();
54- LOGGER .severe ("At least one of -q/-d/-f is required." );
55- System .exit (1 );
56- }
5751
5852 // Initialize event counters:
5953 long badCharge =0 , goodCharge =0 ;
6054 long badHelicity =0 , goodHelicity =0 ;
6155
56+ // Prepare to read from CCDB:
57+ LOGGER .info ("\n >>> Initializing helicity configuration from CCDB ...\n " );
58+ ConstantsManager conman = new ConstantsManager ();
59+ conman .init ("/runcontrol/hwp" ,"/runcontrol/helicity" );
60+ final int run = Util .getRunNumber (parser .getInputList ().get (0 ));
61+
62+ // Determine whether to apply delay correction:
63+ IndexedTable helTable = conman .getConstants (run , "/runcontrol/helicity" );
64+ final boolean doHelicityDelay = helTable .getIntValue ("delay" , 0 ,0 ,0 ) != 0 ;
65+
6266 try (HipoWriterSorted writer = new HipoWriterSorted ()) {
6367
6468 // Setup the output file writer:
@@ -75,13 +79,6 @@ public static void main(String[] args) {
7579 Bank helScalerBank = new Bank (schema .getSchema ("HEL::scaler" ));
7680 Bank helFlipBank = new Bank (schema .getSchema ("HEL::flip" ));
7781 Bank [] configBanks = new Bank []{new Bank (schema .getSchema (ReconstructionEngine .CONFIG_BANK_NAME ))};
78-
79- // Prepare to read from CCDB:
80- LOGGER .info ("\n >>> Initializing helicity configuration from CCDB ...\n " );
81- ConstantsManager conman = new ConstantsManager ();
82- conman .init ("/runcontrol/hwp" ,"/runcontrol/helicity" );
83- final int run = Util .getRunNumber (parser .getInputList ().get (0 ));
84- IndexedTable helTable = conman .getConstants (run , "/runcontrol/helicity" );
8582
8683 // Initialize the scaler sequence from tag-1 events:
8784 LOGGER .info ("\n >>> Initializing scaler sequence from RUN/HEL::scaler ...\n " );
0 commit comments