Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:48

0001 
0002 /*----------------------------------------------------------------------
0003 
0004 Toy EDAnalyzer for testing purposes only.
0005 
0006 ----------------------------------------------------------------------*/
0007 
0008 #include <stdexcept>
0009 #include <iostream>
0010 #include <fstream>
0011 #include <map>
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 #include "CoralBase/TimeStamp.h"
0015 
0016 #include "CondTools/DT/test/stubs/DTTimeUtility.h"
0017 #include "CondFormats/DTObjects/interface/DTHVStatus.h"
0018 #include "CondFormats/DataRecord/interface/DTHVStatusRcd.h"
0019 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0020 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0021 
0022 namespace edmtest {
0023 
0024   DTTimeUtility::DTTimeUtility(edm::ParameterSet const& p)
0025       : year(p.getParameter<int>("year")),
0026         month(p.getParameter<int>("month")),
0027         day(p.getParameter<int>("day")),
0028         hour(p.getParameter<int>("hour")),
0029         min(p.getParameter<int>("minute")),
0030         sec(p.getParameter<int>("second")),
0031         condTime(p.getParameter<long long int>("condTime")),
0032         coralTime(p.getParameter<long long int>("coralTime")) {
0033     // parameters to setup
0034   }
0035 
0036   DTTimeUtility::DTTimeUtility(int i) {}
0037 
0038   void DTTimeUtility::analyze(const edm::Event& e, const edm::EventSetup& context) {
0039     //    using namespace edm::eventsetup;
0040     long long int condConv = ((((condTime >> 32) & 0xFFFFFFFF) * 1000000000) + ((condTime & 0xFFFFFFFF) * 1000));
0041     coral::TimeStamp condStamp(condConv);
0042     std::cout << " condTime " << condTime << " -> coralTime " << condConv << " ( " << condStamp.year() << " , "
0043               << condStamp.month() << " , " << condStamp.day() << " h " << condStamp.hour() << ":" << condStamp.minute()
0044               << ":" << condStamp.second() << " ) " << std::endl;
0045     long long int coralConv = (((coralTime / 1000000000) << 32) + ((coralTime % 1000000000) / 1000));
0046     coral::TimeStamp convStamp(coralTime);
0047     std::cout << " coralTime " << coralTime << " -> condTime " << coralConv << " ( " << convStamp.year() << " , "
0048               << convStamp.month() << " , " << convStamp.day() << " h " << convStamp.hour() << ":" << convStamp.minute()
0049               << ":" << convStamp.second() << " ) " << std::endl;
0050     coral::TimeStamp coralStamp(year, month, day, hour, min, sec, 0);
0051     coralTime = coralStamp.total_nanoseconds();
0052     condTime = (((coralTime / 1000000000) << 32) + ((coralTime % 1000000000) / 1000));
0053     std::cout << coralStamp.year() << " , " << coralStamp.month() << " , " << coralStamp.day() << " h "
0054               << coralStamp.hour() << ":" << coralStamp.minute() << ":" << coralStamp.second() << " "
0055               << " -> coralTime " << coralTime << " -> condTime " << condTime << std::endl;
0056     return;
0057   }
0058   DEFINE_FWK_MODULE(DTTimeUtility);
0059 }  // namespace edmtest