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
14
15#ifndef ALICEO2_ITS_DETECTOR_H_
16#define ALICEO2_ITS_DETECTOR_H_
17
18#include <vector> // for vector
19#include "DetectorsBase/GeometryManager.h" // for getSensID
20#include "DetectorsBase/Detector.h" // for Detector
21#include "DetectorsCommonDataFormats/DetID.h" // for Detector
22#include "ITSMFTSimulation/Hit.h" // for Hit
23#include "ITSSimulation/DescriptorInnerBarrelITS2.h" // for Description of Inner Barrel (ITS2)
24#include "Rtypes.h" // for Int_t, Double_t, Float_t, Bool_t, etc
25#include "TArrayD.h" // for TArrayD
26#include "TGeoManager.h" // for gGeoManager, TGeoManager (ptr only)
27#include "TLorentzVector.h" // for TLorentzVector
28#include "TVector3.h" // for TVector3
29
30#ifdef ENABLE_UPGRADES
31#include "ITS3Simulation/DescriptorInnerBarrelITS3.h" // for Description of Inner Barrel (ITS3)
32#endif
33
34class FairVolume;
35class TGeoVolume;
36
37class TParticle;
38
39class TString;
40
41namespace o2
42{
43namespace itsmft
44{
45class Hit;
46}
47} // namespace o2
48
49namespace o2
50{
51namespace its
52{
53class GeometryTGeo;
54}
55} // namespace o2
56namespace o2
57{
58namespace its
59{
60class V3Layer;
61}
62} // namespace o2
63
64namespace o2
65{
66namespace its
67{
68class V3Layer;
69class V3Services;
70
71class Detector : public o2::base::DetImpl<Detector>
72{
73 public:
74 static constexpr Int_t sNumberOuterLayers = 4;
75 static constexpr Int_t sNumberOfWrapperVolumes = 3;
76
80 Detector(Bool_t active, TString name = "ITS");
81
82 // Factory method
83 static o2::base::Detector* create(const char* name, bool active)
84 {
85 return new Detector(active, name);
86 }
87
89 Detector();
90
92 ~Detector() override;
93
95 void InitializeO2Detector() override;
96
98 Bool_t ProcessHits(FairVolume* v = nullptr) override;
99
101 void Register() override;
102
104 void configOuterBarrelITS(int nInnerBarrelLayers, int buildLevel = 0);
105
107 std::vector<o2::itsmft::Hit>* getHits(Int_t iColl) const
108 {
109 if (iColl == 0) {
110 return mHits;
111 }
112 return nullptr;
113 }
114
115 public:
117 void Reset() override;
118
120 void ConstructGeometry() override;
121
133 void defineLayer(Int_t nlay, Double_t phi0, Double_t r, Int_t nladd, Int_t nmod, Double_t lthick = 0.,
134 Double_t dthick = 0., UInt_t detType = 0, Int_t buildFlag = 0) override;
135
148 virtual void getLayerParameters(Int_t nlay, Double_t& phi0, Double_t& r, Int_t& nladd, Int_t& nmod, Double_t& width,
149 Double_t& tilt, Double_t& lthick, Double_t& mthick, UInt_t& dettype) const;
150
152 o2::itsmft::Hit* addHit(int trackID, int detID, const TVector3& startPos, const TVector3& endPos,
153 const TVector3& startMom, double startE, double endTime, double eLoss,
154 unsigned char startStatus, unsigned char endStatus);
155
157 void defineWrapperVolume(Int_t id, Double_t rmin, Double_t rmax, Double_t zspan) override;
158
160 void addAlignableVolumes() const override;
161
163 void fillParallelWorld() const override;
164
169 void addAlignableVolumesLayer(Int_t lr, TString& parent, Int_t& lastUID) const;
170
176 void addAlignableVolumesHalfBarrel(Int_t lr, Int_t hb, TString& parent, Int_t& lastUID) const;
177
184 void addAlignableVolumesStave(Int_t lr, Int_t hb, Int_t st, TString& parent, Int_t& lastUID) const;
185
193 void addAlignableVolumesHalfStave(Int_t lr, Int_t hb, Int_t st, Int_t hst, TString& parent, Int_t& lastUID) const;
194
203 void addAlignableVolumesModule(Int_t lr, Int_t hb, Int_t st, Int_t hst, Int_t md, TString& parent, Int_t& lastUID) const;
204
214 void addAlignableVolumesChip(Int_t lr, Int_t hb, Int_t st, Int_t hst, Int_t md, Int_t ch, TString& parent,
215 Int_t& lastUID) const;
216
219 Int_t chipVolUID(Int_t id) const { return o2::base::GeometryManager::getSensID(o2::detectors::DetID::ITS, id); }
220
221 void EndOfEvent() override;
222
223 void FinishPrimary() override { ; }
224 virtual void finishRun() { ; }
225 void BeginPrimary() override { ; }
226 void PostTrack() override { ; }
227 void PreTrack() override { ; }
228
230 Int_t getNumberOfLayers() const { return mNumberLayers; }
231
232 bool isMTSafe() const override { return true; }
233
235
236 protected:
238 struct TrackData { // this is transient
240 unsigned char mTrkStatusStart;
241 TLorentzVector mPositionStart;
242 TLorentzVector mMomentumStart;
243 double mEnergyLoss;
245
248
249 std::vector<int> mLayerID;
250 std::vector<TString> mLayerName;
251
253
255
259 std::vector<int> mWrapperLayerId;
260
261 std::vector<bool> mTurboLayer;
262 std::vector<double> mLayerPhi0;
263 std::vector<double> mLayerRadii;
264 std::vector<int> mStavePerLayer;
265 std::vector<int> mUnitPerStave;
266 std::vector<double> mChipThickness;
267 std::vector<double> mStaveWidth;
268 std::vector<double> mStaveTilt;
269 std::vector<double> mDetectorThickness;
270 std::vector<uint> mChipTypeID;
271 std::vector<int> mBuildLevel;
272
274 std::vector<o2::itsmft::Hit>* mHits;
275
277 TGeoVolume* createWrapperVolume(const Int_t nLay);
278
280 virtual void createMaterials();
281
284
287
290 void createMiddlBarrelServices(TGeoVolume* motherVolume);
291
294 void createOuterBarrelServices(TGeoVolume* motherVolume);
295
298 void createOuterBarrelSupports(TGeoVolume* motherVolume);
299
302 void createITSServices(TGeoVolume* motherVolume);
303
304 Detector(const Detector&);
305
306 Detector& operator=(const Detector&);
307
308 std::vector<V3Layer*> mGeometry;
310
311 std::shared_ptr<DescriptorInnerBarrel> mDescriptorIB;
312
313 template <typename Det>
314 friend class o2::base::DetImpl;
316};
317
318// Input and output function for standard C++ input/output.
319std::ostream& operator<<(std::ostream& os, Detector& source);
320
321std::istream& operator>>(std::istream& os, Detector& source);
322} // namespace its
323} // namespace o2
324
325#ifdef USESHM
326namespace o2
327{
328namespace base
329{
330template <>
331struct UseShm<o2::its::Detector> {
332 static constexpr bool value = true;
333};
334} // namespace base
335} // namespace o2
336#endif
337
338#endif
Definition of the Detector class.
Definition of the DescriptorInnerBarrelITS2 class.
Definition of the DescriptorInnerBarrelITS3 class.
Definition of the GeometryManager class.
Definition of the ITSMFT Hit class.
benchmark::State & st
static int getSensID(o2::detectors::DetID detid, int sensid)
void createOuterBarrelSupports(TGeoVolume *motherVolume)
Double_t mWrapperZSpan[sNumberOfWrapperVolumes]
Max radius of wrapper volume.
Definition Detector.h:258
void BeginPrimary() override
Definition Detector.h:225
void addAlignableVolumesModule(Int_t lr, Int_t hb, Int_t st, Int_t hst, Int_t md, TString &parent, Int_t &lastUID) const
struct o2::its::Detector::TrackData mTrackData
virtual void finishRun()
Definition Detector.h:224
~Detector() override
Default destructor.
Definition Detector.cxx:253
Detector & operator=(const Detector &)
Definition Detector.cxx:262
std::vector< int > mStavePerLayer
Vector of layer radii.
Definition Detector.h:264
virtual void getLayerParameters(Int_t nlay, Double_t &phi0, Double_t &r, Int_t &nladd, Int_t &nmod, Double_t &width, Double_t &tilt, Double_t &lthick, Double_t &mthick, UInt_t &dettype) const
Definition Detector.cxx:758
void InitializeO2Detector() override
Initialization of the detector is done here.
Definition Detector.cxx:304
std::vector< V3Layer * > mGeometry
Definition Detector.h:308
Int_t chipVolUID(Int_t id) const
Definition Detector.h:219
virtual void createMaterials()
Create the detector materials.
Definition Detector.cxx:424
std::vector< double > mStaveWidth
Vector of chip thicknesses.
Definition Detector.h:267
Bool_t mModifyGeometry
Definition Detector.h:254
void defineLayer(Int_t nlay, Double_t phi0, Double_t r, Int_t nladd, Int_t nmod, Double_t lthick=0., Double_t dthick=0., UInt_t detType=0, Int_t buildFlag=0) override
Definition Detector.cxx:719
void addAlignableVolumesLayer(Int_t lr, TString &parent, Int_t &lastUID) const
std::vector< double > mChipThickness
Vector of number of "units" per stave.
Definition Detector.h:266
void createITSServices(TGeoVolume *motherVolume)
ClassDefOverride(Detector, 1)
void addAlignableVolumesHalfStave(Int_t lr, Int_t hb, Int_t st, Int_t hst, TString &parent, Int_t &lastUID) const
std::vector< int > mWrapperLayerId
Z span of wrapper volume.
Definition Detector.h:259
void EndOfEvent() override
Definition Detector.cxx:687
std::vector< double > mStaveTilt
Vector of stave width (only used for turbo)
Definition Detector.h:268
std::vector< int > mBuildLevel
Vector of detector type id.
Definition Detector.h:271
o2::itsmft::Hit * addHit(int trackID, int detID, const TVector3 &startPos, const TVector3 &endPos, const TVector3 &startMom, double startE, double endTime, double eLoss, unsigned char startStatus, unsigned char endStatus)
This method is an example of how to add your own point of type Hit to the clones array.
std::vector< bool > mTurboLayer
Id of wrapper layer to which layer belongs (-1 if not wrapped)
Definition Detector.h:261
void constructDetectorGeometry()
Construct the detector geometry.
Definition Detector.cxx:870
void Register() override
Registers the produced collections in FAIRRootManager.
Definition Detector.cxx:689
void PreTrack() override
Definition Detector.h:227
std::vector< uint > mChipTypeID
Vector of detector thicknesses.
Definition Detector.h:270
Double_t mWrapperMinRadius[sNumberOfWrapperVolumes]
Definition Detector.h:256
Bool_t ProcessHits(FairVolume *v=nullptr) override
This method is called for each step during simulation (see FairMCApplication::Stepping())
Definition Detector.cxx:317
void FinishPrimary() override
Definition Detector.h:223
std::vector< int > mUnitPerStave
Vector of number of staves per layer.
Definition Detector.h:265
void ConstructGeometry() override
Base class to create the detector geometry.
Definition Detector.cxx:861
void addAlignableVolumesHalfBarrel(Int_t lr, Int_t hb, TString &parent, Int_t &lastUID) const
static constexpr Int_t sNumberOfWrapperVolumes
Number of wrapper volumes.
Definition Detector.h:75
static constexpr Int_t sNumberOuterLayers
Number of outer layers in ITSU (fixed)
Definition Detector.h:74
void addAlignableVolumes() const override
Add alignable top volumes.
std::vector< o2::itsmft::Hit > * getHits(Int_t iColl) const
Gets the produced collections.
Definition Detector.h:107
void addAlignableVolumesChip(Int_t lr, Int_t hb, Int_t st, Int_t hst, Int_t md, Int_t ch, TString &parent, Int_t &lastUID) const
Detector()
Default constructor.
Definition Detector.cxx:69
void defineSensitiveVolumes()
Define the sensitive volumes of the geometry.
void createOuterBarrelServices(TGeoVolume *motherVolume)
static o2::base::Detector * create(const char *name, bool active)
Definition Detector.h:83
std::vector< double > mLayerPhi0
True for "turbo" layers.
Definition Detector.h:262
void fillParallelWorld() const override
Add ITS chip volumes to parallel world geometry.
void PostTrack() override
Definition Detector.h:226
int mNumberLayers
Number of inner layers (depends on ITS version)
Definition Detector.h:247
Int_t getNumberOfLayers() const
Returns the number of layers.
Definition Detector.h:230
bool isMTSafe() const override
whether this detector may run in multithreaded Geant4, with one clone per worker thread
Definition Detector.h:232
V3Services * mServicesGeometry
Geometry.
Definition Detector.h:309
std::vector< o2::itsmft::Hit > * mHits
Vector of Material Budget Studies.
Definition Detector.h:274
void createMiddlBarrelServices(TGeoVolume *motherVolume)
std::vector< double > mLayerRadii
Vector of layer's 1st stave phi in lab.
Definition Detector.h:263
std::vector< int > mLayerID
Number of layers (depends on inner layer version)
Definition Detector.h:249
Double_t mWrapperMaxRadius[sNumberOfWrapperVolumes]
Min radius of wrapper volume.
Definition Detector.h:257
Int_t mNumberOfDetectors
layer names
Definition Detector.h:252
std::shared_ptr< DescriptorInnerBarrel > mDescriptorIB
Services Geometry.
Definition Detector.h:311
std::vector< double > mDetectorThickness
Vector of stave tilt (only used for turbo)
Definition Detector.h:269
void addAlignableVolumesStave(Int_t lr, Int_t hb, Int_t st, TString &parent, Int_t &lastUID) const
std::vector< TString > mLayerName
layer identifiers
Definition Detector.h:250
TGeoVolume * createWrapperVolume(const Int_t nLay)
Creates an air-filled wrapper cylindrical volume.
Definition Detector.cxx:794
void Reset() override
Has to be called after each event to reset the containers.
Definition Detector.cxx:700
GeometryTGeo * mGeometryTGeo
Definition Detector.h:234
void defineWrapperVolume(Int_t id, Double_t rmin, Double_t rmax, Double_t zspan) override
Set per wrapper volume parameters.
Definition Detector.cxx:707
void configOuterBarrelITS(int nInnerBarrelLayers, int buildLevel=0)
We need this as a method to access members.
Definition Detector.cxx:88
This class defines the Geometry for the Services of the ITS Upgrade using TGeo.
Definition V3Services.h:39
const GLdouble * v
Definition glcorearb.h:832
GLuint const GLchar * name
Definition glcorearb.h:781
GLint GLsizei width
Definition glcorearb.h:270
GLsizei GLsizei GLchar * source
Definition glcorearb.h:798
GLsizei const GLfloat * value
Definition glcorearb.h:819
std::ostream & operator<<(std::ostream &os, Detector &source)
std::istream & operator>>(std::istream &os, Detector &source)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
access to geometry details
Definition Detector.h:238
double mEnergyLoss
momentum
Definition Detector.h:243
TLorentzVector mMomentumStart
position at entrance
Definition Detector.h:242
TLorentzVector mPositionStart
track status flag
Definition Detector.h:241
unsigned char mTrkStatusStart
hit creation started
Definition Detector.h:240