All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
SimDigitalGeom.h
Go to the documentation of this file.
1 #ifndef SimDigitalGeom_h
2 #define SimDigitalGeom_h
3 
4 #include <utility>
5 
6 #include <marlin/Processor.h>
7 #include <IMPL/LCCollectionVec.h>
8 
9 #include <UTIL/CellIDEncoder.h>
10 #include <UTIL/CellIDDecoder.h>
11 
12 #include <EVENT/SimCalorimeterHit.h>
13 #include <EVENT/LCGenericObject.h>
14 #include <IMPL/CalorimeterHitImpl.h>
15 
16 #include "CalorimeterHitType.h" //in MarlinUtil
17 #include "marlinutil/LCGeometryTypes.h"
18 
19 
20 #include "DD4hep/Factories.h"
21 #include "DD4hep/DD4hepUnits.h"
22 #include "DDRec/DetectorData.h"
23 #include "DD4hep/DetType.h"
24 #include "DDRec/DetectorData.h"
25 #include "DDRec/DDGear.h"
26 #include "DDRec/MaterialManager.h"
27 #include "DDRec/DetectorSurfaces.h"
28 
29 namespace AIDA
30 {
31 class ITuple ;
32 }
33 
34 struct StepAndCharge ;
35 
36 /**
37 \addtogroup CaloDigi CaloDigi
38 @{
39 */
40 
42 {
43  PotentialSameTrackID(int _pdgStep , int _pdgParent)
44  : PDGStep{_pdgStep} , PDGParent{ _pdgParent}
45  {}
46 
47  int PDGStep ;
48  int PDGParent ;
49 
50  bool operator<(const PotentialSameTrackID& b) const
51  {
52  return std::tie( PDGStep , PDGParent ) < std::tie(b.PDGStep , b.PDGParent ) ;
53  }
54  bool operator==(const PotentialSameTrackID& b) const
55  {
56  return std::tie( PDGStep , PDGParent ) == std::tie(b.PDGStep , b.PDGParent ) ;
57  }
58 
59 } ;
60 
62 {
63  public :
64  SimDigitalGeomCellId(LCCollection* inputCol, LCCollectionVec* outputCol) ;
65  virtual ~SimDigitalGeomCellId() ;
66 
67  void setCellSize(float size) { _cellSize = size ; }
68 
69  virtual float getCellSize() = 0 ;
70  virtual void setLayerLayout(CHT::Layout layout) = 0 ;
71 
72  std::vector<StepAndCharge> decode(SimCalorimeterHit* hit , bool link) ;
73 
74  protected :
75  virtual void processGeometry(SimCalorimeterHit* hit) = 0 ;
76  void createStepAndChargeVec(SimCalorimeterHit* hit , std::vector<StepAndCharge>& vec , bool link) ;
77 
78  void linkSteps(std::vector<StepAndCharge>& vec) ;
79 
80  public :
81  virtual std::unique_ptr<CalorimeterHitImpl> encode(int delta_I , int delta_J) = 0 ;
82 
83  int I() const { return _Iy ; }
84  int J() const { return _Jz ; }
85  int K() const { return _trueLayer ; }
86  int stave() const { return _stave ; }
87  int module() const { return _module ; }
88  int tower() const { return _tower ; }
89 
90  const LCVector3D& normalToRPCPlane() const { return _normal ; }
91  const LCVector3D& Iaxis() const { return _Iaxis ; }
92  const LCVector3D& Jaxis() const { return _Jaxis ; }
93 
94 
95 
96  SimDigitalGeomCellId(const SimDigitalGeomCellId &toCopy) = delete ;
97  void operator=(const SimDigitalGeomCellId &toCopy) = delete ;
98 
99  protected :
100 
101  CHT::Layout _currentHCALCollectionCaloLayout = CHT::any ;
102 
103  dd4hep::long64 _cellIDvalue = 0 ;
104  CellIDDecoder<SimCalorimeterHit> _decoder ;
105  CellIDEncoder<CalorimeterHitImpl> _encoder ;
106 
107  float _cellSize = 0.0f ;
108 
109  int _trueLayer = -999 ;
110  int _stave = -999 ;
111  int _module = -999 ;
112  int _tower = -999 ;
113  int _Iy = -999 ;
114  int _Jz = -999 ;
115 
116  LCVector3D _normal ;
117  LCVector3D _Iaxis ;
118  LCVector3D _Jaxis ;
119 
120  const float* _hitPosition = nullptr ;
121 
122  std::string _cellIDEncodingString = "" ;
123 
124  //geometry debug tuples
125  public :
126  static void bookTuples(const marlin::Processor* proc) ;
127  protected :
129  void fillDebugTupleGeometryStep(SimCalorimeterHit* hit , const std::vector<StepAndCharge>& stepsInIJZcoord) ;
130 
131  static AIDA::ITuple* _tupleHit ;
137  static AIDA::ITuple* _tupleStep ;
142 } ;
143 
145 {
146  public :
147  SimDigitalGeomCellIdLCGEO(LCCollection* inputCol, LCCollectionVec* outputCol) ;
148  virtual ~SimDigitalGeomCellIdLCGEO() ;
149 
150 
151  virtual float getCellSize() ;
152  virtual void setLayerLayout(CHT::Layout layout) ;
153 
154  virtual std::unique_ptr<CalorimeterHitImpl> encode(int delta_I , int delta_J) ;
155 
156  SimDigitalGeomCellIdLCGEO(const SimDigitalGeomCellIdLCGEO &toCopy) = delete ;
157  void operator=(const SimDigitalGeomCellIdLCGEO &toCopy) = delete ;
158 
159  protected :
160  virtual void processGeometry(SimCalorimeterHit* hit) ;
161 
162  std::vector<std::string> _encodingString = { "layer", "stave", "module", "tower", "x", "y" } ;
163 
164  dd4hep::rec::LayeredCalorimeterData* _caloData = nullptr ;
165 } ;
166 
168 {
169  public :
170  SimDigitalGeomCellIdPROTO(LCCollection* inputCol, LCCollectionVec* outputCol) ;
171  virtual ~SimDigitalGeomCellIdPROTO() ;
172 
173  void setCellSize(float size) { _cellSize = size ; }
174  virtual float getCellSize() { return _cellSize ; }
175  virtual void setLayerLayout(CHT::Layout layout) ;
176 
177  virtual std::unique_ptr<CalorimeterHitImpl> encode(int delta_I , int delta_J) ;
178 
179  SimDigitalGeomCellIdPROTO(const SimDigitalGeomCellIdPROTO &toCopy) = delete ;
180  void operator=(const SimDigitalGeomCellIdPROTO &toCopy) = delete ;
181 
182  protected :
183  virtual void processGeometry(SimCalorimeterHit* hit) ;
184 
185  std::vector<std::string> _encodingString = { "K-1", "", "", "", "I", "J" } ;
186 } ;
187 
188 /** @} */
189 
190 #endif //SimDigitalGeom_h
static void bookTuples(const marlin::Processor *proc)
virtual void processGeometry(SimCalorimeterHit *hit)
void fillDebugTupleGeometryStep(SimCalorimeterHit *hit, const std::vector< StepAndCharge > &stepsInIJZcoord)
virtual void processGeometry(SimCalorimeterHit *hit)
dd4hep::long64 _cellIDvalue
virtual float getCellSize()=0
std::vector< std::string > _encodingString
const LCVector3D & Jaxis() const
SimDigitalGeomCellId(LCCollection *inputCol, LCCollectionVec *outputCol)
void setCellSize(float size)
const float * _hitPosition
const LCVector3D & normalToRPCPlane() const
CellIDDecoder< SimCalorimeterHit > _decoder
bool operator<(const PotentialSameTrackID &b) const
std::vector< StepAndCharge > decode(SimCalorimeterHit *hit, bool link)
virtual float getCellSize()
static AIDA::ITuple * _tupleStep
void operator=(const SimDigitalGeomCellIdLCGEO &toCopy)=delete
void createStepAndChargeVec(SimCalorimeterHit *hit, std::vector< StepAndCharge > &vec, bool link)
virtual std::unique_ptr< CalorimeterHitImpl > encode(int delta_I, int delta_J)
virtual void processGeometry(SimCalorimeterHit *hit)=0
void operator=(const SimDigitalGeomCellId &toCopy)=delete
bool operator==(const PotentialSameTrackID &b) const
static AIDA::ITuple * _tupleHit
SimDigitalGeomCellIdLCGEO(LCCollection *inputCol, LCCollectionVec *outputCol)
virtual void setLayerLayout(CHT::Layout layout)
CellIDEncoder< CalorimeterHitImpl > _encoder
void operator=(const SimDigitalGeomCellIdPROTO &toCopy)=delete
std::string _cellIDEncodingString
virtual std::unique_ptr< CalorimeterHitImpl > encode(int delta_I, int delta_J)
virtual void setLayerLayout(CHT::Layout layout)=0
std::vector< LCCollection * > LCCollectionVec
Definition: SiStripClus.h:55
dd4hep::rec::LayeredCalorimeterData * _caloData
std::vector< std::string > _encodingString
virtual std::unique_ptr< CalorimeterHitImpl > encode(int delta_I, int delta_J)=0
virtual ~SimDigitalGeomCellId()
PotentialSameTrackID(int _pdgStep, int _pdgParent)
CHT::Layout _currentHCALCollectionCaloLayout
SimDigitalGeomCellIdPROTO(LCCollection *inputCol, LCCollectionVec *outputCol)
virtual void setLayerLayout(CHT::Layout layout)
const LCVector3D & Iaxis() const
void setCellSize(float size)
void linkSteps(std::vector< StepAndCharge > &vec)