PandaRoot
BSEmcDetector.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- BSEmcDetector
3 // ----- Based on FairDetector and PndSdsDetector
4 // ----- Created 12/03/2019 by B. Salisbury
5 // -------------------------------------------------------------------------
6 #ifndef BSEMCDETECTOR_HH
7 #define BSEMCDETECTOR_HH
8 
9 #include <string>
10 #include <vector>
11 
12 #include "Rtypes.h"
13 #include "RtypesCore.h"
14 #include "TLorentzVector.h"
15 #include "TString.h"
16 #include "TVector3.h"
17 
18 #include "FairDetector.h"
19 
20 #include "PndGeoHandling.h"
21 
22 class PndSensorNameIdMap;
23 class TClonesArray;
24 class TGeoNode;
25 class BSEmcMCPoint;
26 class FairVolume;
27 class TGeoMatrix;
28 class TBuffer;
29 class TClass;
30 class TMemberInspector;
31 
43 class BSEmcDetector : public FairDetector {
44  public:
45  BSEmcDetector();
46 
48  : FairDetector(other), fListOfSensitives(other.fListOfSensitives), fGeoH(PndGeoHandling::Instance()), fIdMap(other.fIdMap), fPosIndex(other.fPosIndex),
49  fOutBranchName(other.fOutBranchName), fFolderName(other.fFolderName), fPndEmcCollection(other.fPndEmcCollection), fTransformMatrix(other.fTransformMatrix)
50 
51  {
53  };
54 
59  BSEmcDetector(const char *t_name, Bool_t t_active);
60 
62  virtual ~BSEmcDetector();
63 
64  // BSEmcDetector &operator=(BSEmcDetector &other)
65  // {
66  // fListOfSensitives = other.fListOfSensitives;
67  // fPosIndex = other.fPosIndex;
68  // fOutBranchName = other.fOutBranchName;
69  // fFolderName = other.fFolderName;
70  // fPndEmcCollection = other.fPndEmcCollection;
71  // fTransformMatrix = other.fTransformMatrix;
72  // //fGeoH= PndGeoHandling::Instance();
73  // return *this;
74  // };
75 
76  virtual void Initialize() /*override*/;
77 
85  virtual Bool_t ProcessHits(FairVolume *t_vol = nullptr) /*override*/;
86 
92  virtual void EndOfEvent() /*override*/;
93 
94  virtual void FinishRun() /*override*/;
95 
100  virtual void Register() /*override*/;
101 
103  virtual TClonesArray *GetCollection(Int_t t_iColl) const /*override*/;
104 
109  virtual void Print() const;
110 
115  virtual void SetSpecialPhysicsCuts() /*override*/;
116 
121  virtual void Reset() /*override*/;
122 
130  virtual void CopyClones(TClonesArray *t_origin, TClonesArray *t_target, Int_t t_offset) /*override*/;
131 
136  virtual void ConstructGeometry() /*override*/;
137  // void ConstructRootGeometry();
138  virtual void ConstructASCIIGeometry() /*override*/;
139 
140  void SetFolderName(const TString &t_folder) { fFolderName = t_folder; }
141  void SetBranchOutName(const TString &t_branchout) { fOutBranchName = t_branchout; }
142  const TString &GetFolderName() const { return fFolderName; }
143  const TString &GetBranchOutName() const { return fOutBranchName; }
144 
145  void SetSensitiveNames(const std::vector<std::string> &t_sensNames) { fListOfSensitives = t_sensNames; };
146  virtual void SetDefaultSensitiveNames() { fListOfSensitives = {"Crystal"}; } /*override*/;
147  const std::vector<std::string> &GetListOfSensitives() { return fListOfSensitives; }
148  void SetTransformMatrix(TGeoMatrix *t_transform) { fTransformMatrix = t_transform; }
149  const TGeoMatrix *GetTransformMatrix() const { return fTransformMatrix; }
150 
151  void SetIdMap(PndSensorNameIdMap *t_map) { fIdMap = t_map; }
153 
154  void SetPersistency(Bool_t t_storePoints) { fPersistency = t_storePoints; }
155 
156  protected:
157  virtual Int_t GetDetectorId();
158  Bool_t CheckIfSensitive(std::string t_name) /*override*/;
159 
164  BSEmcMCPoint *
165  AddHit(Int_t t_trackID, Int_t t_detID, Int_t t_evtID, TVector3 t_pos, TVector3 t_mom, Double_t t_tof, Double_t t_length, Double_t t_eLoss, Bool_t t_enterning, Bool_t t_exiting);
166 
171  void ResetParameters();
172 
173  protected:
174  std::vector<std::string> fListOfSensitives{};
175  PndGeoHandling *fGeoH{nullptr};
177 
178  private:
179  Int_t fPosIndex{-1};
180  TString fOutBranchName{""};
181  TString fFolderName{""};
182  TClonesArray *fPndEmcCollection{nullptr};
183 
184  Int_t fTrackID{-1};
185  Int_t fVolumeID{-1};
186  Int_t fCopyNumber{-1};
187  Int_t fEventID{-1};
188  TLorentzVector fPos{};
189  TLorentzVector fMom{};
190  Double32_t fTime{-1};
191  Double32_t fLength{-1};
192  Double32_t fELoss{-1};
193  TGeoMatrix *fTransformMatrix{nullptr};
194  Int_t fNumberOfPoints{0};
195  Bool_t fPersistency{kFALSE};
196  ClassDef(BSEmcDetector, 7);
197 };
198 
199 #endif /*BSEMCDETECTOR_HH*/
virtual Bool_t ProcessHits(FairVolume *t_vol=nullptr)
const TString & GetBranchOutName() const
PndSensorNameIdMap * fIdMap
virtual TClonesArray * GetCollection(Int_t t_iColl) const
void ResetParameters()
virtual void ConstructGeometry()
void SetPersistency(Bool_t t_storePoints)
void SetTransformMatrix(TGeoMatrix *t_transform)
virtual Int_t GetDetectorId()
void SetIdMap(PndSensorNameIdMap *t_map)
Class to access the naming information of the MVD.
virtual void SetSpecialPhysicsCuts()
Base class for NameIdMaps used by the EmcGeoHandling singleton to retrieve a detector id from a name ...
BSEmcMCPoint * AddHit(Int_t t_trackID, Int_t t_detID, Int_t t_evtID, TVector3 t_pos, TVector3 t_mom, Double_t t_tof, Double_t t_length, Double_t t_eLoss, Bool_t t_enterning, Bool_t t_exiting)
virtual void Print() const
virtual void Initialize()
represents a mc hit in an emc crystal
Definition: BSEmcMCPoint.h:28
virtual void Register()
void SetSensitiveNames(const std::vector< std::string > &t_sensNames)
virtual void SetDefaultSensitiveNames()
virtual void EndOfEvent()
virtual ~BSEmcDetector()
virtual void ConstructASCIIGeometry()
virtual void CopyClones(TClonesArray *t_origin, TClonesArray *t_target, Int_t t_offset)
PndSensorNameIdMap * GetIdMap()
Specialization of the FairDetector for a common BSEmcDetector.
Definition: BSEmcDetector.h:43
const std::vector< std::string > & GetListOfSensitives()
const TString & GetFolderName() const
BSEmcDetector(BSEmcDetector &other)
Definition: BSEmcDetector.h:47
Bool_t CheckIfSensitive(std::string t_name)
virtual void FinishRun()
void SetBranchOutName(const TString &t_branchout)
virtual void Reset()
PndGeoHandling * fGeoH
void SetFolderName(const TString &t_folder)
std::vector< std::string > fListOfSensitives
const TGeoMatrix * GetTransformMatrix() const