ATLAS Offline Software
Classes | Functions
LArGeo Namespace Reference

Classes

class  BarrelConstruction
 
class  BarrelCryostatConstruction
 Builds GeoModel description of the LAr Electromagnetic Barrel. Descriptions of the presampler and dead material in the crack region are implemented in separate classes. More...
 
class  BarrelPresamplerConstruction
 GeoModel description of the LAr Barrel Presampler. More...
 
class  CryostatConstructionTBEC
 
class  EMECAccordionConstruction
 Class for construction of EMEC internal structure. More...
 
class  EMECConstruction
 GeoModel description of the LAr EMEC envelope and the active part (custom shapes) More...
 
class  EMECModuleConstruction
 
class  EMECSupportConstruction
 GeoModel description of the EMEC Support Structures. More...
 
class  EndcapCryostatConstruction
 Description of the LAr End Cap cryostat, including MBTS description. More...
 
class  EndcapDMConstruction
 
class  FCALConstruction
 
class  HEC2WheelConstruction
 GeoModel description of LAr HEC. More...
 
class  HECClampConstruction
 
class  HECModuleConstruction
 GeoModel description of LAr HECModule. More...
 
class  HECWheelConstruction
 
class  LArDetectorConstructionTBEC
 
class  LArDetectorFactory
 LArDetectorFactory builds GeoModel description of LAr calorimeter by calling relevant 'Construction' classes (Barrel, Endcap). It also builds readout geometry description using LArReadoutGeometry objects. More...
 
class  LArDetectorFactoryLite
 LArDetectorFactoryLite is invoked by the LArDetectorTool when the GeoModel description of LAr calorimeter is built from the SQLite database relevant 'Construction' classes (Barrel, Endcap). It also builds readout geometry. More...
 
class  LArDetectorFactoryTBEC
 
class  RAL
 
class  RALEmb
 
class  RALEmec
 
class  RALExperimentalHall
 
class  RALHec
 
class  TBBarrelCryostatConstruction
 
class  VDetectorParameters
 

Functions

StatusCode buildElStraightSections (StoreGateSvc *detStore, IRDBAccessSvc *paramSvc, IMessageSvc *msgSvc, bool sagging)
 
