PandaRoot
BSEmcMCDepositProductionProcess.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 #ifndef BSEMCMCDEPOSITPRODUCTIONPROCESS_HH
14 #define BSEMCMCDEPOSITPRODUCTIONPROCESS_HH
15 
16 #include <map>
17 #include <string>
18 #include <vector>
19 
20 #include "Rtypes.h"
21 #include "RtypesCore.h"
22 #include "TClonesArray.h"
23 #include "TVector3.h"
24 
25 #include "FairMultiLinkedData.h"
26 
27 #include "PndContainerI.h"
28 #include "PndParameterRegister.h"
29 #include "PndProcess.h"
30 
32 
33 #include "BSEmcSortMCTruthAlgo.h"
34 
35 class PndMCTrack;
36 class BSEmcMCPoint;
37 class BSEmcMCDeposit;
40 class TBuffer;
41 class TClass;
42 class TMemberInspector;
43 
44 struct BSEmcMCDepositProductionData;
45 template <class T>
47 template <class T>
49 
50 struct BSEmcVolume {
51  virtual Bool_t InsideVolume(const TVector3 &t_point) const = 0;
52  virtual ~BSEmcVolume(){};
53 };
54 
55 struct BSEmcVolumeDisk : public BSEmcVolume { // needed for MC matching. Assume barrel structure
56  Double_t fMinR{-1};
57  Double_t fMaxR{-1};
58  Double_t fMinZ{-1};
59  Double_t fMaxZ{-1};
60  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){};
61  virtual ~BSEmcVolumeDisk(){};
62 
63  Bool_t InsideVolume(const TVector3 &t_point) const
64  {
65  if (t_point.Z() > fMinZ && t_point.Z() < fMaxZ) {
66  if (t_point.Perp() > fMinR && t_point.Perp() < fMaxR) {
67  return kTRUE;
68  }
69  }
70  return kFALSE;
71  };
72 };
73 
74 struct BSEmcVolumeBox : public BSEmcVolume {
75  Double_t fMinX{-1}, fMaxX{-1};
76  Double_t fMinY{-1}, fMaxY{-1};
77  Double_t fMinZ{-1}, fMaxZ{-1};
78 
79  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)
80  : fMinX(t_minX), fMaxX(t_maxX), fMinY(t_minY), fMaxY(t_maxY), fMinZ(t_minZ), fMaxZ(t_maxZ){};
81  virtual ~BSEmcVolumeBox(){};
82 
83  Bool_t InsideVolume(const TVector3 &t_point) const
84  {
85  if (t_point.Z() > fMinZ && t_point.Z() < fMaxZ) {
86  if (t_point.Y() > fMinY && t_point.Y() < fMaxY) {
87  if (t_point.X() > fMinX && t_point.X() < fMaxX) {
88  return kTRUE;
89  }
90  }
91  }
92  return kFALSE;
93  };
94 };
95 
115  public:
118  virtual void RequestDataContainer(PndContainerRegister *t_register) /*override*/;
119  virtual void GetDataContainer(PndContainerRegister *t_register) /*override*/;
120  virtual void SetupParameters(const PndParameterRegister *t_parameter) /*override*/;
121  virtual void SetDetectorName(const std::string &t_detectorname) /*override*/;
122  virtual void Process() /*override*/;
123  void SetMCParName(const std::string &t_parName) { fMCParName = t_parName; }
124  void SetPositionParName(const std::string &t_parName) { fPositionParName = t_parName; }
125  void SetVolume(BSEmcVolume *t_volume) { fBoundaryVolume = t_volume; }
126 
127  void SetTrackBranchName(const TString &t_branchname) { fTrackBranchname = t_branchname; }
128  void SetMCPointBranchName(const TString &t_branchname) { fMCPointBranchname = t_branchname; }
129  void SetMCDepositBranchName(const TString &t_branchname) { fMCDepositBranchname = t_branchname; }
130 
131  protected:
132  virtual Double_t GetEnergy(const BSEmcMCPoint *t_point) const;
133  virtual Double_t GetTime(const BSEmcMCPoint *t_point) const;
134  virtual Bool_t GetEntering(const BSEmcMCPoint *t_point) const;
135  virtual Bool_t GetExiting(const BSEmcMCPoint *t_point) const;
136  virtual FairMultiLinkedData GetTracks(const BSEmcMCPoint *t_point) const;
137  virtual Int_t GetMCTrackID(const BSEmcMCPoint *t_point) const;
138  virtual Bool_t SkipPoint(const BSEmcMCPoint *t_point) const;
139 
140  virtual void CreateDeposits(std::vector<BSEmcMCPoint *> t_points);
141  void Reset();
142  Int_t FindMCIndex(const BSEmcMCPoint *t_point);
143  Int_t FindMCIndexIterative(const BSEmcMCPoint *t_point, Int_t t_mcIndex);
144 
145  void SetClusterIdForPoint(BSEmcMCPoint *t_point);
146  void StoreDeposits();
147  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);
148 
149  protected:
150  std::string fMCParName{""};
151  std::string fPositionParName{""};
152 
153  TString fTrackBranchname{""};
154  TString fMCPointBranchname{""};
155  TString fMCDepositBranchname{""};
156  PndContainerI<PndMCTrack> *fMCTrackArray{nullptr};
157  PndMutableContainerI<BSEmcMCPoint> *fPointArray{nullptr};
158  PndMutableContainerI<BSEmcMCDeposit> *fMCDepositArray{nullptr};
159  Double_t fEnergyThreshold{-1};
160  Double_t fCutMotherParticle{-1};
161  Double_t fCutSameTrack{-1};
162  BSEmcCrystalPositionPar *fPositionPar{nullptr};
163  BSEmcVolume *fBoundaryVolume{nullptr};
164 
165  std::map<Int_t, Float_t> fTrackEnergy{};
166  std::map<Int_t, Float_t> fTrackTime{}; // time of first point
167  std::map<Int_t, std::vector<Int_t>> fTrackMcTruth{}; // McTruth MC track which deposited energy in the crystal
168  std::map<Int_t, std::vector<Int_t>> fPointMatch{}; // DetId , PointIds with same DetId
169  std::map<Int_t, FairMultiLinkedData> fTrackEntering{}; // DetId, link to tracks entering same DetId
170  std::map<Int_t, FairMultiLinkedData> fTrackExiting{}; // DetId, link to track exiting same DetId
171  std::map<Int_t, const BSEmcMCPoint *> fLastPointForTrack{}; // <mcTrackId, last point of track seen>
172  std::map<Int_t, std::map<Int_t, Double_t>> fShower{}; // <DetId <MCTrackIndex, DepositedEnergy>> MCTruth deposited energy per crystal and (primary) mc particle type
173 
174  ClassDef(BSEmcMCDepositProductionProcess, 1);
175 };
176 
177 #endif /*BSEMCMCDEPOSITPRODUCTIONPROCESS_HH*/
Base Process class.
Definition: PndProcess.h:36
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:40
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.