CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripFedCablingManipulator Class Reference

#include <SiStripFedCablingManipulator.h>

Inheritance diagram for SiStripFedCablingManipulator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &es) override
 
void endRun (const edm::Run &run, const edm::EventSetup &es) override
 
 SiStripFedCablingManipulator (const edm::ParameterSet &iConfig)
 
 ~SiStripFedCablingManipulator () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

std::unique_ptr< SiStripFedCablingmanipulate (const SiStripFedCabling &)
 

Private Attributes

edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcdfedCablingToken_
 
edm::ParameterSet iConfig_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 18 of file SiStripFedCablingManipulator.h.

Constructor & Destructor Documentation

◆ SiStripFedCablingManipulator()

SiStripFedCablingManipulator::SiStripFedCablingManipulator ( const edm::ParameterSet iConfig)
explicit

Definition at line 6 of file SiStripFedCablingManipulator.cc.

7  : iConfig_(iConfig), fedCablingToken_(esConsumes<edm::Transition::EndRun>()) {
8  edm::LogInfo("SiStripFedCablingManipulator") << "SiStripFedCablingManipulator constructor " << std::endl;
9 }

◆ ~SiStripFedCablingManipulator()

SiStripFedCablingManipulator::~SiStripFedCablingManipulator ( )
override

Definition at line 11 of file SiStripFedCablingManipulator.cc.

11  {
12  edm::LogInfo("SiStripFedCablingManipulator")
13  << "SiStripFedCablingManipulator::~SiStripFedCablingManipulator()" << std::endl;
14 }

Member Function Documentation

◆ analyze()

void SiStripFedCablingManipulator::analyze ( const edm::Event e,
const edm::EventSetup es 
)
inlineoverridevirtual

Implements edm::EDAnalyzer.

Definition at line 22 of file SiStripFedCablingManipulator.h.

22 {};

◆ endRun()

void SiStripFedCablingManipulator::endRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 16 of file SiStripFedCablingManipulator.cc.

16  {
17  const auto& esobj = es.getData(fedCablingToken_);
18 
19  auto obj = manipulate(esobj);
20 
21  cond::Time_t Time_ = 0;
22 
23  //And now write data in DB
25  if (dbservice.isAvailable()) {
26  if (!obj) {
27  edm::LogError("SiStripFedCablingManipulator") << "null pointer obj. nothing will be written " << std::endl;
28  return;
29  }
30 
31  std::string openIovAt = iConfig_.getUntrackedParameter<std::string>("OpenIovAt", "beginOfTime");
32  if (openIovAt == "beginOfTime")
33  Time_ = dbservice->beginOfTime();
34  else if (openIovAt == "currentTime")
35  dbservice->currentTime();
36  else
37  Time_ = iConfig_.getUntrackedParameter<uint32_t>("OpenIovAtTime", 1);
38 
39  //if first time tag is populated
40  if (dbservice->isNewTagRequest("SiStripFedCablingRcd")) {
41  edm::LogInfo("SiStripFedCablingManipulator") << "first request for storing objects with Record "
42  << "SiStripFedCablingRcd"
43  << " at time " << Time_ << std::endl;
44  dbservice->createNewIOV<SiStripFedCabling>(obj.release(), Time_, dbservice->endOfTime(), "SiStripFedCablingRcd");
45  } else {
46  edm::LogInfo("SiStripFedCablingManipulator") << "appending a new object to existing tag "
47  << "SiStripFedCablingRcd"
48  << " in since mode " << std::endl;
49  dbservice->appendSinceTime<SiStripFedCabling>(obj.release(), Time_, "SiStripFedCablingRcd");
50  }
51  } else {
52  edm::LogError("SiStripFedCablingManipulator") << "Service is unavailable" << std::endl;
53  }
54 }

References cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createNewIOV(), cond::service::PoolDBOutputService::currentTime(), cond::service::PoolDBOutputService::endOfTime(), fedCablingToken_, edm::EventSetup::getData(), edm::ParameterSet::getUntrackedParameter(), iConfig_, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), manipulate(), getGTfromDQMFile::obj, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ manipulate()

std::unique_ptr< SiStripFedCabling > SiStripFedCablingManipulator::manipulate ( const SiStripFedCabling iobj)
private

Definition at line 56 of file SiStripFedCablingManipulator.cc.

