Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove last manual configuration of postprocessing script, rely solely on CCDB #350

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void main(String[] args) {
// Parse command-line options:
OptionParser parser = new OptionParser("postprocess");
parser.addOption("-q","0","do beam charge and livetime (0/1=false/true)");
parser.addOption("-d","0","do delayed helicity (0/1=false/true)");
parser.addOption("-d","0","(ignored, old API)");
parser.addOption("-f","0","rebuild the HEL::flip banks (0/1=false/true)");
parser.addRequired("-o","output.hipo");
parser.parse(args);
Expand All @@ -49,19 +49,23 @@ public static void main(String[] args) {
LOGGER.severe("No input file(s) specified.");
System.exit(1);
}
final boolean doHelicityDelay = parser.getOption("-d").intValue() != 0;
final boolean doBeamCharge = parser.getOption("-q").intValue() != 0;
final boolean doRebuildFlips = parser.getOption("-f").intValue() != 0;
if (!doHelicityDelay && !doBeamCharge && !doRebuildFlips) {
parser.printUsage();
LOGGER.severe("At least one of -q/-d/-f is required.");
System.exit(1);
}

// Initialize event counters:
long badCharge=0, goodCharge=0;
long badHelicity=0, goodHelicity=0;

// Prepare to read from CCDB:
LOGGER.info("\n>>> Initializing helicity configuration from CCDB ...\n");
ConstantsManager conman = new ConstantsManager();
conman.init("/runcontrol/hwp","/runcontrol/helicity");
final int run = Util.getRunNumber(parser.getInputList().get(0));

// Determine whether to apply delay correction:
IndexedTable helTable = conman.getConstants(run, "/runcontrol/helicity");
final boolean doHelicityDelay = helTable.getIntValue("delay", 0,0,0) != 0;

try (HipoWriterSorted writer = new HipoWriterSorted()) {

// Setup the output file writer:
Expand All @@ -78,13 +82,6 @@ public static void main(String[] args) {
Bank helScalerBank = new Bank(schema.getSchema("HEL::scaler"));
Bank helFlipBank = new Bank(schema.getSchema("HEL::flip"));
Bank[] configBanks = new Bank[]{new Bank(schema.getSchema(ReconstructionEngine.CONFIG_BANK_NAME))};

// Prepare to read from CCDB:
LOGGER.info("\n>>> Initializing helicity configuration from CCDB ...\n");
ConstantsManager conman = new ConstantsManager();
conman.init("/runcontrol/hwp","/runcontrol/helicity");
final int run = Util.getRunNumber(parser.getInputList().get(0));
IndexedTable helTable = conman.getConstants(run, "/runcontrol/helicity");

// Initialize the scaler sequence from tag-1 events:
LOGGER.info("\n>>> Initializing scaler sequence from RUN/HEL::scaler ...\n");
Expand Down