CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemGeomSvc.cxx
Go to the documentation of this file.
1#include "GaudiKernel/Algorithm.h"
2#include "CgemGeomSvc/CgemGeomSvc.h"
3#include "GaudiKernel/Kernel.h"
4#include "GaudiKernel/IIncidentSvc.h"
5#include "GaudiKernel/Incident.h"
6#include "GaudiKernel/IIncidentListener.h"
7#include "GaudiKernel/IInterface.h"
8#include "GaudiKernel/StatusCode.h"
9#include "GaudiKernel/SvcFactory.h"
10#include "GaudiKernel/PropertyMgr.h"
11#include "GaudiKernel/SmartDataPtr.h"
12#include "CalibData/CalibModel.h"
13#include "GaudiKernel/MsgStream.h"
14#include "EventModel/EventHeader.h"
15#include "EventModel/Event.h"
16#include "GaudiKernel/ISvcLocator.h"
17#include "GaudiKernel/IDataProviderSvc.h"
18#include "GaudiKernel/Bootstrap.h"
19#include <math.h>
20#include <fstream>
21#include <float.h>
22
23
24using namespace std;
25
26CgemGeomSvc::CgemGeomSvc(const std::string& name, ISvcLocator* pSvcLocator)
27 :Service(name,pSvcLocator)
28{
29 declareProperty("UseIniGeomFile", m_iFile = 4); // CHECK it must be read from the file!
30 declareProperty("PrintDebugInfo", m_debugCout = false);
31 declareProperty("TestReadoutPlane", m_testReadoutPlane = false);
32 declareProperty("AlignFile", m_alignFile);
33 declareProperty("UseEffectiveDensity", m_effDensity = false);
34}
35
37 for(int i=0; i<m_N_CgemLayer; i++){
38 for(int j=0; j < m_N_GemFoil; j++) delete m_foil[i][j];
39 int nSheet=m_CgemLayer[i]->getNumberOfSheet();
40 for(int j=0; j<nSheet; j++) delete m_ReadoutPlane[i][j];
41 delete m_CgemLayer[i];
42 }
43 delete m_CgemSeparator;
44 delete m_align;
45 delete m_midDrift;
46
47}
48
49StatusCode CgemGeomSvc::queryInterface (const InterfaceID& riid, void** ppvInterface ){
50
51 if ( IID_ICgemGeomSvc.versionMatch(riid) ) {
52 *ppvInterface = static_cast<ICgemGeomSvc*> (this);
53 } else {
54 return Service::queryInterface(riid, ppvInterface) ;
55 }
56 return StatusCode::SUCCESS;
57}
58
59
61 MsgStream log(msgSvc(), name());
62 log << MSG::INFO << "initializing......" << endreq;
63
64 StatusCode sc = Service::initialize();
65 if ( sc.isFailure() ) return sc;
66
67 initGeom();
68 m_align = new CgemGeoAlign();
69 m_align->initAlignPar(m_alignFile);
70 for(int layer=0; layer<m_N_CgemLayer; layer++){
71 double r = m_CgemLayer[layer]->getInnerROfAnode();
72 m_align->setLayerR(layer, r);
73 }
74
75 cout << "alignfile: " << m_alignFile << " --------------------------------------" << endl;
76
77 m_midDrift = new CgemMidDriftPlane();
78 m_midDrift->setAlignment(m_align);
79 for(int layer=0; layer<m_N_CgemLayer; layer++){
80 double rInner = m_CgemLayer[layer]->getInnerROfGapD();
81 double rOuter = m_CgemLayer[layer]->getOuterROfGapD();
82 double r = (rInner + rOuter)*0.5;
83 m_midDrift->setR(layer, r);
84
85 int nSheet=m_CgemLayer[layer]->getNumberOfSheet();
86 for(int i=0; i<nSheet; i++){
87 m_midDrift->setReadoutPlane(layer, i, m_ReadoutPlane[layer][i]);
88 }
89
90 // double vAngle = m_CgemLayer[layer]->getAngleOfStereo();
91 // m_midDrift->setVangle(layer, vAngle);
92 }
93
94 if(m_testReadoutPlane) TestReadoutPlane();
95
96 return StatusCode::SUCCESS;
97}
98
99
101
102 MsgStream log(msgSvc(),name());
103
104 log<<MSG::INFO << "finalizing.... "<<endreq;
105
106 log<<MSG::INFO << "End of Run "<<endreq;
107 return StatusCode::SUCCESS;
108
109}
110
111void CgemGeomSvc::handle(const Incident& inc){
112 MsgStream log( messageService(), name() );
113 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
114
115 IDataProviderSvc* m_eventSvc;
116 Gaudi::svcLocator()->service("EventDataSvc", m_eventSvc, true);
117 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
118 if (!eventHeader) {
119 log << MSG::FATAL << "Could not find Event Header" << endreq;
120 }
121// if (m_updatealign) return;
122// if (inc.type() == "NewRun" ){
123// log << MSG::DEBUG << "Begin Event" << endreq;
124// clean();
125// m_updatealign = true;
126// if(m_nomcalignment&&m_mindex==0) {
127// int RunNo=eventHeader->runNumber();
128// if(RunNo<0) m_readAlignParDataBase=false ;
129// else m_readAlignParDataBase=true;
130// m_mindex+=1;
131// cout<<"m__RunNo="<<RunNo<<"m_mindex="<<m_mindex<<endl;
132// }
133// //std::cout<<"############"<<m_readAlignParDataBase<<std::endl;
134// ReadAlignPar();
135// }
136}
137
139}
140
142 cout.precision(10);
143 // cout<<"precision: "<<cout.precision()<<endl;
144 /* Get the geometry parameter file from asigned path and value */
145 string geoFilePath = getenv("CGEMGEOMSVCROOT");
146 // int iFile=iPar
147 cout << "IFILE " << m_iFile << endl;
148 // if(m_iFile==0) m_iFile=ReadBoostRoot::GetCgem();
149 switch (m_iFile){
150 case 1 :
151 geoFilePath += "/dat/cgem_model_1_default.txt";
152 break;
153 case 2 :
154 geoFilePath += "/dat/cgem_model_2_default.txt";
155 break;
156 case 3 :
157 geoFilePath += "/dat/cgem_model_3_default.txt";
158 break;
159 case 4 :
160 geoFilePath += "/dat/cgem_model_4_default.txt";
161 break;
162 default :
163 cout << "Warning in CgemGeomSvc::initGeom(): The geometry will be constructed through default model!" << endl;
164 geoFilePath += "/dat/cgem_model_4_default.txt";
165 break;
166 }
167 cout << "INFO in CgemGeomSvc::initGeom(): Geometry will be constructed through File: "
168 << geoFilePath << endl;
169
170 /* Open and read the geometry parameter file */
171 ifstream fin(geoFilePath.c_str(), ios::in);
172 if (!fin.good())
173 {
174 cout << "Error in CgemGeomSvc::initGeom(): Fail to open geomtry file: " << endl;
175 cout << geoFilePath << endl;
176 return false;
177 }
178 string strcom; /* One input line of fin file */
179
180
181 cout << left << "=======get BesMdcGeoParameter from CgemGeomSvc=======" << endl;
182
183 /* Information of CgemLayer and Readout Strip */
184 std::getline(fin, strcom); // Line 2
185 std::getline(fin, strcom); // Line 3
186 fin >> m_N_CgemLayer
187 >> m_N_GemFoil; // Line 3
188 cout << "N_CgemLayer : " << left << setw(8) << m_N_CgemLayer
189 << "N_GemFoil : " << left << setw(8) << m_N_GemFoil << endl;
190 std::getline(fin, strcom); // Line 4
191 std::getline(fin, strcom); // Line 5
192 std::getline(fin, strcom); // Line 6
193 double rLayer, lenLayer, numSheet, wSheet, aStereo, wPitchX, wPitchV, wStripX, wStripV, nChannelX, nChannelV;
194 double phi_start[3][2], dX_start_strip[3][2], dV_start_strip[3][2];
195 for (int i=0; i < m_N_CgemLayer; i++)
196 {
197 fin >> rLayer >> lenLayer >> numSheet >> wSheet >> aStereo >> wPitchX >> wPitchV
198 >> wStripX >> wStripV >> nChannelX >> nChannelV
199 >> phi_start[i][0] >> phi_start[i][1]
200 >> dX_start_strip[i][0] >> dX_start_strip[i][1]
201 >> dV_start_strip[i][0] >> dV_start_strip[i][1]
202 >> m_T_Gap_D[i] >> m_Orientation; // Line 6 7 8
203 //cout<<"rLayer = "<<rLayer<<endl;
204 //nChannelX=nChannelX/numSheet;
205 //nChannelV=nChannelV/numSheet;
206 m_CgemLayer[i] = new CgemGeoLayer();
207
208 m_CgemLayer[i]->setInnerROfCgemLayer(rLayer);
209 m_CgemLayer[i]->setLengthOfCgemLayer(lenLayer);
210 m_CgemLayer[i]->setNumberOfSheet(numSheet);
211 m_CgemLayer[i]->setWidthOfSheet(wSheet);
212 m_CgemLayer[i]->setAngleOfStereo(aStereo);
213 m_CgemLayer[i]->setWidthOfPitchX(wPitchX);
214 m_CgemLayer[i]->setWidthOfPitchV(wPitchV);
215 m_CgemLayer[i]->setWidthOfStripX(wStripX);
216 m_CgemLayer[i]->setWidthOfStripV(wStripV);
217 m_CgemLayer[i]->setNumberOfChannelX(nChannelX);
218 m_CgemLayer[i]->setNumberOfChannelV(nChannelV);
219 m_CgemLayer[i]->setOrientation(m_Orientation);
220 std::getline(fin, strcom); // Line 7 8 9
221 }
222
223 /* Information of Cathode */
224 std::getline(fin, strcom); // Line 10
225 std::getline(fin, strcom); // Line 11
226 fin >> m_N_Cathode_Materials
227 >> m_T_Cathode_Kapton1 >> m_T_Cathode_Epoxy1 >> m_T_Cathode_Rohacell1 >> m_T_Cathode_Epoxy2
228 >> m_T_Cathode_Kapton2 >> m_T_Cathode_Epoxy3 >> m_T_Cathode_Rohacell2 >> m_T_Cathode_Epoxy4
229 >> m_T_Cathode_Kapton3 >> m_T_Cathode_Cu; // Line 11
230
231 if (m_N_Cathode_Materials > N_MATERIAL_MAX) {
232 cout << "Error : CgemGeomSvc::initGeom(), Number of materials in Cathode is wrong!" << endl;
233 cout << "It must be less than " << N_MATERIAL_MAX << " and is " << m_N_Cathode_Materials << endl;
234 cout << "please, either increase N_MATERIAL_MAX or decrease m_N_Cathode_Materials" << endl;
235 return false;
236 }
237
238 m_T_Cathode = m_T_Cathode_Kapton1 + m_T_Cathode_Epoxy1 + m_T_Cathode_Rohacell1 + m_T_Cathode_Epoxy2 + m_T_Cathode_Kapton2 + m_T_Cathode_Epoxy3 + m_T_Cathode_Rohacell2 + m_T_Cathode_Epoxy4 + m_T_Cathode_Kapton3 + m_T_Cathode_Cu;
239
240 /* Information of Gap */
241 std::getline(fin, strcom); // Line 12
242 std::getline(fin, strcom); // Line 13
243 std::getline(fin, strcom); // Line 14
244 fin >> m_T_Gap_T1 >> m_T_Gap_T2 >> m_T_Gap_I; // Line 14
245
246 /* Information of GemFoil */
247 std::getline(fin, strcom); // Line 15
248 std::getline(fin, strcom); // Line 16
249 std::getline(fin, strcom); // Line 17
250 fin >> m_N_GemFoil_Materials
251 >> m_T_GemFoil_Cu1 >> m_T_GemFoil_Kapton >> m_T_GemFoil_Cu2
252 >> m_R_i_GemFoil_Hole >> m_R_o_GemFoil_Hole >> m_L_GemFoil_Hole; // Line 17
253
254 if (m_N_GemFoil_Materials > N_MATERIAL_MAX) {
255 cout << "Error : CgemGeomSvc::initGeom(), Number of materials in GemFoil is wrong!" << endl;
256 cout << "It must be less than " << N_MATERIAL_MAX << " and is " << m_N_GemFoil_Materials << endl;
257 cout << "please, either increase N_MATERIAL_MAX or decrease m_N_GemFoil_Materials" << endl;
258 return false;
259 }
260
261 m_T_GemFoil = m_T_GemFoil_Cu1 + m_T_GemFoil_Kapton + m_T_GemFoil_Cu2;
262
263 /* Information of Anode */
264 std::getline(fin, strcom); // Line 18
265 std::getline(fin, strcom); // Line 19
266 std::getline(fin, strcom); // Line 20
267
268 fin >> m_N_Anode_Materials
269 >> m_T_Anode_Cu1 >> m_T_Anode_Kapton1 >> m_T_Anode_Cu2 >> m_T_Anode_Epoxy1
270 >> m_T_Anode_Kapton2 >> m_T_Anode_Epoxy2 >> m_T_Anode_Rohacell1
271 >> m_T_Anode_Epoxy3 >> m_T_Anode_Kapton3 >> m_T_Anode_Epoxy4
272 >> m_T_Anode_Rohacell2 >> m_T_Anode_Epoxy5 >> m_T_Anode_Cu3 >> m_T_Anode_Kapton4 >> m_B_strip_x_on >> m_B_strip_v_on; // line 20
273
274 if (m_N_Anode_Materials > N_MATERIAL_MAX) {
275 cout << "Error : CgemGeomSvc::initGeom(), Number of materials in Anode is wrong!" << endl;
276 cout << "It must be less than " << N_MATERIAL_MAX << " and is " << m_N_Anode_Materials << endl;
277 cout << "please, either increase N_MATERIAL_MAX or decrease m_N_Anode_Materials" << endl;
278 return false;
279 }
280
281 m_T_Anode = m_T_Anode_Cu1 + m_T_Anode_Kapton1 + m_T_Anode_Cu2 + m_T_Anode_Epoxy1
282 + m_T_Anode_Kapton2 + m_T_Anode_Epoxy2 + m_T_Anode_Rohacell1
283 + m_T_Anode_Epoxy3 + m_T_Anode_Kapton3 + m_T_Anode_Epoxy4
284 + m_T_Anode_Rohacell2 + m_T_Anode_Epoxy5 + m_T_Anode_Cu3 + m_T_Anode_Kapton4;
285
286
287 cout << "thickness: cathode " << m_T_Cathode << " gem " << m_T_GemFoil << " anode " << m_T_Anode << endl;
288
289 /** cable density (g/cm3) **/
290 std::getline(fin, strcom); // Line 21
291 std::getline(fin, strcom); // Line 22
292 fin >> m_Rho_Cable; // Line 22
293 cout << "cable density " << m_Rho_Cable << endl;
294
295 /** CGEM/MDC separator **/
296 std::getline(fin, strcom); // Line 23
297 std::getline(fin, strcom); // Line 24
298 std::getline(fin, strcom); // Line 25
299
300 fin >> m_R_in_Separator >> m_R_out_Separator >> m_L_Separator; // Line 25
301
302 std::getline(fin, strcom); // Line 26
303 std::getline(fin, strcom); // Line 27
304 fin >> m_T_Separator_Al1 >> m_T_Separator_CarFib >> m_T_Separator_Al2; // Line 27
305
306 m_CgemSeparator = new CgemGeoSeparator();
307 m_CgemSeparator->setInnerR(m_R_in_Separator);
308 m_CgemSeparator->setOuterR(m_R_out_Separator);
309 m_CgemSeparator->setLength(m_L_Separator);
310 m_CgemSeparator->setThickOfInnerAluminum(m_T_Separator_Al1);
311 m_CgemSeparator->setThickOfCarbonFiber(m_T_Separator_CarFib);
312 m_CgemSeparator->setThickOfOuterAluminum(m_T_Separator_Al2);
313
314 /* Information of Total volume in simulation */
315
316 std::getline(fin, strcom); // Line 28
317 std::getline(fin, strcom); // Line 29
318 std::getline(fin, strcom); // Line 30
319 fin >> m_R_i_Cgem >> m_R_o_Cgem >> m_L_Cgem; // Line 30
320
321 std::getline(fin, strcom); // Line 31
322 std::getline(fin, strcom); // Line 32
323 std::getline(fin, strcom); // Line 33
324 fin >> m_passive; // Line 33
325
326 cout << "Cgem passive elements are switched " << m_passive << endl;
327
328 for (int i=0; i < m_N_CgemLayer; i++) {
329
330 m_T_CgemLayer[i] = m_T_Cathode + m_T_Gap_D[i] + m_T_Gap_T1 + m_T_Gap_T2 + m_T_Gap_I
331 + m_T_GemFoil*3 + m_T_Anode;
332
333 /* output the thickness information of each material layer */
334 cout << left << "R_CgemLayer " << left << "L_CgemLayer "
335 << left << "N_Sheet " << left << "W_Sheet "
336 << left << "A_Stereo " << left << "W_Pitch_X "
337 << left << "W_Pitch_V "<< left << "W_Strip_X "
338 << left << "W_Strip_V "<< left << "N_Channel_Phi "
339 << left << "N_Channel_V " << left << "Orientation " << endl;
340 cout << left << setw(12) << m_CgemLayer[i]->getInnerROfCgemLayer()
341 << left << setw(12) << m_CgemLayer[i]->getLengthOfCgemLayer()
342 << left << setw(8) << m_CgemLayer[i]->getNumberOfSheet()
343 << left << setw(8) << m_CgemLayer[i]->getWidthOfSheet()
344 << left << setw(8) << m_CgemLayer[i]->getAngleOfStereo()
345 << left << setw(8) << m_CgemLayer[i]->getWidthOfPitchX()
346 << left << setw(8) << m_CgemLayer[i]->getWidthOfPitchV()
347 << left << setw(10) << m_CgemLayer[i]->getWidthOfStripX()
348 << left << setw(10) << m_CgemLayer[i]->getWidthOfStripV()
349 << left << setw(14) << m_CgemLayer[i]->getNumberOfChannelX()
350 << left << setw(12) << m_CgemLayer[i]->getNumberOfChannelV()
351 << left << setw(11) << m_CgemLayer[i]->getOrientation() << endl;
352
353 cout << left << "T_Cathode " << left << "T_GemFoil " << left << "T_Anode "
354 << left << "T_CgemLayer " << endl;
355 cout << left << setw(10) << m_T_Cathode << left << setw(10) << m_T_GemFoil
356 << left << setw(8) << m_T_Anode << left << setw(9) << m_T_CgemLayer[i] << endl;
357
358 cout << "from r " << m_CgemLayer[i]->getInnerROfCgemLayer()
359 << " to " << m_CgemLayer[i]->getInnerROfCgemLayer() + m_T_CgemLayer[i] << endl;
360 cout << "thickness " << m_T_CgemLayer[i] << endl;
361
362 }
363
364 for (int i=0; i < m_N_CgemLayer; i++) {
365
366
367 /* Information of CgemLayer */
368 m_CgemLayer[i]->setIDOfCgemLayer(i);
369 m_CgemLayer[i]->setOuterROfCgemLayer(m_CgemLayer[i]->getInnerROfCgemLayer() + m_T_CgemLayer[i]);
370
371 /* Information of Cathode */
372 bool fReversed = m_CgemLayer[i]->getOrientation();
373 if(fReversed == false) {
374 m_CgemLayer[i]->setInnerROfCathode( m_CgemLayer[i]->getInnerROfCgemLayer() );
375 m_CgemLayer[i]->setOuterROfCathode( m_CgemLayer[i]->getInnerROfCgemLayer() + m_T_Cathode);
376 } else {
377 m_CgemLayer[i]->setOuterROfCathode( m_CgemLayer[i]->getOuterROfCgemLayer() );
378 m_CgemLayer[i]->setInnerROfCathode( m_CgemLayer[i]->getOuterROfCgemLayer() - m_T_Cathode);
379 }
380
381 cout << "CATHODE from " << m_CgemLayer[i]->getInnerROfCathode() << " to " << m_CgemLayer[i]->getOuterROfCathode() << " thickness " << m_CgemLayer[i]->getOuterROfCathode() - m_CgemLayer[i]->getInnerROfCathode() << endl;
382
383 double inner_r_cathode[N_MATERIAL_MAX];
384 double outer_r_cathode[N_MATERIAL_MAX];
385 double m_t_cathode_list[N_MATERIAL_MAX] = {m_T_Cathode_Kapton1, m_T_Cathode_Epoxy1, m_T_Cathode_Rohacell1, m_T_Cathode_Epoxy2, m_T_Cathode_Kapton2, m_T_Cathode_Epoxy3, m_T_Cathode_Rohacell2, m_T_Cathode_Epoxy4, m_T_Cathode_Kapton3, m_T_Cathode_Cu};
386
387 inner_r_cathode[0] = m_CgemLayer[i]->getInnerROfCathode();
388 int counter = 0;
389 if(fReversed == true) counter = m_N_Cathode_Materials - 1;
390
391 for(int imat = 0; imat < m_N_Cathode_Materials; imat++) {
392 outer_r_cathode[imat] = inner_r_cathode[imat] + m_t_cathode_list[counter];
393
394 switch(counter) {
395 case 0 :
396 m_CgemLayer[i]->setInnerROfCathodeKapton1(inner_r_cathode[imat]);
397 m_CgemLayer[i]->setOuterROfCathodeKapton1(outer_r_cathode[imat]);
398 break;
399 case 1 :
400 m_CgemLayer[i]->setInnerROfCathodeEpoxy1(inner_r_cathode[imat]);
401 m_CgemLayer[i]->setOuterROfCathodeEpoxy1(outer_r_cathode[imat]);
402 break;
403 case 2 :
404 m_CgemLayer[i]->setInnerROfCathodeRohacell1(inner_r_cathode[imat]);
405 m_CgemLayer[i]->setOuterROfCathodeRohacell1(outer_r_cathode[imat]);
406 break;
407 case 3 :
408 m_CgemLayer[i]->setInnerROfCathodeEpoxy2(inner_r_cathode[imat]);
409 m_CgemLayer[i]->setOuterROfCathodeEpoxy2(outer_r_cathode[imat]);
410 break;
411 case 4 :
412 m_CgemLayer[i]->setInnerROfCathodeKapton2(inner_r_cathode[imat]);
413 m_CgemLayer[i]->setOuterROfCathodeKapton2(outer_r_cathode[imat]);
414 break;
415 case 5 :
416 m_CgemLayer[i]->setInnerROfCathodeEpoxy3(inner_r_cathode[imat]);
417 m_CgemLayer[i]->setOuterROfCathodeEpoxy3(outer_r_cathode[imat]);
418 break;
419 case 6 :
420 m_CgemLayer[i]->setInnerROfCathodeRohacell2(inner_r_cathode[imat]);
421 m_CgemLayer[i]->setOuterROfCathodeRohacell2(outer_r_cathode[imat]);
422 break;
423 case 7 :
424 m_CgemLayer[i]->setInnerROfCathodeEpoxy4(inner_r_cathode[imat]);
425 m_CgemLayer[i]->setOuterROfCathodeEpoxy4(outer_r_cathode[imat]);
426 break;
427 case 8 :
428 m_CgemLayer[i]->setInnerROfCathodeKapton3(inner_r_cathode[imat]);
429 m_CgemLayer[i]->setOuterROfCathodeKapton3(outer_r_cathode[imat]);
430 break;
431 case 9 :
432 m_CgemLayer[i]->setInnerROfCathodeCu(inner_r_cathode[imat]);
433 m_CgemLayer[i]->setOuterROfCathodeCu(outer_r_cathode[imat]);
434
435 cout << " CATHODE CU INNER " << inner_r_cathode[imat] << " OUTER " << outer_r_cathode[imat] << endl;
436
437 break;
438 default:
439 break;
440 }
441
442 // cout << imat << " " << counter << " inner " << inner_r_cathode[imat] << " outer " << outer_r_cathode[imat] << endl;
443 if(imat == m_N_Cathode_Materials - 1) {
444 cout << "breaking" << endl;
445 break;
446 }
447 inner_r_cathode[imat + 1] = outer_r_cathode[imat];
448 if(fReversed == false) counter++;
449 else counter--;
450 }
451
452
453 cout << "T_cathode: " << setw(15) << m_T_Cathode << setw(15)
454 << m_T_Cathode_Kapton1 << setw(15) << m_T_Cathode_Epoxy1
455 << setw(15) << m_T_Cathode_Rohacell1 << setw(15) << m_T_Cathode_Epoxy2
456 << setw(15) << m_T_Cathode_Kapton2 << setw(15) << m_T_Cathode_Epoxy3
457 << setw(15) << m_T_Cathode_Rohacell2 << setw(15) << m_T_Cathode_Epoxy4
458 << setw(15) << m_T_Cathode_Kapton3 << setw(15) << m_T_Cathode_Cu << endl;
459
460 cout << setw(20) << m_CgemLayer[i]->getInnerROfCathode() << endl
461 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeKapton1()
462 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeKapton1()
463 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeEpoxy1()
464 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeEpoxy1() << endl
465 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeRohacell1()
466 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeRohacell1()
467 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeEpoxy2()
468 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeEpoxy2() << endl
469 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeKapton2()
470 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeKapton2()
471 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeEpoxy3()
472 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeEpoxy3() << endl
473 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeRohacell2()
474 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeRohacell2()
475 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeEpoxy4()
476 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeEpoxy4() << endl
477 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeKapton3()
478 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeKapton3()
479 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeCu()
480 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeCu() << endl
481 << setw(20) << m_CgemLayer[i]->getOuterROfCathode() << endl;
482
483
484 /* Check over the radius */
485 if(fReversed == false) {
486 if (fabs((m_CgemLayer[i]->getOuterROfCathode() / m_CgemLayer[i]->getOuterROfCathodeCu()) - 1) > FLT_EPSILON){
487 cout << fabs(m_CgemLayer[i]->getOuterROfCathode() - m_CgemLayer[i]->getOuterROfCathodeCu()) << endl;
488 cout << setw(20) << m_CgemLayer[i]->getOuterROfCathode()
489 << setw(20) << m_CgemLayer[i]->getOuterROfCathodeCu()
490 << ", FLT_EPSILON = " << FLT_EPSILON << endl;
491 cout << "Error : CgemGeomSvc::initGeom(), Cathode size is wrong!" << endl;
492 return false;
493 }
494 }
495 else {
496 if (fabs((m_CgemLayer[i]->getInnerROfCathode() / m_CgemLayer[i]->getInnerROfCathodeCu()) - 1) > FLT_EPSILON){
497 cout << fabs(m_CgemLayer[i]->getInnerROfCathode() - m_CgemLayer[i]->getInnerROfCathodeCu()) << endl;
498 cout << setw(20) << m_CgemLayer[i]->getInnerROfCathode()
499 << setw(20) << m_CgemLayer[i]->getInnerROfCathodeCu()
500 << ", FLT_EPSILON = " << FLT_EPSILON << endl;
501 cout << "Error : CgemGeomSvc::initGeom(), Cathode size is wrong!" << endl;
502 return false;
503 }
504 }
505
506 /* Information of Gap and GemFoil */
507 if(fReversed == false) {
508 m_CgemLayer[i]->setInnerROfGapD( m_CgemLayer[i]->getOuterROfCathode() );
509 m_CgemLayer[i]->setOuterROfGapD( m_CgemLayer[i]->getOuterROfCathode() + m_T_Gap_D[i] );
510 m_CgemLayer[i]->setInnerROfGapT1( m_CgemLayer[i]->getOuterROfGapD() + m_T_GemFoil );
511 m_CgemLayer[i]->setOuterROfGapT1( m_CgemLayer[i]->getInnerROfGapT1() + m_T_Gap_T1 );
512 m_CgemLayer[i]->setInnerROfGapT2( m_CgemLayer[i]->getOuterROfGapT1() + m_T_GemFoil );
513 m_CgemLayer[i]->setOuterROfGapT2( m_CgemLayer[i]->getInnerROfGapT2() + m_T_Gap_T2 );
514 m_CgemLayer[i]->setInnerROfGapI( m_CgemLayer[i]->getOuterROfGapT2() + m_T_GemFoil );
515 m_CgemLayer[i]->setOuterROfGapI( m_CgemLayer[i]->getInnerROfGapI() + m_T_Gap_I );
516 }
517 else {
518 m_CgemLayer[i]->setOuterROfGapD( m_CgemLayer[i]->getInnerROfCathode() );
519 m_CgemLayer[i]->setInnerROfGapD( m_CgemLayer[i]->getInnerROfCathode() - m_T_Gap_D[i] );
520 m_CgemLayer[i]->setOuterROfGapT1( m_CgemLayer[i]->getInnerROfGapD() - m_T_GemFoil );
521 m_CgemLayer[i]->setInnerROfGapT1( m_CgemLayer[i]->getOuterROfGapT1() - m_T_Gap_T1 );
522 m_CgemLayer[i]->setOuterROfGapT2( m_CgemLayer[i]->getInnerROfGapT1() - m_T_GemFoil );
523 m_CgemLayer[i]->setInnerROfGapT2( m_CgemLayer[i]->getOuterROfGapT2() - m_T_Gap_T2 );
524 m_CgemLayer[i]->setOuterROfGapI( m_CgemLayer[i]->getInnerROfGapT2() - m_T_GemFoil );
525 m_CgemLayer[i]->setInnerROfGapI( m_CgemLayer[i]->getOuterROfGapI() - m_T_Gap_I );
526 }
527
528 cout << "Geom foil&gap " << setw(15) << m_T_Gap_D[i] << setw(15)
529 << m_T_GemFoil << setw(15) << m_T_Gap_T1
530 << setw(15) << m_T_Gap_T2 << setw(15) << m_T_Gap_I << endl;
531
532 cout << "gaps: -----------------------------" << endl;
533 cout << setw(20) << m_CgemLayer[i]->getInnerROfGapD()
534 << setw(20) << m_CgemLayer[i]->getOuterROfGapD()
535 << setw(20) << m_CgemLayer[i]->getInnerROfGapT1()
536 << setw(20) << m_CgemLayer[i]->getOuterROfGapT1() << endl
537 << setw(20) << m_CgemLayer[i]->getInnerROfGapT2()
538 << setw(20) << m_CgemLayer[i]->getOuterROfGapT2()
539 << setw(20) << m_CgemLayer[i]->getInnerROfGapI()
540 << setw(20) << m_CgemLayer[i]->getOuterROfGapI() << endl;
541
542 /* The number of GemFoil can only be 3 in the code! */
543 if (m_N_GemFoil != 3){
544 cout << "Error : CgemGeomSvc::initGeom(), GemFoil number in code is 3! If m_N_GemFoil != 3,you should modify the code,especially the gap information!" << endl;
545 return false;
546 }
547
548 double R_i_GemFoil[3] = {0};
549 if(fReversed == false) {
550 R_i_GemFoil[0] = m_CgemLayer[i]->getOuterROfGapD();
551 R_i_GemFoil[1] = m_CgemLayer[i]->getOuterROfGapT1();
552 R_i_GemFoil[2] = m_CgemLayer[i]->getOuterROfGapT2();
553 }
554 else {
555 R_i_GemFoil[0] = m_CgemLayer[i]->getOuterROfGapT1();
556 R_i_GemFoil[1] = m_CgemLayer[i]->getOuterROfGapT2();
557 R_i_GemFoil[2] = m_CgemLayer[i]->getOuterROfGapI();
558 }
559
560 for(int j=0; j < m_N_GemFoil; j++){
561 m_foil[i][j] = new CgemGeoFoil();
562
563 m_foil[i][j]->setIDOfCgemFoil(j);
564
565
566 double inner_r_foil[N_MATERIAL_MAX];
567 double outer_r_foil[N_MATERIAL_MAX];
568 double m_t_foil_list[N_MATERIAL_MAX] = {m_T_GemFoil_Cu1, m_T_GemFoil_Kapton, m_T_GemFoil_Cu2};
569
570 inner_r_foil[0] = R_i_GemFoil[j];
571
572 if(fReversed == true) counter = m_N_GemFoil_Materials - 1;
573 else counter = 0;
574
575 for(int imat = 0; imat < m_N_GemFoil_Materials; imat++) {
576 outer_r_foil[imat] = inner_r_foil[imat] + m_t_foil_list[counter];
577
578 switch(counter) {
579 case 0 :
580 m_foil[i][j]->setInnerROfCgemFoilCu1(inner_r_foil[imat]);
581 m_foil[i][j]->setOuterROfCgemFoilCu1(outer_r_foil[imat]);
582 break;
583 case 1 :
584 m_foil[i][j]->setInnerROfCgemFoilKapton(inner_r_foil[imat]);
585 m_foil[i][j]->setOuterROfCgemFoilKapton(outer_r_foil[imat]);
586 break;
587 case 2 :
588 m_foil[i][j]->setInnerROfCgemFoilCu2(inner_r_foil[imat]);
589 m_foil[i][j]->setOuterROfCgemFoilCu2(outer_r_foil[imat]);
590 break;
591 default:
592 break;
593 }
594
595 // cout << imat << " " << counter << " inner " << inner_r_foil[imat] << " outer " << outer_r_foil[imat] << endl;
596 if(imat == m_N_GemFoil_Materials - 1) {
597 cout << "breaking" << endl;
598 break;
599 }
600 inner_r_foil[imat + 1] = outer_r_foil[imat];
601 if(fReversed == false) counter++;
602 else counter--;
603 }
604
605 m_foil[i][j]->setInnerROfCgemFoil( R_i_GemFoil[j] );
606 m_foil[i][j]->setOuterROfCgemFoil( R_i_GemFoil[j] + m_T_GemFoil );
607
608 m_CgemLayer[i]->setCgemFoil(j, m_foil[i][j]);
609
610 cout << "Geom foil: layer " << i << " " << j << endl;
611 cout << setw(15) << m_T_GemFoil_Cu1 << setw(15)
612 << m_T_GemFoil_Kapton << setw(15) << m_T_GemFoil_Cu2 << endl;
613
614 cout << setw(20) << m_foil[i][j]->getIDOfCgemFoil()
615 << setw(20) << m_foil[i][j]->getInnerROfCgemFoil()
616 << setw(20) << m_foil[i][j]->getInnerROfCgemFoilCu1()
617 << setw(20) << m_foil[i][j]->getOuterROfCgemFoilCu1()
618 << setw(20) << m_foil[i][j]->getInnerROfCgemFoilKapton() << endl
619 << setw(20) << m_foil[i][j]->getOuterROfCgemFoilKapton()
620 << setw(20) << m_foil[i][j]->getInnerROfCgemFoilCu2()
621 << setw(20) << m_foil[i][j]->getOuterROfCgemFoilCu2()
622 << setw(20) << m_foil[i][j]->getOuterROfCgemFoil() << endl;
623 }
624
625
626 if(fReversed) {
627 cout << "GEM" << endl;
628 cout << "I " << m_CgemLayer[i]->getInnerROfGapI() << " " << m_CgemLayer[i]->getOuterROfGapI() << endl;
629 cout << m_foil[i][2]->getInnerROfCgemFoil() << " " << m_foil[i][2]->getOuterROfCgemFoil() << endl;
630 cout << "T2 " << m_CgemLayer[i]->getInnerROfGapT2() << " " << m_CgemLayer[i]->getOuterROfGapT2() << endl;
631 cout << m_foil[i][1]->getInnerROfCgemFoil() << " " << m_foil[i][1]->getOuterROfCgemFoil() << endl;
632 cout << "T1 " << m_CgemLayer[i]->getInnerROfGapT1() << " " << m_CgemLayer[i]->getOuterROfGapT1() << endl;
633 cout << m_foil[i][0]->getInnerROfCgemFoil() << " " << m_foil[i][0]->getOuterROfCgemFoil() << endl;
634 cout << "D " << m_CgemLayer[i]->getInnerROfGapD() << " " << m_CgemLayer[i]->getOuterROfGapD() << endl;
635 }
636 else {
637 cout << "GEM" << endl;
638 cout << "D " << m_CgemLayer[i]->getInnerROfGapD() << " " << m_CgemLayer[i]->getOuterROfGapD() << endl;
639 cout << m_foil[i][0]->getInnerROfCgemFoil() << " " << m_foil[i][0]->getOuterROfCgemFoil() << endl;
640 cout << "T1 " << m_CgemLayer[i]->getInnerROfGapT1() << " " << m_CgemLayer[i]->getOuterROfGapT1() << endl;
641 cout << m_foil[i][1]->getInnerROfCgemFoil() << " " << m_foil[i][1]->getOuterROfCgemFoil() << endl;
642 cout << "T2 " << m_CgemLayer[i]->getInnerROfGapT2() << " " << m_CgemLayer[i]->getOuterROfGapT2() << endl;
643 cout << m_foil[i][2]->getInnerROfCgemFoil() << " " << m_foil[i][2]->getOuterROfCgemFoil() << endl;
644 cout << "I " << m_CgemLayer[i]->getInnerROfGapI() << " " << m_CgemLayer[i]->getOuterROfGapI() << endl;
645 }
646
647 /* Information of Anode */
648 if(fReversed == false) {
649 m_CgemLayer[i]->setInnerROfAnode( m_CgemLayer[i]->getOuterROfGapI() );
650 m_CgemLayer[i]->setOuterROfAnode( m_CgemLayer[i]->getOuterROfGapI() + m_T_Anode );
651 } else {
652 m_CgemLayer[i]->setOuterROfAnode( m_CgemLayer[i]->getInnerROfGapI() );
653 m_CgemLayer[i]->setInnerROfAnode( m_CgemLayer[i]->getInnerROfGapI() - m_T_Anode);
654 }
655
656 cout << "ANODE from " << m_CgemLayer[i]->getInnerROfAnode() << " to " << m_CgemLayer[i]->getOuterROfAnode() << " thickness " << m_CgemLayer[i]->getOuterROfAnode() - m_CgemLayer[i]->getInnerROfAnode() << endl;
657
658
659
660 double inner_r_anode[N_MATERIAL_MAX];
661 double outer_r_anode[N_MATERIAL_MAX];
662 double m_t_anode_list[N_MATERIAL_MAX] = {m_T_Anode_Cu1, m_T_Anode_Kapton1, m_T_Anode_Cu2, m_T_Anode_Epoxy1, m_T_Anode_Kapton2, m_T_Anode_Epoxy2, m_T_Anode_Rohacell1, m_T_Anode_Epoxy3, m_T_Anode_Kapton3, m_T_Anode_Epoxy4, m_T_Anode_Rohacell2, m_T_Anode_Epoxy4, m_T_Anode_Cu3, m_T_Anode_Kapton4};
663 inner_r_anode[0] = m_CgemLayer[i]->getInnerROfAnode();
664
665 if(fReversed == true) counter = m_N_Anode_Materials - 1;
666 else counter = 0;
667
668 for(int imat = 0; imat < m_N_Anode_Materials; imat++) {
669 outer_r_anode[imat] = inner_r_anode[imat] + m_t_anode_list[counter];
670
671 switch(counter) {
672 case 0 :
673 m_CgemLayer[i]->setInnerROfAnodeCu1(inner_r_anode[imat]);
674 m_CgemLayer[i]->setOuterROfAnodeCu1(outer_r_anode[imat]);
675 break;
676 case 1 :
677 m_CgemLayer[i]->setInnerROfAnodeKapton1(inner_r_anode[imat]);
678 m_CgemLayer[i]->setOuterROfAnodeKapton1(outer_r_anode[imat]);
679 break;
680 case 2:
681 m_CgemLayer[i]->setInnerROfAnodeCu2(inner_r_anode[imat]);
682 m_CgemLayer[i]->setOuterROfAnodeCu2(outer_r_anode[imat]);
683 break;
684 case 3:
685 m_CgemLayer[i]->setInnerROfAnodeEpoxy1(inner_r_anode[imat]);
686 m_CgemLayer[i]->setOuterROfAnodeEpoxy1(outer_r_anode[imat]);
687 break;
688 case 4:
689 m_CgemLayer[i]->setInnerROfAnodeKapton2(inner_r_anode[imat]);
690 m_CgemLayer[i]->setOuterROfAnodeKapton2(outer_r_anode[imat]);
691 break;
692 case 5:
693 m_CgemLayer[i]->setInnerROfAnodeEpoxy2(inner_r_anode[imat]);
694 m_CgemLayer[i]->setOuterROfAnodeEpoxy2(outer_r_anode[imat]);
695 break;
696 case 6:
697 m_CgemLayer[i]->setInnerROfAnodeRohacell1(inner_r_anode[imat]);
698 m_CgemLayer[i]->setOuterROfAnodeRohacell1(outer_r_anode[imat]);
699 break;
700 case 7:
701 m_CgemLayer[i]->setInnerROfAnodeEpoxy3(inner_r_anode[imat]);
702 m_CgemLayer[i]->setOuterROfAnodeEpoxy3(outer_r_anode[imat]);
703 break;
704 case 8:
705 m_CgemLayer[i]->setInnerROfAnodeKapton3(inner_r_anode[imat]);
706 m_CgemLayer[i]->setOuterROfAnodeKapton3(outer_r_anode[imat]);
707 break;
708 case 9:
709 m_CgemLayer[i]->setInnerROfAnodeEpoxy4(inner_r_anode[imat]);
710 m_CgemLayer[i]->setOuterROfAnodeEpoxy4(outer_r_anode[imat]);
711 break;
712 case 10:
713 m_CgemLayer[i]->setInnerROfAnodeRohacell2(inner_r_anode[imat]);
714 m_CgemLayer[i]->setOuterROfAnodeRohacell2(outer_r_anode[imat]);
715 break;
716 case 11:
717 m_CgemLayer[i]->setInnerROfAnodeEpoxy5(inner_r_anode[imat]);
718 m_CgemLayer[i]->setOuterROfAnodeEpoxy5(outer_r_anode[imat]);
719 break;
720 case 12:
721 m_CgemLayer[i]->setInnerROfAnodeCu3(inner_r_anode[imat]);
722 m_CgemLayer[i]->setOuterROfAnodeCu3(outer_r_anode[imat]);
723 break;
724 case 13:
725 m_CgemLayer[i]->setInnerROfAnodeKapton4(inner_r_anode[imat]);
726 m_CgemLayer[i]->setOuterROfAnodeKapton4(outer_r_anode[imat]);
727 break;
728 default:
729 break;
730 }
731
732 // cout << imat << " " << counter << " inner " << inner_r_anode[imat] << " outer " << outer_r_anode[imat] << endl;
733 if(imat == m_N_Anode_Materials - 1) {
734 cout << "breaking" << endl;
735 break;
736 }
737 inner_r_anode[imat + 1] = outer_r_anode[imat];
738 if(fReversed == false) counter++;
739 else counter--;
740 }
741
742 cout << "ANODE: " << endl;
743 cout << setw(20) << m_CgemLayer[i]->getInnerROfAnode() << endl
744 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeCu1()
745 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeCu1()
746 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeKapton1()
747 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeKapton1() << endl
748 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeCu2()
749 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeCu2()
750 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeEpoxy1()
751 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeEpoxy1() << endl
752 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeKapton2()
753 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeKapton2()
754 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeEpoxy2()
755 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeEpoxy2() << endl
756 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeRohacell1()
757 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeRohacell1()
758 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeEpoxy3()
759 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeEpoxy3() << endl
760 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeKapton3()
761 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeKapton3()
762 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeEpoxy4()
763 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeEpoxy4() << endl
764 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeRohacell2()
765 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeRohacell2()
766 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeEpoxy5()
767 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeEpoxy5() << endl
768 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeCu3()
769 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeCu3()
770 << setw(20) << m_CgemLayer[i]->getInnerROfAnodeKapton4()
771 << setw(20) << m_CgemLayer[i]->getOuterROfAnodeKapton4() << endl
772 << setw(20) << m_CgemLayer[i]->getOuterROfAnode() << endl;
773 cout << "X strip description is " << m_B_strip_x_on << " and V strip description is " << m_B_strip_v_on << endl;
774
775 /* Check over the radius! */
776 if(fReversed == false) {
777 if(fabs((m_CgemLayer[i]->getOuterROfAnode() / m_CgemLayer[i]->getOuterROfCgemLayer())-1) > FLT_EPSILON){
778 cout << fabs(m_CgemLayer[i]->getOuterROfAnode() - m_CgemLayer[i]->getOuterROfCgemLayer()) << endl;
779 cout << FLT_EPSILON << endl;
780 cout << "Error : CgemLayer size is wrong!" << endl;
781 return false;
782 }
783 }
784 else {
785 if(fabs((m_CgemLayer[i]->getInnerROfAnode() / m_CgemLayer[i]->getInnerROfCgemLayer())-1) > FLT_EPSILON){
786 cout << fabs(m_CgemLayer[i]->getInnerROfAnode() - m_CgemLayer[i]->getInnerROfCgemLayer()) << endl;
787 cout << FLT_EPSILON << endl;
788 cout << "Error : CgemLayer size is wrong!" << endl;
789 return false;
790 }
791
792 }
793
794 m_CgemLayer[i]->print();
795
796 int nSheet=m_CgemLayer[i]->getNumberOfSheet();
797 double rVstrips=m_CgemLayer[i]->getInnerROfAnode();
798 double rXstrips = m_CgemLayer[i]->getInnerROfAnodeCu2();
799 //double rMidAnode = 0.5*(rVstrips+m_CgemLayer[i]->getOuterROfAnodeCu2());
800 if(fReversed) {
801 rVstrips=m_CgemLayer[i]->getOuterROfAnode();
802 rXstrips = m_CgemLayer[i]->getOuterROfAnodeCu2();
803 }
804 double width_sheet=rXstrips*CLHEP::twopi/nSheet;
805 cout<<"construct CgemReadoutPlanes: "<<endl;
806
807 //cout << "!!!!!!!! CHECK DELETE " << rXstrips << " " << width_sheet << " " << endl;
808
809 for(int j=0; j<nSheet; j++){
810 cout<<"------ layer "<<i<<", sheet "<<j<<" ------ "<<endl;
811 double rStrips = 0.5*(rXstrips+rVstrips);
812 dX_start_strip[i][j]=(2.*M_PI*rStrips-m_CgemLayer[i]->getNumberOfChannelX()*m_CgemLayer[i]->getWidthOfPitchX())/(2.*nSheet)*rXstrips/rStrips;// dX calculation FIXME
813 m_ReadoutPlane[i][j]=new CgemGeoReadoutPlane(i,j,
814 rXstrips, rVstrips,
815 phi_start[i][j], dX_start_strip[i][j],
816 dV_start_strip[i][j],
817 width_sheet,
818 -0.5*m_CgemLayer[i]->getLengthOfCgemLayer(),
819 m_CgemLayer[i]->getLengthOfCgemLayer(),
820 m_CgemLayer[i]->getNumberOfChannelX()/nSheet,
821 m_CgemLayer[i]->getNumberOfChannelV()/nSheet,
822 m_CgemLayer[i]->getWidthOfPitchX(),
823 m_CgemLayer[i]->getWidthOfStripX(),
824 m_CgemLayer[i]->getWidthOfPitchV(),
825 m_CgemLayer[i]->getWidthOfStripV(),
826 m_CgemLayer[i]->getAngleOfStereo(),
827 m_CgemLayer[i]->getMiddleROfGapD(),
828 m_CgemLayer[i]->getOuterROfGapD()
829 );
830 }// loop sheet
831
832 } /* end of "for (int i=0; i < m_N_CgemLayer; i++)" */
833
834 cout << "INFO : CgemGeomSvc::initGeom(), Successfully input geometry parameters!" << endl;
835
836 /** CHECK: now it is the passive dimensions
837 m_R_i_Cgem = m_CgemLayer[0]->getInnerROfCgemLayer();
838 m_R_o_Cgem = m_CgemSeparator->getOuterROfSeparator(); // m_CgemLayer[m_N_CgemLayer-1]->getOuterROfCgemLayer(); // CHECK
839 m_L_Cgem = m_CgemSeparator->getLengthOfSeparator(); // m_CgemLayer[m_N_CgemLayer-1]->getLengthOfCgemLayer(); // CHECK
840 **/
841 cout << "====================CGEM Information=========================" << endl;
842 cout << "R_i_Cgem " << "R_o_Cgem " << "L_Cgem" << endl;
843 cout << left << setw(10) << m_R_i_Cgem
844 << left << setw(10) << m_R_o_Cgem
845 << left << setw(10) << m_L_Cgem << endl;
846 cout << "====================CGEM Information End!====================" << endl;
847 cout << " " << endl;
848
849
850 cout << "************************ FINAL CHECK OF THE DIMENSIONS" << endl;
851 for(int ilayer = 0; ilayer < 3; ilayer++) {
852
853
854 cout << "inner global radius of layer" << ilayer << ": " << m_CgemLayer[ilayer]->getInnerROfCgemLayer()
855 << " outer " << m_CgemLayer[ilayer]->getOuterROfCgemLayer() << endl;
856 cout << "inner radius of cathode: " << m_CgemLayer[ilayer]->getInnerROfCathode()
857 << " outer " << m_CgemLayer[ilayer]->getOuterROfCathode() << endl;
858
859 for(int ifoil = 0; ifoil < 3; ifoil++) {
860 cout << "inner radius of gem" << ifoil << ": " << m_foil[ilayer][ifoil]->getInnerROfCgemFoil()
861 << " outer " << m_foil[ilayer][ifoil]->getOuterROfCgemFoil() << endl;
862 }
863
864 cout << "inner radius of anode: " << m_CgemLayer[ilayer]->getInnerROfAnode()
865 << " outer " << m_CgemLayer[ilayer]->getOuterROfAnode() << endl;
866 }
867 cout << endl;
868
869 return true;
870} /* end of "Execute()" */
871
872
873void CgemGeomSvc::TestReadoutPlane() {
874 const int nSheet[3]={1,2,2};
875 //const double phimin(-3.14159265358979312), phimax(3.14159265358979312);
876 //const double phimin(-3.14159265358979312), phimax(-3.);
877 //const double phimin(-0.1), phimax(0.1);
878 const double phimin(0.), phimax(7.);
879 const int nphi=20000;
880 const double zmin(-850), zmax(850);// L: 532, 690, 847, 0.5*L: 266, 345, 423.5
881 const int nz=100000;
882
883 double phi(0.), z(-423.5), v(0.);
884
885 int onPlane[3][2];
886 int Xid[3][2];
887 int Xid2[3][2];
888 int Xid3[3][2];
889 int Xid4[3][2];
890 int Vid[3][2];
891 int Vid2[3][2];
892 int Vid3[3][2];
893 int Vid4[3][2];
894 double X[3][2], dX2[3][2], dX3[3][2], PHI[3][2],
895 V[3][2], dV2[3][2], dV3[3][2],
896 zCross[3][2];
897
898 cout.precision(10);
899 cout<<setiosflags(ios::left)
900 <<setw(14)<<"phi" <<setw(2)<<" "
901 <<setw(14)<<"z" <<setw(2)<<" "
902 <<setw( 6)<<"layer" <<setw(2)<<" "
903 <<setw( 6)<<"sheet" <<setw(2)<<" "
904 <<setw( 6)<<"onIt" <<setw(2)<<" "
905 <<setw(14)<<"X" <<setw(2)<<" "
906 <<setw( 6)<<"Xid" <<setw(2)<<" "
907 <<setw( 6)<<"Xid2" <<setw(2)<<" "
908 <<setw( 6)<<"Xid3" <<setw(2)<<" "
909 <<setw(18)<<"dX2" <<setw(2)<<" "
910 <<setw(18)<<"dX3" <<setw(2)<<" "
911 <<setw(18)<<"PHI" <<setw(2)<<" "
912 <<setw(18)<<"V" <<setw(2)<<" "
913 <<setw( 6)<<"Vid" <<setw(2)<<" "
914 <<setw( 6)<<"Vid2" <<setw(2)<<" "
915 <<setw( 6)<<"Vid3" <<setw(2)<<" "
916 <<setw(18)<<"dV2" <<setw(2)<<" "
917 <<setw(18)<<"dV3" <<setw(2)<<" "
918 <<setw(18)<<"zCross" <<setw(2)<<" "
919 <<setw(18)<<"Vnext" <<setw(2)<<" "
920 <<endl;
921
922 //for(int ii=0; ii<nz; ii++)
923 for(int ii=0; ii<nphi; ii++)
924 {
925 phi= phimin+(ii+0.5)*(phimax-phimin)/nphi;
926 //z = zmin+(ii+0.5)*(zmax-zmin)/nz;
927 //cout<<setiosflags(ios::left)
928 for(int i=0; i<m_N_CgemLayer; i++)
929 {
930 //cout<<"i = "<<i<<", nsheet = "<<nSheet[i]<<endl;
931 for(int j=0; j<nSheet[i]; j++)
932 {
933 //cout<<"j = "<<j<<endl;
935 onPlane[i][j] =anode->OnThePlane(phi,z);
936 X[i][j] =anode->getX(phi);
937 Xid[i][j] =anode->getXStripID(phi);
938 Xid2[i][j] =anode->getClosestXStripID(phi,dX2[i][j]);
939 dX3[i][j] =anode->getDist2ClosestXStripCenter(phi,Xid3[i][j]);
940 V[i][j] =anode->getVFromPhiZ(phi,z);
941 Vid[i][j] =anode->getVIDFromV(V[i][j]);
942 G4ThreeVector pos(cos(phi),sin(phi),z);
943 Vid2[i][j] =anode->getClosestVStripID(pos, dV2[i][j]);
944 dV3[i][j] =anode->getDist2ClosestVStripCenter(pos, Vid3[i][j]);
945 anode->getStripID(pos,Xid4[i][j],Vid4[i][j]);
946 PHI[i][j] =anode->getPhiFromXID(Xid[i][j]);
947 zCross[i][j] =anode->getZFromPhiV(phi,V[i][j]);
948 int iSheetNext= (j+1)%nSheet[i];
949 //cout<<"isheet, inext = "<<j<<", "<<iSheetNext<<endl;
950 CgemGeoReadoutPlane* anodeNext = getReadoutPlane(i,iSheetNext);
951 double phimin_next = anodeNext->getPhimin();
952 double Vnext = anode->getVInNextSheetFromV(V[i][j],phimin_next);
953 // getVIDInNextSheetFromVID
954 //cout<<phi<<" "<<z<<" "<<i<<" "<<j<<" "<<int(onPlane[i][j])<<" "<<V[i][j]<<" "<<zCross[i][j]<<endl;
955 cout<<setiosflags(ios::left)
956 <<setw(14)<<phi <<setw(2)<<" "
957 <<setw(14)<<z <<setw(2)<<" "
958 <<setw( 6)<<i <<setw(2)<<" "
959 <<setw( 6)<<j <<setw(2)<<" "
960 <<setw( 6)<<int(onPlane[i][j]) <<setw(2)<<" "
961 <<setw(14)<<X[i][j] <<setw(2)<<" "
962 <<setw( 6)<<Xid[i][j] <<setw(2)<<" "
963 <<setw( 6)<<Xid2[i][j] <<setw(2)<<" "
964 <<setw( 6)<<Xid3[i][j] <<setw(2)<<" "
965 <<setw(18)<<dX2[i][j] <<setw(2)<<" "
966 <<setw(18)<<dX3[i][j] <<setw(2)<<" "
967 //<<setw(18)<<fabs(dX3[i][j])-0.29
968 <<setw(18)<<PHI[i][j] <<setw(2)<<" "
969 <<setw(18)<<V[i][j] <<setw(2)<<" "
970 <<setw( 6)<<Vid[i][j] <<setw(2)<<" "
971 <<setw( 6)<<Vid2[i][j] <<setw(2)<<" "
972 <<setw( 6)<<Vid3[i][j] <<setw(2)<<" "
973 <<setw(18)<<dV2[i][j] <<setw(2)<<" "
974 <<setw(18)<<dV3[i][j] <<setw(2)<<" "
975 <<setw(18)<<zCross[i][j] <<setw(2)<<" "
976 <<setw(18)<<Vnext <<setw(2)<<" "
977 <<endl
978 ;
979 }// sheet
980 }// layer
981 //cout<<endl;
982 }// loop phi
983}
984
985
double sin(const BesAngle a)
double cos(const BesAngle a)
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
#define M_PI
Definition: TConstant.h:4
void initAlignPar(std::string alignFile)
double getZFromPhiV(double phi, double V, int checkXRange=1) const
double getPhiFromXID(int X_ID) const
double getDist2ClosestXStripCenter(double phi, int &id)
int getClosestXStripID(double phi, double &dist)
int getXStripID(double phi) const
double getX(double phi) const
int getClosestVStripID(G4ThreeVector pos, double &dist) const
void getStripID(G4ThreeVector pos, int &X_ID, int &V_ID) const
double getDist2ClosestVStripCenter(G4ThreeVector pos, int &id)
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
Definition: CgemGeomSvc.cxx:49
void handle(const Incident &inc)
virtual StatusCode finalize()
bool initGeom()
CgemGeomSvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CgemGeomSvc.cxx:26
CgemGeoReadoutPlane * getReadoutPlane(int iLayer, int iSheet) const
virtual StatusCode initialize()
Definition: CgemGeomSvc.cxx:60
void readAlignPar()
void setReadoutPlane(int layer, int sheet, CgemGeoReadoutPlane *readoutPtr)