![]() |
![]() |
00001 #include "SimG4Core/Geometry/interface/SensitiveDetectorCatalog.h" 00002 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00003 00004 #define DEBUG 00005 00006 #include <iostream> 00007 00008 void SensitiveDetectorCatalog::insert(std::string& cN, std::string& rN, 00009 std::string& lvN) { 00010 theClassNameMap[cN].push_back(rN); 00011 theROUNameMap[rN].push_back(lvN); 00012 #ifdef DEBUG 00013 LogDebug("SimG4CoreGeometry") << "SenstiveDetectorCatalog: insert (" << cN 00014 << "," << rN << "," << lvN << ")\n" 00015 << " has " 00016 << readoutNames().size() << " ROUs " 00017 << readoutNames().front() << "\n" 00018 << " has " 00019 << classNames().size() << " classes " 00020 << classNames().front(); 00021 #endif 00022 } 00023 00024 std::vector<std::string> SensitiveDetectorCatalog::readoutNames() { 00025 std::vector<std::string> temp; 00026 for (MapType::const_iterator it = theROUNameMap.begin(); 00027 it != theROUNameMap.end(); it++) 00028 temp.push_back(it->first); 00029 return temp; 00030 } 00031 00032 std::vector<std::string> SensitiveDetectorCatalog::readoutNames(std::string & className) { 00033 return theClassNameMap[className]; 00034 } 00035 00036 std::vector<std::string> SensitiveDetectorCatalog::logicalNames(std::string & readoutName) { 00037 return theROUNameMap[readoutName]; 00038 } 00039 00040 std::vector<std::string> SensitiveDetectorCatalog::logicalNamesFromClassName(std::string & className) { 00041 std::vector<std::string> temp; 00042 std::vector<std::string> rous = theClassNameMap[className]; 00043 for (std::vector<std::string>::const_iterator it = rous.begin(); 00044 it!= rous.end(); it++) 00045 temp.push_back(*it); 00046 return temp; 00047 } 00048 00049 std::string SensitiveDetectorCatalog::className(std::string & readoutName) { 00050 for (MapType::const_iterator it = theClassNameMap.begin(); 00051 it != theClassNameMap.end(); it++) { 00052 std::vector<std::string> temp = (*it).second; 00053 for (std::vector<std::string>::const_iterator it2 = temp.begin(); 00054 it2!=temp.end(); it2++) { 00055 if (*it2 == readoutName ) return (*it).first; 00056 } 00057 } 00058 return "NotFound"; 00059 } 00060 00061 std::vector<std::string> SensitiveDetectorCatalog::classNames() { 00062 std::vector<std::string> temp; 00063 for (MapType::const_iterator it = theClassNameMap.begin(); 00064 it != theClassNameMap.end(); it++) 00065 temp.push_back(it->first); 00066 return temp; 00067 }