Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
parallel/TopC/ParN04/src/ExN04CalorimeterSD.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: ExN04CalorimeterSD.cc 78055 2013-12-03 08:27:48Z gcosmo $
27 //
28 /// \file parallel/ParN04/src/ExN04CalorimeterSD.cc
29 /// \brief Implementation of the ExN04CalorimeterSD class
30 //
31 
32 #include "ExN04CalorimeterSD.hh"
33 #include "ExN04CalorimeterHit.hh"
34 #include "G4VPhysicalVolume.hh"
35 #include "G4LogicalVolume.hh"
36 #include "G4Track.hh"
37 #include "G4Step.hh"
38 #include "G4ParticleDefinition.hh"
39 #include "G4VTouchable.hh"
40 #include "G4TouchableHistory.hh"
41 #include "G4SystemOfUnits.hh"
42 #include "G4ios.hh"
43 
46  numberOfCellsInZ(20),numberOfCellsInPhi(48)
47 {
48  G4String HCname;
49  collectionName.insert(HCname="calCollection");
50 }
51 
53 {;}
54 
56 {
57  CalCollection = new ExN04CalorimeterHitsCollection
59  for(G4int j=0;j<numberOfCellsInZ;j++)
60  for(G4int k=0;k<numberOfCellsInPhi;k++)
61  {
62  CellID[j][k] = -1;
63  }
64  verboseLevel = 0;
65 }
66 
68 {
69  if(!ROhist) return false;
70  G4double edep = aStep->GetTotalEnergyDeposit();
71  if(verboseLevel>1) G4cout << "Next step edep(MeV) = " << edep/MeV << G4endl;
72  if(edep==0.) return false;
73 
74  G4VPhysicalVolume* physVol = ROhist->GetVolume();
75  //ROhist->MoveUpHistory();
76  //G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
77  G4int copyIDinZ = ROhist->GetReplicaNumber();
78  G4int copyIDinPhi = ROhist->GetReplicaNumber(1);
79 
80  if(CellID[copyIDinZ][copyIDinPhi]==-1)
81  {
82  ExN04CalorimeterHit* calHit
84  (physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi);
85  calHit->SetEdep( edep );
86  G4AffineTransform aTrans = ROhist->GetHistory()->GetTopTransform();
87  aTrans.Invert();
88  calHit->SetPos(aTrans.NetTranslation());
89  calHit->SetRot(aTrans.NetRotation());
90  G4int icell = CalCollection->insert( calHit );
91  CellID[copyIDinZ][copyIDinPhi] = icell - 1;
92  if(verboseLevel>0)
93  { G4cout << " New Calorimeter Hit on CellID "
94  << copyIDinZ << " " << copyIDinPhi << G4endl; }
95  }
96  else
97  {
98  (*CalCollection)[CellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep);
99  if(verboseLevel>0)
100  { G4cout << " Energy added to CellID "
101  << copyIDinZ << " " << copyIDinPhi << G4endl; }
102  }
103 
104  return true;
105 }
106 
108 {
109  static G4int HCID = -1;
110  if(HCID<0)
111  { HCID = GetCollectionID(0); }
112  HCE->AddHitsCollection( HCID, CalCollection );
113 }
114 
116 {
117 }
118 
120 {
121 }
122 
124 {
125 }
126 
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4THitsCollection< ExN04CalorimeterHit > ExN04CalorimeterHitsCollection
G4ThreeVector NetTranslation() const
const XML_Char * name
int G4int
Definition: G4Types.hh:78
virtual G4int GetCollectionID(G4int i)
G4AffineTransform & Invert()
G4GLOB_DLL std::ostream G4cout
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
bool G4bool
Definition: G4Types.hh:79
G4int GetReplicaNumber(G4int depth=0) const
Definition: G4Step.hh:76
G4double GetTotalEnergyDeposit() const
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
G4RotationMatrix NetRotation() const
G4LogicalVolume * GetLogicalVolume() const
#define G4endl
Definition: G4ios.hh:61
const G4AffineTransform & GetTopTransform() const
G4CollectionNameVector collectionName
const G4NavigationHistory * GetHistory() const
double G4double
Definition: G4Types.hh:76