32 MsgStream
log(
msgSvc,
"buildElStraightSections");
47 int Nbrt = (*barrelGeometryRec)[0]->getInt(
"NBRT");
50 double Bar_Z_min = Moth_Z_min;
51 double Bar_Z_max = Moth_Z_max;
60 double Rhocen[15], Phicen[15], Delta[15], deltay[15], deltax[15], TetaTrans[15];
61 for (
int idat=0; idat<15; idat++) {
83 double etaTrans = (*barrelEtaTransRec)[idat]->getDouble(
"ETATRANS");
84 TetaTrans[idat] = 2.*
atan(
exp(-etaTrans));
88 int checkParity = (Phicen[0]<0. ? 1 : 0);
91 int Ncell = (*barrelGeometryRec)[0]->getInt(
"NCELMX");
92 int Nabsorber = (Ncell==64) ? Ncell + 1 : Ncell;
93 int Nelectrode = Ncell;
96 double z1 = (*barrelGeometryRec)[0]->getDouble(
"G10FRONTDELTAZ")*
SYSTEM_OF_UNITS::cm + Moth_Z_min;
98 const double r1 = Moth_inner_radius
103 const double inv_r2_r1 = 1. / (
r2-
r1);
113 double Contract = (*coldContractionRec)[0]->getDouble(
"ABSORBERCONTRACTION");
115 double Thce = (Thpb+Thgl+Thfe)*Contract;
116 double Thel = Thcu+Thfg;
118 double Zmin = Bar_Z_min;
119 double Zmax = Bar_Z_max;
122 double Zcp1l[14],Zcp1h[14],Zcp2l[14],Zcp2h[14];
123 double Rhol[14],Rhoh[14];
128 double Cenx[15]={0}, Ceny[15]={0} ;
129 for (
int jf=0; jf<(Nbrt+1); jf++) {
130 Cenx[jf] = Rhocen[jf]*
cos(Phicen[jf]);
131 Ceny[jf] = Rhocen[jf]*
sin(Phicen[jf]);
136 for (
int jl=0; jl<Nbrt; jl++) {
137 double Adisc2 = (Cenx[jl+1]-Cenx[jl])*(Cenx[jl+1]-Cenx[jl])+
138 (Ceny[jl+1]-Ceny[jl])*(Ceny[jl+1]-Ceny[jl]);
139 double Along2 = Adisc2 - 4.*Rint*Rint;
140 Along[jl] = sqrt(Along2);
142 double ddelta =
M_PI/2.-Delta[jl];
144 if (checkParity==0) {
153 double xlong=Along[jl]-2.*safety_along;
154 double x2=0.5*(Cenx[jl+1]+Cenx[jl])+0.5*xlong*
cos(ddelta);
155 double y2=0.5*(Ceny[jl+1]+Ceny[jl])+0.5*xlong*
sin(ddelta);
156 double x1=0.5*(Cenx[jl+1]+Cenx[jl])-0.5*xlong*
cos(ddelta);
157 double y1=0.5*(Ceny[jl+1]+Ceny[jl])-0.5*xlong*
sin(ddelta);
160 Zcp1l[jl] = Rhol[jl]/
tan(TetaTrans[jl]);
161 Zcp1h[jl] = Rhoh[jl]/
tan(TetaTrans[jl+1]);
163 Zcp2l[jl] = z1 + (Rhol[jl]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
166 Zcp2l[jl]=Moth_Z_max;
169 Zcp2h[jl] = z1 + (Rhoh[jl]-
r1)*inv_r2_r1*(Moth_Z_max-z1);
172 Zcp2h[jl]=Moth_Z_max;
177 double Gama0 = (*barrelGeometryRec)[0]->getDouble(
"PHIFIRST");
180 GeoGenfun::Variable icopy;
181 GeoGenfun::GENFUNCTION Game = Gama0 + Psi/2 + Alfa*icopy;
182 GeoGenfun::GENFUNCTION Gama = Gama0 + Alfa*icopy;
194 for(
int irl=0; irl<Nbrt; irl++) {
197 if (checkParity==0) {
198 iparit= (1-2*(irl%2));
201 iparit=(2*(irl%2)-1);
207 if (Rhocen[irl] < Bar_Rcmx && Rhocen[irl+1] > Bar_Rcmx) {
211 for (
int idivi=0;idivi<ndivi;idivi++) {
225 frac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
230 frac=(Rhoh[irl]-Bar_Rcmx)/(Rhoh[irl]-Rhol[irl]);
243 GeoGenfun::GENFUNCTION x1a =
LArGeo::Fx(irl+0., Gama, Cenx, Ceny)
246 GeoGenfun::GENFUNCTION x2a =
LArGeo::Fx(irl+1., Gama, Cenx, Ceny)
249 GeoGenfun::GENFUNCTION y1a =
LArGeo::Fy(irl+0., Gama, Cenx, Ceny)
252 GeoGenfun::GENFUNCTION y2a =
LArGeo::Fy(irl+1., Gama, Cenx, Ceny)
255 GeoGenfun::GENFUNCTION
dx = x2a - x1a;
256 GeoGenfun::GENFUNCTION
dy = y2a - y1a;
260 GeoGenfun::GENFUNCTION Da = Sqrt (
dx*
dx +
dy*
dy );
261 GeoGenfun::GENFUNCTION da = Sqrt ( (Da - 2.*Rint)*(Da + 2.*Rint) );
264 GeoGenfun::GENFUNCTION cosalfa = (da*
dx -iparit*2.*Rint*
dy)/Da/Da;
265 GeoGenfun::GENFUNCTION sinalfa = (da*
dy +iparit*2.*Rint*
dx)/Da/Da;
266 GeoGenfun::GENFUNCTION newalpha =
LArGeo::ATan2(sinalfa,cosalfa);
275 Xb1 = (Zcp1l[irl]-
Zmin)/2.;
276 Xt1 = (Zcp1h[irl]-
Zmin)/2.;
279 double xfrac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
281 Xb1 = (Zcp1l[irl]-
Zmin)/2.;
282 Xt1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-
Zmin)/2.;
285 Xb1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-
Zmin)/2.;
286 Xt1 = (Zcp1h[irl]-
Zmin)/2.;
291 double Xt2 = tl1-Xt1;
292 double Xb2 = bl1-Xb1;
298 GeoGenfun::GENFUNCTION alpha = ATan(0.5*(bl1-tl1)/
h1);
314 GeoGenfun::GENFUNCTION alfrot = -
M_PI/2. - newalpha;
316 GeoGenfun::GENFUNCTION Xcd = (x1a + x2a)/2. + (2.*idivi-1.)*(1.-
frac)*da/2.*cosalfa;
317 GeoGenfun::GENFUNCTION Ycd = (y1a + y2a)/2. + (2.*idivi-1.)*(1.-
frac)*da/2.*sinalfa;
318 GeoGenfun::GENFUNCTION Zcd = GeoGenfun::FixedConstant(
Zmin+(tl1+bl1)/2.+safety_zlen);
320 GeoXF::TRANSFUNCTION TX =
321 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcd) *
322 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycd) *
323 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcd) *
324 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrot)*
332 if (!gStraightAbsorbers) {
339 gStraightAbsorbers->HalfLength(
instance,irl) = thinTrap->getDydzn();
342 if (!gStraightAbsorbers) {
345 gStraightAbsorbers->setTransform (irl,TX);
346 gStraightAbsorbers->setHalfLength(irl,thinTrap->getDydzn());
355 double Dze = Thel/2.;
358 GeoGenfun::GENFUNCTION x1e =
LArGeo::Fx(irl+0., Game, Cenx, Ceny)
361 GeoGenfun::GENFUNCTION x2e =
LArGeo::Fx(irl+1., Game, Cenx, Ceny)
364 GeoGenfun::GENFUNCTION y1e =
LArGeo::Fy(irl+0., Game, Cenx, Ceny)
367 GeoGenfun::GENFUNCTION y2e =
LArGeo::Fy(irl+1., Game, Cenx, Ceny)
370 GeoGenfun::GENFUNCTION dxe = x2e - x1e;
371 GeoGenfun::GENFUNCTION dye = y2e - y1e;
373 GeoGenfun::GENFUNCTION De = Sqrt ( dxe*dxe + dye*dye );
374 GeoGenfun::GENFUNCTION de = Sqrt ( (De - 2.*Rint)*(De + 2.*Rint) );
377 GeoGenfun::GENFUNCTION cosalfae = (de*dxe -iparit*2.*Rint*dye)/De/De;
378 GeoGenfun::GENFUNCTION sinalfae = (de*dye +iparit*2.*Rint*dxe)/De/De;
379 GeoGenfun::GENFUNCTION newalphe =
LArGeo::ATan2(sinalfae,cosalfae);
384 GeoGenfun::GENFUNCTION alfrote = -
M_PI/2. - newalphe;
386 GeoGenfun::GENFUNCTION Xcde = (x1e + x2e)/2.+ (2.*idivi-1.)*(1.-
frac)*de/2.*cosalfae;
387 GeoGenfun::GENFUNCTION Ycde = (y1e + y2e)/2.+ (2.*idivi-1.)*(1.-
frac)*de/2.*sinalfae;
388 GeoGenfun::GENFUNCTION Zcde = GeoGenfun::FixedConstant(
Zmin+(tl1+bl1)/2.+safety_zlen);
391 GeoGenfun::GENFUNCTION alpha_e = ATan(0.5*(bl1-tl1)/h1e);
393 GeoXF::TRANSFUNCTION TXE =
394 GeoXF::Pow(GeoTrf::TranslateX3D(1.0),Xcde) *
395 GeoXF::Pow(GeoTrf::TranslateY3D(1.0),Ycde) *
396 GeoXF::Pow(GeoTrf::TranslateZ3D(1.0),Zcde) *
397 GeoXF::Pow(GeoTrf::RotateZ3D(1.0),-alfrote)*
402 GeoIntrusivePtr<GeoTrap> trap{
new GeoTrap(Dze,0.,0.,h1e(
instance),tl1,bl1,alpha_e(
instance),
405 if (!gStraightElectrodes) {
412 gStraightElectrodes->HalfLength(
instance,irl) = trap->getDydzn();
416 if (!gStraightElectrodes) {
419 gStraightElectrodes->setTransform (irl,TXE);
420 gStraightElectrodes->setHalfLength(irl,trap->getDydzn());
428 if(!
detStore->record(gStraightElectrodes,
"STRAIGHTELECTRODES").isSuccess()) {
430 return StatusCode::FAILURE;
433 if(!
detStore->record(gStraightAbsorbers,
"STRAIGHTABSORBERS").isSuccess()) {
435 return StatusCode::FAILURE;
438 return StatusCode::SUCCESS;