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/DTT0Print.h"
0016 
0017 namespace edmtest {
0018 
0019   DTT0Print::DTT0Print(edm::ParameterSet const& p) : es_token(esConsumes()) {}
0020 
0021   DTT0Print::DTT0Print(int i) {}
0022 
0023   void DTT0Print::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& t0 = context.getData(es_token);
0029     std::cout << t0.version() << std::endl;
0030     std::cout << std::distance(t0.begin(), t0.end()) << " data in the container" << std::endl;
0031     float t0mean;
0032     float t0rms;
0033     DTT0::const_iterator iter = t0.begin();
0034     DTT0::const_iterator iend = t0.end();
0035     while (iter != iend) {
0036       const DTT0Data& t0Data = *iter++;
0037       int channelId = t0Data.channelId;
0038       if (channelId == 0)
0039         continue;
0040       DTWireId id(channelId);
0041       DTChamberId* cp = &id;
0042       DTChamberId ch(*cp);
0043       DTChamberId cc(id.chamberId());
0044       std::cout << channelId << " " << id.rawId() << " " << cp->rawId() << " " << ch.rawId() << " " << cc.rawId()
0045                 << std::endl;
0046       t0.get(id, t0mean, t0rms, DTTimeUnits::counts);
0047       std::cout << id.wheel() << " " << id.station() << " " << id.sector() << " " << id.superlayer() << " "
0048                 << id.layer() << " " << id.wire() << " -> " << t0Data.t0mean << " " << t0Data.t0rms << " -> " << t0mean
0049                 << " " << t0rms << std::endl;
0050     }
0051   }
0052   DEFINE_FWK_MODULE(DTT0Print);
0053 }  // namespace edmtest