Project
Loading...
Searching...
No Matches
Segmentation.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
15
16#include <fairlogger/Logger.h>
17
22
23using namespace o2::mft;
24
26
27//_____________________________________________________________________________
28Segmentation::Segmentation() : mHalves(nullptr) {}
29
30//_____________________________________________________________________________
31Segmentation::Segmentation(const Char_t* nameGeomFile) : mHalves(nullptr)
32{
33
34 // constructor
35
36 mHalves = new TClonesArray("o2::mft::HalfSegmentation", NumberOfHalves);
37 mHalves->SetOwner(kTRUE);
38
39 auto* halfBottom = new HalfSegmentation(nameGeomFile, Bottom);
40 auto* halfTop = new HalfSegmentation(nameGeomFile, Top);
41
42 new ((*mHalves)[Bottom]) HalfSegmentation(*halfBottom);
43 new ((*mHalves)[Top]) HalfSegmentation(*halfTop);
44
45 delete halfBottom;
46 delete halfTop;
47
48 LOG(debug1) << "MFT segmentation set!";
49}
50
51//_____________________________________________________________________________
52Segmentation::~Segmentation()
53{
54
55 if (mHalves) {
56 mHalves->Delete();
57 }
58 delete mHalves;
59}
60
64
65//_____________________________________________________________________________
66HalfSegmentation* Segmentation::getHalf(Int_t iHalf) const
67{
68 LOG(debug) << Form("Ask for half %d (of %d and %d)", iHalf, Bottom, Top);
69
70 return ((iHalf == Top || iHalf == Bottom) ? ((HalfSegmentation*)mHalves->At(iHalf)) : nullptr);
71}
72
74
75//_____________________________________________________________________________
76void Segmentation::Clear(const Option_t* /*opt*/)
77{
78 if (mHalves) {
79 mHalves->Delete();
80 delete mHalves;
81 mHalves = nullptr;
82 }
83}
84
94//_____________________________________________________________________________
95Int_t Segmentation::getDetElemLocalID(Int_t half, Int_t disk, Int_t ladder, Int_t sensor) const
96{
97
98 Int_t localId = 0;
99
100 if (half == 1) {
101 localId += getHalf(0)->getHalfDisk(disk)->getNChips();
102 }
103
104 for (Int_t iLad = 0; iLad < getHalf(half)->getHalfDisk(disk)->getNLadders(); iLad++) {
105 if (iLad < ladder) {
106 localId += getHalf(half)->getHalfDisk(disk)->getLadder(iLad)->getNSensors();
107 } else {
108 for (Int_t iSens = 0; iSens < getHalf(half)->getHalfDisk(disk)->getLadder(iLad)->getNSensors(); iSens++) {
109 if (iSens == sensor) {
110 return localId;
111 }
112 localId++;
113 }
114 }
115 }
116
117 return -1;
118}
Class for the description of the structure of a half-disk.
Segmentation class for each half of the ALICE Muon Forward Tracker.
Class for the virtual segmentation of the ALICE Muon Forward Tracker.
ClassImp(o2::mft::Segmentation)
Description of the virtual segmentation of a ladder.
std::ostringstream debug
Int_t getNLadders() const
Get the number of Ladder on the Half-Disk.
LadderSegmentation * getLadder(Int_t iLadder)
Returns pointer to the ladder segmentation object.
Int_t getNChips()
Returns the number of sensors on the Half-Disk.
HalfDiskSegmentation * getHalfDisk(Int_t iDisk) const
Int_t getNSensors() const
Returns number of Sensor on the ladder.
HalfSegmentation * getHalf(Int_t iHalf) const
Returns pointer to the segmentation of the half-MFT.
static constexpr Int_t NumberOfHalves
Number of detector halves.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"