Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-18 00:39:47

0001 #include <iostream>
0002 
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 
0010 #include "CondFormats/RPCObjects/interface/RPCReadOutMapping.h"
0011 #include "CondFormats/DataRecord/interface/RPCReadOutMappingRcd.h"
0012 #include "CondFormats/RPCObjects/interface/RPCEMap.h"
0013 #include "CondFormats/DataRecord/interface/RPCEMapRcd.h"
0014 
0015 using namespace std;
0016 using namespace edm;
0017 
0018 // class declaration
0019 class RPCReadOutMapAnalyzer : public edm::one::EDAnalyzer<> {
0020 public:
0021   explicit RPCReadOutMapAnalyzer(const edm::ParameterSet&);
0022   ~RPCReadOutMapAnalyzer() override = default;
0023   void analyze(const edm::Event&, const edm::EventSetup&) override;
0024 
0025 private:
0026   bool m_flag;
0027   edm::ESGetToken<RPCEMap, RPCEMapRcd> readoutMappingToken_;
0028   edm::ESGetToken<RPCReadOutMapping, RPCReadOutMappingRcd> mapZeroToken_;
0029 };
0030 
0031 RPCReadOutMapAnalyzer::RPCReadOutMapAnalyzer(const edm::ParameterSet& iConfig)
0032     : m_flag(iConfig.getUntrackedParameter<bool>("useNewEMap", false)),
0033       readoutMappingToken_(esConsumes()),
0034       mapZeroToken_(esConsumes()) {
0035   ::putenv(const_cast<char*>(std::string("CORAL_AUTH_USER konec").c_str()));
0036   ::putenv(const_cast<char*>(std::string("CORAL_AUTH_PASSWORD konecPass").c_str()));
0037 }
0038 
0039 void RPCReadOutMapAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0040   std::cout << "====== RPCReadOutMapAnalyzer" << std::endl;
0041 
0042   const RPCReadOutMapping* map;
0043   if (m_flag) {
0044     map = iSetup.getData(readoutMappingToken_).convert();
0045   } else {
0046     map = &iSetup.getData(mapZeroToken_);
0047   }
0048   cout << "version: " << map->version() << endl;
0049 
0050   pair<int, int> dccRange = map->dccNumberRange();
0051   cout << " dcc range: " << dccRange.first << " to " << dccRange.second << endl;
0052   vector<const DccSpec*> dccs = map->dccList();
0053   typedef vector<const DccSpec*>::const_iterator IDCC;
0054   for (IDCC idcc = dccs.begin(); idcc != dccs.end(); idcc++)
0055     cout << (**idcc).print(4);
0056 
0057   cout << "--- --- --- --- --- --- --- --- ---" << endl;
0058   cout << "--- --- --- --- --- --- --- --- ---" << endl;
0059   /*
0060    ChamberRawDataSpec linkboard;
0061    linkboard.dccId = 790;
0062    linkboard.dccInputChannelNum = 1;
0063    linkboard.tbLinkInputNum = 1;
0064    linkboard.lbNumInLink = 2;
0065 
0066    int febInputNum=3;
0067    int stripPinNum=5;
0068 
0069    const LinkBoardSpec *location = map->location(linkboard);
0070    if (location) {
0071      location->print();
0072      const FebConnectorSpec * feb = location->feb( febInputNum);
0073      const ChamberStripSpec * strip = feb->strip(stripPinNum);
0074      feb->print();
0075      strip->print();
0076      cout <<" DETID: " << endl;
0077      uint32_t id = feb->rawId();
0078      cout << "uint32_t: " << id << endl;
0079      RPCDetId rpcDetId(id);
0080      cout << rpcDetId << endl;
0081   }
0082      
0083 */
0084 }
0085 
0086 //define this as a plug-in
0087 DEFINE_FWK_MODULE(RPCReadOutMapAnalyzer);