CbmRoot
Loading...
Searching...
No Matches
CbmTrdParSetDigi.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer], Alexandru Bercuci */
4
5#include "CbmTrdParSetDigi.h"
6
7#include "CbmTrdParMod.h" // for CbmTrdParMod
8#include "CbmTrdParModDigi.h" // for CbmTrdParModDigi
9
10#include <FairParamList.h> // for FairParamList
11#include <Logger.h> // for LOG, Severity, Severity::debug
12
13#include <TArrayD.h> // for TArrayD
14#include <TArrayI.h> // for TArrayI
15#include <TString.h> // for TString, Form
16
17#include <map> // for map, map<>::iterator, operator!=, __m...
18#include <utility> // for pair
19
20CbmTrdParSetDigi::CbmTrdParSetDigi(const char* name, const char* title, const char* context)
21 : CbmTrdParSet(name, title, context)
22
23{
24}
25
26//_______________________________________________________________________________
27Bool_t CbmTrdParSetDigi::getParams(FairParamList* l)
28{
29 if (!l) return kFALSE;
30 if (!l->fill("NrOfModules", &fNrOfModules)) {
31 LOG(error) << GetName() << "::getParams : Couldn't find \"NrOfModules\"";
32 return kFALSE;
33 }
34 Int_t maxSectors(0);
35 if (!l->fill("MaxSectors", &maxSectors)) {
36 LOG(error) << GetName() << "::getParams : Couldn't find \"MaxSectors\"";
37 return kFALSE;
38 }
39 TArrayI moduleId(fNrOfModules);
40 if (!l->fill("ModuleIdArray", &moduleId)) {
41 LOG(error) << GetName() << "::getParams : Couldn't find \"MaxSectors\"";
42 return kFALSE;
43 }
44 // Instead of a fixed number of values the number of values to
45 // store now depends on the maximum number of sectors per module
46 Int_t nrValues = 10 + (maxSectors * 4);
47 TArrayD values(nrValues);
48 TArrayD sectorSizeX(maxSectors);
49 TArrayD sectorSizeY(maxSectors);
50 TArrayD padSizeX(maxSectors);
51 TArrayD padSizeY(maxSectors);
52 Int_t orientation;
53 Double_t x;
54 Double_t y;
55 Double_t z;
56 Double_t sizex;
57 Double_t sizey;
58 Double_t sizez;
59 Double_t awPitch(-1.);
60 Double_t awPP(-1.);
61 Double_t awOff(-1.);
62 // Int_t roType(0);
63
64 TString text;
65 for (Int_t i = 0; i < fNrOfModules; i++) {
66 if (!l->fill(Form("%d", moduleId[i]), &values)) {
67 LOG(error) << GetName() << "::getParams : Missing parameter definiton for module " << moduleId[i];
68 continue;
69 }
70 Int_t k(0);
71 orientation = values[k++];
72 // roType=values[k++];
73 awPitch = values[k++];
74 awPP = values[k++];
75 awOff = values[k++];
76 x = values[k++];
77 y = values[k++];
78 z = values[k++];
79 sizex = values[k++];
80 sizey = values[k++];
81 sizez = values[k++];
82 for (Int_t j = 0; j < maxSectors; j++) {
83 sectorSizeX.AddAt(values[k++], j);
84 sectorSizeY.AddAt(values[k++], j);
85 padSizeX.AddAt(values[k++], j);
86 padSizeY.AddAt(values[k++], j);
87 }
88 fModuleMap[moduleId[i]] = new CbmTrdParModDigi(x, y, z, sizex, sizey, sizez, maxSectors, orientation, sectorSizeX,
89 sectorSizeY, padSizeX, padSizeY);
90 fModuleMap[moduleId[i]]->SetModuleId(moduleId[i]);
91 ((CbmTrdParModDigi*) fModuleMap[moduleId[i]])->SetAnodeWireToPadPlaneDistance(awPP); //>0?awPP:0.35);
92 ((CbmTrdParModDigi*) fModuleMap[moduleId[i]])->SetAnodeWireOffset(awOff); //>0?awOff:0.375);
93 ((CbmTrdParModDigi*) fModuleMap[moduleId[i]])->SetAnodeWireSpacing(awPitch); //>0?awPitch:0.25);
94 if (fair::Logger::Logging(fair::Severity::debug)) fModuleMap[moduleId[i]]->Print();
95 }
96 return kTRUE;
97}
98
99//_____________________________________________________________________
100void CbmTrdParSetDigi::putParams(FairParamList* l)
101{
121 if (!l) return;
122 LOG(info) << GetName() << "::putParams(FairParamList*)";
123
124 Int_t maxSectors(0), idx(0);
125 TArrayI moduleIdArray(fNrOfModules);
126 for (std::map<Int_t, CbmTrdParMod*>::iterator imod = fModuleMap.begin(); imod != fModuleMap.end(); imod++) {
127 moduleIdArray[idx++] = imod->first;
128 Int_t sectors = ((CbmTrdParModDigi*) imod->second)->GetNofSectors();
129 if (sectors > maxSectors) maxSectors = sectors;
130 }
131
132 l->add("NrOfModules", fNrOfModules);
133 l->add("MaxSectors", maxSectors);
134 l->add("ModuleIdArray", moduleIdArray);
135
136
137 Int_t nrValues = 10 + (maxSectors * 4);
138 TArrayD values(nrValues);
139 CbmTrdParModDigi* mod(nullptr);
140 for (Int_t i = 0; i < fNrOfModules; i++) {
141 Int_t k(0);
142 mod = (CbmTrdParModDigi*) fModuleMap[moduleIdArray[i]];
143 values.AddAt(mod->GetOrientation(), k++);
144 // Int_t roType(0);
145 // if(mod->GetPadGeoTriangular()) roType |= 1;
146 // if(mod->GetAsicFASP()) roType |= 2;
147 // values.AddAt(roType, k++);
148 values.AddAt(mod->GetAnodeWireSpacing(), k++);
149 values.AddAt(mod->GetAnodeWireToPadPlaneDistance(), k++);
150 values.AddAt(mod->GetAnodeWireOffset(), k++);
151 values.AddAt(mod->GetX(), k++);
152 values.AddAt(mod->GetY(), k++);
153 values.AddAt(mod->GetZ(), k++);
154 values.AddAt(mod->GetSizeX(), k++);
155 values.AddAt(mod->GetSizeY(), k++);
156 values.AddAt(mod->GetSizeZ(), k++);
157 for (Int_t j = 0; j < maxSectors; j++) {
158 values.AddAt(mod->GetSectorSizeX(j), k++);
159 values.AddAt(mod->GetSectorSizeY(j), k++);
160 values.AddAt(mod->GetPadSizeX(j), k++);
161 values.AddAt(mod->GetPadSizeY(j), k++);
162 }
163
164 TString text;
165 text += moduleIdArray[i];
166 l->add(text.Data(), values);
167 }
168}
169
ClassImp(CbmConverterManager)
Definition of chamber gain conversion for one TRD module.
Double_t GetSectorSizeX(Int_t i) const
Double_t GetX() const
Double_t GetSizeY() const
Int_t GetOrientation() const
Double_t GetAnodeWireSpacing() const
Double_t GetPadSizeY(Int_t i) const
Double_t GetSizeZ() const
Double_t GetSectorSizeY(Int_t i) const
Double_t GetAnodeWireOffset() const
Double_t GetPadSizeX(Int_t i) const
Double_t GetAnodeWireToPadPlaneDistance() const
Double_t GetZ() const
Double_t GetSizeX() const
Double_t GetY() const
Bool_t getParams(FairParamList *)
void putParams(FairParamList *)
CbmTrdParSetDigi(const char *name="CbmTrdParSetDigi", const char *title="TRD chamber parameters", const char *context="Default")
std::map< Int_t, CbmTrdParMod * > fModuleMap
Int_t fNrOfModules
no of modules in the current run