Project
Loading...
Searching...
No Matches
Geometry.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12// --- Standard library ---
13#include <fstream>
14#include <algorithm>
15
16// --- ROOT system ---
17
18#include <fairlogger/Logger.h>
19
20#include "FOCALBase/Geometry.h"
21
22using namespace o2::focal;
23
24bool Geometry::sInit = false;
25Geometry* Geometry::sGeom = nullptr;
26
27//_________________________________________________________________________
29{
30 std::fill_n(mPixelLayerLocations.begin(), 20, -1);
31 std::fill_n(mSegments.begin(), 100, -100);
32 std::fill_n(mNumberOfLayersInSegments.begin(), 100, -1);
33 std::fill_n(mLocalLayerZ.begin(), 100, 0.0);
34 std::fill_n(mLocalSegmentsZ.begin(), 100, 0.0);
35 std::fill_n(mLayerThickness.begin(), 100, 0.0);
36
37 *this = geo;
38}
39
40//_________________________________________________________________________
42{
43
44 if (sGeom == nullptr) {
45 sGeom = new Geometry();
46 sGeom->init();
47 } else {
48 if (sInit == false) {
49 sGeom = new Geometry();
50 sGeom->init();
51 }
52 }
53
54 return sGeom;
55}
56
57//_________________________________________________________________________
59{
60
61 if (sGeom == nullptr) {
62 sGeom = new Geometry();
63 sGeom->init(filename);
64 } else {
65 if (sInit == false) {
66 sGeom = new Geometry();
67 sGeom->init(filename);
68 }
69 }
70 return sGeom;
71}
72
73//_________________________________________________________________________
74void Geometry::init(std::string filename)
75{
76 if (filename != "default") {
78 } else {
80 }
81
83 sInit = true;
84}
85
86//_________________________________________________________________________
88{
91 sInit = true;
92}
93
94//_________________________________________________________________________
96{
97 mGeometryComposition.reserve(1000);
98
99 int nlayers = mNPadLayers + mNPixelLayers + mNHCalLayers;
100
102 for (int i = 0; i < nlayers; i++) {
103 if (i < mNPadLayers + mNPixelLayers) {
104 // Check whether it is a pixel layer
105 int isPixel = 0;
106 for (int iPix = 0; iPix < mNPixelLayers && !isPixel; iPix++) {
107 LOG(debug) << "Check pixel layer idx " << iPix << " loc " << mPixelLayerLocations[iPix] << " i= " << i;
108 if (i == mPixelLayerLocations[iPix]) {
109 isPixel = 1;
110 }
111 }
112
113 if (isPixel) {
114 // create pixel compositions
115 LOG(debug) << "Adding pixel layer at layer " << i;
116 for (auto& icomp : mPixelCompositionBase) {
117 icomp.setLayerNumber(i);
118 mGeometryComposition.push_back(icomp);
119 }
121 } else {
122 // create pad compositions
123 for (auto& icomp : mPadCompositionBase) {
124 icomp.setLayerNumber(i);
125 mGeometryComposition.push_back(icomp);
126 }
128 }
129 } else {
130 // create hcal compositions
131 for (auto& icomp : mHCalCompositionBase) {
132 icomp.setLayerNumber(i);
133 mGeometryComposition.push_back(icomp);
134 }
136 }
137 } // end loop over nlayers
138
139 for (int i = 0; i < nlayers; i++) {
140 mLocalLayerZ[i] = 0;
141 for (int j = 0; j < i; j++) {
143 }
144 }
145 for (int i = 0; i < nlayers; i++) {
147 }
148
149 mLocalLayerZ[nlayers] = -1;
150
152 for (auto& icomp : mFrontMatterCompositionBase) {
153 icomp.setLayerNumber(-1);
154 mGeometryComposition.push_back(icomp);
155 }
156
158 for (auto& icomp : mGeometryComposition) {
159 if (icomp.layer() >= 0) {
160 icomp.setCenterZ(mFrontMatterLayerThickness + mLocalLayerZ[icomp.layer()] + icomp.centerZ() + icomp.sizeZ() / 2);
161 } else {
162 icomp.setCenterZ(icomp.centerZ() + icomp.sizeZ() / 2);
163 }
164 }
165}
166
167//_________________________________________________________________________
169{
170
171 LOG(warning) << " Default parameters are not used ";
173 mGlobal_FOCAL_Z0 = 500;
174}
175
176//_________________________________________________________________________
177void Geometry::setParameters(std::string geometryfile)
178{
180 mGlobal_FOCAL_Z0 = 700.0;
181 mInsertFrontPadLayers = false;
182 // PAD setup
183 mGlobal_Pad_Size = 1.0; // pad size
184 mGlobal_PAD_NX = 9; // number of X pads in wafer
185 mGlobal_PAD_NY = 8; // number of Y pads in wafer
186 mGlobal_PAD_NX_Tower = 5; // number of X wafers in tower
187 mGlobal_PAD_NY_Tower = 1; // number of Y wafers in tower
188 mGlobal_PPTOL = 0.0; // tolerance between the wafers
189 mGlobal_PAD_SKIN = 0.2; // dead area (guard ring) on the wafer
190 mGlobal_PIX_SKIN = 0.004;
191 // PIX setup
192 mGlobal_Pixel_Readout = false;
193 mGlobal_Pixel_Size = 0.005; // pixel size
194 mGlobal_PIX_SizeX = 3.0; // sensor size X
195 mGlobal_PIX_SizeY = 2.74; // sensor size Y
197 mGlobal_PIX_OffsetY = 0.09;
198 mGlobal_PIX_NX_Tower = 15; // number of sensors in X
199 mGlobal_PIX_NY_Tower = 3; // number of sensors in Y
200
202 mGlobal_Tower_NY = 11;
203
204 mNPixelLayers = 4;
209
210 mTowerSizeX = 0;
211 mTowerSizeY = 0;
212 mWaferSizeX = 0;
213 mWaferSizeY = 0;
214
215 std::ifstream fin(geometryfile);
216 if (fin.fail()) {
217 LOG(error) << "No geometry file for FoCAL. Use default ones";
219 return;
220 } else {
221 LOG(info) << "Using geometry file " << geometryfile;
222 }
223
224 std::vector<Composition> padCompDummy(10);
225 std::vector<Composition> hCalCompDummy(10);
226 std::vector<Composition> pixelCompDummy(10);
227 std::vector<Composition> frontMatterCompDummy(10);
228 int nPad = 0;
229 int hHCal = 0;
230 int nPixel = 0;
231 int nFrontMatter = 0;
232
233 int npadlayers = 0;
234 int npixlayers = 0;
235 int pixl[10];
236
237 std::string input;
238
239 LOG(info) << "Loading FOCAL geometry file ";
240 while (getline(fin, input)) {
241 LOG(debug) << "Read string :: " << input.c_str();
242 const char* p = std::strpbrk("#", input.c_str());
243 if (p != nullptr) {
244 LOG(debug) << "Skipping comment";
245 continue;
246 }
247
248 std::vector<std::string> tokens;
249 std::stringstream str(input);
250 std::string tmpStr;
251 while (getline(str, tmpStr, ' ')) {
252 if (tmpStr.empty()) {
253 continue;
254 }
255 tokens.push_back(tmpStr);
256 }
257
258 std::string command = tokens[0];
259 LOG(debug) << "command: " << command;
260
261 if (command.find("COMPOSITION") != std::string::npos)
262 {
263 std::string material = tokens[1];
264 float cx = std::stof(tokens[2]);
265 float cy = std::stof(tokens[3]);
266 float dx = std::stof(tokens[4]);
267 float dy = std::stof(tokens[5]);
268 float dz = std::stof(tokens[6]);
269 float cz = 0;
270
271 LOG(debug) << "Material :: " << material;
272 LOG(debug) << "cx/cy/dx/dy/dz :: " << cx << " / " << cy << " / " << dx << " / " << dy << " / " << dz;
273
274 int stack;
275 if (command.find("PAD") != std::string::npos) {
276 sscanf(command.c_str(), "COMPOSITION_PAD_S%d", &stack);
277 padCompDummy.emplace_back(material, stack, stack, 0, cx, cy, cz, dx, dy, dz);
278 nPad++;
279 }
280
281 if (command.find("HCAL") != std::string::npos) {
282 sscanf(command.c_str(), "COMPOSITION_HCAL_S%d", &stack);
283 hCalCompDummy.emplace_back(material, stack, stack, 0, cx, cy, cz, dx, dy, dz);
284 hHCal++;
285 }
286
287 if (command.find("PIX") != std::string::npos) {
288 sscanf(command.c_str(), "COMPOSITION_PIX_S%d", &stack);
289 pixelCompDummy.emplace_back(material, stack, stack, 0, cx, cy, cz, dx, dy, dz);
292 nPixel++;
293 }
294
295 if (command.find("FM") != std::string::npos) {
296 sscanf(command.c_str(), "COMPOSITION_FM_S%d", &stack);
297 frontMatterCompDummy.emplace_back(material, stack, stack, 0, cx, cy, cz, dx, dy, dz);
298 nFrontMatter++;
299 }
300 } // end if COMPOSITION
301
302 if (command.find("GLOBAL") != std::string::npos) {
303
304 if (command.find("PAD_SIZE") != std::string::npos) {
305 mGlobal_Pad_Size = std::stof(tokens[1]);
306 LOG(debug) << "Pad sensor size is set to : " << mGlobal_Pad_Size;
307 }
308
309 if (command.find("PAD_NX") != std::string::npos) {
310 mGlobal_PAD_NX = std::stoi(tokens[1]);
311 LOG(debug) << "No. sensors per pad wafer in X direction : " << mGlobal_PAD_NX;
312 }
313
314 if (command.find("PAD_NY") != std::string::npos) {
315 mGlobal_PAD_NY = std::stoi(tokens[1]);
316 LOG(debug) << "No. sensors per pad wafer in Y direction : " << mGlobal_PAD_NY;
317 }
318
319 if (command.find("PAD_SUPERMODULE_X") != std::string::npos) {
320 mGlobal_PAD_NX_Tower = std::stoi(tokens[1]);
321 LOG(debug) << "Number of pad wafers per module in X direction : " << mGlobal_PAD_NX_Tower;
322 }
323
324 if (command.find("PAD_SUPERMODULE_Y") != std::string::npos) {
325 mGlobal_PAD_NY_Tower = std::stoi(tokens[1]);
326 LOG(debug) << "Number of pad wafers per module in Y direction : " << mGlobal_PAD_NY_Tower;
327 }
328
329 if (command.find("PIX_NX") != std::string::npos) {
330 mGlobal_PIX_NX_Tower = std::stoi(tokens[1]);
331 LOG(debug) << "Number of pixels sensors per module in X direction : " << mGlobal_PIX_NX_Tower;
332 }
333
334 if (command.find("PIX_NY") != std::string::npos) {
335 mGlobal_PIX_NY_Tower = std::stoi(tokens[1]);
336 LOG(debug) << "Number of pixels sensors per module in Y direction : " << mGlobal_PIX_NY_Tower;
337 }
338
339 if (command.find("PAD_PPTOL") != std::string::npos) {
340 mGlobal_PPTOL = std::stof(tokens[1]);
341 LOG(debug) << "Distance between pad sensors : " << mGlobal_PPTOL;
342 }
343
344 if (command.find("PAD_SKIN") != std::string::npos) {
345 mGlobal_PAD_SKIN = std::stof(tokens[1]);
346 LOG(debug) << "Pad wafer skin : " << mGlobal_PAD_SKIN;
347 }
348
349 if (command.find("FOCAL_Z") != std::string::npos) {
350 mGlobal_FOCAL_Z0 = std::stof(tokens[1]);
351 LOG(debug) << "Z-Location of the FoCAL is set to : " << mGlobal_FOCAL_Z0;
352 }
353
354 if (command.find("HCAL_TOWER_SIZE") != std::string::npos) {
355 mGlobal_HCAL_Tower_Size = std::stof(tokens[1]);
356 LOG(debug) << "The size of the HCAL readout tower will be : " << mGlobal_HCAL_Tower_Size;
357 }
358
359 if (command.find("HCAL_TOWER_NX") != std::string::npos) {
360 mGlobal_HCAL_Tower_NX = std::stoi(tokens[1]);
361 LOG(debug) << "The number of the HCAL readout towers in X will be : " << mGlobal_HCAL_Tower_NX;
362 }
363
364 if (command.find("HCAL_TOWER_NY") != std::string::npos) {
365 mGlobal_HCAL_Tower_NY = std::stoi(tokens[1]);
366 LOG(debug) << "The number of the HCAL readout towers in Y will be : " << mGlobal_HCAL_Tower_NY;
367 }
368
369 if (command.find("PIX_OffsetX") != std::string::npos) {
370 mGlobal_PIX_OffsetX = std::stof(tokens[1]);
371 LOG(debug) << "Pixel offset from the beam pipe will be: " << mGlobal_PIX_OffsetX;
372 }
373
374 if (command.find("PIX_OffsetY") != std::string::npos) {
375 mGlobal_PIX_OffsetY = std::stof(tokens[1]);
376 LOG(debug) << "Pixel offset from the top of module will be: " << mGlobal_PIX_OffsetY;
377 }
378
379 if (command.find("PIX_SKIN") != std::string::npos) {
380 mGlobal_PIX_SKIN = std::stof(tokens[1]);
381 LOG(debug) << "Pixel sensor skin : " << mGlobal_PIX_SKIN;
382 }
383
384 if (command.find("TOWER_TOLX") != std::string::npos) {
385 mGlobal_TOWER_TOLX = std::stof(tokens[1]);
386 mGlobal_Gap_Material = tokens[2];
387 LOG(debug) << "Distance between modules in X direction : " << mGlobal_TOWER_TOLX << ", Material : " << mGlobal_Gap_Material;
388 }
389
390 if (command.find("TOWER_TOLY") != std::string::npos) {
391 mGlobal_TOWER_TOLY = std::stof(tokens[1]);
392 mGlobal_Gap_Material = tokens[2];
393 LOG(debug) << "Distance between modules in Y direction : " << mGlobal_TOWER_TOLY << " Material : " << mGlobal_Gap_Material;
394 }
395
396 if (command.find("MIDDLE_TOWER_OFFSET") != std::string::npos) {
397 mGlobal_Middle_Tower_Offset = std::stof(tokens[1]);
398 LOG(debug) << "Middle tower offset will be: " << mGlobal_Middle_Tower_Offset;
399 }
400
401 if (command.find("Tower_NX") != std::string::npos) {
402 mGlobal_Tower_NX = std::stof(tokens[1]);
403 LOG(debug) << "Number of FOCAL modules in x direction is set to : " << mGlobal_Tower_NX;
404 }
405
406 if (command.find("Tower_NY") != std::string::npos) {
407 mGlobal_Tower_NY = std::stof(tokens[1]);
408 LOG(debug) << "Number of FOCAL modules in y direction is set to : " << mGlobal_Tower_NY;
409 }
410 } // end if GLOBAL
411
412 if (command.find("COMMAND") != std::string::npos) {
413
414 if (command.find("NUMBER_OF_PAD_LAYERS") != std::string::npos) {
415 npadlayers = std::stoi(tokens[1]);
416 LOG(debug) << "Number of pad layers " << npadlayers;
417 }
418
419 if (command.find("NUMBER_OF_HCAL_LAYERS") != std::string::npos) {
420 mNHCalLayers = std::stoi(tokens[1]);
421 LOG(debug) << "Number of HCAL layers " << mNHCalLayers;
422 if (mNHCalLayers == 1) {
423 mUseSandwichHCAL = false;
424 } else {
425 mUseSandwichHCAL = true;
426 }
427 }
428
429 if (command.find("NUMBER_OF_SEGMENTS") != std::string::npos) {
430 mNumberOfSegments = std::stoi(tokens[1]);
431 LOG(debug) << "Number of Segments " << mNumberOfSegments;
432 }
433
434 if (command.find("INSERT_PIX") != std::string::npos) {
435 sscanf(command.c_str(), "COMMAND_INSERT_PIX_AT_L%d", &pixl[npixlayers]);
436 LOG(debug) << "Number of pixel layer " << npixlayers << " : location " << pixl[npixlayers];
437 npixlayers++;
438 }
439
440 if (command.find("COMMAND_PIXEL_READOUT_ON") != std::string::npos) {
442 mGlobal_Pixel_Size = std::stof(tokens[1]);
443 LOG(debug) << "Pixel readout on (for MASPS): pixel size is set to : " << mGlobal_Pixel_Size;
444 }
445
446 if (command.find("COMMAND_INSERT_FRONT_PAD_LAYERS") != std::string::npos) {
448 LOG(debug) << "Insert two pad layers in front of ECAL for charged particle veto!";
449 }
450
451 if (command.find("COMMAND_INSERT_HCAL_READOUT") != std::string::npos) {
453 LOG(debug) << "Insert Aluminium 1cm thick layer behind HCAL to simulate readout SiPM material !";
454 }
455 } // end if COMMAND
456
457 if (command.find("VIRTUAL") != std::string::npos) {
458
459 int segment, minlayer, maxLayer, isPixel;
460 float padSize, sensitiveThickness, pixelTreshold;
461
462 if (command.find("N_SEGMENTS") != std::string::npos) {
463 mVirtualNSegments = std::stoi(tokens[1]);
464 LOG(debug) << "Number of Virtual Segments is set to : " << mVirtualNSegments;
465 }
466
467 if (command.find("SEGMENT_LAYOUT") != std::string::npos) {
468 minlayer = std::stoi(tokens[1]);
469 maxLayer = std::stoi(tokens[2]);
470 padSize = std::stof(tokens[3]);
471 sensitiveThickness = std::stof(tokens[4]);
472 isPixel = std::stoi(tokens[5]);
473 pixelTreshold = std::stof(tokens[6]);
474
475 if (mVirtualSegmentComposition.size() == 0) {
476 if (mVirtualNSegments <= 0) {
477 LOG(debug) << "Making 20 segments";
478 for (int seg = 0; seg < 20; seg++) {
479 mVirtualSegmentComposition.emplace_back();
480 }
482 } else {
483 LOG(debug) << "Making " << mVirtualNSegments << " segments";
484 for (int seg = 0; seg < mVirtualNSegments; seg++) {
485 mVirtualSegmentComposition.emplace_back();
486 }
487 }
488 }
489
490 sscanf(command.c_str(), "VIRTUAL_SEGMENT_LAYOUT_N%d", &segment);
492 continue;
493 }
495 mVirtualSegmentComposition[segment].mMaxLayer = maxLayer;
496 mVirtualSegmentComposition[segment].mPadSize = padSize;
497 mVirtualSegmentComposition[segment].mRelativeSensitiveThickness = sensitiveThickness;
498 mVirtualSegmentComposition[segment].mPixelTreshold = pixelTreshold;
499 mVirtualSegmentComposition[segment].mIsPixel = isPixel;
500
501 LOG(debug) << "Segment number " << segment << " defined with (minLayer, maxLayer, padSize, isPixel): ("
502 << minlayer << ", " << maxLayer << ", " << padSize << ", " << isPixel << ")";
503 } // end if SEGMENT_LAYOUT
504
505 } // end if VIRTUAL
506
507 } // end while
508
511 mNPixelLayers = npixlayers;
512 for (int i = 0; i < npixlayers; i++) {
513 mPixelLayerLocations[i] = pixl[i];
514 }
515
516 mNPadLayers = npadlayers;
517 LOG(debug) << "mNPadLayers, mNPixelLayers, mNHCalLayers, mNumberOfSegments :: " << mNPadLayers << " / " << mNPixelLayers << " / " << mNHCalLayers << " / " << mNumberOfSegments;
518
520
521 if (mNumberOfSegments >= 100) {
522 LOG(warning) << "You reached the segments limits! Setting Number of segments to: 100";
524 LOG(warning) << "New number of segments: " << mNumberOfSegments;
526 }
529 for (int i = 0; i < mNumberOfSegments; i++) {
531 }
532 LOG(debug) << "Number of segments: " << mNumberOfSegments;
533 } else {
534 for (int i = 0; i < mNumberOfSegments; i++) {
536 }
537 }
538
540
541 float center_z = 0;
542
543 mPadCompositionBase.reserve(200);
544 mHCalCompositionBase.reserve(200);
545 mPixelCompositionBase.reserve(200);
546 mFrontMatterCompositionBase.reserve(200);
547
548 for (auto& tmpComp : padCompDummy) {
549 LOG(debug) << "Material(pad layer) " << tmpComp.material();
550 LOG(debug) << "layer / stack / id :: " << tmpComp.layer() << " / " << tmpComp.stack() << " / " << tmpComp.id();
551 LOG(debug) << "center x,y,dz :: " << tmpComp.sizeX() << " / " << tmpComp.sizeY() << " / " << tmpComp.sizeZ();
552 if (tmpComp.material().compare("SiPad")) { // materials other than SiPad
553 mPadCompositionBase.emplace_back(tmpComp.material(), tmpComp.layer(), tmpComp.stack(), tmpComp.id(),
554 tmpComp.centerX(), tmpComp.centerY(), center_z,
555 mTowerSizeX, mTowerSizeY, tmpComp.sizeZ());
556 if (mTowerSizeX < tmpComp.sizeX()) {
557 mTowerSizeX = tmpComp.sizeX();
558 }
559 if (mTowerSizeY < tmpComp.sizeY()) {
560 mTowerSizeY = tmpComp.sizeY();
561 }
562 } else {
563 for (int itowerX = 0; itowerX < mGlobal_PAD_NX_Tower; itowerX++) {
564 for (int itowerY = 0; itowerY < mGlobal_PAD_NY_Tower; itowerY++) {
565 for (int ix = 0; ix < mGlobal_PAD_NX; ix++) {
566 for (int iy = 0; iy < mGlobal_PAD_NY; iy++) {
567 auto [x, y] = getGeoPadCenterLocal(itowerX, itowerY, iy, ix);
568 mPadCompositionBase.emplace_back("SiPad", tmpComp.layer(), tmpComp.stack(),
570 x, y, center_z,
571 mGlobal_Pad_Size, mGlobal_Pad_Size, tmpComp.sizeZ());
574 }
577 }
578 }
579 }
580 } // end for itowerY
581 } // end for itowerX
582 } // end else
583 center_z += tmpComp.getThickness();
584 } // end loop over pad layer compositions
585 LOG(debug) << "============ Created all pad layer compositions (" << mPadCompositionBase.size() << " volumes)";
586
587 mPadLayerThickness = center_z;
588
590
591 center_z = 0;
592 for (auto& tmpComp : pixelCompDummy) {
593 LOG(debug) << "Material (pixel layer) " << tmpComp.material();
594 LOG(debug) << "layer / stack / id :: " << tmpComp.layer() << " / " << tmpComp.stack() << " / " << tmpComp.id();
595 LOG(debug) << "center x,y,dz :: " << tmpComp.sizeX() << " / " << tmpComp.sizeY() << " / " << tmpComp.sizeZ();
596 if (tmpComp.material().compare("SiPix")) {
597 mPixelCompositionBase.emplace_back(tmpComp.material(), mPixelLayerLocations[0], tmpComp.stack(), tmpComp.id(),
598 tmpComp.centerX(), tmpComp.centerY(), center_z, mTowerSizeX, mTowerSizeY, tmpComp.sizeZ());
599 } else {
600 for (int ix = 0; ix < mGlobal_PIX_NX_Tower; ix++) {
601 for (int iy = 0; iy < mGlobal_PIX_NY_Tower; iy++) {
602 auto [pixX, pixY] = getGeoPixCenterLocal(iy, ix);
603 mPixelCompositionBase.emplace_back("SiPix", tmpComp.layer(), tmpComp.stack(), ix + iy * mGlobal_PIX_NX_Tower,
604 pixX, pixY, center_z,
605 mGlobal_PIX_SizeX, mGlobal_PIX_SizeY, tmpComp.sizeZ());
606 }
607 }
608 }
609 center_z += tmpComp.getThickness();
610 }
611 LOG(debug) << "============ Created all pixel layer compositions (" << mPixelCompositionBase.size() << " volumes)";
612 mPixelLayerThickness = center_z;
613
614 // Add HCal Layers
615 center_z = 0;
616 for (auto& tmpComp : hCalCompDummy) {
617 LOG(debug) << "Material (hcal) " << tmpComp.material();
618 LOG(debug) << "layer / stack / id :: " << tmpComp.layer() << " / " << tmpComp.stack() << " / " << tmpComp.id();
619 LOG(debug) << "center x,y,dz :: " << tmpComp.sizeX() << " / " << tmpComp.sizeY() << " / " << tmpComp.sizeZ();
620 mHCalCompositionBase.emplace_back(tmpComp.material(), tmpComp.layer(), tmpComp.stack(), tmpComp.id(),
621 tmpComp.centerX(), tmpComp.centerY(), mNHCalLayers == 1 ? 0. : center_z, // if we decided to use the spagetti HCAL it will be only one layer with two compositions
622 tmpComp.sizeX(), tmpComp.sizeY(), tmpComp.sizeZ());
623 if (mNHCalLayers == 1) {
624 center_z = tmpComp.getThickness();
625 } else {
626 center_z += tmpComp.getThickness();
627 }
628 }
629 LOG(debug) << "============ Created all hcal compositions (" << mHCalCompositionBase.size() << " volumes)";
630 mHCalLayerThickness = center_z;
631 center_z = 0;
632
634 LOG(debug) << " end of SetParameters ";
635}
636
637//_________________________________________________________________________
639{
640
641 for (auto& icomp : mGeometryComposition) {
642 if (icomp.layer() == layer && icomp.stack() == stack) {
643 return &icomp;
644 }
645 }
646 return nullptr;
647}
648
649//_________________________________________________________________________
650std::vector<const Composition*> Geometry::getFOCALMicroModule(int layer) const
651{
652
653 std::vector<const Composition*> layerComposition;
654
655 if (layer == -1) {
656 for (auto& icomp : mGeometryComposition) {
657 layerComposition.push_back(&icomp);
658 }
659 } else {
660 for (auto& icomp : mGeometryComposition) {
661 if (icomp.layer() == layer) {
662 layerComposition.push_back(&icomp);
663 }
664 }
665 }
666 return layerComposition;
667}
668
669//_________________________________________________________________________
671std::tuple<double, double, double> Geometry::getGeoTowerCenter(int tower, int segment) const
672{
673 int id = tower;
674 int itowerx = id % getNumberOfTowersInX();
675 int itowery = id / getNumberOfTowersInX();
676
677 float dwx = getTowerSizeX() + getTowerGapSizeX();
678 float dwy = getTowerSizeY() + getTowerGapSizeY();
679
680 double x = itowerx * dwx + 0.5 * dwx - 0.5 * getFOCALSizeX();
681 double y = itowery * dwy + 0.5 * dwy - 0.5 * getFOCALSizeY();
682 if (itowerx == 0 && itowery == 5) {
684 }
685 if (itowerx == 1 && itowery == 5) {
687 }
688
689 // From here is HCal stuff
691 auto [status, nCols, nRows] = getVirtualNColRow(segment);
692 int ix = id % nCols;
693 int iy = id / nRows;
694
695 if (mUseSandwichHCAL) {
696 float padSize = mVirtualSegmentComposition[segment].mPadSize;
697 double hCALsizeX = nCols * padSize;
698 double hCALsizeY = nRows * padSize;
699 x = ix * padSize + 0.5 * padSize - 0.5 * hCALsizeX;
700 y = iy * padSize + 0.5 * padSize - 0.5 * hCALsizeY;
701 } else {
702 nCols = std::floor(getFOCALSizeX() / getHCALTowerSize() + 0.001) + 1;
703 nRows = std::floor(getFOCALSizeY() / getHCALTowerSize() + 0.001);
704 ix = id % nCols;
705 iy = id / nRows;
706 double beamPipeRadius = 3.6; // in cm TODO: check if this is OK
707 double towerHalfDiag = std::sqrt(2) * 0.5 * getTowerSizeX(); // tower half diagonal
708 double minRadius = beamPipeRadius + towerHalfDiag;
709
710 float towerSize = getHCALTowerSize() / 7; // To be set from outside (number of channels on x & y)
711 y = iy * towerSize + 0.5 * towerSize - 0.5 * towerSize * nRows;
712 x = ix * towerSize + 0.5 * towerSize - 0.5 * towerSize * nCols;
713 if (y < minRadius && y > -minRadius) {
714 x = int(x) <= 0 ? x - (minRadius - towerSize) : x + (minRadius - towerSize);
715 }
716 }
717 }
718
719 /*
721 // define beam pipe radius, calculate half of the tower diagonal in XY
722 // and remove every tower which center is closer than the sum of the two...
723 double beamPipeRadius = 3.6; // in cm TODO: check if this is OK
724 double towerHalfDiag = std::sqrt(2)*0.5*getTowerSizeX(); // tower half diagonal
725 double minRadius = beamPipeRadius+towerHalfDiag;
726 //
727 if((x*x+y*y) < (minRadius*minRadius)){ // comparing the tower center position with the minimum distance in second powers.
728 //mDisableTowers.push_back(Tower+1);
729 //return false;
730 }
731 */
732
733 return {x, y, getFOCALZ0()};
734}
735
736//_________________________________________________________________________
737std::tuple<double, double, double> Geometry::getGeoCompositionCenter(int tower, int layer, int stack) const
738{
739 auto [status, segment] = getVirtualSegmentFromLayer(layer);
740 auto [towX, towY, towZ] = getGeoTowerCenter(tower, segment);
741 double z = towZ;
742
744 if (comp1 == nullptr) {
745 z = z + mLocalLayerZ[layer] - getFOCALSizeZ() / 2;
746 } else {
747 z = comp1->centerZ() - getFOCALSizeZ() / 2 + getFOCALZ0();
748 }
749 return {towX, towY, z};
750}
751
752//_________________________________________________________________________
754std::tuple<double, double, double> Geometry::getGeoPadCenter(int tower, int layer, int stack, int row, int col) const
755{
756 auto [x, y, z] = getGeoCompositionCenter(tower, layer, stack);
757 int itowerx = tower % mGlobal_PAD_NX_Tower;
758 int itowery = tower / mGlobal_PAD_NX_Tower;
759 auto [padX, padY] = getGeoPadCenterLocal(itowerx, itowery, row, col);
760
761 return {x + padX, y + padY, z};
762}
763
764//_________________________________________________________________________
766std::tuple<double, double> Geometry::getGeoPadCenterLocal(int towerX, int towerY, int row, int col) const
767{
769 /*
770 (0,0)
771 ___________________
772 | __ __
773 | |__| |__|
774 | __ __
775 | |__| |__|
776 | __ __
777 | |__| |__|
778 |
779 */
782 x = x - 0.5 * getTowerSizeX();
783 y = y + 0.5 * mTowerSizeY;
784 return {x, y};
785}
786
788std::tuple<double, double> Geometry::getGeoPixCenterLocal(int row, int col) const
789{
791 /*
792 (0,0)
793 ___________________
794 | __ __
795 | |__| |__|
796 | __ __
797 | |__| |__|
798 | __ __
799 | |__| |__|
800 |
801 */
802 double x = +col * (mGlobal_PIX_SizeX + 2.0 * mGlobal_PIX_SKIN) + 0.5 * mGlobal_PIX_SizeX;
803 double y = -row * (mGlobal_PIX_SizeY + 2.0 * mGlobal_PIX_SKIN) - 0.5 * mGlobal_PIX_SizeY;
804 x = x - 0.5 * mTowerSizeX;
806 return {x, y};
807}
808
809//_________________________________________________________________________
811{
812 return mTowerSizeX;
813 // return mGlobal_NX_NY_Pads*(mGlobal_Pad_Size+mGlobal_PPTOL)-mGlobal_PPTOL+2*mGlobal_PAD_SKIN;
814}
815
816//_________________________________________________________________________
818{
819 return mTowerSizeY;
820 // return mGlobal_NX_NY_Pads*(mGlobal_Pad_Size+mGlobal_PPTOL)-mGlobal_PPTOL+2*mGlobal_PAD_SKIN;
821}
822
823//_________________________________________________________________________
828
829//_________________________________________________________________________
834
835//_________________________________________________________________________
837{
838
839 double ret = 0;
840 for (int i = 0; i < mNPadLayers + mNPixelLayers + mNHCalLayers; i++) {
841 ret += mLayerThickness[i];
842 }
843 ret = ret + mFrontMatterLayerThickness;
844 return ret;
845}
846
847//_________________________________________________________________________
849{
850
851 double ret = 0;
852 for (int i = 0; i < mNPadLayers + mNPixelLayers; i++) {
853 ret += mLayerThickness[i];
854 }
855 ret = ret + mFrontMatterLayerThickness;
856 return ret;
857}
858
859//_________________________________________________________________________
861{
862
863 // Determines the ECAL z center of mass with respect to the FOCAL
864 double centerZ = mFrontMatterLayerThickness + mLocalLayerZ[0] + getECALSizeZ() / 2;
865 return centerZ;
866}
867
868//_________________________________________________________________________
870{
871
872 double ret = 0;
874 ret += mLayerThickness[i];
875 }
876 return ret;
877}
878
879//_________________________________________________________________________
881{
882
884 return centerZ;
885}
886
887//_________________________________________________________________________
888// this returns the following quantities for the pad position location
889// layer depth
890// pad row and col in the wafer
891// wafer id in the brick, where the pad belongs to
892std::tuple<int, int, int, int, int, int, int> Geometry::getPadPositionId2RowColStackLayer(int id) const
893{
894
898 int number = id - 1;
899 int padid = (number & 0xfff);
900 int stack = (number >> 12) & 0x000f;
901 // lay = (number >> 16) & 0x00ff;
902 int lay = (number >> 16) & 0x000f;
903
904 // seg = fSegments[lay];
905 auto [status, seg] = getVirtualSegmentFromLayer(lay); // NOTE: to be checked since this overrides the initialization above
906 /*col = padid%mGlobal_PAD_NX;
907 row = padid/mGlobal_PAD_NX;*/
908 int waferx = 0;
909 int wafery = 0;
910 int col = 0;
911 int row = 0;
912
913 // This gives the (col,row) of the pixel sensor
914 if (getVirtualIsPixel(seg)) {
915 col = padid % mGlobal_PIX_NX_Tower;
916 row = padid / mGlobal_PIX_NX_Tower;
917 } else {
918 col = padid % mGlobal_PAD_NX;
919 int remainder = (padid - col) / mGlobal_PAD_NX;
920 row = remainder % mGlobal_PAD_NY;
921 remainder = (remainder - row) / mGlobal_PAD_NY;
922 waferx = remainder % mGlobal_PAD_NX_Tower;
923 wafery = remainder / mGlobal_PAD_NX_Tower;
924 }
925 /*cout << "FROM GEOMETRY stack/lay/seg/waferx/wafery/col/row :: " << stack << " / " << lay << " / " << seg << " / "
926 << waferx << " / " << wafery << " / " << col << " / " << row << endl;*/
927 if (getVirtualIsHCal(seg)) {
928 auto [status, nCols, nRows] = getVirtualNColRow(seg);
929 col = id % nCols;
930 row = id / nRows;
931 }
932
933 return {row, col, stack, lay, seg, waferx, wafery};
934}
935
936//_________________________________________________________________________
939{
940
941 double ret = 0;
942 if (seg < 0 || seg > mNumberOfSegments) {
943 ret = getFOCALZ0();
944 } else {
945 for (int i = 0; i < seg; i++) {
946 ret += mLocalSegmentsZ[i];
947 }
948 }
949 ret = ret + mLocalSegmentsZ[seg] / 2 + getFOCALZ0() - getFOCALSizeZ() / 2;
950 return ret;
951}
952
953//_________________________________________________________________________
958{
964
965 std::vector<int> layerType;
966 for (int j = 0; j < mNPixelLayers + mNPadLayers + mNHCalLayers; j++) {
967 layerType.push_back(0);
968 }
969 for (int i = 0; i < mNPixelLayers; i++) {
970 layerType[mPixelLayerLocations[i]] = -1;
971 }
972
973 int low = 0;
974 int start = 0;
975 int high = 0;
976 for (int i = 0; i < mNumberOfSegments; i++) {
978 for (int j = start; j < mNPixelLayers + mNPadLayers + mNHCalLayers; j++) {
979 if (layerType[j] == -1) {
980 mSegments[j] = i;
981 start++;
982 } else {
983 mSegments[j] = i;
984 low++;
985 start++;
986 }
987 if (low >= high) {
988 break;
989 }
990 }
991 }
992}
993
994//_________________________________________________________________________
998int Geometry::getPixelNumber(int vol0, int vol1, int /*vol2*/, double x, double y) const
999{
1000 int ret = 0;
1001 if (mGlobal_Pixel_Readout == false) {
1002 ret = -1;
1003 return ret;
1004 }
1005 int id = vol0;
1006 // int tower = vol1;
1007 // int brick = vol2; /// meaning 0 in the current design
1008
1009 auto [row, col, stack, layer, segment, waferX, waferY] = getPadPositionId2RowColStackLayer(id);
1010 auto [pixX, pixY] = getGeoPixCenterLocal(row, col);
1011
1012 double x_loc = x - pixX;
1013 double y_loc = y - pixY;
1014 double pixel_nbr_x = ((x_loc + 0.5 * getGlobalPixelWaferSizeX()) / (mGlobal_Pixel_Size));
1015 double pixel_nbr_y = ((y_loc + 0.5 * getGlobalPixelWaferSizeY()) / (mGlobal_Pixel_Size));
1016
1017 int pixel_number_x;
1018 pixel_number_x = static_cast<int>(pixel_nbr_x);
1019 // if(pixel_number_x-pixel_nbr_x>0.5){
1020 // pixel_number_x = pixel_number_x+1;
1021 // }
1022
1023 int pixel_number_y;
1024 pixel_number_y = static_cast<int>(pixel_nbr_y);
1025 // if(pixel_number_y-pixel_nbr_y>0.5){
1026 // pixel_number_y = pixel_number_y+1;
1027 // }
1028 ret = (pixel_number_x << 16) | pixel_number_y;
1029 // cout<<x<<" "<<y<<" "<<x0<<" "<<y0<<" "<<x_loc<<" "<<y_loc<<" "<<pixel_number_x<<" "<<pixel_number_y<<" "<<ret<<endl;
1030 return ret;
1031}
1032
1033//_________________________________________________________________________
1054
1055//_________________________________________________________________________
1057{
1058 return std::find(mDisableTowers.begin(), mDisableTowers.end(), tower) != mDisableTowers.end();
1059}
1060
1061//_________________________________________________________________________
1063std::tuple<double, double, double> Geometry::getGeoPixelCenter(int pixel, int tower, int layer, int stack, int row, int col) const
1064{
1065 auto [x0, y0, z0] = getGeoPadCenter(tower, layer, stack, row, col);
1066
1067 int pixel_y = pixel & 0xff;
1068 int pixel_x = (pixel >> 8) & 0xff;
1069
1070 double x1, y1;
1071 x1 = pixel_x * mGlobal_Pixel_Size + 0.5 * mGlobal_Pixel_Size - 0.5 * mGlobal_Pad_Size;
1072 y1 = pixel_y * mGlobal_Pixel_Size + 0.5 * mGlobal_Pixel_Size - 0.5 * mGlobal_Pad_Size;
1073
1074 return {x1 + x0, y1 + y0, z0};
1075}
1076
1077std::tuple<bool, int, int, int, int> Geometry::getVirtualInfo(double x, double y, double z) const
1078{
1079 //
1080 // Calculate col, row, layer, (virtual) segment from x,y,z
1081 // returns false if outside volume
1082 //
1083 int col = -1, row = -1;
1084 auto [status, layer, segment] = getVirtualLayerSegment(z);
1085
1086 if (!status) {
1087 return {false, col, row, layer, segment};
1088 }
1089 if (segment == -1) {
1090 return {false, col, row, layer, segment};
1091 }
1092 if (std::abs(x) > (getFOCALSizeX() + 2 * getMiddleTowerOffset()) / 2) {
1093 return {false, col, row, layer, segment};
1094 }
1095 if (std::abs(y) > getFOCALSizeY() / 2) {
1096 return {false, col, row, layer, segment};
1097 }
1098
1100 float towerSize = getHCALTowerSize();
1101 double beamPipeRadius = 3.0; // in cm TODO check the number is OK (different hardcoded values are used elsewhere)
1102 double minRadius = beamPipeRadius + towerSize / 2.;
1103
1104 double hCALsizeX = getHCALTowersInX() * towerSize;
1105 double hCALsizeY = getHCALTowersInY() * towerSize;
1106
1107 if (x < minRadius && x > -minRadius && y < minRadius && y > -minRadius) {
1108 x = x < 0 ? x - 0.001 : x + 0.001;
1109 y = y < 0 ? y - 0.001 : y + 0.001;
1110 }
1111 if (!mUseSandwichHCAL) {
1112 row = (int)((y + hCALsizeY / 2) / (towerSize / 7));
1113 col = (int)((x + hCALsizeX / 2) / (towerSize / 7));
1114 } else {
1115 row = (int)((y + hCALsizeY / 2) / (towerSize));
1116 col = (int)((x + hCALsizeX / 2) / (towerSize));
1117 }
1118 } else {
1119 row = (int)((y + getFOCALSizeY() / 2) / mVirtualSegmentComposition[segment].mPadSize);
1120 // if it is the towers right and left of the beam pipe, adjust x so the offset is removed
1121 // if(y < 4.2 && y > - 4.2) { // TO BE set from outside or somewhere else -4,4 is the y position of the middle towers
1122 // x = x < 0 ? x + GetMiddleTowerOffset() : x - GetMiddleTowerOffset();
1123 // }
1124 col = (int)((x + getFOCALSizeX() / 2) / mVirtualSegmentComposition[segment].mPadSize);
1125 }
1126 return {true, col, row, layer, segment};
1127}
1128
1129//_______________________________________________________________________
1130std::tuple<bool, double, double, double> Geometry::getXYZFromColRowSeg(int col, int row, int segment) const
1131{
1132
1133 double x = 0.0, y = 0.0, z = 0.0;
1134 if (segment > mVirtualNSegments) {
1135 return {false, x, y, z};
1136 }
1137
1139 float towerSize = getHCALTowerSize();
1140 double hCALsizeX = getHCALTowersInX() * towerSize;
1141 double hCALsizeY = getHCALTowersInY() * towerSize;
1142
1143 if (!mUseSandwichHCAL) {
1144 y = -1 * hCALsizeY / 2 + ((float)row + 0.5) * (towerSize / 7);
1145 x = -1 * hCALsizeX / 2 + ((float)col + 0.5) * (towerSize / 7);
1146 } else {
1147 y = -1 * hCALsizeY / 2 + ((float)row + 0.5) * (towerSize);
1148 x = -1 * hCALsizeX / 2 + ((float)col + 0.5) * (towerSize);
1149 }
1150 } else {
1151 y = -1 * getFOCALSizeY() / 2 + ((float)row + 0.5) * mVirtualSegmentComposition[segment].mPadSize;
1152 x = -1 * getFOCALSizeX() / 2 + ((float)col + 0.5) * mVirtualSegmentComposition[segment].mPadSize;
1153 // Middle towers offset
1154 // if(y < 4.2 && y > - 4.2) { // TO BE set from outside or somewhere else -4,4 is the y position of the middle towers
1155 // x = x < 0 ? x - GetMiddleTowerOffset() : x + GetMiddleTowerOffset();
1156 // }
1157 }
1158
1159 if (std::abs(x) > (getFOCALSizeX() + 2 * getMiddleTowerOffset()) / 2) {
1160 return {false, x, y, z};
1161 }
1162 if (std::abs(y) > getFOCALSizeY() / 2) {
1163 return {false, x, y, z};
1164 }
1166 return {true, x, y, z};
1167}
1168
1169//_______________________________________________________________________
1170std::tuple<bool, int, int> Geometry::getVirtualNColRow(int segment) const
1171{
1172
1173 // ix + iy*mGlobal_PAD_NX + itowerX*mGlobal_PAD_NX*mGlobal_PAD_NY + itowerY*mGlobal_PAD_NX_Tower*mGlobal_PAD_NX*mGlobal_PAD_NY
1174 int nCol = -1, nRow = -1;
1175 if (mVirtualSegmentComposition.size() == 0) {
1176 return {false, nCol, nRow};
1177 }
1178 if ((segment < 0) || (segment >= mVirtualNSegments)) {
1179 return {false, nCol, nRow};
1180 }
1181 nCol = (int)(getFOCALSizeX() / mVirtualSegmentComposition[segment].mPadSize + 0.001);
1182 nRow = (int)(getFOCALSizeY() / mVirtualSegmentComposition[segment].mPadSize + 0.001);
1184 if (!mUseSandwichHCAL) {
1185 nCol = getHCALTowersInX() * 7; // To be set from outside (number of channels in each tower on x)
1186 nRow = getHCALTowersInY() * 7; // To be set from outside (number of channels in each tower on y)
1187 } else {
1188 nCol = getHCALTowersInX();
1189 nRow = getHCALTowersInY();
1190 }
1191 }
1192 return {true, nCol, nRow};
1193}
1194
1195//_______________________________________________________________________
1197{
1198
1199 return mVirtualNSegments;
1200}
1201
1202//_______________________________________________________________________
1203std::tuple<bool, int, int> Geometry::getVirtualLayerSegment(float z) const
1204{
1205
1206 int layer = -1;
1207 int segment = -1;
1208
1209 z = z - getFOCALZ0() + getFOCALSizeZ() / 2; // z from front face (excluding fron matter)
1210 float emLayersZ = mNPadLayers * mPadLayerThickness + mNPixelLayers * mPixelLayerThickness; // Pixel layers replace pad layers
1211 if (z < emLayersZ) {
1213 while (layer >= 0 && z < mLocalLayerZ[layer]) {
1214 layer--;
1215 }
1216 } else {
1217 z = z - emLayersZ;
1219 }
1220
1221 if ((layer < 0) || (layer >= (mNPadLayers + mNPixelLayers + mNHCalLayers))) {
1222 return {false, layer, segment};
1223 }
1224
1225 segment = -1;
1226 for (int nSeg = 0; nSeg < mVirtualNSegments; nSeg++) {
1227 if ((layer >= mVirtualSegmentComposition[nSeg].mMinLayer) && (layer <= mVirtualSegmentComposition[nSeg].mMaxLayer)) {
1228 segment = nSeg;
1229 break;
1230 }
1231 }
1232
1233 if (segment == mVirtualNSegments) {
1234 return {false, layer, segment};
1235 }
1236 return {true, layer, segment};
1237}
1238
1239//_______________________________________________________________________
1240std::tuple<bool, int> Geometry::getVirtualSegmentFromLayer(int layer) const
1241{
1242
1243 int segment = -1;
1244 for (int nSeg = 0; nSeg < mVirtualNSegments; nSeg++) {
1245 // cout << "Segment boundaries " << nSeg << " : " << mVirtualSegmentComposition[nSeg].fMinLayer << " " << mVirtualSegmentComposition[nSeg].fMaxLayer << endl;
1246 if ((layer >= mVirtualSegmentComposition[nSeg].mMinLayer) && (layer <= mVirtualSegmentComposition[nSeg].mMaxLayer)) {
1247 segment = nSeg;
1248 break;
1249 }
1250 }
1251 if (segment == mVirtualNSegments) {
1252 return {false, segment};
1253 }
1254 return {true, segment};
1255}
1256
1257//_______________________________________________________________________
1259{
1260 auto [status, layer, segment] = getVirtualLayerSegment(z);
1261 return segment;
1262}
1263
1264//_______________________________________________________________________
1266{
1267 if (mVirtualSegmentComposition.size() == 0) {
1268 return -1;
1269 }
1270 return mVirtualSegmentComposition[segment].mPadSize;
1271}
1272
1273//_______________________________________________________________________
1275{
1276
1277 if (mVirtualSegmentComposition.size() == 0) {
1278 return -1;
1279 }
1280 return mVirtualSegmentComposition[segment].mRelativeSensitiveThickness;
1281}
1282
1283//_______________________________________________________________________
1285{
1286
1287 if (mVirtualSegmentComposition.size() == 0) {
1288 return -1;
1289 }
1290 return mVirtualSegmentComposition[segment].mPixelTreshold;
1291}
1292
1293//________________________________________________________________________
1295{
1296
1297 if (mVirtualSegmentComposition.size() == 0) {
1298 return -1;
1299 }
1300
1301 float size = 0;
1302 for (int nLay = mVirtualSegmentComposition[segment].mMinLayer; nLay <= mVirtualSegmentComposition[segment].mMaxLayer; nLay++) {
1303 size += mLayerThickness[nLay];
1304 }
1305 return size;
1306}
1307
1308//________________________________________________________________________
1310{
1311
1312 if (mVirtualSegmentComposition.size() == 0) {
1313 return -1;
1314 }
1315
1316 float before = 0;
1317 float thickness = 0;
1318
1319 for (int nLay = 0; nLay < mVirtualSegmentComposition[segment].mMinLayer; nLay++) {
1320 before += mLayerThickness[nLay];
1321 }
1322 for (int nLay = mVirtualSegmentComposition[segment].mMinLayer; nLay <= mVirtualSegmentComposition[segment].mMaxLayer; nLay++) {
1323 thickness += mLayerThickness[nLay];
1324 }
1325 return getFOCALZ0() - getFOCALSizeZ() / 2 + before + thickness / 2;
1326}
1327
1328//________________________________________________________________________
1330{
1331
1332 if (mVirtualSegmentComposition.size() == 0) {
1333 return false;
1334 }
1335
1336 if ((segment < 0) || (segment >= mVirtualNSegments)) {
1337 return false;
1338 }
1339
1340 return (mVirtualSegmentComposition[segment].mIsPixel == 1);
1341}
1342
1343//________________________________________________________________________
1345{
1346
1347 if (mVirtualSegmentComposition.size() == 0) {
1348 return false;
1349 }
1350
1351 if ((segment < 0) || (segment >= mVirtualNSegments)) {
1352 return false;
1353 }
1354 return (mVirtualSegmentComposition[segment].mIsPixel == 2);
1355}
1356
1357//________________________________________________________________________
1359{
1360 //
1361 // Get the number of layers in a given segment
1362 //
1363 if (mVirtualSegmentComposition.size() == 0) {
1364 return -1;
1365 }
1366
1367 if ((segment < 0) || (segment >= mVirtualNSegments)) {
1368 return -1;
1369 }
1370 return (mVirtualSegmentComposition[segment].mMaxLayer - mVirtualSegmentComposition[segment].mMinLayer + 1);
1371}
1372
1373//_______________________________________________________________________
1375{
1376 //
1377 // Get the number of first layer in a given segment
1378 //
1379 if (mVirtualSegmentComposition.size() == 0) {
1380 return -1;
1381 }
1382
1383 if ((segment < 0) || (segment >= mVirtualNSegments)) {
1384 return -1;
1385 }
1386 return mVirtualSegmentComposition[segment].mMinLayer;
1387}
1388
1389//_______________________________________________________________________
1391{
1392 //
1393 // Get the number of first layer in a given segment
1394 //
1395 if (mVirtualSegmentComposition.size() == 0) {
1396 return -1;
1397 }
1398
1399 if ((segment < 0) || (segment >= mVirtualNSegments)) {
1400 return -1;
1401 }
1402 return mVirtualSegmentComposition[segment].mMaxLayer;
1403}
o2::mch::mapping::CathodeSegmentation seg
int32_t i
uint32_t j
Definition RawData.h:0
uint32_t col
Definition RawData.h:4
uint32_t stack
Definition RawData.h:1
std::ostringstream debug
float centerZ() const
Definition Composition.h:57
double getTowerGapSizeY() const
Definition Geometry.h:127
double getFOCALSizeY() const
Definition Geometry.cxx:830
std::vector< VirtualSegment > mVirtualSegmentComposition
Definition Geometry.h:228
float mHCalLayerThickness
Definition Geometry.h:223
std::tuple< int, int, int, int, int, int, int > getPadPositionId2RowColStackLayer(int id) const
Definition Geometry.cxx:892
int getNumberOfTowersInX() const
Definition Geometry.h:123
std::tuple< bool, double, double, double > getXYZFromColRowSeg(int col, int row, int segment) const
double getTowerGapSizeX() const
Definition Geometry.h:126
double getHCALSizeZ() const
Definition Geometry.cxx:869
std::array< float, 100 > mLocalSegmentsZ
Definition Geometry.h:219
float mFrontMatterLayerThickness
segment location in z
Definition Geometry.h:220
double getGlobalPixelWaferSizeY() const
Definition Geometry.h:130
double getECALSizeZ() const
Definition Geometry.cxx:848
int getHCALTowersInY() const
Definition Geometry.h:103
std::vector< Composition > mFrontMatterCompositionBase
Definition Geometry.h:162
float getVirtualPadSize(int segment) const
bool getVirtualIsHCal(int segment) const
int getVirtualNSegments() const
std::tuple< bool, int, int, int, int > getVirtualInfo(double x, double y, double z) const
std::list< int > mDisableTowers
Definition Geometry.h:225
std::array< float, 100 > mLayerThickness
Definition Geometry.h:224
double getGlobalPixelWaferSizeX() const
Definition Geometry.h:129
double getFOCALSizeZ() const
Definition Geometry.cxx:836
std::tuple< double, double > getGeoPadCenterLocal(int towerX, int towerY, int row, int col) const
this gives local position of the pad with respect to the wafer
Definition Geometry.cxx:766
std::tuple< double, double, double > getGeoPixelCenter(int pixel_id, int tower, int layer, int stack, int row, int col) const
this gives global position of the pixel
int getPixelNumber(int vol0, int vol1, int vol2, double x, double y) const
Definition Geometry.cxx:998
void init(const std::string geoFile)
Definition Geometry.cxx:74
float getHCALTowerSize() const
Definition Geometry.h:101
static Geometry * getInstance()
Definition Geometry.cxx:41
float getVirtualRelativeSensitiveThickness(int segment) const
std::tuple< bool, int, int > getVirtualNColRow(int segment) const
float mGlobal_PIX_OffsetX
Definition Geometry.h:182
std::array< float, 100 > mLocalLayerZ
Definition Geometry.h:218
float mGlobal_PIX_OffsetY
Definition Geometry.h:183
int getVirtualSegment(float z) const
int getVirtualMaxLayerInSegment(int segment) const
int getHCALTowersInX() const
Definition Geometry.h:102
std::vector< Composition > mPixelCompositionBase
Definition Geometry.h:164
double getHCALCenterZ() const
Definition Geometry.cxx:880
std::tuple< double, double, double > getGeoCompositionCenter(int tower, int layer, int stack) const
Definition Geometry.cxx:737
std::tuple< double, double, double > getGeoTowerCenter(int tower, int segment=-1) const
this gives global position of the center of tower
Definition Geometry.cxx:671
double getTowerSizeX() const
Definition Geometry.cxx:810
std::vector< const Composition * > getFOCALMicroModule(int layer) const
Definition Geometry.cxx:650
std::vector< Composition > mPadCompositionBase
Definition Geometry.h:163
std::array< int, 20 > mPixelLayerLocations
Definition Geometry.h:192
const Composition * getComposition(int layer, int stack) const
Definition Geometry.cxx:638
void setUpLayerSegmentMap()
Definition Geometry.cxx:957
std::array< int, 100 > mNumberOfLayersInSegments
Definition Geometry.h:215
double getFOCALZ0() const
Definition Geometry.h:122
bool getVirtualIsPixel(int segment) const
float getMiddleTowerOffset() const
Definition Geometry.h:134
std::tuple< bool, int, int > getVirtualLayerSegment(float z) const
std::vector< Composition > mHCalCompositionBase
Definition Geometry.h:165
double getFOCALSizeX() const
Definition Geometry.cxx:824
double getTowerSizeY() const
Definition Geometry.cxx:817
float getVirtualSegmentSizeZ(int segment) const
std::vector< Composition > mGeometryComposition
Definition Geometry.h:161
int getVirtualMinLayerInSegment(int segment) const
bool disabledTower(int tower)
std::tuple< bool, int > getVirtualSegmentFromLayer(int layer) const
float mGlobal_Middle_Tower_Offset
Definition Geometry.h:199
float getVirtualSegmentZ(int segment) const
std::tuple< double, double, double > getGeoPadCenter(int tower, int layer, int stack, int row, int col) const
this gives global position of the pad
Definition Geometry.cxx:754
double getECALCenterZ() const
Definition Geometry.cxx:860
float mGlobal_HCAL_Tower_Size
Definition Geometry.h:202
std::array< int, 100 > mSegments
Definition Geometry.h:214
int getVirtualNLayersInSegment(int segment) const
float getVirtualPixelTreshold(int segment) const
std::tuple< double, double > getGeoPixCenterLocal(int row, int col) const
this gives local position of the pad with respect to the wafer
Definition Geometry.cxx:788
double getFOCALSegmentZ(int seg) const
Definition Geometry.cxx:938
float mPixelLayerThickness
Definition Geometry.h:222
bool mInsertFrontHCalReadoutMaterial
Definition Geometry.h:210
std::string mGlobal_Gap_Material
Definition Geometry.h:200
GLint GLenum GLint x
Definition glcorearb.h:403
GLuint segment
Definition glcorearb.h:4945
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition glcorearb.h:5034
GLsizeiptr size
Definition glcorearb.h:659
GLenum GLuint GLenum GLuint GLuint GLuint minlayer
Definition glcorearb.h:2506
GLuint GLfloat GLfloat GLfloat x1
Definition glcorearb.h:5034
GLint y
Definition glcorearb.h:270
GLuint GLfloat x0
Definition glcorearb.h:5034
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLuint start
Definition glcorearb.h:469
GLuint GLfloat GLfloat y0
Definition glcorearb.h:5034
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
std::string filename()
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< int > row
const std::string str