Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-09 00:50:50

0001 
0002 /*----------------------------------------------------------------------
0003 
0004 Toy EDAnalyzer for testing purposes only.
0005 
0006 ----------------------------------------------------------------------*/
0007 
0008 #include <stdexcept>
0009 #include <string>
0010 #include <iostream>
0011 #include <map>
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 
0015 #include "CondFormats/DTObjects/test/stubs/DTTtrigPrint.h"
0016 
0017 namespace edmtest {
0018 
0019   DTTtrigPrint::DTTtrigPrint(edm::ParameterSet const& p) : es_token(esConsumes()) {}
0020 
0021   DTTtrigPrint::DTTtrigPrint(int i) {}
0022 
0023   void DTTtrigPrint::analyze(const edm::Event& e, const edm::EventSetup& context) {
0024     using namespace edm::eventsetup;
0025     // Context is not used.
0026     std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0027     std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
0028     const auto& tTrig = context.getData(es_token);
0029     std::cout << tTrig.version() << std::endl;
0030     std::cout << std::distance(tTrig.begin(), tTrig.end()) << " data in the container" << std::endl;
0031     DTTtrig::const_iterator iter = tTrig.begin();
0032     DTTtrig::const_iterator iend = tTrig.end();
0033     while (iter != iend) {
0034       const DTTtrigId& trigId = iter->first;
0035       const DTTtrigData& trigData = iter->second;
0036       float trigTime;
0037       float trigTrms;
0038       float trigKfac;
0039       float trigComp;
0040       tTrig.get(trigId.wheelId,
0041                 trigId.stationId,
0042                 trigId.sectorId,
0043                 trigId.slId,
0044                 trigId.layerId,
0045                 trigId.cellId,
0046                 trigTime,
0047                 trigTrms,
0048                 trigKfac,
0049                 DTTimeUnits::counts);
0050       tTrig.get(trigId.wheelId,
0051                 trigId.stationId,
0052                 trigId.sectorId,
0053                 trigId.slId,
0054                 trigId.layerId,
0055                 trigId.cellId,
0056                 trigComp,
0057                 DTTimeUnits::counts);
0058       std::cout << trigId.wheelId << " " << trigId.stationId << " " << trigId.sectorId << " " << trigId.slId << " "
0059                 << trigId.layerId << " " << trigId.cellId << " -> " << trigData.tTrig << " " << trigData.tTrms << " "
0060                 << trigData.kFact << " -> " << trigTime << " " << trigTrms << " " << trigKfac << " -> " << trigComp
0061                 << std::endl;
0062       iter++;
0063     }
0064   }
0065   DEFINE_FWK_MODULE(DTTtrigPrint);
0066 }  // namespace edmtest