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

#include <ExGflashEventAction.hh>

Inheritance diagram for ExGflashEventAction:
G4UserEventAction

Public Member Functions

 ExGflashEventAction ()
 
 ~ExGflashEventAction ()
 
void BeginOfEventAction (const G4Event *)
 
void EndOfEventAction (const G4Event *)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManager * fpEventManager
 

Detailed Description

Definition at line 39 of file ExGflashEventAction.hh.

Constructor & Destructor Documentation

ExGflashEventAction::ExGflashEventAction ( )

Definition at line 49 of file ExGflashEventAction.cc.

49  :
50 fNevent(0),fDtime(0.0),fCalorimeterCollectionId(-1)
51 {
52 }
ExGflashEventAction::~ExGflashEventAction ( )

Definition at line 54 of file ExGflashEventAction.cc.

References G4cout, and G4endl.

55 {
56  if ( fNevent > 0 ) G4cout << "Internal Real Elapsed Time /event is: "<< fDtime /fNevent<< G4endl;
57 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Member Function Documentation

void ExGflashEventAction::BeginOfEventAction ( const G4Event *  evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 60 of file ExGflashEventAction.cc.

References G4cout, G4endl, G4Event::GetEventID(), and G4Timer::Start().

61 {
62  fTimerIntern.Start();
63  G4cout<<" ------ Start ExGflashEventAction ----- "<<G4endl;
64  fNevent=evt->GetEventID();
65  G4cout<<" Start generating event Nr "<<fNevent<<G4endl<<G4endl;
66 }
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void Start()
void ExGflashEventAction::EndOfEventAction ( const G4Event *  evt)
virtual

Hits in sensitive Detector

Computing (x,y,z) of vertex of initial particles

For all Hits in sensitive detector

Reimplemented from G4UserEventAction.

Definition at line 68 of file ExGflashEventAction.cc.

References CLHEP::Hep3Vector::cross(), G4TrajectoryContainer::entries(), G4THitsCollection< T >::entries(), G4cout, G4endl, G4SDManager::GetCollectionID(), G4HCofThisEvent::GetHC(), G4Event::GetHCofThisEvent(), G4PrimaryParticle::GetMomentum(), G4PrimaryVertex::GetPosition(), G4PrimaryVertex::GetPrimary(), G4Event::GetPrimaryVertex(), G4Timer::GetRealElapsed(), G4SDManager::GetSDMpointer(), G4Timer::GetSystemElapsed(), G4Event::GetTrajectoryContainer(), G4Timer::GetUserElapsed(), python.hepunit::GeV, CLHEP::Hep3Vector::mag(), G4INCL::Math::max(), G4Timer::Stop(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

69 {
70  fTimerIntern.Stop();
71  G4cout << G4endl;
72  G4cout << "******************************************";
73  G4cout << G4endl;
74  G4cout << "Internal Real Elapsed Time is: "<< fTimerIntern.GetRealElapsed();
75  G4cout << G4endl;
76  G4cout << "Internal System Elapsed Time: " << fTimerIntern.GetSystemElapsed();
77  G4cout << G4endl;
78  G4cout << "Internal GetUserElapsed Time: " << fTimerIntern.GetUserElapsed();
79  G4cout << G4endl;
80  G4cout << "******************************************"<< G4endl;
81  fDtime+=fTimerIntern.GetRealElapsed();
82  G4cout<<" ------ ExGflashEventAction::End of event nr. "<<fNevent<<" -----"<< G4endl;
83 
85  G4String colNam;
86  fCalorimeterCollectionId=SDman->GetCollectionID(colNam="ExGflashCollection");
87  if (fCalorimeterCollectionId<0) return;
88  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
89  ExGflashHitsCollection* THC = 0;
90  G4double totE = 0;
91  // Read out of the crysta ECAL
92  THC=(ExGflashHitsCollection *)(HCE->GetHC(fCalorimeterCollectionId));
93  if (THC)
94  {
95  /// Hits in sensitive Detector
96  int n_hit = THC->entries();
97  G4cout<<" " << n_hit<< " hits are stored in ExGflashHitsCollection "<<G4endl;
98  G4PrimaryVertex* pvertex=evt->GetPrimaryVertex();
99  ///Computing (x,y,z) of vertex of initial particles
100  G4ThreeVector vtx=pvertex->GetPosition();
101  G4PrimaryParticle* pparticle=pvertex->GetPrimary();
102  // direction of the Shower
103  G4ThreeVector mom=pparticle->GetMomentum()/pparticle->GetMomentum().mag();
104 
105  //@@@ ExGflashEventAction: Magicnumber
106  G4double energyincrystal[100];
107  for (int i=0;i<100;i++) energyincrystal[i]=0.;
108 
109  //@@@ ExGflashEventAction: Magicnumber
110  /// For all Hits in sensitive detector
111  for (int i=0;i<n_hit;i++)
112  {
113  G4double estep = (*THC)[i]->GetEdep()/GeV;
114  if (estep >0.0)
115  {
116  totE += (*THC)[i]->GetEdep()/GeV;
117  G4int num=(*THC)[i]->GetCrystalNum();
118 
119  energyincrystal[num]+=(*THC)[i]->GetEdep()/GeV;
120  //G4cout << num << G4endl;
121  // G4cout << " Crystal Nummer " << (*THC)[i]->GetCrystalNum() << G4endl;
122  // G4cout << (*THC)[i]->GetCrystalNum() /10 <<
123  // " "<<(*THC)[i]->GetCrystalNum()%10 << G4endl;
124 
125  G4ThreeVector hitpos=(*THC)[i]->GetPos();
126  G4ThreeVector l (hitpos.x(), hitpos.y(), hitpos.z());
127  // distance from shower start
128  l = l - vtx;
129  // projection on shower axis = longitudinal profile
130  G4ThreeVector longitudinal = l;
131  // shower profiles (Radial)
132  G4ThreeVector radial = vtx.cross(l);
133  }
134  }
135  G4double max = 0;
136  G4int index = 0;
137  //Find crystal with maximum energy
138  for (int i=0;i<100;i++)
139  {
140  //G4cout << i <<" " << energyincrystal[i] << G4endl;
141  if (max <energyincrystal[i])
142  {
143  max=energyincrystal[i];
144  index = i;
145  }
146  }
147  //G4cout << index <<" NMAX " << index << G4endl;
148 
149  // 3x3 matrix of crystals around the crystal with the maximum energy deposit
150  G4double e3x3 =
151  energyincrystal[index]+energyincrystal[index+1]+energyincrystal[index-1]+
152  energyincrystal[index-10]+energyincrystal[index-9]+energyincrystal[index-11]+
153  energyincrystal[index+10]+energyincrystal[index+11]+energyincrystal[index+9];
154 
155  // 5x5 matrix of crystals around the crystal with the maximum energy deposit
156  G4double e5x5 =
157  energyincrystal[index]+energyincrystal[index+1]+energyincrystal[index-1]+
158  energyincrystal[index+2]+energyincrystal[index-2]+
159  energyincrystal[index-10]+energyincrystal[index-9]+energyincrystal[index-11]+
160  energyincrystal[index-8]+energyincrystal[index-12]+
161  energyincrystal[index+10]+energyincrystal[index+11]+energyincrystal[index+9]+
162  energyincrystal[index+12]+energyincrystal[index+8];
163 
164  G4cout << " e1 " << energyincrystal[index]
165  << " e3x3 " << e3x3<< " GeV e5x5 " <<e5x5 <<G4endl;
166  }
167 
168  G4cout << " Total energy deposited in the calorimeter: " << totE << " (GeV)" << G4endl;
169  G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
170  G4int n_trajectories = 0;
171  if(trajectoryContainer){ n_trajectories = trajectoryContainer->entries(); }
172  G4cout << " " << n_trajectories << " trajectories stored in this event." << G4endl;
173 
174 }
G4ThreeVector GetMomentum() const
G4double GetSystemElapsed() const
Definition: G4Timer.cc:119
G4ThreeVector GetPosition() const
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
double x() const
int G4int
Definition: G4Types.hh:78
G4TrajectoryContainer * GetTrajectoryContainer() const
Definition: G4Event.hh:178
double z() const
G4PrimaryParticle * GetPrimary(G4int i=0) const
G4GLOB_DLL std::ostream G4cout
G4double GetUserElapsed() const
Definition: G4Timer.cc:130
G4PrimaryVertex * GetPrimaryVertex(G4int i=0) const
Definition: G4Event.hh:156
G4double GetRealElapsed() const
Definition: G4Timer.cc:107
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void Stop()
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
double y() const
#define G4endl
Definition: G4ios.hh:61
Hep3Vector cross(const Hep3Vector &) const
G4HCofThisEvent * GetHCofThisEvent() const
Definition: G4Event.hh:174
double G4double
Definition: G4Types.hh:76
double mag() const

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