CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDG4SensitiveConverter.cc
Go to the documentation of this file.
3 
6 
7 #include "G4LogicalVolume.hh"
8 
9 using std::string;
10 using std::vector;
11 using std::cout;
12 using std::endl;
13 
15 
17 
19 
20  LogDebug("SimG4CoreGeometry") <<" DDG4SensitiveConverter::upDate() starts" ;
22 
23  for (unsigned int i=0; i<ddg4s.size(); i++) {
24  DDG4Dispatchable * ddg4 = ddg4s[i];
25  const DDLogicalPart * part = (ddg4->getDDLogicalPart());
26  G4LogicalVolume * result = (ddg4->getG4LogicalVolume());
27 
28  std::string sClassName = getString("SensitiveDetector",part);
29  std::string sROUName = getString("ReadOutName",part);
30  std::string fff = result->GetName();
31  if (sClassName != "NotFound") {
32  LogDebug("SimG4CoreGeometry") << " DDG4SensitiveConverter: Sensitive " << fff
33  << " Class Name " << sClassName << " ROU Name " << sROUName ;
34  fff = result->GetName();
35  catalog.insert(sClassName,sROUName,fff);
36  }
37  }
38  return catalog;
39 }
40 
41 std::string DDG4SensitiveConverter::getString(const std::string & s,
42  const DDLogicalPart * part) {
43  std::vector<std::string> temp;
44  DDValue val(s);
45  std::vector<const DDsvalues_type *> result = part->specifics();
46  std::vector<const DDsvalues_type *>::iterator it = result.begin();
47  bool foundIt = false;
48  for (; it != result.end(); ++it) {
49  foundIt = DDfetch(*it,val);
50  if (foundIt) break;
51  }
52  if (foundIt) {
53  temp = val.strings();
54  if (temp.size() != 1) {
55  edm::LogError("SimG4CoreGeometry") << "DDG4SensitiveConverter - ERROR: I need 1 " << s << " tags" ;
56  throw SimG4Exception("DDG4SensitiveConverter: Problem with Region tags: one and only one is allowed");
57  }
58  return temp[0];
59  }
60  return "NotFound";
61 }
62 
#define LogDebug(id)
void insert(std::string &, std::string &, std::string &)
int i
Definition: DBlmapReader.cc:9
std::vector< DDG4Dispatchable * > DDG4DispContainer
const DDLogicalPart * getDDLogicalPart() const
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:102
std::vector< const DDsvalues_type * > specifics(void) const
returns the specific-data attached to the LogicalPart only (not to a DDExpandedNode) ...
tuple result
Definition: query.py:137
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
std::string getString(const std::string &, const DDLogicalPart *)
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
Definition: DDValue.h:71
G4LogicalVolume * getG4LogicalVolume() const
part
Definition: HCALResponse.h:21
SensitiveDetectorCatalog upDate(const DDG4DispContainer &ddg4s)
tuple cout
Definition: gather_cfg.py:121