Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
GammaRayTelCalorimeterSD Class Reference

#include <GammaRayTelCalorimeterSD.hh>

Inheritance diagram for GammaRayTelCalorimeterSD:
G4VSensitiveDetector

Public Member Functions

 GammaRayTelCalorimeterSD (G4String)
 
 ~GammaRayTelCalorimeterSD ()
 
void Initialize (G4HCofThisEvent *)
 
G4bool ProcessHits (G4Step *astep, G4TouchableHistory *ROHist)
 
void EndOfEvent (G4HCofThisEvent *)
 
void clear ()
 
void DrawAll ()
 
void PrintAll ()
 
- Public Member Functions inherited from G4VSensitiveDetector
 G4VSensitiveDetector (G4String name)
 
 G4VSensitiveDetector (const G4VSensitiveDetector &right)
 
virtual ~G4VSensitiveDetector ()
 
const G4VSensitiveDetectoroperator= (const G4VSensitiveDetector &right)
 
G4int operator== (const G4VSensitiveDetector &right) const
 
G4int operator!= (const G4VSensitiveDetector &right) const
 
G4bool Hit (G4Step *aStep)
 
void SetROgeometry (G4VReadOutGeometry *value)
 
void SetFilter (G4VSDFilter *value)
 
G4int GetNumberOfCollections () const
 
G4String GetCollectionName (G4int id) const
 
void SetVerboseLevel (G4int vl)
 
void Activate (G4bool activeFlag)
 
G4bool isActive () const
 
G4String GetName () const
 
G4String GetPathName () const
 
G4String GetFullPathName () const
 
G4VReadOutGeometryGetROgeometry () const
 
G4VSDFilterGetFilter () const
 
virtual G4VSensitiveDetectorClone () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VSensitiveDetector
virtual G4int GetCollectionID (G4int i)
 
- Protected Attributes inherited from G4VSensitiveDetector
G4CollectionNameVector collectionName
 
G4String SensitiveDetectorName
 
G4String thePathName
 
G4String fullPathName
 
G4int verboseLevel
 
G4bool active
 
G4VReadOutGeometryROgeometry
 
G4VSDFilterfilter
 

Detailed Description

Definition at line 51 of file GammaRayTelCalorimeterSD.hh.

Constructor & Destructor Documentation

GammaRayTelCalorimeterSD::GammaRayTelCalorimeterSD ( G4String  name)

Definition at line 52 of file GammaRayTelCalorimeterSD.cc.

References G4VSensitiveDetector::collectionName, GammaRayTelDetectorConstruction::GetNbOfCALBars(), GammaRayTelDetectorConstruction::GetNbOfCALLayers(), G4RunManager::GetRunManager(), G4RunManager::GetUserDetectorConstruction(), and G4CollectionNameVector::insert().

53 {
55  Detector =
57 
58  NbOfCALBars = Detector->GetNbOfCALBars();
59  NbOfCALLayers = Detector->GetNbOfCALLayers();
60 
61  //G4cout << NbOfCALBars << " bars " << G4endl;
62  //G4cout << NbOfCALLayers << " layers " << G4endl;
63 
64  NbOfCALChannels = NbOfCALBars*NbOfCALLayers;
65 
66  ChitXID = new G4int[NbOfCALChannels];
67  ChitYID = new G4int[NbOfCALChannels];
68  collectionName.insert("CalorimeterCollection");
69 }
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
int G4int
Definition: G4Types.hh:78
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
G4VSensitiveDetector(G4String name)
G4CollectionNameVector collectionName
GammaRayTelCalorimeterSD::~GammaRayTelCalorimeterSD ( )

Definition at line 73 of file GammaRayTelCalorimeterSD.cc.

74 {
75  delete [] ChitXID;
76  delete [] ChitYID;
77 }

Member Function Documentation

void GammaRayTelCalorimeterSD::clear ( void  )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 192 of file GammaRayTelCalorimeterSD.cc.

193 {}
void GammaRayTelCalorimeterSD::DrawAll ( void  )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 197 of file GammaRayTelCalorimeterSD.cc.

198 {}
void GammaRayTelCalorimeterSD::EndOfEvent ( G4HCofThisEvent HCE)
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 172 of file GammaRayTelCalorimeterSD.cc.

References G4HCofThisEvent::AddHitsCollection(), G4VSensitiveDetector::collectionName, G4SDManager::GetCollectionID(), and G4SDManager::GetSDMpointer().

173 {
174  static G4int HCID = -1;
175  if(HCID<0)
176  {
178  }
179  HCE->AddHitsCollection(HCID,CalorimeterCollection);
180 
181 
182  for (G4int i=0;i<NbOfCALChannels;i++)
183  {
184  ChitXID[i] = -1;
185  ChitYID[i] = -1;
186  };
187 }
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
int G4int
Definition: G4Types.hh:78
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4CollectionNameVector collectionName
void GammaRayTelCalorimeterSD::Initialize ( G4HCofThisEvent )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 81 of file GammaRayTelCalorimeterSD.cc.