56  {
58  std::unique_ptr<SiStripFedCabling> oobj;
59 
60  std::ifstream inputFile_;
61  inputFile_.open(fp.c_str());
62 
63  std::map<uint32_t, std::pair<uint32_t, uint32_t> > dcuDetIdMap;
64  uint32_t dcuid, Olddetid, Newdetid;
65 
66  // if(fp.c_str()==""){
67  if (fp.empty()) {
68  edm::LogInfo("SiStripFedCablingManipulator")
69  << "::manipulate : since no file is specified, the copy of the input cabling will be applied" << std::endl;
70  oobj = std::make_unique<SiStripFedCabling>(iobj);
71  } else if (!inputFile_.is_open()) {
72  edm::LogError("SiStripFedCablingManipulator") << "::manipulate - ERROR in opening file " << fp << std::endl;
73  throw cms::Exception("CorruptedData") << "::manipulate - ERROR in opening file " << fp << std::endl;
74  } else {
75  for (;;) {
76  inputFile_ >> dcuid >> Olddetid >> Newdetid;
77 
78  if (!(inputFile_.eof() || inputFile_.fail())) {
79  if (dcuDetIdMap.find(dcuid) == dcuDetIdMap.end()) {
80  edm::LogInfo("SiStripFedCablingManipulator") << dcuid << " " << Olddetid << " " << Newdetid << std::endl;
81 
82  dcuDetIdMap[dcuid] = std::pair<uint32_t, uint32_t>(Olddetid, Newdetid);
83  } else {
84  edm::LogError("SiStripFedCablingManipulator")
85  << "::manipulate - ERROR duplicated dcuid " << dcuid << std::endl;
86  throw cms::Exception("CorruptedData")
87  << "SiStripFedCablingManipulator::manipulate - ERROR duplicated dcuid " << dcuid;
88  break;
89  }
90  } else if (inputFile_.eof()) {
91  edm::LogInfo("SiStripFedCablingManipulator") << "::manipulate - END of file reached" << std::endl;
92  break;
93  } else if (inputFile_.fail()) {
94  edm::LogError("SiStripFedCablingManipulator") << "::manipulate - ERROR while reading file" << std::endl;
95  break;
96  }
97  }
98  inputFile_.close();
99  std::map<uint32_t, std::pair<uint32_t, uint32_t> >::const_iterator it = dcuDetIdMap.begin();
100  for (; it != dcuDetIdMap.end(); ++it)
101  edm::LogInfo("SiStripFedCablingManipulator")
102  << "::manipulate - Map " << it->first << " " << it->second.first << " " << it->second.second;
103 
104  std::vector<FedChannelConnection> conns;
105 
106  auto feds = iobj.fedIds();
107  for (auto ifeds = feds.begin(); ifeds != feds.end(); ifeds++) {
108  auto conns_per_fed = iobj.fedConnections(*ifeds);
109  for (auto iconn = conns_per_fed.begin(); iconn != conns_per_fed.end(); ++iconn) {
110  std::map<uint32_t, std::pair<uint32_t, uint32_t> >::const_iterator it = dcuDetIdMap.find(iconn->dcuId());
111  if (it != dcuDetIdMap.end() && it->second.first == iconn->detId()) {
112  edm::LogInfo("SiStripFedCablingManipulator")
113  << "::manipulate - fedid " << *ifeds << " dcuid " << iconn->dcuId() << " oldDet " << iconn->detId()
114  << " newDetID " << it->second.second;
115  conns.push_back(FedChannelConnection(iconn->fecCrate(),
116  iconn->fecSlot(),
117  iconn->fecRing(),
118  iconn->ccuAddr(),
119  iconn->ccuChan(),
120  iconn->i2cAddr(0),
121  iconn->i2cAddr(1),
122  iconn->dcuId(),
123  it->second.second, //<------ New detid
124  iconn->nApvPairs(),
125  iconn->fedId(),
126  iconn->fedCh(),
127  iconn->fiberLength(),
128  iconn->dcu(),
129  iconn->pll(),
130  iconn->mux(),
131  iconn->lld()));
132  } else {
133  conns.push_back(FedChannelConnection(iconn->fecCrate(),
134  iconn->fecSlot(),
135  iconn->fecRing(),
136  iconn->ccuAddr(),
137  iconn->ccuChan(),
138  iconn->i2cAddr(0),
139  iconn->i2cAddr(1),
140  iconn->dcuId(),
141  iconn->detId(),
142  iconn->nApvPairs(),
143  iconn->fedId(),
144  iconn->fedCh(),
145  iconn->fiberLength(),
146  iconn->dcu(),
147  iconn->pll(),
148  iconn->mux(),
149  iconn->lld()));
150  }
151  }
152  }
153 
154  oobj = std::make_unique<SiStripFedCabling>(conns);
155  }
156  return oobj;
157 }

References Exception, SiStripFedCabling::fedConnections(), SiStripFedCabling::fedIds(), l1tstage2emulator_dqm_sourceclient-live_cfg::feds, personalPlayback::fp, edm::ParameterSet::getParameter(), iConfig_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by endRun().

Member Data Documentation

◆ fedCablingToken_

edm::ESGetToken<SiStripFedCabling, SiStripFedCablingRcd> SiStripFedCablingManipulator::fedCablingToken_
private

Definition at line 30 of file SiStripFedCablingManipulator.h.

Referenced by endRun().

◆ iConfig_

edm::ParameterSet SiStripFedCablingManipulator::iConfig_
private

Definition at line 29 of file SiStripFedCablingManipulator.h.

Referenced by endRun(), and manipulate().

l1tstage2emulator_dqm_sourceclient-live_cfg.feds
feds
Definition: l1tstage2emulator_dqm_sourceclient-live_cfg.py:152
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
cond::service::PoolDBOutputService::appendSinceTime
void appendSinceTime(const T *payloadObj, cond::Time_t sinceTime, const std::string &recordName)
Definition: PoolDBOutputService.h:141
personalPlayback.fp
fp
Definition: personalPlayback.py:523
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
SiStripFedCablingManipulator::manipulate
std::unique_ptr< SiStripFedCabling > manipulate(const SiStripFedCabling &)
Definition: SiStripFedCablingManipulator.cc:56
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
SiStripFedCablingManipulator::fedCablingToken_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
Definition: SiStripFedCablingManipulator.h:30
Exception
Definition: hltDiff.cc:246
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiStripFedCabling::fedIds
FedsConstIterRange fedIds() const
Definition: SiStripFedCabling.h:154
SiStripFedCabling::fedConnections
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Definition: SiStripFedCabling.cc:160
edm::Log
Definition: MessageLogger.h:70
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:217
SiStripFedCablingManipulator::iConfig_
edm::ParameterSet iConfig_
Definition: SiStripFedCablingManipulator.h:29