GeoGenfun::FunctionNoop Fx (double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
 
GeoGenfun::FunctionNoop Fy (double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
 
GeoGenfun::FunctionNoop Del1 (GeoGenfun::GENFUNCTION G)
 
GeoGenfun::FunctionNoop Del2 (GeoGenfun::GENFUNCTION G)
 
GeoGenfun::FunctionNoop ATan2 (GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
 
StatusCode buildMbtsReadout (StoreGateSvc *detStore, IRDBAccessSvc *paramSvc, IMessageSvc *msgSvc, double zposMM, const std::map< std::string, unsigned > &trdMap, const std::string &detKey, const std::string &detNode)
 
StatusCode buildFcalChannelMap (StoreGateSvc *detStore, IRDBAccessSvc *paramSvc, IMessageSvc *msgSvc)
 

Function Documentation

◆ ATan2()

GeoGenfun::FunctionNoop LArGeo::ATan2 ( GeoGenfun::GENFUNCTION  y,
GeoGenfun::GENFUNCTION  x 
)

Definition at line 50 of file BarrelAuxFunctions.cxx.

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 }

◆ buildElStraightSections()

StatusCode LArGeo::buildElStraightSections ( StoreGateSvc detStore,
IRDBAccessSvc paramSvc,
IMessageSvc *  msgSvc,
bool  sagging 
)

Definition at line 27 of file ElStraightSectionBuilder.cxx.

31 {
32  MsgStream log(msgSvc, "buildElStraightSections");
33 
34  GeoGenfun::Sqrt Sqrt;
35  GeoGenfun::ATan ATan;
36 
37  IRDBRecordset_ptr barrelGeometryRec = paramSvc->getRecordsetPtr("BarrelGeometry","");
38  IRDBRecordset_ptr barrelSaggingRec = paramSvc->getRecordsetPtr("BarrelSagging","");
39  IRDBRecordset_ptr barrelEtaTransRec = paramSvc->getRecordsetPtr("BarrelEtaTrans","");
40  IRDBRecordset_ptr coldContractionRec = paramSvc->getRecordsetPtr("ColdContraction","");
41 
42  double Moth_Z_min = (*barrelGeometryRec)[0]->getDouble("ZMIN")*SYSTEM_OF_UNITS::cm;
43  double Moth_Z_max = (*barrelGeometryRec)[0]->getDouble("ZMAX")*SYSTEM_OF_UNITS::cm;
44  double Moth_inner_radius = (*barrelGeometryRec)[0]->getDouble("RMIN")*SYSTEM_OF_UNITS::cm;
45 
46  // number of zigs for accordion
47  int Nbrt = (*barrelGeometryRec)[0]->getInt("NBRT"); // =14
48 
49  // Z coordinates for half barrel in
50  double Bar_Z_min = Moth_Z_min;
51  double Bar_Z_max = Moth_Z_max;
52 
53  double Bar_Rcmx = (*barrelGeometryRec)[0]->getDouble("RMINHIGHZ")*SYSTEM_OF_UNITS::cm;
54 
55  // Accordion shape parameters:
56  // rho phi of curvature centers and delta's
57  // IN 2D_transverse LOCAL framework of a layer and symetry axis as X_axis
58  // delta's are GEOMETRICAL angles of straight parts w.r. the Y_axis )
59 
60  double Rhocen[15], Phicen[15], Delta[15], deltay[15], deltax[15], TetaTrans[15];
61  for (int idat=0; idat<15; idat++) {
62  std::string strIdat = std::to_string(idat);
63  Rhocen[idat] = (*barrelGeometryRec)[0]->getDouble("RHOCEN_"+strIdat)*SYSTEM_OF_UNITS::cm;
64  Phicen[idat] = (*barrelGeometryRec)[0]->getDouble("PHICEN_"+strIdat)*SYSTEM_OF_UNITS::deg;
65  Delta[idat] = (*barrelGeometryRec)[0]->getDouble("DELTA_"+strIdat)*SYSTEM_OF_UNITS::deg;
66  if(idat == 14) {
67  Delta[idat] = (90.0) * SYSTEM_OF_UNITS::deg;
68  }
69 
70  // Maximum SAGGING displacement for each of the fifteen folds in Gaudi::Units::mm
71  // (should be 0.0, 0.17, 0.30, 0.63, 0.78, 1.06, 1.09, 1.21, 1.07, 1.03, 0.74, 0.61, 0.27, 0.20, 0.0)
72  //GUtmp sagging amplied by 10
73  if (sagging) {
74  deltay[idat] = (*barrelSaggingRec)[0]->getDouble("SAG_"+strIdat)*SYSTEM_OF_UNITS::cm;
75  deltax[idat] = (*barrelSaggingRec)[0]->getDouble("SAG_"+strIdat+"_X")*SYSTEM_OF_UNITS::cm;
76  }
77  else {
78  deltay[idat]=0.;
79  deltax[idat]=0.;
80  }
81 
82  // eta of lead transition
83  double etaTrans = (*barrelEtaTransRec)[idat]->getDouble("ETATRANS");
84  TetaTrans[idat] = 2.*atan(exp(-etaTrans));
85  }
86 
87  // parity of accordion waves
88  int checkParity = (Phicen[0]<0. ? 1 : 0); // 0 for case where first absorber wave goes up
89  // 1 for case where first absorber wave goes down
90 
91  int Ncell = (*barrelGeometryRec)[0]->getInt("NCELMX");
92  int Nabsorber = (Ncell==64) ? Ncell + 1 : Ncell;
93  int Nelectrode = Ncell;
94 
95  // z of end of G10 ring
96  double z1 = (*barrelGeometryRec)[0]->getDouble("G10FRONTDELTAZ")*SYSTEM_OF_UNITS::cm + Moth_Z_min;
97  // radius of end of G10 ring
98  const double r1 = Moth_inner_radius
99  + (*barrelGeometryRec)[0]->getDouble("XEL1")*SYSTEM_OF_UNITS::cm
100  + (*barrelGeometryRec)[0]->getDouble("XG10")*SYSTEM_OF_UNITS::cm;
101  // minimum radius at end of volume
102  const double r2 = (*barrelGeometryRec)[0]->getDouble("RMINHIGHZ")*SYSTEM_OF_UNITS::cm;
103  const double inv_r2_r1 = 1. / (r2-r1);
104 
105  {
106  // Construct the straight and the corner parts of the Accordion plates
107  double Thgl = (*barrelGeometryRec)[0]->getDouble("THGL")*SYSTEM_OF_UNITS::cm;
108  double Thfe = (*barrelGeometryRec)[0]->getDouble("THFE")*SYSTEM_OF_UNITS::cm;
109  double Thpb = (*barrelGeometryRec)[0]->getDouble("THPB")*SYSTEM_OF_UNITS::cm;
110  double Thcu = (*barrelGeometryRec)[0]->getDouble("THCU")*SYSTEM_OF_UNITS::cm;
111  double Thfg = (*barrelGeometryRec)[0]->getDouble("THFG")*SYSTEM_OF_UNITS::cm;
112 
113  double Contract = (*coldContractionRec)[0]->getDouble("ABSORBERCONTRACTION");
114 
115  double Thce = (Thpb+Thgl+Thfe)*Contract;
116  double Thel = Thcu+Thfg;
117 
118  double Zmin = Bar_Z_min;
119  double Zmax = Bar_Z_max;
120  double /*Zcp2[15],*/Along[14];
121 
122  double Zcp1l[14],Zcp1h[14],Zcp2l[14],Zcp2h[14];
123  double Rhol[14],Rhoh[14];
124 
125  double safety_along = 0.007*SYSTEM_OF_UNITS::mm;
126 
127  // Compute centers of curvature coordinates in a local frame.
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]); // Phicen[] already in radians
131  Ceny[jf] = Rhocen[jf]*sin(Phicen[jf]);
132  }
133 
134  // Compute staight lengths of folds
135  double Rint = (*barrelGeometryRec)[0]->getDouble("RINT")*SYSTEM_OF_UNITS::cm;
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);
141 
142  double ddelta = M_PI/2.-Delta[jl];
143  // different parity depending on direction of first wave
144  if (checkParity==0) {
145  if (jl%2==1) {
146  ddelta=-1.*ddelta;
147  }
148  } else {
149  if (jl%2==0) {
150  ddelta=-1.*ddelta;
151  }
152  }
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);
158  Rhol[jl] = sqrt(x1*x1+y1*y1);
159  Rhoh[jl] = sqrt(x2*x2+y2*y2);
160  Zcp1l[jl] = Rhol[jl]/tan(TetaTrans[jl]);
161  Zcp1h[jl] = Rhoh[jl]/tan(TetaTrans[jl+1]);
162  if (Rhol[jl] < r2) {
163  Zcp2l[jl] = z1 + (Rhol[jl]-r1)*inv_r2_r1*(Moth_Z_max-z1);
164  }
165  else {
166  Zcp2l[jl]=Moth_Z_max;
167  }
168  if (Rhoh[jl] < r2) {
169  Zcp2h[jl] = z1 + (Rhoh[jl]-r1)*inv_r2_r1*(Moth_Z_max-z1);
170  }
171  else {
172  Zcp2h[jl]=Moth_Z_max;
173  }
174  }
175 
176  double Psi = (*barrelGeometryRec)[0]->getDouble("ALFA")*SYSTEM_OF_UNITS::deg; // 360.*Gaudi::Units::deg/1024
177  double Gama0 = (*barrelGeometryRec)[0]->getDouble("PHIFIRST");
178  double Alfa = Psi; // size of one phi cell
179 
180  GeoGenfun::Variable icopy;
181  GeoGenfun::GENFUNCTION Game = Gama0 + Psi/2 + Alfa*icopy;
182  GeoGenfun::GENFUNCTION Gama = Gama0 + Alfa*icopy;
183 
184  GeoStraightAccSection* gStraightElectrodes{nullptr};
185  GeoStraightAccSection* gStraightAbsorbers{nullptr};
186  //
187  // Loop through the straight and corner(Fold) parts of the Accordion plates
188  // Repeat each part around Phi, then move to the next, towards outer radii
189  //
190 
191  // GU 09/06/2004 add some safety in z size
192  double safety_zlen=0.050*SYSTEM_OF_UNITS::mm;
193 
194  for(int irl=0; irl<Nbrt; irl++) { // loop over zig-zag in radius
195  int iparit;
196  // different parity depending on direction of first wave
197  if (checkParity==0) {
198  iparit= (1-2*(irl%2)); // +1 for irl=0,2,4,.. -1 for irl=1,3,5,..
199  }
200  else {
201  iparit=(2*(irl%2)-1); // -1 for irl=0,2,3... +1 for irl=1,3,5
202  }
203 
204  // special case if Rhocen[il] < Bar_Rcmx < Rhocen[il+1]
205  // we had to divide the fold in two different pieces to deal with the shape
206  int ndivi=1;
207  if (Rhocen[irl] < Bar_Rcmx && Rhocen[irl+1] > Bar_Rcmx) {
208  ndivi=2;
209  }
210 
211  for (int idivi=0;idivi<ndivi;idivi++) {
212 
213  // lenght in z at beginning and end of straigth part
214  double bl1,tl1;
215  double frac;
216  if (ndivi==1) {
217  bl1 = (std::min(Zcp2l[irl],Zmax)-Zmin)/2.;
218  tl1 = (std::min(Zcp2h[irl],Zmax)-Zmin)/2.;
219  frac=1.;
220  }
221  else {
222  if (idivi==0) {
223  bl1 = (std::min(Zcp2l[irl],Zmax)-Zmin)/2.;
224  tl1 = (Zmax-Zmin)/2.;
225  frac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
226  }
227  else {
228  bl1 = (Zmax-Zmin)/2.;
229  tl1 = (Zmax-Zmin)/2.;
230  frac=(Rhoh[irl]-Bar_Rcmx)/(Rhoh[irl]-Rhol[irl]);
231  }
232  }
233  //GU 09/06/2004 add small safety in size tl1 and bl1
234  tl1=tl1-safety_zlen;
235  bl1=bl1-safety_zlen;
236 
237  // =================================== Absorbers
238  {
239  // thickness of absorber
240  double Dz = Thce/2.;
241 
242  // For absorbers
243  GeoGenfun::GENFUNCTION x1a = LArGeo::Fx(irl+0., Gama, Cenx, Ceny)
244  +deltay[irl]*LArGeo::Del1(Gama)
245  +deltax[irl]*LArGeo::Del2(Gama);
246  GeoGenfun::GENFUNCTION x2a = LArGeo::Fx(irl+1., Gama, Cenx, Ceny)
247  +deltay[irl+1]*LArGeo::Del1(Gama)
248  +deltax[irl+1]*LArGeo::Del2(Gama);
249  GeoGenfun::GENFUNCTION y1a = LArGeo::Fy(irl+0., Gama, Cenx, Ceny)
250  -deltay[irl]*LArGeo::Del2(Gama)
251  +deltax[irl]*LArGeo::Del1(Gama);
252  GeoGenfun::GENFUNCTION y2a = LArGeo::Fy(irl+1., Gama, Cenx, Ceny)
253  -deltay[irl+1]*LArGeo::Del2(Gama)
254  +deltax[irl+1]*LArGeo::Del1(Gama);
255  GeoGenfun::GENFUNCTION dx = x2a - x1a;
256  GeoGenfun::GENFUNCTION dy = y2a - y1a;
257 
258  // Da the two fold centers distance, da straight part length
259 
260  GeoGenfun::GENFUNCTION Da = Sqrt ( dx*dx + dy*dy );
261  GeoGenfun::GENFUNCTION da = Sqrt ( (Da - 2.*Rint)*(Da + 2.*Rint) );
262 
263  // newalpha (slant angle) value of the rotation angle around Z_axis
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);
267 
268  GeoGenfun::GENFUNCTION h1 = da/2. * frac - .007*SYSTEM_OF_UNITS::mm;
269 
270  // thick absorber pieces
271  // more correct computation with z lenght computed exactly at the
272  // radius of the end and the beginning of the straight sections
273  double Xb1,Xt1;
274  if (ndivi==1) {
275  Xb1 = (Zcp1l[irl]-Zmin)/2.;
276  Xt1 = (Zcp1h[irl]-Zmin)/2.;
277  }
278  else {
279  double xfrac=(Bar_Rcmx-Rhol[irl])/(Rhoh[irl]-Rhol[irl]);
280  if (idivi==0) {
281  Xb1 = (Zcp1l[irl]-Zmin)/2.;
282  Xt1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-Zmin)/2.;
283  }
284  else {
285  Xb1 = (xfrac*Zcp1h[irl]+(1.-xfrac)*Zcp1l[irl]-Zmin)/2.;
286  Xt1 = (Zcp1h[irl]-Zmin)/2.;
287  }
288  }
289 
290  // lengths that remain to be covered with the thin absorber
291  double Xt2 = tl1-Xt1;
292  double Xb2 = bl1-Xb1;
293 
294  Xt2 = Xt2 -0.007*SYSTEM_OF_UNITS::mm;
295  Xb2 = Xb2 -0.007*SYSTEM_OF_UNITS::mm;
296 
297 
298  GeoGenfun::GENFUNCTION alpha = ATan(0.5*(bl1-tl1)/h1);
299 
300  // angle that would be needed for trap do describe only thin absorber
301  // ------------------|---------X---------|
302  // <-------------------------------------> 2*tl1
303  // <---------> Xt2
304  //
305  // <---------------------------------> 2*bl1
306  // <--------> Xb2
307  // ---------------|--------X---------|
308  // alpha = (-) angle between X's
309  // tan(alpha) = delta X size / width, deltaX size = 2*tl1-Xt2-(2*bl1-Xb2), width = 2.*h1
310 
311  // .newalpha is already computed angle wrt z axis
312  // P/2 rotation is to get absorber aligned along local x axis
313  // instead of y, then rotate with angle newalpha
314  GeoGenfun::GENFUNCTION alfrot = -M_PI/2. - newalpha;
315 
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);
319 
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)*
325  GeoTrf::RotateY3D(-90*SYSTEM_OF_UNITS::deg);
326 
327  for (int instance = 0; instance < Nabsorber; instance++) {
328 
329  GeoIntrusivePtr<GeoTrap> thinTrap{new GeoTrap(Dz,0.,0.,h1(instance),tl1,bl1,alpha(instance),
330  h1(instance),tl1,bl1,alpha(instance))};
331  if (sagging) {
332  if (!gStraightAbsorbers) {
333  gStraightAbsorbers = new GeoStraightAccSection();
334  }
335  gStraightAbsorbers->XCent(instance,irl)=TX(instance)(0,3); //dx
336  gStraightAbsorbers->YCent(instance,irl)=TX(instance)(1,3); //dy
337  gStraightAbsorbers->Cosu(instance,irl) =-(TX(instance)(0,1)); //xy
338  gStraightAbsorbers->Sinu(instance,irl) = (TX(instance)(0,2)); //xz
339  gStraightAbsorbers->HalfLength(instance,irl) = thinTrap->getDydzn();
340  }
341  else {
342  if (!gStraightAbsorbers) {
343  gStraightAbsorbers = new GeoStraightAccSection();
344  }
345  gStraightAbsorbers->setTransform (irl,TX);
346  gStraightAbsorbers->setHalfLength(irl,thinTrap->getDydzn());
347  break;
348  }
349  } // loop over instances
350  } // end absorbers
351 
352  // ======================== Electrodes:
353  {
354  // thickness of electrode
355  double Dze = Thel/2.;
356 
357  // For electrodes
358  GeoGenfun::GENFUNCTION x1e = LArGeo::Fx(irl+0., Game, Cenx, Ceny)
359  +deltay[irl]*LArGeo::Del1(Game)
360  +deltax[irl]*LArGeo::Del2(Game);
361  GeoGenfun::GENFUNCTION x2e = LArGeo::Fx(irl+1., Game, Cenx, Ceny)
362  +deltay[irl+1]*LArGeo::Del1(Game)
363  +deltax[irl+1]*LArGeo::Del2(Game);
364  GeoGenfun::GENFUNCTION y1e = LArGeo::Fy(irl+0., Game, Cenx, Ceny)
365  -deltay[irl]*LArGeo::Del2(Game)
366  +deltax[irl]*LArGeo::Del1(Game);
367  GeoGenfun::GENFUNCTION y2e = LArGeo::Fy(irl+1., Game, Cenx, Ceny)
368  -deltay[irl+1]*LArGeo::Del2(Game)
369  +deltax[irl+1]*LArGeo::Del1(Game);
370  GeoGenfun::GENFUNCTION dxe = x2e - x1e;
371  GeoGenfun::GENFUNCTION dye = y2e - y1e;
372  // De the two fold centers distance, de straight part length
373  GeoGenfun::GENFUNCTION De = Sqrt ( dxe*dxe + dye*dye );
374  GeoGenfun::GENFUNCTION de = Sqrt ( (De - 2.*Rint)*(De + 2.*Rint) );
375 
376  //newalphe (slant angle) value of the rotation angle around Z_axis
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);
380 
381  // newalphae is already computed angle wrt z axis
382  // P/2 rotation is to get absorber aligned along local x axis
383  // instead of y, then rotate with angle newalpha
384  GeoGenfun::GENFUNCTION alfrote = -M_PI/2. - newalphe;
385 
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);
389 
390  GeoGenfun::GENFUNCTION h1e = de/2.*frac - .007*SYSTEM_OF_UNITS::mm;
391  GeoGenfun::GENFUNCTION alpha_e = ATan(0.5*(bl1-tl1)/h1e);
392 
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)*
398  GeoTrf::RotateY3D(-90*SYSTEM_OF_UNITS::deg);
399 
400  for (int instance = 0; instance < Nelectrode; instance++) {
401 
402  GeoIntrusivePtr<GeoTrap> trap{new GeoTrap(Dze,0.,0.,h1e(instance),tl1,bl1,alpha_e(instance),
403  h1e(instance),tl1,bl1,alpha_e(instance))};
404  if (sagging) {
405  if (!gStraightElectrodes) {
406  gStraightElectrodes = new GeoStraightAccSection();
407  }
408  gStraightElectrodes->XCent(instance,irl)=TXE(instance)(0,3); //dx
409  gStraightElectrodes->YCent(instance,irl)=TXE(instance)(1,3); //dy
410  gStraightElectrodes->Cosu(instance,irl) =-(TXE(instance)(0,1)); //xy
411  gStraightElectrodes->Sinu(instance,irl) = (TXE(instance)(0,2)); //xz
412  gStraightElectrodes->HalfLength(instance,irl) = trap->getDydzn();
413 
414  }
415  else {
416  if (!gStraightElectrodes) {
417  gStraightElectrodes = new GeoStraightAccSection();
418  }
419  gStraightElectrodes->setTransform (irl,TXE);
420  gStraightElectrodes->setHalfLength(irl,trap->getDydzn());
421  break;
422  }
423  } // loop over instances
424  } // end loop over ndivi
425  } // end loop over irl (zig-zag)
426  }
427 
428  if(!detStore->record(gStraightElectrodes,"STRAIGHTELECTRODES").isSuccess()) {
429  log << MSG::FATAL << "Cannot store STRAIGHTELECTRODES structure" << endmsg;
430  return StatusCode::FAILURE;
431  }
432 
433  if(!detStore->record(gStraightAbsorbers,"STRAIGHTABSORBERS").isSuccess()) {
434  log << MSG::FATAL << "Cannot store STRAIGHTABSORBERS structure" << endmsg;
435  return StatusCode::FAILURE;
436  }
437  }
438  return StatusCode::SUCCESS;
439 }

