ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_FastCaloSim
ISF_FastCaloSimParametrization
ISF_FastCaloSimParametrization
FCS_Cell.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef FCS_Cell
6
#define FCS_Cell
7
#include <vector>
8
#include <cmath>
//std::abs
9
#include <algorithm>
//std::sort, std::remove_if
10
#include <Rtypes.h>
11
#include <TLorentzVector.h>
12
/******************************************
13
This contains structure definition
14
All structures are relatively simple
15
each matched cell remembers - cell properties + vector of g4hits in this cell + vector of FCS hits in this cell
16
17
Technicalities - needs a Linkdef.h file + makefile to create the dictionary for ROOT
18
then the last class could be saved in to the TTree
19
20
******************************************/
21
22
struct
FCS_cell
23
{
24
Long64_t
cell_identifier
{};
25
int
sampling
{};
26
float
energy
{};
27
float
center_x
{};
28
float
center_y
{};
29
float
center_z
{};
//to be updated later
30
bool
operator<
(
const
FCS_cell
&rhs)
const
{
return
energy
> rhs.
energy
;};
31
};
32
33
struct
FCS_hit
//this is the FCS detailed hit
34
{
35
Long64_t
identifier
{};
//hit in the same tile cell can have two identifiers (for two PMTs)
36
Long64_t
cell_identifier
{};
37
int
sampling
{};
//calorimeter layer
38
float
hit_energy
{};
//energy is already scaled for the sampling fraction
39
float
hit_time
{};
40
float
hit_x
{};
41
float
hit_y
{};
42
float
hit_z
{};
43
bool
operator<
(
const
FCS_hit
&rhs)
const
{
return
hit_energy
> rhs.
hit_energy
;};
44
};
45
46
struct
FCS_g4hit
//this is the standard G4Hit
47
{
48
Long64_t
identifier
{};
49
Long64_t
cell_identifier
{};
50
int
sampling
{};
51
float
hit_energy
{};
52
float
hit_time
{};
53
bool
operator<
(
const
FCS_g4hit
&rhs)
const
{
return
hit_energy
> rhs.
hit_energy
;};
54
};
55
56
struct
FCS_matchedcell
//this is the matched structure for a single cell
57
{
58
FCS_cell
cell
;
59
std::vector<FCS_g4hit>
g4hit
;
60
std::vector<FCS_hit>
hit
;
61
inline
void
clear
() {
g4hit
.clear();
hit
.clear();};
62
inline
float
scalingfactor
(){
float
hitsum =0.;
for
(
unsigned
int
i=0; i<
hit
.size(); i++){hitsum+=
hit
[i].hit_energy;};
return
cell
.energy/hitsum;};
//doesn't check for 0!
63
bool
operator<
(
const
FCS_matchedcell
&rhs)
const
{
return
cell
.energy > rhs.
cell
.
energy
;};
64
inline
void
sorthit
() {
std::sort
(
hit
.begin(),
hit
.end());};
65
inline
void
sortg4hit
() {
std::sort
(
g4hit
.begin(),
g4hit
.end());};
66
inline
void
sort
() {
sorthit
();
sortg4hit
();};
67
inline
void
time_trim
(
float
timing_cut) {
hit
.erase(
std::remove_if
(
hit
.begin(),
hit
.end(), [&timing_cut](
const
FCS_hit
&rhs) { return rhs.hit_time>timing_cut;}),
hit
.end());
g4hit
.erase(
std::remove_if
(
g4hit
.begin(),
g4hit
.end(), [&timing_cut](
const
FCS_g4hit
&rhs) { return rhs.hit_time>timing_cut;}),
g4hit
.end());};
68
};
69
70
struct
FCS_matchedcellvector
//this is the matched structure for the whole event (or single layer) - vector of FCS_matchedcell
71
{
72
//Note that struct can have methods
73
//Note the overloaded operator(s) to access the underlying vector
74
std::vector<FCS_matchedcell>
m_vector
;
75
inline
std::vector<FCS_matchedcell>
GetLayer
(
int
layer){std::vector<FCS_matchedcell> ret;
for
(
unsigned
i=0; i<
m_vector
.size(); i++) {
if
(
m_vector
[i].cell.sampling == layer) ret.push_back(
m_vector
[i]);};
return
ret;};
76
inline
FCS_matchedcell
operator[]
(
unsigned
int
place) {
return
m_vector
[place];};
77
inline
unsigned
int
size
() {
return
m_vector
.size();};
78
inline
void
push_back
(
const
FCS_matchedcell
& cell) {
m_vector
.push_back(cell);};
79
inline
void
sort_cells
() {
std::sort
(
m_vector
.begin(),
m_vector
.end());};
80
inline
void
sort
() {
std::sort
(
m_vector
.begin(),
m_vector
.end());
for
(
unsigned
int
i=0; i<
m_vector
.size(); i++) {
m_vector
[i].sort();};};
81
inline
void
time_trim
(
float
timing_cut)
82
{
for
(
unsigned
int
i=0; i<
m_vector
.size(); i++) {
m_vector
[i].time_trim(timing_cut); };
m_vector
.erase(
std::remove_if
(
m_vector
.begin(),
m_vector
.end(), [] (
const
FCS_matchedcell
&rhs) { return (rhs.hit.size()==0 && rhs.g4hit.size() ==0 && std::fabs(rhs.cell.energy)<1e-3);}),
m_vector
.end());};
83
inline
float
scalingfactor
(){
float
cellsum=0.;
float
hitsum=0.;
for
(
unsigned
int
i=0; i<
m_vector
.size(); i++){cellsum+=
m_vector
[i].cell.energy;
for
(
unsigned
int
j=0; j<
m_vector
[i].hit.size(); j++){hitsum+=
m_vector
[i].hit[j].hit_energy;};};
return
cellsum/hitsum;};
//doesn't check for 0!
84
};
85
86
87
#endif
88
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
std::remove_if
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.
Definition
DVL_algorithms.h:70
FCS_cell
Definition
FCS_Cell.h:23
FCS_cell::energy
float energy
Definition
FCS_Cell.h:26
FCS_cell::center_x
float center_x
Definition
FCS_Cell.h:27
FCS_cell::sampling
int sampling
Definition
FCS_Cell.h:25
FCS_cell::center_y
float center_y
Definition
FCS_Cell.h:28
FCS_cell::cell_identifier
Long64_t cell_identifier
Definition
FCS_Cell.h:24
FCS_cell::operator<
bool operator<(const FCS_cell &rhs) const
Definition
FCS_Cell.h:30
FCS_cell::center_z
float center_z
Definition
FCS_Cell.h:29
FCS_g4hit
Definition
FCS_Cell.h:47
FCS_g4hit::sampling
int sampling
Definition
FCS_Cell.h:50
FCS_g4hit::operator<
bool operator<(const FCS_g4hit &rhs) const
Definition
FCS_Cell.h:53
FCS_g4hit::hit_time
float hit_time
Definition
FCS_Cell.h:52
FCS_g4hit::cell_identifier
Long64_t cell_identifier
Definition
FCS_Cell.h:49
FCS_g4hit::identifier
Long64_t identifier
Definition
FCS_Cell.h:48
FCS_g4hit::hit_energy
float hit_energy
Definition
FCS_Cell.h:51
FCS_hit
Definition
FCS_Cell.h:34
FCS_hit::hit_time
float hit_time
Definition
FCS_Cell.h:39
FCS_hit::hit_z
float hit_z
Definition
FCS_Cell.h:42
FCS_hit::hit_x
float hit_x
Definition
FCS_Cell.h:40
FCS_hit::identifier
Long64_t identifier
Definition
FCS_Cell.h:35
FCS_hit::hit_y
float hit_y
Definition
FCS_Cell.h:41
FCS_hit::hit_energy
float hit_energy
Definition
FCS_Cell.h:38
FCS_hit::sampling
int sampling
Definition
FCS_Cell.h:37
FCS_hit::operator<
bool operator<(const FCS_hit &rhs) const
Definition
FCS_Cell.h:43
FCS_hit::cell_identifier
Long64_t cell_identifier
Definition
FCS_Cell.h:36
FCS_matchedcell
Definition
FCS_Cell.h:57
FCS_matchedcell::sorthit
void sorthit()
Definition
FCS_Cell.h:64
FCS_matchedcell::g4hit
std::vector< FCS_g4hit > g4hit
Definition
FCS_Cell.h:59
FCS_matchedcell::sort
void sort()
Definition
FCS_Cell.h:66
FCS_matchedcell::hit
std::vector< FCS_hit > hit
Definition
FCS_Cell.h:60
FCS_matchedcell::scalingfactor
float scalingfactor()
Definition
FCS_Cell.h:62
FCS_matchedcell::operator<
bool operator<(const FCS_matchedcell &rhs) const
Definition
FCS_Cell.h:63
FCS_matchedcell::time_trim
void time_trim(float timing_cut)
Definition
FCS_Cell.h:67
FCS_matchedcell::sortg4hit
void sortg4hit()
Definition
FCS_Cell.h:65
FCS_matchedcell::cell
FCS_cell cell
Definition
FCS_Cell.h:58
FCS_matchedcell::clear
void clear()
Definition
FCS_Cell.h:61
FCS_matchedcellvector
Definition
FCS_Cell.h:71
FCS_matchedcellvector::sort
void sort()
Definition
FCS_Cell.h:80
FCS_matchedcellvector::time_trim
void time_trim(float timing_cut)
Definition
FCS_Cell.h:81
FCS_matchedcellvector::sort_cells
void sort_cells()
Definition
FCS_Cell.h:79
FCS_matchedcellvector::size
unsigned int size()
Definition
FCS_Cell.h:77
FCS_matchedcellvector::m_vector
std::vector< FCS_matchedcell > m_vector
Definition
FCS_Cell.h:74
FCS_matchedcellvector::push_back
void push_back(const FCS_matchedcell &cell)
Definition
FCS_Cell.h:78
FCS_matchedcellvector::operator[]
FCS_matchedcell operator[](unsigned int place)
Definition
FCS_Cell.h:76
FCS_matchedcellvector::scalingfactor
float scalingfactor()
Definition
FCS_Cell.h:83
FCS_matchedcellvector::GetLayer
std::vector< FCS_matchedcell > GetLayer(int layer)
Definition
FCS_Cell.h:75
Generated on
for ATLAS Offline Software by
1.17.0