ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ShapeCreator Class Reference

#include <ShapeCreator.h>

Collaboration diagram for ShapeCreator:

Public Member Functions

 ShapeCreator ()
 
void setProjection (int p)
 
TLine * createLine (const TVector3 &pos, const TVector3 &dir, double length)
 
TLine * createLine (const TVector3 &pos1, const TVector3 &pos2)
 
TLine * createOrthogonalLine (const TVector3 &pos, const TVector3 &dir, double length)
 
TArrow * createArrow (const TVector3 &pos, const TVector3 &dir, double length)
 
TPolyLine * createTriangle (const TVector3 &pos, const TVector3 &dir, double length)
 
TArc * createArc (const TVector3 &pos, double r)
 
TBox * createBox (const TVector3 &upperleft, const TVector3 &lowerright)
 
TText * createText (const TVector3 &pos, const char *text)
 
TEllipse * createEllipse (const TVector3 &pos, double r1, double r2)
 

Private Member Functions

void applyProjection (const TVector3 &pos, double &x1, double &x2)
 
void applyDirectionProjectionUnit (const TVector3 &dir, double &x1, double &x2, const TVector3 &pos)
 

Private Attributes

int m_projection
 

Detailed Description

Definition at line 22 of file ShapeCreator.h.

Constructor & Destructor Documentation

◆ ShapeCreator()

ShapeCreator::ShapeCreator ( )

Definition at line 20 of file ShapeCreator.cxx.

20  :
21  m_projection(0){
22 }

Member Function Documentation

◆ applyDirectionProjectionUnit()

void ShapeCreator::applyDirectionProjectionUnit ( const TVector3 &  dir,
double &  x1,
double &  x2,
const TVector3 &  pos 
)
private

Definition at line 53 of file ShapeCreator.cxx.

53  {
54  //void ShapeCreator::applyProjection(const Hep3Vector& pos, double& x1, double& x2){
55 
56  if(m_projection == 0) {
57  x1 = dir.x();
58  x2 = dir.y();
59  } else if(m_projection == 1) {
60  x1 = dir.x();
61  x2 = dir.z();
62  } else if(m_projection == 2) {
63  x1 = dir.z();
64  x2 = dir.y();
65  } else if(m_projection == 3) {
66  // Cylindrical Coordinates: Z Phi
67  //const double phiFactor = 180. / TMath::Pi(); // use deg
68  const double phiFactor = 1000.; // use mrad
69  x1 = dir.z();
70  // directions:
71  TVector3 pos2(pos+dir);
72  x2 = (pos2.Phi() - pos.Phi()) * phiFactor;
73 // if (radius != 0.){
74 // //x2 = atan(sqrt(pow(dir.x(),2.)+pow(dir.y(),2.))/radius) * phiFactor;
75 // x2 = atan(dir.Perp()/radius) * phiFactor;
76 // //std::cout << "radius: " << radius << ", dir.Perp:" << dir.Perp() << std::endl;
77 // } else {
78 // x2=0.;
79 // }
80 
81  } else if(m_projection == 4) {
82  // Cylindrical Coordinates: Z vs. R*Phi
83  x1 = dir.z();
84  x2 = dir.Phi() * dir.Perp();
85  }
86 
87  double length = sqrt(x1*x1 + x2*x2);
88  if (length >0) {
89  x1/=length;
90  x2/=length;
91  }
92 
93 }

◆ applyProjection()

void ShapeCreator::applyProjection ( const TVector3 &  pos,
double &  x1,
double &  x2 
)
private

Definition at line 25 of file ShapeCreator.cxx.

25  {
26  //void ShapeCreator::applyProjection(const Hep3Vector& pos, double& x1, double& x2){
27 
28  if(m_projection == 0) {
29  x1 = pos.x();
30  x2 = pos.y();
31  } else if(m_projection == 1) {
32  x1 = pos.x();
33  x2 = pos.z();
34  } else if(m_projection == 2) {
35  x1 = pos.z();
36  x2 = pos.y();
37  } else if(m_projection == 3) {
38  // Cylindrical Coordinates: Z Phi
39 
40  //const double phiFactor = 180. / TMath::Pi(); // use deg
41  const double phiFactor = 1000.; // use mrad
42  x1 = pos.z();
43  x2 = pos.Phi() * phiFactor;
44 
45  } else if(m_projection == 4) {
46  // Cylindrical Coordinates: Z vs. R*Phi
47  x1 = pos.z();
48  x2 = pos.Phi() * pos.Perp();
49  }
50 
51 }

◆ createArc()

TArc * ShapeCreator::createArc ( const TVector3 &  pos,
double  r 
)

Definition at line 175 of file ShapeCreator.cxx.

175  {
176  double x1,x2;
178 // std::cout << "ShapeCreator: creating circle at (" << x1 << "," << x2 << ") with radius "<< r << std::endl;
179 
180  return new TArc(x1,x2,r);
181 }

◆ createArrow()

TArrow * ShapeCreator::createArrow ( const TVector3 &  pos,
const TVector3 &  dir,
double  length 
)

Definition at line 149 of file ShapeCreator.cxx.

149  {
150  double x1,x2;
151  double dx1,dx2;
152 
155 // std::cout << "ShapeCreator: creating line from (" << x1 << "," << x2 << ") to ("<< dx1 << "," << dx2 << ") " << std::endl;
156 
157 // return new TLine(xu1,xu2,xl1,xl2);
158  return new TArrow(x1, x2, x1+dx1*length, x2+dx2*length);
159 }

