Project
Loading...
Searching...
No Matches
Detector.h
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#ifndef ALICEO2_TOF_DETECTOR_H_
13#define ALICEO2_TOF_DETECTOR_H_
14
16#include "TOFBase/Geo.h"
17
20
21#include <array>
22#include <map>
23#include <vector>
24
25class TGeoVolume;
26
27class FairVolume;
28
29namespace o2
30{
31namespace tof
32{
33class HitType : public o2::BasicXYZEHit<float>
34{
35 public:
36 using BasicXYZEHit<float>::BasicXYZEHit;
37};
38} // namespace tof
39} // namespace o2
40
41#ifdef USESHM
42namespace std
43{
44template <>
45class allocator<o2::tof::HitType> : public o2::utils::ShmAllocator<o2::tof::HitType>
46{
47};
48} // namespace std
49#endif
50
51namespace o2
52{
53namespace tof
54{
55
56class Detector : public o2::base::DetImpl<Detector>
57{
58 public:
60 kAir = 1,
61 kNomex = 2,
62 kG10 = 3,
66 kFre = 7,
67 kCuS = 8,
68 kGlass = 9,
69 kWater = 10,
70 kCable = 11,
72 kCopper = 13,
74 kCrates = 15,
75 kHoneyHoles = 16
76 };
77
78 Detector() = default;
79
80 Detector(Bool_t active);
81
82 ~Detector() override;
83
84 void InitializeO2Detector() final;
85
86 Bool_t ProcessHits(FairVolume* v = nullptr) final;
87
88 void Register() override;
89
90 std::vector<HitType>* getHits(int iColl) const
91 {
92 if (iColl == 0) {
93 return mHits;
94 }
95 return nullptr;
96 }
97
98 void Reset() final;
99 void EndOfEvent() final;
100
101 void CreateMaterials();
102 void ConstructGeometry() final;
103 void addAlignableVolumes() const override;
104
105 void setTOFholes(Bool_t flag = kTRUE) { mTOFHoles = flag; }
106
107 protected:
108 virtual void DefineGeometry(Float_t xtof, Float_t ytof, Float_t zlenA) final;
109 virtual void MaterialMixer(Float_t* p, const Float_t* const a, const Float_t* const m, Int_t n) const final;
110
111 private:
113 Detector(const Detector& rhs);
114
115 void createModules(Float_t xtof, Float_t ytof, Float_t zlenA, Float_t xFLT, Float_t yFLT, Float_t zFLTA) const;
116 void makeStripsInModules(Float_t ytof, Float_t zlenA) const;
117 void createModuleCovers(Float_t xtof, Float_t zlenA) const;
118 void createBackZone(Float_t xtof, Float_t ytof, Float_t zlenA) const;
119 void makeFrontEndElectronics(Float_t xtof) const;
120 void makeFEACooling(Float_t xtof) const;
121 void makeNinoMask(Float_t xtof) const;
122 void makeSuperModuleCooling(Float_t xtof, Float_t ytof, Float_t zlenA) const;
124 struct FEAContainer {
125 Float_t z;
126 Int_t row;
127 Bool_t rotated;
128 };
130 std::vector<FEAContainer> feaContainers(Float_t zlenA, Bool_t holes) const;
132 void makeCentralFEAContainer(Float_t ytof) const;
134 TGeoVolume* coolingBarPiece(Double_t dx, Double_t dy, Double_t dz) const;
136 void placeCoolingBar(const char* mother, const std::vector<FEAContainer>& cont, Double_t crateDZ,
137 Double_t crateY0, Double_t crateY1, Double_t xcoor, Double_t dx, Double_t ycoor,
138 Double_t dy, Double_t zcoor, Double_t dz, Int_t& copy) const;
139 void makeSuperModuleServices(Float_t xtof, Float_t ytof, Float_t zlenA) const;
140 void makeReadoutCrates(Float_t ytof) const;
141
142 void makeModulesInBTOFvolumes(Float_t ytof, Float_t zlenA) const;
143 void makeCoversInBTOFvolumes() const;
144 void makeBackInBTOFvolumes(Float_t ytof) const;
145
146 bool isMergable(HitType hit1, HitType hit2)
147 {
148 if (hit1.GetTrackID() != hit2.GetTrackID()) {
149 return false;
150 }
151
152 if (std::abs(hit1.GetTime() - hit2.GetTime()) > 1.0 /*1 ns*/) {
153 return false;
154 }
155
156 return true;
157 }
158
159 Int_t mEventNr; // event count
160 Int_t mTOFSectors[o2::tof::Geo::NSECTORS];
161 Bool_t mTOFHoles; // flag to allow for holes in front of the PHOS
162 Int_t mLastChannelID = -1;
163
165 std::vector<HitType>* mHits;
166
169 mutable std::map<std::array<Double_t, 3>, TGeoVolume*> mBarPieces;
170
171 template <typename Det>
172 friend class o2::base::DetImpl;
173 ClassDefOverride(Detector, 1);
174};
175} // namespace tof
176} // namespace o2
177
178#ifdef USESHM
179namespace o2
180{
181namespace base
182{
183template <>
184struct UseShm<o2::tof::Detector> {
185 static constexpr bool value = true;
186};
187} // namespace base
188} // namespace o2
189#endif
190
191#endif
Definition of the Detector class.
void setTOFholes(Bool_t flag=kTRUE)
Definition Detector.h:105
~Detector() override
Definition Detector.cxx:60
virtual void MaterialMixer(Float_t *p, const Float_t *const a, const Float_t *const m, Int_t n) const final
Definition Detector.cxx:297
void ConstructGeometry() final
Definition Detector.cxx:312
void Register() override
Definition Detector.cxx:121
void InitializeO2Detector() final
Definition Detector.cxx:65
void addAlignableVolumes() const override
declare alignable volumes of detector
Bool_t ProcessHits(FairVolume *v=nullptr) final
Definition Detector.cxx:75
void EndOfEvent() final
Definition Detector.cxx:328
Detector()=default
virtual void DefineGeometry(Float_t xtof, Float_t ytof, Float_t zlenA) final
Definition Detector.cxx:329
void Reset() final
Definition Detector.cxx:126
std::vector< HitType > * getHits(int iColl) const
Definition Detector.h:90
static constexpr Int_t NSECTORS
Definition Geo.h:122
GLdouble n
Definition glcorearb.h:1982
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< int > row