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