References G4VSensitiveDetector::collectionName, and G4VSensitiveDetector::SensitiveDetectorName.

82 {
83  CalorimeterCollection = new GammaRayTelCalorimeterHitsCollection
85  for (G4int i=0;i<NbOfCALChannels;i++)
86  {
87  ChitXID[i] = -1;
88  ChitYID[i] = -1;
89  };
90 }
int G4int
Definition: G4Types.hh:78
G4THitsCollection< GammaRayTelCalorimeterHit > GammaRayTelCalorimeterHitsCollection
G4CollectionNameVector collectionName
void GammaRayTelCalorimeterSD::PrintAll ( void  )
virtual

Reimplemented from G4VSensitiveDetector.

Definition at line 202 of file GammaRayTelCalorimeterSD.cc.

203 {}
G4bool GammaRayTelCalorimeterSD::ProcessHits ( G4Step astep,
G4TouchableHistory ROHist 
)
virtual

Implements G4VSensitiveDetector.

Definition at line 94 of file GammaRayTelCalorimeterSD.cc.

References GammaRayTelCalorimeterHit::AddEnergy(), G4VPhysicalVolume::GetCopyNo(), G4VPhysicalVolume::GetName(), G4StepPoint::GetPosition(), G4Step::GetPreStepPoint(), G4Step::GetTotalEnergyDeposit(), G4StepPoint::GetTouchable(), G4TouchableHistory::GetVolume(), G4THitsCollection< T >::insert(), python.hepunit::keV, GammaRayTelCalorimeterHit::SetCALBarNumber(), GammaRayTelCalorimeterHit::SetCALPlaneNumber(), GammaRayTelCalorimeterHit::SetCALType(), and GammaRayTelCalorimeterHit::SetPos().

95 {
96 
97  G4double edep = aStep->GetTotalEnergyDeposit();
98  if ((edep/keV == 0.)) return false;
99 
100  // This TouchableHistory is used to obtain the physical volume
101  // of the hit
102  G4TouchableHistory* theTouchable
103  = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
104 
105  G4VPhysicalVolume* cal_bar = theTouchable->GetVolume();
106  G4VPhysicalVolume* cal_plane = theTouchable->GetVolume(1);
107 
108  G4int CALBarNumber=cal_bar->GetCopyNo();
109  G4String CALBarName = cal_bar->GetName();
110 
111  G4int PlaneNumber = 0;
112  PlaneNumber=cal_plane->GetCopyNo();
113  G4String PlaneName = cal_plane->GetName();
114 
115 
116  G4int NChannel = 0;
117 
118  NChannel = PlaneNumber * NbOfCALBars + CALBarNumber;
119 
120  if (PlaneName == "CALLayerX" )
121 
122  // The hit is on an X CsI plane
123 
124  {
125  // This is a new hit
126  if (ChitXID[NChannel]==-1)
127  {
129  CalorimeterHit->SetCALType(1);
130  CalorimeterHit->AddEnergy(edep);
131  CalorimeterHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
132  CalorimeterHit->SetCALPlaneNumber(PlaneNumber);
133  CalorimeterHit->SetCALBarNumber(CALBarNumber);
134  ChitXID[NChannel] =
135  CalorimeterCollection->insert(CalorimeterHit) -1;
136  }
137  else // This is not new
138  {
139  (*CalorimeterCollection)
140  [ChitXID[NChannel]]->AddEnergy(edep);
141  }
142  }
143 
144  if (PlaneName == "CALLayerY")
145  // The hit is on an Y CsI plane
146  {
147  // This is a new hit
148  if (ChitYID[NChannel]==-1)
149  {
150  GammaRayTelCalorimeterHit* CalorimeterHit
152  CalorimeterHit->SetCALType(0);
153  CalorimeterHit->AddEnergy(edep);
154  CalorimeterHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
155  CalorimeterHit->SetCALPlaneNumber(PlaneNumber);
156  CalorimeterHit->SetCALBarNumber(CALBarNumber);
157  ChitYID[NChannel] =
158  CalorimeterCollection->insert(CalorimeterHit)-1;
159  }
160  else // This is not new
161  {
162  (*CalorimeterCollection)
163  [ChitYID[NChannel]]->AddEnergy(edep);
164  }
165  }
166 
167  return true;
168 }
G4VPhysicalVolume * GetVolume(G4int depth=0) const
int G4int
Definition: G4Types.hh:78
const G4String & GetName() const
virtual G4int GetCopyNo() const =0
double G4double
Definition: G4Types.hh:76

The documentation for this class was generated from the following files: