PandaRoot
PndEmcDigi.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 // File and Version Information:
15 // $Id:$
16 //
17 // Description:
18 // EMC Digi.
19 //
20 // Software developed for the BaBar Detector at the SLAC B-Factory.
21 // Adapted for the PANDA experiment at GSI
22 //
23 // Author List:
24 // Xiaorong Shi Lawrence Livermore National Lab
25 // Steve Playfer University of Edinburgh
26 // Stephen Gowdy University of Edinburgh
27 // Dima Melnichuk - adaption for PANDA
28 //
29 // Copyright Information:
30 // Copyright (C) 1994 Lawrence Livermore National Lab
31 //
33 //#pragma once
34 #ifndef PNDEMCDIGI_H
35 #define PNDEMCDIGI_H
36 
37 #include "TObject.h"
38 #include "PndEmcTwoCoordIndex.h"
39 #include "PndEmcHit.h"
40 #include "FairTimeStamp.h"
41 #include "TVector3.h"
42 #include "TClonesArray.h"
43 
44 class TVector3;
45 class PndEmcXtal;
46 class PndEmcSharedDigi;
47 
48 class PndEmcDigi : public FairTimeStamp
49 {
50 
51  friend std::ostream& operator<< (std::ostream& out, PndEmcDigi& digi){
52  out << "PndEmc Digi in crystal: " << digi.GetDetectorId()
53  << " energy: " << digi.GetEnergy()
54  << " timestamp: "<<digi.GetTimeStamp();
55  return out;
56  }
57 
58  public:
59  //for time based simulation
60  static TClonesArray* fDigiArrayTBD;
61  static void InitDigiArrayTBD();
62 
64  PndEmcDigi();
65 
66  PndEmcDigi(Int_t trackid, Int_t id, Float_t energy, Float_t time, Float_t local_time /*check of T res*/, Int_t hitIndex=-1, Int_t pileIndex=-1, Int_t DCid=-1);
67  PndEmcDigi(const PndEmcDigi&);
68 
70  virtual ~PndEmcDigi();
71  // Operators
72 
73  virtual bool operator==(const PndEmcDigi & otherDigi) const;
74  virtual bool operator!=(const PndEmcDigi & otherDigi) const;
75  virtual bool operator<( const PndEmcDigi & otherDigi) const;
76 
77  virtual bool equal(FairTimeStamp* data){
78  PndEmcDigi* myDigi = dynamic_cast <PndEmcDigi*> (data);
79  if (myDigi != nullptr) {
80  if (fDetectorId == myDigi->GetDetectorId())
81  return true;
82  }
83  return false;
84  }
85 
87  virtual void Print(const Option_t* opt ="") const;
88 
90 
92  void SetEnergy(Double32_t energy) { fEnergy = energy ;};
93  void SetTrackId(Int_t id) { fTrackId = id ;};
94  virtual void SetDetectorId(Int_t id);
95  void SetDCnumber(Int_t DCid) { fDCid = DCid ;};
96 
97  virtual void AbsorbEnergy(PndEmcDigi& otherDigi);
98 
99  //check if 2 digis are neigbour or not (prelim for testing)
100  bool isNeighbour(const PndEmcDigi* theDigi) const;
101 
102 
104  virtual Double_t GetEnergy() const;
105  Int_t GetTrackId() const { return fTrackId ;};
106  Int_t GetDetectorId() const { return fDetectorId ;};
107  PndEmcTwoCoordIndex* GetTCI() const;
108  Int_t GetThetaInt() const {return fThetaInd;};
109  Int_t GetPhiInt() const {return fPhiInd;};
110  Double_t GetTheta() const {return fTheta;};
111  Double_t GetPhi() const {return fPhi;};
112  Short_t GetModule() const { return (fDetectorId/100000000);};
113  Short_t GetRow() const { return ((fDetectorId/1000000)%100);};
114  Short_t GetCrystal() const { return (fDetectorId%10000);};
115  Short_t GetCopy() const { return ((fDetectorId/10000)%100);};
116  Short_t GetXPad() const;
117  Short_t GetYPad() const;
118  Int_t GetDCnumber() const; // for mapping into virtual Data Concentrators (DC)
119  Int_t GetEventNr() const { return fEvtNo ;}; //
120 
121  Int_t GetHitIndex() {return fHitIndex;}
122  Float_t GetLocalTime() {return flocal_time;}
123  Int_t GetPileIndex() {return fPileIndex;}
124  const TVector3 &where() const {return fWhere;};
125 
127  virtual const PndEmcSharedDigi* dynamic_cast_PndEmcSharedDigi() const;
128 
129  static Double_t getRescaleFactor(){ return fRescaleFactor; };
130  static Double_t getPositionDepthPWO(){ return fPositionDepthPWO; };
131  static Double_t getPositionDepthShashlyk(){ return fPositionDepthShashlyk; };
132 
133  Int_t fEvtNo;
134 
135  protected:
136  Float_t flocal_time;
137  Double_t fEnergy; // digi amplitude
138  Int_t fTrackId;
139  Int_t fDetectorId;
140  Int_t fHitIndex; // Index of hit which is converted to digi
141  Int_t fPileIndex; // Index of pile-up: 1 - single hits, 2 - come from pile-up
142  TVector3 fWhere;
143  Int_t fThetaInd;
144  Int_t fPhiInd;
145  Double_t fTheta;
146  Double_t fPhi;
147 
148  Int_t fDCid;
149 
150  private:
151 
152  friend class PndEmcWaveformToDigi;
156  friend class PndEmcFWEndcapDigi;
157  friend class PndEmcBWEndcapDigi;
158  friend class PndEmcShashlykDigi;
160  friend class PndEmcMakeDigi;
161  friend class PndEmcMakeTbDigi;
162  friend class PndEmcCorrBump;
163 
164  static void selectDigiPositionMethod( PositionMethod ,
165  double positionDepthPWO = 0.,
166  double positionDepthShahslyk = 0.,
167  double rescaleFactor = 1.);
168 
169  static TVector3 surfacePosition( const PndEmcXtal* xtal );
170  static TVector3 depthPosition( const PndEmcXtal* xtal );
171 
172  static TVector3 ( *&algPointer() ) ( const PndEmcXtal* );
173 
174  static double fRescaleFactor;
175  static double fPositionDepthPWO;
176  static double fPositionDepthShashlyk;
177 
178 
179  ClassDef(PndEmcDigi,8);
180 };
181 
182 #endif // PndEmcDigi_H
Int_t fDCid
Definition: PndEmcDigi.h:148
currently not used, not in CMakeLists.txt
Int_t GetTrackId() const
Definition: PndEmcDigi.h:105
virtual PndEmcSharedDigi * dynamic_cast_PndEmcSharedDigi()
virtual void Print(const Option_t *opt="") const
virtual bool operator!=(const PndEmcDigi &otherDigi) const
virtual Double_t GetEnergy() const
Module to take the hit list for the calorimeter and make ADC waveforms from them. ...
Int_t GetPhiInt() const
Definition: PndEmcDigi.h:109
Float_t flocal_time
Definition: PndEmcDigi.h:136
Int_t fTrackId
Definition: PndEmcDigi.h:138
void SetTrackId(Int_t id)
Definition: PndEmcDigi.h:93
represents coordinates of one crystal
Definition: PndEmcXtal.h:47
static Double_t getPositionDepthShashlyk()
Definition: PndEmcDigi.h:131
void SetDCnumber(Int_t DCid)
Definition: PndEmcDigi.h:95
Short_t GetRow() const
Definition: PndEmcDigi.h:113
stores crystal index coordinates (x,y) or (theta,phi)
virtual void AbsorbEnergy(PndEmcDigi &otherDigi)
Float_t GetLocalTime()
Definition: PndEmcDigi.h:122
Double_t fEnergy
Definition: PndEmcDigi.h:137
virtual ~PndEmcDigi()
Int_t GetDCnumber() const
bool isNeighbour(const PndEmcDigi *theDigi) const
TVector3 fWhere
Definition: PndEmcDigi.h:142
friend class PndEmcWaveformToDigiFPGA
Definition: PndEmcDigi.h:153
Task to create digis from waveforms.
static Double_t getRescaleFactor()
Definition: PndEmcDigi.h:129
Short_t GetCrystal() const
Definition: PndEmcDigi.h:114
void SetEnergy(Double32_t energy)
Definition: PndEmcDigi.h:92
Int_t fHitIndex
Definition: PndEmcDigi.h:140
Int_t GetDetectorId() const
Definition: PndEmcDigi.h:106
used to share PndEmcDigis between bumps
Double_t fTheta
Definition: PndEmcDigi.h:145
static Double_t getPositionDepthPWO()
Definition: PndEmcDigi.h:130
virtual bool equal(FairTimeStamp *data)
Definition: PndEmcDigi.h:77
Int_t fPhiInd
Definition: PndEmcDigi.h:144
Task to create PndEmcDigi from PndEmcHit.
Short_t GetModule() const
Definition: PndEmcDigi.h:112
Task to create digis from waveforms.
virtual bool operator==(const PndEmcDigi &otherDigi) const
const TVector3 & where() const
Definition: PndEmcDigi.h:124
Short_t GetCopy() const
Definition: PndEmcDigi.h:115
friend std::ostream & operator<<(std::ostream &out, PndEmcDigi &digi)
Definition: PndEmcDigi.h:51
Int_t fEvtNo
Definition: PndEmcDigi.h:131
Int_t GetHitIndex()
Definition: PndEmcDigi.h:121
virtual bool operator<(const PndEmcDigi &otherDigi) const
Int_t GetThetaInt() const
Definition: PndEmcDigi.h:108
Int_t fDetectorId
Definition: PndEmcDigi.h:139
Int_t GetPileIndex()
Definition: PndEmcDigi.h:123
Double_t GetTheta() const
Definition: PndEmcDigi.h:110
Double_t GetPhi() const
Definition: PndEmcDigi.h:111
Takes list of PndEmcWaveform and creates PndEmcDigi.
Int_t GetEventNr() const
Definition: PndEmcDigi.h:119
Short_t GetXPad() const
Int_t fThetaInd
Definition: PndEmcDigi.h:143
Int_t fPileIndex
Definition: PndEmcDigi.h:141
Double_t fPhi
Definition: PndEmcDigi.h:146
Short_t GetYPad() const
Task to create digis from waveforms.
static TClonesArray * fDigiArrayTBD
Definition: PndEmcDigi.h:60
PndEmcTwoCoordIndex * GetTCI() const
virtual void SetDetectorId(Int_t id)
Task to create PndEmcDigi from PndEmcHit.
Module to take the hit list for the calorimeter and make ADC waveforms from them. ...
static void InitDigiArrayTBD()