CbmRoot
CbmStsParModule.cxx
Go to the documentation of this file.
1 
5 #include "CbmStsParModule.h"
6 
7 #include <cassert> // for assert
8 #include <iostream> // for operator<<, basic_ostream, stringstream
9 #include <sstream> // for stringstream
10 #include <string> // for char_traits
11 
12 using std::string;
13 using std::stringstream;
14 
16 
17 
18  // ----- Constructor ---------------------------------------------------
19  CbmStsParModule::CbmStsParModule(UInt_t nChannels, UInt_t nAsicChannels)
20  : fNofChannels(nChannels), fNofAsicChannels(nAsicChannels) {
21  UInt_t nAsics = (nChannels % nAsicChannels ? nChannels / nAsicChannels + 1
22  : nChannels / nAsicChannels);
23  fAsicPars.resize(nAsics);
24 }
25 // -------------------------------------------------------------------------
26 
27 
28 // ----- Get ASIC parameters -------------------------------------------
29 const CbmStsParAsic& CbmStsParModule::GetParAsic(UInt_t channel) const {
30  assert(!fAsicPars.empty());
31  assert(channel < fNofChannels);
32  UInt_t nAsic = channel / fNofAsicChannels;
33  assert(nAsic < GetNofAsics());
34  return fAsicPars[nAsic];
35 }
36 // -------------------------------------------------------------------------
37 
38 
39 // ----- Check for a chennel being active ------------------------------
40 Bool_t CbmStsParModule::IsChannelActive(UInt_t channel) const {
41  const CbmStsParAsic& parAsic = GetParAsic(channel);
42  UShort_t asicChannel = channel % fNofAsicChannels;
43  return parAsic.IsChannelActive(asicChannel);
44 }
45 // -------------------------------------------------------------------------
46 
47 
48 // ----- Set parameters for all ASICs ----------------------------------
50  for (auto& par : fAsicPars) {
51  par = asicPar;
52  par.Init();
53  }
54 }
55 // -------------------------------------------------------------------------
56 
57 
58 // ----- String output -------------------------------------------------
59 string CbmStsParModule::ToString() const {
60  stringstream ss;
61  ss << "Channels " << fNofChannels << " | ASICS " << GetNofAsics()
62  << " | Channels per ASIC " << fNofAsicChannels;
63  return ss.str();
64 }
65 // -------------------------------------------------------------------------
CbmStsParModule::IsChannelActive
Bool_t IsChannelActive(UInt_t channel) const
Check for a channel being active.
Definition: CbmStsParModule.cxx:40
CbmStsParModule::fAsicPars
std::vector< CbmStsParAsic > fAsicPars
ASIC parameters.
Definition: CbmStsParModule.h:97
CbmStsParModule::CbmStsParModule
CbmStsParModule()
Default constructor.
Definition: CbmStsParModule.h:32
CbmStsParModule::SetAllAsics
void SetAllAsics(const CbmStsParAsic &asicPar)
Set all ASICs with the same parameter set.
Definition: CbmStsParModule.cxx:49
CbmStsParModule::GetNofAsics
UInt_t GetNofAsics() const
Number of ASICs.
Definition: CbmStsParModule.h:68
CbmStsParModule::fNofAsicChannels
UInt_t fNofAsicChannels
Number of channels per ASIC.
Definition: CbmStsParModule.h:96
CbmStsParModule::GetParAsic
const CbmStsParAsic & GetParAsic(UInt_t channel) const
ASIC parameters for a given channel.
Definition: CbmStsParModule.cxx:29
CbmStsParAsic
Parameters of the STS readout ASIC.
Definition: CbmStsParAsic.h:25
CbmStsParModule
Parameters for one STS module.
Definition: CbmStsParModule.h:28
CbmStsParModule.h
CbmStsParModule::fNofChannels
UInt_t fNofChannels
Number of readout channels.
Definition: CbmStsParModule.h:95
ClassImp
ClassImp(CbmStsParModule) CbmStsParModule
Definition: CbmStsParModule.cxx:15
CbmStsParModule::ToString
std::string ToString() const
String output.
Definition: CbmStsParModule.cxx:59
CbmStsParAsic::Init
void Init()
Initialisation.
Definition: CbmStsParAsic.cxx:89
CbmStsParAsic::IsChannelActive
Bool_t IsChannelActive(UShort_t channel) const
Check for a channel being active.
Definition: CbmStsParAsic.h:157