CMS 3D CMS Logo

SiStripPsuDetIdMap.h
Go to the documentation of this file.
1 #ifndef SISTRIPPSUDETIDMAP_H
2 #define SISTRIPPSUDETIDMAP_H
3 
4 #include <memory>
11 
15 #include "DeviceFactory.h"
16 
17 #include "boost/cstdint.hpp"
18 #include <vector>
19 #include <string>
20 #include <iostream>
21 #include <fstream>
22 #include <sstream>
23 #include <ostream>
24 
25 class SiStripConfigDb;
26 
34 public:
39 
40  std::vector<uint32_t> getLvDetID(std::string psu);
41  void getHvDetID(std::string psuchannel,
42  std::vector<uint32_t> &ids,
43  std::vector<uint32_t> &unmapped_ids,
44  std::vector<uint32_t> &crosstalking_ids);
45 
46  //Produces 3 list of detIDs:
47  //1-detids (positively matching the PSUChannel for HV case, positively matching the PSU for the LV case)
48  //2-unmapped_detids (matching the PSUChannel000 for the HV case, empty for LV case)
49  //3-crosstalking_detids (matching the PSUChannel999 for the HV case, empty for the LV case)
50  void getDetID(std::string pvss,
51  bool,
52  std::vector<uint32_t> &detids,
53  std::vector<uint32_t> &unmapped_detids,
54  std::vector<uint32_t> &crosstalking_detids);
56  std::string getPSUName(uint32_t detid);
58  std::string getPSUName(uint32_t detid, std::string group);
60  std::string getDetectorLocation(uint32_t detid);
64  std::string getDetectorLocation(uint32_t detid, std::string group);
66  uint32_t getDcuId(std::string pvss);
68  uint32_t getDcuId(uint32_t detid);
69 
70  //Return the HVUnmapped PSU channels as a map initialized to all channels (002/003) OFF (false):
71  std::map<std::string, std::vector<uint32_t> > getHVUnmappedMap() { return HVUnmapped_Map; }
72  //Return the HVCrosstalking PSU channels as a map initialized to all channels (002/003) OFF (false):
73  std::map<std::string, std::vector<uint32_t> > getHVCrosstalkingMap() { return HVCrosstalking_Map; }
74  //PsuDetIdMap getHVUnmappedDetIdMap() {return HVUnmapped_Map}
75  //Return the HVUnmapped PSUchannel to (HV status) map initialized to all OFF:
76  //PsuDetIdMap getHVUnmappedChannelMap() {return HVUnmapped_ChanStatus}
77  //PsuDetIdMap getHVCrosstalkingChannelMap() {return HVCrossTalking_ChanStatus}
79  std::vector<std::pair<uint32_t, std::string> > getPsuDetIdMap() { return pgMap; }
81  std::vector<std::string> getDetectorLocations() { return detectorLocations; }
83  std::vector<uint32_t> getDcuIds() { return dcuIds; }
85  std::vector<std::pair<uint32_t, std::string> > getControlPsuDetIdMap() { return cgMap; }
87  std::vector<std::string> getControlDetectorLocations() { return controlLocations; }
89  std::vector<uint32_t> getCgDcuIds() { return cgDcuIds; }
91  std::vector<uint32_t> getCcuDcuIds() { return ccuDcuIds; }
92 
94  void printMap();
96  void printControlMap();
98  //void BuildMap();
103  void BuildMap(const std::string &mapFile, const bool debug);
104  //Old "rawmap" (vector of pairs) method to be used by excludeddetids:
105  void BuildMap(const std::string &mapFile, std::vector<std::pair<uint32_t, std::string> > &rawmap);
107  void BuildMap(const std::string &mapFile,
108  const bool debug,
109  std::map<std::string, std::vector<uint32_t> > &LVmap,
110  std::map<std::string, std::vector<uint32_t> > &HVmap,
111  std::map<std::string, std::vector<uint32_t> > &HVUnmappedmap,
112  std::map<std::string, std::vector<uint32_t> > &HVCrosstalkingmap);
113 
114  //Service function to remove duplicated from vectors of detids:
115  void RemoveDuplicateDetIDs(std::vector<uint32_t> &detids);
116 
118  std::vector<std::pair<uint32_t, std::string> > getDcuPsuMap();
120  int IsHVChannel(std::string pvss);
121 
122 private:
123  // typedefs
124  typedef std::vector<TkDcuPsuMap *> DcuPsuVector;
125  typedef std::map<std::string, std::vector<uint32_t> > PsuDetIdMap;
129  void getDcuPsuMap(DcuPsusRange &pRange, DcuPsusRange &cRange, std::string partition);
131  // std::vector< std::pair<uint32_t, SiStripConfigDb::DeviceAddress> > retrieveDcuDeviceAddresses(std::string partition);
132  std::vector<std::pair<std::vector<uint16_t>, std::vector<uint32_t> > > retrieveDcuDeviceAddresses(
133  std::string partition);
135  std::vector<uint32_t> findDcuIdFromDeviceAddress(uint32_t dcuid_);
137  void clone(DcuPsuVector &input, DcuPsuVector &output);
139  // for debugging
140  void checkMapInputValues(const SiStripConfigDb::DcuDetIdsV &dcuDetIds_, const DcuPsuVector &dcuPsus_);
141 
142  // member variables
145  std::vector<std::pair<uint32_t, std::string> > pgMap, cgMap;
146  std::vector<std::string> detectorLocations, controlLocations;
147  std::vector<uint32_t> dcuIds, cgDcuIds, ccuDcuIds;
149  // std::vector< std::pair<uint32_t, SiStripConfigDb::DeviceAddress> > dcu_device_addr_vector;
150  std::vector<std::pair<std::vector<uint16_t>, std::vector<uint32_t> > > dcu_device_addr_vector;
151 };
152 #endif
void clone(DcuPsuVector &input, DcuPsuVector &output)
std::vector< std::string > getDetectorLocations()
std::map< std::string, std::vector< uint32_t > > getHVUnmappedMap()
std::vector< uint32_t > getCcuDcuIds()
std::vector< uint32_t > ccuDcuIds
std::string getPSUName(uint32_t detid)
void getDetID(std::string pvss, bool, std::vector< uint32_t > &detids, std::vector< uint32_t > &unmapped_detids, std::vector< uint32_t > &crosstalking_detids)
std::vector< std::pair< std::vector< uint16_t >, std::vector< uint32_t > > > retrieveDcuDeviceAddresses(std::string partition)
Extension to SiStripConfigDb to map PSU channels to DetIDs using DCU-PSU map and DCU-DetID map...
DcuPsus::range DcuPsusRange
std::map< std::string, std::vector< uint32_t > > PsuDetIdMap
static std::string const input
Definition: EdmProvDump.cc:48
std::vector< uint32_t > cgDcuIds
edm::Service< SiStripConfigDb > db_
int IsHVChannel(std::string pvss)
std::vector< uint32_t > dcuIds
An interface class to the DeviceFactory.
std::vector< uint32_t > getDcuIds()
std::vector< uint32_t > getLvDetID(std::string psu)
std::vector< std::pair< uint32_t, std::string > > getControlPsuDetIdMap()
std::vector< std::pair< uint32_t, std::string > > getDcuPsuMap()
std::vector< std::pair< uint32_t, std::string > > getPsuDetIdMap()
void getHvDetID(std::string psuchannel, std::vector< uint32_t > &ids, std::vector< uint32_t > &unmapped_ids, std::vector< uint32_t > &crosstalking_ids)
void RemoveDuplicateDetIDs(std::vector< uint32_t > &detids)
std::vector< uint32_t > findDcuIdFromDeviceAddress(uint32_t dcuid_)
std::vector< std::string > controlLocations
#define debug
Definition: HDRShower.cc:19
std::vector< DcuDetId > DcuDetIdsV
std::vector< std::string > detectorLocations
void BuildMap(const std::string &mapFile, const bool debug)
std::vector< uint32_t > getCgDcuIds()
std::map< std::string, std::vector< uint32_t > > getHVCrosstalkingMap()
uint32_t getDcuId(std::string pvss)
std::vector< std::pair< uint32_t, std::string > > pgMap
std::vector< TkDcuPsuMap * > DcuPsuVector
boost::iterator_range< data_iterator > range
Definition: MapOfVectors.h:34
std::string getDetectorLocation(uint32_t detid)
edm::MapOfVectors< std::string, TkDcuPsuMap * > DcuPsus
std::vector< std::pair< uint32_t, std::string > > cgMap
PsuDetIdMap HVCrosstalking_Map
std::vector< std::pair< std::vector< uint16_t >, std::vector< uint32_t > > > dcu_device_addr_vector
void checkMapInputValues(const SiStripConfigDb::DcuDetIdsV &dcuDetIds_, const DcuPsuVector &dcuPsus_)
std::vector< std::string > getControlDetectorLocations()