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