Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-09 23:01:15

0001 #ifndef HashFunctions_h
0002 #define HashFunctions_h
0003 
0004 /**
0005  *  file:           HashFunctions.h
0006  *  Author:         Viktor Khristenko
0007  *
0008  *  Description:
0009  *      Hash accoring to various Detector Elements
0010  */
0011 
0012 #include "DQM/HcalCommon/interface/Constants.h"
0013 #include "DQM/HcalCommon/interface/HcalCommonHeaders.h"
0014 
0015 namespace hcaldqm {
0016   namespace hashfunctions {
0017     /**
0018  *  by HcalDetId
0019  */
0020     uint32_t hash_Subdet(HcalDetId const &);
0021     uint32_t hash_Subdetiphi(HcalDetId const &);
0022     uint32_t hash_Subdetieta(HcalDetId const &);
0023     uint32_t hash_Subdetdepth(HcalDetId const &);
0024     uint32_t hash_SubdetPM(HcalDetId const &);
0025     uint32_t hash_SubdetPMiphi(HcalDetId const &);
0026     uint32_t hash_iphi(HcalDetId const &);
0027     uint32_t hash_ieta(HcalDetId const &);
0028     uint32_t hash_depth(HcalDetId const &);
0029     uint32_t hash_HFPMiphi(HcalDetId const &);
0030     uint32_t hash_HBHEPartition(HcalDetId const &);
0031     uint32_t hash_DChannel(HcalDetId const &);
0032 
0033     /**
0034  *  by ElectronicsId
0035  */
0036     uint32_t hash_FED(HcalElectronicsId const &);
0037     uint32_t hash_FEDSpigot(HcalElectronicsId const &);
0038     uint32_t hash_FEDSlot(HcalElectronicsId const &);
0039     uint32_t hash_Crate(HcalElectronicsId const &);
0040     uint32_t hash_CrateSpigot(HcalElectronicsId const &);
0041     uint32_t hash_CrateSlot(HcalElectronicsId const &);
0042     uint32_t hash_Fiber(HcalElectronicsId const &);
0043     uint32_t hash_FiberFiberCh(HcalElectronicsId const &);
0044     uint32_t hash_FiberCh(HcalElectronicsId const &);
0045     uint32_t hash_Electronics(HcalElectronicsId const &);
0046     uint32_t hash_EChannel(HcalElectronicsId const &);
0047 
0048     /**
0049  *  by TrigTowerDetId
0050  */
0051     uint32_t hash_TTSubdet(HcalTrigTowerDetId const &);
0052     uint32_t hash_TTSubdetPM(HcalTrigTowerDetId const &);
0053     uint32_t hash_TTSubdetPMiphi(HcalTrigTowerDetId const &);
0054     uint32_t hash_TTSubdetieta(HcalTrigTowerDetId const &);
0055     uint32_t hash_TTdepth(HcalTrigTowerDetId const &);
0056     uint32_t hash_TChannel(HcalTrigTowerDetId const &);
0057 
0058     /**
0059  *      by Mixed ElectronicsId and TrigTowerDetId
0060  */
0061     uint32_t hash_TTSubdetFW(HcalTrigTowerDetId const &, HcalElectronicsId const &);
0062 
0063     std::string name_Subdet(HcalDetId const &);
0064     std::string name_Subdetiphi(HcalDetId const &);
0065     std::string name_Subdetieta(HcalDetId const &);
0066     std::string name_Subdetdepth(HcalDetId const &);
0067     std::string name_SubdetPM(HcalDetId const &);
0068     std::string name_SubdetPMiphi(HcalDetId const &);
0069     std::string name_iphi(HcalDetId const &);
0070     std::string name_ieta(HcalDetId const &);
0071     std::string name_depth(HcalDetId const &);
0072     std::string name_HFPMiphi(HcalDetId const &);
0073     std::string name_HBHEPartition(HcalDetId const &);
0074     std::string name_DChannel(HcalDetId const &);
0075 
0076     uint32_t hash_Subdet(std::string const &);
0077     uint32_t hash_Subdetiphi(std::string const &);
0078     uint32_t hash_Subdetieta(std::string const &);
0079     uint32_t hash_Subdetdepth(std::string const &);
0080     uint32_t hash_SubdetPM(std::string const &);
0081     uint32_t hash_SubdetPMiphi(std::string const &);
0082     uint32_t hash_iphi(std::string const &);
0083     uint32_t hash_ieta(std::string const &);
0084     uint32_t hash_depth(std::string const &);
0085     uint32_t hash_HFPMiphi(std::string const &);
0086     uint32_t hash_HBHEPartition(std::string const &);
0087     uint32_t hash_DChannel(std::string const &);
0088 
0089     std::string name_FED(HcalElectronicsId const &);
0090     std::string name_FEDSpigot(HcalElectronicsId const &);
0091     std::string name_FEDSlot(HcalElectronicsId const &);
0092     std::string name_Crate(HcalElectronicsId const &);
0093     std::string name_CrateSpigot(HcalElectronicsId const &);
0094     std::string name_CrateSlot(HcalElectronicsId const &);
0095     std::string name_Fiber(HcalElectronicsId const &);
0096     std::string name_FiberFiberCh(HcalElectronicsId const &);
0097     std::string name_FiberCh(HcalElectronicsId const &);
0098     std::string name_Electronics(HcalElectronicsId const &);
0099     std::string name_EChannel(HcalElectronicsId const &);
0100 
0101     uint32_t hash_FED(std::string const &);
0102     uint32_t hash_FEDSpigot(std::string const &);
0103     uint32_t hash_FEDSlot(std::string const &);
0104     uint32_t hash_Crate(std::string const &);
0105     uint32_t hash_CrateSpigot(std::string const &);
0106     uint32_t hash_CrateSlot(std::string const &);
0107     uint32_t hash_Fiber(std::string const &);
0108     uint32_t hash_FiberFiberCh(std::string const &);
0109     uint32_t hash_FiberCh(std::string const &);
0110     uint32_t hash_Electronics(std::string const &);
0111     uint32_t hash_EChannel(std::string const &);
0112 
0113     std::string name_TTSubdet(HcalTrigTowerDetId const &);
0114     std::string name_TTSubdetPM(HcalTrigTowerDetId const &);
0115     std::string name_TTSubdetPMiphi(HcalTrigTowerDetId const &);
0116     std::string name_TTSubdetieta(HcalTrigTowerDetId const &);
0117     std::string name_TTdepth(HcalTrigTowerDetId const &);
0118     std::string name_TChannel(HcalTrigTowerDetId const &);
0119 
0120     uint32_t hash_TTSubdet(std::string const &);
0121     uint32_t hash_TTSubdetPM(std::string const &);
0122     uint32_t hash_TTSubdetPMiphi(std::string const &);
0123     uint32_t hash_TTSubdetieta(std::string const &);
0124     uint32_t hash_TTdepth(std::string const &);
0125     uint32_t hash_TChannel(std::string const &);
0126 
0127     std::string name_TTSubdetFW(HcalTrigTowerDetId const &, HcalElectronicsId const &);
0128 
0129     uint32_t hash_TTSubdetFW(std::string const &);
0130 
0131     enum HashType {
0132       fSubdet = 0,
0133       fSubdetiphi = 1,
0134       fSubdetieta = 2,
0135       fSubdetdepth = 3,
0136       fSubdetPM = 4,
0137       fSubdetPMiphi = 5,
0138       fiphi = 6,
0139       fieta = 7,
0140       fdepth = 8,
0141       fHFPMiphi = 9,
0142       fHBHEPartition = 10,
0143       fDChannel = 11,
0144       nHashType_did = 12,
0145       fFED = 13,
0146       fFEDSpigot = 14,
0147       fFEDSlot = 15,
0148       fCrate = 16,
0149       fCrateSpigot = 17,
0150       fCrateSlot = 18,
0151       fFiber = 19,
0152       fFiberFiberCh = 20,
0153       fFiberCh = 21,
0154       fElectronics = 22,
0155       fEChannel = 23,
0156       nHashType_eid = 24,
0157       fTTSubdet = 25,
0158       fTTSubdetPM = 26,
0159       fTTSubdetPMiphi = 27,
0160       fTTSubdetieta = 28,
0161       fTTdepth = 29,
0162       fTChannel = 30,
0163       nHashType_tid = 31,
0164       fTTSubdetFW = 32,
0165       nHashType_mixid = 33,
0166       nHashType = 34
0167     };
0168     typedef uint32_t (*hash_function_did)(HcalDetId const &);
0169     typedef uint32_t (*hash_function_eid)(HcalElectronicsId const &);
0170     typedef uint32_t (*hash_function_tid)(HcalTrigTowerDetId const &);
0171     typedef uint32_t (*hash_function_mixid)(HcalTrigTowerDetId const &, HcalElectronicsId const &);
0172     typedef std::string (*name_function_did)(HcalDetId const &);
0173     typedef std::string (*name_function_eid)(HcalElectronicsId const &);
0174     typedef std::string (*name_function_tid)(HcalTrigTowerDetId const &);
0175     typedef std::string (*name_function_mixid)(HcalTrigTowerDetId const &, HcalElectronicsId const &);
0176     hash_function_did const hash_did[nHashType_did] = {hash_Subdet,
0177                                                        hash_Subdetiphi,
0178                                                        hash_Subdetieta,
0179                                                        hash_Subdetdepth,
0180                                                        hash_SubdetPM,
0181                                                        hash_SubdetPMiphi,
0182                                                        hash_iphi,
0183                                                        hash_ieta,
0184                                                        hash_depth,
0185                                                        hash_HFPMiphi,
0186                                                        hash_HBHEPartition,
0187                                                        hash_DChannel};
0188     hash_function_eid const hash_eid[nHashType_eid - nHashType_did - 1] = {hash_FED,
0189                                                                            hash_FEDSpigot,
0190                                                                            hash_FEDSlot,
0191                                                                            hash_Crate,
0192                                                                            hash_CrateSpigot,
0193                                                                            hash_CrateSlot,
0194                                                                            hash_Fiber,
0195                                                                            hash_FiberFiberCh,
0196                                                                            hash_FiberCh,
0197                                                                            hash_Electronics,
0198                                                                            hash_EChannel};
0199     hash_function_tid const hash_tid[nHashType_tid - nHashType_eid - 1] = {
0200         hash_TTSubdet, hash_TTSubdetPM, hash_TTSubdetPMiphi, hash_TTSubdetieta, hash_TTdepth, hash_TChannel};
0201     hash_function_mixid const hash_mixid[nHashType_mixid - nHashType_tid - 1] = {hash_TTSubdetFW};
0202     name_function_did const name_did[nHashType_did] = {name_Subdet,
0203                                                        name_Subdetiphi,
0204                                                        name_Subdetieta,
0205                                                        name_Subdetdepth,
0206                                                        name_SubdetPM,
0207                                                        name_SubdetPMiphi,
0208                                                        name_iphi,
0209                                                        name_ieta,
0210                                                        name_depth,
0211                                                        name_HFPMiphi,
0212                                                        name_HBHEPartition,
0213                                                        name_DChannel};
0214     name_function_eid const name_eid[nHashType_eid - nHashType_did - 1] = {name_FED,
0215                                                                            name_FEDSpigot,
0216                                                                            name_FEDSlot,
0217                                                                            name_Crate,
0218                                                                            name_CrateSpigot,
0219                                                                            name_CrateSlot,
0220                                                                            name_Fiber,
0221                                                                            name_FiberFiberCh,
0222                                                                            name_FiberCh,
0223                                                                            name_Electronics,
0224                                                                            name_EChannel};
0225     name_function_tid const name_tid[nHashType_tid - nHashType_eid - 1] = {
0226         name_TTSubdet, name_TTSubdetPM, name_TTSubdetPMiphi, name_TTSubdetieta, name_TTdepth, name_TChannel};
0227     name_function_mixid const name_mixid[nHashType_mixid - nHashType_tid - 1] = {name_TTSubdetFW};
0228     int const nhashes = nHashType_did + (nHashType_eid - nHashType_did - 1) + (nHashType_tid - nHashType_eid - 1) +
0229                         (nHashType_mixid - nHashType_tid - 1);
0230     std::string const hash_names[nhashes] = {
0231         "Subdet",    "Subdetiphi",   "Subdetieta",     "Subdetdepth",  "SubdetPM",      "SubdetPMiphi",
0232         "iphi",      "ieta",         "depth",          "HFPMiphi",     "HBHEPartition", "DChannel",
0233 
0234         "FED",       "FEDSpigot",    "FEDSlot",        "Crate",        "CrateSpigot",   "CrateSlot",
0235         "Fiber",     "FiberFiberCh", "FiberCh",        "Electronics",  "EChannel",
0236 
0237         "TTSubdet",  "TTSubdetPM",   "TTSubdetPMiphi", "TTSubdetieta", "TTdepth",       "TChannel",
0238 
0239         "TTSubdetFW"};
0240   }  // namespace hashfunctions
0241 }  // namespace hcaldqm
0242 
0243 #endif