CbmRoot
CbmMvdDigi.cxx
Go to the documentation of this file.
1 // -----------------------------------------------------------------------
2 // ----- CbmMvdDigi source file -----
3 // ----- Created 17/04/08 by C. Dritsa -----
4 // -----------------------------------------------------------------------
5 
6 #include "CbmMvdDigi.h"
7 
8 #include <FairLogger.h> // for LOG, Logger
9 
10 #include <TMath.h> // for Power
11 #include <TObject.h> // for TObject
12 
13 // ----- Default constructor -------------------------------------------
15  : TObject()
17  , fCharge(0.)
18  , fChannelNrX(0)
19  , fChannelNrY(0)
20  , fTrackID(-1)
21  , fPointID(0)
22  , fPixelSizeX(0.)
23  , fPixelSizeY(0.)
24  , fDetectorId(0)
25  , fChannelNr(0)
26  , fDigiTime(0.)
27  , fFrameNumber(0)
28  , fRefId(-1)
29  , fDigiFlag(-1) {}
30 // -------------------------------------------------------------------------
31 
32 
33 /*
34 // ----- Constructor with parameters -----------------------------------
35 CbmMvdDigi::CbmMvdDigi(Int_t iStation, Int_t iChannelNrX, Int_t iChannelNrY, Float_t charge,
36  Float_t pixelSizeX, Float_t pixelSizeY)
37  : CbmDigi(kMVD, 0),
38  CbmMvdDetectorId(),
39  fCharge(charge),
40  fChannelNrX(iChannelNrX),
41  fChannelNrY(iChannelNrY),
42  fTrackID(-1),
43  fPointID(0),
44  fPixelSizeX(pixelSizeX),
45  fPixelSizeY(pixelSizeY),
46  fDetectorId(0),
47  fChannelNr(0),
48  fDigiTime(0.),
49  fFrameNumber(0),
50  fRefId(-1),
51  fDigiFlag(-1)
52 {
53  // Check range for station
54  if ( ! ( iStation >= 0 && iStation <= 255 ) ) {
55  LOG(fatal) << "Illegal station number " << iStation;
56  }
57 
58  fDetectorId = DetectorId(iStation);
59 
60  fChannelNrY = iChannelNrY;
61  fCharge = charge;
62  fChannelNrX=iChannelNrX;
63  fChannelNrY=iChannelNrY;
64  fPixelSizeX=pixelSizeX;
65  fPixelSizeY=pixelSizeY;
66  fDigiFlag=-1;
67 
68 }
69 // -------------------------------------------------------------------------
70 */
71 
72 // ----- Constructor with parameters --> used only due to error TODO include correct version -----------------------------------
73 CbmMvdDigi::CbmMvdDigi(Int_t iStation,
74  Int_t iChannelNrX,
75  Int_t iChannelNrY,
76  Float_t charge,
77  Float_t pixelSizeX,
78  Float_t pixelSizeY,
79  Float_t time,
80  Int_t frame)
81  : TObject()
83  , fCharge(charge)
84  , fChannelNrX(iChannelNrX)
85  , fChannelNrY(iChannelNrY)
86  , fTrackID(0)
87  , fPointID(0)
88  , fPixelSizeX(pixelSizeX)
89  , fPixelSizeY(pixelSizeY)
90  , fDetectorId(DetectorId(iStation))
91  , fChannelNr(0)
92  , fDigiTime(time)
93  , fFrameNumber(frame)
94  , fRefId(-1)
95  , fDigiFlag(-1) {
96  // Check range for station
97  if (!(iStation >= 0 && iStation <= 600)) {
98  LOG(fatal) << "Illegal station number " << iStation;
99  }
100 }
101 // -------------------------------------------------------------------------
102 
103 Int_t CbmMvdDigi::GetAdcCharge(Int_t adcDynamic,
104  Int_t adcOffset,
105  Int_t adcBits) {
118  Int_t adcCharge;
119 
120  if (fCharge < adcOffset) { return 0; };
121 
122 
123  Double_t stepSize;
124  // Int_t adcMax = adcOffset + adcDynamic;
125 
126  stepSize = adcDynamic / TMath::Power(2, adcBits);
127  adcCharge = int((fCharge - adcOffset) / stepSize);
128 
129 
130  if (adcCharge > int(TMath::Power(2, adcBits) - 1)) {
131  adcCharge = (int) TMath::Power(2, adcBits) - 1;
132  }
133 
134  if (gDebug > 0) { LOG(debug) << "CbmMvdDigi::GetAdcCharge() " << adcCharge; }
135 
136  return adcCharge;
137 }
138 
139 
140 // -------------------------------------------------------------------------
142 // -------------------------------------------------------------------------
144 // -------------------------------------------------------------------------
145 
147 Int_t CbmMvdDigi::GetAddress() const { return 0; }
148 
149 // -------------------------------------------------------------------------
150 
152 Double_t CbmMvdDigi::GetTime() const { return fDigiTime; }
153 
154 
155 // -------------------------------------------------------------------------
156 
157 
158 // ----- Destructor ----------------------------------------------------
160 // -------------------------------------------------------------------------
161 
CbmMvdDetectorId
Definition: CbmMvdDetectorId.h:32
CbmMvdDigi::GetPixelY
Int_t GetPixelY()
Definition: CbmMvdDigi.cxx:143
CbmMvdDigi::GetAdcCharge
Int_t GetAdcCharge(Int_t adcDynamic, Int_t adcOffset, Int_t adcBits)
Definition: CbmMvdDigi.cxx:103
CbmMvdDigi::GetTime
Double_t GetTime() const
Definition: CbmMvdDigi.cxx:152
CbmMvdDigi.h
CbmMvdDigi::GetAddress
Int_t GetAddress() const
Definition: CbmMvdDigi.cxx:147
CbmMvdDigi::fDigiTime
Double_t fDigiTime
Definition: CbmMvdDigi.h:96
CbmMvdDigi::fChannelNrX
Int_t fChannelNrX
Definition: CbmMvdDigi.h:88
CbmMvdDigi::fChannelNrY
Int_t fChannelNrY
Definition: CbmMvdDigi.h:89
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMvdDigi
Definition: CbmMvdDigi.h:21
CbmMvdDigi::fCharge
Float_t fCharge
Definition: CbmMvdDigi.h:87
CbmMvdDigi::GetPixelX
Int_t GetPixelX()
Definition: CbmMvdDigi.cxx:141
CbmMvdDigi::~CbmMvdDigi
~CbmMvdDigi()
Definition: CbmMvdDigi.cxx:159
CbmMvdDigi::CbmMvdDigi
CbmMvdDigi()
Definition: CbmMvdDigi.cxx:14