]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/PMDSurveyPointsGen_v1.C
Adding consistency checks (Jens)
[u/mrichter/AliRoot.git] / PMD / PMDSurveyPointsGen_v1.C
1 void PMDSurveyPointsGen_v1(){
2   
3   // Macro to generate survey points in the format of AliSurveyObj 
4   // by giving some finite rotation and translation.
5   
6   if(!gGeoManager) AliGeomManager::LoadGeometry("geometry.root");
7   
8   TClonesArray *array = new TClonesArray("AliAlignObjMatrix",10);
9   TClonesArray &mobj = *array;
10   
11   Double_t l_vect[3]={0.,0.,0.}; // a local vector (the origin)
12   
13   Double_t g_vect_1[3];    // vector corresp. to it in global RS for sector-1
14   Double_t g_vect_2[3];    // vector corresp. to it in global RS for sector-2
15   Double_t g_vect_3[3];    // vector corresp. to it in global RS for sector-3
16   Double_t g_vect_4[3];    // vector corresp. to it in global RS for sector-4
17   
18   //**************** get global matrix *******************
19   
20   TGeoHMatrix *g3_1 = AliGeomManager::GetMatrix("PMD/Sector1");
21   TGeoNode* n3_1 = gGeoManager->GetCurrentNode();
22   TGeoHMatrix* l3_1 = n3_1->GetMatrix();// to get local matrix  
23   g3_1->LocalToMaster(l_vect,g_vect_1); // point coordinates in the global RS
24   
25   cout<<endl<<"Origin of sector-1 in the global RS: "<<
26     g_vect_1[0]<<" "<<g_vect_1[1]<<" "<<g_vect_1[2]<<" "<<endl;
27   
28
29   TGeoHMatrix *g3_2 = AliGeomManager::GetMatrix("PMD/Sector2");
30   TGeoNode* n3_2 = gGeoManager->GetCurrentNode();
31   TGeoHMatrix* l3_2 = n3_2->GetMatrix(); 
32   g3_2->LocalToMaster(l_vect,g_vect_2);
33   
34   cout<<endl<<"Origin of sector-2 in the global RS: "<<
35     g_vect_2[0]<<" "<<g_vect_2[1]<<" "<<g_vect_2[2]<<" "<<endl;
36   
37   
38   TGeoHMatrix *g3_3 = AliGeomManager::GetMatrix("PMD/Sector3");
39   TGeoNode* n3_3 = gGeoManager->GetCurrentNode();
40   TGeoHMatrix* l3_3 = n3_3->GetMatrix(); 
41   g3_3->LocalToMaster(l_vect,g_vect_3);
42   
43   cout<<endl<<"Origin of the sector-3 in the global RS: "<<
44     g_vect_3[0]<<" "<<g_vect_3[1]<<" "<<g_vect_3[2]<<" "<<endl;
45   
46   
47   TGeoHMatrix *g3_4 = AliGeomManager::GetMatrix("PMD/Sector4");
48   TGeoNode* n3_4 = gGeoManager->GetCurrentNode();
49   TGeoHMatrix* l3_4 = n3_4->GetMatrix();
50   g3_4->LocalToMaster(l_vect,g_vect_4);
51   
52   cout<<endl<<"Origin of the sector-4 in the global RS: "<<
53     g_vect_4[0]<<" "<<g_vect_4[1]<<" "<<g_vect_4[2]<<" "<<endl;
54   
55   
56   
57   // Hereafter the four ideal fiducial marks on the PMD 
58   // are expressed in local coordinates. 
59   //All the coordinates are expressed in cm here.
60   const Double_t zsize   = 2.3;
61   const Double_t zoffset = 0.0;
62   const Double_t zdepth  = zsize + zoffset + g_vect_1[2];
63   
64   // Coordinates of four Ideal fudicial marks on the sector-1 of the PMD in 
65   //global frame of reference.
66   
67   Double_t A1[3] = {12.025, 37.85, zdepth};// Fiducial mark # 19
68   Double_t B1[3] = {74.275, 37.85, zdepth};// Fiducial mark # 20
69   Double_t C1[3] = {74.275, 87.05, zdepth};// Fiducial mark # 18
70   Double_t D1[3] = {12.025, 87.05, zdepth};// Fiducial mark # 17
71      
72   // Coordinates of four Ideal fudicial marks on the sector-2 of the PMD in 
73   //global frame of reference.
74     
75   Double_t A2[3] = {-74.275, -87.05, zdepth};// Fiducial mark # 15
76   Double_t B2[3] = {-12.025, -87.05, zdepth};// Fiducial mark # 16
77   Double_t C2[3] = {-12.025, -37.85, zdepth};// Fiducial mark # 14
78   Double_t D2[3] = {-74.275, -37.85, zdepth};// Fiducial mark # 13
79   
80   // Coordinates of four Ideal fudicial marks on the sector-3 of the PMD in 
81   //global frame of reference.
82   
83   Double_t A3[3] = {-74.275, 11.15, zdepth};// Fiducial mark # 11
84   Double_t B3[3] = {7.725, 11.15, zdepth};  // Fiducial mark # 12
85   Double_t C3[3] = {7.725, 87.05, zdepth};  // Fiducial mark # 06
86   Double_t D3[3] = {-74.25, 87.05, zdepth}; // Fiducial mark # 05
87   
88   // Coordinates of four Ideal fudicial marks on the sector-4 of the PMD in 
89   //global frame of reference.
90   
91   Double_t A4[3] = {-7.725, -87.05, zdepth};// Fiducial mark # 27
92   Double_t B4[3] = {74.275, -87.05, zdepth};// Fiducial mark # 28
93   Double_t C4[3] = {74.275, -11.15, zdepth};// Fiducial mark # 22
94   Double_t D4[3] = {-7.725, -11.15, zdepth};// Fiducial mark # 21
95   
96   // Let's  misalign the sector-1 for testing purpose only.
97   for (Int_t i = 0; i < 3; i++) 
98     {
99       // To convert the coordinates of fiducial marks in local RS as those are
100       // given  above in global RS.
101       A1[i] = A1[i] - g_vect_1[i];
102       B1[i] = B1[i] - g_vect_1[i];
103       C1[i] = C1[i] - g_vect_1[i];
104       D1[i] = D1[i] - g_vect_1[i];
105       
106     }
107   
108   
109   //                    ^ local y
110   //                    |
111   //      D-------------|-------------C
112   //      |             |             |
113   //      |             |             |
114   //      |             |             |
115   //      |             |             |
116   //      |             |             |
117   //      |             |             |
118   //  ------------------|------------------> local x
119   //      |             |             |
120   //      |             |             |
121   //      |             |             |
122   //      |             |             |
123   //      |             |             |
124   //      |             |             |
125   //      A-------------|-------------B
126   //
127   // local z exiting the plane of the screen
128    
129   Double_t gA1[3], gB1[3], gC1[3], gD1[3];
130   
131   g3_1->LocalToMaster(A1,gA1);
132   g3_1->LocalToMaster(B1,gB1);
133   g3_1->LocalToMaster(C1,gC1);
134   g3_1->LocalToMaster(D1,gD1);
135
136   /*
137   cout<<endl<<"Ideal fiducial marks coordinates in the global RS:1\n"<<
138     "A1 "<<gA1[0]<<" "<<gA1[1]<<" "<<gA1[2]<<" "<<endl<<
139     "B1 "<<gB1[0]<<" "<<gB1[1]<<" "<<gB1[2]<<" "<<endl<<
140     "C1 "<<gC1[0]<<" "<<gC1[1]<<" "<<gC1[2]<<" "<<endl<<
141     "D1 "<<gD1[0]<<" "<<gD1[1]<<" "<<gD1[2]<<" "<<endl;
142   */
143   
144   // We apply a delta transformation to the surveyed vol. to represent
145   // its real position, given below by ng3 and nl3, which differs from its
146   // ideal position saved above in g3 and l3
147   
148   TGeoPhysicalNode* pn3_1 = gGeoManager->MakePhysicalNode("ALIC_1/EPM1_1");
149   
150   Double_t dphi_1   = 0.; //  tilt around Z
151   Double_t dtheta_1 = 0.; //  tilt around X
152   Double_t dpsi_1   = 0.; //  tilt around new Z
153   
154   Double_t dx_1 = 2.; // shift along X
155   Double_t dy_1 = 3.; // shift along Y
156   Double_t dz_1 = 4.; // shift along Z
157   
158   TGeoRotation* rrot_1 = new TGeoRotation("rot",dphi_1,dtheta_1,dpsi_1);
159   TGeoCombiTrans localdelta_1 = *(new TGeoCombiTrans(dx_1,dy_1,dz_1, rrot_1));
160     
161   // new local matrix, representing real position
162   TGeoHMatrix nlocal_1 = *l3_1 * localdelta_1;
163   TGeoHMatrix* nl3_1 = new TGeoHMatrix(nlocal_1);
164   pn3_1->Align(nl3_1);
165   
166   // Let's get the global matrix for later comparison
167   TGeoHMatrix* ng3_1 = pn3_1->GetMatrix(); //"real" global matrix,what survey sees 
168   printf("\n\n************  real global matrix for Sector-1 **************\n");
169   ng3_1->Print();
170   
171   Double_t ngA1[3], ngB1[3], ngC1[3], ngD1[3];
172   ng3_1->LocalToMaster(A1,ngA1);
173   ng3_1->LocalToMaster(B1,ngB1);
174   ng3_1->LocalToMaster(C1,ngC1);
175   ng3_1->LocalToMaster(D1,ngD1);
176   
177   cout<<endl<<"Fiducial marks coordinates in the global RS given by survey:1\n"<<
178     "A1 "<<ngA1[0]<<" "<<ngA1[1]<<" "<<ngA1[2]<<" "<<endl<<
179     "B1 "<<ngB1[0]<<" "<<ngB1[1]<<" "<<ngB1[2]<<" "<<endl<<
180     "C1 "<<ngC1[0]<<" "<<ngC1[1]<<" "<<ngC1[2]<<" "<<endl<<
181     "D1 "<<ngD1[0]<<" "<<ngD1[1]<<" "<<ngD1[2]<<" "<<endl;
182   
183   
184   // Let's  misalign the sector-2.
185   for (Int_t i = 0; i < 3; i++) 
186     {
187       // To convert the coordinates of fiducial marks in local RS as those are
188       // given  above in global RS.
189       A2[i] = A2[i] - g_vect_2[i];
190       B2[i] = B2[i] - g_vect_2[i];
191       C2[i] = C2[i] - g_vect_2[i];
192       D2[i] = D2[i] - g_vect_2[i];
193       
194     }
195   
196   Double_t gA2[3], gB2[3], gC2[3], gD2[3];
197   
198   g3_2->LocalToMaster(A2,gA2);
199   g3_2->LocalToMaster(B2,gB2);
200   g3_2->LocalToMaster(C2,gC2);
201   g3_2->LocalToMaster(D2,gD2);
202   
203   /*
204   cout<<endl<<"Ideal fiducial marks coordinates in the global RS:2\n"<<
205     "A2 "<<gA2[0]<<" "<<gA2[1]<<" "<<gA2[2]<<" "<<endl<<
206     "B2 "<<gB2[0]<<" "<<gB2[1]<<" "<<gB2[2]<<" "<<endl<<
207     "C2 "<<gC2[0]<<" "<<gC2[1]<<" "<<gC2[2]<<" "<<endl<<
208     "D2 "<<gD2[0]<<" "<<gD2[1]<<" "<<gD2[2]<<" "<<endl;
209   */
210   
211   // We apply a delta transformation to the surveyed vol. to represent
212   // its real position, given below by ng3 and nl3, which differs from its
213   // ideal position saved above in g3 and l3
214   
215   TGeoPhysicalNode* pn3_2 = gGeoManager->MakePhysicalNode("ALIC_1/EPM2_1");
216   
217   Double_t dphi_2   = 0.; // tilt around Z
218   Double_t dtheta_2 = 0.; // tilt around X
219   Double_t dpsi_2   = 0.; // tilt around new Z
220   
221   Double_t dx_2   = 2.; // shift along X
222   Double_t dy_2   = 3.; // shift along Y
223   Double_t dz_2   = 4.; // shift along Z
224   
225   TGeoRotation* rrot_2 = new TGeoRotation("rot",dphi_2,dtheta_2,dpsi_2);
226   TGeoCombiTrans localdelta_2 = *(new TGeoCombiTrans(dx_2,dy_2,dz_2, rrot_2));
227   
228   // new local matrix, representing real position
229   TGeoHMatrix nlocal_2 = *l3_2 * localdelta_2;
230   TGeoHMatrix* nl3_2 = new TGeoHMatrix(nlocal_2);
231   pn3_2->Align(nl3_2);
232   
233   // Let's get the global matrix for later comparison
234   TGeoHMatrix* ng3_2 = pn3_2->GetMatrix(); //real global matrix 
235   printf("\n\n************  real global matrix for Sector-2 **************\n");
236   ng3_2->Print();
237   
238   Double_t ngA2[3], ngB2[3], ngC2[3], ngD2[3];
239   ng3_2->LocalToMaster(A2,ngA2);
240   ng3_2->LocalToMaster(B2,ngB2);
241   ng3_2->LocalToMaster(C2,ngC2);
242   ng3_2->LocalToMaster(D2,ngD2);
243   
244   cout<<endl<<"Fiducial marks coordinates in the global RS given by survey:2\n"<<
245     "A2 "<<ngA2[0]<<" "<<ngA2[1]<<" "<<ngA2[2]<<" "<<endl<<
246     "B2 "<<ngB2[0]<<" "<<ngB2[1]<<" "<<ngB2[2]<<" "<<endl<<
247     "C2 "<<ngC2[0]<<" "<<ngC2[1]<<" "<<ngC2[2]<<" "<<endl<<
248     "D2 "<<ngD2[0]<<" "<<ngD2[1]<<" "<<ngD2[2]<<" "<<endl;
249   
250 // Let's  misalign the sector-3.
251   for (Int_t i = 0; i < 3; i++) 
252     {
253       // To convert the coordinates of fiducial marks in local RS as those are
254       // given  above in global RS.
255       A3[i] = A3[i] - g_vect_3[i];
256       B3[i] = B3[i] - g_vect_3[i];
257       C3[i] = C3[i] - g_vect_3[i];
258       D3[i] = D3[i] - g_vect_3[i];
259     }
260   
261   Double_t gA3[3], gB3[3], gC3[3], gD3[3];
262   
263   g3_3->LocalToMaster(A3,gA3);
264   g3_3->LocalToMaster(B3,gB3);
265   g3_3->LocalToMaster(C3,gC3);
266   g3_3->LocalToMaster(D3,gD3);
267   
268   /*
269   cout<<endl<<"Ideal fiducial marks coordinates in the global RS:3\n"<<
270     "A3 "<<gA3[0]<<" "<<gA3[1]<<" "<<gA3[2]<<" "<<endl<<
271     "B3 "<<gB3[0]<<" "<<gB3[1]<<" "<<gB3[2]<<" "<<endl<<
272     "C3 "<<gC3[0]<<" "<<gC3[1]<<" "<<gC3[2]<<" "<<endl<<
273     "D3 "<<gD3[0]<<" "<<gD3[1]<<" "<<gD3[2]<<" "<<endl;
274   */
275
276   // We apply a delta transformation to the surveyed vol. to represent
277   // its real position, given below by ng3 and nl3, which differs from its
278   // ideal position saved above in g3 and l3
279   
280   TGeoPhysicalNode* pn3_3 = gGeoManager->MakePhysicalNode("ALIC_1/EPM3_1");
281   
282   Double_t dphi_3   = 0.; //  tilt around Z
283   Double_t dtheta_3 = 0.; //  tilt around X
284   Double_t dpsi_3   = 0.; //  tilt around new Z
285   
286   Double_t dx_3   = 2.; // shift along X
287   Double_t dy_3   = 3.; // shift along Y
288   Double_t dz_3   = 4 ; // shift along Z
289     
290   TGeoRotation* rrot_3 = new TGeoRotation("rot",dphi_3,dtheta_3,dpsi_3);
291   TGeoCombiTrans localdelta_3 = *(new TGeoCombiTrans(dx_3,dy_3,dz_3, rrot_3));
292     
293   // new local matrix, representing real position
294   TGeoHMatrix nlocal_3 = *l3_3 * localdelta_3;
295   TGeoHMatrix* nl3_3 = new TGeoHMatrix(nlocal_3);
296   pn3_3->Align(nl3_3);
297   
298   // Let's get the global matrix for later comparison
299   TGeoHMatrix* ng3_3 = pn3_3->GetMatrix(); //"real" global matrix,what survey sees 
300   printf("\n\n************  real global matrix for Sector-3 **************\n");
301   ng3_3->Print();
302   
303   Double_t ngA3[3], ngB3[3], ngC3[3], ngD3[3];
304   ng3_3->LocalToMaster(A3,ngA3);
305   ng3_3->LocalToMaster(B3,ngB3);
306   ng3_3->LocalToMaster(C3,ngC3);
307   ng3_3->LocalToMaster(D3,ngD3);
308   
309   cout<<endl<<"Fiducial marks coordinates in the global RS given by survey:3\n"<<
310     "A3 "<<ngA3[0]<<" "<<ngA3[1]<<" "<<ngA3[2]<<" "<<endl<<
311     "B3 "<<ngB3[0]<<" "<<ngB3[1]<<" "<<ngB3[2]<<" "<<endl<<
312     "C3 "<<ngC3[0]<<" "<<ngC3[1]<<" "<<ngC3[2]<<" "<<endl<<
313     "D3 "<<ngD3[0]<<" "<<ngD3[1]<<" "<<ngD3[2]<<" "<<endl;
314  
315   // Let's  misalign the sector-4.
316   for (Int_t i = 0; i < 3; i++) 
317     {
318       // To convert the coordinates of fiducial marks in local RS as those are
319       // given  above in global RS.
320       A4[i] = A4[i] - g_vect_4[i];
321       B4[i] = B4[i] - g_vect_4[i];
322       C4[i] = C4[i] - g_vect_4[i];
323       D4[i] = D4[i] - g_vect_4[i];
324       
325     }
326   
327   Double_t gA4[3], gB4[3], gC4[3], gD4[3];
328   
329   g3_4->LocalToMaster(A4,gA4);
330   g3_4->LocalToMaster(B4,gB4);
331   g3_4->LocalToMaster(C4,gC4);
332   g3_4->LocalToMaster(D4,gD4);
333   
334   /*
335   cout<<endl<<"Ideal fiducial marks coordinates in the global RS:4\n"<<
336     "A4 "<<gA4[0]<<" "<<gA4[1]<<" "<<gA4[2]<<" "<<endl<<
337     "B4 "<<gB4[0]<<" "<<gB4[1]<<" "<<gB4[2]<<" "<<endl<<
338     "C4 "<<gC4[0]<<" "<<gC4[1]<<" "<<gC4[2]<<" "<<endl<<
339     "D4 "<<gD4[0]<<" "<<gD4[1]<<" "<<gD4[2]<<" "<<endl;
340   */
341
342   // We apply a delta transformation to the surveyed vol. to represent
343   // its real position, given below by ng3 and nl3, which differs from its
344   // ideal position saved above in g3 and l3
345   
346   TGeoPhysicalNode* pn3_4 = gGeoManager->MakePhysicalNode("ALIC_1/EPM4_1");
347   
348   Double_t dphi_4   = 0.; //  tilt around Z
349   Double_t dtheta_4 = 0.; //  tilt around X
350   Double_t dpsi_4   = 0.; //  tilt around new Z
351   
352   Double_t dx_4   = 2.; // shift along X
353   Double_t dy_4   = 3.; // shift along Y
354   Double_t dz_4   = 4.; // shift along Z
355   
356     
357   TGeoRotation* rrot_4 = new TGeoRotation("rot",dphi_4,dtheta_4,dpsi_4);
358   TGeoCombiTrans localdelta_4 = *(new TGeoCombiTrans(dx_4,dy_4,dz_4, rrot_4));
359     
360   // new local matrix, representing real position
361   TGeoHMatrix nlocal_4 = *l3_4 * localdelta_4;
362   TGeoHMatrix* nl3_4 = new TGeoHMatrix(nlocal_4);
363   pn3_4->Align(nl3_4);
364   
365   // Let's get the global matrix for later comparison
366   TGeoHMatrix* ng3_4 = pn3_4->GetMatrix(); //"real" global matrix,what survey sees 
367   printf("\n\n************  real global matrix for Sector-4 **************\n");
368   ng3_4->Print();
369   
370   Double_t ngA4[3], ngB4[3], ngC4[3], ngD4[3];
371   ng3_4->LocalToMaster(A4,ngA4);
372   ng3_4->LocalToMaster(B4,ngB4);
373   ng3_4->LocalToMaster(C4,ngC4);
374   ng3_4->LocalToMaster(D4,ngD4);
375   
376   cout<<endl<<"Fiducial marks coordinates in the global RS given by survey:4\n"<<
377     "A4 "<<ngA4[0]<<" "<<ngA4[1]<<" "<<ngA4[2]<<" "<<endl<<
378     "B4 "<<ngB4[0]<<" "<<ngB4[1]<<" "<<ngB4[2]<<" "<<endl<<
379     "C4 "<<ngC4[0]<<" "<<ngC4[1]<<" "<<ngC4[2]<<" "<<endl<<
380     "D4 "<<ngD4[0]<<" "<<ngD4[1]<<" "<<ngD4[2]<<" "<<endl;
381  
382
383   Double_t ngP1[4][3], ngP2[4][3],ngP3[4][3], ngP4[4][3];
384    
385   for(Int_t i=0;i<4;i++)
386     { 
387       for (Int_t j=0; j<3; j++)
388         {
389           ngP1[0][j] = ngA1[j];
390           ngP1[1][j] = ngB1[j];
391           ngP1[2][j] = ngC1[j];
392           ngP1[3][j] = ngD1[j];
393
394           ngP2[0][j] = ngA2[j];
395           ngP2[1][j] = ngB2[j];
396           ngP2[2][j] = ngC2[j];
397           ngP2[3][j] = ngD2[j];
398           
399           ngP3[0][j] = ngA3[j];
400           ngP3[1][j] = ngB3[j];
401           ngP3[2][j] = ngC3[j];
402           ngP3[3][j] = ngD3[j];
403           
404           ngP4[0][j] = ngA4[j];
405           ngP4[1][j] = ngB4[j];
406           ngP4[2][j] = ngC4[j];
407           ngP4[3][j] = ngD4[j];
408   
409         }
410     }
411   
412   Float_t xx, yy, zz;
413   Char_t seqno[6], PType[1], TUsed[1];
414   Int_t precision;
415   
416   ofstream ftw;
417   ftw.open("PMDGenSurveyPoints_v1.txt");
418
419   ifstream ftr;
420   ftr.open("Survey_Points_PMD01.txt",ios::in);
421     
422   Int_t nline = 0;
423   const int Nrow=70;
424   TString CommentLine[Nrow];
425   TString tmp, tmp1;
426   char line[80];
427   Int_t surseq1[4] = {19, 20, 18, 17};
428   Int_t surseq2[4] = {15, 16, 14, 13};
429   Int_t surseq3[4] = {11, 12, 06, 05};
430   Int_t surseq4[4] = {27, 28, 22, 21};
431   
432   while (nline<Nrow) 
433     {
434       ftr.getline(line,80, '\n');
435       tmp = line;
436       tmp1 = tmp(0,60);
437       CommentLine[nline] = Strip(tmp1);
438       
439       ftw<<CommentLine[nline]<<endl;
440       
441       if (nline >= 40 && nline < 68)
442         { 
443           ftr>>seqno>>xx>>yy>>zz>>PType>>TUsed>>precision;
444           
445           // cout<<seqno<<"\t"<<xx<<"\t"<<yy<<"\t"<<zz<<"\t"<<PType<<"\t"<<TUsed<<
446           //"\t"<<precision<<endl;
447           
448           Int_t i= (nline-40)+1;
449           for (Int_t j=0;j<4;j++)
450             {          
451               if (surseq1[j] == i)
452                 {
453                   xx = ngP1[j][0]*10.0;
454                   yy = ngP1[j][1]*10.0;
455                   zz = ngP1[j][2]*10.0;
456                   cout<<seqno<<"\t"<<xx<<"\t"<<yy<<"\t"<<zz<<"\t"<<PType<<
457                     "\t"<<TUsed<< "\t"<<precision<<endl;   
458                 }
459              else if (surseq2[j] == i)
460                 {
461                   xx = ngP2[j][0]*10.0;
462                   yy = ngP2[j][1]*10.0;
463                   zz = ngP2[j][2]*10.0;
464                   cout<<seqno<<"\t"<<xx<<"\t"<<yy<<"\t"<<zz<<"\t"<<PType<<
465                     "\t"<<TUsed<< "\t"<<precision<<endl;   
466                 }
467               else if (surseq3[j] == i)
468                 {
469                   xx = ngP3[j][0]*10.0;
470                   yy = ngP3[j][1]*10.0;
471                   zz = ngP3[j][2]*10.0;
472                   cout<<seqno<<"\t"<<xx<<"\t"<<yy<<"\t"<<zz<<"\t"<<PType<<
473                     "\t"<<TUsed<< "\t"<<precision<<endl;   
474                 }
475              else if (surseq4[j] == i)
476                 {
477                   xx = ngP4[j][0]*10.0;
478                   yy = ngP4[j][1]*10.0;
479                   zz = ngP4[j][2]*10.0;
480                   cout<<seqno<<"\t"<<xx<<"\t"<<yy<<"\t"<<zz<<"\t"<<PType<<
481                     "\t"<<TUsed<< "\t"<<precision<<endl;   
482                 }
483             }
484           ftw<<seqno<<"\t"<<xx<<"\t"<<yy<<"\t"<<zz<<"\t"<<PType<<"\t"<<TUsed<<
485             "\t"<<precision<<endl; 
486           
487         }
488       
489       //cout << "CommentLine [" << nline<< "]: " << CommentLine[nline] <<endl;
490       nline++;
491     }
492 }