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