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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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

void manipulate (const SiStripFedCabling *, SiStripFedCabling *&)
 

Private Attributes

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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 18 of file SiStripFedCablingManipulator.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file SiStripFedCablingManipulator.cc.

8  : iConfig_(iConfig) {
9  edm::LogInfo("SiStripFedCablingManipulator") << "SiStripFedCablingManipulator constructor " << std::endl;
10 }
SiStripFedCablingManipulator::~SiStripFedCablingManipulator ( )
override

Definition at line 12 of file SiStripFedCablingManipulator.cc.

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

Member Function Documentation

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

Definition at line 22 of file SiStripFedCablingManipulator.h.

References endRun(), manipulate(), and writedatasetfile::run.

22 {};
void SiStripFedCablingManipulator::endRun ( const edm::Run run,
const edm::EventSetup es 
)
override

Definition at line 17 of file SiStripFedCablingManipulator.cc.

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

Referenced by analyze().

17  {
19  es.get<SiStripFedCablingRcd>().get(esobj);
20 
21  SiStripFedCabling* obj = nullptr;
22  manipulate(esobj.product(), obj);
23 
24  cond::Time_t Time_ = 0;
25 
26  //And now write data in DB
28  if (dbservice.isAvailable()) {
29  if (obj == nullptr) {
30  edm::LogError("SiStripFedCablingManipulator") << "null pointer obj. nothing will be written " << std::endl;
31  return;
32  }
33 
34  std::string openIovAt = iConfig_.getUntrackedParameter<std::string>("OpenIovAt", "beginOfTime");
35  if (openIovAt == "beginOfTime")
36  Time_ = dbservice->beginOfTime();
37  else if (openIovAt == "currentTime")
38  dbservice->currentTime();
39  else
40  Time_ = iConfig_.getUntrackedParameter<uint32_t>("OpenIovAtTime", 1);
41 
42  //if first time tag is populated
43  if (dbservice->isNewTagRequest("SiStripFedCablingRcd")) {
44  edm::LogInfo("SiStripFedCablingManipulator") << "first request for storing objects with Record "
45  << "SiStripFedCablingRcd"
46  << " at time " << Time_ << std::endl;
47  dbservice->createNewIOV<SiStripFedCabling>(obj, Time_, dbservice->endOfTime(), "SiStripFedCablingRcd");
48  } else {
49  edm::LogInfo("SiStripFedCablingManipulator") << "appending a new object to existing tag "
50  << "SiStripFedCablingRcd"
51  << " in since mode " << std::endl;
52  dbservice->appendSinceTime<SiStripFedCabling>(obj, Time_, "SiStripFedCablingRcd");
53  }
54  } else {
55  edm::LogError("SiStripFedCablingManipulator") << "Service is unavailable" << std::endl;
56  }
57 }
T getUntrackedParameter(std::string const &, T const &) const
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
unsigned long long Time_t
Definition: Time.h:14
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void manipulate(const SiStripFedCabling *, SiStripFedCabling *&)
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86
void SiStripFedCablingManipulator::manipulate ( const SiStripFedCabling iobj,
SiStripFedCabling *&  oobj 
)
private

Definition at line 59 of file SiStripFedCablingManipulator.cc.

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

Referenced by analyze(), and endRun().

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

Member Data Documentation

edm::ParameterSet SiStripFedCablingManipulator::iConfig_
private

Definition at line 29 of file SiStripFedCablingManipulator.h.

Referenced by endRun(), and manipulate().