◆ createBox()

TBox * ShapeCreator::createBox ( const TVector3 &  upperleft,
const TVector3 &  lowerright 
)

Definition at line 184 of file ShapeCreator.cxx.

184  {
185  double x1,x2;
186  double y1,y2;
187 
188  applyProjection(upperleft,x1,x2);
189  applyProjection(lowerright,y1,y2);
190 
191 
192  return new TBox(x1,x2,y1,y2);
193 }

◆ createEllipse()

TEllipse * ShapeCreator::createEllipse ( const TVector3 &  pos,
double  r1,
double  r2 
)

Definition at line 201 of file ShapeCreator.cxx.

201  {
202  double x1,x2;
204 // std::cout << "ShapeCreator: creating circle at (" << x1 << "," << x2 << ") with radius "<< r << std::endl;
205 
206  return new TEllipse(x1, x2, r1, r2);
207 }

◆ createLine() [1/2]

TLine * ShapeCreator::createLine ( const TVector3 &  pos,
const TVector3 &  dir,
double  length 
)

Definition at line 106 of file ShapeCreator.cxx.

106  {
107  double x1,x2;
108  double dx1,dx2;
109 
112 // std::cout << "ShapeCreator: creating line from (" << x1 << "," << x2 << ") to ("<< dx1 << "," << dx2 << ") " << std::endl;
113 
114  double xu1 = x1 + 0.5*dx1*length;
115  double xu2 = x2 + 0.5*dx2*length;
116  double xl1 = x1 - 0.5*dx1*length;
117  double xl2 = x2 - 0.5*dx2*length;
118 
119  return new TLine(xu1,xu2,xl1,xl2);
120 // return new TLine(x1, x2, x1+dx1*length, x2+dx2*length);
121 }

◆ createLine() [2/2]

TLine * ShapeCreator::createLine ( const TVector3 &  pos1,
const TVector3 &  pos2 
)

Definition at line 123 of file ShapeCreator.cxx.

123  {
124  double x1,y1;
125  double x2,y2;
126 
127  applyProjection(pos1,x1,y1);
128  applyProjection(pos2,x2,y2);
129 
130  return new TLine(x1,y1,x2,y2);
131 }

◆ createOrthogonalLine()

TLine * ShapeCreator::createOrthogonalLine ( const TVector3 &  pos,
const TVector3 &  dir,
double  length 
)

Definition at line 133 of file ShapeCreator.cxx.

133  {
134  double x1,x2;
135  double dx1,dx2;
136 
139 
140  double xu1 = x1 + 0.5*dx2*length;
141  double xu2 = x2 - 0.5*dx1*length;
142  double xl1 = x1 - 0.5*dx2*length;
143  double xl2 = x2 + 0.5*dx1*length;
144 
145  return new TLine(xu1,xu2,xl1,xl2);
146 // return new TLine(x1, x2, x1-dx2*length, x2+dx1*length);
147 }

◆ createText()

TText * ShapeCreator::createText ( const TVector3 &  pos,
const char *  text 
)

Definition at line 195 of file ShapeCreator.cxx.

195  {
196  double x1,x2;
198  return new TText(x1, x2, text);
199 }

◆ createTriangle()

TPolyLine * ShapeCreator::createTriangle ( const TVector3 &  pos,
const TVector3 &  dir,
double  length 
)

Definition at line 161 of file ShapeCreator.cxx.

161  {
162  double x1,x2;
163  double dx1,dx2;
164 
167  Double_t x[3] = { x1+(dx2/2.)*length ,x1+dx1*length ,x1-(dx2/2.)*length};
168  Double_t y[3] = { x2-(dx1/2.)*length ,x2+dx2*length, x2+(dx1/2.)*length};
169 // Double_t x[3] = { x1-(dx1-dx2/2.)*length ,x1 ,x1-(dx1+dx2/2.)*length};
170 // Double_t y[3] = { x2-(dx2+dx1/2.)*length ,x2, x2-(dx2-dx1/2.)*length};
171  return new TPolyLine(3,x,y);
172 }

◆ setProjection()

void ShapeCreator::setProjection ( int  p)

Definition at line 95 of file ShapeCreator.cxx.

95  {
96 //void ShapeCreator::setProjection(int p, double parameter) {
97  if(p != 0 && p != 1 && p != 2 && p != 3 && p != 4)
98  std::cout << "ERROR Wrong projection " << std::endl;
99  m_projection = p;
100  //m_parameter = parameter;
101 // std::cout << "ShapeCreator: using projection type " << m_projection << std::endl;
102 }

Member Data Documentation

◆ m_projection

int ShapeCreator::m_projection
private

Definition at line 41 of file ShapeCreator.h.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:676
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
ShapeCreator::applyDirectionProjectionUnit
void applyDirectionProjectionUnit(const TVector3 &dir, double &x1, double &x2, const TVector3 &pos)
Definition: ShapeCreator.cxx:53
x
#define x
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
ShapeCreator::m_projection
int m_projection
Definition: ShapeCreator.h:41
beamspotman.dir
string dir
Definition: beamspotman.py:623
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ShapeCreator::applyProjection
void applyProjection(const TVector3 &pos, double &x1, double &x2)
Definition: ShapeCreator.cxx:25
y
#define y
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26