CbmRoot
Loading...
Searching...
No Matches
CbmStsTrackingInterface.cxx
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov, Sergei Zharko [committer] */
4
5/***************************************************************************************************
6 * @file CbmStsTrackingInterface.cxx
7 * @brief Input data and parameters interface from STS subsystem used in L1 tracker (definition)
8 * @since 27.05.2022
9 * @author S.Zharko <s.zharko@gsi.de>
10 ***************************************************************************************************/
11
13
14#include "FairDetector.h"
15#include "FairRunAna.h"
16#include <Logger.h>
17
18#include "TGeoPhysicalNode.h"
19
21
22 // ---------------------------------------------------------------------------------------------------------------------
23 //
25 : FairTask("CbmStsTrackingInterface")
26{
27 if (!fpInstance) { fpInstance = this; }
28}
29
30// ---------------------------------------------------------------------------------------------------------------------
31//
36
37// ---------------------------------------------------------------------------------------------------------------------
38//
39std::tuple<double, double> CbmStsTrackingInterface::GetStereoAnglesSensor(int address) const
40{
42
43 const CbmStsSensor* sensor =
45
46 assert(sensor);
47
48 const TGeoPhysicalNode* node = sensor->GetNode();
49 assert(node);
50 const CbmStsParSensor* param = sensor->GetParams();
51 assert(param);
52
53 double angleF = param->GetPar(8) * TMath::DegToRad();
54 double angleB = param->GetPar(9) * TMath::DegToRad();
55
56 const TGeoHMatrix* matrix = node->GetMatrix();
57
58 if (matrix) {
59 TGeoRotation rot(*matrix);
60 {
61 Double_t local[3] = {TMath::Cos(angleF), TMath::Sin(angleF), 0.};
62 Double_t global[3];
63 rot.LocalToMaster(local, global);
64 angleF = TMath::ATan2(global[1], global[0]);
65 }
66 {
67 Double_t local[3] = {TMath::Cos(angleB), TMath::Sin(angleB), 0.};
68 Double_t global[3];
69 rot.LocalToMaster(local, global);
70 angleB = TMath::ATan2(global[1], global[0]);
71 }
72 }
73
74 return std::tuple(angleF, angleB);
75}
76
77// ---------------------------------------------------------------------------------------------------------------------
78//
80{
81 // Check, if all the necessary parameter containers were found
82 if (!fStsParSetModule) { return kFATAL; }
83 if (!fStsParSetSensor) { return kFATAL; }
84 if (!fStsParSetSensorCond) { return kFATAL; }
85
86 // Initialize CbmStsSetup instance
87 auto stsSetup = CbmStsSetup::Instance();
88 if (!stsSetup->IsInit()) { stsSetup->Init(nullptr); }
89 if (!stsSetup->IsModuleParsInit()) { stsSetup->SetModuleParameters(fStsParSetModule); }
90 if (!stsSetup->IsSensorParsInit()) { stsSetup->SetSensorParameters(fStsParSetSensor); }
91 if (!stsSetup->IsSensorCondInit()) { stsSetup->SetSensorConditions(fStsParSetSensorCond); }
92
93 int nStations = CbmStsSetup::Instance()->GetNofStations();
94 fvStationFullVolume.clear();
95 fvStationFullVolume.reserve(nStations);
96 for (int iSt = 0; iSt < nStations; ++iSt) {
97 const auto* pStsStation{CbmStsSetup::Instance()->GetStation(iSt)};
98 if constexpr (!kLegacy) {
99 fvStationFullVolume.emplace_back(pStsStation->GetXmin(), pStsStation->GetXmax(), pStsStation->GetYmin(),
100 pStsStation->GetYmax(), pStsStation->GetZmin(), pStsStation->GetZmax());
101 }
102 else {
103 fvStationFullVolume.emplace_back(pStsStation->GetXmin(), pStsStation->GetXmax(), pStsStation->GetYmin(),
104 pStsStation->GetYmax(), pStsStation->GetZ() - 2., pStsStation->GetZ() + 2.);
105 }
106 }
108
109
110 // Check the validity of the parameters
111 if (!this->Check()) {
112 LOG(error)
113 << "Some errors occurred in the tracking detector interface initialization for STS (see information above)";
114 return kFATAL;
115 }
116
117 return kSUCCESS;
118}
119
120// ---------------------------------------------------------------------------------------------------------------------
121//
123{
124 this->SetParContainers();
125 return Init();
126}
127
128// ---------------------------------------------------------------------------------------------------------------------
129//
131{
132 auto runtimeDb = FairRunAna::Instance()->GetRuntimeDb();
133 fStsParSetModule = dynamic_cast<CbmStsParSetModule*>(runtimeDb->getContainer("CbmStsParSetModule"));
134 fStsParSetSensor = dynamic_cast<CbmStsParSetSensor*>(runtimeDb->getContainer("CbmStsParSetSensor"));
135 fStsParSetSensorCond = dynamic_cast<CbmStsParSetSensorCond*>(runtimeDb->getContainer("CbmStsParSetSensorCond"));
136 if (!fStsParSetModule) {
137 LOG(fatal) << "CbmStsTrackingInterface::SetParContainers: error accessing to CbmStsParSetModule container";
138 }
139 if (!fStsParSetSensor) {
140 LOG(fatal) << "CbmStsTrackingInterface::SetParContainers: error accessing to CbmStsParSetSensor container";
141 }
143 LOG(fatal) << "CbmStsTrackingInterface::SetParContainers: error accessing to CbmStsParSetSensorCond container";
144 }
145}
146
@ kStsSensor
ClassImp(CbmStsTrackingInterface) CbmStsTrackingInterface
Constructional parameters of a STS sensor.
Float_t GetPar(UInt_t index) const
Get a parameter.
Parameters container for CbmStsParModule.
Parameters container for CbmStsParSensorCond.
Parameters container for CbmStsParSensor.
Class representing an instance of a sensor in the CBM-STS.
const CbmStsParSensor * GetParams() const
Sensor parameters.
TGeoPhysicalNode * GetNode() const
CbmStsElement * GetElement(Int_t address, Int_t level)
Int_t GetNofStations() const
Definition CbmStsSetup.h:94
static CbmStsSetup * Instance()
CbmStsStation * GetStation(Int_t stationId) const
A CbmL1 subtask, which provides necessary methods for CA tracker to access the geometry and dataflow ...
CbmStsTrackingInterface()
Default constructor.
InitStatus ReInit() override
FairTask: ReInit method.
CbmStsParSetModule * fStsParSetModule
InitStatus Init() override
FairTask: Init method.
CbmStsParSetSensorCond * fStsParSetSensorCond
void SetParContainers() override
FairTask: sets parameter containers up.
static CbmStsTrackingInterface * fpInstance
std::tuple< double, double > GetStereoAnglesSensor(int address) const override
Gets stereo angles of the two independent measured coordinates.
CbmStsParSetSensor * fStsParSetSensor
std::vector< VolumeInfo > fvStationFullVolume
Geometric properties of each station passive volume.
std::vector< VolumeInfo > fvStationActiveVolume
Geometric properties of each station active volume.
bool Check() const
Checks detector interface: boundary conditions of the parameters.
static constexpr bool kLegacy
If use legacy tracking detector interface definition FIXME: Remove after testing.