1#include "GaudiKernel/Algorithm.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"
13#include "GaudiKernel/MsgStream.h"
16#include "GaudiKernel/ISvcLocator.h"
17#include "GaudiKernel/IDataProviderSvc.h"
18#include "GaudiKernel/Bootstrap.h"
28 :Service(name,pSvcLocator)
30 declareProperty(
"UseIniGeomFile", m_iFile = 6);
31 declareProperty(
"PrintDebugInfo", m_debugCout =
false);
32 declareProperty(
"TestReadoutPlane", m_testReadoutPlane =
false);
33 declareProperty(
"AlignFile", m_alignFile);
34 declareProperty(
"UseEffectiveDensityHoles", m_effDensityHoles =
false);
35 declareProperty(
"UseEffectiveDensityStrips", m_effDensityStrips =
false);
39 for(
int i=0; i<m_N_CgemLayer; i++){
40 for(
int j=0; j < m_N_GemFoil; j++)
delete m_foil[i][j];
42 for(
int j=0; j<nSheet; j++)
delete m_ReadoutPlane[i][j];
43 delete m_CgemLayer[i];
45 delete m_CgemSeparator;
53 if ( IID_ICgemGeomSvc.versionMatch(riid) ) {
56 return Service::queryInterface(riid, ppvInterface) ;
58 return StatusCode::SUCCESS;
63 MsgStream log(
msgSvc(), name());
64 log << MSG::INFO <<
"initializing......" << endreq;
66 StatusCode sc = Service::initialize();
67 if ( sc.isFailure() )
return sc;
72 for(
int layer=0; layer<m_N_CgemLayer; layer++){
77 cout <<
"CgemGeomSvc::initialize(): alignfile: " << m_alignFile <<
" --------------------------------------" << endl;
81 for(
int layer=0; layer<m_N_CgemLayer; layer++){
86 m_midDrift->
setR(layer, r);
89 for(
int i=0; i<nSheet; i++){
97 if(m_testReadoutPlane) TestReadoutPlane();
99 return StatusCode::SUCCESS;
105 MsgStream log(
msgSvc(),name());
107 log<<MSG::INFO <<
"finalizing.... "<<endreq;
109 log<<MSG::INFO <<
"End of Run "<<endreq;
110 return StatusCode::SUCCESS;
115 MsgStream log( messageService(), name() );
116 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
118 IDataProviderSvc* m_eventSvc;
119 Gaudi::svcLocator()->service(
"EventDataSvc", m_eventSvc,
true);
120 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,
"/Event/EventHeader");
122 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
148 string geoFilePath = getenv(
"CGEMGEOMSVCROOT");
150 cout <<
"IFILE " << m_iFile << endl;
154 geoFilePath +=
"/dat/cgem_model_1_default.txt";
157 geoFilePath +=
"/dat/cgem_model_2_default.txt";
160 geoFilePath +=
"/dat/cgem_model_3_default.txt";
163 geoFilePath +=
"/dat/cgem_model_4_default.txt";
166 geoFilePath +=
"/dat/cgem_model_5_default.txt";
169 geoFilePath +=
"/dat/cgem_model_6_default.txt";
173 geoFilePath +=
"/dat/cgem_model_oldgeom.txt";
177 cout <<
"Warning in CgemGeomSvc::initGeom(): The geometry will be constructed through default model!" << endl;
178 geoFilePath +=
"/dat/cgem_model_6_default.txt";
181 cout <<
"INFO in CgemGeomSvc::initGeom(): Geometry will be constructed through File: "
182 << geoFilePath << endl;
185 ifstream fin(geoFilePath.c_str(), ios::in);
188 cout <<
"Error in CgemGeomSvc::initGeom(): Fail to open geomtry file: " << endl;
189 cout << geoFilePath << endl;
195 if(m_debugCout) cout << left <<
"=======get BesMdcGeoParameter from CgemGeomSvc=======" << endl;
198 std::getline(fin, strcom);
199 std::getline(fin, strcom);
202 if(m_debugCout) cout <<
"N_CgemLayer : " << left << setw(8) << m_N_CgemLayer
203 <<
"N_GemFoil : " << left << setw(8) << m_N_GemFoil << endl;
204 std::getline(fin, strcom);
205 std::getline(fin, strcom);
206 std::getline(fin, strcom);
207 double rLayer, lenLayer, numSheet, wSheet, aStereo, wPitchX, wPitchV, wStripX, wStripV, nChannelX, nChannelV;
208 double phi_start[3][2], dX_start_strip[3][2], dV_start_strip[3][2];
210 for (
int i=0; i < m_N_CgemLayer; i++)
212 fin >> rLayer >> lenLayer >> numSheet >> wSheet >> aStereo >> wPitchX >> wPitchV
213 >> wStripX >> wStripV >> nChannelX >> nChannelV
214 >> phi_start[i][0] >> phi_start[i][1]
215 >> dX_start_strip[i][0] >> dX_start_strip[i][1]
216 >> dV_start_strip[i][0] >> dV_start_strip[i][1]
217 >> gap_d[i] >> m_Orientation;
221 m_T_Gap_D[i] = gap_d[i];
235 std::getline(fin, strcom);
239 double ncMaterials[3];
240 double tc_cu1[3],tc_kapton1[3], tc_epoxy0[3],tc_carbonf[3],tc_epoxy1[3],tc_honeycomb[3],tc_rohacell1[3],tc_epoxy2[3],tc_kapton2[3],tc_epoxy3[3],tc_rohacell2[3],tc_epoxy4[3],tc_kapton3[3],tc_cu2[3];
241 std::getline(fin, strcom);
246 fin >>nmc_Materials[0]>>nmc_Materials[1]>>nmc_Materials[2]>>nmc_Materials[3]>>nmc_Materials[4]>>nmc_Materials[5]
247 >>nmc_Materials[6]>>nmc_Materials[7]>>nmc_Materials[8]>>nmc_Materials[9]>>nmc_Materials[10]>>nmc_Materials[11]
248 >>nmc_Materials[12]>>nmc_Materials[13]>>nmc_Materials[14];
249 for (
int i=0; i < m_N_CgemLayer; i++)
251 std::getline(fin,strcom);
252 fin >>ncMaterials[i]>>tc_cu1[i]>>tc_kapton1[i]>>tc_epoxy0[i]>>tc_carbonf[i]>>tc_epoxy1[i]>>tc_honeycomb[i]>>tc_rohacell1[i]
253 >>tc_epoxy2[i]>>tc_kapton2[i]>>tc_epoxy3[i]>>tc_rohacell2[i]>>tc_epoxy4[i]>>tc_kapton3[i]>>tc_cu2[i];
255 cout <<
"Error : CgemGeomSvc::initGeom(), Number of materials in Cathode[Layer "<<i<<
"] is wrong!" << endl;
256 cout <<
"It must be less than " <<
N_MATERIAL_MAX <<
" and is " << ncMaterials[i] << endl;
257 cout <<
"please, either increase N_MATERIAL_MAX or decrease m_N_Cathode1_Materials" << endl;
262 double ngMaterials[3];
263 double tg_cu1[3],tg_kapton[3],tg_cu2[3],r_i_hole[3],r_o1_hole[3],r_o2_hole[3],l_hole[3];
264 double tg_gt1[3],tg_gt2[3],tg_gi[3];
265 std::getline(fin,strcom);
266 std::getline(fin,strcom);
267 for (
int i=0;i<m_N_CgemLayer;i++)
269 std::getline(fin,strcom);
270 fin>>tg_gt1[i]>>tg_gt2[i]>>tg_gi[i];
272 std::getline(fin,strcom);
273 std::getline(fin,strcom);
274 fin >>nmg_Materials[0]>>nmg_Materials[1]>>nmg_Materials[2]>>nmg_Materials[3];
275 for (
int i=0;i<m_N_CgemLayer;i++)
277 std::getline(fin,strcom);
278 fin>>ngMaterials[i]>>tg_cu1[i]>>tg_kapton[i]>>tg_cu2[i]>>r_i_hole[i]>>r_o1_hole[i]>>r_o2_hole[i]>>l_hole[i];
283 double naMaterials[3];
284 double ta_cu1[3],ta_kapton1[3],ta_cu2[3],ta_epoxy1[3],ta_kapton2[3],ta_epoxy2[3],ta_rohacell1[3];
285 double ta_carbonf1[3], ta_kapton3[3], ta_epoxy3[3], ta_honeycomb[3],ta_kapton4[3],ta_epoxy4[3],ta_rohacell2[3];
286 double ta_carbonf2[3],ta_epoxy5[3],ta_cu3[3],ta_kapton5[3], ta_kapton6[3], ta_cu4[3];
287 std::getline(fin,strcom);
288 std::getline(fin,strcom);
289 fin >>nma_Materials[0]>>nma_Materials[1]>>nma_Materials[2]>>nma_Materials[3]>>nma_Materials[4]>>nma_Materials[5]
290 >>nma_Materials[6]>>nma_Materials[7]>>nma_Materials[8]>>nma_Materials[9]>>nma_Materials[10]>>nma_Materials[11]
291 >>nma_Materials[12]>>nma_Materials[13]>>nma_Materials[14]>>nma_Materials[15]>>nma_Materials[16]>>nma_Materials[17]>>nma_Materials[18]
292 >>nma_Materials[19]>>nma_Materials[20];
293 for (
int i=0;i<m_N_CgemLayer;i++)
295 std::getline(fin,strcom);
296 fin >>naMaterials[i]>>ta_cu1[i]>>ta_kapton1[i]>>ta_cu2[i]>>ta_epoxy1[i]>>ta_kapton2[i]>>ta_epoxy2[i]>>ta_rohacell1[i]
297 >>ta_carbonf1[i]>>ta_kapton3[i]>>ta_epoxy3[i]>>ta_honeycomb[i]>>ta_kapton4[i]>>ta_epoxy4[i]>>ta_rohacell2[i]
298 >>ta_carbonf2[i]>>ta_epoxy5[i]>>ta_cu3[i]>>ta_kapton5[i]>>ta_kapton6[i]>>ta_cu4[i]
299 >>m_B_strip_x_on>>m_B_strip_v_on;
301 cout <<
"Error : CgemGeomSvc::initGeom(), Number of materials in Anode[L"<<i<<
"] is wrong!" << endl;
302 cout <<
"It must be less than " <<
N_MATERIAL_MAX <<
" and is " << naMaterials[i] << endl;
303 cout <<
"please, either increase N_MATERIAL_MAX or decrease N_Materials" << endl;
309 std::getline(fin, strcom);
310 std::getline(fin, strcom);
312 if(m_debugCout) cout <<
"cable density " << m_Rho_Cable << endl;
315 std::getline(fin, strcom);
316 std::getline(fin, strcom);
317 std::getline(fin, strcom);
318 double r_i_separator,r_o_separator,l_separator;
319 double t_al1,t_al2,t_carbonf;
320 fin >> r_i_separator >> r_o_separator >> l_separator;
322 std::getline(fin, strcom);
323 std::getline(fin, strcom);
324 fin >> t_al1 >> t_carbonf>> t_al2;
327 m_CgemSeparator->
setInnerR(r_i_separator);
328 m_CgemSeparator->
setOuterR(r_o_separator);
336 std::getline(fin, strcom);
337 std::getline(fin, strcom);
338 std::getline(fin, strcom);
339 fin >> m_R_i_Cgem >> m_R_o_Cgem >> m_L_Cgem;
341 std::getline(fin, strcom);
342 std::getline(fin, strcom);
343 std::getline(fin, strcom);
345 if(m_debugCout) cout <<
"Cgem passive elements are switched " << m_passive << endl;
347 double T_Cathode,T_Anode, T_GemFoil;
348 for (
int i=0; i < m_N_CgemLayer; i++) {
349 T_Cathode = tc_cu1[i]+tc_kapton1[i]+tc_epoxy0[i]+tc_carbonf[i]+tc_epoxy1[i]+tc_honeycomb[i]+tc_rohacell1[i]+tc_epoxy2[i]+tc_kapton2[i]+tc_epoxy3[i]+tc_rohacell2[i]+tc_epoxy4[i]+tc_kapton3[i]+tc_cu2[i];
350 m_T_Cathode[i] = T_Cathode;
352 T_Anode = ta_cu1[i]+ta_kapton1[i]+ta_cu2[i]+ta_epoxy1[i]+ta_kapton2[i]+ta_epoxy2[i]+ta_rohacell1[i]+ta_carbonf1[i]+ta_kapton3[i]+ta_epoxy3[i]+ta_honeycomb[i]+ta_kapton4[i]+ta_epoxy4[i]+ta_rohacell2[i]+ta_carbonf2[i]+ta_epoxy5[i]+ta_cu3[i]+ta_kapton5[i]+ta_kapton6[i]+ta_cu4[i];
353 m_T_Anode[i] = T_Anode;
355 T_GemFoil = tg_cu1[i]+tg_kapton[i]+tg_cu2[i];
356 m_T_CgemLayer[i] = T_Cathode+ gap_d[i] + tg_gt1[i] + tg_gt2[i] + tg_gi[i] + T_GemFoil*3 + T_Anode;
360 cout << left <<
"R_CgemLayer " << left <<
"L_CgemLayer "
361 << left <<
"N_Sheet " << left <<
"W_Sheet "
362 << left <<
"A_Stereo " << left <<
"W_Pitch_X "
363 << left <<
"W_Pitch_V "<< left <<
"W_Strip_X "
364 << left <<
"W_Strip_V "<< left <<
"N_Channel_Phi "
365 << left <<
"N_Channel_V " << left <<
"Orientation " << endl;
379 cout << left <<
"T_Cathode L"<<i << left <<
"T_GemFoil L"<<i << left <<
"T_Anode L"<<i
380 << left <<
"T_CgemLayer "<<i << endl;
381 cout << left << setw(10) << T_Cathode << left << setw(10) << T_GemFoil
382 << left << setw(8) << T_Anode << left << setw(9) << m_T_CgemLayer[i] << endl;
386 cout <<
"thickness " << m_T_CgemLayer[i] << endl;
391 m_CgemLayer[i]->
setOuterROfCgemLayer(m_CgemLayer[i]->getInnerROfCgemLayer() + m_T_CgemLayer[i]);
395 if(fReversed ==
false) {
397 m_CgemLayer[i]->
setOuterROfCathode( m_CgemLayer[i]->getInnerROfCgemLayer() + T_Cathode);
400 m_CgemLayer[i]->
setInnerROfCathode( m_CgemLayer[i]->getOuterROfCgemLayer() - T_Cathode);
416 inner_r_cathode[imat]+=tc_cu1[i];
421 inner_r_cathode[imat]+=tc_kapton1[i];
426 inner_r_cathode[imat]+=tc_epoxy0[i];
431 inner_r_cathode[imat]+=tc_carbonf[i];
436 inner_r_cathode[imat]+=tc_epoxy1[i];
441 inner_r_cathode[imat]+=tc_honeycomb[i];
446 inner_r_cathode[imat]+=tc_rohacell1[i];
451 inner_r_cathode[imat]+=tc_epoxy2[i];
456 inner_r_cathode[imat]+=tc_kapton2[i];
461 inner_r_cathode[imat]+=tc_epoxy3[i];
466 inner_r_cathode[imat]+=tc_rohacell2[i];
471 inner_r_cathode[imat]+=tc_epoxy4[i];
476 inner_r_cathode[imat]+=tc_kapton3[i];
481 inner_r_cathode[imat]+=tc_cu2[i];
483 if(m_debugCout) cout <<
" CATHODE CU INNER " << inner_r_cathode[imat] <<
" OUTER " << inner_r_cathode[imat]+tc_cu2[i] << endl;
492 if(m_debugCout) cout <<
"breaking" << endl;
495 inner_r_cathode[imat + 1] = inner_r_cathode[imat];
496 if(fReversed ==
false) counter++;
501 cout <<
"T_cathode: " << setw(15) <<T_Cathode;
536 if(fReversed ==
false) {
537 if (fabs((m_CgemLayer[i]->getOuterROfCathode() / m_CgemLayer[i]->getOuterROfCathodeCu2()) - 1) > FLT_EPSILON){
538 cout << fabs(m_CgemLayer[i]->getOuterROfCathode() - m_CgemLayer[i]->getOuterROfCathodeCu2()) << endl;
541 <<
", FLT_EPSILON = " << FLT_EPSILON << endl;
542 cout <<
"Error : CgemGeomSvc::initGeom(), Cathode size is wrong!" << endl;
547 if (fabs((m_CgemLayer[i]->getInnerROfCathode() / m_CgemLayer[i]->getInnerROfCathodeCu1()) - 1) > FLT_EPSILON){
548 cout << fabs(m_CgemLayer[i]->getInnerROfCathode() - m_CgemLayer[i]->getInnerROfCathodeCu1()) << endl;
551 <<
", FLT_EPSILON = " << FLT_EPSILON << endl;
552 cout <<
"Error : CgemGeomSvc::initGeom(), Cathode size is wrong!" << endl;
558 if(fReversed ==
false) {
559 m_CgemLayer[i]->
setInnerROfGapD( m_CgemLayer[i]->getOuterROfCathode() );
560 m_CgemLayer[i]->
setOuterROfGapD( m_CgemLayer[i]->getOuterROfCathode() + gap_d[i] );
561 m_CgemLayer[i]->
setInnerROfGapT1( m_CgemLayer[i]->getOuterROfGapD() + tg_cu1[i]+tg_kapton[i]+tg_cu2[i] );
562 m_CgemLayer[i]->
setOuterROfGapT1( m_CgemLayer[i]->getInnerROfGapT1() + tg_gt1[i] );
563 m_CgemLayer[i]->
setInnerROfGapT2( m_CgemLayer[i]->getOuterROfGapT1() + tg_cu1[i]+tg_kapton[i]+tg_cu2[i]);
564 m_CgemLayer[i]->
setOuterROfGapT2( m_CgemLayer[i]->getInnerROfGapT2() + tg_gt2[i] );
565 m_CgemLayer[i]->
setInnerROfGapI( m_CgemLayer[i]->getOuterROfGapT2() + tg_cu1[i]+tg_kapton[i]+tg_cu2[i] );
566 m_CgemLayer[i]->
setOuterROfGapI( m_CgemLayer[i]->getInnerROfGapI() + tg_gi[i]);
569 m_CgemLayer[i]->
setOuterROfGapD( m_CgemLayer[i]->getInnerROfCathode() );
570 m_CgemLayer[i]->
setInnerROfGapD( m_CgemLayer[i]->getInnerROfCathode() - gap_d[i]);
571 m_CgemLayer[i]->
setOuterROfGapT1( m_CgemLayer[i]->getInnerROfGapD() - tg_cu1[i]-tg_kapton[i]-tg_cu2[i]);
572 m_CgemLayer[i]->
setInnerROfGapT1( m_CgemLayer[i]->getOuterROfGapT1() - tg_gt1[i]);
573 m_CgemLayer[i]->
setOuterROfGapT2( m_CgemLayer[i]->getInnerROfGapT1() - tg_cu1[i]-tg_kapton[i]-tg_cu2[i] );
574 m_CgemLayer[i]->
setInnerROfGapT2( m_CgemLayer[i]->getOuterROfGapT2() - tg_gt2[i]);
575 m_CgemLayer[i]->
setOuterROfGapI( m_CgemLayer[i]->getInnerROfGapT2() - tg_cu1[i]-tg_kapton[i]-tg_cu2[i]);
576 m_CgemLayer[i]->
setInnerROfGapI( m_CgemLayer[i]->getOuterROfGapI() - tg_gi[i]);
581 cout <<
"Geom foil&gap " << setw(15) << gap_d[i] << setw(15)
582 << tg_cu1[i]+tg_kapton[i]+tg_cu2[i] << setw(15) << tg_gt1[i]
583 << setw(15) << tg_gt2[i] << setw(15) << tg_gi[i] << endl;
585 cout <<
"gaps: -----------------------------" << endl;
597 if (m_N_GemFoil != 3){
598 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;
602 double R_i_GemFoil[3] = {0};
603 if(fReversed ==
false) {
614 for(
int j=0; j < m_N_GemFoil; j++){
622 double m_t_foil_list[
N_MATERIAL_MAX] = {tg_cu1[i], tg_kapton[i], tg_cu2[i]};
624 inner_r_foil[0] = R_i_GemFoil[j];
626 if(fReversed ==
true) counter = ngMaterials[i] - 1;
634 for(
int imat = 0; imat < ngMaterials[i]; imat++) {
635 outer_r_foil[imat] = inner_r_foil[imat] + m_t_foil_list[counter];
655 if(imat == ngMaterials[i] - 1) {
656 if(m_debugCout) cout <<
"breaking" << endl;
659 inner_r_foil[imat + 1] = outer_r_foil[imat];
660 if(fReversed ==
false) counter++;
671 cout <<
"Geom foil: layer " << i <<
" " << j << endl;
672 cout << setw(15) << tg_cu1[i] << setw(15)
673 << tg_kapton[i] << setw(15) << tg_cu2[i] << endl;
690 cout <<
"GEM" << endl;
700 cout <<
"GEM" << endl;
712 if(fReversed ==
false) {
714 m_CgemLayer[i]->
setOuterROfAnode( m_CgemLayer[i]->getOuterROfGapI() + T_Anode );
717 m_CgemLayer[i]->
setInnerROfAnode( m_CgemLayer[i]->getInnerROfGapI() - T_Anode);
727 ta_cu1[i],ta_kapton1[i],ta_cu2[i],ta_epoxy1[i],ta_kapton2[i],ta_epoxy2[i],ta_rohacell1[i],ta_carbonf1[i],ta_kapton3[i],ta_epoxy3[i],ta_honeycomb[i],ta_kapton4[i],ta_epoxy4[i],ta_rohacell2[i],ta_carbonf2[i],ta_epoxy5[i],ta_cu3[i],ta_kapton5[i],ta_kapton6[i],ta_cu4[i]
735 outer_r_anode[imat] = inner_r_anode[imat] + m_t_anode_list[counter];
824 if(m_debugCout) cout <<
"breaking" << endl;
827 inner_r_anode[imat + 1] = outer_r_anode[imat];
828 if(fReversed ==
false) counter++;
833 cout <<
"ANODE: " << endl;
876 cout <<
"X strip description is " << m_B_strip_x_on <<
" and V strip description is " << m_B_strip_v_on << endl;
880 if(fReversed ==
false) {
881 if(fabs((m_CgemLayer[i]->getOuterROfAnode() / m_CgemLayer[i]->getOuterROfCgemLayer())-1) > FLT_EPSILON){
882 cout << fabs(m_CgemLayer[i]->getOuterROfAnode() - m_CgemLayer[i]->getOuterROfCgemLayer()) << endl;
883 cout << FLT_EPSILON << endl;
884 cout <<
"Error : CgemLayer size is wrong!" << endl;
889 if(fabs((m_CgemLayer[i]->getInnerROfAnode() / m_CgemLayer[i]->getInnerROfCgemLayer())-1) > FLT_EPSILON){
890 cout << fabs(m_CgemLayer[i]->getInnerROfAnode() - m_CgemLayer[i]->getInnerROfCgemLayer()) << endl;
891 cout << FLT_EPSILON << endl;
892 cout <<
"Error : CgemLayer size is wrong!" << endl;
898 m_CgemLayer[i]->
print();
908 double width_sheet=rXstrips*CLHEP::twopi/nSheet;
909 if(m_debugCout) cout<<
"construct CgemReadoutPlanes: "<<endl;
913 for(
int j=0; j<nSheet; j++){
914 if(m_debugCout) cout<<
"------ layer "<<i<<
", sheet "<<j<<
" ------ "<<endl;
915 double rStrips = 0.5*(rXstrips+rVstrips);
919 phi_start[i][j], dX_start_strip[i][j],
920 dV_start_strip[i][j],
922 -0.5*m_CgemLayer[i]->getLengthOfCgemLayer(),
923 m_CgemLayer[i]->getLengthOfCgemLayer(),
924 m_CgemLayer[i]->getNumberOfChannelX()/nSheet,
925 m_CgemLayer[i]->getNumberOfChannelV()/nSheet,
926 m_CgemLayer[i]->getWidthOfPitchX(),
927 m_CgemLayer[i]->getWidthOfStripX(),
928 m_CgemLayer[i]->getWidthOfPitchV(),
929 m_CgemLayer[i]->getWidthOfStripV(),
930 m_CgemLayer[i]->getAngleOfStereo(),
931 m_CgemLayer[i]->getMiddleROfGapD(),
932 m_CgemLayer[i]->getOuterROfGapD()
938 if(m_debugCout) cout <<
"INFO : CgemGeomSvc::initGeom(), Successfully input geometry parameters!" << endl;
947 cout <<
"====================CGEM Information=========================" << endl;
948 cout <<
"R_i_Cgem " <<
"R_o_Cgem " <<
"L_Cgem" << endl;
949 cout << left << setw(10) << m_R_i_Cgem
950 << left << setw(10) << m_R_o_Cgem
951 << left << setw(10) << m_L_Cgem << endl;
952 cout <<
"====================CGEM Information End!====================" << endl;
956 cout <<
"************************ FINAL CHECK OF THE DIMENSIONS" << endl;
957 for(
int ilayer = 0; ilayer < 3; ilayer++) {
960 cout <<
"inner global radius of layer" << ilayer <<
": " << m_CgemLayer[ilayer]->
getInnerROfCgemLayer()
965 for(
int ifoil = 0; ifoil < 3; ifoil++) {
966 cout <<
"inner radius of gem" << ifoil <<
": " << m_foil[ilayer][ifoil]->
getInnerROfCgemFoil()
970 cout <<
"inner radius of anode: " << m_CgemLayer[ilayer]->
getInnerROfAnode()
980void CgemGeomSvc::TestReadoutPlane() {
981 const int nSheet[3]={1,2,2};
985 const double phimin(0.), phimax(7.);
986 const int nphi=20000;
987 const double zmin(-850), zmax(850);
990 double phi(0.), z(0),
v(0.);
1002 double X[3][2], dX2[3][2], dX3[3][2], PHI[3][2],
1003 V[3][2], dV2[3][2], dV3[3][2],
1007 cout<<setiosflags(ios::left)
1008 <<setw(14)<<
"phi" <<setw(2)<<
" "
1009 <<setw(14)<<
"z" <<setw(2)<<
" "
1010 <<setw( 6)<<
"layer" <<setw(2)<<
" "
1011 <<setw( 6)<<
"sheet" <<setw(2)<<
" "
1012 <<setw( 6)<<
"onIt" <<setw(2)<<
" "
1013 <<setw(14)<<
"X" <<setw(2)<<
" "
1014 <<setw( 6)<<
"Xid" <<setw(2)<<
" "
1015 <<setw( 6)<<
"Xid2" <<setw(2)<<
" "
1016 <<setw( 6)<<
"Xid3" <<setw(2)<<
" "
1017 <<setw(18)<<
"dX2" <<setw(2)<<
" "
1018 <<setw(18)<<
"dX3" <<setw(2)<<
" "
1019 <<setw(18)<<
"PHI" <<setw(2)<<
" "
1020 <<setw(18)<<
"V" <<setw(2)<<
" "
1021 <<setw( 6)<<
"Vid" <<setw(2)<<
" "
1022 <<setw( 6)<<
"Vid2" <<setw(2)<<
" "
1023 <<setw( 6)<<
"Vid3" <<setw(2)<<
" "
1024 <<setw(18)<<
"dV2" <<setw(2)<<
" "
1025 <<setw(18)<<
"dV3" <<setw(2)<<
" "
1026 <<setw(18)<<
"zCross" <<setw(2)<<
" "
1027 <<setw(18)<<
"Vnext" <<setw(2)<<
" "
1028 <<setw(18)<<
"VStripLen"<<setw(2)<<
" "
1032 for(
int ii=0; ii<nphi; ii++)
1034 phi= phimin+(ii+0.5)*(phimax-phimin)/nphi;
1037 for(
int i=0; i<m_N_CgemLayer; i++)
1040 for(
int j=0; j<nSheet[i]; j++)
1045 X[i][j] =anode->
getX(phi);
1051 G4ThreeVector pos(
cos(phi),
sin(phi),z);
1054 anode->
getStripID(pos,Xid4[i][j],Vid4[i][j]);
1057 int iSheetNext= (j+1)%nSheet[i];
1060 double phimin_next = anodeNext->
getPhimin();
1065 cout<<setiosflags(ios::left)
1066 <<setw(14)<<phi <<setw(2)<<
" "
1067 <<setw(14)<<z <<setw(2)<<
" "
1068 <<setw( 6)<<i <<setw(2)<<
" "
1069 <<setw( 6)<<j <<setw(2)<<
" "
1070 <<setw( 6)<<int(onPlane[i][j]) <<setw(2)<<
" "
1071 <<setw(14)<<X[i][j] <<setw(2)<<
" "
1072 <<setw( 6)<<Xid[i][j] <<setw(2)<<
" "
1073 <<setw( 6)<<Xid2[i][j] <<setw(2)<<
" "
1074 <<setw( 6)<<Xid3[i][j] <<setw(2)<<
" "
1075 <<setw(18)<<dX2[i][j] <<setw(2)<<
" "
1076 <<setw(18)<<dX3[i][j] <<setw(2)<<
" "
1078 <<setw(18)<<PHI[i][j] <<setw(2)<<
" "
1079 <<setw(18)<<V[i][j] <<setw(2)<<
" "
1080 <<setw( 6)<<Vid[i][j] <<setw(2)<<
" "
1081 <<setw( 6)<<Vid2[i][j] <<setw(2)<<
" "
1082 <<setw( 6)<<Vid3[i][j] <<setw(2)<<
" "
1083 <<setw(18)<<dV2[i][j] <<setw(2)<<
" "
1084 <<setw(18)<<dV3[i][j] <<setw(2)<<
" "
1085 <<setw(18)<<zCross[i][j] <<setw(2)<<
" "
1086 <<setw(18)<<Vnext <<setw(2)<<
" "
1087 <<setw(18)<<VStripLen <<setw(2)<<
" "
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
void setLayerR(int layer_geo, double r)
void initAlignPar(std::string alignFile)
double getOuterROfCgemFoilCu1() const
double getInnerROfCgemFoilCu2() const
void setIDOfCgemFoil(int id)
void setInnerROfCgemFoilKapton(double r)
void setOuterROfCgemFoilCu1(double r)
double getOuterROfCgemFoilKapton() const
void setLengthOfCgemFoilHole(double r)
void setInnerROfCgemFoilCu1(double r)
double getInnerROfCgemFoil() const
double getInnerROfCgemFoilCu1() const
void setOuterROfCgemFoilCu2(double r)
int getIDOfCgemFoil() const
void setInnerROfCgemFoilCu2(double r)
void setOuterR1OfCgemFoilHole(double r)
void setOuterROfCgemFoilKapton(double r)
void setOuterR2OfCgemFoilHole(double r)
double getInnerROfCgemFoilKapton() const
void setOuterROfCgemFoil(double r)
void setInnerROfCgemFoil(double r)
double getOuterROfCgemFoilCu2() const
double getOuterROfCgemFoil() const
void setInnerROfCgemFoilHole(double r)
void setWidthOfPitchV(double w)
double getMiddleROfGapD() const
void setWidthOfStripX(double w)
double getOuterROfAnodeCu1() const
void setInnerROfCathodeEpoxy3(double r)
void setAngleOfStereo(double a)
void setIDOfCgemLayer(int id)
void setOuterROfAnodeKapton4(double r)
void setInnerROfCathodeEpoxy4(double r)
double getInnerROfCathode() const
void setInnerROfAnodeKapton6(double r)
double getInnerROfAnodeEpoxy4() const
double getInnerROfAnodeEpoxy1() const
void setInnerROfAnodeRohacell2(double r)
void setOuterROfCathodeKapton3(double r)
void setOuterROfAnodeCarbonf2(double r)
double getInnerROfCathodeKapton2() const
void setOuterROfAnodeCu3(double r)
void setOuterROfAnodeKapton1(double r)
double getInnerROfCathodeEpoxy0() const
double getWidthOfPitchV() const
void setOuterROfAnodeRohacell2(double r)
double getOuterROfCathodeEpoxy4() const
double getInnerROfGapI() const
double getOuterROfAnodeCarbonf1() const
void setOuterROfAnode(double r)
void setInnerROfAnodeHoneycomb(double r)
double getWidthOfStripV() const
double getOuterROfGapD() const
void setOuterROfAnodeEpoxy5(double r)
void setOuterROfCathodeRohacell2(double r)
double getInnerROfCathodeKapton3() const
void setInnerROfCathodeCarbonf(double r)
double getInnerROfAnodeHoneycomb() const
double getOuterROfAnodeEpoxy2() const
double getInnerROfGapT1() const
double getInnerROfCathodeCu1() const
double getLengthOfCgemLayer() const
void setInnerROfAnodeCu2(double r)
double getOuterROfCathodeEpoxy1() const
void setOuterROfAnodeEpoxy3(double r)
double getInnerROfCathodeCu2() const
void setOuterROfAnodeKapton5(double r)
double getInnerROfCathodeEpoxy2() const
double getInnerROfAnodeKapton6() const
double getOuterROfCathodeKapton1() const
double getOuterROfAnodeHoneycomb() const
void setOuterROfCathodeKapton2(double r)
void setInnerROfCathodeKapton2(double r)
void setOuterROfAnodeEpoxy1(double r)
double getOuterROfAnodeKapton2() const
double getInnerROfCathodeEpoxy4() const
double getOuterROfAnodeCu4() const
double getOuterROfAnodeKapton1() const
void setInnerROfAnodeEpoxy5(double r)
double getOuterROfCathodeCu2() const
double getInnerROfAnodeCu1() const
void setInnerROfCathodeCu2(double r)
double getInnerROfAnodeKapton2() const
void setInnerROfGapD(double r)
void setOuterROfGapI(double r)
double getInnerROfCgemLayer() const
double getOuterROfCathodeEpoxy3() const
void setNumberOfChannelV(int n)
double getInnerROfAnode() const
double getInnerROfGapT2() const
void setCgemFoil(int i, CgemGeoFoil *pFoil)
double getWidthOfStripX() const
double getOuterROfAnodeRohacell1() const
void setInnerROfAnodeEpoxy2(double r)
void setOuterROfAnodeKapton2(double r)
double getOuterROfGapT1() const
void setInnerROfAnodeCarbonf2(double r)
void setOuterROfGapT2(double r)
double getOuterROfCathodeRohacell2() const
double getOuterROfCathodeCarbonf() const
void setOuterROfCathodeKapton1(double r)
double getOuterROfGapT2() const
double getInnerROfAnodeCu3() const
int getNumberOfSheet() const
void setOuterROfCathodeCarbonf(double r)
void setInnerROfAnodeKapton1(double r)
void setInnerROfAnodeCarbonf1(double r)
double getOuterROfAnodeCu3() const
double getInnerROfCathodeEpoxy3() const
void setOuterROfAnodeKapton3(double r)
double getOuterROfAnodeKapton3() const
void setInnerROfCgemLayer(double innerR)
double getOuterROfAnode() const
double getOuterROfCathodeCu1() const
void setInnerROfAnodeCu1(double r)
void setInnerROfGapT1(double r)
void setInnerROfGapI(double r)
void setInnerROfCathodeHoneycomb(double r)
double getOuterROfCathodeKapton3() const
int getNumberOfChannelX() const
double getInnerROfAnodeRohacell1() const
void setNumberOfSheet(int n)
void setInnerROfAnodeCu3(double r)
void setInnerROfAnode(double r)
int getNumberOfChannelV() const
void setInnerROfGapT2(double r)
double getOuterROfCathode() const
double getOuterROfAnodeEpoxy1() const
double getWidthOfSheet() const
double getInnerROfAnodeEpoxy2() const
void setOuterROfCathodeEpoxy4(double r)
double getOuterROfCathodeRohacell1() const
double getOuterROfAnodeEpoxy4() const
void setInnerROfCathodeRohacell1(double r)
void setInnerROfAnodeCu4(double r)
void setOuterROfAnodeEpoxy2(double r)
void setInnerROfAnodeRohacell1(double r)
void setOuterROfGapT1(double r)
double getInnerROfAnodeCu4() const
void setInnerROfAnodeKapton5(double r)
double getOuterROfAnodeCarbonf2() const
double getOuterROfGapI() const
void setOrientation(bool o)
void setOuterROfAnodeCu2(double r)
double getInnerROfAnodeRohacell2() const
void setInnerROfCathodeRohacell2(double r)
double getOuterROfCgemLayer() const
void setOuterROfCathodeRohacell1(double r)
void setInnerROfAnodeKapton4(double r)
double getInnerROfCathodeCarbonf() const
void setInnerROfCathodeEpoxy1(double r)
double getAngleOfStereo() const
double getInnerROfAnodeCarbonf1() const
void setOuterROfCathodeEpoxy1(double r)
void setNumberOfChannelX(int n)
void setOuterROfAnodeKapton6(double r)
double getInnerROfAnodeEpoxy3() const
void setOuterROfCgemLayer(double outerR)
double getOuterROfAnodeEpoxy5() const
void setOuterROfCathodeEpoxy0(double r)
double getInnerROfCathodeKapton1() const
double getWidthOfPitchX() const
void setOuterROfCathodeCu2(double r)
void setWidthOfStripV(double w)
double getInnerROfAnodeKapton3() const
void setOuterROfCathodeHoneycomb(double r)
double getInnerROfCathodeEpoxy1() const
double getInnerROfAnodeKapton4() const
void setOuterROfCathodeEpoxy2(double r)
bool getOrientation() const
void setInnerROfCathodeKapton1(double r)
void setInnerROfCathodeEpoxy0(double r)
void setLengthOfCgemLayer(double length)
void setInnerROfCathodeCu1(double r)
void setOuterROfAnodeHoneycomb(double r)
void setInnerROfCathodeKapton3(double r)
void setInnerROfAnodeEpoxy1(double r)
void setInnerROfCathode(double r)
double getInnerROfAnodeEpoxy5() const
void setOuterROfAnodeCarbonf1(double r)
double getOuterROfAnodeCu2() const
double getInnerROfGapD() const
double getInnerROfAnodeCarbonf2() const
void setInnerROfAnodeKapton3(double r)
double getInnerROfAnodeKapton5() const
double getOuterROfAnodeEpoxy3() const
double getInnerROfAnodeKapton1() const
void setInnerROfCathodeEpoxy2(double r)
double getOuterROfCathodeEpoxy2() const
double getInnerROfAnodeCu2() const
double getOuterROfCathodeHoneycomb() const
void setOuterROfCathodeEpoxy3(double r)
double getOuterROfCathodeKapton2() const
double getOuterROfAnodeKapton4() const
void setInnerROfAnodeEpoxy3(double r)
double getInnerROfCathodeHoneycomb() const
double getInnerROfCathodeRohacell1() const
void setOuterROfGapD(double r)
void setOuterROfAnodeCu1(double r)
void setOuterROfAnodeCu4(double r)
double getOuterROfAnodeKapton5() const
void setOuterROfCathodeCu1(double r)
void setWidthOfSheet(double w)
void setOuterROfAnodeRohacell1(double r)
double getInnerROfCathodeRohacell2() const
void setWidthOfPitchX(double w)
void setInnerROfAnodeEpoxy4(double r)
void setOuterROfAnodeEpoxy4(double r)
double getOuterROfAnodeRohacell2() const
double getOuterROfAnodeKapton6() const
double getOuterROfCathodeEpoxy0() const
void setInnerROfAnodeKapton2(double r)
void setOuterROfCathode(double r)
double getVFromPhiZ(double phi, double z, bool checkRange=true) const
double getVStripLength(int V_ID) const
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
bool OnThePlane(double phi, double z) const
int getVIDFromV(double V) const
double getX(double phi) const
double getVInNextSheetFromV(double v, double phiminNext) 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)
void setInnerR(double innerR)
void setOuterR(double outerR)
void setLength(double length)
void setThickOfOuterAluminum(double thick)
void setThickOfCarbonFiber(double thick)
void setThickOfInnerAluminum(double thick)
static const int NMATERIALS_CATHODE
static const int NMATERIALS_ANODE
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
void handle(const Incident &inc)
static const int N_MATERIAL_MAX
virtual StatusCode finalize()
CgemGeomSvc(const std::string &name, ISvcLocator *pSvcLocator)
CgemGeoReadoutPlane * getReadoutPlane(int iLayer, int iSheet) const
virtual StatusCode initialize()
void setAlignment(CgemGeoAlign *alignPtr)
void setR(int layer, double r)
void setReadoutPlane(int layer, int sheet, CgemGeoReadoutPlane *readoutPtr)