Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:51

0001 #include "CalibTracker/SiStripESProducers/plugins/fake/Phase2TrackerCablingCfgESSource.h"
0002 #include "CalibFormats/SiStripObjects/interface/SiStripFecCabling.h"
0003 #include "CalibFormats/SiStripObjects/interface/SiStripModule.h"
0004 #include "CalibTracker/Records/interface/SiStripHashedDetIdRcd.h"
0005 #include "CalibTracker/SiStripCommon/interface/SiStripFedIdListReader.h"
0006 #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
0007 #include "CondFormats/SiStripObjects/interface/Phase2TrackerCabling.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include <sstream>
0010 #include <vector>
0011 #include <map>
0012 
0013 // -----------------------------------------------------------------------------
0014 //
0015 Phase2TrackerCablingCfgESSource::Phase2TrackerCablingCfgESSource(const edm::ParameterSet& pset)
0016     : Phase2TrackerCablingESProducer(pset), pset_(pset) {
0017   findingRecord<Phase2TrackerCablingRcd>();
0018   edm::LogVerbatim("Phase2TrackerCabling") << "[Phase2TrackerCablingCfgESSource::" << __func__ << "]"
0019                                            << " Constructing object...";
0020 }
0021 
0022 // -----------------------------------------------------------------------------
0023 //
0024 Phase2TrackerCablingCfgESSource::~Phase2TrackerCablingCfgESSource() {
0025   edm::LogVerbatim("Phase2TrackerCabling") << "[Phase2TrackerCablingCfgESSource::" << __func__ << "]"
0026                                            << " Destructing object...";
0027 }
0028 
0029 // -----------------------------------------------------------------------------
0030 //
0031 Phase2TrackerCabling* Phase2TrackerCablingCfgESSource::make(const Phase2TrackerCablingRcd&) {
0032   edm::LogVerbatim("Phase2TrackerCabling") << "[Phase2TrackerCablingCfgESSource::" << __func__ << "]"
0033                                            << " Building FED cabling map from cfg.";
0034 
0035   std::vector<Phase2TrackerModule> conns;
0036 
0037   // iterate through the parameterset and create corresponding Phase2TrackerModule
0038   std::vector<edm::ParameterSet> modules = pset_.getParameterSetVector("modules");
0039   uint32_t detid, gbtid, fedid, fedch, powerGroup, coolingLoop;
0040   for (std::vector<edm::ParameterSet>::const_iterator it = modules.begin(); it < modules.end(); ++it) {
0041     detid = it->getParameter<uint32_t>("detid");
0042     gbtid = it->getParameter<uint32_t>("gbtid");
0043     fedid = it->getParameter<uint32_t>("fedid");
0044     fedch = it->getParameter<uint32_t>("fedch");
0045     powerGroup = it->getParameter<uint32_t>("powerGroup");
0046     coolingLoop = it->getParameter<uint32_t>("coolingLoop");
0047     Phase2TrackerModule::ModuleTypes type =
0048         it->getParameter<std::string>("moduleType") == "2S" ? Phase2TrackerModule::SS : Phase2TrackerModule::PS;
0049     conns.push_back(Phase2TrackerModule(type, detid, gbtid, fedid, fedch, powerGroup, coolingLoop));
0050   }
0051 
0052   // return the cabling
0053   Phase2TrackerCabling* cabling = new Phase2TrackerCabling(conns);
0054   return cabling;
0055 }