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)
 
void endRun (const edm::Run &run, const edm::EventSetup &es)
 
 SiStripFedCablingManipulator (const edm::ParameterSet &iConfig)
 
 ~SiStripFedCablingManipulator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 &)
 
- 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 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 ( )

Definition at line 13 of file SiStripFedCablingManipulator.cc.

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

Member Function Documentation

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

Definition at line 24 of file SiStripFedCablingManipulator.h.

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

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

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(), NULL, MuonAssociatorByHits_cfi::obj, edm::ESHandle< T >::product(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

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

Definition at line 57 of file SiStripFedCablingManipulator.cc.

References Exception, SiStripFedCabling::fedConnections(), SiStripFedCabling::fedIds(), edm::ParameterSet::getParameter(), iConfig_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze(), and endRun().

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

Referenced by endRun(), and manipulate().