FairRoot/PandaRoot
PndLmdAlignPar.cxx
Go to the documentation of this file.
1 #include <iostream>
2 #include "PndLmdAlignPar.h"
3 #include "FairParamList.h"
4 #include "TMath.h"
5 #include "TString.h"
6 PndLmdAlignPar::PndLmdAlignPar(const char* name, const char* title, const char* context)
7  : FairParGenericSet(name,title,context),fshift_x(0),fshift_y(0),fshift_z(0),frotate_x(0),frotate_y(0),frotate_z(0)
8 {
9  clear();
10 }
11 
12 void PndLmdAlignPar::putParams(FairParamList* list)
13 {
14  if(!list) return;
15  list->add("num_halfs", (Int_t)fhalfs);
16  list->add("num_planes", (Int_t)fplanes);
17  list->add("num_modules", (Int_t)fmodules);
18  list->add("num_sensors", (Int_t)fsensors);
19  list->add("num_sides", (Int_t)fsides);
20  for (int ihalf = 0; ihalf < fhalfs; ihalf++){ // loop over detector halves
21  for (int iplane = 0; iplane < fplanes; iplane++){ // loop over planes
22  for (int imodule = 0; imodule < fmodules; imodule++){ // loop over modules
23  int curpos = (ihalf*fplanes*fmodules)+(iplane*fmodules)+imodule;
24  TString name_shx = "shift_x_";
25  name_shx +=ihalf;
26  name_shx +="_";
27  name_shx +=iplane;
28  name_shx +="_";
29  name_shx +=imodule;
30  list->add(name_shx, (Double_t)fshift_x[curpos]);
31  TString name_shy = "shift_y_";
32  name_shy +=ihalf;
33  name_shy +="_";
34  name_shy +=iplane;
35  name_shy +="_";
36  name_shy +=imodule;
37  list->add(name_shy, (Double_t)fshift_y[curpos]);
38  TString name_shz = "shift_z_";
39  name_shz +=ihalf;
40  name_shz +="_";
41  name_shz +=iplane;
42  name_shz +="_";
43  name_shz +=imodule;
44  list->add(name_shz, (Double_t)fshift_z[curpos]);
45  TString name_rotx = "rotate_x_";
46  name_rotx +=ihalf;
47  name_rotx +="_";
48  name_rotx +=iplane;
49  name_rotx +="_";
50  name_rotx +=imodule;
51  list->add(name_rotx, (Double_t)frotate_x[curpos]);
52  TString name_roty = "rotate_y_";
53  name_roty +=ihalf;
54  name_roty +="_";
55  name_roty +=iplane;
56  name_roty +="_";
57  name_roty +=imodule;
58  list->add(name_roty, (Double_t)frotate_y[curpos]);
59  TString name_rotz = "rotate_z_";
60  name_rotz +=ihalf;
61  name_rotz +="_";
62  name_rotz +=iplane;
63  name_rotz +="_";
64  name_rotz +=imodule;
65  list->add(name_rotz, (Double_t)frotate_z[curpos]);
66  }
67  }
68  }
69 }
70 
71 Bool_t PndLmdAlignPar::getParams(FairParamList* list)
72 {
73  if (!list) return kFALSE;
74  if (!list->fill("num_halfs", &fhalfs)) return kFALSE;
75  if (!list->fill("num_planes", &fplanes)) return kFALSE;
76  if (!list->fill("num_modules", &fmodules)) return kFALSE;
77  if (!list->fill("num_sensors", &fsensors)) return kFALSE;
78  if (!list->fill("num_sides", &fsides)) return kFALSE;
79 
80  fshift_x.resize(fhalfs*fplanes*fmodules,0);
81  fshift_y.resize(fhalfs*fplanes*fmodules,0);
82  fshift_z.resize(fhalfs*fplanes*fmodules,0);
83  frotate_x.resize(fhalfs*fplanes*fmodules,0);
84  frotate_y.resize(fhalfs*fplanes*fmodules,0);
85  frotate_z.resize(fhalfs*fplanes*fmodules,0);
86 
87  for (int ihalf = 0; ihalf < fhalfs; ihalf++){ // loop over detector halves
88  for (int iplane = 0; iplane < fplanes; iplane++){ // loop over planes
89  for (int imodule = 0; imodule < fmodules; imodule++){ // loop over modules
90  int curpos = (ihalf*fplanes*fmodules)+(iplane*fmodules)+imodule;
91  TString name_shx = "shift_x_";
92  name_shx +=ihalf;
93  name_shx +="_";
94  name_shx +=iplane;
95  name_shx +="_";
96  name_shx +=imodule;
97 
98  TString name_shy = "shift_y_";
99  name_shy +=ihalf;
100  name_shy +="_";
101  name_shy +=iplane;
102  name_shy +="_";
103  name_shy +=imodule;
104 
105  TString name_shz = "shift_z_";
106  name_shz +=ihalf;
107  name_shz +="_";
108  name_shz +=iplane;
109  name_shz +="_";
110  name_shz +=imodule;
111 
112  TString name_rotx = "rotate_x_";
113  name_rotx +=ihalf;
114  name_rotx +="_";
115  name_rotx +=iplane;
116  name_rotx +="_";
117  name_rotx +=imodule;
118 
119  TString name_roty = "rotate_y_";
120  name_roty +=ihalf;
121  name_roty +="_";
122  name_roty +=iplane;
123  name_roty +="_";
124  name_roty +=imodule;
125 
126  TString name_rotz = "rotate_z_";
127  name_rotz +=ihalf;
128  name_rotz +="_";
129  name_rotz +=iplane;
130  name_rotz +="_";
131  name_rotz +=imodule;
132 
133  if (!list->fill(name_shx, &fshift_x[curpos])) return kFALSE;
134  if (!list->fill(name_shy, &fshift_y[curpos])) return kFALSE;
135  if (!list->fill(name_shz, &fshift_z[curpos])) return kFALSE;
136  if (!list->fill(name_rotx, &frotate_x[curpos])) return kFALSE;
137  if (!list->fill(name_roty, &frotate_y[curpos])) return kFALSE;
138  if (!list->fill(name_rotz, &frotate_z[curpos])) return kFALSE;
139  }
140  }
141  }
142  return kTRUE;
143 }
144 
146 
148 {
149  std::cout<<"LUMI Alignment Parameters for geometry with :"<<std::endl;
150  std::cout<<" Halfs = "<<fhalfs<<std::endl;
151  std::cout<<" Planes = "<<fplanes<<std::endl;
152  std::cout<<" Modules = "<<fmodules<<std::endl;
153  std::cout<<" fshift_x.size() = "<< fshift_x.size()<<std::endl;
154  std::cout<<" fshift_y.size() = "<< fshift_z.size()<<std::endl;
155  std::cout<<" fshift_z.size() = "<< fshift_z.size()<<std::endl;
156  std::cout<<" frotate_x.size() = "<< frotate_x.size()<<std::endl;
157  std::cout<<" frotate_y.size() = "<< frotate_y.size()<<std::endl;
158  std::cout<<" frotate_z.size() = "<< frotate_z.size()<<std::endl;
159 
160  for(size_t ix=0; ix<fshift_x.size();ix++){
161  if(fshift_x[ix]!=0) cout<<"fshift_x["<<ix<<"]="<<fshift_x[ix]<<endl;
162  if(fshift_y[ix]!=0) cout<<"fshift_y["<<ix<<"]="<<fshift_y[ix]<<endl;
163  if(fshift_z[ix]!=0) cout<<"fshift_z["<<ix<<"]="<<fshift_z[ix]<<endl;
164  if(frotate_x[ix]!=0) cout<<"frotate_x["<<ix<<"]="<<frotate_x[ix]<<endl;
165  if(frotate_y[ix]!=0) cout<<"frotate_y["<<ix<<"]="<<frotate_y[ix]<<endl;
166  if(frotate_z[ix]!=0) cout<<"frotate_z["<<ix<<"]="<<frotate_z[ix]<<endl;
167  }
168  return;
169 }
vector< double > fshift_z
vector< double > fshift_x
Alignment Parameter Class for LMD.
Double_t
vector< double > frotate_y
TString name
void putParams(FairParamList *list)
vector< double > frotate_x
Bool_t getParams(FairParamList *list)
ClassImp(PndAnaContFact)
vector< double > frotate_z
void clear(void)
vector< double > fshift_y
PndLmdAlignPar(const char *name="PndLmdAlignPar", const char *title="PndLmd alignment parameter", const char *context="TestDefaultContext")