Skip to content

Commit fc43839

Browse files
mfasDasawenzel
authored andcommitted
Implement first version of EMCAL hit creation (#523)
- Bug fix (temporary) in Shishkebab geometry - Small fix in EMCAL geometry - Remove unused variable (shut) in Hit - Fix z-coordinate of Hit - Fix add function for hit: All hits from the same track are added to 1 hit. For this a lookup table is used to map the hits - Handle calculation of the module ID: Module ID needs to be obtained from the copy number of the volume and the volume ID over various levels in the geometry tree - Process Hits add currently hits once a volume is passed
1 parent 852262b commit fc43839

10 files changed

Lines changed: 891 additions & 764 deletions

File tree

Detectors/EMCAL/base/include/EMCALBase/Geometry.h

Lines changed: 24 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
#include <vector>
1818

1919
#include <RStringView.h>
20-
#include <TArrayD.h>
2120
#include <TGeoMatrix.h>
22-
#include <TList.h>
2321
#include <TNamed.h>
2422
#include <TParticle.h>
2523
#include <TVector3.h>
@@ -154,7 +152,7 @@ class Geometry
154152
/// \param[out] absId absolute ID number
155153
/// \param[out] vimpact TVector3 of impact coordinates?
156154
///
157-
void ImpactOnEmcal(TVector3 vtx, Double_t theta, Double_t phi, Int_t& absId, TVector3& vimpact) const;
155+
void ImpactOnEmcal(const Point3D<double> &vtx, Double_t theta, Double_t phi, Int_t& absId, Point3D<double>& vimpact) const;
158156

159157
///
160158
/// Checks whether point is inside the EMCal volume
@@ -238,10 +236,10 @@ class Geometry
238236
Double_t GetPhiCenterOfSMSec(Int_t nsupmod) const;
239237
Float_t GetSuperModulesPar(Int_t ipar) const { return mParSM[ipar]; }
240238
//
241-
Int_t GetSMType(Int_t nSupMod) const
239+
EMCALSMType GetSMType(Int_t nSupMod) const
242240
{
243241
if (nSupMod > mNumberOfSuperModules)
244-
return -1;
242+
return NOT_EXISTENT;
245243
return mEMCSMSystem[nSupMod];
246244
}
247245

@@ -458,94 +456,48 @@ class Geometry
458456
/// \return cell absolute ID number
459457
Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const;
460458

461-
///
462-
/// Online mapping and numbering is the same for EMCal and DCal SMs but:
463-
/// - DCal odd SM (13,15,17) has online cols: 16-47; offline cols 0-31.
464-
/// - Even DCal SMs have the same numbering online and offline 0-31.
465-
/// - DCal 1/3 SM (18,19), online rows 16-23; offline rows 0-7
466-
///
467-
/// Here shift the online cols or rows depending on the
468-
/// super-module number to match the offline mapping.
469-
///
470-
/// \param sm: super module number of the channel/cell
471-
/// \param iphi: row/phi cell index, modified for DCal
472-
/// \param ieta: column/eta index, modified for DCal
473-
///
474-
void ShiftOnlineToOfflineCellIndexes(Int_t sm, Int_t& iphi, Int_t& ieta) const;
475-
476-
///
477-
/// Here shift the DCal online cols or rows depending on the
478-
/// super-module number to match the online mapping.
479-
///
480-
/// Reverse procedure to the one in the method above
481-
/// ShiftOnlineToOfflineCellIndexes().
482-
///
483-
/// \param sm super module number of the channel/cell
484-
/// \param iphi row/phi cell index, modified for DCal
485-
/// \param ieta column/eta index, modified for DCal
486-
///
487-
void ShiftOfflineToOnlineCellIndexes(Int_t sm, Int_t& iphi, Int_t& ieta) const;
488-
489-
///
490-
/// \brief Look to see what the relative position inside a given cell is for a recpoint.
491-
///
492-
/// \param absId cell absolute id. number, input
493-
/// \param xr,yr,zr - x,y,z coordinates of cell with absId inside SM, output
494-
/// \throw InvalidCellIDException if cell ID does not exist
495-
///
496-
void RelPosCellInSModule(Int_t absId, Double_t& xr, Double_t& yr, Double_t& zr) const;
497-
498459
///
499460
/// \brief Look to see what the relative position inside a given cell is for a recpoint.
500461
///
501462
/// Same as RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr)
502463
/// but taking into account position of shower max.
503464
///
504-
/// \param absId cell absolute id. number, input
505-
/// \param distEff shower max position? check call in AliEMCALRecPoint!, input
506-
/// \param xr,yr,zr - x,y,z coordinates of cell with absId inside SM, output
507-
/// \throw InvalidCellIDException if cell ID does not exist
508-
///
509-
void RelPosCellInSModule(Int_t absId, Double_t distEff, Double_t& xr, Double_t& yr, Double_t& zr) const;
510-
511-
///
512-
/// \brief Look to see what the relative position inside a given cell is for a recpoint.
513-
///
514-
/// \param absId cell absolute id. number, input
515-
/// \param loc Double[3] with x,y,z coordinates of cell with absId inside SM, output
465+
/// \param[in] absId cell absolute id. number, input
466+
/// \param[in] distEff shower max position? check call in RecPoint!
467+
/// \return Point3D with x,y,z coordinates of cell with absId inside SM
516468
/// \throw InvalidCellIDException if cell ID does not exist
517469
///
518-
void RelPosCellInSModule(Int_t absId, Double_t loc[3]) const;
470+
Point3D<double> RelPosCellInSModule(Int_t absId, Double_t distEf) const;
519471

520472
///
521473
/// \brief Look to see what the relative position inside a given cell is for a recpoint.
522474
///
523475
/// \param absId cell absolute id. number, input
524-
/// \param vloc TVector3 with x,y,z coordinates of cell with absId inside SM, output
476+
/// \return Point3D with x,y,z coordinates of cell with absId inside SM
525477
/// \throw InvalidCellIDException if cell ID does not exist
526478
///
527-
void RelPosCellInSModule(Int_t absId, TVector3& vloc) const;
479+
Point3D<double> RelPosCellInSModule(Int_t absId) const;
528480

529-
const Int_t* GetEMCSystem() const { return mEMCSMSystem; } // EMC System, SM type list
481+
std::vector<EMCALSMType> GetEMCSystem() const { return mEMCSMSystem; } // EMC System, SM type list
530482
// Local Coordinates of SM
531-
TArrayD GetCentersOfCellsEtaDir() const
483+
std::vector<Double_t> GetCentersOfCellsEtaDir() const
532484
{
533485
return mCentersOfCellsEtaDir;
534486
} // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
535-
TArrayD GetCentersOfCellsXDir() const
487+
std::vector<Double_t> GetCentersOfCellsXDir() const
536488
{
537489
return mCentersOfCellsXDir;
538490
} // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
539-
TArrayD GetCentersOfCellsPhiDir() const
491+
std::vector<Double_t> GetCentersOfCellsPhiDir() const
540492
{
541493
return mCentersOfCellsPhiDir;
542494
} // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
543495
//
544-
TArrayD GetEtaCentersOfCells() const
496+
std::vector<Double_t> GetEtaCentersOfCells() const
545497
{
546498
return mEtaCentersOfCells;
547499
} // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
548-
TArrayD GetPhiCentersOfCells() const
500+
std::vector<Double_t> GetPhiCentersOfCells() const
549501
{
550502
return mPhiCentersOfCells;
551503
} // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
@@ -621,19 +573,19 @@ class Geometry
621573
Int_t mNETAdiv; ///< Number eta division of module
622574
Int_t mNPHIdiv; ///< Number phi division of module
623575
Int_t mNCellsInModule; ///< Number cell in module
624-
TArrayD mPhiBoundariesOfSM; ///< Phi boundaries of SM in rad; size is fNumberOfSuperModules;
625-
TArrayD mPhiCentersOfSM; ///< Phi of centers of SM; size is fNumberOfSuperModules/2
626-
TArrayD mPhiCentersOfSMSec; ///< Phi of centers of section where SM lies; size is fNumberOfSuperModules/2
576+
std::vector<Double_t> mPhiBoundariesOfSM; ///< Phi boundaries of SM in rad; size is fNumberOfSuperModules;
577+
std::vector<Double_t> mPhiCentersOfSM; ///< Phi of centers of SM; size is fNumberOfSuperModules/2
578+
std::vector<Double_t> mPhiCentersOfSMSec; ///< Phi of centers of section where SM lies; size is fNumberOfSuperModules/2
627579

628580
// Local Coordinates of SM
629-
TArrayD mPhiCentersOfCells; ///< [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
630-
TArrayD mCentersOfCellsEtaDir; ///< Size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
631-
TArrayD mCentersOfCellsPhiDir; ///< Size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
632-
TArrayD
581+
std::vector<Double_t> mPhiCentersOfCells; ///< [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
582+
std::vector<Double_t> mCentersOfCellsEtaDir; ///< Size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
583+
std::vector<Double_t> mCentersOfCellsPhiDir; ///< Size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
584+
std::vector<Double_t>
633585
mEtaCentersOfCells; ///< [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
634586
Int_t mNCells; ///< Number of cells in calo
635587
Int_t mNPhi; ///< Number of Towers in the PHI direction
636-
TArrayD mCentersOfCellsXDir; ///< Size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
588+
std::vector<Double_t> mCentersOfCellsXDir; ///< Size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
637589
Float_t mEnvelop[3]; ///< The GEANT TUB for the detector
638590
Float_t mArm1EtaMin; ///< Minimum pseudorapidity position of EMCAL in Eta
639591
Float_t mArm1EtaMax; ///< Maximum pseudorapidity position of EMCAL in Eta
@@ -670,7 +622,7 @@ class Geometry
670622
Int_t mNumberOfSuperModules; ///< default is 12 = 6 * 2
671623

672624
/// geometry structure
673-
Int_t* mEMCSMSystem; //[mNumberOfSuperModules]
625+
std::vector<EMCALSMType> mEMCSMSystem; ///< Type of the supermodule (size number of supermodules
674626

675627
Float_t mFrontSteelStrip; ///< 13-may-05
676628
Float_t mLateralSteelStrip; ///< 13-may-05

Detectors/EMCAL/base/include/EMCALBase/Hit.h

Lines changed: 91 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -13,104 +13,102 @@
1313

1414
#include "SimulationDataFormat/BaseHits.h"
1515

16-
namespace o2 {
17-
namespace EMCAL {
18-
19-
/// \class Hit
20-
/// \brief EMCAL simulation hit information
21-
class Hit : public o2::BasicXYZEHit<float> {
22-
public:
23-
24-
/// \brief Default constructor
25-
Hit() = default;
26-
27-
/// \brief Hit constructor
28-
///
29-
/// Fully defining information of the EMCAL point (position,
30-
/// momentum, energy, track, ...)
31-
///
32-
/// \param shunt
33-
/// \param primary Number of primary particle
34-
/// \param trackID Index of the track
35-
/// \param parentID ID of the parent primary entering the EMCAL
36-
/// \param detID ID of the detector segment
37-
/// \param initialEnergy Energy of the primary particle enering the EMCAL
38-
/// \param pos Position vector of the point
39-
/// \param mom Momentum vector for the particle at the point
40-
/// \param tof Time of the hit
41-
/// \param length Length of the segment
42-
Hit(Int_t shunt, Int_t primary, Int_t trackID, Int_t parentID, Int_t detID, Int_t initialEnergy,
43-
const Point3D<float> &pos, const Vector3D<float> &mom, Double_t tof, Double_t eLoss):
44-
o2::BasicXYZEHit<float>(pos.X(), pos.Y(), pos.X(), tof, eLoss, trackID, detID),
16+
namespace o2
17+
{
18+
namespace EMCAL
19+
{
20+
/// \class Hit
21+
/// \brief EMCAL simulation hit information
22+
class Hit : public o2::BasicXYZEHit<float>
23+
{
24+
public:
25+
/// \brief Default constructor
26+
Hit() = default;
27+
28+
/// \brief Hit constructor
29+
///
30+
/// Fully defining information of the EMCAL point (position,
31+
/// momentum, energy, track, ...)
32+
///
33+
/// \param primary Number of primary particle
34+
/// \param trackID Index of the track
35+
/// \param parentID ID of the parent primary entering the EMCAL
36+
/// \param detID ID of the detector segment
37+
/// \param initialEnergy Energy of the primary particle enering the EMCAL
38+
/// \param pos Position vector of the point
39+
/// \param mom Momentum vector for the particle at the point
40+
/// \param tof Time of the hit
41+
/// \param length Length of the segment
42+
Hit(Int_t primary, Int_t trackID, Int_t parentID, Int_t detID, Int_t initialEnergy, const Point3D<float>& pos,
43+
const Vector3D<float>& mom, Double_t tof, Double_t eLoss)
44+
: o2::BasicXYZEHit<float>(pos.X(), pos.Y(), pos.Z(), tof, eLoss, trackID, detID),
4545
mPvector(mom),
46-
mShunt(shunt),
4746
mPrimary(primary),
4847
mParent(parentID),
4948
mInitialEnergy(initialEnergy)
50-
{
51-
}
52-
53-
/// \brief Check whether the points are from the same parent and in the same detector volume
54-
/// \return True if points are the same (origin and detector), false otherwise
55-
Bool_t operator==(const Hit &rhs) const;
56-
57-
/// \brief Sorting points according to parent particle and detector volume
58-
/// \return True if this point is smaller, false otherwise
59-
Bool_t operator<(const Hit &rhs) const;
60-
61-
/// \brief Adds energy loss from the other point to this point
62-
/// \param rhs EMCAL point to add to this point
63-
/// \return This point with the summed energy loss
64-
Hit &operator+=(const Hit &rhs);
65-
66-
/// \brief Creates a new point base on this point but adding the energy loss of the right hand side
67-
/// \param
68-
/// \return New EMAL point base on this point
69-
Hit operator+(const Hit &rhs) const;
70-
71-
/// \brief Destructor
72-
~Hit() override = default;
73-
74-
/// \brief Get the initial energy of the primary particle entering EMCAL
75-
/// \return Energy of the primary particle entering EMCAL
76-
Double_t GetInitialEnergy() const { return mInitialEnergy; }
77-
78-
/// \brief Get parent track of the particle producing the hit
79-
/// \return ID of the parent particle
80-
Int_t GetParentTrack() const { return mParent; }
81-
82-
/// \brief Get Primary particles at the origin of the hit
83-
/// \return Primary particles at the origin of the hit
84-
Int_t GetPrimary() const { return mPrimary; }
85-
86-
/// \brief Set initial energy of the primary particle entering EMCAL
87-
/// \param energy Energy of the primary particle entering EMCAL
88-
void SetInitialEnergy(Double_t energy) { mInitialEnergy = energy; }
89-
90-
/// \brief Set the ID of the parent track of the track producing the hit
91-
/// \param parentID ID of the parent track
92-
void SetParentTrack(Int_t parentID) { mParent = parentID; }
93-
94-
/// \brief Set primary particles at the origin of the hit
95-
/// \param primary Primary particles at the origin of the hit
96-
void SetPrimary(Int_t primary) { mPrimary = primary; }
97-
98-
/// \brief Writing point information to an output stream;
99-
/// \param stream target output stream
100-
void PrintStream(std::ostream &stream) const;
101-
102-
private:
103-
Vector3D<float> mPvector; ///< Momentum Vector
104-
Int_t mShunt; ///< Shunt (check if needed)
105-
Int_t mPrimary; ///< Primary particles at the origin of the hit
106-
Int_t mParent; ///< Parent particle that entered the EMCAL
107-
Double32_t mInitialEnergy; ///< Energy of the parent particle that entered the EMCAL
108-
109-
ClassDefOverride(Hit, 1);
110-
};
111-
112-
std::ostream &operator<<(std::ostream &stream, const Hit &point);
49+
{
11350
}
51+
52+
/// \brief Check whether the points are from the same parent and in the same detector volume
53+
/// \return True if points are the same (origin and detector), false otherwise
54+
Bool_t operator==(const Hit& rhs) const;
55+
56+
/// \brief Sorting points according to parent particle and detector volume
57+
/// \return True if this point is smaller, false otherwise
58+
Bool_t operator<(const Hit& rhs) const;
59+
60+
/// \brief Adds energy loss from the other point to this point
61+
/// \param rhs EMCAL point to add to this point
62+
/// \return This point with the summed energy loss
63+
Hit& operator+=(const Hit& rhs);
64+
65+
/// \brief Creates a new point base on this point but adding the energy loss of the right hand side
66+
/// \param
67+
/// \return New EMAL point base on this point
68+
Hit operator+(const Hit& rhs) const;
69+
70+
/// \brief Destructor
71+
~Hit() override = default;
72+
73+
/// \brief Get the initial energy of the primary particle entering EMCAL
74+
/// \return Energy of the primary particle entering EMCAL
75+
Double_t GetInitialEnergy() const { return mInitialEnergy; }
76+
77+
/// \brief Get parent track of the particle producing the hit
78+
/// \return ID of the parent particle
79+
Int_t GetParentTrack() const { return mParent; }
80+
81+
/// \brief Get Primary particles at the origin of the hit
82+
/// \return Primary particles at the origin of the hit
83+
Int_t GetPrimary() const { return mPrimary; }
84+
85+
/// \brief Set initial energy of the primary particle entering EMCAL
86+
/// \param energy Energy of the primary particle entering EMCAL
87+
void SetInitialEnergy(Double_t energy) { mInitialEnergy = energy; }
88+
89+
/// \brief Set the ID of the parent track of the track producing the hit
90+
/// \param parentID ID of the parent track
91+
void SetParentTrack(Int_t parentID) { mParent = parentID; }
92+
93+
/// \brief Set primary particles at the origin of the hit
94+
/// \param primary Primary particles at the origin of the hit
95+
void SetPrimary(Int_t primary) { mPrimary = primary; }
96+
97+
/// \brief Writing point information to an output stream;
98+
/// \param stream target output stream
99+
void PrintStream(std::ostream& stream) const;
100+
101+
private:
102+
Vector3D<float> mPvector; ///< Momentum Vector
103+
Int_t mPrimary; ///< Primary particles at the origin of the hit
104+
Int_t mParent; ///< Parent particle that entered the EMCAL
105+
Double32_t mInitialEnergy; ///< Energy of the parent particle that entered the EMCAL
106+
107+
ClassDefOverride(Hit, 1);
108+
};
109+
110+
std::ostream& operator<<(std::ostream& stream, const Hit& point);
111+
}
114112
}
115113

116114
#endif /* Point_h */

0 commit comments

Comments
 (0)