CbmRoot
CbmStsParSensor.cxx
Go to the documentation of this file.
1 
6 #include "CbmStsParSensor.h"
7 
8 #include <TMath.h> // for Nint
9 
10 #include <sstream> // for operator<<, basic_ostream, stringstream
11 #include <string> // for char_traits
12 
14 
15  // ----- Constructor ---------------------------------------------------
17  : fClass(sClass) {}
18 // -------------------------------------------------------------------------
19 
20 
21 // ----- Get a parameter -----------------------------------------------
22 Float_t CbmStsParSensor::GetPar(UInt_t index) const {
23  Float_t value = 0.;
24  if (index < fPar.size()) value = fPar[index];
25  return value;
26 }
27 // -------------------------------------------------------------------------
28 
29 
30 // ----- Get the integer value of a parameter --------------------------
31 Int_t CbmStsParSensor::GetParInt(UInt_t index) const {
32  return TMath::Nint(GetPar(index));
33 }
34 // -------------------------------------------------------------------------
35 
36 
37 // ----- String output -------------------------------------------------
38 std::string CbmStsParSensor::ToString() const {
39  std::stringstream ss;
40 
41  switch (fClass) {
42  case CbmStsSensorClass::kDssdStereo: ss << "Class DssdStereo | "; break;
43  case CbmStsSensorClass::kDssdOrtho: ss << "Class DssdStereo | "; break;
44  default: ss << "Class unknown"; break;
45  } //? sensor class
46 
47  ss << "size (" << fPar[0] << " x " << fPar[1] << " x " << fPar[2]
48  << ") | active " << fPar[3] << " | strips " << fPar[4] << " / " << fPar[5]
49  << " | pitch " << fPar[6] << " / " << fPar[7] << " | stereo " << fPar[8]
50  << " / " << fPar[9];
51 
52  return ss.str();
53 }
54 // -------------------------------------------------------------------------
CbmStsParSensor.h
CbmStsParSensor::fClass
CbmStsSensorClass fClass
Definition: CbmStsParSensor.h:93
CbmStsSensorClass::kDssdOrtho
@ kDssdOrtho
CbmStsSensorClass::kDssdStereo
@ kDssdStereo
CbmStsParSensor
Constructional parameters of a STS sensor.
Definition: CbmStsParSensor.h:38
ClassImp
ClassImp(CbmStsParSensor) CbmStsParSensor
Definition: CbmStsParSensor.cxx:13
CbmStsParSensor::CbmStsParSensor
CbmStsParSensor(CbmStsSensorClass sClass=CbmStsSensorClass::kDssdStereo)
Constructor.
CbmStsSensorClass
CbmStsSensorClass
Sensor classes.
Definition: CbmStsDefs.h:61
CbmStsParSensor::GetParInt
Int_t GetParInt(UInt_t index) const
Get the nearest integer value of a parameter.
Definition: CbmStsParSensor.cxx:31
CbmStsParSensor::fPar
std::array< float, NPARAMS > fPar
Definition: CbmStsParSensor.h:94
CbmStsParSensor::GetPar
Float_t GetPar(UInt_t index) const
Get a parameter.
Definition: CbmStsParSensor.cxx:22
CbmStsParSensor::ToString
std::string ToString() const
Info to string.
Definition: CbmStsParSensor.cxx:38