Skip to content

Commit 869ceeb

Browse files
mfasDasawenzel
authored andcommitted
[FOCAL-66, FOCAL-67, FOCAL-68] Skeleton for FOCAL detector simulation
- Basic detector class - Incoming particle handling from EMCAL - Material definition from AliFOCAL package - New FOCALsimulation library
1 parent bdf72dd commit 869ceeb

5 files changed

Lines changed: 467 additions & 0 deletions

File tree

Detectors/FOCAL/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
add_subdirectory(base)
1313
add_subdirectory(calib)
1414
add_subdirectory(calibration)
15+
add_subdirectory(simulation)
1516
add_subdirectory(reconstruction)
1617
add_subdirectory(workflow)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
o2_add_library(FOCALSimulation
13+
SOURCES src/Detector.cxx
14+
PUBLIC_LINK_LIBRARIES ROOT::TreePlayer O2::FOCALBase O2::DetectorsBase O2::SimConfig O2::SimulationDataFormat O2::Headers O2::DataFormatsFOCAL
15+
AliceO2::InfoLogger
16+
Microsoft.GSL::GSL)
17+
18+
o2_target_root_dictionary(
19+
FOCALSimulation
20+
HEADERS include/FOCALSimulation/Detector.h
21+
)
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
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_FOCAL_DETECTOR_H_
13+
#define ALICEO2_FOCAL_DETECTOR_H_
14+
15+
#include <vector>
16+
17+
#include "DetectorsBase/Detector.h"
18+
#include "FOCALBase/Hit.h"
19+
20+
class FairVolume;
21+
22+
namespace o2::focal
23+
{
24+
25+
/// \struct Parent
26+
/// \brief Information about superparent (particle entering any FOCAL volume)
27+
/// \ingroup FOCALsimulation
28+
struct Parent {
29+
int mPDG; ///< PDG code
30+
double mEnergy; ///< Total energy
31+
bool mHasTrackReference; ///< Flag indicating whether parent has a track reference
32+
};
33+
34+
/// \class Detector
35+
/// \brief FOCAL detector simulation
36+
/// \ingroup FOCALsimulation
37+
/// \author Markus Fasel <markus.fasel@cern.ch>, Oak Ridge National Laboratory
38+
/// \since June 6, 2024
39+
class Detector : public o2::base::DetImpl<Detector>
40+
{
41+
public:
42+
enum MediumType_t { ID_TUNGSTEN = 0,
43+
ID_SILICON = 1,
44+
ID_G10 = 2,
45+
ID_COPPER = 3,
46+
ID_STEEL = 4,
47+
ID_ALLOY = 5,
48+
ID_CERAMIC = 6,
49+
ID_PB = 7,
50+
ID_SC = 8,
51+
ID_SIINSENS = 9,
52+
ID_VAC = 10,
53+
ID_AIR = 11 };
54+
/// \brief Dummy constructor
55+
Detector() = default;
56+
57+
/// \brief Destructor
58+
~Detector() override;
59+
60+
/// \brief Initializing detector
61+
void InitializeO2Detector() override;
62+
63+
/// \brief Processing hit creation in the FOCAL sensitive volume
64+
/// \param v Current sensitive volume
65+
Bool_t ProcessHits(FairVolume* v = nullptr) final;
66+
67+
/// \brief register container with hits
68+
void Register() override;
69+
70+
/// \brief Get access to the hits
71+
/// \return Hit collection
72+
std::vector<Hit>* getHits(Int_t iColl) const
73+
{
74+
if (iColl == 0) {
75+
return mHits;
76+
}
77+
return nullptr;
78+
}
79+
80+
/// \brief Clean point collection
81+
void Reset() final;
82+
83+
/// \brief Steps to be carried out at the end of the event
84+
///
85+
/// For FOCAL cleaning the hit collection and the lookup table
86+
void EndOfEvent() final;
87+
88+
/// \brief Begin primaray
89+
///
90+
/// Caching current primary ID and set current parent ID to the
91+
/// current primary ID
92+
void BeginPrimary() override;
93+
94+
/// \brief Finish current primary
95+
///
96+
/// Reset caches for current primary, current parent and current cell
97+
void FinishPrimary() override;
98+
99+
protected:
100+
/// \brief Creating detector materials for the FOCAL detector
101+
void CreateMaterials();
102+
103+
void ConstructGeometry() override;
104+
105+
/// \brief Add new superparent to the container
106+
/// \param trackID Track ID of the superparent
107+
/// \param pdg PDG code of the superparent
108+
/// \param energy Energy of the superparent
109+
Parent* AddSuperparent(int trackID, int pdg, double energy);
110+
111+
private:
112+
/// \brief Copy constructor (used in MT)
113+
Detector(const Detector& rhs);
114+
115+
std::vector<o2::focal::Hit>* mHits; ///< Container with hits
116+
117+
std::unordered_map<int, int> mSuperParentsIndices; //!<! Super parent indices (track index - superparent index)
118+
std::unordered_map<int, Parent> mSuperParents; //!<! Super parent kine info (superparent index - superparent object)
119+
Parent* mCurrentSuperparent; //!<! Pointer to the current superparent
120+
121+
// Worker variables during hit creation
122+
Int_t mCurrentTrack; //!<! Current track
123+
Int_t mCurrentPrimaryID; //!<! ID of the current primary
124+
Int_t mCurrentParentID; //!<! ID of the current parent
125+
126+
template <typename Det>
127+
friend class o2::base::DetImpl;
128+
ClassDefOverride(Detector, 1);
129+
};
130+
} // namespace o2::focal
131+
132+
#ifdef USESHM
133+
namespace o2
134+
{
135+
namespace base
136+
{
137+
template <>
138+
struct UseShm<o2::focal::Detector> {
139+
static constexpr bool value = true;
140+
};
141+
} // namespace base
142+
} // namespace o2
143+
#endif
144+
145+
#endif // ALICEO2_FOCAL_DETECTOR_H_

0 commit comments

Comments
 (0)