Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:39

0001 #ifndef CondFormats_SiStripObjects_Phase2TrackerCabling_H
0002 #define CondFormats_SiStripObjects_Phase2TrackerCabling_H
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 #include <CondFormats/SiStripObjects/interface/Phase2TrackerModule.h>
0006 #include <vector>
0007 #include <algorithm>
0008 
0009 class Phase2TrackerCabling {
0010   typedef std::vector<Phase2TrackerModule> store;
0011   typedef std::vector<Phase2TrackerModule>::const_iterator key;
0012   typedef std::vector<key> cabling;
0013 
0014 public:
0015   // Constructor taking FED channel connection objects as input.
0016   Phase2TrackerCabling(const std::vector<Phase2TrackerModule>& cons);
0017 
0018   // Copy ocnstructor
0019   Phase2TrackerCabling(const Phase2TrackerCabling& src);
0020 
0021   // Default constructor
0022   Phase2TrackerCabling() {}
0023 
0024   // Default destructor
0025   virtual ~Phase2TrackerCabling() {}
0026 
0027   // Initialize the internal maps
0028   void initializeCabling();
0029 
0030   // get the list of modules
0031   const std::vector<Phase2TrackerModule>& connections() const { return connections_; }
0032 
0033   // find a connection for a given fed channel
0034   const Phase2TrackerModule& findFedCh(std::pair<unsigned int, unsigned int> fedch) const;
0035 
0036   // find a connection for a given detid
0037   const Phase2TrackerModule& findDetid(uint32_t detid) const;
0038 
0039   // find a connection for a given gbtid
0040   const Phase2TrackerModule& findGbtid(uint32_t gbtid) const;
0041 
0042   // return all the modules connected to a given cooling line
0043   Phase2TrackerCabling filterByCoolingLine(uint32_t coolingLine) const;
0044 
0045   // return all the modules connected to a given HV group
0046   Phase2TrackerCabling filterByPowerGroup(uint32_t powerGroup) const;
0047 
0048   // print a summary of the content
0049   std::string summaryDescription() const;
0050 
0051   // print the details of the content
0052   std::string description(bool compact = false) const;
0053 
0054 private:
0055   // the connections
0056   store connections_;
0057 
0058   // indices for fast searches
0059   cabling fedCabling_ COND_TRANSIENT;
0060   cabling gbtCabling_ COND_TRANSIENT;
0061   cabling detCabling_ COND_TRANSIENT;
0062 
0063 private:
0064   // sorting functions
0065   static bool chOrdering(key a, key b);
0066   static bool chComp(key a, std::pair<unsigned int, unsigned int> b);
0067   static bool fedeq(key a, key b);
0068   static bool detidOrdering(key a, key b);
0069   static bool detidComp(key a, uint32_t b);
0070   static bool gbtidOrdering(key a, key b);
0071   static bool gbtidComp(key a, uint32_t b);
0072   static bool coolingOrdering(const Phase2TrackerModule& a, const Phase2TrackerModule& b);
0073   static bool coolingComp(const Phase2TrackerModule& a, uint32_t b);
0074   static bool cooleq(const Phase2TrackerModule& a, const Phase2TrackerModule& b);
0075   static bool powerOrdering(const Phase2TrackerModule& a, const Phase2TrackerModule& b);
0076   static bool powerComp(const Phase2TrackerModule& a, uint32_t b);
0077   static bool poweq(const Phase2TrackerModule& a, const Phase2TrackerModule& b);
0078 
0079   COND_SERIALIZABLE;
0080 };
0081 
0082 #endif