43 (
const std::string&
t,
const std::string&
n,
const IInterface*
p)
45 m_proptool (
"Trk::RungeKuttaPropagator/InDetPropagator" ),
48 m_fieldmode (
"MapSolenoid")
50 declareInterface<ITRT_DetElementsRoadMaker>(
this);
108 std::string s1;
for(
int i=0;
i<
n; ++
i) s1.append(
" "); s1.append(
"|");
110 std::string fieldmode[9] ={
"NoField" ,
"ConstantField",
"SolenoidalField",
111 "ToroidalField" ,
"Grid3DField" ,
"RealisticField" ,
112 "UndefinedField",
"AthenaField" ,
"?????" };
119 fieldCondObj->getInitializedCache (fieldCache);
124 if(mode<0 || mode>8 )
mode = 8;
126 n = 62-fieldmode[
mode].size();
127 std::string
s3;
for(
int i=0;
i<
n; ++
i)
s3.append(
" ");
s3.append(
"|");
136 out<<
"|----------------------------------------------------------------------"
137 <<
"-------------------|"
139 out<<
"| Tool for propagation | "<<
m_proptool.type()<<s1<<std::endl;
140 out<<
"| Magnetic field mode | "<<fieldmode[
mode]<<
s3<<std::endl;
141 out<<
"| Width of the road (mm) | "
142 <<std::setw(12)<<std::setprecision(5)<<
m_width
144 out<<
"|----------------------------------------------------------------------"
145 <<
"-------------------|"
151 int nl =
layer[1].size();
153 for(
const auto &
i :
layer[1])
nc+=
i.nElements();
154 out<<
"|----------------------------------------------------------------|"
156 out<<
"| Barrel map containt "
157 <<std::setw(4)<<nl<<
" layers and "
158 <<std::setw(6)<<
nc<<
" elements |"
160 out<<
"|------|-----------|------------|------------|------------|------|"
162 out<<
"| n | R | Z min | Z max | max dF | nEl |"
164 out<<
"|------|-----------|------------|------------|------------|------|"
166 for(
unsigned int i=0;
i!=
layer[1].size(); ++
i) {
170 <<std::setw(4)<<
i<<
" |"
171 <<std::setw(10)<<std::setprecision(4)<<
layer[1][
i].r ()<<
" | "
172 <<std::setw(10)<<std::setprecision(4)<<
zmin<<
" | "
173 <<std::setw(10)<<std::setprecision(4)<<
zmax<<
" | "
174 <<std::setw(10)<<std::setprecision(4)<<
layer[1][
i].dfe()<<
" | "
175 <<std::setw(4)<<
layer[1][
i].nElements()<<
" | "
178 out<<
"|------|-----------|------------|------------|------------|------|"
184 int nl =
layer[0].size();
186 for(
const auto &
i :
layer[0])
nc+=
i.nElements();
187 out<<
"|----------------------------------------------------------------|"
189 out<<
"| L.Endcap map containt "
190 <<std::setw(4)<<nl<<
" layers and "
191 <<std::setw(6)<<
nc<<
" elements |"
194 out<<
"|------|-----------|------------|------------|------------|------|"
196 out<<
"| n | Z | R min | R max | max dF | nEl |"
198 out<<
"|------|-----------|------------|------------|------------|------|"
200 for(
unsigned int i=0;
i!=
layer[0].size(); ++
i) {
204 <<std::setw(4)<<
i<<
" |"
205 <<std::setw(10)<<std::setprecision(4)<<
layer[0][
i].z()<<
" | "
206 <<std::setw(10)<<std::setprecision(4)<< rmin<<
" | "
207 <<std::setw(10)<<std::setprecision(4)<< rmax<<
" | "
208 <<std::setw(10)<<std::setprecision(4)<<
layer[0][
i].dfe()<<
" | "
209 <<std::setw(4)<<
layer[0][
i].nElements()<<
" | "
212 out<<
"|------|-----------|------------|------------|------------|------|"
216 int nl =
layer[2].size();
218 for(
const auto &
i :
layer[2])
nc+=
i.nElements();
219 out<<
"|----------------------------------------------------------------|"
221 out<<
"| R.Endcap map containt "
222 <<std::setw(4)<<nl<<
" layers and "
223 <<std::setw(6)<<
nc<<
" elements |"
225 out<<
"|------|-----------|------------|------------|------------|------|"
227 out<<
"| n | Z | R min | R max | max dF | nEl |"
229 out<<
"|------|-----------|------------|------------|------------|------|"
231 for(
unsigned int i=0;
i!=
layer[2].size(); ++
i) {
235 <<std::setw(4)<<
i<<
" |"
236 <<std::setw(10)<<std::setprecision(4)<<
layer[2][
i].z()<<
" | "
237 <<std::setw(10)<<std::setprecision(4)<< rmin<<
" | "
238 <<std::setw(10)<<std::setprecision(4)<< rmax<<
" | "
239 <<std::setw(10)<<std::setprecision(4)<<
layer[2][
i].dfe()<<
" | "
240 <<std::setw(4)<<
layer[2][
i].nElements()<<
" | "
243 out<<
"|------|-----------|------------|------------|------------|------|"
255 out<<
"|--------------------------------------------------------------------|"
257 out<<
"| Road size | "<<std::setw(12)<<size_road
259 out<<
"|--------------------------------------------------------------------|"
277 std::vector<const InDetDD::TRT_BaseElement*>
279 (
const EventContext& ctx,
284 double qp = std::abs(500.*Tp.parameters()[4]) ;
285 if( qp < 1.
e-10 ) qp = 1.e-10;
287 if(
S > 200. )
S = 200. ;
291 std::vector<const InDetDD::TRT_BaseElement*>
result;
292 if( CB.r() > rminTRT) {
296 std::deque<Amg::Vector3D>
G;
312 (std::deque<Amg::Vector3D>& GP,
313 std::vector<const InDetDD::TRT_BaseElement*>& Road,
324 float(std::sqrt((*g).x()*(*g).x()+(*g).y()*(*g).y())),
m_width,0.};
330 std::vector<std::pair<const InDet::TRT_DetElementLink_xk*,float> > lDE;
331 for (
unsigned int module_i = 0; module_i < 3; ++module_i) {
332 size_t layersSize =
layer[module_i].size();
334 used[module_i].resize(layersSize);
335 for (
unsigned int layer_i = 0; layer_i < layersSize; ++layer_i) {
338 used[module_i][layer_i].clear();
340 used[module_i][layer_i].resize(
layer[module_i][layer_i].nElements());
344 for(++
g;
g!=ge; ++
g) {
347 float(std::sqrt((*g).x()*(*g).x()+(*g).y()*(*g).y()))};
349 float dx = Pn[0]-Po[0];
350 float dy = Pn[1]-Po[1];
351 float dz = Pn[2]-Po[2];
352 float st = std::sqrt(
dx*
dx+
dy*
dy+dz*dz);
353 if(st <=0.)
continue;
364 assert(
used.at(1).size() >
static_cast<unsigned int>(
n1));
365 layer[1][
n1].getBarrelDetElementsATL(Po, A, lDE,
used[1][
n1]);
368 for (--
n1;
n1 >= 0; --
n1) {
371 assert(
used.at(1).size() >
static_cast<unsigned int>(
n1));
372 layer[1][
n1].getBarrelDetElementsATL(Po, A, lDE,
used[1][
n1]);
382 if (Pn[2] <
layer[2][n2].
z())
384 assert(
used.at(2).size() >
static_cast<unsigned int>(n2));
385 layer[2][n2].getEndcapDetElements(Po, A, lDE,
used[2][n2]);
388 for (--n2; n2 >= 0; --n2) {
389 if (Pn[2] >
layer[2][n2].
z())
391 assert(
used.at(2).size() >
static_cast<unsigned int>(n2));
392 layer[2][n2].getEndcapDetElements(Po, A, lDE,
used[2][n2]);
402 if (Pn[2] >
layer[0][n0].
z())
404 assert(
used.at(0).size() >
static_cast<unsigned int>(n0));
405 layer[0][n0].getEndcapDetElements(Po, A, lDE,
used[0][n0]);
408 for (--n0; n0 >= 0; --n0) {
409 if (Pn[2] <
layer[0][n0].
z())
411 assert(
used.at(0).size() >
static_cast<unsigned int>(n0));
412 layer[0][n0].getEndcapDetElements(Po, A, lDE,
used[0][n0]);
425 std::vector<std::pair<const InDet::TRT_DetElementLink_xk*,float> >
::iterator l=lDE.begin(),le=lDE.end(),
n,
m;
432 for(++
n;
n!=le; ++
n) {
434 if( (*m).second > (*n).second ) {
435 std::pair<const InDet::TRT_DetElementLink_xk*,float>
d=(*m); (*m)=(*n); (*n)=
d;
nc=
true;
443 for(
l=lDE.begin();
l!=le; ++
l) {
444 Road.push_back((*l).first->detElement());
454 (std::deque<Amg::Vector3D>& GP,
455 std::vector<const InDetDD::TRT_BaseElement*>& Road,
464 float(std::sqrt((*g).x()*(*g).x()+(*g).y()*(*g).y())),
m_width,0.};
468 std::vector<std::pair<const InDet::TRT_DetElementLink_xk*,float> > lDE;
469 for (
unsigned int module_i = 0; module_i < 3; ++module_i) {
470 size_t layersSize =
layer[module_i].size();
472 used[module_i].resize(layersSize);
473 for (
unsigned int layer_i = 0; layer_i < layersSize; ++layer_i) {
476 used[module_i][layer_i].clear();
478 used[module_i][layer_i].resize(
layer[module_i][layer_i].nElements());
482 for(++
g;
g!=ge; ++
g) {
485 float(std::sqrt((*g).x()*(*g).x()+(*g).y()*(*g).y()))};
487 float dx = Pn[0]-Po[0];
488 float dy = Pn[1]-Po[1];
489 float dz = Pn[2]-Po[2];
490 float st = std::sqrt(
dx*
dx+
dy*
dy+dz*dz);
499 assert(
used.at(1).size() >
static_cast<unsigned int>(
n1) );
514 std::vector<std::pair<const InDet::TRT_DetElementLink_xk*, float> >
::iterator l=lDE.begin(),le=lDE.end(),
n;
521 for(++
n;
n!=le; ++
n) {
523 if( (*l).second > (*n).second ) {
524 std::pair<const InDet::TRT_DetElementLink_xk*,float>
d = (*l); (*l) = (*n); (*n) =
d;
533 for(
l=lDE.begin();
l!=le; ++
l) {
534 Road.push_back((*l).first->detElement());
547 double D =
a.x()*A.x()+
a.y()*A.y()+
a.z()*A.z();
if(D==0.)
return D;
548 return ((A.x()*(R.x()-
r.x())+A.y()*(R.y()-
r.y())+A.z()*(R.z()-
r.z()))/D);
558 const double cor = 0.8;
565 zfield = 299.7925*
f[2];
570 if( std::abs(zfield) < .0000001 )
return bounds;
572 const AmgVector(5)& Vp = Tp.parameters();
576 if( std::abs(
cur)*bounds.
r() < cor )
return bounds;
579 if(cor*std::abs(
rad) > bounds.
r() )
return bounds;
582 double sn,cs; sincos(Vp[2],&sn,&cs);
583 double xc = Gp.x()+sn*
rad ;
584 double yc = Gp.y()-cs*
rad ;
585 double rm = (std::sqrt(xc*xc+yc*yc)+std::abs(
rad))*cor;
586 if( rm > bounds.
r() )
return bounds;