~durga/maus/rel709

« back to all changes in this revision

Viewing changes to src/common_cpp/DetModel/MAUSSD.cc

  • Committer: Durga Rajaram
  • Date: 2013-10-01 00:19:57 UTC
  • mfrom: (659.1.74 rc)
  • Revision ID: durga@fnal.gov-20131001001957-iswih60vis9rodw0
Tags: MAUS-v0.7.1
MAUS-v0.7.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *
16
16
 */
17
17
 
 
18
#include "Geant4/G4SDManager.hh"
 
19
 
18
20
#include "DetModel/MAUSSD.hh"
 
21
#include "Interface/STLUtils.hh"
19
22
 
20
23
namespace MAUS {
 
24
int MAUSSD::_uniqueID(0);
 
25
std::map<std::string, bool> MAUSSD::_hasVolumes;
21
26
 
22
27
MAUSSD::MAUSSD(MiceModule* mod)
23
 
     : G4VSensitiveDetector(mod->fullName()) {
 
28
     : G4VSensitiveDetector(namePrefix()+mod->fullName()) {
 
29
  _hasVolumes[namePrefix()] = true;
24
30
  _module = mod;
 
31
  G4SDManager::GetSDMpointer()->AddNewDetector(this);
25
32
}
26
33
 
27
34
bool MAUSSD::isHit() {
31
38
  return false;
32
39
}
33
40
 
 
41
std::string MAUSSD::namePrefix() {
 
42
  return "/"+STLUtils::ToString(_uniqueID)+"/";
 
43
}
 
44
 
 
45
void MAUSSD::ResetSDs() {
 
46
  if (_hasVolumes[namePrefix()])
 
47
      G4SDManager::GetSDMpointer()->Activate(namePrefix(), false);
 
48
  _uniqueID++;
 
49
  _hasVolumes[namePrefix()] = false;
 
50
}
34
51
}  // ends MAUS namespace