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
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
233
234 protected:
236 struct TrackData { // this is transient
238 unsigned char mTrkStatusStart;
239 TLorentzVector mPositionStart;
240 TLorentzVector mMomentumStart;
241 double mEnergyLoss;
243
246
247 std::vector<int> mLayerID;
248 std::vector<TString> mLayerName;
249
251
253
257 std::vector<int> mWrapperLayerId;
258
259 std::vector<bool> mTurboLayer;
260 std::vector<double> mLayerPhi0;
261 std::vector<double> mLayerRadii;
262 std::vector<int> mStavePerLayer;
263 std::vector<int> mUnitPerStave;
264 std::vector<double> mChipThickness;
265 std::vector<double> mStaveWidth;
266 std::vector<double> mStaveTilt;
267 std::vector<double> mDetectorThickness;
268 std::vector<uint> mChipTypeID;
269 std::vector<int> mBuildLevel;
270
272 std::vector<o2::itsmft::Hit>* mHits;
273
275 TGeoVolume* createWrapperVolume(const Int_t nLay);
276
278 virtual void createMaterials();
279
282
285
288 void createMiddlBarrelServices(TGeoVolume* motherVolume);
289
292 void createOuterBarrelServices(TGeoVolume* motherVolume);
293
296 void createOuterBarrelSupports(TGeoVolume* motherVolume);
297
300 void createITSServices(TGeoVolume* motherVolume);
301
302 Detector(const Detector&);
303
304 Detector& operator=(const Detector&);
305
306 std::vector<V3Layer*> mGeometry;
308
309 std::shared_ptr<DescriptorInnerBarrel> mDescriptorIB;
310
311 template <typename Det>
312 friend class o2::base::DetImpl;
314};
315
316// Input and output function for standard C++ input/output.
317std::ostream& operator<<(std::ostream& os, Detector& source);
318
319std::istream& operator>>(std::istream& os, Detector& source);
320} // namespace its
321} // namespace o2
322
323#ifdef USESHM
324namespace o2
325{
326namespace base
327{
328template <>
329struct UseShm<o2::its::Detector> {
330 static constexpr bool value = true;
331};
332} // namespace base
333} // namespace o2
334#endif
335
336#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)
static constexpr ID ITS
Definition DetID.h:63
void createOuterBarrelSupports(TGeoVolume *motherVolume)
Double_t mWrapperZSpan[sNumberOfWrapperVolumes]
Max radius of wrapper volume.
Definition Detector.h:256
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:251
Detector & operator=(const Detector &)
Definition Detector.cxx:260
std::vector< int > mStavePerLayer
Vector of layer radii.
Definition Detector.h:262
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:745
void InitializeO2Detector() override
Initialization of the detector is done here.
Definition Detector.cxx:302
std::vector< V3Layer * > mGeometry
Definition Detector.h:306
Int_t chipVolUID(Int_t id) const
Definition Detector.h:219
virtual void createMaterials()
Create the detector materials.
Definition Detector.cxx:412
std::vector< double > mStaveWidth
Vector of chip thicknesses.
Definition Detector.h:265
Bool_t mModifyGeometry
Definition Detector.h:252
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:706
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:264
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:257
void EndOfEvent() override
Definition Detector.cxx:674
std::vector< double > mStaveTilt
Vector of stave width (only used for turbo)
Definition Detector.h:266
std::vector< int > mBuildLevel
Vector of detector type id.
Definition Detector.h:269
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:259
void constructDetectorGeometry()
Construct the detector geometry.
Definition Detector.cxx:857
void Register() override
Registers the produced collections in FAIRRootManager.
Definition Detector.cxx:676
void PreTrack() override
Definition Detector.h:227
std::vector< uint > mChipTypeID
Vector of detector thicknesses.
Definition Detector.h:268
Double_t mWrapperMinRadius[sNumberOfWrapperVolumes]
Definition Detector.h:254
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:263
void ConstructGeometry() override
Base class to create the detector geometry.
Definition Detector.cxx:848
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:67
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:260
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:245
Int_t getNumberOfLayers() const
Returns the number of layers.
Definition Detector.h:230
V3Services * mServicesGeometry
Geometry.
Definition Detector.h:307
std::vector< o2::itsmft::Hit > * mHits
Vector of Material Budget Studies.
Definition Detector.h:272
void createMiddlBarrelServices(TGeoVolume *motherVolume)
std::vector< double > mLayerRadii
Vector of layer's 1st stave phi in lab.
Definition Detector.h:261
std::vector< int > mLayerID
Number of layers (depends on inner layer version)
Definition Detector.h:247
Double_t mWrapperMaxRadius[sNumberOfWrapperVolumes]
Min radius of wrapper volume.
Definition Detector.h:255
Int_t mNumberOfDetectors
layer names
Definition Detector.h:250
std::shared_ptr< DescriptorInnerBarrel > mDescriptorIB
Services Geometry.
Definition Detector.h:309
std::vector< double > mDetectorThickness
Vector of stave tilt (only used for turbo)
Definition Detector.h:267
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:248
TGeoVolume * createWrapperVolume(const Int_t nLay)
Creates an air-filled wrapper cylindrical volume.
Definition Detector.cxx:781
void Reset() override
Has to be called after each event to reset the containers.
Definition Detector.cxx:687
GeometryTGeo * mGeometryTGeo
Definition Detector.h:232
void defineWrapperVolume(Int_t id, Double_t rmin, Double_t rmax, Double_t zspan) override
Set per wrapper volume parameters.
Definition Detector.cxx:694
void configOuterBarrelITS(int nInnerBarrelLayers, int buildLevel=0)
We need this as a method to access members.
Definition Detector.cxx:86
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
GLboolean r
Definition glcorearb.h:1233
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:236
double mEnergyLoss
momentum
Definition Detector.h:241
TLorentzVector mMomentumStart
position at entrance
Definition Detector.h:240
TLorentzVector mPositionStart
track status flag
Definition Detector.h:239
unsigned char mTrkStatusStart
hit creation started
Definition Detector.h:238