PandaRoot
BSEmcMCDepositProductionProcess.h
Go to the documentation of this file.
1 #ifndef BSEMCMCDEPOSITPRODUCTIONPROCESS_HH
2 #define BSEMCMCDEPOSITPRODUCTIONPROCESS_HH
3 
4 #include <map>
5 #include <string>
6 #include <vector>
7 
8 #include "Rtypes.h"
9 #include "RtypesCore.h"
10 #include "TClonesArray.h"
11 #include "TVector3.h"
12 
13 #include "FairMultiLinkedData.h"
14 
15 #include "PndContainerI.h"
16 #include "PndParameterRegister.h"
17 #include "PndProcess.h"
18 
20 
21 #include "BSEmcSortMCTruthAlgo.h"
22 
23 class PndMCTrack;
24 class BSEmcMCPoint;
25 class BSEmcMCDeposit;
28 class TBuffer;
29 class TClass;
30 class TMemberInspector;
31 
32 struct BSEmcMCDepositProductionData;
33 template <class T>
35 template <class T>
37 
38 struct BSEmcVolume {
39  virtual Bool_t InsideVolume(const TVector3 &t_point) const = 0;
40  virtual ~BSEmcVolume(){};
41 };
42 
43 struct BSEmcVolumeDisk : public BSEmcVolume { // needed for MC matching. Assume barrel structure
44  Double_t fMinR{-1};
45  Double_t fMaxR{-1};
46  Double_t fMinZ{-1};
47  Double_t fMaxZ{-1};
48  BSEmcVolumeDisk(Double_t t_minR, Double_t t_maxR, Double_t t_minZ, Double_t t_maxZ) : fMinR(t_minR), fMaxR(t_maxR), fMinZ(t_minZ), fMaxZ(t_maxZ){};
49  virtual ~BSEmcVolumeDisk(){};
50 
51  Bool_t InsideVolume(const TVector3 &t_point) const
52  {
53  if (t_point.Z() > fMinZ && t_point.Z() < fMaxZ) {
54  if (t_point.Perp() > fMinR && t_point.Perp() < fMaxR) {
55  return kTRUE;
56  }
57  }
58  return kFALSE;
59  };
60 };
61 
62 struct BSEmcVolumeBox : public BSEmcVolume {
63  Double_t fMinX{-1}, fMaxX{-1};
64  Double_t fMinY{-1}, fMaxY{-1};
65  Double_t fMinZ{-1}, fMaxZ{-1};
66 
67  BSEmcVolumeBox(Double_t t_minX, Double_t t_maxX, Double_t t_minY, Double_t t_maxY, Double_t t_minZ, Double_t t_maxZ)
68  : fMinX(t_minX), fMaxX(t_maxX), fMinY(t_minY), fMaxY(t_maxY), fMinZ(t_minZ), fMaxZ(t_maxZ){};
69  virtual ~BSEmcVolumeBox(){};
70 
71  Bool_t InsideVolume(const TVector3 &t_point) const
72  {
73  if (t_point.Z() > fMinZ && t_point.Z() < fMaxZ) {
74  if (t_point.Y() > fMinY && t_point.Y() < fMaxY) {
75  if (t_point.X() > fMinX && t_point.X() < fMaxX) {
76  return kTRUE;
77  }
78  }
79  }
80  return kFALSE;
81  };
82 };
83 
103  public:
106  virtual void RequestDataContainer(PndContainerRegister *t_register) /*override*/;
107  virtual void GetDataContainer(PndContainerRegister *t_register) /*override*/;
108  virtual void SetupParameters(const PndParameterRegister *t_parameter) /*override*/;
109  virtual void SetDetectorName(const std::string &t_detectorname) /*override*/;
110  virtual void Process() /*override*/;
111  void SetMCParName(const std::string &t_parName) { fMCParName = t_parName; }
112  void SetPositionParName(const std::string &t_parName) { fPositionParName = t_parName; }
113  void SetVolume(BSEmcVolume *t_volume) { fBoundaryVolume = t_volume; }
114 
115  void SetTrackBranchName(const TString &t_branchname) { fTrackBranchname = t_branchname; }
116  void SetMCPointBranchName(const TString &t_branchname) { fMCPointBranchname = t_branchname; }
117  void SetMCDepositBranchName(const TString &t_branchname) { fMCDepositBranchname = t_branchname; }
118 
119  protected:
120  virtual Double_t GetEnergy(const BSEmcMCPoint *t_point) const;
121  virtual Double_t GetTime(const BSEmcMCPoint *t_point) const;
122  virtual Bool_t GetEntering(const BSEmcMCPoint *t_point) const;
123  virtual Bool_t GetExiting(const BSEmcMCPoint *t_point) const;
124  virtual FairMultiLinkedData GetTracks(const BSEmcMCPoint *t_point) const;
125  virtual Int_t GetMCTrackID(const BSEmcMCPoint *t_point) const;
126  virtual Bool_t SkipPoint(const BSEmcMCPoint *t_point) const;
127 
128  virtual void CreateDeposits(std::vector<BSEmcMCPoint *> t_points);
129  void Reset();
130  Int_t FindMCIndex(const BSEmcMCPoint *t_point);
131  Int_t FindMCIndexIterative(const BSEmcMCPoint *t_point, Int_t t_mcIndex);
132 
133  void SetClusterIdForPoint(BSEmcMCPoint *t_point);
134  void StoreDeposits();
135  virtual void StoreDeposit(Int_t t_detId, Double_t t_time, std::vector<Int_t> &t_mctrackIds, const FairMultiLinkedData &t_entering, const FairMultiLinkedData &t_exiting);
136 
137  protected:
138  std::string fMCParName{""};
139  std::string fPositionParName{""};
140 
141  TString fTrackBranchname{""};
142  TString fMCPointBranchname{""};
143  TString fMCDepositBranchname{""};
144  PndContainerI<PndMCTrack> *fMCTrackArray{nullptr};
145  PndMutableContainerI<BSEmcMCPoint> *fPointArray{nullptr};
146  PndMutableContainerI<BSEmcMCDeposit> *fMCDepositArray{nullptr};
147  Double_t fEnergyThreshold{-1};
148  Double_t fCutMotherParticle{-1};
149  Double_t fCutSameTrack{-1};
150  BSEmcCrystalPositionPar *fPositionPar{nullptr};
151  BSEmcVolume *fBoundaryVolume{nullptr};
152 
153  std::map<Int_t, Float_t> fTrackEnergy{};
154  std::map<Int_t, Float_t> fTrackTime{}; // time of first point
155  std::map<Int_t, std::vector<Int_t>> fTrackMcTruth{}; // McTruth MC track which deposited energy in the crystal
156  std::map<Int_t, std::vector<Int_t>> fPointMatch{}; // DetId , PointIds with same DetId
157  std::map<Int_t, FairMultiLinkedData> fTrackEntering{}; // DetId, link to tracks entering same DetId
158  std::map<Int_t, FairMultiLinkedData> fTrackExiting{}; // DetId, link to track exiting same DetId
159  std::map<Int_t, const BSEmcMCPoint *> fLastPointForTrack{}; // <mcTrackId, last point of track seen>
160  std::map<Int_t, std::map<Int_t, Double_t>> fShower{}; // <DetId <MCTrackIndex, DepositedEnergy>> MCTruth deposited energy per crystal and (primary) mc particle type
161 
162  ClassDef(BSEmcMCDepositProductionProcess, 1);
163 };
164 
165 #endif /*BSEMCMCDEPOSITPRODUCTIONPROCESS_HH*/
Base Process class.
Definition: PndProcess.h:24
Bool_t InsideVolume(const TVector3 &t_point) const
Bool_t InsideVolume(const TVector3 &t_point) const
represents the deposited energy of one emc crystal from simulation
BSEmcVolumeDisk(Double_t t_minR, Double_t t_maxR, Double_t t_minZ, Double_t t_maxZ)
void SetMCPointBranchName(const TString &t_branchname)
BSEmcVolumeBox(Double_t t_minX, Double_t t_maxX, Double_t t_minY, Double_t t_maxY, Double_t t_minZ, Double_t t_maxZ)
void SetPositionParName(const std::string &t_parName)
virtual Bool_t InsideVolume(const TVector3 &t_point) const =0
void SetMCDepositBranchName(const TString &t_branchname)
Parameter for crystal positions.
Process to create BSEmcMCDeposits out of BSEmcMCPoints.
void SetTrackBranchName(const TString &t_branchname)
represents a mc hit in an emc crystal
Definition: BSEmcMCPoint.h:28
void SetMCParName(const std::string &t_parName)
Interface to a datacontainer to be used in PandaROOT.
Base class for algo that require the cleansortmclist.
Helper class to indirect the Parameter fetching via the FairRuntimeDb.