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_TRD_DETECTOR_H_
13#define ALICEO2_TRD_DETECTOR_H_
14
15#include <vector>
19
20#include "DataFormatsTRD/Hit.h"
21
22class FairVolume;
23
24namespace o2
25{
26namespace trd
27{
28
29class Geometry;
30class TRsim;
31
32class Detector : public o2::base::DetImpl<Detector>
33{
34 public:
35 Detector(Bool_t active = true);
36 ~Detector() override;
37 void InitializeO2Detector() override;
38 bool ProcessHits(FairVolume* v = nullptr) override;
39 void Register() override;
40 std::vector<Hit>* getHits(int iColl) const
41 {
42 if (iColl == 0) {
43 return mHits;
44 }
45 return nullptr;
46 }
47 void FinishEvent() override;
48 void Reset() override;
49 void EndOfEvent() override;
50 void createMaterials();
51 void ConstructGeometry() override;
53 void addAlignableVolumes() const override;
54
55 private:
57 Detector(const Detector& rhs);
58
59 void InitializeParams();
60
61 // defines/sets-up the sensitive volumes
62 void defineSensitiveVolumes();
63
64 // Fills the volume-id lookup tables below; called once from InitializeO2Detector().
65 void buildVolumeIdTables();
66
67 // What a sensitive volume is, in mRegionByVolId
68 enum Region : int8_t { kNotSensitive = 0,
69 kDrift = 1,
70 kAmplification = 2 };
71
72 // addHit
73 template <typename T>
74 void addHit(T x, T y, T z, T locC, T locR, T locT, T tof, int charge, int trackId, int detId, bool drift = false);
75
76 // Create TR hits
77 void createTRhit(int);
78
79 std::vector<Hit>* mHits = nullptr;
80
81 float mFoilDensity;
82 float mGasNobleFraction;
83 float mGasDensity;
84
85 float mMaxMCStepDef;
86
87 bool mTRon; // Switch for TR simulation
88 TRsim* mTR; // Access to TR simulation
89
90 float mWion; // Ionization potential
91
92 Geometry* mGeom = nullptr;
93
94 // Volume-id lookup tables, resolved once at initialisation so that ProcessHits does
95 // integer indexing instead of an sscanf on a volume name at every step. Volume ids are
96 // small and dense, so a flat vector beats a map here.
97 std::vector<int8_t> mRegionByVolId;
98 std::vector<int8_t> mChamberByVolId;
99 std::vector<int8_t> mSectorByVolId;
100
101 // How far above a sensitive volume the chamber and the supermodule sit. This depends on
102 // how the transport engine represents the hierarchy -- a native-Geant4 conversion flattens
103 // the chamber assembly away -- so it is resolved from the tables on the first hit rather
104 // than hard-coded.
105 int mChamberOffset = -1;
106 int mSectorOffset = -1;
107
108 template <typename Det>
109 friend class o2::base::DetImpl;
110 ClassDefOverride(Detector, 1);
111};
112
113template <typename T>
114void Detector::addHit(T x, T y, T z, T locC, T locR, T locT, T tof, int charge, int trackId, int detId, bool drift)
115{
116 mHits->emplace_back(x, y, z, locC, locR, locT, tof, charge, trackId, detId, drift);
117}
118
119} // namespace trd
120} // namespace o2
121
122#ifdef USESHM
123namespace o2
124{
125namespace base
126{
127template <>
128struct UseShm<o2::trd::Detector> {
129 static constexpr bool value = true;
130};
131} // namespace base
132} // namespace o2
133#endif
134#endif
Definition of the Detector class.
int16_t charge
Definition RawEventData.h:5
Detector()
Default Constructor.
Definition Detector.cxx:36
~Detector() override
Definition Detector.cxx:53
void InitializeO2Detector() override
Definition Detector.cxx:58
void EndOfEvent() override
Definition Detector.cxx:340
void Register() override
Definition Detector.cxx:317
void ConstructGeometry() override
Definition Detector.cxx:542
void addAlignableVolumes() const override
Add alignable top volumes.
Definition Detector.cxx:568
bool ProcessHits(FairVolume *v=nullptr) override
Definition Detector.cxx:117
void Reset() override
Definition Detector.cxx:333
std::vector< Hit > * getHits(int iColl) const
Definition Detector.h:40
void FinishEvent() override
Definition Detector.cxx:322
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...