Go to the documentation of this file.00001 #ifndef SISTRIPPSUDETIDMAP_H
00002 #define SISTRIPPSUDETIDMAP_H
00003
00004 #include <memory>
00005 #include "FWCore/ServiceRegistry/interface/Service.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "DataFormats/Common/interface/Handle.h"
00009 #include "FWCore/Framework/interface/EventSetup.h"
00010 #include "DataFormats/Common/interface/MapOfVectors.h"
00011
00012 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00013 #include "OnlineDB/SiStripConfigDb/interface/SiStripConfigDb.h"
00014 #include "OnlineDB/SiStripConfigDb/interface/SiStripDbParams.h"
00015 #include "DeviceFactory.h"
00016
00017 #include "boost/cstdint.hpp"
00018 #include <vector>
00019 #include <string>
00020 #include <iostream>
00021 #include <fstream>
00022 #include <sstream>
00023 #include <ostream>
00024
00025 class SiStripConfigDb;
00026
00033 class SiStripPsuDetIdMap
00034 {
00035 public:
00037 SiStripPsuDetIdMap();
00039 ~SiStripPsuDetIdMap();
00040
00041 std::vector<uint32_t> getLvDetID(std::string psu);
00042 void getHvDetID(std::string psuchannel, std::vector<uint32_t> & ids, std::vector<uint32_t> & unmapped_ids, std::vector<uint32_t> & crosstalking_ids );
00043
00044
00045
00046
00047
00048 void getDetID(std::string pvss, bool, std::vector<uint32_t> & detids,std::vector<uint32_t> & unmapped_detids,std::vector<uint32_t> & crosstalking_detids);
00050 std::string getPSUName(uint32_t detid);
00052 std::string getPSUName(uint32_t detid, std::string group);
00054 std::string getDetectorLocation(uint32_t detid);
00056 std::string getDetectorLocation(std::string pvss);
00058 std::string getDetectorLocation(uint32_t detid, std::string group);
00060 uint32_t getDcuId(std::string pvss);
00062 uint32_t getDcuId(uint32_t detid);
00063
00064
00065 std::map<std::string,std::vector<uint32_t> > getHVUnmappedMap() {return HVUnmapped_Map;}
00066
00067 std::map<std::string,std::vector<uint32_t> > getHVCrosstalkingMap() {return HVCrosstalking_Map;}
00068
00069
00070
00071
00073 std::vector< std::pair<uint32_t, std::string> > getPsuDetIdMap() {return pgMap;}
00075 std::vector<std::string> getDetectorLocations() {return detectorLocations;}
00077 std::vector<uint32_t> getDcuIds() {return dcuIds;}
00079 std::vector< std::pair<uint32_t, std::string> > getControlPsuDetIdMap() {return cgMap;}
00081 std::vector<std::string> getControlDetectorLocations() {return controlLocations;}
00083 std::vector<uint32_t> getCgDcuIds() {return cgDcuIds;}
00085 std::vector<uint32_t> getCcuDcuIds() {return ccuDcuIds;}
00086
00088 void printMap();
00090 void printControlMap();
00092
00097 void BuildMap( const std::string & mapFile, const bool debug );
00098
00099 void BuildMap( const std::string & mapFile, std::vector<std::pair<uint32_t,std::string> > & rawmap);
00101 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);
00102
00103
00104 void RemoveDuplicateDetIDs(std::vector<uint32_t> & detids);
00105
00107 std::vector< std::pair<uint32_t, std::string> > getDcuPsuMap();
00109 int IsHVChannel(std::string pvss);
00110
00111 private:
00112
00113 typedef std::vector<TkDcuPsuMap *> DcuPsuVector ;
00114 typedef std::map<std::string,std::vector<uint32_t> > PsuDetIdMap;
00115 typedef edm::MapOfVectors<std::string,TkDcuPsuMap*> DcuPsus;
00116 typedef DcuPsus::range DcuPsusRange;
00118 void getDcuPsuMap(DcuPsusRange &pRange, DcuPsusRange &cRange, std::string partition);
00120
00121 std::vector< std::pair< std::vector<uint16_t> , std::vector<uint32_t> > > retrieveDcuDeviceAddresses(std::string partition);
00123 std::vector<uint32_t> findDcuIdFromDeviceAddress(uint32_t dcuid_);
00125 void clone(DcuPsuVector &input, DcuPsuVector &output);
00127
00128 void checkMapInputValues(SiStripConfigDb::DcuDetIdsV dcuDetIds_, DcuPsuVector dcuPsus_);
00129
00130
00131 edm::Service<SiStripConfigDb> db_;
00132 PsuDetIdMap LVMap, HVMap, HVUnmapped_Map, HVCrosstalking_Map;
00133 std::vector< std::pair<uint32_t, std::string> > pgMap, cgMap;
00134 std::vector<std::string> detectorLocations, controlLocations;
00135 std::vector<uint32_t> dcuIds, cgDcuIds, ccuDcuIds;
00136 DcuPsus DcuPsuMapPG_, DcuPsuMapCG_;
00137
00138 std::vector< std::pair< std::vector<uint16_t> , std::vector<uint32_t> > > dcu_device_addr_vector;
00139 };
00140 #endif