Loading...
Searching...
No Matches
EventAction.hh
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//
27/// \file B5/include/EventAction.hh
28/// \brief Definition of the B5::EventAction class
29
30#ifndef B5EventAction_h
31#define B5EventAction_h 1
32
33#include "Constants.hh"
34
35#include "G4UserEventAction.hh"
36#include "globals.hh"
37
38#include <vector>
39#include <array>
40
41// named constants
42const G4int kEm = 0;
43const G4int kHad = 1;
44const G4int kH1 = 0;
45const G4int kH2 = 1;
46const G4int kDim = 2;
47
48namespace B5
49{
50
51/// Event action
52
53class EventAction : public G4UserEventAction
54{
55public:
57 ~EventAction() override = default;
58
59 void BeginOfEventAction(const G4Event*) override;
60 void EndOfEventAction(const G4Event*) override;
61
62 std::vector<G4double>& GetEmCalEdep() { return fCalEdep[kEm]; }
63 std::vector<G4double>& GetHadCalEdep() { return fCalEdep[kHad]; }
64
65private:
66 // hit collections Ids
67 std::array<G4int, kDim> fHodHCID = { -1, -1 };
68 std::array<G4int, kDim> fDriftHCID = { -1, -1 };
69 std::array<G4int, kDim> fCalHCID = { -1, -1 };
70 // histograms Ids
71 std::array<std::array<G4int, kDim>, kDim> fDriftHistoID
72 {{ {{ -1, -1 }}, {{ -1, -1 }} }};
73 // std::array<T, N> is an aggregate that contains a C array.
74 // To initialize it, we need outer braces for the class itself
75 // and inner braces for the C array
76 // energy deposit in calorimeters cells
77 std::array<std::vector<G4double>, kDim> fCalEdep
78 {{ std::vector<G4double>(kNofEmCells, 0.), std::vector<G4double>(kNofHadCells, 0.) }};
79};
80
81}
82
83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84
85#endif
Definition of B5 example constants.
const G4int kEm
const G4int kH1
const G4int kHad
const G4int kH2
const G4int kDim
std::array< G4int, kDim > fDriftHCID
std::vector< G4double > & GetHadCalEdep()
std::vector< G4double > & GetEmCalEdep()
std::array< std::vector< G4double >, kDim > fCalEdep
~EventAction() override=default
void EndOfEventAction(const G4Event *) override
std::array< std::array< G4int, kDim >, kDim > fDriftHistoID
std::array< G4int, kDim > fCalHCID
std::array< G4int, kDim > fHodHCID
void BeginOfEventAction(const G4Event *) override
constexpr G4int kNofHadCells
Definition Constants.hh:46
constexpr G4int kNofEmCells
Definition Constants.hh:43

Applications | User Support | Publications | Collaboration