Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:46

0001 #include "DataFormats/Provenance/interface/LuminosityBlockID.h"
0002 #include "CondCore/CondDB/interface/Exception.h"
0003 
0004 #include "CondCore/Utilities/interface/Utilities.h"
0005 #include <iostream>
0006 
0007 namespace cond {
0008   class FromLumiIdUtilities : public Utilities {
0009   public:
0010     FromLumiIdUtilities();
0011     ~FromLumiIdUtilities() override;
0012     int execute() override;
0013   };
0014 }  // namespace cond
0015 
0016 cond::FromLumiIdUtilities::FromLumiIdUtilities() : Utilities("cmscond_from_lumiid") {
0017   addOption<uint64_t>("lumiid", "i", "luminosity block id of unsigned 64bit int(required)");
0018 }
0019 
0020 cond::FromLumiIdUtilities::~FromLumiIdUtilities() {}
0021 
0022 int cond::FromLumiIdUtilities::execute() {
0023   if (!hasOptionValue("lumiid")) {
0024     std::cout << "ERROR: Missing mandatory option \"lumiid\"." << std::endl;
0025     return 1;
0026   }
0027   uint64_t lumiid = getOptionValue<uint64_t>("lumiid");
0028   bool debug = hasDebug();
0029   std::cout << edm::LuminosityBlockID(lumiid) << std::endl;
0030   if (debug) {
0031     std::cout << "firstValidLuminosityBlockID:\t" << edm::LuminosityBlockID::firstValidLuminosityBlock().value()
0032               << std::endl;
0033     std::cout << "maxRunNumber:\t" << edm::RunID::maxRunNumber() << std::endl;
0034     std::cout << "maxLuminosityBlockNumber:\t" << edm::LuminosityBlockID::maxLuminosityBlockNumber() << std::endl;
0035     std::cout << "maxLuminosityBlockID:\t"
0036               << edm::LuminosityBlockID(edm::RunID::maxRunNumber(), edm::LuminosityBlockID::maxLuminosityBlockNumber())
0037                      .value()
0038               << std::endl;
0039   }
0040   return 0;
0041 }
0042 
0043 int main(int argc, char** argv) {
0044   cond::FromLumiIdUtilities utilities;
0045   return utilities.run(argc, argv);
0046 }