test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
35  public:
40 
41  std::vector<uint32_t> getLvDetID(std::string psu);
42  void getHvDetID(std::string psuchannel, std::vector<uint32_t> & ids, std::vector<uint32_t> & unmapped_ids, std::vector<uint32_t> & crosstalking_ids );
43 
44  //Produces 3 list of detIDs:
45  //1-detids (positively matching the PSUChannel for HV case, positively matching the PSU for the LV case)
46  //2-unmapped_detids (matching the PSUChannel000 for the HV case, empty for LV case)
47  //3-crosstalking_detids (matching the PSUChannel999 for the HV case, empty for the LV case)
48  void getDetID(std::string pvss, bool, std::vector<uint32_t> & detids,std::vector<uint32_t> & unmapped_detids,std::vector<uint32_t> & crosstalking_detids);
50  std::string getPSUName(uint32_t detid);
52  std::string getPSUName(uint32_t detid, std::string group);
54  std::string getDetectorLocation(uint32_t detid);
58  std::string getDetectorLocation(uint32_t detid, std::string group);
60  uint32_t getDcuId(std::string pvss);
62  uint32_t getDcuId(uint32_t detid);
63 
64  //Return the HVUnmapped PSU channels as a map initialized to all channels (002/003) OFF (false):
65  std::map<std::string,std::vector<uint32_t> > getHVUnmappedMap() {return HVUnmapped_Map;}
66  //Return the HVCrosstalking PSU channels as a map initialized to all channels (002/003) OFF (false):
67  std::map<std::string,std::vector<uint32_t> > getHVCrosstalkingMap() {return HVCrosstalking_Map;}
68  //PsuDetIdMap getHVUnmappedDetIdMap() {return HVUnmapped_Map}
69  //Return the HVUnmapped PSUchannel to (HV status) map initialized to all OFF:
70  //PsuDetIdMap getHVUnmappedChannelMap() {return HVUnmapped_ChanStatus}
71  //PsuDetIdMap getHVCrosstalkingChannelMap() {return HVCrossTalking_ChanStatus}
73  std::vector< std::pair<uint32_t, std::string> > getPsuDetIdMap() {return pgMap;}
75  std::vector<std::string> getDetectorLocations() {return detectorLocations;}
77  std::vector<uint32_t> getDcuIds() {return dcuIds;}
79  std::vector< std::pair<uint32_t, std::string> > getControlPsuDetIdMap() {return cgMap;}
81  std::vector<std::string> getControlDetectorLocations() {return controlLocations;}
83  std::vector<uint32_t> getCgDcuIds() {return cgDcuIds;}
85  std::vector<uint32_t> getCcuDcuIds() {return ccuDcuIds;}
86 
88  void printMap();
90  void printControlMap();
92  //void BuildMap();
97  void BuildMap( const std::string & mapFile, const bool debug );
98  //Old "rawmap" (vector of pairs) method to be used by excludeddetids:
99  void BuildMap( const std::string & mapFile, std::vector<std::pair<uint32_t,std::string> > & rawmap);
101  void BuildMap( const std::string & mapFile, const bool debug, std::map<std::string,std::vector<uint32_t> > & LVmap, std::map<std::string,std::vector<uint32_t> > & HVmap, std::map<std::string,std::vector<uint32_t> > & HVUnmappedmap, std::map<std::string,std::vector<uint32_t> > & HVCrosstalkingmap);
102 
103  //Service function to remove duplicated from vectors of detids:
104  void RemoveDuplicateDetIDs(std::vector<uint32_t> & detids);
105 
107  std::vector< std::pair<uint32_t, std::string> > getDcuPsuMap();
109  int IsHVChannel(std::string pvss);
110 
111  private:
112  // typedefs
113  typedef std::vector<TkDcuPsuMap *> DcuPsuVector ;
114  typedef std::map<std::string,std::vector<uint32_t> > PsuDetIdMap;
118  void getDcuPsuMap(DcuPsusRange &pRange, DcuPsusRange &cRange, std::string partition);
120  // std::vector< std::pair<uint32_t, SiStripConfigDb::DeviceAddress> > retrieveDcuDeviceAddresses(std::string partition);
121  std::vector< std::pair< std::vector<uint16_t> , std::vector<uint32_t> > > retrieveDcuDeviceAddresses(std::string partition);
123  std::vector<uint32_t> findDcuIdFromDeviceAddress(uint32_t dcuid_);
127  // for debugging
128  void checkMapInputValues(const SiStripConfigDb::DcuDetIdsV& dcuDetIds_, const DcuPsuVector& dcuPsus_);
129 
130  // member variables
133  std::vector< std::pair<uint32_t, std::string> > pgMap, cgMap;
134  std::vector<std::string> detectorLocations, controlLocations;
135  std::vector<uint32_t> dcuIds, cgDcuIds, ccuDcuIds;
137  // std::vector< std::pair<uint32_t, SiStripConfigDb::DeviceAddress> > dcu_device_addr_vector;
138  std::vector< std::pair< std::vector<uint16_t> , std::vector<uint32_t> > > dcu_device_addr_vector;
139 };
140 #endif
void clone(DcuPsuVector &input, DcuPsuVector &output)
std::vector< std::pair< uint32_t, std::string > > getPsuDetIdMap()
std::vector< std::string > getDetectorLocations()
std::vector< uint32_t > getCcuDcuIds()
std::vector< std::pair< std::vector< uint16_t >, std::vector< uint32_t > > > dcu_device_addr_vector
std::vector< uint32_t > ccuDcuIds
std::string getPSUName(uint32_t detid)
edm::MapOfVectors< std::string, TkDcuPsuMap * > DcuPsus
std::map< std::string, std::vector< uint32_t > > getHVCrosstalkingMap()
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...
std::map< std::string, std::vector< uint32_t > > getHVUnmappedMap()
DcuPsus::range DcuPsusRange
static std::string const input
Definition: EdmProvDump.cc:43
std::vector< uint32_t > cgDcuIds
std::vector< std::pair< uint32_t, std::string > > pgMap
edm::Service< SiStripConfigDb > db_
int IsHVChannel(std::string pvss)
std::vector< std::pair< uint32_t, std::string > > cgMap
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 > > getDcuPsuMap()
std::map< std::string, std::vector< uint32_t > > PsuDetIdMap
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
tuple group
Definition: watchdog.py:82
#define debug
Definition: HDRShower.cc:19
std::vector< DcuDetId > DcuDetIdsV
std::vector< std::string > detectorLocations
std::vector< std::pair< uint32_t, std::string > > getControlPsuDetIdMap()
void BuildMap(const std::string &mapFile, const bool debug)
std::vector< uint32_t > getCgDcuIds()
uint32_t getDcuId(std::string pvss)
std::vector< TkDcuPsuMap * > DcuPsuVector
boost::iterator_range< data_iterator > range
Definition: MapOfVectors.h:34
std::string getDetectorLocation(uint32_t detid)
PsuDetIdMap HVCrosstalking_Map
void checkMapInputValues(const SiStripConfigDb::DcuDetIdsV &dcuDetIds_, const DcuPsuVector &dcuPsus_)
std::vector< std::string > getControlDetectorLocations()