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 bool isMTSafe() const override { return true; }
86
87 Bool_t ProcessHits(FairVolume* v = nullptr) final;
88
89 void Register() override;
90
91 std::vector<HitType>* getHits(int iColl) const
92 {
93 if (iColl == 0) {
94 return mHits;
95 }
96 return nullptr;
97 }
98
99 void Reset() final;
100 void EndOfEvent() final;
101
102 void CreateMaterials();
103 void ConstructGeometry() final;
104 void addAlignableVolumes() const override;
105
106 void setTOFholes(Bool_t flag = kTRUE) { mTOFHoles = flag; }
107
108 protected:
109 virtual void DefineGeometry(Double_t xtof, Double_t ytof, Double_t zlenA) final;
110 virtual void MaterialMixer(Float_t* p, const Float_t* const a, const Float_t* const m, Int_t n) const final;
111
112 private:
114 Detector(const Detector& rhs);
115
116 void createModules(Double_t xtof, Double_t ytof, Double_t zlenA, Double_t xFLT, Double_t yFLT, Double_t zFLTA) const;
117 void makeStripsInModules(Double_t ytof, Double_t zlenA) const;
118 void createModuleCovers(Double_t xtof, Double_t zlenA) const;
119 void createBackZone(Double_t xtof, Double_t ytof, Double_t zlenA) const;
120 void makeFrontEndElectronics(Double_t xtof) const;
121 void makeFEACooling(Double_t xtof) const;
122 void makeNinoMask(Double_t xtof) const;
123 void makeSuperModuleCooling(Double_t xtof, Double_t ytof, Double_t zlenA) const;
125 struct FEAContainer {
126 Double_t z;
127 Int_t row;
128 Bool_t rotated;
129 };
131 std::vector<FEAContainer> feaContainers(Double_t zlenA, Bool_t holes) const;
133 void makeCentralFEAContainer(Double_t ytof) const;
135 TGeoVolume* coolingBarPiece(Double_t dx, Double_t dy, Double_t dz) const;
137 void placeCoolingBar(const char* mother, const std::vector<FEAContainer>& cont, Double_t crateDZ,
138 Double_t crateY0, Double_t crateY1, Double_t xcoor, Double_t dx, Double_t ycoor,
139 Double_t dy, Double_t zcoor, Double_t dz, Int_t& copy) const;
140 void makeSuperModuleServices(Double_t xtof, Double_t ytof, Double_t zlenA) const;
141 void makeReadoutCrates(Double_t ytof) const;
142
143 void makeModulesInBTOFvolumes(Double_t ytof, Double_t zlenA) const;
144 void makeCoversInBTOFvolumes() const;
145 void makeBackInBTOFvolumes(Double_t ytof) const;
146
147 bool isMergable(HitType hit1, HitType hit2)
148 {
149 if (hit1.GetTrackID() != hit2.GetTrackID()) {
150 return false;
151 }
152
153 if (std::abs(hit1.GetTime() - hit2.GetTime()) > 1.0 /*1 ns*/) {
154 return false;
155 }
156
157 return true;
158 }
159
160 Int_t mEventNr; // event count
161 Int_t mTOFSectors[o2::tof::Geo::NSECTORS];
162 Bool_t mTOFHoles; // flag to allow for holes in front of the PHOS
163 Int_t mLastChannelID = -1;
164 Int_t mTrackRefLastTrackID = -1;
165
167 std::vector<HitType>* mHits;
168
171 mutable std::map<std::array<Double_t, 3>, TGeoVolume*> mBarPieces;
172
173 template <typename Det>
174 friend class o2::base::DetImpl;
175 ClassDefOverride(Detector, 1);
176};
177} // namespace tof
178} // namespace o2
179
180#ifdef USESHM
181namespace o2
182{
183namespace base
184{
185template <>
186struct UseShm<o2::tof::Detector> {
187 static constexpr bool value = true;
188};
189} // namespace base
190} // namespace o2
191#endif
192
193#endif
Definition of the Detector class.
void setTOFholes(Bool_t flag=kTRUE)
Definition Detector.h:106
~Detector() override
Definition Detector.cxx:60
bool isMTSafe() const override
whether this detector may run in multithreaded Geant4, with one clone per worker thread
Definition Detector.h:85
virtual void MaterialMixer(Float_t *p, const Float_t *const a, const Float_t *const m, Int_t n) const final
Definition Detector.cxx:305
void ConstructGeometry() final
Definition Detector.cxx:320
void Register() override
Definition Detector.cxx:128
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:336
Detector()=default
virtual void DefineGeometry(Double_t xtof, Double_t ytof, Double_t zlenA) final
Definition Detector.cxx:337
void Reset() final
Definition Detector.cxx:133
std::vector< HitType > * getHits(int iColl) const
Definition Detector.h:91
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