Geant4  10.02.p02
CCalSteppingAction.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 //
27 // File: CCalSeppingAction.cc
28 // Description: Study profiling during the steps
30 #include <iostream>
31 #include <cmath>
32 
33 #include "CCalSteppingAction.hh"
34 
35 #include "G4SystemOfUnits.hh"
36 #include "G4SDManager.hh"
37 #include "G4StepPoint.hh"
38 #include "G4ThreeVector.hh"
39 
40 #include "CCalAnalysis.hh"
41 
42 
43 
45 
47  timeHistoMaxBin=analysis->maxbin();
48 
49  int i;
50  for (i=0; i<200; i++) {timeDeposit[i] = 0.;}
51  for (i=0; i<70; i++) {LateralProfile[i] = 0.;}
52 
53 }
54 
55 
57  G4cout << "CCalSteppingAction deleted" << G4endl;
58 }
59 
60 
62 
63  G4StepPoint* PostStepPoint= aStep->GetPostStepPoint();
64  G4StepPoint* PreStepPoint= aStep->GetPreStepPoint();
65  int TSliceID;
66 
67  if ( PostStepPoint->GetGlobalTime() / nanosecond > 1.0E9 ) TSliceID = 999999999;
68  else TSliceID = static_cast<int>( PostStepPoint->GetGlobalTime() / nanosecond );
69  TSliceID = TSliceID<timeHistoMaxBin ? TSliceID : timeHistoMaxBin-1;
70  timeDeposit[TSliceID] += aStep->GetTotalEnergyDeposit() / GeV;
71 
72  G4ThreeVector HitPoint = 0.5*(PostStepPoint->GetPosition()+
73  PreStepPoint->GetPosition());
74  // Because the beam axis has been defined as the x-axis,
75  // the lateral displacement is given in terms of the y and z positions.
76  double perp = std::sqrt(HitPoint.y()*HitPoint.y()+HitPoint.z()*HitPoint.z());
77  int radialPosition = std::min(69,int(perp/cm));
78  LateralProfile[radialPosition] += aStep->GetTotalEnergyDeposit() / GeV;
79 
80 }
81 
82 
84 
87  analysis->InsertTime(timeDeposit);
88 
89  int i=0;
90  for (i=0; i<70; i++){LateralProfile[i] = 0.;}
91  for (i=0; i<200; i++){timeDeposit[i] = 0.;}
92 
93  G4cout << " --- End of event --- " << G4endl;
94 
95 }
static const double cm
Definition: G4SIunits.hh:118
CLHEP::Hep3Vector G4ThreeVector
G4StepPoint * GetPreStepPoint() const
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetPosition() const
static const double GeV
Definition: G4SIunits.hh:214
Definition: G4Step.hh:76
void InsertLateralProfile(float *)
G4double GetTotalEnergyDeposit() const
static const double nanosecond
Definition: G4SIunits.hh:157
Defines the format which is used for the output file default is a ROOT file. Comment the g4root and u...
Definition: CCalAnalysis.hh:44
G4StepPoint * GetPostStepPoint() const
static CCalAnalysis * getInstance()
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
#define G4endl
Definition: G4ios.hh:61
G4double GetGlobalTime() const
virtual void UserSteppingAction(const G4Step *aStep)
void InsertTime(float *)