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>
10 
14 #include "DeviceFactory.h"
15 
16 #include <vector>
17 #include <string>
18 #include <iostream>
19 #include <fstream>
20 #include <sstream>
21 #include <ostream>
22 #include <cstdint>
23 
24 class SiStripConfigDb;
25 
33 public:
38 
39  std::vector<uint32_t> getLvDetID(std::string psu);
40  void getHvDetID(std::string psuchannel,
41  std::vector<uint32_t> &ids,
42  std::vector<uint32_t> &unmapped_ids,
43  std::vector<uint32_t> &crosstalking_ids);
44 
45  //Produces 3 list of detIDs:
46  //1-detids (positively matching the PSUChannel for HV case, positively matching the PSU for the LV case)
47  //2-unmapped_detids (matching the PSUChannel000 for the HV case, empty for LV case)
48  //3-crosstalking_detids (matching the PSUChannel999 for the HV case, empty for the LV case)
49  void getDetID(std::string pvss,
50  bool,
51  std::vector<uint32_t> &detids,
52  std::vector<uint32_t> &unmapped_detids,
53  std::vector<uint32_t> &crosstalking_detids);
55  std::string getPSUName(uint32_t detid);
57  std::string getPSUName(uint32_t detid, std::string group);
59  std::string getDetectorLocation(uint32_t detid);
65  uint32_t getDcuId(std::string pvss);
67  uint32_t getDcuId(uint32_t detid);
68 
69  //Return the HVUnmapped PSU channels as a map initialized to all channels (002/003) OFF (false):
70  std::map<std::string, std::vector<uint32_t> > getHVUnmappedMap() { return HVUnmapped_Map; }
71  //Return the HVCrosstalking PSU channels as a map initialized to all channels (002/003) OFF (false):
72  std::map<std::string, std::vector<uint32_t> > getHVCrosstalkingMap() { return HVCrosstalking_Map; }
73  //PsuDetIdMap getHVUnmappedDetIdMap() {return HVUnmapped_Map}
74  //Return the HVUnmapped PSUchannel to (HV status) map initialized to all OFF:
75  //PsuDetIdMap getHVUnmappedChannelMap() {return HVUnmapped_ChanStatus}
76  //PsuDetIdMap getHVCrosstalkingChannelMap() {return HVCrossTalking_ChanStatus}
78  std::vector<std::pair<uint32_t, std::string> > getPsuDetIdMap() { return pgMap; }
80  std::vector<std::string> getDetectorLocations() { return detectorLocations; }
82  std::vector<uint32_t> getDcuIds() { return dcuIds; }
84  std::vector<std::pair<uint32_t, std::string> > getControlPsuDetIdMap() { return cgMap; }
86  std::vector<std::string> getControlDetectorLocations() { return controlLocations; }
88  std::vector<uint32_t> getCgDcuIds() { return cgDcuIds; }
90  std::vector<uint32_t> getCcuDcuIds() { return ccuDcuIds; }
91 
93  void printMap();
95  void printControlMap();
97  //void BuildMap();
102  void BuildMap(const std::string &mapFile, const bool debug);
103  //Old "rawmap" (vector of pairs) method to be used by excludeddetids:
104  void BuildMap(const std::string &mapFile, std::vector<std::pair<uint32_t, std::string> > &rawmap);
106  void BuildMap(const std::string &mapFile,
107  const bool debug,
108  std::map<std::string, std::vector<uint32_t> > &LVmap,
109  std::map<std::string, std::vector<uint32_t> > &HVmap,
110  std::map<std::string, std::vector<uint32_t> > &HVUnmappedmap,
111  std::map<std::string, std::vector<uint32_t> > &HVCrosstalkingmap);
112 
113  //Service function to remove duplicated from vectors of detids:
114  void RemoveDuplicateDetIDs(std::vector<uint32_t> &detids);
115 
117  std::vector<std::pair<uint32_t, std::string> > getDcuPsuMap();
119  int IsHVChannel(std::string pvss);
120 
121 private:
122  // typedefs
123  typedef std::vector<TkDcuPsuMap *> DcuPsuVector;
124  typedef std::map<std::string, std::vector<uint32_t> > PsuDetIdMap;
130  // std::vector< std::pair<uint32_t, SiStripConfigDb::DeviceAddress> > retrieveDcuDeviceAddresses(std::string partition);
131  std::vector<std::pair<std::vector<uint16_t>, std::vector<uint32_t> > > retrieveDcuDeviceAddresses(
134  std::vector<uint32_t> findDcuIdFromDeviceAddress(uint32_t dcuid_);
138  // for debugging
139  void checkMapInputValues(const SiStripConfigDb::DcuDetIdsV &dcuDetIds_, const DcuPsuVector &dcuPsus_);
140 
141  // member variables
144  std::vector<std::pair<uint32_t, std::string> > pgMap, cgMap;
145  std::vector<std::string> detectorLocations, controlLocations;
146  std::vector<uint32_t> dcuIds, cgDcuIds, ccuDcuIds;
148  // std::vector< std::pair<uint32_t, SiStripConfigDb::DeviceAddress> > dcu_device_addr_vector;
149  std::vector<std::pair<std::vector<uint16_t>, std::vector<uint32_t> > > dcu_device_addr_vector;
150 };
151 #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:50
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
Definition: output.py:1
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()