ATLAS Offline Software
BarrelAuxFunctions.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "BarrelAuxFunctions.h"
6 
7 #include "GeoGenericFunctions/Abs.h"
8 #include "GeoGenericFunctions/Sin.h"
9 #include "GeoGenericFunctions/Cos.h"
10 #include "GeoGenericFunctions/ATan.h"
11 #include "GeoGenericFunctions/Rectangular.h"
12 #include "GeoGenericFunctions/Mod.h"
13 
14 #include <cfloat>
15 
16 GeoGenfun::FunctionNoop LArGeo::Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[] )
17 {
18  GeoGenfun::Cos Cos;
19  GeoGenfun::Sin Sin;
20  int i = (int)rint(r-.1), j = (int)rint(r+.1) ;
21  GeoGenfun::GENFUNCTION result = (Cos(G)*(Cenx[i]+Cenx[j])/2-Sin(G)*(Ceny[i]+Ceny[j])/2) ;
22  return {&result};
23 }
24 
25 GeoGenfun::FunctionNoop LArGeo::Fy(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[] )
26 {
27  GeoGenfun::Cos Cos;
28  GeoGenfun::Sin Sin;
29  int i = (int)rint(r-.1), j = (int)rint(r+.1) ;
30  GeoGenfun::GENFUNCTION result = (Sin(G)*(Cenx[i]+Cenx[j])/2+Cos(G)*(Ceny[i]+Ceny[j])/2) ;
31  return {&result};
32 }
33 
34 GeoGenfun::FunctionNoop LArGeo::Del1(GeoGenfun::GENFUNCTION G)
35 {
36  GeoGenfun::Cos Cos;
37  GeoGenfun::Sin Sin;
38  GeoGenfun::GENFUNCTION result = (Cos( G ) * Sin( G ) );
39  return {&result};
40 }
41 
42 GeoGenfun::FunctionNoop LArGeo::Del2(GeoGenfun::GENFUNCTION G)
43 {
44  GeoGenfun::Cos Cos;
45  GeoGenfun::GENFUNCTION result = (Cos( G ) * Cos( G ) );
46  return {&result};
47 }
48 
49 
50 GeoGenfun::FunctionNoop LArGeo::ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
51 {
52  // Manufacture a Theta Function:
53  GeoGenfun::Rectangular Theta;
54  Theta.x0().setValue(0.0);
55  Theta.x1().setValue(DBL_MAX);
56  Theta.baseline().setValue(0.0);
57  Theta.height().setValue(1.0);
58 
59  // Manufacture an ATan function:
60  GeoGenfun::ATan ATan;
61 
62 
63  // Manufacture a Mod function, putting this on the range (0-2PI)
64  GeoGenfun::Mod Mod2Pi(2*M_PI);
65 
66  // Now take ATan if x is positive
67 
68  GeoGenfun::GENFUNCTION result = Theta(x)*ATan(y/x) + Theta(-x)*(Mod2Pi(ATan(y/x)+M_PI));
69  return {&result};
70 
71 }
beamspotman.r
def r
Definition: beamspotman.py:676
get_generator_info.result
result
Definition: get_generator_info.py:21
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
M_PI
#define M_PI
Definition: ActiveFraction.h:11
x
#define x
LArGeo::Fx
GeoGenfun::FunctionNoop Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:16
LArGeo::Del1
GeoGenfun::FunctionNoop Del1(GeoGenfun::GENFUNCTION G)
Definition: BarrelAuxFunctions.cxx:34
lumiFormat.i
int i
Definition: lumiFormat.py:85
G
#define G(x, y, z)
Definition: MD5.cxx:113
LArGeo::Del2
GeoGenfun::FunctionNoop Del2(GeoGenfun::GENFUNCTION G)
Definition: BarrelAuxFunctions.cxx:42
BarrelAuxFunctions.h
Namespace with auxiliary functions used by BarrelConstruction and ElStraightSectionBuilder classes.
LArGeo::Fy
GeoGenfun::FunctionNoop Fy(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:25
y
#define y
LArGeo::ATan2
GeoGenfun::FunctionNoop ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
Definition: BarrelAuxFunctions.cxx:50