Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:47

0001 #ifndef SimG4CMS_Calo_CaloDetInfo_H
0002 #define SimG4CMS_Calo_CaloDetInfo_H
0003 #include <iostream>
0004 #include <string>
0005 #include <vector>
0006 #include "G4ThreeVector.hh"
0007 #include "G4VSolid.hh"
0008 
0009 class CaloDetInfo {
0010 public:
0011   CaloDetInfo(uint32_t id,
0012               uint32_t depth,
0013               double rho,
0014               const std::string& name,
0015               G4ThreeVector pos,
0016               const G4VSolid* sol,
0017               bool flag = false);
0018   CaloDetInfo();
0019   CaloDetInfo(const CaloDetInfo&);
0020   ~CaloDetInfo() = default;
0021 
0022   uint32_t id() const { return id_; }
0023   uint32_t depth() const { return depth_; }
0024   double rho() const { return rho_; }
0025   std::string name() const { return name_; }
0026   G4ThreeVector pos() const { return pos_; }
0027   const G4VSolid* solid() const { return solid_; }
0028   bool flag() const { return flag_; }
0029 
0030   bool operator<(const CaloDetInfo& info) const;
0031 
0032 private:
0033   uint32_t id_;
0034   uint32_t depth_;
0035   double rho_;
0036   std::string name_;
0037   G4ThreeVector pos_;
0038   const G4VSolid* solid_;
0039   bool flag_;
0040 };
0041 
0042 class CaloDetInfoLess {
0043 public:
0044   bool operator()(const CaloDetInfo* a, const CaloDetInfo* b) {
0045     if (a->id() == b->id()) {
0046       if (a->depth() == b->depth()) {
0047         return (a->rho() < b->rho());
0048       } else {
0049         return (a->depth() < b->depth());
0050       }
0051     } else {
0052       return (a->id() < b->id());
0053     }
0054   }
0055   bool operator()(const CaloDetInfo a, const CaloDetInfo b) {
0056     if (a.id() == b.id()) {
0057       if (a.depth() == b.depth()) {
0058         return (a.rho() < b.rho());
0059       } else {
0060         return (a.depth() < b.depth());
0061       }
0062     } else {
0063       return (a.id() < b.id());
0064     }
0065   }
0066 };
0067 
0068 std::ostream& operator<<(std::ostream&, const CaloDetInfo&);
0069 #endif