◆ buildFcalChannelMap()

StatusCode LArGeo::buildFcalChannelMap ( StoreGateSvc detStore,
IRDBAccessSvc paramSvc,
IMessageSvc *  msgSvc 
)

Definition at line 14 of file FCALChannelMapBuilder.cxx.

17 {
18  MsgStream log(msgSvc, "buildFcalChannelMap");
19  FCAL_ChannelMap* cmap = new FCAL_ChannelMap(0);
20 
21  std::vector<IRDBRecordset_ptr> recordsets { paramSvc->getRecordsetPtr("FCalElecMod1","")
22  , paramSvc->getRecordsetPtr("FCalElecMod2","")
23  , paramSvc->getRecordsetPtr("FCalElecMod3","") };
24 
25  for(const IRDBRecordset_ptr& recordset : recordsets) {
26  for(const IRDBRecord_ptr& rec : *recordset) {
27  cmap->add_tube(rec->getString("TILENAME")
28  , rec->getInt("MODNUMBER")
29  , rec->getInt("IDENTIFIER")
30  , rec->getInt("I")
31  , rec->getInt("J")
32  , rec->getDouble("X")
33  , rec->getDouble("Y")
34  , rec->getString("HVFEEDTHROUGHID"));
35  }
36  }
37 
38  cmap->finish();
39 
40  StatusCode sc = detStore->record(cmap,"FCAL_ChannelMap");
41  if(sc.isFailure()) {
42  log << MSG::FATAL << "Failed to build FCAL Channel Map" << endmsg;
43  }
44 
45  return sc;
46 }

