00001 #ifndef G4DataHelpers_TH2DE_H
00002 #define G4DataHelpers_TH2DE_H
00003
00004
00005
00006
00007
00011
00012 #include "G4DataHelpers/ITouchableToDetectorElement.h"
00013 #include "GaudiAlg/GaudiTool.h"
00014
00015 #include <string>
00016 #include <vector>
00017 #include <map>
00018
00019 class TH2DE : public GaudiTool, virtual ITouchableToDetectorElement
00020 {
00021 public:
00022 TH2DE(const std::string& type,
00023 const std::string& name,
00024 const IInterface* parent);
00025 virtual ~TH2DE();
00026
00027 virtual StatusCode GetBestDetectorElement(const G4TouchableHistory* inHistory,
00028 const std::vector<std::string>& ,
00029 const IDetectorElement* &outElement,
00030 int& outCompatibility);
00031
00032 virtual StatusCode G4VolumeToDetDesc(const G4VPhysicalVolume* inVol,
00033 const IPVolume* &outVol);
00034
00035 virtual StatusCode ClearCache();
00036
00037 private:
00038
00039 typedef std::pair<std::string,std::string> LvPvPair_t;
00040 typedef std::vector<LvPvPair_t> NameHistory_t;
00041 typedef std::vector<G4VPhysicalVolume*> TouchableHistory_t;
00042 typedef std::map<TouchableHistory_t,const IDetectorElement*> THCache_t;
00043 typedef std::map<const G4VPhysicalVolume*,const IPVolume*> PVCache_t;
00044 THCache_t m_THcache;
00045 PVCache_t m_PVcache;
00046
00047
00048 const IDetectorElement* FindChildDE(const IDetectorElement* de, NameHistory_t& name_history);
00049 const IDetectorElement* FindDE(const IDetectorElement* de, NameHistory_t& name_history);
00050 int InHistory(const IDetectorElement* de, const NameHistory_t& name_history);
00051
00052 const IDetectorElement* CheckCache(const G4TouchableHistory* g4hist);
00053
00054 };
00055
00056
00057 #endif // G4DataHelpers_TH2DE_H