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