ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
HeavyIonPhys
HIEventUtils
Root
HIEventShapeSummaryUtils.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
HIEventUtils/HIEventShapeSummaryUtils.h
"
6
#include "
CxxUtils/sincos.h
"
7
8
namespace
HI
9
{
10
void
AddEventShape::operator()
(
xAOD::HIEventShape
* slice,
const
xAOD::HIEventShape
* in_slice)
const
11
{
12
//update members
13
slice->setNCells(slice->nCells()+
m_weight
*in_slice->
nCells
());
14
slice->setEt(slice->et()+
m_weight
*in_slice->
et
());
15
slice->setArea(slice->area() +
m_weight
*in_slice->
area
());
16
slice->setRho(slice->rho() +
m_weight
*in_slice->
rho
());
17
18
unsigned
int
nord=slice->etCos().size();
19
if
(nord!=slice->etSin().size())
throw
std::domain_error(
"Input HIEventShape has unequal n-harmonics for Q_x and Q_y"
);
20
21
//if output shape is empty, copy directly from input
22
if
(nord==0)
23
{
24
slice->etCos().assign(in_slice->
etCos
().begin(),in_slice->
etCos
().end());
25
slice->etSin().assign(in_slice->
etSin
().begin(),in_slice->
etSin
().end());
26
return
;
27
}
28
29
unsigned
int
in_nord=in_slice->
etCos
().size();
30
//can only do addition for harmonics in input slice, print warning?
31
if
(in_nord < nord) nord=in_nord;
32
else
if
(in_nord > nord &&
match_num_harmonics
)
33
{
34
//print a warning?
35
auto
itr=in_slice->
etCos
().begin();
36
std::advance(itr,nord);
37
slice->etCos().insert(slice->etCos().end(),itr,in_slice->
etCos
().end());
38
itr=in_slice->
etSin
().begin();
39
std::advance(itr,nord);
40
slice->etSin().insert(slice->etSin().end(),itr,in_slice->
etSin
().end());
41
}
42
//only need to sum to nord, if prev condition was met i>nord set explicitly by insert
43
for
(
unsigned
int
i=0; i<nord; i++)
44
{
45
float
tmp_cos = slice->etCos().at(i);
46
slice->etCos()[i] = tmp_cos +
m_weight
*in_slice->
etCos
().at(i);
47
float
tmp_sin = slice->etSin().at(i);
48
slice->etSin()[i] = tmp_sin +
m_weight
*in_slice->
etSin
().at(i);
49
}
50
}
51
52
53
void
fillSummary
(
const
xAOD::HIEventShapeContainer
* in,
xAOD::HIEventShape
* out,
54
const
std::function<
bool
(
const
xAOD::HIEventShape
*)>& incFunction,
55
const
std::function<
void
(
xAOD::HIEventShape
*,
const
xAOD::HIEventShape
*)>& addFunction)
56
{
57
for
(
const
auto
sItr : *in )
58
{
59
if
(incFunction(sItr)) addFunction(out,sItr);
60
}
61
}
62
63
void
fillSummary
(
const
xAOD::HIEventShapeContainer
* in,
xAOD::HIEventShape
* out,
64
const
std::set<unsigned int>& indices,
65
const
std::function<
void
(
xAOD::HIEventShape
*,
const
xAOD::HIEventShape
*)>& addFunction)
66
{
67
for
(
const
auto
i : indices ) addFunction(out,in->
at
(i));
68
}
69
70
71
void
fillSummary
(
const
xAOD::HIEventShapeContainer
* in,
xAOD::HIEventShape
* out,
72
const
std::function<
bool
(
const
xAOD::HIEventShape
*)>& incFunction)
73
{
74
for
(
const
auto
sItr : *in )
75
{
76
if
(incFunction(sItr))
HI::AddES
(out,sItr);
77
}
78
}
79
80
float
getModulation
(
const
xAOD::HIEventShape
* es,
const
std::vector<unsigned int>& harmonics,
float
phi
)
81
{
82
float
mod=1;
83
for
(
const
auto
itr : harmonics)
84
{
85
CxxUtils::sincos
sc
(itr*
phi
);
86
mod+=
sc
.apply(es->
etSin
().at(itr-1),es->
etCos
().at(itr-1));
87
}
88
return
mod;
89
}
90
int
setHarmonics
(std::vector<unsigned int>& in)
91
{
92
for
(
unsigned
int
i=0; i<in.size(); i++)
93
{
94
int
harmonic=in[i]-1;
//v_0=1 by construction
95
if
(harmonic < 0)
return
i;
96
in[i]=harmonic;
97
}
98
return
-1;
99
}
100
}
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
HIEventShapeSummaryUtils.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
xAOD::HIEventShape_v2::nCells
int nCells() const
number of cells that were summed in slice
xAOD::HIEventShape_v2::area
float area() const
obtain the area of the eta slice
xAOD::HIEventShape_v2::rho
float rho() const
energy density (et/area)
xAOD::HIEventShape_v2::etSin
const std::vector< float > & etSin() const
sine (x) part of the harmonic modulation strength
xAOD::HIEventShape_v2::etCos
const std::vector< float > & etCos() const
cosine (y) part of the harmonic modulation strength Following convention is used: index 0 is first ha...
xAOD::HIEventShape_v2::et
float et() const
Transverse energy reconstructed on the slice.
HI
Definition
HIEventDefs.h:14
HI::fillSummary
void fillSummary(const xAOD::HIEventShapeContainer *in, xAOD::HIEventShape *out, const std::function< bool(const xAOD::HIEventShape *)> &incFunction, const std::function< void(xAOD::HIEventShape *, const xAOD::HIEventShape *)> &addFunction)
Definition
HIEventShapeSummaryUtils.cxx:53
HI::AddES
constexpr AddEventShape AddES
Definition
HIEventShapeSummaryUtils.h:42
HI::setHarmonics
int setHarmonics(std::vector< unsigned int > &in)
Definition
HIEventShapeSummaryUtils.cxx:90
HI::getModulation
float getModulation(const xAOD::HIEventShape *es, const std::vector< unsigned int > &harmonics, float phi)
Definition
HIEventShapeSummaryUtils.cxx:80
xAOD::HIEventShapeContainer
HIEventShapeContainer_v2 HIEventShapeContainer
Define the latest version of the container.
Definition
HIEventShapeContainer.h:17
xAOD::HIEventShape
HIEventShape_v2 HIEventShape
Definition of the latest event info version.
Definition
HIEventShape.h:16
sincos.h
Helper to simultaneously calculate sin and cos of the same angle.
CxxUtils::sincos
Helper to simultaneously calculate sin and cos of the same angle.
Definition
sincos.h:39
HI::AddEventShape::match_num_harmonics
bool match_num_harmonics
Definition
HIEventShapeSummaryUtils.h:32
HI::AddEventShape::m_weight
float m_weight
Definition
HIEventShapeSummaryUtils.h:39
HI::AddEventShape::operator()
void operator()(xAOD::HIEventShape *slice, const xAOD::HIEventShape *in_slice) const
Definition
HIEventShapeSummaryUtils.cxx:10
Generated on
for ATLAS Offline Software by
1.17.0