PandaRoot
PndEmcHit.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // -------------------------------------------------------------------------
14 // ----- PndEmcHit header file -----
15 // ----- Created 14/08/06 by S.Spataro -----
16 // -------------------------------------------------------------------------
17 
24 //#pragma once
25 #ifndef PNDEMCHIT_H
26 #define PNDEMCHIT_H
27 
28 #include "FairHit.h"
29 #include "TMath.h"
30 #include <vector>
31 #include <map>
32 #include <algorithm>
33 
34 class PndEmcPoint;
35 
40 class PndEmcHit : public FairHit {
41  public:
43  PndEmcHit();
44 
45  PndEmcHit(Int_t trackid, Int_t id, Float_t energy, Float_t time, Float_t X, Float_t Y, Float_t Z);
46 
47  PndEmcHit(Int_t trackid, Int_t id, Float_t energy, Float_t time, Float_t X, Float_t Y, Float_t Z, std::vector<Int_t> McTruth, FairMultiLinkedData enteringTrack,
48  FairMultiLinkedData exitingTrack, std::set<Int_t> clusterList);
49 
51  PndEmcHit(const PndEmcHit &);
52 
54  virtual ~PndEmcHit();
55 
57  void Print(const Option_t *opt = "") const;
58 
60  void SetEnergy(Double32_t energy) { fEnergy = energy; };
61  void SetTime(Double32_t time) { fTimeStamp = time * 1E9; };
62  void SetDepositedEnergyMap(const std::map<Int_t, Double_t> &depEnergy) { fDepositedEnergy = depEnergy; }
63  void AddDepositedEnergy(Int_t mcId, Double_t depEnergy) { fDepositedEnergy[mcId] += depEnergy; }
64 
66  Double_t GetEnergy() const { return fEnergy; };
67  Double_t GetTime() const { return fTimeStamp / 1E9; };
68  Float_t GetTheta() const { return fX == 0.0 && fY == 0.0 && fZ == 0.0 ? 0.0 : TMath::ATan2(sqrt(fX * fX + fY * fY), fZ) * TMath::RadToDeg(); };
69  Float_t GetPhi() const { return fX == 0.0 && fY == 0.0 ? 0.0 : TMath::ATan2(fY, fX) * TMath::RadToDeg(); };
70  Short_t GetModule() const { return (fDetectorID / 100000000); };
71  Short_t GetRow() const { return ((fDetectorID / 1000000) % 100); };
72  Short_t GetCrystal() const { return (fDetectorID % 10000); };
73  Short_t GetCopy() const { return ((fDetectorID / 10000) % 100); };
74 
75  Short_t GetXPad() const;
76  Short_t GetYPad() const;
77  FairMultiLinkedData GetTrackEntering() const { return fTrackEntering; }
78  FairMultiLinkedData GetTrackExiting() const { return fTrackExiting; }
79 
80  const std::vector<Int_t> &GetMcList() { return fMcList; }
81  std::set<Int_t> GetClusterList() { return fClusterList; }
82 
83  void AddClusterID(int clusterId) { fClusterList.insert(clusterId); }
84 
85  std::map<Int_t, Double_t> GetDepositedEnergyMap() const { return fDepositedEnergy; };
86 
87  protected:
88  Double32_t fEnergy; // hit amplitude
89 
90  std::vector<Int_t> fMcList; // Mc TrackIndex contributed to hit
91  FairMultiLinkedData fTrackEntering; // Links to tracks entering the crystal
92  FairMultiLinkedData fTrackExiting; // Links to tracks exiting the crystal
93  std::set<Int_t> fClusterList; // To which cluster belongs the hit based on MC information (could be more than one)
94  std::map<Int_t, Double_t> fDepositedEnergy; // MC deposited energy per (primary) MC particle
95 
96  ClassDef(PndEmcHit, 4)
97 };
98 
99 #endif // PNDEMCHIT_H
represents a mc hit in an emc crystal
Definition: PndEmcPoint.h:31
Short_t GetYPad() const
void SetTime(Double32_t time)
Definition: PndEmcHit.h:61
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:40
FairMultiLinkedData fTrackExiting
Definition: PndEmcHit.h:92
Short_t GetModule() const
Definition: PndEmcHit.h:70
FairMultiLinkedData GetTrackExiting() const
Definition: PndEmcHit.h:78
std::set< Int_t > GetClusterList()
Definition: PndEmcHit.h:81
std::set< Int_t > fClusterList
Definition: PndEmcHit.h:93
FairMultiLinkedData GetTrackEntering() const
Definition: PndEmcHit.h:77
void SetEnergy(Double32_t energy)
Definition: PndEmcHit.h:60
Double_t GetTime() const
Definition: PndEmcHit.h:67
const std::vector< Int_t > & GetMcList()
Definition: PndEmcHit.h:80
virtual ~PndEmcHit()
static T ATan2(const T &y, const T &x)
Short_t GetRow() const
Definition: PndEmcHit.h:71
Float_t GetTheta() const
Definition: PndEmcHit.h:68
void AddDepositedEnergy(Int_t mcId, Double_t depEnergy)
Definition: PndEmcHit.h:63
Short_t GetCrystal() const
Definition: PndEmcHit.h:72
Short_t GetCopy() const
Definition: PndEmcHit.h:73
void AddClusterID(int clusterId)
Definition: PndEmcHit.h:83
std::map< Int_t, Double_t > fDepositedEnergy
Definition: PndEmcHit.h:94
std::vector< Int_t > fMcList
Definition: PndEmcHit.h:90
Short_t GetXPad() const
std::map< Int_t, Double_t > GetDepositedEnergyMap() const
Definition: PndEmcHit.h:85
represents the deposited energy of one emc crystal from simulation
Definition: PndEmcHit.h:40
Double_t GetEnergy() const
Definition: PndEmcHit.h:66
FairMultiLinkedData fTrackEntering
Definition: PndEmcHit.h:91
void Print(const Option_t *opt="") const
Float_t GetPhi() const
Definition: PndEmcHit.h:69
Double32_t fEnergy
Definition: PndEmcHit.h:85
void SetDepositedEnergyMap(const std::map< Int_t, Double_t > &depEnergy)
Definition: PndEmcHit.h:62