10#include "CoolKernel/IFolder.h"
11#include "CoolKernel/IDatabase.h"
12#include "CoolKernel/FolderSpecification.h"
37 const IFolderPtr & l1prescaleFolder = db->getFolder(
"/TRIGGER/LVL1/Prescales");
38 const IRecordSpecification & l1psSpec = l1prescaleFolder->payloadSpecification();
39 const IFieldSpecification& l1psfield = l1psSpec[
"Lvl1Prescale"];
40 if(l1psfield.storageType() == StorageType::Int64) {
44 const IFolderPtr & hltMenuFolder = db->getFolder(
"/TRIGGER/HLT/Menu");
45 const IRecordSpecification & hltMenuSpec = hltMenuFolder->payloadSpecification();
47 if(hltMenuSpec.exists(
"Prescale")) {
49 const IFieldSpecification& lowChNField = hltMenuSpec[
"LowerChainName"];
53 if(lowChNField.storageType() == StorageType::String4k) {
57 const IFieldSpecification& psField = hltMenuSpec[
"Prescale"];
61 if(psField.storageType() == StorageType::UInt32) {
67 if(psField.storageType() == StorageType::Float) {
73 throw runtime_error(
"Could not determine the COOL schema of the TriggerDB");
87 cool::RecordSpecification rspec;
88 rspec.extend(
"ItemName", StorageType::String255 );
89 rspec.extend(
"ItemVersion", StorageType::UInt32 );
91 FolderVersioning::SINGLE_VERSION, rspec);
104 cool::RecordSpecification rspec;
106 rspec.extend(
"Logic", StorageType::String255 );
107 rspec.extend(
"ConditionsList", StorageType::String4k );
109 FolderVersioning::SINGLE_VERSION,rspec);
122 cool::RecordSpecification rspec;
123 rspec.extend(
"Threshold", StorageType::String255 );
124 rspec.extend(
"ThresholdValue", StorageType::String4k );
125 rspec.extend(
"Cable", StorageType::String255 );
127 FolderVersioning::SINGLE_VERSION,rspec);
140 cool::RecordSpecification rspec;
141 rspec.extend(
"Lvl1PrescaleConfigurationKey", StorageType::UInt32 );
143 FolderVersioning::MULTI_VERSION,rspec);
156 cool::RecordSpecification rspec;
157 if(schemaVersion<4) {
158 rspec.extend(
"Lvl1Prescale", StorageType::Int32 );
159 }
else if(schemaVersion>=4) {
160 rspec.extend(
"Lvl1Prescale", StorageType::Int64 );
163 FolderVersioning::MULTI_VERSION,rspec);
176 cool::RecordSpecification rspec;
177 rspec.extend(
"ThresholdName", StorageType::String255 );
178 rspec.extend(
"CtpinSlot", StorageType::UChar );
179 rspec.extend(
"CtpinConnector", StorageType::UChar );
180 rspec.extend(
"ThresholdBit", StorageType::UChar );
181 rspec.extend(
"CableBit", StorageType::UChar );
182 rspec.extend(
"ThresholdMapping", StorageType::UChar );
183 rspec.extend(
"ThresholdActive", StorageType::Bool );
185 FolderVersioning::SINGLE_VERSION,rspec);
198 cool::RecordSpecification rspec;
199 rspec.extend(
"Lvl1BunchGroupConfigurationKey", StorageType::UInt32 );
201 FolderVersioning::MULTI_VERSION,rspec);
214 cool::RecordSpecification rspec;
215 rspec.extend(
"BunchCode" , StorageType::Blob64k );
217 FolderVersioning::MULTI_VERSION,rspec);
230 cool::RecordSpecification rspec;
231 rspec.extend(
"BunchGroup0", StorageType::String255 );
232 rspec.extend(
"BunchGroup1", StorageType::String255 );
233 rspec.extend(
"BunchGroup2", StorageType::String255 );
234 rspec.extend(
"BunchGroup3", StorageType::String255 );
235 rspec.extend(
"BunchGroup4", StorageType::String255 );
236 rspec.extend(
"BunchGroup5", StorageType::String255 );
237 rspec.extend(
"BunchGroup6", StorageType::String255 );
238 rspec.extend(
"BunchGroup7", StorageType::String255 );
239 rspec.extend(
"BunchGroup8", StorageType::String255 );
240 rspec.extend(
"BunchGroup9", StorageType::String255 );
241 rspec.extend(
"BunchGroup10", StorageType::String255 );
242 rspec.extend(
"BunchGroup11", StorageType::String255 );
243 rspec.extend(
"BunchGroup12", StorageType::String255 );
244 rspec.extend(
"BunchGroup13", StorageType::String255 );
245 rspec.extend(
"BunchGroup14", StorageType::String255 );
246 rspec.extend(
"BunchGroup15", StorageType::String255 );
247 rspec.extend(
"ItemToBunchGroupMap" ,StorageType::Blob64k );
249 FolderVersioning::SINGLE_VERSION,rspec);
262 cool::RecordSpecification rspec;
263 rspec.extend(
"ChainName", StorageType::String255 );
264 rspec.extend(
"ChainVersion", StorageType::UInt32 );
265 rspec.extend(
"ChainCounter", StorageType::UInt32 );
266 rspec.extend(
"TriggerLevel", StorageType::String255 );
267 rspec.extend(
"LowerChainName", StorageType::String4k );
268 rspec.extend(
"Prescale", StorageType::Float );
269 rspec.extend(
"PassThrough", StorageType::Float );
270 rspec.extend(
"TriggerElements", StorageType::String4k );
271 rspec.extend(
"StreamInfo", StorageType::String255 );
273 FolderVersioning::SINGLE_VERSION,rspec);
286 cool::RecordSpecification rspec;
287 rspec.extend(
"ChainCounter", StorageType::UInt32 );
288 rspec.extend(
"Groups", StorageType::String4k );
290 FolderVersioning::SINGLE_VERSION,rspec);
303 cool::RecordSpecification rspec;
304 rspec.extend(
"MasterConfigurationKey", StorageType::UInt32 );
305 rspec.extend(
"HltPrescaleConfigurationKey", StorageType::UInt32 );
306 rspec.extend(
"ConfigSource", StorageType::String255 );
308 FolderVersioning::SINGLE_VERSION,rspec);
321 cool::RecordSpecification rspec;
322 rspec.extend(
"Prescale", StorageType::Float );
323 rspec.extend(
"Passthrough", StorageType::Float );
324 rspec.extend(
"RerunPrescale", StorageType::Float );
326 FolderVersioning::MULTI_VERSION,rspec);
339 cool::RecordSpecification rspec;
340 rspec.extend(
"HltPrescaleKey", StorageType::UInt32 );
342 FolderVersioning::MULTI_VERSION,rspec);
359 RecordSpecification rspec;
360 rspec.extend(
"CounterType", StorageType::String255 );
361 rspec.extend(
"BunchGroupId", StorageType::UChar );
362 rspec.extend(
"ThresholdName", StorageType::String255 );
363 rspec.extend(
"CtpinSlot", StorageType::String255 );
364 rspec.extend(
"CtpinConnector", StorageType::String255 );
365 rspec.extend(
"Multiplicity", StorageType::String255 );
366 rspec.extend(
"ThresholdBitStart", StorageType::String255 );
367 rspec.extend(
"ThresholdBitEnd", StorageType::String255 );
368 rspec.extend(
"ThresholdActive", StorageType::String255 );
369 rspec.extend(
"CounterName", StorageType::String255 );
370 rspec.extend(
"CounterLogic", StorageType::String255 );
372 FolderVersioning::SINGLE_VERSION, rspec);
382 cool::RecordSpecification rspec;
392 static const string singleChannelDesc =
"<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"40774348\" /></addrHeader><typeName>AthenaAttributeList</typeName>";
393 static const string multiChannelDesc =
"<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" /></addrHeader><typeName>CondAttrListCollection</typeName>";
395 if( db->existsFolder( fd.folder ) )
398 const string &
description = isMultiChannel ? multiChannelDesc : singleChannelDesc;
400 bool createParents =
true;
402 IFolderPtr ptr = db->createFolder( fd.folder, fd.fspec,
description, createParents );
419 std::string singleChannelDesc =
"<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"40774348\" /></addrHeader><typeName>AthenaAttributeList</typeName>";
420 std::string multiChannelDesc =
"<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" /></addrHeader><typeName>CondAttrListCollection</typeName>";
423 bool newFolder =
false;
425 static const bool singleChannel(
false);
426 static const bool multiChannel(
true);
428 IFolderSetPtr topFolder;
429 if( !db->existsFolderSet(
"/TRIGGER" ) ) {
431 topFolder = db->createFolderSet(
"/TRIGGER" );
433 if( !db->existsFolderSet(
"/TRIGGER/LVL1" ) ) {
435 db->createFolderSet(
"/TRIGGER/LVL1" );
437 if( !db->existsFolderSet(
"/TRIGGER/HLT" ) ) {
439 db->createFolderSet(
"/TRIGGER/HLT" );
478 bool multiChannel(
true);
485 return db->getFolderSet(
"/TRIGGER" );
496 return db->getFolder(
"/TRIGGER/LVL1/Menu" );
500 return db->getFolder(
"/TRIGGER/LVL1/ItemDef" );
504 return db->getFolder(
"/TRIGGER/LVL1/Thresholds" );
508 return db->getFolder(
"/TRIGGER/LVL1/Lvl1ConfigKey" );
512 return db->getFolder(
"/TRIGGER/LVL1/Prescales" );
516 return db->getFolder(
"/TRIGGER/LVL1/BunchGroupKey" );
520 return db->getFolder(
"/TRIGGER/LVL1/BunchGroupContent" );
524 return db->getFolder(
"/TRIGGER/LVL1/BunchGroupDescription" );
528 return db->getFolder(
"/TRIGGER/LVL1/CTPCoreInputMapping" );
532 return db->getFolder(
"/TRIGGER/LVL1/CTPInMonitoringMapping" );
536 return db->getFolder(
"/TRIGGER/HLT/Menu" );
540 return db->getFolder(
"/TRIGGER/HLT/Groups" );
544 return db->getFolder(
"/TRIGGER/HLT/HltConfigKeys" );
548 return db->getFolder(
"/TRIGGER/HLT/MenuAwareMonConfigKey" );
552 return db->getFolder(
"/TRIGGER/HLT/Prescales" );
556 return db->getFolder(
"/TRIGGER/HLT/PrescaleKey" );
567 for(
const string&
node : db->listAllNodes()) {
568 bool isFolderSet = db->existsFolderSet(
node);
573 IFolderPtr folder = db->getFolder(
node);
574 bool isMultiVersion = (folder->versioningMode() == FolderVersioning::MULTI_VERSION);
575 const IRecordSpecification& rspec = folder->payloadSpecification();
576 o <<
" (" << (isMultiVersion?
"Multiversion":
"Singleversion") <<
")" << endl;
578 for(
uint i=0;i<rspec.size(); i++) {
579 o <<
" " << setw(30) << rspec[i].name()
580 <<
" (" << rspec[i].storageType().name() <<
")" << endl;
cool::RecordSpecification & rspec()
static cool::RecordSpecification createHltMenuFolderSpecification()
defines the folder structure for the HLT menu
static FolderDefinition HltPrescalesFolderDefinition()
static cool::IFolderSetPtr createMonFolderStructure(cool::IDatabasePtr db, int schemaVersion=0)
creates the folder structure in the monitoring COOL database
static cool::RecordSpecification createLvl1InputMapFolderSpecification()
defines the folder structure for the LVL1 CTP input map
static cool::RecordSpecification createLvl1MonMapFolderSpecification()
defines the folder structure for the LVL1 monitoring counter map
static const long mBGDescBlobSize
static cool::IFolderPtr getHltPrescaleKeyFolder(cool::IDatabasePtr db)
static void printFolderStructure(cool::IDatabasePtr db, std::ostream &o)
prints the folder structure that is in the COOL database
static cool::RecordSpecification createLvl1ThresholdFolderSpecification()
defines the folder structure for the LVL1 thresholds
static cool::RecordSpecification createLvl1MenuFolderSpecification()
defines the folder structure for the LVL1 menu
static FolderDefinition Lvl1ItemDefFolderDefinition()
static cool::IFolderPtr getHltChainGroupFolder(cool::IDatabasePtr db)
static cool::RecordSpecification createLvl1ConfigKeysFolderSpecification()
defines the folder structure for the LVL1 config key
static cool::IFolderPtr getLvl1ConfKeyFolder(cool::IDatabasePtr db)
static cool::RecordSpecification createHltPrescalesFolderSpecification()
defines the folder structure for the HLT prescales
static cool::RecordSpecification createLvl1BGKeyFolderSpecification()
defines the folder structure for the LVL1 bunch group key
static cool::IFolderPtr getHltMenuFolder(cool::IDatabasePtr db)
static FolderDefinition Lvl1BGDescFolderDefinition()
static FolderDefinition Lvl1BGKeyFolderDefinition()
static int readSchemaVersion(cool::IDatabasePtr db)
get the version of the COOL database
static cool::IFolderPtr getMonConfKeyFolder(cool::IDatabasePtr db)
static FolderDefinition HltPrescaleKeyFolderDefinition()
static cool::RecordSpecification createLvl1ItemDefFolderSpecification()
defines the folder structure for the LVL1 item def
static FolderDefinition Lvl1ConfigKeysFolderDefinition()
static cool::RecordSpecification createLvl1BGDescFolderSpecification()
defines the folder structure for the LVL1 bunch group descriptions
static cool::RecordSpecification createLvl1PrescalesFolderSpecification(int schemaVersion)
defines the folder structure for the LVL1 prescales
static cool::IFolderPtr getLvl1ItemDefFolder(cool::IDatabasePtr db)
static cool::IFolderPtr getLvl1BGContentFolder(cool::IDatabasePtr db)
static cool::IFolderPtr getHltConfKeyFolder(cool::IDatabasePtr db)
static FolderDefinition Lvl1MonMapFolderSpecification()
static FolderDefinition Lvl1BGContentFolderDefinition()
static FolderDefinition HltMenuFolderDefinition()
static cool::IFolderPtr getLvl1PrescalesFolder(cool::IDatabasePtr db)
static int getDefaultSchemaVersion()
access to the version
static FolderDefinition Lvl1ThresholdFolderDefinition()
static cool::IFolderSetPtr createFolderStructure(cool::IDatabasePtr db, int schemaVersion=0)
creates the folder structure in the COOL database
static cool::IFolderPtr getLvl1MonMapFolder(cool::IDatabasePtr db)
static cool::RecordSpecification createLvl1BGContentFolderSpecification()
defines the folder structure for the LVL1 bunch groups
static FolderDefinition Lvl1PrescalesFolderDefinition(int schemaVersion)
static cool::IFolderPtr getLvl1BGDescFolder(cool::IDatabasePtr db)
static cool::IFolderPtr getLvl1BGKeyFolder(cool::IDatabasePtr db)
static cool::IFolderPtr getLvl1ThresholdFolder(cool::IDatabasePtr db)
static const int mDefaultSchemaVersion
static cool::RecordSpecification createHltChainGroupFolderSpecification()
defines the folder structure for the HLT chain groups
static FolderDefinition HltChainGroupFolderDefinition()
static cool::IFolderPtr getLvl1InputMapFolder(cool::IDatabasePtr db)
static cool::RecordSpecification createHltPrescaleKeyFolderSpecification()
defines the folder structure for the HLT prescales
static FolderDefinition Lvl1InputMapFolderDefinition()
static cool::IFolderPtr getLvl1MenuFolder(cool::IDatabasePtr db)
static const long mBGContentBlobSize
static cool::RecordSpecification createHltConfigKeysFolderSpecification()
defines the folder structure for the HLT config key
static FolderDefinition Lvl1MenuFolderDefinition()
static bool CreateFolderIfNotExist(cool::IDatabasePtr db, const std::string &folder, const cool::IRecordSpecification &spec, cool::FolderVersioning::Mode mode, bool isMultiChannel)
static cool::IFolderPtr getHltPrescalesFolder(cool::IDatabasePtr db)
static FolderDefinition HltConfigKeysFolderDefinition()
std::string description
glabal timer - how long have I taken so far?
Forward iterator to traverse the main components of the trigger configuration.