◆ buildMbtsReadout()

StatusCode LArGeo::buildMbtsReadout ( StoreGateSvc detStore,
IRDBAccessSvc paramSvc,
IMessageSvc *  msgSvc,
double  zposMM,
const std::map< std::string, unsigned > &  trdMap,
const std::string &  detKey,
const std::string &  detNode 
)

Definition at line 22 of file MbtsReadoutBuilder.cxx.

29 {
30  MsgStream log(msgSvc, "buildMbtsReadout");
31 
32  IRDBRecordset_ptr larPositionRec = paramSvc->getRecordsetPtr("LArPosition",detKey,detNode);
33  IRDBRecordset_ptr mbtsGen = paramSvc->getRecordsetPtr("MBTSGen",detKey,detNode);
34  IRDBRecordset_ptr mbtsScin = paramSvc->getRecordsetPtr("MBTSScin",detKey,detNode);
35  IRDBRecordset_ptr mbtsTrds = paramSvc->getRecordsetPtr("MBTSTrds",detKey,detNode);
36 
37  // Get ID helper
38  const TileTBID* tileTBID = nullptr;
39  StatusCode sc = detStore->retrieve(tileTBID);
40  if(sc.isFailure() || !tileTBID) {
41  log << MSG::ERROR << "Failed to initialize TileTBID" << endmsg;
42  return sc;
43  }
44 
45  const IRDBRecord *posRec = GeoDBUtils::getTransformRecord(larPositionRec, "LARCRYO_EC_POS");
46  if(!posRec) {
47  log << MSG::ERROR << "No lar position record in the database" << endmsg;
48  return StatusCode::FAILURE;
49  }
50 
52  double globalZMM = xfPos.translation().z() + zposMM;
53 
54  // Create MBTS manager
55  MbtsDetDescrManager* mbtsManager = new MbtsDetDescrManager();
56 
57  // Create Calo DDEs for both sides
58  for(int side=0; side<2; side++) {
59  int sidesign = (side ? -1 : 1);
60 
61  for(unsigned int scinId=0; scinId<2; scinId++) {
62  int nScin(0), eta(0);
63  double dx1Scin(0.), dzScin(0.), zposScin(0.), rposScin(0.), scineta(0.), scindeta(0.), deltaPhi(0.), startPhi(0.);
64 
65  if(mbtsGen->size()==0) {
66  // The "old" description:
67  const IRDBRecord* curScin = (*mbtsScin)[scinId];
68 
69  nScin = curScin->getInt("SCINNUM");
70  eta = curScin->getInt("SCIN_ID")-1;
71  dx1Scin = curScin->getDouble("DX1")*SYSTEM_OF_UNITS::mm;
72  dzScin = curScin->getDouble("DZ")*SYSTEM_OF_UNITS::mm;
73  zposScin = curScin->getDouble("ZPOS")*SYSTEM_OF_UNITS::mm;
74  rposScin = curScin->getDouble("RPOS")*SYSTEM_OF_UNITS::mm;
75  if(!curScin->isFieldNull("ETA")) {
76  scineta = curScin->getDouble("ETA");
77  }
78  if(!curScin->isFieldNull("DETA")) {
79  scindeta = curScin->getDouble("DETA");
80  }
81  deltaPhi = 360.*SYSTEM_OF_UNITS::deg/nScin;
82  if(!curScin->isFieldNull("STARTPHI")) {
83  startPhi = curScin->getDouble("STARTPHI");
84  }
85  }
86  else {
87  // The "new" description
88  std::string scinName = (scinId==0?"MBTS1":"MBTS2");
89  const IRDBRecord* curScin = (*mbtsTrds)[trdMap.at(scinName)];
90  nScin = (*mbtsGen)[0]->getInt("NSCIN");
91  eta = curScin->getInt("SCIN_ID")-1;
92  dx1Scin = curScin->getDouble("DX1")*SYSTEM_OF_UNITS::mm;
93  dzScin = curScin->getDouble("DZ")*SYSTEM_OF_UNITS::mm;
94  zposScin = (*mbtsGen)[0]->getDouble("ZPOSENV")*SYSTEM_OF_UNITS::mm;
95  rposScin = ((*mbtsGen)[0]->getDouble("RPOSENV")+curScin->getDouble("ZPOS"))*SYSTEM_OF_UNITS::mm;
96  scineta = curScin->getDouble("ETA");
97  scindeta = curScin->getDouble("DETA");
98  startPhi = (*mbtsGen)[0]->getDouble("STARTPHI");
99  deltaPhi = 360.*SYSTEM_OF_UNITS::deg/nScin;
100  }
101 
102  for(int phi=0; phi<nScin; phi++) {
103  // Construct CaloDDE
104  MbtsDetectorElement* mbtsDDE = new MbtsDetectorElement();
105  // Construct Identifier
106  mbtsDDE->set_id(tileTBID->channel_id(sidesign,phi,eta));
107  mbtsDDE->set_z((globalZMM + zposScin)*sidesign);
108  mbtsDDE->set_dz(dx1Scin);
109  mbtsDDE->set_r(rposScin);
110  mbtsDDE->set_dr(dzScin);
111  mbtsDDE->set_phi((phi+startPhi)*deltaPhi);
112  mbtsDDE->set_dphi(deltaPhi*0.5);
113  mbtsDDE->set_eta(scineta);
114  mbtsDDE->set_deta(scindeta);
115  mbtsDDE->compute_derived();
116  // Store CaloDDE into the manager
117  mbtsManager->add(mbtsDDE);
118  } // Loop over indivudual scintillators
119  } // Loop over mbtsScin contents
120  } // Loop over sides
121 
122  // Record the manager into the DS
123  sc = detStore->record(mbtsManager,"MBTS");
124  if(sc.isFailure()) {
125  log << MSG::FATAL << "Failed to record MBTS Detector Manager into the DS" << endmsg;
126  }
127  return sc;
128 }

