BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
CbmStsDigiLight.cxx
Go to the documentation of this file.
1/** CbmStsDigiLight.cxx
2 **@author V.Friese <v.friese@gsi.de>
3 **@since 28.08.2006
4 **@version 2.0
5 **/
6
7#include "CbmStsDigiLight.h"
8
9// ----- Bit fields for charge and time stamp --------------------------
10const Int_t CbmStsDigiLight::fgkCharBits = 12; // in data0
11const Int_t CbmStsDigiLight::fgkTimeBits = 14; // in data1
14// -------------------------------------------------------------------------
15
16// ----- Bit shift for charge and time stamp ---------------------------
19// -------------------------------------------------------------------------
20
21// ----- Bit masks for charge and time stamp ---------------------------
25// -------------------------------------------------------------------------
26
27// ----- Default constructor -------------------------------------------
33// -------------------------------------------------------------------------
34
35// ----- Standard constructor ------------------------------------------
36// CbmStsDigiLight::CbmStsDigiLight(Int_t station, Int_t sector, Int_t side,
37// Int_t channel, Int_t adc, Int_t time)
38// : FairMultiLinkedData(),
39// CbmStsDetectorId(),
40// fData(0)
41// {
42// AddIndex(index);
43// fData = ( (DetectorId(station, sector, side, channel) >> 4) & fgkAddrMask )
44// | ( (adc & fgkCharMask) << fgkCharShift )
45// | ( (time & fgkTimeMask) << fgkTimeShift ) ;
46//
47// }
48// -------------------------------------------------------------------------
49CbmStsDigiLight::CbmStsDigiLight(Int_t station, Int_t sector, Int_t side, Int_t channel, Int_t adc, Int_t time)
50 : CbmDigi()
52 , fData(0)
53{
54 // AddIndex(index,adc);
55 fData = ((DetectorId(station, sector, side, channel) >> 4) & fgkAddrMask) | ((adc & fgkCharMask) << fgkCharShift)
56 | ((time & fgkTimeMask) << fgkTimeShift);
57}
58
59// ----- Destructor ----------------------------------------------------
61// -------------------------------------------------------------------------
62
63// ----- Add charge ----------------------------------------------------
65{
66 Int_t maxAdc = (1 << fgkCharBits) - 1;
67 Int_t newAdc = GetAdc() + adc;
68 if (newAdc > maxAdc)
69 newAdc = maxAdc;
70 SetAdc(newAdc);
71}
72// -------------------------------------------------------------------------
73
74// ----- Set new charge ------------------------------------------------
76{
77
78 // First set old charge to zero
80
81 // Now set new charge
82 fData = fData | ((adc & fgkCharMask) << fgkCharShift);
83}
84// -------------------------------------------------------------------------
int Int_t
long long Long64_t
DetectorId
BM@N DetectorID enumerator.
CbmDigi()
Default constructor.
Definition CbmDigi.cxx:13
static const Int_t fgkSideBits
static const Int_t fgkStatBits
Number of bits for address fields (static).
static const Int_t fgkSectBits
static const Int_t fgkChanBits
CbmStsDetectorId()
Constructor (empty).
void AddAdc(Int_t adc)
Add charge.
Long64_t fData
Data members.
static const Int_t fgkAddrBits
Static members for bit operations.
static const Long64_t fgkAddrMask
static const Int_t fgkTimeShift
static const Long64_t fgkCharMask
static const Int_t fgkCharShift
Int_t GetAdc() const
Charge.
void SetAdc(Int_t charge)
Modifiers.
CbmStsDigiLight()
Default constructor.
static const Int_t fgkTimeBits
static const Int_t fgkCharBits
CbmStsDigiLight.cxx.
virtual ~CbmStsDigiLight()
Destructor.
static const Long64_t fgkTimeMask