PandaRoot
BSEmcDetector.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 // ----- BSEmcDetector
15 // ----- Based on FairDetector and PndSdsDetector
16 // ----- Created 12/03/2019 by B. Salisbury
17 // -------------------------------------------------------------------------
18 #ifndef BSEMCDETECTOR_HH
19 #define BSEMCDETECTOR_HH
20 
21 #include <string>
22 #include <vector>
23 
24 #include "Rtypes.h"
25 #include "RtypesCore.h"
26 #include "TLorentzVector.h"
27 #include "TString.h"
28 #include "TVector3.h"
29 
30 #include "FairDetector.h"
31 
32 #include "PndGeoHandling.h"
33 
34 class PndSensorNameIdMap;
35 class TClonesArray;
36 class TGeoNode;
37 class BSEmcMCPoint;
38 class FairVolume;
39 class TGeoMatrix;
40 class TBuffer;
41 class TClass;
42 class TMemberInspector;
43 
55 class BSEmcDetector : public FairDetector {
56  public:
57  BSEmcDetector();
58 
60  : FairDetector(other), fListOfSensitives(other.fListOfSensitives), fGeoH(PndGeoHandling::Instance()), fIdMap(other.fIdMap), fPosIndex(other.fPosIndex),
61  fOutBranchName(other.fOutBranchName), fFolderName(other.fFolderName), fPndEmcCollection(other.fPndEmcCollection), fTransformMatrix(other.fTransformMatrix)
62 
63  {
65  };
66 
71  BSEmcDetector(const char *t_name, Bool_t t_active);
72 
74  virtual ~BSEmcDetector();
75 
76  // BSEmcDetector &operator=(BSEmcDetector &other)
77  // {
78  // fListOfSensitives = other.fListOfSensitives;
79  // fPosIndex = other.fPosIndex;
80  // fOutBranchName = other.fOutBranchName;
81  // fFolderName = other.fFolderName;
82  // fPndEmcCollection = other.fPndEmcCollection;
83  // fTransformMatrix = other.fTransformMatrix;
84  // //fGeoH= PndGeoHandling::Instance();
85  // return *this;
86  // };
87 
88  virtual void Initialize() /*override*/;
89 
97  virtual Bool_t ProcessHits(FairVolume *t_vol = nullptr) /*override*/;
98 
104  virtual void EndOfEvent() /*override*/;
105 
106  virtual void FinishRun() /*override*/;
107 
112  virtual void Register() /*override*/;
113 
115  virtual TClonesArray *GetCollection(Int_t t_iColl) const /*override*/;
116 
121  virtual void Print() const;
122 
127  virtual void SetSpecialPhysicsCuts() /*override*/;
128 
133  virtual void Reset() /*override*/;
134 
142  virtual void CopyClones(TClonesArray *t_origin, TClonesArray *t_target, Int_t t_offset) /*override*/;
143 
148  virtual void ConstructGeometry() /*override*/;
149  // void ConstructRootGeometry();
150  virtual void ConstructASCIIGeometry() /*override*/;
151 
152  void SetFolderName(const TString &t_folder) { fFolderName = t_folder; }
153  void SetBranchOutName(const TString &t_branchout) { fOutBranchName = t_branchout; }
154  const TString &GetFolderName() const { return fFolderName; }
155  const TString &GetBranchOutName() const { return fOutBranchName; }
156 
157  void SetSensitiveNames(const std::vector<std::string> &t_sensNames) { fListOfSensitives = t_sensNames; };
158  virtual void SetDefaultSensitiveNames() { fListOfSensitives = {"Crystal"}; } /*override*/;
159  const std::vector<std::string> &GetListOfSensitives() { return fListOfSensitives; }
160  void SetTransformMatrix(TGeoMatrix *t_transform) { fTransformMatrix = t_transform; }
161  const TGeoMatrix *GetTransformMatrix() const { return fTransformMatrix; }
162 
163  void SetIdMap(PndSensorNameIdMap *t_map) { fIdMap = t_map; }
165 
166  void SetPersistency(Bool_t t_storePoints) { fPersistency = t_storePoints; }
167 
168  protected:
169  virtual Int_t GetDetectorId();
170  Bool_t CheckIfSensitive(std::string t_name) /*override*/;
171 
176  BSEmcMCPoint *
177  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);
178 
183  void ResetParameters();
184 
185  protected:
186  std::vector<std::string> fListOfSensitives{};
187  PndGeoHandling *fGeoH{nullptr};
189 
190  private:
191  Int_t fPosIndex{-1};
192  TString fOutBranchName{""};
193  TString fFolderName{""};
194  TClonesArray *fPndEmcCollection{nullptr};
195 
196  Int_t fTrackID{-1};
197  Int_t fVolumeID{-1};
198  Int_t fCopyNumber{-1};
199  Int_t fEventID{-1};
200  TLorentzVector fPos{};
201  TLorentzVector fMom{};
202  Double32_t fTime{-1};
203  Double32_t fLength{-1};
204  Double32_t fELoss{-1};
205  TGeoMatrix *fTransformMatrix{nullptr};
206  Int_t fNumberOfPoints{0};
207  Bool_t fPersistency{kFALSE};
208  ClassDef(BSEmcDetector, 7);
209 };
210 
211 #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:40
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:55
const std::vector< std::string > & GetListOfSensitives()
const TString & GetFolderName() const
BSEmcDetector(BSEmcDetector &other)
Definition: BSEmcDetector.h:59
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