CMS 3D CMS Logo

Public Member Functions

AttachSD Class Reference

#include <AttachSD.h>

List of all members.

Public Member Functions

 AttachSD ()
std::pair< std::vector
< SensitiveTkDetector * >
, std::vector
< SensitiveCaloDetector * > > 
create (const DDDWorld &w, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *m, SimActivityRegistry &reg) const
 ~AttachSD ()

Detailed Description

Definition at line 13 of file AttachSD.h.


Constructor & Destructor Documentation

AttachSD::AttachSD ( )

Definition at line 17 of file AttachSD.cc.

{}
AttachSD::~AttachSD ( )

Definition at line 19 of file AttachSD.cc.

{}

Member Function Documentation

std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > AttachSD::create ( const DDDWorld w,
const DDCompactView cpv,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager m,
SimActivityRegistry reg 
) const

Definition at line 23 of file AttachSD.cc.

References SensitiveDetectorCatalog::className(), className(), reco::get(), LogDebug, SensitiveDetectorCatalog::readoutNames(), and cond::rpcobtemp::temp.

Referenced by RunManager::initG4(), and GeometryProducer::produce().

{
  std::pair< std::vector<SensitiveTkDetector *>,
    std::vector<SensitiveCaloDetector*> > detList;
//#ifdef DEBUG
  //cout << " Initializing AttachSD " << endl;
  LogDebug("SimG4CoreSensitiveDetector") << " AttachSD: Initializing" ;
//#endif
  std::vector<std::string> rouNames = clg.readoutNames();
  for (std::vector<std::string>::iterator it = rouNames.begin();
       it != rouNames.end(); it++) {
    std::string className = clg.className(*it);
    //std::cout<<" trying to find something for "<<className<<" " <<*it<<std::endl;
    edm::LogInfo("SimG4CoreSensitiveDetector") << " AttachSD: trying to find something for " << className << " "  << *it ;
    std::auto_ptr<SensitiveDetectorMakerBase> temp(
                                                   SensitiveDetectorPluginFactory::get()->create(className) );
    std::auto_ptr<SensitiveTkDetector> tkDet;
    std::auto_ptr<SensitiveCaloDetector> caloDet;
    temp->make(*it,cpv,clg,p,m,reg,tkDet,caloDet);
    if(tkDet.get()){
      detList.first.push_back(tkDet.get());
      tkDet.release();
    }
    if(caloDet.get()){
      detList.second.push_back(caloDet.get());
      caloDet.release();
    }
//#ifdef DEBUG
    // cout << " AttachSD: created a " << className << " with name " << *it << endl;
    LogDebug("SimG4CoreSensitiveDetector") << " AttachSD: created a " << className << " with name " << *it ;
    //#endif
  }      
  return detList;
}