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
77 Bool_t ProcessHits(FairVolume* v = nullptr) final;
78
91 Hit* AddHit(Int_t trackID, Int_t primary, Double_t initialEnergy, Int_t detID,
92 const math_utils::Point3D<float>& pos, const math_utils::Vector3D<float>& mom, Double_t time, Double_t energyloss);
93
94 Parent* AddSuperparent(Int_t trackID, Int_t pdg, Double_t energy);
95
97 void Register() override;
98
101 std::vector<Hit>* getHits(Int_t iColl) const
102 {
103 if (iColl == 0) {
104 return mHits;
105 }
106 return nullptr;
107 }
108
110 void Reset() final;
111
115 void EndOfEvent() final;
116
122
127 void BeginPrimary() override;
128
132 void FinishPrimary() override;
133
134 protected:
136 void CreateMaterials();
137
138 void ConstructGeometry() override;
139
141 void CreateEmcalEnvelope();
142
145
147 void CreateSupermoduleGeometry(const std::string_view mother = "XEN1");
148
150 void CreateEmcalModuleGeometry(const std::string_view mother = "SMOD", const std::string_view child = "EMOD");
151
153 void CreateAlFrontPlate(const std::string_view mother = "EMOD", const std::string_view child = "ALFP");
154
168 int CreateEMCALVolume(const std::string_view name, const std::string_view shape, MediumType_t mediumID, Double_t* shapeParams, Int_t nparams);
169
175 Double_t CalculateLightYield(Double_t energydeposit, Double_t tracklength, Int_t charge) const;
176
180 Hit* FindHit(Int_t cellID, Int_t parentID);
181
182 private:
184 Detector(const Detector& rhs);
185
186 Int_t mBirkC0;
187 Double_t mBirkC1;
188 Double_t mBirkC2;
189
190 std::vector<std::string> mSensitive;
191 std::unordered_map<int, EMCALSMType> mSMVolumeID;
192 std::unordered_map<std::string, EMCALSMType> mSMVolNames;
193 Int_t mVolumeIDScintillator;
194 std::vector<Hit>* mHits;
195 Geometry* mGeometry;
196 std::unordered_map<int, int> mSuperParentsIndices;
197 std::unordered_map<int, Parent> mSuperParents;
198 Parent* mCurrentSuperparent;
199
200 // Worker variables during hit creation
201 Int_t mCurrentTrack;
202 Int_t mCurrentPrimaryID;
203 Int_t mCurrentParentID;
204
205 Double_t mSampleWidth;
206 Double_t mSmodPar0;
207 Double_t mSmodPar1;
208 Double_t mSmodPar2;
209 Double_t mInnerEdge;
210 Double_t mDCALInnerGap;
211 Double_t mParEMOD[5];
212
213 template <typename Det>
214 friend class o2::base::DetImpl;
215 ClassDefOverride(Detector, 1);
216};
217} // namespace emcal
218} // namespace o2
219
220#ifdef USESHM
221namespace o2
222{
223namespace base
224{
225template <>
226struct UseShm<o2::emcal::Detector> {
227 static constexpr bool value = true;
228};
229} // namespace base
230} // namespace o2
231#endif
232
233#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:112
void InitializeO2Detector() override
Initializing detector.
Definition Detector.cxx:117
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:101
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:143
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:170
void EndOfEvent() final
Steps to be carried out at the end of the event.
Definition Detector.cxx:141
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:214
EMCAL geometry definition.
Definition Geometry.h:40
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 ...
Defining DataPointCompositeObject explicitly as copiable.
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