Generating L1 configuration objects from OMDS
One step in the O2O process is generating C++ L1 configuration objects (defined in
CondFormats/L1TObjects
) using data stored in OMDS corresponding to a given TSC key. These objects are put in EventSetup, where they can be used by any CMSSW module, not just those performing O2O. For instance, one could run an EDAnalyzer that computes hardware lookup tables based on these configuration objects.
Code layout
The relevant database tools reside in
CondTools/L1Trigger
:
-
CondTools/L1Trigger/{interface,src}/OMDSReader.{h,cc}
is the helper object that establishes the OCCI connection between OMDS and CMSSW and provides an interface for issuing SQL queries.
-
CondTools/L1Trigger/interface/L1ObjectKeysOnlineProdBase.h
is the abstract base class for ESProducers that determine the object keys for a given subsystem key.
-
CondTools/L1Trigger/interface/L1ConfigOnlineProdBase.h
is the templated abstract base class for ESProducers that make the CondDB objects.
Subclasses of
L1ObjectKeysOnlineProdBase
and
L1ConfigOnlineProdBase
are placed in the subsystem directories of
L1TriggerConfig
so that they can be maintained by subsystem developers.
Choice of object keys
The choice of object key is not strictly defined and is left to the subsystem developer (see below for restrictions). This key serves to identify different versions of the offline C++ objects, so it should be read from a column in OMDS that tracks the changes in the corresponding configuration data.
This key is used both by the ESProducers that determine the object keys (subclasses of
L1ObjectKeysOnlineProdBase
) and by the ESProducers that read the configuration data from OMDS (subclasses of
L1ConfigOnlineProdBase
). So, the choice of object key must be coordinated between the two ESProducers.
Usually, object keys will simply come from the ID or KEY column of a particular OMDS table. Sometimes, the data used to construct a given C++ object comes from multiple OMDS tables. In this case, some options for constructing the object key are:
- Use a key from a higher-level table that refers to all the tables needed to construct the C++ object.
- Concatenate multiple keys into a single string. Here, the corresponding subclass of
L1ConfigOnlineProdBase
must parse this string and decompose it into its constituent keys, so that they can be used to query OMDS.
For Run Settings data that would normally be unkeyed, a timestamp could be used as a key.
Important: there are two characters to be avoided in keys:
- Spaces (' ') are allowed but discouraged because they must be replaced when used in a command line.
- Question marks ('?') should not be used. This is a reserved character used to handle keys with spaces.
Finally, the L1 O2O framework stores all the TSC/subsystem/object keys as
std::string
. If they are not defined as strings in OMDS, they can be converted in the ESProducers via a function like this:
#include <sstream>
template <class T>
inline std::string to_string (const T& t)
{
std::stringstream ss;
ss << t;
return ss.str();
}
Writing the code
Set up release area on .cms cluster
c3rel CMSSW_3_1_0
cd CMSSW_3_1_0/src
cmsenv
kinit user@CERN.CH
cvs co -r V00-02-00 CondCore/L1TPlugins
cvs co -r V01-20-03 CondFormats/L1TObjects
cvs co -r V03-14-01 CondTools/L1Trigger
cvs co -r V11-08-00 DataFormats/L1CMS.GlobalTrigger
cvs co -r V10-13-00 L1Trigger/CMS.GlobalTrigger
cvs co -r V00-05-00 L1TriggerConfig/CSCTFConfigProducers
addpkg L1TriggerConfig/DTTrackFinder
cvs co -r V01-05-03 L1TriggerConfig/GMTConfigProducers
cvs co -r V00-08-02 L1TriggerConfig/GctConfigProducers
cvs co -r V03-00-00 L1TriggerConfig/L1GtConfigProducers
cvs co -r V00-09-00 L1TriggerConfig/L1ScalesProducers
cvs co -r V01-07-01 L1TriggerConfig/RCTConfigProducers
addpkg L1TriggerConfig/RPCTriggerConfig
cvs co -r V00-03-00 L1TriggerConfig/L1GeometryProducers
scramv1 b
Use
this page to figure out which tag of
CondTools/L1Trigger
to check out, as well as any other tags you might need. When in doubt, ask.
Modify L1TriggerConfig
CMS.BuildFile
In the CMS.BuildFile of
L1TriggerConfig/{your subsystem package}
, add the following line:
<use name=CondTools/L1Trigger>
if it does not appear already.
Write a subclass of L1ObjectKeysOnlineProdBase
For objects in the TSC key, see
SWGuideL1ObjectKeysOnlineProdBaseTSC.
For Run Settings (RS) objects that are decoupled from the TSC key, see
SWGuideL1ObjectKeysOnlineProdBaseRS.
Write a subclass of L1ConfigOnlineProdBase
See
SWGuideL1ConfigOnlineProdBase. These instructions apply to both TSC and RS objects.
Executing SQL queries
See
SWGuideOMDSReaderSQLQueries for instructions on coding up SQL queries using the function
l1t::OMDSReader::basicQuery(...)
.
Validate the O2O code
See
SWGuideL1O2OTestJob for instructions.
--
WernerSun - 14 Jul 2008