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_TRK_DETECTOR_H
13#define ALICEO2_TRK_DETECTOR_H
14
16#include "TRKSimulation/Hit.h"
17
22
23#include <TLorentzVector.h>
24#include <TString.h>
25
26namespace o2
27{
28namespace trk
29{
30
31class Detector : public o2::base::DetImpl<Detector>
32{
33 public:
34 Detector(bool active);
38
39 // Factory method
41 {
42 return new Detector(active);
43 }
44
45 void ConstructGeometry() override;
46
47 o2::trk::Hit* addHit(int trackID, unsigned short detID, const TVector3& startPos, const TVector3& endPos,
48 const TVector3& startMom, double startE, double endTime, double eLoss,
49 unsigned char startStatus, unsigned char endStatus);
50
51 // Mandatory overrides
52 void BeginPrimary() override { ; }
53 void FinishPrimary() override { ; }
54 void InitializeO2Detector() override;
55 void PostTrack() override { ; }
56 void PreTrack() override { ; }
57 bool ProcessHits(FairVolume* v = nullptr) override;
58 void EndOfEvent() override;
59 void Register() override;
60 void Reset() override;
61
62 // Custom member functions
63 std::vector<o2::trk::Hit>* getHits(int iColl) const
64 {
65 if (!iColl) {
66 return mHits;
67 }
68 return nullptr;
69 }
70
71 void configMLOT();
72 void configFT3ScopingV3();
73 void configFromFile(std::string fileName = "alice3_TRK_layout.txt");
74 void configToFile(std::string fileName = "alice3_TRK_layout.txt");
75
76 void configServices(); // To get special conf from CLI options
78 void createGeometry();
79
80 static constexpr int kForward = 0;
81 static constexpr int kBackward = 1;
82
83 private:
84 int mNumberOfVolumes;
85 int mNumberOfVolumesVD;
86
87 // Transient data about track passing the sensor
88 struct TrackData {
89 bool mHitStarted; // hit creation started
90 unsigned char mTrkStatusStart; // track status flag
91 TLorentzVector mPositionStart; // position at entrance
92 TLorentzVector mMomentumStart; // momentum
93 double mEnergyLoss; // energy loss
94 } mTrackData;
95 GeometryTGeo* mGeometryTGeo;
96 std::vector<o2::trk::Hit>* mHits; // Derived from ITSMFT
97 std::vector<std::unique_ptr<TRKCylindricalLayer>> mLayers;
98 TRKServices mServices; // Houses the services of the TRK, but not the Iris tracker
99
100 std::vector<std::string> mFirstOrLastLayers; // Names of the first or last layers
101 bool InsideFirstOrLastLayer(std::string layerName);
102
103 void defineSensitiveVolumes();
104
105 protected:
106 std::array<std::vector<TString>, 2> mFT3LayerName; // Two sets of layer (disc) names, one per direction (forward/backward)
107 std::vector<int> mSensorID;
108 std::vector<TString> mSensorName;
109 std::array<std::vector<FT3Layer>, 2> mFT3Layers; // Two sets of layers (discs), one per direction (forward/backward)
110
111 public:
112 static constexpr Int_t sNumberVDPetalCases = 4;
113 int getNumberOfLayers() const { return mLayers.size(); }
115 {
116 if (mFT3LayerName[kBackward].size() != mFT3LayerName[kForward].size()) {
117 LOG(fatal) << "Number of layers in the two directions are different! Returning 0.";
118 }
119 return mFT3LayerName[kBackward].size();
120 }
121
122 void Print(FairVolume* vol, int volume, int subDetID, int layer, int stave, int halfstave, int mod, int chip, int chipID) const;
123
124 template <typename Det>
125 friend class o2::base::DetImpl;
127};
128} // namespace trk
129} // namespace o2
130
131#ifdef USESHM
132namespace o2
133{
134namespace base
135{
136template <>
137struct UseShm<o2::trk::Detector> {
138 static constexpr bool value = true;
139};
140} // namespace base
141} // namespace o2
142#endif
143#endif
Definition of the Detector class.
Definition of the TRK Hit class.
Definition of the FT3Layer class.
Detector()
Default Constructor.
Definition Detector.cxx:36
void Reset() override
void Register() override
void ConstructGeometry() override
void BeginPrimary() override
Definition Detector.h:52
void InitializeO2Detector() override
std::vector< o2::trk::Hit > * getHits(int iColl) const
Definition Detector.h:63
void FinishPrimary() override
Definition Detector.h:53
static constexpr Int_t sNumberVDPetalCases
Definition Detector.h:112
void PostTrack() override
Definition Detector.h:55
std::array< std::vector< FT3Layer >, 2 > mFT3Layers
layer names
Definition Detector.h:109
void EndOfEvent() override
static o2::base::Detector * create(bool active)
Definition Detector.h:40
void PreTrack() override
Definition Detector.h:56
std::array< std::vector< TString >, 2 > mFT3LayerName
Definition Detector.h:106
int getNumberOfLayers() const
Number of VD petals.
Definition Detector.h:113
o2::trk::Hit * addHit(int trackID, unsigned short detID, const TVector3 &startPos, const TVector3 &endPos, const TVector3 &startMom, double startE, double endTime, double eLoss, unsigned char startStatus, unsigned char endStatus)
Definition Detector.cxx:746
static constexpr int kForward
Definition Detector.h:80
Detector(const Detector &other)
bool ProcessHits(FairVolume *v=nullptr) override
int getNumberOfFT3Layers() const
Number of TRK layers.
Definition Detector.h:114
std::vector< int > mSensorID
Definition Detector.h:107
std::vector< TString > mSensorName
layer identifiers
Definition Detector.h:108
ClassDefOverride(Detector, 2)
static constexpr int kBackward
Definition Detector.h:81
GLsizeiptr size
Definition glcorearb.h:659
const GLdouble * v
Definition glcorearb.h:832
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 ...
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"