ATLAS Offline Software
Geometry.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArCafJobs/Geometry.h"
6 
7 #include "TH2.h"
8 #include "TProfile2D.h"
9 #include "TMath.h"
10 #include <vector>
11 
12 #include <iostream>
13 using std::cout;
14 using std::endl;
15 
16 using namespace LArSamples;
17 
18 TH2D* Geo::partitionHist(PartitionId part, const TString& name, const TString& title)
19 {
20  TH2D* h = new TH2D(name, title, nFEBs(part), -0.5, nFEBs(part) - 0.5, nPartitionChannels(part), -0.5, nPartitionChannels(part) - 0.5);
22  return h;
23 }
24 
25 
26 TProfile2D* Geo::partitionProfileHist(PartitionId part, const TString& name, const TString& title)
27 {
28  TProfile2D* h = new TProfile2D(name, title, nFEBs(part), -0.5, nFEBs(part) - 0.5, nPartitionChannels(part), -0.5, nPartitionChannels(part) - 0.5);
30  return h;
31 }
32 
33 
35 {
36  if (hist->GetXaxis()->GetNbins() != nFEBs(part)) return false;
37  for (int i = 0; i < nFeedThroughs(part); i++)
38  hist->GetXaxis()->SetBinLabel(1 + i*nSlots(part), feedThroughName(part, i));
39 
40  short nTicks = 16;
41  if (hist->GetYaxis()->GetNbins() != nPartitionChannels(part)) return false;
42  for (int i = 0; i < nTicks; i++)
43  hist->GetYaxis()->SetBinLabel(1 + nPartitionChannels(part)/nTicks*i, Form("%d", nPartitionChannels(part)/nTicks*i));
44 
45  return true;
46 }
47 
48 
50 {
51  if (Id::summary(part) == EMB) return 32;
52  if (Id::summary(part) == EMEC) return 25;
53  if (Id::summary(part) == HEC) return 25;
54  if (Id::summary(part) == FCAL) return 25;
55  return 0;
56 }
57 
58 
60 {
61  if (Id::summary(part) == EMB) return 14;
62  if (Id::summary(part) == EMEC) return 15;
63  if (Id::summary(part) == HEC) return 15;
64  if (Id::summary(part) == FCAL) return 15;
65  return 0;
66 }
67 
68 
69 short Geo::nFEBs()
70 {
71  short n = 0;
80  return n;
81 }
82 
83 
85 {
86  short n = 0;
88  for (unsigned int c = 0; c < 10; c++)
89  for (unsigned short l = Geo::firstLayer(cal[c]); l < Geo::firstLayer(cal[c]) + Geo::nLayers(cal[c]); l++)
90  for (unsigned short r = 0; r < Geo::nRegions(cal[c], l); r++) {
91  n += Geo::nEta(cal[c], l);
92  }
93 
94  return n;
95 }
96 
97 
99 {
100  return 128;
101 }
102 
103 
105 {
106  if (Id::matchCalo(calo, EMB)) return 0;
107  if (Id::matchCalo(calo, EMEC)) return 0;
108  if (Id::matchCalo(calo, HEC)) return 0;
109  if (Id::matchCalo(calo, FCAL)) return 1;
110  return -1;
111 }
112 
113 
114 short Geo::nLayers(CaloId calo)
115 {
116  if (Id::matchCalo(calo, EMB)) return 4;
117  if (Id::matchCalo(calo, EMEC)) return 4;
118  if (Id::matchCalo(calo, HEC)) return 4;
119  if (Id::matchCalo(calo, FCAL)) return 3;
120  return -1;
121 }
122 
123 
124 short Geo::nRegions(CaloId calo, short layer)
125 {
126  if (Id::matchCalo(calo, EMB)) {
127  if (layer == 1) return 2;
128  if (layer == 2) return 2;
129  return 1;
130  }
131 
132  if (Id::matchCalo(calo, EMEC_OUTER)) {
133  if (layer == 1) return 6;
134  if (layer == 2) return 2;
135  return 1;
136  }
137 
138  if (Id::matchCalo(calo, EMEC_INNER)) return 1;
139  if (Id::matchCalo(calo, HEC)) return 2;
140  if (Id::matchCalo(calo, FCAL)) return 1;
141 
142  return 0;
143 }
144 
145 
146 short Geo::firstEta(CaloId calo, short layer, short region)
147 {
148  if (Id::matchCalo(calo, EMB) && layer == 1 && region == 0) return 1;
149  if (Id::matchCalo(calo, HEC) && layer == 2 && region == 0) return 1;
150  if (Id::matchCalo(calo, HEC) && layer == 3 && region == 0) return 1;
151  return 0;
152 }
153 
154 
155 short Geo::nEta(CaloId calo, short layer)
156 {
157  if (calo == EMB) return 2*nEta(EMB_A, layer);
158  if (calo == EMEC) return 2*nEta(EMEC_A, layer);
159  if (calo == EMEC_A || calo == EMEC_C) return nEta(EMEC_OUTER_A, layer) + nEta(EMEC_INNER_A, layer);
160  if (calo == HEC) return 2*nEta(HEC_A, layer);
161  if (calo == FCAL) return 2*nEta(FCAL_A, layer);
162 
163  short total = 0;
164  for (short region = 0; region < nRegions(calo, layer); region++) total += nEta(calo, layer, region);
165  return total;
166 }
167 
168 
169 short Geo::nEta(CaloId calo, short layer, short region, short iPhi)
170 {
171  if (region >= nRegions(calo, layer)) return 0;
172  if (Id::matchCalo(calo, EMB)) {
173  if (layer == 0) return 61;
174  if (layer == 1) {
175  if (region == 0) return 447; // should be 448, but first strip in each 1/2 barrel is missing
176  if (region == 1) return 3;
177  }
178  if (layer == 2) {
179  if (region == 0) return 56;
180  if (region == 1) return 1;
181  }
182  if (layer == 3) return 27;
183  return 0;
184  }
185  if (Id::matchCalo(calo, EMEC_OUTER)) {
186  if (layer == 0) return 12;
187  if (layer == 1) {
188  if (region == 0) return 1;
189  if (region == 1) return 3;
190  if (region == 2) return 96;
191  if (region == 3) return 48;
192  if (region == 4) return 64;
193  if (region == 5) return 4;
194  }
195  if (layer == 2) {
196  if (region == 0) return 1;
197  if (region == 1) return 43;
198  }
199  if (layer == 3) return 20;
200  return 0;
201  }
202  if (Id::matchCalo(calo, EMEC_INNER)) {
203  if (layer == 0) return 0;
204  if (layer == 1) return 7;
205  if (layer == 2) return 7;
206  if (layer == 3) return 0;
207  return 0;
208  }
209  if (Id::matchCalo(calo, HEC)) {
210  if (layer >= 4) return 0;
211  if (region == 0) { short n[4] = { 10, 10, 9, 8 }; return n[layer]; }
212  if (region == 1) { short n[4] = { 4, 3, 3, 4 }; return n[layer]; }
213  return 0;
214  }
215  if (Id::matchCalo(calo, FCAL)) {
216  if (layer > 3) return 0;
217  if (layer == 1) return 63;
218  if (layer == 2) {
219  short n[16] = { 30, 32, 32, 31, 31, 32, 32, 30, 30, 32, 32, 31, 31, 32, 32, 30 };
220  return n[iPhi];
221  }
222  if (layer == 3) return (iPhi == 5 || iPhi == 13 ? 15 : 16);
223  }
224  return 0;
225 }
226 
227 
228 short Geo::nPhi(CaloId calo, short layer, short region)
229 {
230  if (Id::matchCalo(calo, EMB)) {
231  if (layer > 3) return 0;
232  if (region == 1) return (layer == 1 || layer == 2 ? 256 : 0); // barrel-end region
233  short n[4] = { 64, 64, 256, 256 };
234  return n[layer];
235  }
236  if (Id::matchCalo(calo, EMEC_OUTER)) {
237  if (layer > 3) return 0;
238  short n[4] = { 64, 64, 256, 256 };
239  return n[layer];
240  }
241  if (Id::matchCalo(calo, EMEC_INNER)) {
242  if (layer > 2 || layer == 0) return 0;
243  short n[3] = { 0, 64, 64 };
244  return n[layer];
245  }
246  if (Id::matchCalo(calo, EMEC)) return nPhi(EMEC_OUTER, layer);
247  if (Id::matchCalo(calo, PRECISION_EM)) return nPhi(EMB, layer);
248  if (Id::matchCalo(calo, EM)) return nPhi(EMB, layer);
249  if (Id::matchCalo(calo, HEC)) {
250  if (layer > 3) return 0;
251  if (region == 0) return 64;
252  if (region == 1) return 32;
253  return 0;
254  }
255  if (Id::matchCalo(calo, FCAL)) {
256  if (layer > 3) return 0;
257  short n[4] = { 0, 16, 16, 16 };
258  return n[layer];
259  }
260  return 0;
261 }
262 
263 
264 double Geo::etaSize(CaloId calo, short layer, short region, short iEta)
265 {
266  if (Id::matchCalo(calo, EMB)) {
267  if (layer > 3) return 0;
268  double w[4] = { 0.025, 0.0249724/8, 0.025, 0.050 };
269  double nominal = w[layer];
270  if (iEta == -1) return nominal;
271  // iEta == 0 strip is not there! (well, strip is there, but not connected...)
272 /* if (layer == 1 && iEta >= 1 && iEta <= 447) return nominal;
273  if (layer == 1 && iEta >= 448) return 8*nominal;
274  if (layer == 2 && iEta >= 0 && iEta <= 56) return nominal;
275  if (layer == 2 && iEta == 57) return 3*nominal;*/
276  if (layer == 0) return nominal;
277  if (calo == EMB_A && layer == 1 && region == 0 && iEta == 0) return nominal*1.5;
278  if (calo == EMB_C && layer == 1 && region == 0 && iEta == nEta(calo, layer, region)) return nominal*1.5;
279  if (layer == 1 && region == 0) return nominal;
280  if (layer == 1 && region == 1) return 8*nominal;
281  if (layer == 2 && region == 0) return nominal;
282  if (layer == 2 && region == 1) return 3*nominal;
283  if (layer == 3) return nominal;
284  return 0;
285  }
286 
287  if (Id::matchCalo(calo, EMEC_OUTER)) {
288  if (layer > 3) return 0;
289  double w[4] = { 0.025, 0.025/8, 0.025, 0.050 };
290  double nominal = w[layer];
291  if (iEta == -1) return nominal;
292 /* if (layer == 1 && iEta == 0) return 16*nominal;
293  if (layer == 1 && iEta >= 1 && iEta <= 3) return 8*nominal;
294  if (layer == 1 && iEta >= 4 && iEta <= 99) return nominal;
295  if (layer == 1 && iEta >= 100 && iEta <= 147) return 4/3.*nominal;
296  if (layer == 1 && iEta >= 148 && iEta <= 211) return 2*nominal;
297  if (layer == 1 && iEta >= 212 && iEta <= 215) return 8*nominal;
298  if (layer == 2 && iEta == 1) return 2*nominal;
299  if (layer == 2 && iEta >= 2 && iEta <= 44) return nominal;*/
300  if (layer == 0) return nominal;
301  if (layer == 1 && region == 0) return 16*nominal;
302  if (layer == 1 && region == 1) return 8*nominal;
303  if (layer == 1 && region == 2) return nominal;
304  if (layer == 1 && region == 3) return 4/3.*nominal;
305  if (layer == 1 && region == 4) return 2*nominal;
306  if (layer == 1 && region == 5) return 8*nominal;
307  if (layer == 2 && region == 0) return 2*nominal;
308  if (layer == 2 && region == 1) return nominal;
309  if (layer == 3) return nominal;
310  return 0;
311  }
312 
313  if (Id::matchCalo(calo, EMEC_INNER)) {
314  if (layer > 3) return 0;
315  double nominal = 0.1;
316  if (iEta == -1) return nominal;
317 /* if (layer == 1 && iEta >= 216 && iEta <= 222) return 32*nominal;
318  if (layer == 2 && iEta >= 45 && iEta <= 51) return 4*nominal;*/
319  if (layer == 1) return nominal;
320  if (layer == 2) return nominal;
321  if (layer == 3) return nominal;
322  return 0;
323  }
324 
325  if (Id::matchCalo(calo, HEC)) {
326  if (layer > 3) return 0;
327  if (region == 0) return 0.1;
328  if (region == 1) return 0.2;
329  return 0;
330  }
331 
332  if (Id::matchCalo(calo, FCAL)) {
333  double nominal = 1.8/64;
334  if (layer == 1) return nominal;
335  if (layer == 2) return 2*nominal;
336  if (layer == 3) return 4*nominal;
337  return 0;
338  }
339 
340  return 0;
341 }
342 
343 
344 double Geo::phiSize(CaloId calo, short layer, short /*region*/, short /*iPhi*/)
345 {
346  if (layer > 3) return 0;
347  if (Id::matchCalo(calo, FCAL) && layer == 0) return 0;
348  short nphi=nPhi(calo, layer);
349  double nominal = 0;
350  if (nphi!=0) nominal=TMath::TwoPi()/nphi;//nPhi(calo, layer);
351  return nominal;
352 }
353 
354 
355 double Geo::etaMin(CaloId calo, short layer, short region)
356 {
357  if (Id::sign(calo) < 0) return -etaMax(Id::mirror(calo), layer, region);
358 
359  if (region < 0) {
360  if (calo == EMB) return -etaMax(EMB_A, layer);
361  if (calo == EMEC_A) return etaMin(EMEC_OUTER_A, layer);
362  region = 0;
363  }
364 
365  if (calo == EMB_A) {
366  if (layer == 1 && region == 0) return 0;
367  if (region == 1) return 1.40; // where applicable, i.e. layers 1,2
368  return 0;
369  }
370  if (calo == EMEC_OUTER_A) {
371  if (layer == 0) return 1.5;
372  if (layer == 1) {
373  if (region == 0) return 1.385; // njpb
374  if (region == 1) return 1.435; // njpb
375  if (region == 2) return 1.51; // njpb
376  if (region == 3) return 1.81; // njpb
377  if (region == 4) return 2.01; // njpb
378  if (region == 5) return 2.41; // njpb
379  }
380  if (layer == 2) {
381  if (region == 0) return 1.385; // njpb
382  if (region == 1) return 1.435; // njpb
383  }
384  if (layer == 3) return 1.5;
385  }
386  if (calo == EMEC_INNER_A)
387  if (layer == 1 || layer == 2) return 2.51;
388  if (calo == HEC_A) {
389  if (region == 0) return 1.5;
390  if (region == 1) return 2.5;
391  }
392  if (calo == FCAL_A) return 3.1;
393  return -999;
394 }
395 
396 
397 double Geo::etaMax(CaloId calo, short layer, short region)
398 {
399  if (Id::sign(calo) < 0) return -etaMin(Id::mirror(calo), layer, region);
400 
401  if (region < 0) {
402  if (calo == EMB) return etaMax(EMB_A, layer);
403  if (calo == EMEC_A) return etaMax(EMEC_INNER_A, layer);
404  region = nRegions(calo, layer) - 1;
405  }
406 
407  if (calo == EMB_A) {
408  if (layer == 0) return 1.52;
409  if (layer == 1 || layer == 2) {
410  if (region == 0) return 1.40;
411  if (region == 1) return 1.475;
412  }
413  if (layer == 3) return 1.35;
414  }
415  if (calo == EMEC_OUTER_A) {
416  if (layer == 0) return 1.8;
417  if (layer == 1) {
418  if (region == 0) return 1.435; // njpb
419  if (region == 1) return 1.51; // njpb
420  if (region == 2) return 1.81; // njpb
421  if (region == 3) return 2.01; // njpb
422  if (region == 4) return 2.41; // njpb
423  if (region == 5) return 2.51; // njpb
424  }
425  if (layer == 2) {
426  if (region == 0) return 1.435; // njpb
427  if (region == 1) return 2.51; // njpb
428  }
429  if (layer == 3) return 2.5;
430  }
431  if (calo == EMEC_INNER_A)
432  if (layer == 1 || layer == 2) return 3.21;
433  if (calo == HEC_A) {
434  if (region == 0) return 2.5;
435  if (region == 1) return 3.3;
436  }
437  if (calo == FCAL_A) return 4.9;
438  return -999;
439 }
440 
441 
442 double Geo::eta(CaloId calo, short layer, short region, short iEta)
443 {
444  double pos = etaMin(calo, layer, region);
445  for (short i = 0; i < iEta; i++) pos += etaSize(calo, layer, region, i);
446  return Id::sign(calo)*pos;
447 }
448 
449 
450 double Geo::phiMin(CaloId calo, short layer, short region)
451 {
452  if (Id::matchCalo(calo, EMEC_OUTER) && layer == 2) return phiSize(calo, layer, region)/2;
453  return 0;
454 }
455 
456 
457 double Geo::phi(CaloId calo, short layer, short region, short iPhi)
458 {
459  double pos = phiMin(calo, layer, region);
460  for (short i = 0; i < iPhi; i++) pos += phiSize(calo, layer, region, i);
461  return pos;
462 }
463 
464 
465 short Geo::etaIndex(CaloId calo, short layer, short region, short iEta)
466 {
467  if (Id::matchCalo(calo, EMB)) {
468  if (layer == 1 && region == 1) iEta += nEta(calo, layer, 0);
469  if (layer == 2 && region == 1) iEta += nEta(calo, layer, 0);
470  }
471  if (Id::matchCalo(calo, EMEC_OUTER)) {
472  if (layer == 1)
473  for (short r = 0; r < region; r++) iEta += nEta(calo, layer, r);
474  if (layer == 2 && region >= 1) iEta += 1;
475  }
476  if (Id::matchCalo(calo, HEC))
477  if (region == 1) iEta += 10;
478  return iEta;
479 }
480 
481 
482 TArrayD Geo::etaBins(CaloId calo, short layer)
483 {
484  if (Id::sign(calo) < 0) return mirror(etaBins(Id::mirror(calo), layer));
485 
486  if (calo == EMB) {
487  TArrayD binsA = etaBins(EMB_A, layer);
488  TArrayD binsC = etaBins(EMB_C, layer);
489  std::vector<TArrayD*> v; v.push_back(&binsC); v.push_back(&binsA);
490  return merge(v);
491  }
492  if (calo == EMEC_A) {
493  TArrayD binsO = etaBins(EMEC_OUTER_A, layer);
494  TArrayD binsI = etaBins(EMEC_INNER_A, layer);
495  std::vector<TArrayD*> v; v.push_back(&binsO); v.push_back(&binsI);
496  return merge(v);
497  }
498  if (calo == PRECISION_EM) {
499  TArrayD binsBA = etaBins(EMB_A, layer);
500  TArrayD binsOA = etaBins(EMEC_OUTER_A, layer);
501  if (layer == 1) {
502  binsBA = remove(binsBA, -1);
503  binsBA = remove(binsBA, -1);
504  binsOA = remove(binsOA, 0);
505  } else if (layer == 2) {
506  binsBA = remove(binsBA, -1);
507  binsOA[0] = 1.40;
508  }
509  TArrayD binsBC = mirror(binsBA);
510  TArrayD binsOC = mirror(binsOA);
511  std::vector<TArrayD*> v;
512  v.push_back(&binsOC); v.push_back(&binsBC);
513  v.push_back(&binsBA); v.push_back(&binsOA);
514  return merge(v);
515  }
516  if (calo == EM) {
517  TArrayD binsIA = etaBins(EMEC_INNER_A, layer);
518  TArrayD binsIC = etaBins(EMEC_INNER_C, layer);
519  TArrayD binsPE = etaBins(PRECISION_EM, layer);
520  std::vector<TArrayD*> v;
521  v.push_back(&binsIC); v.push_back(&binsPE); v.push_back(&binsIA);
522  return merge(v);
523  }
524 
525  if (calo == HEC) {
526  TArrayD binsHA = etaBins(HEC_A, layer);
527  TArrayD binsHC = etaBins(HEC_C, layer);
528  TArrayD trans(2); trans[0] = -1.5; trans[1] = 1.5;
529  std::vector<TArrayD*> v;
530  v.push_back(&binsHC); v.push_back(&trans); v.push_back(&binsHA);
531  return merge(v);
532  }
533 
534  if (nEta(calo, layer) == 0) return TArrayD();
535 
536  TArrayD bins(nEta(calo, layer) + 1);
537  short nRegs = nRegions(calo, layer);
538 
539  int i = 0;
540  for (short k = 0; k < nRegs; k++) {
541  for (short ii = 0; ii < nEta(calo, layer, k); ii++, i++)
542  bins[i] = eta(calo, layer, k, ii);
543  }
544  bins[i] = etaHigh(calo, layer, nRegs - 1, nEta(calo, layer, nRegs - 1) - 1);
545  return bins;
546 }
547 
548 
549 TH2D* Geo::etaPhiHist(CaloId calo, short layer, const TString& name, const TString& title)
550 {
551  TArrayD etaBinArray = etaBins(calo, layer);
552  short nPhiBins = nPhi(calo, layer);
553  double eps = 1E-6; // This is needed for changes in granularity: e.g. in the HEC, at larger eta the phi granularity is twice less => the center of
554  // the coarse phi bins fall on a histogram boundary, and floating-point uncertainties mean that some bins fall on one side and some on the other...
555  TH2D* h = new TH2D(name, title, etaBinArray.GetSize() - 1, etaBinArray.GetArray(),
556  nPhiBins, -TMath::Pi() + eps + phiMin(calo, layer), TMath::Pi() + eps + phiMin(calo, layer));
557  h->GetXaxis()->SetTitle("#eta");
558  h->GetYaxis()->SetTitle("#phi");
559  return h;
560 }
561 
562 
563 double Geo::etaCenter(CaloId calo, short layer, short region, short iEta)
564 {
565  return eta(calo, layer, region, iEta) + Id::sign(calo)*etaSize(calo, layer, region, iEta)/2;
566 }
567 
568 
569 double Geo::phiCenter(CaloId calo, short layer, short region, short iPhi)
570 {
571  return phi(calo, layer, region, iPhi) + phiSize(calo, layer, region, iPhi)/2;
572 }
573 
574 
575 double Geo::etaHigh(CaloId calo, short layer, short region, short iEta)
576 {
577  return eta(calo, layer, region, iEta) + Id::sign(calo)*etaSize(calo, layer, region, iEta);
578 }
579 
580 
581 double Geo::phiHigh(CaloId calo, short layer, short region, short iPhi)
582 {
583  return phi(calo, layer, region, iPhi) + phiSize(calo, layer, region, iPhi);
584 }
585 
586 
587 int Geo::nChannels(CaloId calo, short layer, short region)
588 {
589  if (region >= Geo::nRegions(calo, layer)) return 0;
590  int n = Geo::nEta(calo, layer, region)*Geo::nPhi(calo, layer, region);
591  if (Id::matchCalo(calo, FCAL) && layer == 2) n -= 12; // account for non-phi-symmetric disconnected channels
592  if (Id::matchCalo(calo, FCAL) && layer == 3) n -= 2; // account for non-phi-symmetric disconnected channels
593  return n;
594 }
595 
596 
597 int Geo::nChannels(CaloId calo, short layer)
598 {
599  if (calo == EMB) return nChannels(EMB_A, layer) + nChannels(EMB_C, layer);
600  if (calo == EMEC_A) return nChannels(EMEC_OUTER_A, layer) + nChannels(EMEC_INNER_A, layer);
601  if (calo == EMEC_C) return nChannels(EMEC_OUTER_C, layer) + nChannels(EMEC_INNER_C, layer);
602  if (calo == EMEC) return nChannels(EMEC_A, layer) + nChannels(EMEC_C, layer);
603  if (calo == HEC) return nChannels(HEC_A, layer) + nChannels(HEC_C, layer);
604  if (calo == FCAL) return nChannels(FCAL_A, layer) + nChannels(FCAL_C, layer);
605 
606  int n = 0;
607  for (unsigned short r = 0; r < Geo::nRegions(calo, layer); r++)
608  n += Geo::nChannels(calo, layer, r);
609  return n;
610 }
611 
612 
614 {
615  int n = 0;
616  for (unsigned short l = Geo::firstLayer(calo); l < Geo::firstLayer(calo) + Geo::nLayers(calo); l++)
617  n += Geo::nChannels(calo, l);
618  return n;
619 }
620 
621 
622 TString Geo::feedThroughName(PartitionId part, short feedThrough)
623 {
624 // feedthrough experts names (based on baseplane numbers) vector
625 // From ATL-AP-IN-0003, Numberings for the Barrel Feedthroughs
626 
627 // Barrel A and C feedthrough experts names
628 // indexed by feedthrough number (which starts at 0)
629  std::vector<std::string> ftBarrelA, ftBarrelC;
630  ftBarrelA.resize(32); ftBarrelC.resize(32);
631  ftBarrelA[0] = " 0-01L"; ftBarrelC[0] = " 0-09L";
632  ftBarrelA[1] = " 1-02R"; ftBarrelC[1] = " 1-08R";
633  ftBarrelA[2] = " 2-02L"; ftBarrelC[2] = " 2-08L";
634  ftBarrelA[3] = " 3-03R"; ftBarrelC[3] = " 3-07R";
635  ftBarrelA[4] = " 4-03L"; ftBarrelC[4] = " 4-07L";
636  ftBarrelA[5] = " 5-04R"; ftBarrelC[5] = " 5-06R";
637  ftBarrelA[6] = " 6-04L"; ftBarrelC[6] = " 6-06L";
638  ftBarrelA[7] = " 7-05R"; ftBarrelC[7] = " 7-05R";
639  ftBarrelA[8] = " 8-05L"; ftBarrelC[8] = " 8-05L";
640  ftBarrelA[9] = " 9-06R"; ftBarrelC[9] = " 9-04R";
641  ftBarrelA[10] = "10-06L"; ftBarrelC[10] = "10-04L";
642  ftBarrelA[11] = "11-07R"; ftBarrelC[11] = "11-03R";
643  ftBarrelA[12] = "12-07L"; ftBarrelC[12] = "12-03L";
644  ftBarrelA[13] = "13-08R"; ftBarrelC[13] = "13-02R";
645  ftBarrelA[14] = "14-08L"; ftBarrelC[14] = "14-02L";
646  ftBarrelA[15] = "15-09R"; ftBarrelC[15] = "15-01R";
647  ftBarrelA[16] = "16-09L"; ftBarrelC[16] = "16-01L";
648  ftBarrelA[17] = "17-10R"; ftBarrelC[17] = "17-16R";
649  ftBarrelA[18] = "18-10L"; ftBarrelC[18] = "18-16L";
650  ftBarrelA[19] = "19-11R"; ftBarrelC[19] = "19-15R";
651  ftBarrelA[20] = "20-11L"; ftBarrelC[20] = "20-15L";
652  ftBarrelA[21] = "21-12R"; ftBarrelC[21] = "21-14R";
653  ftBarrelA[22] = "22-12L"; ftBarrelC[22] = "22-14L";
654  ftBarrelA[23] = "23-13R"; ftBarrelC[23] = "23-13R";
655  ftBarrelA[24] = "24-13L"; ftBarrelC[24] = "24-13L";
656  ftBarrelA[25] = "25-14R"; ftBarrelC[25] = "25-12R";
657  ftBarrelA[26] = "26-14L"; ftBarrelC[26] = "26-12L";
658  ftBarrelA[27] = "27-15R"; ftBarrelC[27] = "27-11R";
659  ftBarrelA[28] = "28-15L"; ftBarrelC[28] = "28-11L";
660  ftBarrelA[29] = "29-16R"; ftBarrelC[29] = "29-10R";
661  ftBarrelA[30] = "30-16L"; ftBarrelC[30] = "30-10L";
662  ftBarrelA[31] = "31-01R"; ftBarrelC[31] = "31-09R";
663 
664 // Endcap A and C feedthrough experts names, indexed by feedthrough number
665  std::vector<std::string> ftEndcapA, ftEndcapC;
666  ftEndcapA.resize(25); ftEndcapC.resize(25);
667  ftEndcapA[0] = " 0-01R"; ftEndcapC[0] = " 0-07R";
668  ftEndcapA[1] = " 1-01L"; ftEndcapC[1] = " 1-07L";
669  ftEndcapA[2] = " 2-02R"; ftEndcapC[2] = " 2-06R";
670  ftEndcapA[3] = " 3-02L"; ftEndcapC[3] = " 3-06L";
671  ftEndcapA[4] = " 4-03R"; ftEndcapC[4] = " 4-05R";
672  ftEndcapA[5] = " 5-03L"; ftEndcapC[5] = " 5-05L";
673  ftEndcapA[6] = " 6-04R"; ftEndcapC[6] = " 6-04L"; // the FCAL baseplane
674  ftEndcapA[7] = " 7-05R"; ftEndcapC[7] = " 7-03R";
675  ftEndcapA[8] = " 8-05L"; ftEndcapC[8] = " 8-03L";
676  ftEndcapA[9] = " 9-06R"; ftEndcapC[9] = " 9-02R";
677  ftEndcapA[10] = "10-06L"; ftEndcapC[10] = "10-02L";
678  ftEndcapA[11] = "11-07R"; ftEndcapC[11] = "11-01R";
679  ftEndcapA[12] = "12-07L"; ftEndcapC[12] = "12-01L";
680  ftEndcapA[13] = "13-08R"; ftEndcapC[13] = "13-13R";
681  ftEndcapA[14] = "14-08L"; ftEndcapC[14] = "14-13L";
682  ftEndcapA[15] = "15-09R"; ftEndcapC[15] = "15-12R";
683  ftEndcapA[16] = "16-09L"; ftEndcapC[16] = "16-12L";
684  ftEndcapA[17] = "17-10R"; ftEndcapC[17] = "17-11R";
685  ftEndcapA[18] = "18-10L"; ftEndcapC[18] = "18-11L";
686  ftEndcapA[19] = "19-11R"; ftEndcapC[19] = "19-10R";
687  ftEndcapA[20] = "20-11L"; ftEndcapC[20] = "20-10L";
688  ftEndcapA[21] = "21-12R"; ftEndcapC[21] = "21-09R";
689  ftEndcapA[22] = "22-12L"; ftEndcapC[22] = "22-09L";
690  ftEndcapA[23] = "23-13R"; ftEndcapC[23] = "23-08R";
691  ftEndcapA[24] = "24-13L"; ftEndcapC[24] = "24-08L";
692 
693  if (part == EMB_A_PARTITION) return ftBarrelA[feedThrough];
694  if (part == EMB_C_PARTITION) return ftBarrelC[feedThrough];
695  if (part == EMEC_A_PARTITION) return ftEndcapA[feedThrough];
696  if (part == EMEC_C_PARTITION) return ftEndcapC[feedThrough];
697  return "UNKNOWN";
698 }
699 
700 
701 TArrayD Geo::merge(const std::vector<TArrayD*>& arrays)
702 {
703  std::vector<TArrayD*> nonEmptyArrays;
704  unsigned int n = 0;
705  for (unsigned int k = 0; k < arrays.size(); k++) {
706  if (arrays[k]->GetSize() == 0) continue;
707  n += arrays[k]->GetSize();
708  nonEmptyArrays.push_back(arrays[k]);
709  }
710 
711  TArrayD bins(n - nonEmptyArrays.size() + 1); // remove final bins, except the last one
712  int i = 0;
713  for (unsigned int k = 0; k < nonEmptyArrays.size(); k++)
714  for (int ii = 0; ii < nonEmptyArrays[k]->GetSize() - 1; ii++, i++)
715  bins[i] = (*nonEmptyArrays[k])[ii];
716  bins[i] = (*nonEmptyArrays[nonEmptyArrays.size() - 1])[nonEmptyArrays[nonEmptyArrays.size() - 1]->GetSize() - 1];
717  return bins;
718 }
719 
720 
721 TArrayD Geo::mirror(const TArrayD& bins)
722 {
723  int n = bins.GetSize();
724  TArrayD mirrorBins(n);
725  for (int k = 0; k < n; k++)
726  mirrorBins[k] = -bins[n - k - 1];
727  return mirrorBins;
728 }
729 
730 TArrayD Geo::remove(const TArrayD& bins, int index)
731 {
732  int n = bins.GetSize();
733  if (index < 0) index = n + index;
734  if (index >= n) return bins;
735 
736  TArrayD newBins(n - 1);
737  int k = 0;
738  for (int kk = 0; kk < n; kk++) {
739  if (kk == index) continue;
740  newBins[k] = bins[kk];
741  k++;
742  }
743  return newBins;
744 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
LArSamples::Geo::phiSize
static double phiSize(CaloId calo, short layer, short region, short iPhi=-1)
Definition: Geometry.cxx:344
beamspotman.r
def r
Definition: beamspotman.py:676
LArSamples::Geo::etaPhiHist
static TH2D * etaPhiHist(CaloId calo, short layer, const TString &name, const TString &title)
Definition: Geometry.cxx:549
LArSamples::HEC_C_PARTITION
@ HEC_C_PARTITION
Definition: CaloId.h:31
LArSamples::HEC
@ HEC
Definition: CaloId.h:26
LArSamples::Id::matchCalo
static bool matchCalo(CaloId id, CaloId idSpec)
Definition: CaloId.cxx:188
LArSamples::Geo::nFEBs
static short nFEBs()
Definition: Geometry.cxx:69
LArSamples::Geo::merge
static TArrayD merge(const std::vector< TArrayD * > &arrays)
Definition: Geometry.cxx:701
index
Definition: index.py:1
LArSamples::Geo::setBinLabels
static bool setBinLabels(TH2 *hist, PartitionId part)
Definition: Geometry.cxx:34
plotmaker.hist
hist
Definition: plotmaker.py:148
LArSamples::Geo::nRegions
static short nRegions(CaloId calo, short layer)
Definition: Geometry.cxx:124
Geometry.h
LArSamples::Id::summary
static CaloId summary(CaloId id)
Definition: CaloId.cxx:74
LArSamples::Geo::phiCenter
static double phiCenter(CaloId calo, short layer, short region, short iPhi)
Definition: Geometry.cxx:569
LArSamples::FCAL_C
@ FCAL_C
Definition: CaloId.h:22
LArSamples::EMEC_A_PARTITION
@ EMEC_A_PARTITION
Definition: CaloId.h:30
LArSamples::EMEC_INNER
@ EMEC_INNER
Definition: CaloId.h:25
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
LArSamples
Definition: AbsShape.h:24
LArSamples::Geo::phiHigh
static double phiHigh(CaloId calo, short layer, short region, short iPhi)
Definition: Geometry.cxx:581
LArSamples::HEC_A
@ HEC_A
Definition: CaloId.h:24
LArSamples::EMB_A_PARTITION
@ EMB_A_PARTITION
Definition: CaloId.h:30
LArSamples::FCAL_A
@ FCAL_A
Definition: CaloId.h:24
LArSamples::Geo::phi
static double phi(CaloId calo, short layer, short region, short iPhi)
Definition: Geometry.cxx:457
LArSamples::Geo::nSlots
static short nSlots(PartitionId part)
Definition: Geometry.cxx:59
LArSamples::PRECISION_EM
@ PRECISION_EM
Definition: CaloId.h:26
LArSamples::Geo::etaMin
static double etaMin(CaloId calo, short layer, short region=-1)
Definition: Geometry.cxx:355
LArSamples::EMEC_OUTER_C
@ EMEC_OUTER_C
Definition: CaloId.h:22
LArSamples::Geo::etaSize
static double etaSize(CaloId calo, short layer, short region, short iEta=-1)
Definition: Geometry.cxx:264
LArSamples::EMEC
@ EMEC
Definition: CaloId.h:25
python.changerun.kk
list kk
Definition: changerun.py:41
LArSamples::Geo::etaIndex
static short etaIndex(CaloId calo, short layer, short region, short iEta)
Definition: Geometry.cxx:465
LArSamples::FCAL_A_PARTITION
@ FCAL_A_PARTITION
Definition: CaloId.h:31
LArSamples::EMB
@ EMB
Definition: CaloId.h:25
LArSamples::Geo::nPhi
static short nPhi(CaloId calo, short layer, short region=0)
Definition: Geometry.cxx:228
LArSamples::EMB_C
@ EMB_C
Definition: CaloId.h:22
lumiFormat.i
int i
Definition: lumiFormat.py:85
h
beamspotman.n
n
Definition: beamspotman.py:731
LArSamples::FCAL_C_PARTITION
@ FCAL_C_PARTITION
Definition: CaloId.h:31
LArSamples::Geo::nPartitionChannels
static short nPartitionChannels(PartitionId part)
Definition: Geometry.cxx:98
extractSporadic.h
list h
Definition: extractSporadic.py:97
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
covarianceTool.title
title
Definition: covarianceTool.py:542
LArSamples::EMEC_OUTER
@ EMEC_OUTER
Definition: CaloId.h:25
LArSamples::EMEC_C_PARTITION
@ EMEC_C_PARTITION
Definition: CaloId.h:30
LArSamples::EM
@ EM
Definition: CaloId.h:26
LArSamples::PartitionId
PartitionId
Definition: CaloId.h:29
plotting.yearwise_luminosity_vs_mu.bins
bins
Definition: yearwise_luminosity_vs_mu.py:30
LArSamples::EMB_C_PARTITION
@ EMB_C_PARTITION
Definition: CaloId.h:30
LArSamples::Geo::nLayers
static short nLayers(CaloId calo)
Definition: Geometry.cxx:114
LArSamples::Geo::partitionHist
static TH2D * partitionHist(PartitionId part, const TString &name, const TString &title)
Definition: Geometry.cxx:18
LArSamples::EMEC_OUTER_A
@ EMEC_OUTER_A
Definition: CaloId.h:24
LArSamples::Geo::partitionProfileHist
static TProfile2D * partitionProfileHist(PartitionId part, const TString &name, const TString &title)
Definition: Geometry.cxx:26
LArSamples::Geo::eta
static double eta(CaloId calo, short layer, short region, short iEta)
Definition: Geometry.cxx:442
ConvertOldUJHistosToNewHistos.etaBinArray
etaBinArray
Definition: ConvertOldUJHistosToNewHistos.py:146
LArSamples::Geo::phiMin
static double phiMin(CaloId calo, short layer, short region=-1)
Definition: Geometry.cxx:450
LArSamples::Geo::firstLayer
static short firstLayer(CaloId calo)
Definition: Geometry.cxx:104
LArSamples::Geo::etaCenter
static double etaCenter(CaloId calo, short layer, short region, short iEta)
Definition: Geometry.cxx:563
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArSamples::Geo::etaMax
static double etaMax(CaloId calo, short layer, short region=-1)
Definition: Geometry.cxx:397
LArSamples::Geo::mirror
static TArrayD mirror(const TArrayD &bins)
Definition: Geometry.cxx:721
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
LArSamples::HEC_A_PARTITION
@ HEC_A_PARTITION
Definition: CaloId.h:31
LArSamples::CaloId
CaloId
Definition: CaloId.h:21
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::iPhi
@ iPhi
Definition: ParamDefs.h:47
python.PyAthena.v
v
Definition: PyAthena.py:154
LArSamples::FCAL
@ FCAL
Definition: CaloId.h:26
DeMoScan.index
string index
Definition: DeMoScan.py:364
ChangeHistoRange.newBins
list newBins
Definition: ChangeHistoRange.py:89
LArSamples::Geo::nFeedThroughs
static short nFeedThroughs(PartitionId part)
Definition: Geometry.cxx:49
LArSamples::EMEC_A
@ EMEC_A
Definition: CaloId.h:25
LArSamples::Geo::etaHigh
static double etaHigh(CaloId calo, short layer, short region, short iEta)
Definition: Geometry.cxx:575
LArSamples::EMEC_INNER_C
@ EMEC_INNER_C
Definition: CaloId.h:22
LArSamples::Geo::nEta
static short nEta(CaloId calo, short layer, short region, short iPhi=1)
Definition: Geometry.cxx:169
LArSamples::HEC_C
@ HEC_C
Definition: CaloId.h:22
LArSamples::EMB_A
@ EMB_A
Definition: CaloId.h:24
LArSamples::EMEC_INNER_A
@ EMEC_INNER_A
Definition: CaloId.h:24
LArSamples::Id::mirror
static CaloId mirror(CaloId id)
Definition: CaloId.cxx:236
LArSamples::Geo::remove
static TArrayD remove(const TArrayD &bins, int index)
Definition: Geometry.cxx:730
LArSamples::Geo::nChannels
static int nChannels(CaloId calo, short layer, short region)
Definition: Geometry.cxx:587
LArSamples::Geo::etaBins
static TArrayD etaBins(CaloId calo, short layer)
Definition: Geometry.cxx:482
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
xAOD::iEta
setScale setgFexType iEta
Definition: gFexJetRoI_v1.cxx:77
LArSamples::EMEC_C
@ EMEC_C
Definition: CaloId.h:25
LArSamples::Geo::nPhiRings
static short nPhiRings()
Definition: Geometry.cxx:84
python.compressB64.c
def c
Definition: compressB64.py:93
LArSamples::Id::sign
static short sign(CaloId id)
Definition: CaloId.cxx:206
LArSamples::Geo::firstEta
static short firstEta(CaloId calo, short layer, short region=0)
Definition: Geometry.cxx:146
LArSamples::Geo::feedThroughName
static TString feedThroughName(PartitionId part, short feedThrough)
Definition: Geometry.cxx:622
PUfitVar::nPhiBins
constexpr std::size_t nPhiBins
Definition: GepMETPufitAlg.cxx:20
fitman.k
k
Definition: fitman.py:528