Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

/*----------------------------------------------------------------------

Toy EDAnalyzer for testing purposes only.

----------------------------------------------------------------------*/

#include <stdexcept>
#include <string>
#include <iostream>
#include <map>
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "CondFormats/DTObjects/test/stubs/DTTtrigPrint.h"

namespace edmtest {

  DTTtrigPrint::DTTtrigPrint(edm::ParameterSet const& p) : es_token(esConsumes()) {}

  DTTtrigPrint::DTTtrigPrint(int i) {}

  void DTTtrigPrint::analyze(const edm::Event& e, const edm::EventSetup& context) {
    using namespace edm::eventsetup;
    // Context is not used.
    std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
    std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
    const auto& tTrig = context.getData(es_token);
    std::cout << tTrig.version() << std::endl;
    std::cout << std::distance(tTrig.begin(), tTrig.end()) << " data in the container" << std::endl;
    DTTtrig::const_iterator iter = tTrig.begin();
    DTTtrig::const_iterator iend = tTrig.end();
    while (iter != iend) {
      const DTTtrigId& trigId = iter->first;
      const DTTtrigData& trigData = iter->second;
      float trigTime;
      float trigTrms;
      float trigKfac;
      float trigComp;
      tTrig.get(trigId.wheelId,
                trigId.stationId,
                trigId.sectorId,
                trigId.slId,
                trigId.layerId,
                trigId.cellId,
                trigTime,
                trigTrms,
                trigKfac,
                DTTimeUnits::counts);
      tTrig.get(trigId.wheelId,
                trigId.stationId,
                trigId.sectorId,
                trigId.slId,
                trigId.layerId,
                trigId.cellId,
                trigComp,
                DTTimeUnits::counts);
      std::cout << trigId.wheelId << " " << trigId.stationId << " " << trigId.sectorId << " " << trigId.slId << " "
                << trigId.layerId << " " << trigId.cellId << " -> " << trigData.tTrig << " " << trigData.tTrms << " "
                << trigData.kFact << " -> " << trigTime << " " << trigTrms << " " << trigKfac << " -> " << trigComp
                << std::endl;
      iter++;
    }
  }
  DEFINE_FWK_MODULE(DTTtrigPrint);
}  // namespace edmtest