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_EMCAL_DETECTOR_H_
13#define ALICEO2_EMCAL_DETECTOR_H_
14
16#include "EMCALBase/Hit.h"
18#include "MathUtils/Cartesian.h"
19#include "RStringView.h"
20#include "Rtypes.h"
21#include <vector>
22#include <unordered_map>
23
24class FairVolume;
25class TClonesArray;
26class TH2;
27
28namespace o2
29{
30namespace emcal
31{
32class Hit;
33class Geometry;
34
38struct Parent {
39 int mPDG;
40 double mEnergy;
42};
43
51class Detector : public o2::base::DetImpl<Detector>
52{
53 public:
54 enum MediumType_t { ID_AIR = 0,
55 ID_PB = 1,
56 ID_SC = 2,
57 ID_AL = 3,
59 ID_PAPER = 5 };
60
62 Detector() = default;
63
67 Detector(Bool_t isActive);
68
70 ~Detector() override;
71
73 void InitializeO2Detector() override;
74 bool isMTSafe() const override { return true; }
75
78 Bool_t ProcessHits(FairVolume* v = nullptr) final;
79
92 Hit* AddHit(Int_t trackID, Int_t primary, Double_t initialEnergy, Int_t detID,
93 const math_utils::Point3D<float>& pos, const math_utils::Vector3D<float>& mom, Double_t time, Double_t energyloss);
94
95 Parent* AddSuperparent(Int_t trackID, Int_t pdg, Double_t energy);
96
98 void Register() override;
99
102 std::vector<Hit>* getHits(Int_t iColl) const
103 {
104 if (iColl == 0) {
105 return mHits;
106 }
107 return nullptr;
108 }
109
111 void Reset() final;
112
116 void EndOfEvent() final;
117
123
128 void BeginPrimary() override;
129
133 void FinishPrimary() override;
134
135 protected:
137 void CreateMaterials();
138
139 void ConstructGeometry() override;
140
142 void CreateEmcalEnvelope();
143
146
148 void CreateSupermoduleGeometry(const std::string_view mother = "XEN1");
149
151 void CreateEmcalModuleGeometry(const std::string_view mother = "SMOD", const std::string_view child = "EMOD");
152
154 void CreateAlFrontPlate(const std::string_view mother = "EMOD", const std::string_view child = "ALFP");
155
169 int CreateEMCALVolume(const std::string_view name, const std::string_view shape, MediumType_t mediumID, Double_t* shapeParams, Int_t nparams);
170
176 Double_t CalculateLightYield(Double_t energydeposit, Double_t tracklength, Int_t charge) const;
177
181 Hit* FindHit(Int_t cellID, Int_t parentID);
182
183 private:
185 Detector(const Detector& rhs);
186
187 Int_t mBirkC0;
188 Double_t mBirkC1;
189 Double_t mBirkC2;
190
191 std::vector<std::string> mSensitive;
192 std::unordered_map<int, EMCALSMType> mSMVolumeID;
193 std::unordered_map<std::string, EMCALSMType> mSMVolNames;
194 Int_t mVolumeIDScintillator;
195 std::vector<Hit>* mHits;
196 Geometry* mGeometry;
197 std::unordered_map<int, int> mSuperParentsIndices;
198 std::unordered_map<int, Parent> mSuperParents;
199 Parent* mCurrentSuperparent;
200
201 // Worker variables during hit creation
202 Int_t mCurrentTrack;
203 Int_t mCurrentPrimaryID;
204 Int_t mCurrentParentID;
205
206 Double_t mSampleWidth;
207 Double_t mSmodPar0;
208 Double_t mSmodPar1;
209 Double_t mSmodPar2;
210 Double_t mInnerEdge;
211 Double_t mDCALInnerGap;
212 Double_t mParEMOD[5];
213
214 template <typename Det>
215 friend class o2::base::DetImpl;
216 ClassDefOverride(Detector, 1);
217};
218} // namespace emcal
219} // namespace o2
220
221#ifdef USESHM
222namespace o2
223{
224namespace base
225{
226template <>
227struct UseShm<o2::emcal::Detector> {
228 static constexpr bool value = true;
229};
230} // namespace base
231} // namespace o2
232#endif
233
234#endif
Definition of the Detector class.
int16_t charge
Definition RawEventData.h:5
int16_t time
Definition RawEventData.h:4
#define protected
uint16_t pos
Definition RawData.h:3
Detector simulation class for the EMCAL detector.
Definition Detector.h:52
Hit * AddHit(Int_t trackID, Int_t primary, Double_t initialEnergy, Int_t detID, const math_utils::Point3D< float > &pos, const math_utils::Vector3D< float > &mom, Double_t time, Double_t energyloss)
Add EMCAL hit.
Definition Detector.cxx:322
void CreateEmcalModuleGeometry(const std::string_view mother="SMOD", const std::string_view child="EMOD")
Generate module geometry (2x2 towers)
Definition Detector.cxx:887
Double_t CalculateLightYield(Double_t energydeposit, Double_t tracklength, Int_t charge) const
Calculate the amount of light seen by the APD for a given track segment (charged particles only) acco...
Definition Detector.cxx:339
Parent * AddSuperparent(Int_t trackID, Int_t pdg, Double_t energy)
Definition Detector.cxx:332
Hit * FindHit(Int_t cellID, Int_t parentID)
Try to find hit with same cell and parent track ID.
void CreateSupermoduleGeometry(const std::string_view mother="XEN1")
Generate super module geometry.
Definition Detector.cxx:718
~Detector() override
Destructor.
Definition Detector.cxx:111
bool isMTSafe() const override
whether this detector may run in multithreaded Geant4, with one clone per worker thread
Definition Detector.h:74
void InitializeO2Detector() override
Initializing detector.
Definition Detector.cxx:116
int CreateEMCALVolume(const std::string_view name, const std::string_view shape, MediumType_t mediumID, Double_t *shapeParams, Int_t nparams)
Create new EMCAL volume and add it to the list of sensitive volumes.
Geometry * GetGeometry()
Get the EMCAL geometry desciption.
Definition Detector.cxx:391
Detector()=default
Default constructor.
std::vector< Hit > * getHits(Int_t iColl) const
Get access to the hits.
Definition Detector.h:102
void CreateEmcalEnvelope()
Generate EMCAL envelop (mother volume of all supermodules)
Definition Detector.cxx:402
void Register() override
register container with hits
Definition Detector.cxx:374
void FinishPrimary() override
Finish current primary.
void ConstructGeometry() override
Definition Detector.cxx:142
void CreateMaterials()
Creating detector materials for the EMCAL detector and space frame.
Definition Detector.cxx:635
Bool_t ProcessHits(FairVolume *v=nullptr) final
Processing hit creation in the EMCAL scintillator volume.
Definition Detector.cxx:169
void EndOfEvent() final
Steps to be carried out at the end of the event.
Definition Detector.cxx:140
void BeginPrimary() override
Begin primaray.
void Reset() final
Clean point collection.
Definition Detector.cxx:379
void CreateShiskebabGeometry()
Generate tower geometry.
Definition Detector.cxx:454
void CreateAlFrontPlate(const std::string_view mother="EMOD", const std::string_view child="ALFP")
Generate aluminium plates geometry.
Definition Detector.cxx:984
friend class o2::base::DetImpl
Definition Detector.h:215
EMCAL geometry definition.
Definition Geometry.h:42
EMCAL simulation hit information.
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
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Information about superparent (particle entering EMCAL)
Definition Detector.h:38
double mEnergy
Total energy.
Definition Detector.h:40
int mPDG
PDG code.
Definition Detector.h:39
bool mHasTrackReference
Flag indicating whether parent has a track reference.
Definition Detector.h:41