ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
16GeoGenfun::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
25GeoGenfun::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
34GeoGenfun::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
42GeoGenfun::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
50GeoGenfun::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}
#define M_PI
Namespace with auxiliary functions used by BarrelConstruction and ElStraightSectionBuilder classes.
#define G(x, y, z)
Definition MD5.cxx:113
#define y
#define x
int r
Definition globals.cxx:22
GeoGenfun::FunctionNoop Fy(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
GeoGenfun::FunctionNoop ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
GeoGenfun::FunctionNoop Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
GeoGenfun::FunctionNoop Del1(GeoGenfun::GENFUNCTION G)
GeoGenfun::FunctionNoop Del2(GeoGenfun::GENFUNCTION G)