◆ Del1()

GeoGenfun::FunctionNoop LArGeo::Del1 ( GeoGenfun::GENFUNCTION  G)

Definition at line 34 of file BarrelAuxFunctions.cxx.

35 {
36  GeoGenfun::Cos Cos;
37  GeoGenfun::Sin Sin;
38  GeoGenfun::GENFUNCTION result = (Cos( G ) * Sin( G ) );
39  return {&result};
40 }

◆ Del2()

GeoGenfun::FunctionNoop LArGeo::Del2 ( GeoGenfun::GENFUNCTION  G)

Definition at line 42 of file BarrelAuxFunctions.cxx.

43 {
44  GeoGenfun::Cos Cos;
45  GeoGenfun::GENFUNCTION result = (Cos( G ) * Cos( G ) );
46  return {&result};
47 }

◆ Fx()

GeoGenfun::FunctionNoop LArGeo::Fx ( double  r,
GeoGenfun::GENFUNCTION  G,
const double  Cenx[],
const double  Ceny[] 
)

Definition at line 16 of file BarrelAuxFunctions.cxx.

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 }

◆ Fy()

GeoGenfun::FunctionNoop LArGeo::Fy ( double  r,
GeoGenfun::GENFUNCTION  G,
const double  Cenx[],
const double  Ceny[] 
)

