Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:01:23

0001 #ifndef Fireworks_Core_FWGeometryTableManager_h
0002 #define Fireworks_Core_FWGeometryTableManager_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWGeometryTableManager
0007 //
0008 /**\class FWGeometryTableManager FWGeometryTableManager.h Fireworks/Core/interface/FWGeometryTableManager.h
0009 
0010  Description: [one line class summary]
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:
0018 //         Created:  Wed Jan  4 20:34:22 CET 2012
0019 //
0020 
0021 #include "Fireworks/Core/interface/FWGeometryTableManagerBase.h"
0022 #include <string>
0023 #include <unordered_map>
0024 
0025 class FWGeometryTableViewBase;
0026 class FWGeometryTableView;
0027 
0028 #include "TGeoVolume.h"
0029 
0030 class FWGeometryTableManager : public FWGeometryTableManagerBase {
0031 public:
0032   enum ECol { kNameColumn, kColorColumn, kTranspColumn, kVisSelfColumn, kVisChildColumn, kMaterialColumn, kNumColumn };
0033 
0034   enum GeometryBits { kMatches = BIT(5), kChildMatches = BIT(6), kFilterCached = BIT(7) };
0035 
0036   struct Match {
0037     bool m_matches;
0038     bool m_childMatches;
0039     Match() : m_matches(false), m_childMatches(false) {}
0040 
0041     bool accepted() const { return m_matches || m_childMatches; }
0042   };
0043 
0044   typedef std::unordered_map<TGeoVolume*, Match> Volumes_t;
0045   typedef Volumes_t::iterator Volumes_i;
0046 
0047   FWGeometryTableManager(FWGeometryTableView*);
0048   ~FWGeometryTableManager() override;
0049 
0050   void recalculateVisibility() override;
0051   void recalculateVisibilityNodeRec(int);
0052   void recalculateVisibilityVolumeRec(int);
0053   // geo
0054   void loadGeometry(TGeoNode* iGeoTopNode, TObjArray* iVolumes);
0055   void checkChildMatches(TGeoVolume* v, std::vector<TGeoVolume*>&);
0056   void importChildren(int parent_idx);
0057   void checkHierarchy();
0058 
0059   // signal callbacks
0060   void updateFilter(int);
0061   void printMaterials();
0062 
0063   void setDaughtersSelfVisibility(int i, bool v) override;
0064   void setVisibility(NodeInfo& nodeInfo, bool) override;
0065   void setVisibilityChld(NodeInfo& nodeInfo, bool) override;
0066 
0067   bool getVisibilityChld(const NodeInfo& nodeInfo) const override;
0068   bool getVisibility(const NodeInfo& nodeInfo) const override;
0069 
0070   void assertNodeFilterCache(NodeInfo& data);
0071 
0072   int numberOfColumns() const override { return kNumColumn; }
0073   FWTableCellRendererBase* cellRenderer(int iSortedRowNumber, int iCol) const override;
0074 
0075   void checkRegionOfInterest(double* center, double radius, long algo);
0076   void resetRegionOfInterest();
0077 
0078 protected:
0079   bool nodeIsParent(const NodeInfo&) const override;
0080   //   virtual FWGeometryTableManagerBase::ESelectionState nodeSelectionState(int) const;
0081   const char* cellName(const NodeInfo& data) const override;
0082 
0083 public:
0084   FWGeometryTableManager(const FWGeometryTableManager&) = delete;                   // stop default
0085   const FWGeometryTableManager& operator=(const FWGeometryTableManager&) = delete;  // stop default
0086 
0087 private:
0088   FWGeometryTableView* m_browser;
0089 
0090   mutable Volumes_t m_volumes;
0091 
0092   bool m_filterOff;  //cached
0093 };
0094 
0095 #endif