Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:35:43

0001 #ifndef CaloOnlineTools_HcalOnlineDb_HcalAssistant_h
0002 #define CaloOnlineTools_HcalOnlineDb_HcalAssistant_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     HcalOnlineDb
0006 // Class  :     HcalAssistant
0007 //
0008 /**\class HcalAssistant HcalAssistant.h CaloOnlineTools/HcalOnlineDb/interface/HcalAssistant.h
0009 
0010  Description: Various helper functions
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Gena Kukartsev, kukarzev@fnal.gov
0018 //         Created:  Thu Jul 16 11:39:31 CEST 2009
0019 //
0020 
0021 #include <iostream>
0022 #include <string>
0023 #include <vector>
0024 #include <map>
0025 
0026 #include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
0027 #include "DataFormats/HcalDetId/interface/HcalZDCDetId.h"
0028 
0029 #ifndef DATAFORMATS_HCALDETID_HCALSUBDETECTOR_H
0030 #define DATAFORMATS_HCALDETID_HCALSUBDETECTOR_H
0031 enum HcalSubdetector {
0032   HcalEmpty = 0,
0033   HcalBarrel = 1,
0034   HcalEndcap = 2,
0035   HcalOuter = 3,
0036   HcalForward = 4,
0037   HcalTriggerTower = 5,
0038   HcalOther = 7
0039 };
0040 enum HcalOtherSubdetector { HcalOtherEmpty = 0, HcalCalibration = 2 };
0041 #endif
0042 
0043 class HcalAssistant {
0044 public:
0045   friend class HcalChannelQualityXml;
0046 
0047   HcalAssistant();
0048   virtual ~HcalAssistant();
0049 
0050   int addQuotes();
0051   std::string getRandomQuote(void);
0052 
0053   std::string getUserName(void);
0054 
0055   HcalSubdetector getSubdetector(std::string _det);
0056   std::string getSubdetectorString(HcalSubdetector _det);
0057   HcalZDCDetId::Section getZDCSection(std::string _section);
0058   std::string getZDCSectionString(HcalZDCDetId::Section _section);
0059 
0060   int getListOfChannelsFromDb();
0061   int getSubdetector(int _rawid);
0062   int getIeta(int _rawid);
0063   int getIphi(int _rawid);
0064   int getDepth(int _rawid);
0065   int getRawId(HcalSubdetector _det, int _ieta, int _iphi, int _depth);
0066 
0067   int a_to_i(char* inbuf);
0068 
0069 private:
0070   std::vector<std::string> quotes;
0071   std::map<int, int> geom_to_rawid;  // geom hash is the hey
0072   std::map<int, int> rawid_to_geom;  // rawId is the key
0073   bool listIsRead;                   // were channels read from OMDS?
0074 
0075   //
0076   //_____ encode HCAL geometry channel in a single integer hash
0077   //      not relying on HcalDetId
0078   int getGeomId(HcalSubdetector _det, int _ieta, int _iphi, int _depth);
0079   int getHcalIeta(int _geomId);
0080   int getHcalIphi(int _geomId);
0081   int getHcalDepth(int _geomId);
0082   HcalSubdetector getHcalSubdetector(int _geomId);
0083   std::string getSubdetectorString(int _geomId);
0084   int getRawId(int _geomId);
0085   int getRawIdFromCmssw(int _geomId);
0086   int getGeomId(int _rawid);
0087 };
0088 
0089 #endif