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