Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:12

0001 #ifndef HCALTEXT2DETIDCONVERTER_H
0002 #define HCALTEXT2DETIDCONVERTER_H
0003 
0004 /** \class HcalText2DetIdConverter
0005     \author F.Ratnikov, UMd
0006    Converts any flavour of HcalDetId to/from ascii strings
0007 
0008 
0009    For Calibration DetIds:
0010 
0011    Flavor = "CALIB_[HB|HE|HO|HF]" or "HOX"
0012 
0013    fField1 is ieta (-2:2 for CALIB)
0014    fField2 is iphi
0015    fField3 is ctype (CALIB only)
0016 
0017 */
0018 #include <string>
0019 #include "DataFormats/DetId/interface/DetId.h"
0020 
0021 class HcalText2DetIdConverter {
0022 public:
0023   HcalText2DetIdConverter(const std::string& fFlavor = "NA",
0024                           const std::string& fField1 = "0",
0025                           const std::string& fField2 = "0",
0026                           const std::string& fField3 = "0");
0027 
0028   HcalText2DetIdConverter(DetId fId);
0029 
0030   bool isHcalDetId() const;
0031   bool isHcalCalibDetId() const;
0032   bool isHcalTrigTowerDetId() const;
0033   bool isHcalZDCDetId() const;
0034 
0035   const std::string& getFlavor() const { return flavorName; }
0036   const std::string& getField1() const { return field1; }
0037   const std::string& getField2() const { return field2; }
0038   const std::string& getField3() const { return field3; }
0039   DetId getId() const { return mId; }
0040   int getField(int i) const;
0041   std::string toString() const;
0042 
0043 private:
0044   bool init(const std::string& fFlavor,
0045             const std::string& fField1,
0046             const std::string& fField2,
0047             const std::string& fField3);
0048   bool init(DetId fId);
0049   void setField(int i, int fValue);
0050   std::string flavorName;
0051   std::string field1;
0052   std::string field2;
0053   std::string field3;
0054   DetId mId;
0055 };
0056 
0057 #endif