CMS 3D CMS Logo

Public Member Functions | Private Member Functions

DDG4SensitiveConverter Class Reference

#include <DDG4SensitiveConverter.h>

List of all members.

Public Member Functions

 DDG4SensitiveConverter ()
SensitiveDetectorCatalog upDate (const DDG4DispContainer &ddg4s)
virtual ~DDG4SensitiveConverter ()

Private Member Functions

std::string getString (const std::string &, const DDLogicalPart *)

Detailed Description

Definition at line 12 of file DDG4SensitiveConverter.h.


Constructor & Destructor Documentation

DDG4SensitiveConverter::DDG4SensitiveConverter ( )

Definition at line 14 of file DDG4SensitiveConverter.cc.

{}
DDG4SensitiveConverter::~DDG4SensitiveConverter ( ) [virtual]

Definition at line 16 of file DDG4SensitiveConverter.cc.

{}

Member Function Documentation

std::string DDG4SensitiveConverter::getString ( const std::string &  s,
const DDLogicalPart part 
) [private]

Definition at line 41 of file DDG4SensitiveConverter.cc.

References DDfetch(), query::result, DDLogicalPart::specifics(), DDValue::strings(), and groupFilesInBlocks::temp.

Referenced by upDate().

                                                                          {
  std::vector<std::string> temp;
  DDValue val(s);
  std::vector<const DDsvalues_type *> result = part->specifics();
  std::vector<const DDsvalues_type *>::iterator it = result.begin();
  bool foundIt = false;
  for (; it != result.end(); ++it) {
    foundIt = DDfetch(*it,val);
    if (foundIt) break;
  }    
  if (foundIt) { 
    temp = val.strings(); 
    if (temp.size() != 1) {
      edm::LogError("SimG4CoreGeometry") << "DDG4SensitiveConverter - ERROR: I need 1 " << s << " tags" ;
      throw SimG4Exception("DDG4SensitiveConverter: Problem with Region tags: one and only one is allowed");
    }
    return temp[0]; 
  }
  return "NotFound";
}
SensitiveDetectorCatalog DDG4SensitiveConverter::upDate ( const DDG4DispContainer ddg4s)

Definition at line 18 of file DDG4SensitiveConverter.cc.

References validate_alignment_devdb10_cfg::catalog, DDG4Dispatchable::getDDLogicalPart(), DDG4Dispatchable::getG4LogicalVolume(), getString(), i, SensitiveDetectorCatalog::insert(), LogDebug, and query::result.

Referenced by DDG4Builder::BuildGeometry().

                                                                                       {

  LogDebug("SimG4CoreGeometry") <<" DDG4SensitiveConverter::upDate() starts" ;
  SensitiveDetectorCatalog catalog;

  for (unsigned int i=0; i<ddg4s.size(); i++)  {
    DDG4Dispatchable * ddg4 = ddg4s[i];
    const DDLogicalPart * part   = (ddg4->getDDLogicalPart());
    G4LogicalVolume *     result = (ddg4->getG4LogicalVolume());
  
    std::string sClassName = getString("SensitiveDetector",part);
    std::string sROUName   = getString("ReadOutName",part);
    std::string fff        = result->GetName();
    if (sClassName != "NotFound") {
      LogDebug("SimG4CoreGeometry") << " DDG4SensitiveConverter: Sensitive " << fff
                                    << " Class Name " << sClassName << " ROU Name " << sROUName ;           
      fff = result->GetName();
      catalog.insert(sClassName,sROUName,fff);
    }
  }
  return catalog;
}