CbmRoot
Loading...
Searching...
No Matches
CbmMuchTrackingInterface.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 CbmMuchTrackingInterface.cxx
7 * @brief Input data and parameters interface from MuCh subsystem used in L1 tracker (definition)
8 * @since 31.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
19
20 // ---------------------------------------------------------------------------------------------------------------------
21 //
23 : FairTask("CbmMuchTrackingInterface")
24{
25 if (!fpInstance) { fpInstance = this; }
26}
27
28// ---------------------------------------------------------------------------------------------------------------------
29//
34
35// ---------------------------------------------------------------------------------------------------------------------
36//
38{
39 LOG(info) << "\033[1;33mCALL CbmMuchTrackingInterface::Init()\033[0m";
40
42 if (!fGeoScheme) { LOG(fatal) << "CbmMuchTrackingInterface::Init: CbmMuchGeoScheme instance is nullptr"; }
43
44 // Check initialization of the MuCh digi parameters file
45 if (!fGeoScheme->IsInitialized()) {
46 LOG(error) << "CbmMuchTrackingInterface::Init: MuCh digi parameters were not initialized\n"
47 << "\033[4;1;32mNOTE\033[0m: For the MuCh digi parameters initialization please place the following "
48 << "code to your macro:\n"
49 << "\n\t// ----- MuCh digi parameters initialization --------------------------------------"
50 << "\n\tif (CbmSetup::Instance()->IsActive(ECbmModuleId::kMuch)) {"
51 << "\n\t // Parameter file name"
52 << "\n\t TString geoTag;"
53 << "\n\t CbmSetup::Instance()->GetGeoTag(ECbmModuleId::kMuch, geoTag);"
54 << "\n\t Int_t muchFlag = (geoTag.Contains(\"mcbm\") ? 1 : 0);"
55 << "\n\t TString parFile = gSystem->Getenv(\"VMCWORKDIR\");"
56 << "\n\t parFile += \"/parameters/much/much_\" + geoTag(0, 4) + \"_digi_sector.root\";"
57 << "\n\t"
58 << "\n\t // Initialization of the geometry scheme"
59 << "\n\t auto muchGeoScheme = CbmMuchGeoScheme::Instance();"
60 << "\n\t if (!muchGeoScheme->IsInitialized()) { muchGeoScheme->Init(parFile, muchFlag); }"
61 << "\n\t}"
62 << "\n\t// --------------------------------------------------------------------------------";
63 return kFATAL;
64 }
65
66 // Keep Track of how many layers are present in each station (may be heterogenous)
67 for (int iMuchSt = 0, iFirstLayer = 0; iMuchSt < fGeoScheme->GetNStations(); ++iMuchSt) {
68 fFirstTrackingStation.push_back(iFirstLayer);
69 iFirstLayer += fGeoScheme->GetStation(iMuchSt)->GetNLayers();
70 }
71
72 int nStations{0};
73 for (int iMuchSt = 0; iMuchSt < fGeoScheme->GetNStations(); ++iMuchSt) {
74 nStations += fGeoScheme->GetStation(iMuchSt)->GetNLayers();
75 }
76 fvStationFullVolume.clear();
77 // FIXME: Provide
78 fvStationFullVolume.reserve(nStations);
79 for (int iSt = 0; iSt < nStations; ++iSt) {
80 auto* pLayer{GetMuchLayer(iSt)};
81 fvStationFullVolume.emplace_back(-100., +100, -100., +100, pLayer->GetZ() - 0.5 * pLayer->GetDz(),
82 pLayer->GetZ() + 0.5 * pLayer->GetDz());
83 }
84
86
87 // Check the validity of the parameters
88 if (!this->Check()) {
89 LOG(error)
90 << "Some errors occurred in the tracking detector interface initialization for MuCh (see information above)";
91 return kFATAL;
92 }
93
94 return kSUCCESS;
95}
96
97// ---------------------------------------------------------------------------------------------------------------------
98//
100{
101 this->SetParContainers();
102 return Init();
103}
104
105// ---------------------------------------------------------------------------------------------------------------------
106//
108
109
110// ---------------------------------------------------------------------------------------------------------------------
111//
112std::pair<int, int> CbmMuchTrackingInterface::ConvTrackingStationId2MuchId(int traStationId) const
113{
114 int muchStation = fFirstTrackingStation.size() - 1;
115 while (muchStation > 0 && (fFirstTrackingStation[muchStation] > traStationId)) {
116 muchStation--;
117 }
118 int muchLayer = traStationId - fFirstTrackingStation[muchStation];
119 return std::pair(muchStation, muchLayer);
120}
ClassImp(CbmMuchTrackingInterface) CbmMuchTrackingInterface
CbmMuchStation * GetStation(Int_t iStation) const
static CbmMuchGeoScheme * Instance()
Int_t GetNStations() const
Int_t GetNLayers() const
A CbmL1 subtask, which provides necessary methods for L1 tracker to access the geometry and dataflow ...
static CbmMuchTrackingInterface * fpInstance
Instance of the class.
CbmMuchGeoScheme * fGeoScheme
MuCh geometry scheme instance.
std::pair< int, int > ConvTrackingStationId2MuchId(int traStationId) const
Calculates MuCh station ID from tracker station ID.
InitStatus ReInit() override
FairTask: ReInit method.
CbmMuchTrackingInterface()
Default constructor.
void SetParContainers() override
FairTask: sets parameter containers up.
InitStatus Init() override
FairTask: Init method.
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.