CMS 3D CMS Logo

DDG4SensitiveConverter.cc
Go to the documentation of this file.
2 
5 
6 #include "G4LogicalVolume.hh"
7 
8 using std::string;
9 using std::vector;
10 
12 
14 
16 
17  LogDebug("SimG4CoreGeometry") <<" DDG4SensitiveConverter::upDate() starts" ;
19 
20  for (unsigned int i=0; i<ddg4s.size(); i++) {
21  DDG4Dispatchable * ddg4 = ddg4s[i];
22  const DDLogicalPart * part = (ddg4->getDDLogicalPart());
23  G4LogicalVolume * result = (ddg4->getG4LogicalVolume());
24 
25  std::string sClassName = getString("SensitiveDetector",part);
26  std::string sROUName = getString("ReadOutName",part);
27  std::string fff = result->GetName();
28  if (sClassName != "NotFound") {
29  LogDebug("SimG4CoreGeometry") << " DDG4SensitiveConverter: Sensitive " << fff
30  << " Class Name " << sClassName << " ROU Name " << sROUName ;
31  fff = result->GetName();
32  catalog.insert(sClassName,sROUName,fff);
33  }
34  }
35  return catalog;
36 }
37 
39  const DDLogicalPart * part) {
40  std::vector<std::string> temp;
41  DDValue val(s);
42  std::vector<const DDsvalues_type *> result = part->specifics();
43  std::vector<const DDsvalues_type *>::iterator it = result.begin();
44  bool foundIt = false;
45  for (; it != result.end(); ++it) {
46  foundIt = DDfetch(*it,val);
47  if (foundIt) break;
48  }
49  if (foundIt) {
50  temp = val.strings();
51  if (temp.size() != 1) {
52  edm::LogError("SimG4CoreGeometry") << "DDG4SensitiveConverter - ERROR: I need 1 " << s << " tags" ;
53  throw cms::Exception("SimG4CoreGeometry", " DDG4SensitiveConverter::getString Problem with Region tags - one and only one allowed: " + s);
54  }
55  return temp[0];
56  }
57  return "NotFound";
58 }
59 
#define LogDebug(id)
std::vector< DDG4Dispatchable * > DDG4DispContainer
const DDLogicalPart * getDDLogicalPart() const
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
void insert(const std::string &, const std::string &, const std::string &)
std::vector< const DDsvalues_type * > specifics(void) const
returns the specific-data attached to the LogicalPart only (not to a DDExpandedNode) ...
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
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:61
G4LogicalVolume * getG4LogicalVolume() const
part
Definition: HCALResponse.h:20
SensitiveDetectorCatalog upDate(const DDG4DispContainer &ddg4s)