|
ATLAS Offline Software
|
#include "TrigConfBase/MsgStream.h"
#include "TrigConfStorage/StorageMgr.h"
#include "TrigConfStorage/DBLoader.h"
#include "TrigConfStorage/IStorageMgr.h"
#include "TrigConfStorage/IHLTFrameLoader.h"
#include "TrigConfStorage/MCKLoader.h"
#include "TrigConfL1Data/CaloInfo.h"
#include "TrigConfL1Data/CTPConfig.h"
#include "L1TopoConfig/L1TopoMenu.h"
#include "TrigConfL1Data/Muctpi.h"
#include "TrigConfHLTData/HLTFrame.h"
#include "TrigConfHLTData/HLTPrescaleSet.h"
#include "TrigConfJobOptData/JobOptionTable.h"
#include "TrigConfCoolWriter.h"
#include "Run2toRun3ConvertersL1.h"
#include "Run2toRun3ConvertersHLT.h"
#include "CoolKernel/DatabaseId.h"
#include "CoolKernel/Exception.h"
#include "CoolKernel/IDatabaseSvc.h"
#include "CoolKernel/IDatabase.h"
#include "CoolKernel/IFolder.h"
#include "CoolKernel/IObject.h"
#include "boost/lexical_cast.hpp"
#include "boost/algorithm/string.hpp"
#include <iostream>
#include <fstream>
#include <string>
#include <memory>
#include <ctime>
#include <map>
#include <vector>
#include <sys/stat.h>
Go to the source code of this file.
|
void | printhelp (std::ostream &o, std::ostream &(*lineend)(std::ostream &os)) |
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 353 of file ReadWrite.cxx.
366 if(gConfig.
error.size()!=0) {
367 for(
const string&
e: gConfig.
error)
373 ofstream *outf(0), *errf(0);
377 outf =
new ofstream(outfn.c_str());
378 errf =
new ofstream(errfn.c_str());
380 ostream&
log = (outf==0?cout:*outf);
381 ostream&
logerr = (errf==0?cerr:*errf);
382 ostream& (*lineend) ( ostream&
os ) = &endl;
386 logerr << lineend <<
"===> Error in the option specification: " <<
check << lineend << lineend;
388 if(outf) outf->close();
389 if(errf) errf->close();
419 sm->masterTableLoader().setLevel(gConfig.
outputlevel);
420 sm->masterTableLoader().load(*l1tm);
424 ctpc->setSMK( gConfig.
getKey(0) );
425 ctpc->setPrescaleSetId( gConfig.
getKey(1) );
426 ctpc->setBunchGroupSetId( gConfig.
getKey(3) );
427 sm->menuLoader().setEnv(IMenuLoader::CTPOnl);
428 ctpc->setLoadCtpFiles(gConfig.
fw);
429 sm->masterTableLoader().setLevel( gConfig.
outputlevel );
430 sm->masterTableLoader().load(*ctpc);
431 ctpc->muCTPi().setSMK( gConfig.
getKey(0) );
432 sm->masterTableLoader().load( ctpc->muCTPi() );
436 hltFrame->setSMK( gConfig.
getKey(0) );
438 hltFrame->thePrescaleSetCollection().set_prescale_key_to_load( gConfig.
getKey(2) );
439 sm->hltFrameLoader().setLevel( gConfig.
outputlevel );
440 sm->hltFrameLoader().load( *hltFrame );
444 hltpsk = gConfig.
getKey(2);
449 mckloader->loadMCKlinkedToSMK(
smk, mck);
451 mckloader->loadReleaseLinkedToMCK(mck,
release);
452 log <<
"Loaded MCK " << mck <<
" (active for SMK " <<
smk <<
" and release " <<
release <<
")" << endl;
454 log <<
"Did not load MCK from DB as MCK is 0 or no MCK is linked";
463 unsigned int runnumber = gConfig.
inpar.size()>1 ? boost::lexical_cast<unsigned int,string>(gConfig.
inpar[1]) : 1;
464 unsigned int lb = gConfig.
inpar.size()>2 ? boost::lexical_cast<unsigned int,string>(gConfig.
inpar[2]) : 0;
465 log <<
"TrigConfReadWrite Reading cool : " << coolInputConnection << lineend;
467 log <<
" lb : " <<
lb << lineend;
469 string configSource(
"");
475 ctpc->setPrescaleSet( ps );
492 hltFrame->thePrescaleSetCollection().addPrescaleSet(
lb, pss );
495 smk = hltFrame->smk();
501 log <<
"Loaded this configuration" << lineend;
502 log <<
" SMK " <<
smk << lineend;
503 log <<
" L1 PSK " <<
l1psk << lineend;
504 log <<
" HLT PSK " << hltpsk << lineend;
505 log <<
" BGSK " << bgsk << lineend;
506 if(ctpc) ctpc->print(
" ", gConfig.
printlevel);
508 if(hltFrame) hltFrame->print(
" ", gConfig.
printlevel);
522 log <<
"Retrieving Lvl1 CTP configuration for comparison" << lineend;
524 ctpc2->setSMK( gConfig.
getKey2(0) );
525 ctpc2->setPrescaleSetId( gConfig.
getKey2(1) );
526 ctpc2->setBunchGroupSetId( gConfig.
getKey2(3) );
530 ctpc2->muCTPi().setSMK( gConfig.
getKey2(0) );
533 log <<
"Retrieving HLT menu configuration and prescale set from the TriggerDB for comparison" << lineend;
535 hltFrame2->setSMK( gConfig.
getKey2(0) );
537 hltFrame2->thePrescaleSetCollection().set_prescale_key_to_load( gConfig.
getKey2(2) );
547 bool equalMenus = ctpc->equals(ctpc2,
"LVL1config_Diff.xml");
549 log <<
"LVL1 menus are identical." << lineend;
551 log <<
"LVL1 menus differ. Writing LVL1 menu comparison file LVL1config_Diff.xml" << lineend;
554 if(hltFrame && hltFrame2) {
555 bool equalMenus = hltFrame->equals(hltFrame2,
"HLTconfig_Diff.xml");
557 log <<
"HLT menus are identical." << lineend;
559 log <<
"HLT menus differ. Writing HLT menu comparison file HLTconfig_Diff.xml" << lineend;
592 string configSource(
"");
605 catch(
const cool::StorageTypeStringTooLong&
e){
606 log <<
"FATAL: Unable to write data to COOL";
624 log <<
"TrigConfReadWrite: Retrieving JO from the TriggerDB" << lineend;
◆ printhelp()
void printhelp |
( |
std::ostream & |
o, |
|
|
std::ostream &(*)(std::ostream &os) |
lineend |
|
) |
| |
Definition at line 64 of file ReadWrite.cxx.
65 o <<
"================================================================================\n";
66 o <<
"The program needs to be run with the following specifications:\n" << lineend;
67 o <<
"TrigConfReadWrite <options>\n";
69 o <<
"[Global options]\n";
70 o <<
" -i|--input input [input [input]] ... source of configuration, format see below (mandatory)\n";
71 o <<
" -2|--comp input [input [input]] ... source of a second configuration for comparison\n";
72 o <<
" -o|--output r3json|cool [output[;cooldb]] [run] ... output format, name (for cool optional run number)\n";
73 o <<
" ... absolute output file name must contain '/', cooldb can be appended COMP200|OFLP200\n";
74 o <<
" -v|--loglevel <string> ... log level [NIL, VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL, ALWAYS]\n";
75 o <<
" -l|--log <string> ... name of a log file\n";
76 o <<
" --jo ... read and write job options where possible\n";
77 o <<
" --fw ... read ctp firmware\n";
78 o <<
" -p|--print <int> ... print configuration with detail 0...5 (default 1)\n";
79 o <<
" -h|--help ... this output\n";
80 o <<
" --nomerge ... internally don't merge L2 and EF (by default merge is enabled)\n";
82 o <<
"Input can be specified the following\n";
83 o <<
" -i <TRIGDB_ALIAS>|<TRIGDB_connection> smk[,l1psk,hltpsk,bgsk] ... to read the menu from a trigger db via alias or explicit connection specification (ORACLE or SQlite)\n";
84 o <<
" -i <COOLDB_ALIAS>|<COOLDB_connection>|cool.db run[,lb] ... to read the menu from COOL for a certain run and possibly LB [file names must end with '.db']\n";
86 o <<
"The cool dbconnection can be specified as one of the following\n";
87 o <<
" - via alias : COOLONL_TRIGGER (use COOLONL_TRIGGER/COMP200 for Run 1 data)";
88 o <<
" - from sqlite : cool.db (use cool.db;COMP200 for Run 1 data)";
91 o <<
"Input for comparison can be specified the same way, using the '-2' or '--comp' option\n";
94 o <<
"Output formats can be json or cool. In case a second input is specified for comparison, the output will be on screen or an xml file with the differences\n";
95 o <<
" -o r3json [<test>] ... will produce Run 3 config files L1PrescalesSet[_<test>].json, BunchGroupSet[_<test>].json, L1Menu[_<test>].json, HLTPrescalesSet[_<test>].json, and HLTMenu[_<test>].json\n";
96 o <<
" -o cool ... will produce trig_cool.db with cool db instance CONDBR2 and infinite IOV\n";
97 o <<
" -o cool 200000 ... will produce trig_cool.db with cool db instance CONDBR2 and run number 200000\n";
98 o <<
" -o cool test [200000] ... will produce trig_cool_test.db with cool db instance CONDBR2 [and run number 200000]\n";
99 o <<
" -o cool ../test.db [200000] ... will produce ../test.db with cool db instance CONDBR2 [and run number 200000]\n";
100 o <<
" -o cool 'test;COMP200' [200000] ... will produce Menu_test.db with cool db instance COMP200 [and run number 200000]\n";
102 o <<
"================================================================================\n";
void convertRun2BunchGroupsToRun3(const TrigConf::CTPConfig *ctpConfig, const std::string &filename, bool writeTmpFile)
Run 2 to Run 3 bunchgroup converter.
void readHLTPayload(unsigned int run, HLTFrame &hltFrame)
virtual IJobOptionTableLoader & jobOptionTableLoader() override
virtual IHLTFrameLoader & hltFrameLoader() override
void convertRun2HLTPrescalesToRun3(const TrigConf::HLTFrame *frame, const std::string &filename)
void printhelp(std::ostream &o, std::ostream &(*lineend)(std::ostream &os))
virtual IMenuLoader & menuLoader() override
virtual bool load(ThresholdConfig &thrcfg)=0
Load the LVL1 trigger thresholds from the configuration source.
std::vector< std::string > inpar
void print(const std::string &indent="", unsigned int detail=1) const override
print method
void readL1PrescalePayload(unsigned int runNumber, unsigned int lumiblockNumber, unsigned int &lvl1PrescaleKey, TrigConf::PrescaleSet &prescale)
Reading luminosityblock-wise configuration information the COOL database.
table to hold the complete list of JobOption entries for a single configuration, from which the JobOp...
void writeMCKPayload(ValidityRange vr, unsigned int mck, std::string &release, std::string &info)
void readHltPrescalePayload(unsigned int runNumber, unsigned int lumiblockNumber, TrigConf::HLTPrescaleSet &pss)
Reading luminosityblock-wise configuration information the COOL database.
Database Storage Manager, controls the database session and the different loader classes for DB acces...
string coolOutputConnection
unsigned int getKey2(unsigned int which)
void convertRun2L1MenuToRun3(const TrigConf::CTPConfig *ctpConfig, const TXC::L1TopoMenu *topoMenu, const std::string &filename, bool writeTmpFile)
Conversion of L1 menu.
string coolInputConnection
unsigned int getKey(unsigned int which)
virtual void setLevel(MSGTC::Level lvl)=0
Load the configuration data from the configuration source.
unsigned int coolOutputRunNr
void readL1BunchGroupLBPayload(unsigned int runNumber, unsigned int lumiblockNumber, int &bgKey, TrigConf::BunchGroupSet &bgs)
Reading lb-wise bunch group configuration information from COOL database.
HLT chain configuration information.
void writeL1Payload(ValidityRange vr, const CTPConfig &ctpConfig)
void convertRun2L1PrescalesToRun3(const TrigConf::CTPConfig *ctpConfig, const std::string &filename, bool writeTmpFile)
Conversion of L1 prescales set.
virtual IMasterTableLoader & masterTableLoader() override
void setTriggerLevel(int level)
setter of the trigger level
void readL1Payload(unsigned int run, CTPConfig &ctpc)
void convertRun2HLTMenuToRun3(const TrigConf::HLTFrame *frame, const std::string &filename)
string CheckForCompleteSetup()
Reading/Writing of trigger configuration data from/to COOL.
void writeHLTPayload(ValidityRange vr, const HLTFrame &hltFrame, const std::string &configSource)
virtual bool load(JobOptionTable &data)=0
virtual bool load(HLTFrame &data)=0
int parseProgramOptions(int argc, char *argv[])