CbmRoot
Loading...
Searching...
No Matches
CbmStsSensor.cxx
Go to the documentation of this file.
1/* Copyright (C) 2013-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
9#include "CbmStsSensor.h"
10
11#include <ostream> // for operator<<, stringstream, basic_ostream
12
13
14// ----- Constructor ---------------------------------------------------
15CbmStsSensor::CbmStsSensor(UInt_t address, TGeoPhysicalNode* node, CbmStsElement* mother)
16 : CbmStsElement(address, kStsSensor, node, mother)
17{
18}
19// -------------------------------------------------------------------------
20
21// ----- Get the unique address from the sensor name (static) ----------
23{
24
25 Int_t unit = 10 * (name[5] - '0') + name[6] - '0' - 1;
26 Int_t ladder = 10 * (name[9] - '0') + name[10] - '0' - 1;
27 Int_t hLadder = (name[11] == 'U' ? 0 : 1);
28 Int_t module = 10 * (name[14] - '0') + name[15] - '0' - 1;
29 Int_t sensor = 10 * (name[18] - '0') + name[19] - '0' - 1;
30
31 return CbmStsAddress::GetAddress(unit, ladder, hLadder, module, sensor);
32}
33// -------------------------------------------------------------------------
34
35
36// ----- String output -------------------------------------------------
37std::string CbmStsSensor::ToString() const
38{
39 std::stringstream ss;
40 ss << GetName() << ", address " << CbmStsAddress::ToString(fAddress);
41 return ss.str();
42}
43// -------------------------------------------------------------------------
44
ClassImp(CbmConverterManager)
@ kStsSensor
Class representing an element of the STS setup.
Int_t fAddress
Unique element address.
Class representing an instance of a sensor in the CBM-STS.
virtual std::string ToString() const
String output.
static UInt_t GetAddressFromName(TString name)
Get the address from the sensor name (static)
CbmStsSensor(UInt_t address=0, TGeoPhysicalNode *node=nullptr, CbmStsElement *mother=nullptr)
int32_t GetAddress(uint32_t unit=0, uint32_t ladder=0, uint32_t halfladder=0, uint32_t module=0, uint32_t sensor=0, uint32_t side=0, uint32_t version=kCurrentVersion)
Construct address.
std::string ToString(int32_t address)
String output.