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_FOCAL_DETECTOR_H_
13#define ALICEO2_FOCAL_DETECTOR_H_
14
15#include <vector>
16
18#include "FOCALBase/Hit.h"
19#include "FOCALBase/Geometry.h"
20#include "TGeoManager.h"
21
22class FairVolume;
23
24namespace o2::focal
25{
26
27class Hit;
28class Geometry;
29
33struct Parent {
34 int mPDG;
35 double mEnergy;
37};
38
54class Detector : public o2::base::DetImpl<Detector>
55{
56 public:
60 ID_G10 = 3,
65 ID_PB = 8,
66 ID_SC = 9,
69 ID_VAC = 12,
70 ID_AIR = 13 };
72 Detector() = default;
73
77 Detector(Bool_t isActive, std::string geofilename = "default");
78
80 ~Detector() override;
81
83 void InitializeO2Detector() override;
84 bool isMTSafe() const override { return true; }
85
88 Bool_t ProcessHits(FairVolume* v = nullptr) final;
89
102 Hit* AddHit(int trackID, int primary, double initialEnergy, int detID, o2::focal::Hit::Subsystem_t subsystem,
103 const math_utils::Point3D<float>& pos, double time, double energyloss);
104
106 void Register() override;
107
110 std::vector<Hit>* getHits(Int_t iColl) const
111 {
112 if (iColl == 0) {
113 return mHits;
114 }
115 return nullptr;
116 }
117
119 void Reset() final;
120
124 void EndOfEvent() final;
125
130 void BeginPrimary() override;
131
135 void FinishPrimary() override;
136
141 Geometry* getGeometry(std::string name = "");
142
148 Hit* FindHit(int parentID, int col, int row, int layer);
149
150 protected:
152 void CreateMaterials();
153
154 virtual void addAlignableVolumes() const override;
155 void addAlignableVolumesHCAL() const;
156 void addAlignableVolumesECAL() const;
157
158 void ConstructGeometry() override;
159
160 virtual void CreateHCALSpaghetti();
161 virtual void CreateHCALSandwich();
162 virtual void CreateHCALSheets();
163
164 TGeoVolumeAssembly* CreatePitchAssembly(double Lx = 498.1,
165 double Ly1 = 2.0,
166 double Ly2 = 1.5,
167 double Lz = 1100.0,
168 double hole_diameter = 1.1,
169 double hole_spacing = 4.0,
170 int nholes = 124,
171 double fiber_radius = 0.5,
172 std::string suffix = "");
173
175 void CreateECALGeometry();
176
181 Parent* AddSuperparent(int trackID, int pdg, double energy);
182
185 bool ProcessHitsEPad(FairVolume* v = nullptr);
186
189 bool ProcessHitsEPix(FairVolume* v = nullptr);
190
193 bool ProcessHitsHCAL(FairVolume* v = nullptr);
194
195 private:
197 Detector(const Detector& rhs);
198
199 Geometry* mGeometry;
200
201 int mMedSensHCal = 0;
202 int mMedSensECalPad = 0;
203 int mMedSensECalPix = 0;
204
205 std::vector<const Composition*> mGeoCompositions;
206
207 std::vector<o2::focal::Hit>* mHits;
208 std::unordered_map<Hit::HitID, unsigned int, Hit::HitIDHasher> mHitIndexMapping;
209
210 std::unordered_map<int, int> mSuperParentsIndices;
211 std::unordered_map<int, Parent> mSuperParents;
212 Parent* mCurrentSuperparent;
213
214 // Worker variables during hit creation
215 Int_t mCurrentTrack;
216 Int_t mCurrentPrimaryID;
217 Int_t mCurrentParentID;
218
219 std::vector<std::string> mSensitive;
220 int mVolumeIDScintillator = -1;
221
222 template <typename Det>
223 friend class o2::base::DetImpl;
224 ClassDefOverride(Detector, 1);
225};
226} // namespace o2::focal
227
228#ifdef USESHM
229namespace o2
230{
231namespace base
232{
233template <>
234struct UseShm<o2::focal::Detector> {
235 static constexpr bool value = true;
236};
237} // namespace base
238} // namespace o2
239#endif
240
241#endif // ALICEO2_FOCAL_DETECTOR_H_
Definition of the Detector class.
int16_t time
Definition RawEventData.h:4
#define protected
uint16_t pos
Definition RawData.h:3
uint32_t col
Definition RawData.h:4
FOCAL detector simulation.
Definition Detector.h:55
bool ProcessHitsEPad(FairVolume *v=nullptr)
Processing hit creation in the ECAL Pad sensitive volume.
TGeoVolumeAssembly * CreatePitchAssembly(double Lx=498.1, double Ly1=2.0, double Ly2=1.5, double Lz=1100.0, double hole_diameter=1.1, double hole_spacing=4.0, int nholes=124, double fiber_radius=0.5, std::string suffix="")
Definition Detector.cxx:702
void addAlignableVolumesHCAL() const
Definition Detector.cxx:412
~Detector() override
Destructor.
Definition Detector.cxx:70
void InitializeO2Detector() override
Initializing detector.
Definition Detector.cxx:86
bool ProcessHitsHCAL(FairVolume *v=nullptr)
Processing hit creation in the HCAL sensitive volume.
std::vector< Hit > * getHits(Int_t iColl) const
Get access to the hits.
Definition Detector.h:110
virtual void CreateHCALSandwich()
Definition Detector.cxx:915
bool isMTSafe() const override
whether this detector may run in multithreaded Geant4, with one clone per worker thread
Definition Detector.h:84
void Register() override
register container with hits
Definition Detector.cxx:202
virtual void CreateHCALSheets()
Definition Detector.cxx:836
Hit * AddHit(int trackID, int primary, double initialEnergy, int detID, o2::focal::Hit::Subsystem_t subsystem, const math_utils::Point3D< float > &pos, double time, double energyloss)
Add FOCAL hit.
Definition Detector.cxx:168
void FinishPrimary() override
Finish current primary.
virtual void CreateHCALSpaghetti()
Definition Detector.cxx:509
void ConstructGeometry() override
Definition Detector.cxx:433
Detector(Bool_t isActive, std::string geofilename="default")
Main constructor.
void addAlignableVolumesECAL() const
Definition Detector.cxx:423
bool ProcessHitsEPix(FairVolume *v=nullptr)
Processing hit creation in the ECAL Pixel sensitive volume.
virtual void addAlignableVolumes() const override
declare alignable volumes of detector
Definition Detector.cxx:400
void CreateMaterials()
Creating detector materials for the FOCAL detector.
Definition Detector.cxx:221
Hit * FindHit(int parentID, int col, int row, int layer)
Try to find hit with same cell and parent track ID.
Definition Detector.cxx:181
Bool_t ProcessHits(FairVolume *v=nullptr) final
Processing hit creation in the FOCAL sensitive volume.
Definition Detector.cxx:113
void EndOfEvent() final
Steps to be carried out at the end of the event.
Definition Detector.cxx:200
void BeginPrimary() override
Begin primaray.
void CreateECALGeometry()
Generate ECAL geometry.
Detector()=default
Dummy constructor.
Parent * AddSuperparent(int trackID, int pdg, double energy)
Add new superparent to the container.
Definition Detector.cxx:193
void Reset() final
Clean point collection.
Definition Detector.cxx:207
Geometry * getGeometry(std::string name="")
Get the FOCAL geometry desciption.
Definition Detector.cxx:75
friend class o2::base::DetImpl
Definition Detector.h:223
Common FOCAL hit class for the detector simulation.
Definition Hit.h:28
const GLdouble * v
Definition glcorearb.h:832
GLuint const GLchar * name
Definition glcorearb.h:781
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Information about superparent (particle entering any FOCAL volume)
Definition Detector.h:33
double mEnergy
Total energy.
Definition Detector.h:35
bool mHasTrackReference
Flag indicating whether parent has a track reference.
Definition Detector.h:36
int mPDG
PDG code.
Definition Detector.h:34
std::vector< int > row