Definition at line 25 of file BarrelAuxFunctions.cxx.

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 }
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
beamspotman.r
def r
Definition: beamspotman.py:676
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
Trk::VKContraintType::Theta
@ Theta
TileTBID::channel_id
Identifier channel_id(int type, int module, int channel) const
identifer for one channel of a Tile testbeam detector
Definition: TileTBID.cxx:197
VertexShift::Zmax
const float Zmax
Definition: VertexShift.h:26
MbtsDetectorElement::set_dz
void set_dz(double dz)
Definition: CaloDetectorElements.h:397
MbtsDetectorElement::set_id
void set_id(const Identifier &id)
Definition: CaloDetectorElements.h:395
get_generator_info.result
result
Definition: get_generator_info.py:21
GeoStraightAccSection
Record of All Electrode Straight Pieces.
Definition: GeoStraightAccSection.h:24
MbtsDetectorElement::compute_derived
void compute_derived()
Definition: CaloDetectorElements.cxx:598
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
GeoDBUtils::getTransformRecord
static const IRDBRecord * getTransformRecord(IRDBRecordset_ptr positionRecSet, const std::string &key)
Definition: GeoDBUtils.h:23
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
MbtsDetectorElement::set_phi
void set_phi(double phi)
Definition: CaloDetectorElements.h:402
FCAL_ChannelMap
This class contains the tube and tile maps for the FCAL A tile is of a set of FCAL tubes.
Definition: LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h:34
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
Zmin
double Zmin
Definition: LArDetectorConstructionTBEC.cxx:58
M_PI
#define M_PI
Definition: ActiveFraction.h:11
deg
#define deg
Definition: SbPolyhedron.cxx:17
FCAL_ChannelMap::add_tube
void add_tube(const std::string &tileName, int mod, int id, int i, int j, double xCm, double yCm)
Definition: LArCalorimeter/LArGeoModel/LArReadoutGeometry/src/FCAL_ChannelMap.cxx:69
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
MbtsDetectorElement::set_deta
void set_deta(double deta)
Definition: CaloDetectorElements.h:401
MbtsDetectorElement::set_dphi
void set_dphi(double dphi)
Definition: CaloDetectorElements.h:403
MCP::ScaleSmearParam::r2
@ r2
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
x
#define x
GeoDBUtils::getTransform
static GeoTrf::Transform3D getTransform(const IRDBRecord *currentRec)
Definition: GeoDBUtils.h:33
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
LArGeo::Fx
GeoGenfun::FunctionNoop Fx(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:16
MbtsDetDescrManager
Definition: MbtsDetDescrManager.h:16
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
MbtsDetDescrManager::add
void add(CaloDetDescrElement *element)
Definition: MbtsDetDescrManager.cxx:31
TRT::Hit::side
@ side
Definition: HitInfo.h:83
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
MbtsDetectorElement::set_z
void set_z(double z)
Definition: CaloDetectorElements.h:396
LArGeo::Del1
GeoGenfun::FunctionNoop Del1(GeoGenfun::GENFUNCTION G)
Definition: BarrelAuxFunctions.cxx:34
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
G
#define G(x, y, z)
Definition: MD5.cxx:113
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MbtsDetectorElement::set_dr
void set_dr(double dr)
Definition: CaloDetectorElements.h:399
checkxAOD.frac
frac
Definition: Tools/PyUtils/bin/checkxAOD.py:259
Dz
double Dz
Definition: LArDetectorConstructionTBEC.cxx:59
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MbtsDetectorElement::set_eta
void set_eta(double eta)
Definition: CaloDetectorElements.h:400
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
LArGeo::Del2
GeoGenfun::FunctionNoop Del2(GeoGenfun::GENFUNCTION G)
Definition: BarrelAuxFunctions.cxx:42
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
FCAL_ChannelMap::finish
void finish()
Definition: LArCalorimeter/LArGeoModel/LArReadoutGeometry/src/FCAL_ChannelMap.cxx:55
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
LArGeo::Fy
GeoGenfun::FunctionNoop Fy(double r, GeoGenfun::GENFUNCTION G, const double Cenx[], const double Ceny[])
Definition: BarrelAuxFunctions.cxx:25
y
#define y
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
MbtsDetectorElement
Mbts Detector Element.
Definition: CaloDetectorElements.h:387
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
IRDBRecord_ptr
std::unique_ptr< IRDBRecord > IRDBRecord_ptr
Definition: IRDBRecordset.h:23
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TileTBID
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:65
IRDBRecord::getDouble
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
MCP::ScaleSmearParam::r1
@ r1
MbtsDetectorElement::set_r
void set_r(double r)
Definition: CaloDetectorElements.h:398
LArGeo::ATan2
GeoGenfun::FunctionNoop ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
Definition: BarrelAuxFunctions.cxx:50