Double check if SM is running added. Some redundant output removed from SM
[u/mrichter/AliRoot.git] / ITS / Displayv11.C
1 //----------------------------------------------------------------------
2
3 #if !defined(__CINT__) || defined(__MAKECINT__)
4 #include <TROOT.h>
5 #include <TSystem.h>
6 #include <TPolyLine.h>
7 #include <TGeoVolume.h>
8 #include <TGeoMedium.h>
9 #include <TGeoManager.h>
10 #include <TArrayD.h>
11 #include <TArrow.h>
12 #include <TControlBar.h>
13 #include <TGeoTube.h>
14 #include <TCanvas.h>
15 #include <TPad.h>
16 #include <TVirtualPad.h>
17 #include <TView.h>
18 #include "AliITSgeom.h"
19 #include "AliITSInitGeometry.h"
20 #include "AliITSv11GeometrySPD.h"
21 #include "AliITSv11GeometrySDD.h"
22 #include "AliITSv11GeometrySSD.h"
23 #include "AliITSv11GeometrySupport.h"
24 #endif
25
26
27 static AliITSv11GeometrySPD *gspd;
28 static AliITSv11GeometrySDD *gsdd;
29 static AliITSv11GeometrySSD *gssd;
30 static AliITSv11GeometrySupport *gsupp;
31 static AliITSgeom *geom;
32
33 void CreateMaterialsITS();
34
35 void AliMaterial(Int_t imat, const char* name, Float_t a, 
36                  Float_t z, Float_t dens, Float_t radl,
37                  Float_t absl);
38 void AliMedium(Int_t numed, const char *name, Int_t nmat,
39                Int_t isvol, Int_t ifield, Float_t fieldm,
40                Float_t tmaxfd, Float_t stemax, Float_t deemax,
41                Float_t epsil, Float_t stmin);
42 void AliMixture(Int_t kmat, const char* name, Float_t* a, Float_t* z,
43                 Double_t dens, Int_t nlmat=0, Float_t* wmat=0);
44 void Mixture(Int_t& kmat, const char* name, Double_t* a, Double_t* z,
45              Double_t dens, Int_t nlmat, Double_t* wmat);
46 Double_t* CreateDoubleArray(Float_t* array, Int_t size);
47
48 Bool_t Make2DCrossSections(TPolyLine &a0,TPolyLine &a1,
49                            TPolyLine &b0,TPolyLine &b1,TPolyMarker &p);
50
51 //
52 //----------------------------------------------------------------------
53 void Displayv11(){
54     // Display AliITSv11 Geometry
55     // Inputs:
56     //    const char* filename output file with the display in it
57     // Outputs:
58     //    none.
59     // Retrurn:
60     //    none.
61
62     gSystem->Load("libGeom");
63     //
64     if(gGeoManager) delete gGeoManager;
65     gGeoManager = new TGeoManager("ITSGeometry",
66                                   " ITS Simulation Geometry Manager");
67     TGeoManager *mgr2 = gGeoManager;
68     //
69     const AliITSVersion_t kv11=(AliITSVersion_t)110;
70     const Char_t *cvsDate="$Date$";
71     const Char_t *cvsRevision="$Revision$";
72     const Int_t kLength=100;
73     Char_t vstrng[kLength];
74     AliITSInitGeometry initgeom(kv11,1);
75     //
76     TGeoMaterial *vacmat = new TGeoMaterial("Vacume",0,0,0);
77     TGeoMedium   *vacmed = new TGeoMedium("Vacume_med",1,vacmat);
78     TGeoVolume *ALIC = mgr2->MakeBox("ALIC",vacmed,1000.,1000.,2000.);
79     mgr2->SetTopVolume(ALIC);
80     TGeoVolume *ITS = mgr2->MakeBox("ITSV",vacmed,990.,990.,1990.);
81     if(initgeom.WriteVersionString(vstrng,kLength,kv11,1,cvsDate,cvsRevision))
82         ITS->SetTitle(vstrng);
83     //TGeoVolumeAssembly *ITSSPD = new TGeoVolumeAssembly("ITSSPD");
84     //ITS->AddNode(ITSSPD,1);
85     ALIC->AddNode(ITS,1);
86     //
87     /*
88     AliITSv11 *its = new AliITSv11(0,3);
89     its->SetDebug(ISetits(0,-1));
90     its->GetSPDGeometry()->SetDebug(ISetits(0,-1));
91     its->GetSupGeometry()->SetDebug(ISetits(0,-1));
92     its->CreateMaterials();
93     its->CreateGeometry();
94     */
95     gspd  = new AliITSv11GeometrySPD(0);
96     gsdd  = new AliITSv11GeometrySDD();
97     gsupp = new AliITSv11GeometrySupport(0);
98     gssd  = new AliITSv11GeometrySSD();
99     //
100     CreateMaterialsITS();
101     gspd->SPDSector(ITS,mgr2);
102     gsupp->SPDCone(ITS,mgr2);
103     gsupp->SetDebug(0);
104     gsupp->SDDCone(ITS,mgr2);
105     gsdd->Layer3(ITS);
106     gsdd->Layer4(ITS);
107     gsdd->ForwardLayer3(ITS);// in Hybrid its in IS02
108     gsdd->ForwardLayer4(ITS);// in Hybrid its in IS02
109     gssd->Layer5(ITS);
110     gssd->Layer6(ITS);
111     gssd->LadderSupportLayer5(ITS);
112     gssd->LadderSupportLayer6(ITS);
113     gssd->EndCapSupportSystemLayer6(ITS);
114     gssd->EndCapSupportSystemLayer5(ITS);
115     gsupp->SSDCone(ITS,mgr2);
116     gsupp->ServicesCableSupport(ITS);
117     //
118     mgr2->CloseGeometry();
119     //
120     geom = new AliITSgeom();
121     initgeom.InitAliITSgeom(geom);
122     //
123     TControlBar *bar=new TControlBar("vertical","ITS Geometry Display",10,10);
124     bar->AddButton("Set Clipping on","ISetits(2,1)","Clipping on");
125     bar->AddButton("Set Cllipping off","ISetits(2,0)","Clipping off");
126     bar->AddButton("Set axis on","ISetits(3,1)","Show Axis on");
127     bar->AddButton("Set axis off","ISetits(3,0)","Show Axis off");
128     bar->AddButton("Set perspective on","ISetits(4,1)","Perspective on");
129     bar->AddButton("Set perspective off","ISetits(4,0)","Perspective off");
130     bar->AddButton("Set RayTrace on","ISetits(5,1)","Perspective on");
131     bar->AddButton("Set RayTrace off","ISetits(5,0)","Perspective off");
132     bar->AddButton("Set circle/80","ISetits(1,80)","circles ~ by 80 lines");
133     bar->AddButton("Display Geometry","Displayit()","Run Displayit");
134     bar->AddButton("Display SPD Sector Volume","EngineeringSPDSector()",
135                    "Run EngineeringSPDSector");
136     bar->AddButton("Print SPD Sector Volume data xfig","PrintSPDSectorData()",
137                    "Run PrintSPDSectorData");
138     bar->AddButton("Display SPD General Volume","EngineeringSPDCenter()",
139                    "Run EngineeringSPDCenter");
140     bar->AddButton("Display SPD Thermal Shield","EngineeringSPDThS()",
141                    "Run EngineeringSPDThS");
142     bar->AddButton("Display SPD Sector Cross Sections","EngineeringSPDSCS()",
143                    "Run EngineeringSPDSCS");
144     bar->AddButton("Display SDD Layer 3","EngineeringSDDLayer3()",
145                    "Run EngineeringSDDLayer3");
146     bar->AddButton("Display SDD Layer 4","EngineeringSDDLayer4()",
147                    "Run EngineeringSDDLayer4");
148     bar->AddButton("Display SDD Cone","EngineeringSDDCone()",
149                    "Run EngineeringSDDCone");
150     bar->AddButton("Display SDD Central Cylinder","EngineeringSDDCylinder()",
151                    "Run EngineeringSDDCylinder");
152     bar->AddButton("Display SSD Layer 5","EngineeringSSDLayer5()",
153                    "Run EngineeringSSDLayer5");
154     bar->AddButton("Display SSD Layer 6","EngineeringSSDLayer6()",
155                    "Run EngineeringSSDLayer6");
156     bar->AddButton("Display SSD Cone","EngineeringSSDCone()",
157                    "Run EngineeringSSDCone");
158     bar->AddButton("Display SSD Central Cylinder","EngineeringSSDCylinder()",
159                    "Run EngineeringSSDCylinder");
160 //    bar->AddButton("Display SUP RB24 side","EngineeringSupRB24()",
161 //                   "Run EngineeringSupRB24");
162 //    bar->AddButton("Display Cable Trays RB24 side","EngineeringSupTrayRB24()",
163 //                   "Run EngineeringSupTrayRB24");
164 //    bar->AddButton("Display SUP RB26 side","EngineeringSupRB26()",
165 //                   "Run EngineeringSupRB26");
166     bar->AddButton("Save Geometry to File","ExportToFile()",
167                    "Run ExportToFile");
168     bar->AddButton("Quit/Exit",".q","Exit");
169     bar->Show();
170     gROOT->SaveContext();
171          //Displayit();
172 }
173 //----------------------------------------------------------------------
174 void ExportToFile(){
175     // Quirry file name and write geometry to a root file.
176     // Inputs:
177     //    const char* filename output file with the display in it
178     // Outputs:
179     //    none.
180     // Retrurn:
181     //    none.
182     Char_t filename[100];
183
184     printf("Enter File name:");
185     scanf("%s",filename);
186
187     gGeoManager->Export(filename);
188 }
189 //----------------------------------------------------------------------
190 Int_t ISetits(Int_t t,Int_t v){
191     static Int_t itsdebug=1,nsegments=80,cut=0,axis=1,perspective=0,ray=0;
192
193     switch (t) {
194     case 0:
195         if(v<0) return itsdebug;
196         itsdebug = v;
197         break;
198     case 1:
199         if(v<0) return nsegments;
200         nsegments= v;
201         break;
202     case 2:
203         if(v<0) return cut;
204         cut = v;
205         break;
206     case 3:
207         if(v<0) return axis;
208         axis = v;
209         break;
210     case 4:
211         if(v<0) return perspective;
212         perspective = v;
213         break;
214     case 5:
215         if(v<0) return ray;
216         ray = v;
217         break;
218     }// end switch
219     return 0;
220 }
221 //----------------------------------------------------------------------
222 Double_t DSetits(Int_t t,Double_t v){
223     static Double_t phimincut=0.0,phimaxcut=180.0;
224     static Double_t longitude=90.0,latitude=0.0;
225
226     switch (t) {
227     case 0:
228         if(v<0.) return phimincut;
229         phimincut = v;
230         break;
231     case 1:
232         if(v<0.) return phimaxcut;
233         phimaxcut = v;
234         break;
235     case 2:
236         if(v<0.) return longitude;
237         longitude = v;
238         break;
239     case 3:
240         if(v<0.) return latitude;
241         latitude = v;
242         break;
243     case 4:
244         if(v<0.) return latitude;
245         latitude = v;
246         break;
247     }// end switch
248     return 0;
249 }
250 //----------------------------------------------------------------------
251 void Displayit(){
252     // Display AliITSv11 Geometry
253     // Inputs:
254     //    const char* filename output file with the display in it
255     // Outputs:
256     //    none.
257     // Retrurn:
258     //    none.
259     Int_t irr;
260     //
261     TGeoManager *mgr2 = gGeoManager;
262     TGeoVolume *ALIC = mgr2->GetTopVolume();
263     TCanvas *c1;
264     if(!(c1 = (TCanvas*)gROOT->FindObject("C1")))
265         c1 = new TCanvas("C1","ITS Simulation Geometry",900,900);
266     //c1->Divide(2,2);
267     //
268     mgr2->SetNsegments(ISetits(1,-1));
269     //
270     mgr2->SetVisLevel(6);
271     mgr2->SetVisOption(0);
272     //mgr2->CheckOverlaps(0.01);
273     //mgr2->PrintOverlaps();
274     if(ISetits(2,-1)==1){
275         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
276         mgr2->SetClippingShape(clip);
277     } // end if
278     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
279     //
280     c1->cd(1);
281     ALIC->Draw();
282     TPad *p1 = (TPad*)c1->GetPad(1);
283     TView *view1 = p1->GetView();
284     if(view1){
285         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
286         if(irr) cout <<"error="<<irr<<endl;
287         if(ISetits(4,-1)==0) view1->SetParallel();
288         else  view1->SetPerspective();
289         view1->Front();
290         if(ISetits(3,-1)!=0) view1->ShowAxis();
291     } // end if view1
292     if(ISetits(5,-1)==1) ALIC->Raytrace();
293     /*c1->cd(2);
294     ALIC->Draw();
295     TPad *p2 = c1->GetPad(2);
296     TView *view2 = p2->GetView();
297     if(view2){
298         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
299         if(irr) cout <<"error="<<irr<<endl;
300         if(ISetits(4,-1)==0) view2->SetParallel();
301         else  view2->SetPerspective();
302         view2->RotateView(60.,30.);
303         if(ISetits(3,-1)!=0) view2->ShowAxis();
304     } // end if view2
305     if(ISetits(5,-1)==1) ALIC->Raytrace();
306     c1->cd(3);
307     ALIC->Draw();
308     c1->SetPhi(90.0); c1->SetTheta(90.0);
309     TPad *p3 = c1->GetPad(3);
310     TView *view3 = p3->GetView();
311     if(view3){
312         view3->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
313         if(irr) cout <<"error="<<irr<<endl;
314         if(ISetits(4,-1)==0) view3->SetParallel();
315         else  view3->SetPerspective();
316         view3->Top();
317         if(ISetits(3,-1)!=0) view3->ShowAxis();
318     } // end if view3
319     if(ISetits(5,-1)==1) ALIC->Raytrace();
320     c1->cd(4);
321     ALIC->Draw();
322     TPad *p4 = c1->GetPad(4);
323     TView *view4 = p4->GetView();
324     if(view4){
325         view4->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
326         if(irr) cout <<"error="<<irr<<endl;
327         if(ISetits(4,-1)==0) view4->SetParallel();
328         else  view4->SetPerspective();
329         view4->Side();
330         if(ISetits(3,-1)!=0) view4->ShowAxis();
331     } // end if view4
332     if(ISetits(5,-1)==1) ALIC->Raytrace();
333     *///
334 }
335 //----------------------------------------------------------------------
336 void EngineeringSPDSCS(){
337     // Display SPD Carbon Fiber Sector Cross sections A and B
338     // Inputs:
339     //    none.
340     // Outputs:
341     //    none.
342     // Return:
343     //    none.
344     TPolyLine *a0,*a1,*b0,*b1;
345     TPolyMarker *p;
346     TCanvas *cSPDSCS=0;
347     Int_t i;
348     Double_t max=0.0;
349
350     a0 = new TPolyLine();
351     a1 = new TPolyLine();
352     b0 = new TPolyLine();
353     b1 = new TPolyLine();
354     p = new TPolyMarker();
355     a0->SetLineColor(1);
356     a1->SetLineColor(4);
357     b0->SetLineColor(3);
358     b0->SetLineStyle(2); // dashed
359     b1->SetLineColor(6);
360     b1->SetLineStyle(2); // dashed
361     p->SetMarkerColor(2);
362     p->SetMarkerStyle(5);
363     if(gspd==0||Make2DCrossSections(*a0,*a1,*b0,*b1,*p)==kFALSE)return;
364     for(i=0;i<a0->GetN();i++) {
365       if(TMath::Abs(a0->GetX()[i])>max) max = TMath::Abs(a0->GetX()[i]);
366       if(TMath::Abs(a0->GetY()[i])>max) max = TMath::Abs(a0->GetY()[i]);
367     } // end for i
368     for(i=0;i<a1->GetN();i++) {
369       if(TMath::Abs(a1->GetX()[i])>max) max = TMath::Abs(a0->GetX()[i]);
370       if(TMath::Abs(a1->GetY()[i])>max) max = TMath::Abs(a1->GetY()[i]);
371     } // end for i
372     for(i=0;i<b0->GetN();i++) {
373       if(TMath::Abs(b0->GetX()[i])>max) max = TMath::Abs(b0->GetX()[i]);
374       if(TMath::Abs(b0->GetY()[i])>max) max = TMath::Abs(b0->GetY()[i]);
375     } // end for i
376     for(i=0;i<b1->GetN();i++) {
377       if(TMath::Abs(b1->GetX()[i])>max) max = TMath::Abs(b1->GetX()[i]);
378       if(TMath::Abs(b1->GetY()[i])>max) max = TMath::Abs(b1->GetY()[i]);
379     } // end for i
380     max *= 1.05;
381     cSPDSCS = (TCanvas*)gROOT->FindObject("cSPDSCS");
382     if(cSPDSCS==0) delete cSPDSCS;
383     cSPDSCS = new TCanvas("cSPDSCS","SPD Carbon Fiber Sector Cross sections",2);
384     cSPDSCS->Range(-max,-max,max,max);
385     //cSPDSCS->RangeAxis();
386     cSPDSCS->SetFixedAspectRatio(kTRUE);
387     //
388     a0->Draw("");
389     a1->Draw("same");
390     p->Draw("same");
391     b0->Draw("same");
392     b1->Draw("same");
393     cSPDSCS->Update();
394     return;
395 }
396 //----------------------------------------------------------------------
397 void EngineeringSPDSector(){
398     // Display SPD Sector Geometry
399     // Inputs:
400     //    none.
401     // Outputs:
402     //    none.
403     // Retrurn:
404     //    none.
405     Int_t irr;
406     //
407     TGeoManager *mgr2 = gGeoManager;
408     TGeoVolume *ALIC = mgr2->GetTopVolume();
409     TCanvas *c4=0, *c5=0;
410     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
411         c4 = new TCanvas("C4","ITS SPD Layer Geometry Side View",500,500);
412     TGeoVolume *ITS=0,*ITSSPD=0,*SPDLay=0;
413     TGeoNode *node=0;
414     //
415     node = ALIC->FindNode("ITSV_1");
416     ITS = node->GetVolume();
417     node = ITS->FindNode("ITSSPD_1");
418     ITSSPD = node->GetVolume();
419     node = ITSSPD->FindNode("ITSSPDCarbonFiberSectorV_1");
420     if(node==0)Error("EngineeringSPDSector","could not find node %s",
421                      "ITSSPDCarbonFiberSectorV_1");
422     SPDLay = node->GetVolume();
423     if(SPDLay==0)Error("EngineeringSPDSector","could not find volume SPDLay");
424     //
425     mgr2->SetNsegments(ISetits(1,-1));
426     //
427     mgr2->SetVisLevel(6);
428     mgr2->SetVisOption(0);
429     //mgr2->CheckOverlaps(0.01);
430     //mgr2->PrintOverlaps();
431     if(ISetits(2,-1)==1){
432         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
433         mgr2->SetClippingShape(clip);
434     } // end if
435     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
436     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
437     //
438     SPDLay->Draw();
439     TView *view1 = c4->GetView();
440     if(view1){
441         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
442         if(irr) cout <<"error="<<irr<<endl;
443         if(ISetits(4,-1)==0) view1->SetParallel();
444         else  view1->SetPerspective();
445         view1->Front();
446         if(ISetits(3,-1)!=0) view1->ShowAxis();
447     } // end if view1
448     if(ISetits(5,-1)==1) SPDLay->Raytrace();
449     //
450     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
451         c5 = new TCanvas("C5","ITS SPD Sector Geometry End View",500,500);
452     SPDLay->Draw();
453     TView *view2 = c5->GetView();
454     if(view2){
455         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
456         if(irr) cout <<"error="<<irr<<endl;
457         if(ISetits(4,-1)==0) view2->SetParallel();
458         else  view2->SetPerspective();
459         view2->Top();
460         if(ISetits(3,-1)!=0) view2->ShowAxis();
461     } // end if view2
462     if(ISetits(5,-1)==1) SPDLay->Raytrace();
463     //
464 }
465 //----------------------------------------------------------------------
466 void PrintSPDSectorData(){
467     // Print SPD Sector Data
468     // Inputs:
469     //    none.
470     // Outputs:
471     //    none.
472     // Retrurn:
473     //    none.
474     Int_t irr,i;
475     //
476     TGeoManager *mgr2 = gGeoManager;
477     TGeoXtru * sA0;
478     TGeoVolume *vA0=0;
479
480     //mgr2->PushPath();
481     //mgr2->cd("ITSSPDCarbonFiberSupportSectorA0_1");
482     vA0 = mgr2->FindVolumeFast("ITSSPDCarbonFiberSupportSectorA0");
483     sA0 = (TGeoXtru*) vA0->GetShape();
484     irr = sA0->GetNvert();
485     Double_t x,y;
486     cout <<endl;
487     cout <<"2 3 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 "<<irr;
488     for(i=0;i<irr;i++){
489         x = sA0->GetX(i)+2.5;
490         y = sA0->GetY(i)+2.5;
491         if(!(i%6)) { cout << endl; cout <<"        ";}
492         cout<<" "<<TMath::Nint(x*450.)<<" "<<TMath::Nint(y*450);
493         //cout<<" "<<x<<" "<<y;
494     } // end for i
495     x = sA0->GetX(0)+2.5;
496     y = sA0->GetY(0)+2.5;
497     if(!(i%6)) { cout << endl; cout <<"        ";}
498     cout<<" "<<TMath::Nint(x*450.)<<" "<<TMath::Nint(y*450);
499     //cout<<" "<<x<<" "<<y;
500     cout << endl;
501     //
502 }
503 //----------------------------------------------------------------------
504 void EngineeringSPDCenter(){
505     // Display SPD Centeral Geometry
506     // Inputs:
507     //    none.
508     // Outputs:
509     //    none.
510     // Retrurn:
511     //    none.
512     Int_t irr;
513     //
514     TGeoManager *mgr2 = gGeoManager;
515     TGeoVolume *ALIC = mgr2->GetTopVolume();
516     TCanvas *c4=0, *c5=0;
517     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
518         c4 = new TCanvas("C4","ITS SPD Layer Geometry Side View",500,500);
519     TGeoVolume *ITS,*ITSSPD,*SPDLay=0;
520     TGeoNode *node;
521     //
522     node = ALIC->FindNode("ITSV_1");
523     ITS = node->GetVolume();
524     node = ITS->FindNode("ITSSPD_1");
525     ITSSPD = node->GetVolume();
526     //
527     mgr2->SetNsegments(ISetits(1,-1));
528     //
529     mgr2->SetVisLevel(6);
530     mgr2->SetVisOption(0);
531     //mgr2->CheckOverlaps(0.01);
532     //mgr2->PrintOverlaps();
533     if(ISetits(2,-1)==1){
534         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
535         mgr2->SetClippingShape(clip);
536     } // end if
537     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
538     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
539     //
540     ITSSPD->Draw();
541     TView *view1 = c4->GetView();
542     if(view1){
543         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
544         if(irr) cout <<"error="<<irr<<endl;
545         if(ISetits(4,-1)==0) view1->SetParallel();
546         else  view1->SetPerspective();
547         view1->Front();
548         if(ISetits(3,-1)!=0) view1->ShowAxis();
549     } // end if view1
550     if(ISetits(5,-1)==1) SPDLay->Raytrace();
551     //
552     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
553         c5 = new TCanvas("C5","ITS SPD Centeral Geometry End View",500,500);
554     ITSSPD->Draw();
555     TView *view2 = c5->GetView();
556     if(view2){
557         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
558         if(irr) cout <<"error="<<irr<<endl;
559         if(ISetits(4,-1)==0) view2->SetParallel();
560         else  view2->SetPerspective();
561         view2->Top();
562         if(ISetits(3,-1)!=0) view2->ShowAxis();
563     } // end if view2
564     if(ISetits(5,-1)==1) ITSSPD->Raytrace();
565     //
566 }
567 //----------------------------------------------------------------------
568 void EngineeringSPDThS(){
569     // Display SPD Thermal Shield Geometry
570     // Inputs:
571     //    none.
572     // Outputs:
573     //    none.
574     // Retrurn:
575     //    none.
576     Int_t irr;
577     //
578     TGeoManager *mgr2 = gGeoManager;
579     TGeoVolume *ALIC = mgr2->GetTopVolume();
580     TCanvas *c4;
581     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
582         c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
583     c4->Divide(2,1);
584     TGeoVolume *ITS,*SPDThS=0;
585     TGeoNode *node;
586     //
587     node = ALIC->FindNode("ITSV_1");
588     ITS = node->GetVolume();
589     node = ITS->FindNode("ITSspdThermalShield_1");
590     SPDThS = node->GetVolume();
591     //
592     mgr2->SetNsegments(ISetits(1,-1));
593     //
594     mgr2->SetVisLevel(6);
595     mgr2->SetVisOption(0);
596     //mgr2->CheckOverlaps(0.01);
597     //mgr2->PrintOverlaps();
598     if(ISetits(2,-1)==1){
599         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
600         mgr2->SetClippingShape(clip);
601     } // end if
602     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
603     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
604     //
605     c4->cd(1);
606     SPDThS->Draw();
607     TPad *p1 = (TPad*)c4->GetPad(1);
608     TView *view1 = p1->GetView();
609     if(view1){
610         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
611         if(irr) cout <<"error="<<irr<<endl;
612         if(ISetits(4,-1)==0) view1->SetParallel();
613         else  view1->SetPerspective();
614         view1->Front();
615         if(ISetits(3,-1)!=0) view1->ShowAxis();
616     } // end if view1
617     if(ISetits(5,-1)==1) SPDThS->Raytrace();
618     //
619     c4->cd(2);
620     SPDThS->Draw();
621     TPad *p2 = (TPad*)c4->GetPad(2);
622     TView *view2 = p2->GetView();
623     if(view2){
624         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
625         if(irr) cout <<"error="<<irr<<endl;
626         if(ISetits(4,-1)==0) view2->SetParallel();
627         else  view2->SetPerspective();
628         view2->Top();
629         if(ISetits(3,-1)!=0) view2->ShowAxis();
630     } // end if view2
631     if(ISetits(5,-1)==1) SPDThS->Raytrace();
632     //
633 }
634 //----------------------------------------------------------------------
635 void EngineeringSDDLayer3(){
636     // Display SDD Layer 3 Geometry
637     // Inputs:
638     //    none.
639     // Outputs:
640     //    none.
641     // Retrurn:
642     //    none.
643     Int_t irr;
644     //
645     TGeoManager *mgr2 = gGeoManager;
646     TGeoVolume *ALIC = mgr2->GetTopVolume();
647     TCanvas *c4=0, *c5=0;
648     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
649         c4 = new TCanvas("C4","ITS SDD Layer 3 Geometry Side View",500,500);
650     TGeoVolume *ITS,*SDDLay3=0;
651     TGeoNode *node;
652     //
653     node = ALIC->FindNode("ITSV_1");
654     ITS = node->GetVolume();
655     node = ITS->FindNode("ITSsddLayer3_1");
656     SDDLay3 = node->GetVolume();
657     //
658     mgr2->SetNsegments(ISetits(1,-1));
659     //
660     mgr2->SetVisLevel(6);
661     mgr2->SetVisOption(0);
662     //mgr2->CheckOverlaps(0.01);
663     //mgr2->PrintOverlaps();
664     if(ISetits(2,-1)==1){
665         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
666         mgr2->SetClippingShape(clip);
667     } // end if
668     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
669     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
670     //
671     SDDLay3->Draw();
672     TView *view1 = c4->GetView();
673     if(view1){
674         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
675         if(irr) cout <<"error="<<irr<<endl;
676         if(ISetits(4,-1)==0) view1->SetParallel();
677         else  view1->SetPerspective();
678         view1->Front();
679         if(ISetits(3,-1)!=0) view1->ShowAxis();
680     } // end if view1
681     if(ISetits(5,-1)==1) SDDLay3->Raytrace();
682     //
683     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
684         c5 = new TCanvas("C5","ITS SDD Layer 3 Geometry End View",500,500);
685     SDDLay3->Draw();
686     TView *view2 = c5->GetView();
687     if(view2){
688         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
689         if(irr) cout <<"error="<<irr<<endl;
690         if(ISetits(4,-1)==0) view2->SetParallel();
691         else  view2->SetPerspective();
692         view2->Top();
693         if(ISetits(3,-1)!=0) view2->ShowAxis();
694     } // end if view2
695     if(ISetits(5,-1)==1) SDDLay3->Raytrace();
696     //
697 }
698 //----------------------------------------------------------------------
699 void EngineeringSDDLayer4(){
700     // Display SDD Layer 4 Geometry
701     // Inputs:
702     //    none.
703     // Outputs:
704     //    none.
705     // Retrurn:
706     //    none.
707     Int_t irr;
708     //
709     TGeoManager *mgr2 = gGeoManager;
710     TGeoVolume *ALIC = mgr2->GetTopVolume();
711     TCanvas *c4=0, *c5=0;
712     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
713         c4 = new TCanvas("C4","ITS SDD Layer 4 Geometry Side View",500,500);
714     TGeoVolume *ITS,*SDDLay4=0;
715     TGeoNode *node;
716     //
717     node = ALIC->FindNode("ITSV_1");
718     ITS = node->GetVolume();
719     node = ITS->FindNode("ITSsddLayer4_1");
720     SDDLay4 = node->GetVolume();
721     //
722     mgr2->SetNsegments(ISetits(1,-1));
723     //
724     mgr2->SetVisLevel(6);
725     mgr2->SetVisOption(0);
726     //mgr2->CheckOverlaps(0.01);
727     //mgr2->PrintOverlaps();
728     if(ISetits(2,-1)==1){
729         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
730         mgr2->SetClippingShape(clip);
731     } // end if
732     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
733     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
734     //
735     SDDLay4->Draw();
736     TView *view1 = c4->GetView();
737     if(view1){
738         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
739         if(irr) cout <<"error="<<irr<<endl;
740         if(ISetits(4,-1)==0) view1->SetParallel();
741         else  view1->SetPerspective();
742         view1->Front();
743         if(ISetits(3,-1)!=0) view1->ShowAxis();
744     } // end if view1
745     if(ISetits(5,-1)==1) SDDLay4->Raytrace();
746     //
747     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
748         c5 = new TCanvas("C5","ITS SDD Layer 4 Geometry End View",500,500);
749     SDDLay4->Draw();
750     TView *view2 = c5->GetView();
751     if(view2){
752         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
753         if(irr) cout <<"error="<<irr<<endl;
754         if(ISetits(4,-1)==0) view2->SetParallel();
755         else  view2->SetPerspective();
756         view2->Top();
757         if(ISetits(3,-1)!=0) view2->ShowAxis();
758     } // end if view2
759     if(ISetits(5,-1)==1) SDDLay4->Raytrace();
760     //
761 }
762 //----------------------------------------------------------------------
763 void EngineeringSDDCone(){
764     // Display SDD Cone Geometry
765     // Inputs:
766     //    none.
767     // Outputs:
768     //    none.
769     // Retrurn:
770     //    none.
771     Int_t irr;
772     //
773     TGeoManager *mgr2 = gGeoManager;
774     TGeoVolume *ALIC = mgr2->GetTopVolume();
775     TCanvas *c2=0;
776     if(!(c2 = (TCanvas*)gROOT->FindObject("C2")))
777         c2 = new TCanvas("C2","ITS SDD Cone Geometry",900,450);
778     c2->Divide(2,1);
779     TGeoVolume *ITS,*SDD=0;
780     TGeoNode *node;
781     //
782     node = ALIC->FindNode("ITSV_1");
783     ITS = node->GetVolume();
784     node = ITS->FindNode("SDDCarbonFiberCone_1");
785     SDD = node->GetVolume();
786     //
787     mgr2->SetNsegments(ISetits(1,-1));
788     //
789     mgr2->SetVisLevel(6);
790     mgr2->SetVisOption(0);
791     //mgr2->CheckOverlaps(0.01);
792     //mgr2->PrintOverlaps();
793     if(ISetits(2,-1)==1){
794         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
795         mgr2->SetClippingShape(clip);
796     } // end if
797     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
798     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
799     //
800     c2->cd(1);
801     SDD->Draw();
802     TPad *p1 = (TPad*)c2->GetPad(1);
803     TView *view1 = p1->GetView();
804     if(view1){
805         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
806         if(irr) cout <<"error="<<irr<<endl;
807         if(ISetits(4,-1)==0) view1->SetParallel();
808         else  view1->SetPerspective();
809         view1->Front();
810         if(ISetits(3,-1)!=0) view1->ShowAxis();
811     } // end if view1
812     if(ISetits(5,-1)==1) SDD->Raytrace();
813     //
814     c2->cd(2);
815     SDD->Draw();
816     TPad *p2 = (TPad*)c2->GetPad(2);
817     TView *view2 = p2->GetView();
818     if(view2){
819         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
820         if(irr) cout <<"error="<<irr<<endl;
821         if(ISetits(4,-1)==0) view2->SetParallel();
822         else  view2->SetPerspective();
823         view2->Top();
824         if(ISetits(3,-1)!=0) view2->ShowAxis();
825     } // end if view1
826     if(ISetits(5,-1)==1) SDD->Raytrace();
827     //
828 }
829 //----------------------------------------------------------------------
830 void EngineeringSDDCylinder(){
831     // Display SDD Cylinder Geometry
832     // Inputs:
833     //    none.
834     // Outputs:
835     //    none.
836     // Retrurn:
837     //    none.
838     Int_t irr;
839     //
840     TGeoManager *mgr2 = gGeoManager;
841     TGeoVolume *ALIC = mgr2->GetTopVolume();
842     TCanvas *c3=0;
843     if(!(c3 = (TCanvas*)gROOT->FindObject("C3")))
844         c3 = new TCanvas("C3","ITS SDD Cylinder Geometry",900,450);
845     c3->Divide(2,1);
846     TGeoVolume *ITS,*SDD=0;
847     TGeoNode *node;
848 //    TArrow *arrow=new TArrow();
849     //
850     node = ALIC->FindNode("ITSV_1");
851     ITS = node->GetVolume();
852     node = ITS->FindNode("SDDCarbonFiberCylinder_1");
853     SDD = node->GetVolume();
854 //    Double_t Rmin = ((TGeoTube*)(SDD->GetShape()))->GetRmin();
855 //    Double_t Rmax = ((TGeoTube*)(SDD->GetShape()))->GetRmax();
856 //    Double_t Dz   = ((TGeoTube*)(SDD->GetShape()))->GetDz();
857     //
858     mgr2->SetNsegments(ISetits(1,-1));
859     //
860     mgr2->SetVisLevel(6);
861     mgr2->SetVisOption(0);
862     //mgr2->CheckOverlaps(0.01);
863     //mgr2->PrintOverlaps();
864     if(ISetits(2,-1)==1){
865         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
866         mgr2->SetClippingShape(clip);
867     } // end if
868     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
869     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
870     //
871     c3->cd(1);
872     SDD->Draw();
873     TPad *p1 = (TPad*)c3->GetPad(1);
874     TView *view1 = p1->GetView();
875     if(view1){
876         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
877         if(irr) cout <<"error="<<irr<<endl;
878         if(ISetits(4,-1)==0) view1->SetParallel();
879         else  view1->SetPerspective();
880         view1->Front();
881         if(ISetits(3,-1)!=0) view1->ShowAxis();
882     } // end if view1
883     if(ISetits(5,-1)==1) SDD->Raytrace();
884     //arrow->DrawArrow(1.01*Rmax,-Dz,1.01*Rmax,+Dz);
885     //
886     c3->cd(2);
887     SDD->Draw();
888     TPad *p2 = (TPad*)c3->GetPad(2);
889     TView *view2 = p2->GetView();
890     if(view2){
891         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
892         if(irr) cout <<"error="<<irr<<endl;
893         if(ISetits(4,-1)==0) view2->SetParallel();
894         else  view2->SetPerspective();
895         view2->Top();
896         if(ISetits(3,-1)!=0) view2->ShowAxis();
897     } // end if view2
898     if(ISetits(5,-1)==1) SDD->Raytrace();
899     //arrow->DrawArrow(Rmax,0.0,Rmax,0.0);
900     //Double_t s = TMath::Sin(0.7),c = TMath::Cos(0.7);
901     //arrow->DrawArrow(-Rmin*c,-Rmin*s,Rmin*c,Rmin*s);
902     //
903 }
904 //----------------------------------------------------------------------
905 void EngineeringSSDLayer5(){
906     // Display SSD Layer 5 Geometry
907     // Inputs:
908     //    none.
909     // Outputs:
910     //    none.
911     // Retrurn:
912     //    none.
913     Int_t irr;
914     //
915     TGeoManager *mgr2 = gGeoManager;
916     TGeoVolume *ALIC = mgr2->GetTopVolume();
917     TCanvas *c4=0, *c5=0;
918     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
919         c4 = new TCanvas("C4","ITS SDD Layer 5 Geometry Side View",500,500);
920     TGeoVolume *ITS,*SDDLay5=0;
921     TGeoNode *node;
922     //
923     node = ALIC->FindNode("ITSV_1");
924     ITS = node->GetVolume();
925     node = ITS->FindNode("ITSssdLayer5_1");
926     SDDLay5 = node->GetVolume();
927     //
928     mgr2->SetNsegments(ISetits(1,-1));
929     //
930     mgr2->SetVisLevel(6);
931     mgr2->SetVisOption(0);
932     //mgr2->CheckOverlaps(0.01);
933     //mgr2->PrintOverlaps();
934     if(ISetits(2,-1)==1){
935         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
936         mgr2->SetClippingShape(clip);
937     } // end if
938     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
939     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
940     //
941     SDDLay5->Draw();
942     TView *view1 = c4->GetView();
943     if(view1){
944         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
945         if(irr) cout <<"error="<<irr<<endl;
946         if(ISetits(4,-1)==0) view1->SetParallel();
947         else  view1->SetPerspective();
948         view1->Front();
949         if(ISetits(3,-1)!=0) view1->ShowAxis();
950     } // end if view1
951     if(ISetits(5,-1)==1) SDDLay5->Raytrace();
952     //
953     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
954         c5 = new TCanvas("C5","ITS SDD Layer 5 Geometry End View",500,500);
955     SDDLay5->Draw();
956     TView *view2 = c5->GetView();
957     if(view2){
958         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
959         if(irr) cout <<"error="<<irr<<endl;
960         if(ISetits(4,-1)==0) view2->SetParallel();
961         else  view2->SetPerspective();
962         view2->Top();
963         if(ISetits(3,-1)!=0) view2->ShowAxis();
964     } // end if view2
965     if(ISetits(5,-1)==1) SDDLay5->Raytrace();
966     //
967 }
968 //----------------------------------------------------------------------
969 void EngineeringSSDLayer6(){
970     // Display SSD Layer 6 Geometry
971     // Inputs:
972     //    none.
973     // Outputs:
974     //    none.
975     // Retrurn:
976     //    none.
977     Int_t irr;
978     //
979     TGeoManager *mgr2 = gGeoManager;
980     TGeoVolume *ALIC = mgr2->GetTopVolume();
981     TCanvas *c4=0, *c5=0;
982     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
983         c4 = new TCanvas("C4","ITS SDD Layer 6 Geometry Side View",500,500);
984     TGeoVolume *ITS,*SDDLay6=0;
985     TGeoNode *node;
986     //
987     node = ALIC->FindNode("ITSV_1");
988     ITS = node->GetVolume();
989     node = ITS->FindNode("ITSssdLayer6_1");
990     SDDLay6 = node->GetVolume();
991     //
992     mgr2->SetNsegments(ISetits(1,-1));
993     //
994     mgr2->SetVisLevel(6);
995     mgr2->SetVisOption(0);
996     //mgr2->CheckOverlaps(0.01);
997     //mgr2->PrintOverlaps();
998     if(ISetits(2,-1)==1){
999         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
1000         mgr2->SetClippingShape(clip);
1001     } // end if
1002     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1003     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1004     //
1005     SDDLay6->Draw();
1006     TView *view1 = c4->GetView();
1007     if(view1){
1008         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1009         if(irr) cout <<"error="<<irr<<endl;
1010         if(ISetits(4,-1)==0) view1->SetParallel();
1011         else  view1->SetPerspective();
1012         view1->Front();
1013         if(ISetits(3,-1)!=0) view1->ShowAxis();
1014     } // end if view1
1015     if(ISetits(5,-1)==1) SDDLay6->Raytrace();
1016     //
1017     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
1018         c5 = new TCanvas("C5","ITS SDD Layer 6 Geometry End View",500,500);
1019     SDDLay6->Draw();
1020     TView *view2 = c5->GetView();
1021     if(view2){
1022         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1023         if(irr) cout <<"error="<<irr<<endl;
1024         if(ISetits(4,-1)==0) view2->SetParallel();
1025         else  view2->SetPerspective();
1026         view2->Top();
1027         if(ISetits(3,-1)!=0) view2->ShowAxis();
1028     } // end if view2
1029     if(ISetits(5,-1)==1) SDDLay6->Raytrace();
1030     //
1031 }
1032 //----------------------------------------------------------------------
1033 void EngineeringSSDCone(){
1034     // Display SSD Cone Geometry
1035     // Inputs:
1036     //    none.
1037     // Outputs:
1038     //    none.
1039     // Retrurn:
1040     //    none.
1041     Int_t irr;
1042     //
1043     TGeoManager *mgr2 = gGeoManager;
1044     TGeoVolume *ALIC = mgr2->GetTopVolume();
1045     TCanvas *c2=0;
1046     if(!(c2 = (TCanvas*)gROOT->FindObject("C2")))
1047         c2 = new TCanvas("C2","ITS SSD Cone Geometry",900,450);
1048     c2->Divide(2,1);
1049     TGeoVolume *ITS,*SSD=0;
1050     TGeoNode *node;
1051     //
1052     node = ALIC->FindNode("ITSV_1");
1053     ITS = node->GetVolume();
1054     node = ITS->FindNode("ITSssdCone_1");
1055     SSD = node->GetVolume();
1056     //
1057     mgr2->SetNsegments(ISetits(1,-1));
1058     //
1059     mgr2->SetVisLevel(6);
1060     mgr2->SetVisOption(0);
1061     //mgr2->CheckOverlaps(0.01);
1062     //mgr2->PrintOverlaps();
1063     if(ISetits(2,-1)==1){
1064         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
1065         mgr2->SetClippingShape(clip);
1066     } // end if
1067     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1068     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1069     //
1070     c2->cd(1);
1071     SSD->Draw();
1072     TPad *p1 = (TPad*)c2->GetPad(1);
1073     TView *view1 = p1->GetView();
1074     if(view1){
1075         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1076         if(irr) cout <<"error="<<irr<<endl;
1077         if(ISetits(4,-1)==0) view1->SetParallel();
1078         else  view1->SetPerspective();
1079         view1->Top();
1080         if(ISetits(3,-1)!=0) view1->ShowAxis();
1081     } // end if view1
1082     if(ISetits(5,-1)==1) SSD->Raytrace();
1083     //
1084     c2->cd(2);
1085     SSD->Draw();
1086     TPad *p2 = (TPad*)c2->GetPad(2);
1087     TView *view2 = p2->GetView();
1088     if(view2){
1089         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1090         if(irr) cout <<"error="<<irr<<endl;
1091         if(ISetits(4,-1)==0) view2->SetParallel();
1092         else  view2->SetPerspective();
1093         view2->Front();
1094         if(ISetits(3,-1)!=0) view2->ShowAxis();
1095     } // end if view1
1096     if(ISetits(5,-1)==1) SSD->Raytrace();
1097     //
1098 }
1099 //----------------------------------------------------------------------
1100 void EngineeringSSDCylinder(){
1101     // Display SSD Cylinder Geometry
1102     // Inputs:
1103     //    none.
1104     // Outputs:
1105     //    none.
1106     // Retrurn:
1107     //    none.
1108     Int_t irr;
1109     //
1110     TGeoManager *mgr2 = gGeoManager;
1111     TGeoVolume *ALIC = mgr2->GetTopVolume();
1112     TCanvas *c3=0;
1113     if(!(c3 = (TCanvas*)gROOT->FindObject("C3")))
1114         c3 = new TCanvas("C3","ITS SSD Cylinder Geometry",900,450);
1115     c3->Divide(2,1);
1116     TGeoVolume *ITS,*SSD=0;
1117     TGeoNode *node;
1118 //    TArrow *arrow=new TArrow();
1119     //
1120     node = ALIC->FindNode("ITSV_1");
1121     ITS = node->GetVolume();
1122     node = ITS->FindNode("SSDexternalcylinder_1");
1123     SSD = node->GetVolume();
1124     //Double_t Rmin = ((TGeoPcon*)(SSD->GetShape()))->GetRmin();
1125     //Double_t Rmax = ((TGeoPcon*)(SSD->GetShape()))->GetRmax();
1126     //Double_t Dz   = ((TGeoPcon*)(SSD->GetShape()))->GetDz();
1127     //
1128     mgr2->SetNsegments(ISetits(1,-1));
1129     //
1130     mgr2->SetVisLevel(6);
1131     mgr2->SetVisOption(0);
1132     //mgr2->CheckOverlaps(0.01);
1133     //mgr2->PrintOverlaps();
1134     if(ISetits(2,-1)==1){
1135         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
1136         mgr2->SetClippingShape(clip);
1137     } // end if
1138     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1139     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1140     //
1141     c3->cd(1);
1142     SSD->Draw();
1143     TPad *p1 = (TPad*)c3->GetPad(1);
1144     TView *view1 = p1->GetView();
1145     if(view1){
1146         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1147         if(irr) cout <<"error="<<irr<<endl;
1148         if(ISetits(4,-1)==0) view1->SetParallel();
1149         else  view1->SetPerspective();
1150         view1->Front();
1151         if(ISetits(3,-1)!=0) view1->ShowAxis();
1152     } // end if view1
1153     if(ISetits(5,-1)==1) SSD->Raytrace();
1154     //arrow->DrawArrow(1.01*Rmax,-Dz,1.01*Rmax,+Dz);
1155     //
1156     c3->cd(2);
1157     SSD->Draw();
1158     TPad *p2 = (TPad*)c3->GetPad(2);
1159     TView *view2 = p2->GetView();
1160     if(view2){
1161         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1162         if(irr) cout <<"error="<<irr<<endl;
1163         if(ISetits(4,-1)==0) view2->SetParallel();
1164         else  view2->SetPerspective();
1165         view2->Top();
1166         if(ISetits(3,-1)!=0) view2->ShowAxis();
1167     } // end if view2
1168     if(ISetits(5,-1)==1) SSD->Raytrace();
1169     //arrow->DrawArrow(Rmax,0.0,Rmax,0.0);
1170     //Double_t s = TMath::Sin(0.7),c = TMath::Cos(0.7);
1171     //arrow->DrawArrow(-Rmin*c,-Rmin*s,Rmin*c,Rmin*s);
1172     //
1173 }
1174 //----------------------------------------------------------------------
1175 void EngineeringSupRB24(){
1176     // Display  RB 24 side cable tray support structure Geometry
1177     // Inputs:
1178     //    none.
1179     // Outputs:
1180     //    none.
1181     // Retrurn:
1182     //    none.
1183     Int_t irr;
1184     //
1185     TGeoManager *mgr2 = gGeoManager;
1186     TGeoVolume *ALIC = mgr2->GetTopVolume();
1187     TCanvas *c4=0;
1188     if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
1189         c4 = new TCanvas("C4","ITS SDD Cylinder Geometry",900,450);
1190     c4->Divide(2,1);
1191     TGeoVolume *ITS,*SUPRB24=0;
1192     TGeoNode *node;
1193     //
1194     node = ALIC->FindNode("ITSV_1");
1195     ITS = node->GetVolume();
1196     node = ITS->FindNode("ITSsupFrameM24_1");
1197     SUPRB24 = node->GetVolume();
1198     //
1199     mgr2->SetNsegments(ISetits(1,-1));
1200     //
1201     mgr2->SetVisLevel(6);
1202     mgr2->SetVisOption(0);
1203     //mgr2->CheckOverlaps(0.01);
1204     //mgr2->PrintOverlaps();
1205     if(ISetits(2,-1)==1){
1206         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
1207         mgr2->SetClippingShape(clip);
1208     } // end if
1209     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1210     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1211     //
1212     c4->cd(1);
1213     SUPRB24->Draw();
1214     TPad *p1 = (TPad*)c4->GetPad(1);
1215     TView *view1 = p1->GetView();
1216     if(view1){
1217         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1218         if(irr) cout <<"error="<<irr<<endl;
1219         if(ISetits(4,-1)==0) view1->SetParallel();
1220         else  view1->SetPerspective();
1221         view1->Front();
1222         if(ISetits(3,-1)!=0) view1->ShowAxis();
1223     } // end if view1
1224     if(ISetits(5,-1)==1) SUPRB24->Raytrace();
1225     //
1226     c4->cd(2);
1227     SUPRB24->Draw();
1228     TPad *p2 = (TPad*)c4->GetPad(2);
1229     TView *view2 = p2->GetView();
1230     if(view2){
1231         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1232         if(irr) cout <<"error="<<irr<<endl;
1233         if(ISetits(4,-1)==0) view2->SetParallel();
1234         else  view2->SetPerspective();
1235         view2->Top();
1236         if(ISetits(3,-1)!=0) view2->ShowAxis();
1237     } // end if view2
1238     if(ISetits(5,-1)==1) SUPRB24->Raytrace();
1239     //
1240 }
1241 //----------------------------------------------------------------------
1242 void EngineeringSupTrayRB24(){
1243     // Display  RB 24 side cable tray support structure Geometry
1244     // Inputs:
1245     //    none.
1246     // Outputs:
1247     //    none.
1248     // Retrurn:
1249     //    none.
1250     Int_t irr;
1251     //
1252     TGeoManager *mgr2 = gGeoManager;
1253     TGeoVolume *ALIC = mgr2->GetTopVolume();
1254     TCanvas *c4=0,*c5=0;
1255     //if(!(c4 = (TCanvas*)gROOT->FindObject("C4")))
1256         c4 = new TCanvas("C4","ITS RB24 Cable Trays and Patch Pannels",500,500);
1257     //c4->Divide(2,1);
1258     TGeoVolume *ITS,*SUPRB24=0;
1259     TGeoNode *node;
1260     //
1261     node = ALIC->FindNode("ITSV_1");
1262     ITS = node->GetVolume();
1263     node = ITS->FindNode("ITSsupCableTrayMotherMT24_1");
1264     SUPRB24 = node->GetVolume();
1265     //
1266     mgr2->SetNsegments(ISetits(1,-1));
1267     //
1268     mgr2->SetVisLevel(6);
1269     mgr2->SetVisOption(0);
1270     //mgr2->CheckOverlaps(0.01);
1271     //mgr2->PrintOverlaps();
1272     if(ISetits(2,-1)==1){
1273         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
1274         mgr2->SetClippingShape(clip);
1275     } // end if
1276     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1277     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1278     //
1279     c4->cd(1);
1280     SUPRB24->Draw();
1281     //TPad *p1 = c4->GetPad(1);
1282     //TView *view1 = p1->GetView();
1283     TView *view1 = c4->GetView();
1284     if(view1){
1285         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1286         if(irr) cout <<"error="<<irr<<endl;
1287         if(ISetits(4,-1)==0) view1->SetParallel();
1288         else  view1->SetPerspective();
1289         view1->Front();
1290         if(ISetits(3,-1)!=0) view1->ShowAxis();
1291     } // end if view1
1292     if(ISetits(5,-1)==1) SUPRB24->Raytrace();
1293     //
1294     //c4->cd(2);
1295         c5 = new TCanvas("C5","ITS RB24 Cable Trays and Patch Pannels",500,500);
1296     c5->cd(1);
1297     SUPRB24->Draw();
1298     //TPad *p2 = c5->GetPad(1);
1299     //TView *view2 = p2->GetView();
1300     TView *view2 = c5->GetView();
1301     if(view2){
1302         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1303         if(irr) cout <<"error="<<irr<<endl;
1304         if(ISetits(4,-1)==0) view2->SetParallel();
1305         else  view2->SetPerspective();
1306         view2->Top();
1307         if(ISetits(3,-1)!=0) view2->ShowAxis();
1308     } // end if view2
1309     if(ISetits(5,-1)==1) SUPRB24->Raytrace();
1310     //
1311 }
1312 //----------------------------------------------------------------------
1313 void EngineeringSupRB26(){
1314     // Display RB 26 side cable tray support structure
1315     // Inputs:
1316     //    none.
1317     // Outputs:
1318     //    none.
1319     // Retrurn:
1320     //    none.
1321     Int_t irr;
1322     //
1323     TGeoManager *mgr2 = gGeoManager;
1324     TGeoVolume *ALIC = mgr2->GetTopVolume();
1325     TCanvas *c5=0;
1326     if(!(c5 = (TCanvas*)gROOT->FindObject("C5")))
1327         c5 = new TCanvas("C5","ITS SDD Cylinder Geometry",900,450);
1328     c5->Divide(2,1);
1329     TGeoVolume *ITS,*SUPRB26=0;
1330     TGeoNode *node;
1331     //
1332     node = ALIC->FindNode("ITSV_1");
1333     ITS = node->GetVolume();
1334     node = ITS->FindNode("ITSsupFrameM26_1");
1335     SUPRB26 = node->GetVolume();
1336     //
1337     mgr2->SetNsegments(ISetits(1,-1));
1338     //
1339     mgr2->SetVisLevel(6);
1340     mgr2->SetVisOption(0);
1341     //mgr2->CheckOverlaps(0.01);
1342     //mgr2->PrintOverlaps();
1343     if(ISetits(2,-1)==1){
1344         TGeoShape *clip = new TGeoTubeSeg(0, 1000, 2000, 45, 90);
1345         mgr2->SetClippingShape(clip);
1346     } // end if
1347     mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1348     if(ISetits(2,-1)!=0) mgr2->SetPhiRange(DSetits(1,-1.),DSetits(0,-1.));
1349     //
1350     c5->cd(1);
1351     SUPRB26->Draw();
1352     TPad *p1 = (TPad*)c5->GetPad(1);
1353     TView *view1 = p1->GetView();
1354     if(view1){
1355         view1->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1356         if(irr) cout <<"error="<<irr<<endl;
1357         if(ISetits(4,-1)==0) view1->SetParallel();
1358         else  view1->SetPerspective();
1359         view1->Front();
1360         if(ISetits(3,-1)!=0) view1->ShowAxis();
1361     } // end if view1
1362     if(ISetits(5,-1)==1) SUPRB26->Raytrace();
1363     //
1364     c5->cd(2);
1365     SUPRB26->Draw();
1366     TPad *p2 = (TPad*)c5->GetPad(2);
1367     TView *view2 = p2->GetView();
1368     if(view2){
1369         view2->SetView(DSetits(2,-1.),DSetits(3,-1.),DSetits(4,-1.),irr);
1370         if(irr) cout <<"error="<<irr<<endl;
1371         if(ISetits(4,-1)==0) view2->SetParallel();
1372         else  view2->SetPerspective();
1373         view2->Top();
1374         if(ISetits(3,-1)!=0) view2->ShowAxis();
1375     } // end if view2
1376     if(ISetits(5,-1)==1) SUPRB26->Raytrace();
1377     //
1378 }
1379
1380 // Local functions to replace "regular" ones not available
1381 // in the environment where the macro runs
1382
1383 //______________________________________________________________________
1384 void CreateMaterialsITS(){
1385     // Create ITS materials
1386     //     This function defines the default materials used in the Geant
1387     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
1388     // AliITSv11Hybrid.
1389     // In general it is automatically replaced by
1390     // the CreateMaterials routine defined in AliITSv?. Should the function
1391     // CreateMaterials not exist for the geometry version you are using this
1392     // one is used. See the definition found in AliITSv5 or the other routine
1393     // for a complete definition.
1394     // Inputs:
1395     //   none.
1396     // Outputs:
1397     //   none.
1398     // Return:
1399     //   none.
1400
1401     Bool_t fByThick=kTRUE;    // Flag to use services materials by thickness
1402                               // ture, or mass false.
1403
1404 //    Int_t   ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
1405 //    Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
1406     Int_t   ifield = 2;
1407     Float_t fieldm = 10.;
1408
1409     Float_t tmaxfd = 0.1; // 1.0; // Degree
1410     Float_t stemax = 1.0; // cm
1411     Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
1412     Float_t epsil  = 1.0E-4; // 1.0; // cm
1413     Float_t stmin  = 0.0; // cm "Default value used"
1414
1415     Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
1416     Float_t stemaxSi = 0.0075; //  .10000E+01; // cm
1417     Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
1418     Float_t epsilSi  = 1.0E-4;// .10000E+01;
1419     Float_t stminSi  = 0.0; // cm "Default value used"
1420
1421     Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
1422     Float_t stemaxAir = .10000E+01; // cm
1423     Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
1424     Float_t epsilAir  = 1.0E-4;// .10000E+01;
1425     Float_t stminAir  = 0.0; // cm "Default value used"
1426
1427     Float_t tmaxfdServ = 1.0; // 10.0; // Degree
1428     Float_t stemaxServ = 1.0; // 0.01; // cm
1429     Float_t deemaxServ = 0.5; // 0.1; // Fraction of particle's energy 0<deemax<=1
1430     Float_t epsilServ  = 1.0E-3; // 0.003; // cm
1431     Float_t stminServ  = 0.0; //0.003; // cm "Default value used"
1432
1433     // Freon PerFluorobuthane C4F10 see 
1434     // http://st-support-cooling-electronics.web.cern.ch/
1435     //        st-support-cooling-electronics/default.htm
1436     Float_t afre[2]  = { 12.011,18.9984032 };
1437     Float_t zfre[2]  = { 6., 9. };
1438     Float_t wfre[2]  = { 4.,10. };
1439     Float_t densfre  = 1.52;
1440
1441
1442     //CM55J
1443
1444     Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
1445     Float_t zCM55J[4]={6.,7.,8.,1.};
1446     Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
1447     Float_t dCM55J = 1.8;
1448
1449     //ALCM55J
1450
1451     Float_t aALCM55J[5]={12.0107,14.0067,15.9994,1.00794,26.981538};
1452     Float_t zALCM55J[5]={6.,7.,8.,1.,13.};
1453     Float_t wALCM55J[5]={0.817657902,0.0093488157,0.0503618265,0.0226320885,0.1};
1454     Float_t dALCM55J = 1.9866;
1455
1456     //Si Chips
1457
1458     Float_t aSICHIP[6]={12.0107,14.0067,15.9994,1.00794,28.0855,107.8682};
1459     Float_t zSICHIP[6]={6.,7.,8.,1.,14., 47.};
1460     Float_t wSICHIP[6]={0.039730642,0.001396798,0.01169634,0.004367771,0.844665,0.09814344903};
1461     Float_t dSICHIP = 2.36436;
1462
1463     //Inox
1464     
1465     Float_t aINOX[9]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,51.9961,95.94,55.845};
1466     Float_t zINOX[9]={6.,25.,14.,15.,16., 28.,24.,42.,26.};
1467     Float_t wINOX[9]={0.0003,0.02,0.01,0.00045,0.0003,0.12,0.17,0.025,0.654};
1468     Float_t dINOX = 8.03;
1469
1470     //SDD HV microcable
1471
1472     Float_t aHVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
1473     Float_t zHVm[5]={6.,1.,7.,8.,13.};
1474     Float_t wHVm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
1475     Float_t dHVm = 1.6087;
1476
1477     //SDD LV+signal cable
1478
1479     Float_t aLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
1480     Float_t zLVm[5]={6.,1.,7.,8.,13.};
1481     Float_t wLVm[5]={0.21722436468,0.0082859922,0.023028867,0.06574077612, 0.68572};
1482     Float_t dLVm = 2.1035;
1483
1484     //SDD hybrid microcab
1485
1486     Float_t aHLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
1487     Float_t zHLVm[5]={6.,1.,7.,8.,13.};
1488     Float_t wHLVm[5]={0.24281879711,0.00926228815,0.02574224025,0.07348667449, 0.64869};
1489     Float_t dHLVm = 2.0502;
1490
1491     //SDD anode microcab
1492
1493     Float_t aALVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
1494     Float_t zALVm[5]={6.,1.,7.,8.,13.};
1495     Float_t wALVm[5]={0.392653705471,0.0128595919215,0.041626868025,0.118832707289, 0.431909};
1496     Float_t dALVm = 2.0502;
1497
1498     //X7R capacitors
1499
1500     Float_t aX7R[7]={137.327,47.867,15.9994,58.6928,63.5460,118.710,207.2};
1501     Float_t zX7R[7]={56.,22.,8.,28.,29.,50.,82.};
1502     Float_t wX7R[7]={0.251639432,0.084755042,0.085975822,0.038244751,0.009471271,0.321736471,0.2081768};
1503     Float_t dX7R = 7.14567;
1504
1505     // AIR
1506
1507     Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
1508     Float_t zAir[4]={6.,7.,8.,18.};
1509     Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
1510     Float_t dAir = 1.20479E-3;
1511
1512     // Water
1513
1514     Float_t aWater[2]={1.00794,15.9994};
1515     Float_t zWater[2]={1.,8.};
1516     Float_t wWater[2]={0.111894,0.888106};
1517     Float_t dWater   = 1.0;
1518
1519     // CERAMICS
1520   //     94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
1521     Float_t acer[5]  = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
1522     Float_t zcer[5]  = {       13.,     8.,    14.,     25.,    24. };
1523     Float_t wcer[5]  = {.4443408,.5213375,.0130872,.0178135,.003421};
1524     Float_t denscer  = 3.6;
1525
1526     //G10FR4
1527
1528     Float_t zG10FR4[14] = {14.00,       20.00,  13.00,  12.00,  5.00,   22.00,  11.00,  19.00,  26.00,  9.00,   8.00,   6.00,   7.00,   1.00};
1529     Float_t aG10FR4[14] = {28.0855000,40.0780000,26.9815380,24.3050000,10.8110000,47.8670000,22.9897700,39.0983000,55.8450000,18.9984000,15.9994000,12.0107000,14.0067000,1.0079400};
1530     Float_t wG10FR4[14] = {0.15144894,0.08147477,0.04128158,0.00904554,0.01397570,0.00287685,0.00445114,0.00498089,0.00209828,0.00420000,0.36043788,0.27529426,0.01415852,0.03427566};
1531     Float_t densG10FR4= 1.8;
1532     
1533      //--- EPOXY  --- C18 H19 O3
1534       Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ; 
1535       Float_t zEpoxy[3] = {     8.,      1.,      6.} ; 
1536       Float_t wEpoxy[3] = {     3.,     19.,     18.} ; 
1537       Float_t dEpoxy = 1.8 ;
1538
1539       // rohacell: C9 H13 N1 O2
1540     Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
1541     Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
1542     Float_t wrohac[4] = { 14.,   10.,    2.,     6.};
1543     Float_t drohac    = 0.052;
1544
1545     // If he/she means stainless steel (inox) + Aluminium and Zeff=15.3383 then
1546 //
1547 // %Al=81.6164 %inox=100-%Al
1548
1549     Float_t aInAl[5] = {27., 55.847,51.9961,58.6934,28.0855 };
1550     Float_t zInAl[5] = {13., 26.,24.,28.,14. };
1551     Float_t wInAl[5] = {.816164, .131443,.0330906,.0183836,.000919182};
1552     Float_t dInAl    = 3.075;
1553
1554     // Kapton
1555
1556     Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
1557     Float_t zKapton[4]={1.,6.,7.,8.};
1558     Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
1559     Float_t dKapton   = 1.42;
1560     
1561     // Kapton + Cu (for Pixel Bus)
1562
1563     Float_t aKaptonCu[5]={1.00794, 12.0107, 14.010, 15.9994, 63.5460};
1564     Float_t zKaptonCu[5]={1., 6., 7., 8., 29.};
1565     Float_t wKaptonCuBus[5];
1566     
1567     // Kapton + Cu (for Pixel MCM)
1568
1569     Float_t wKaptonCuMCM[5];
1570     
1571     // Kapton + Cu (mix of two above)
1572
1573     Float_t wKaptonCuMix[5];
1574
1575     //SDD ruby sph.
1576     Float_t aAlOxide[2]  = { 26.981539,15.9994};
1577     Float_t zAlOxide[2]  = {       13.,     8.};
1578     Float_t wAlOxide[2]  = {0.4707, 0.5293};
1579     Float_t dAlOxide     = 3.97;
1580
1581     // Silica for optical fibers: Si O2
1582     Float_t aoptfib[2] = { 28.0855, 15.9994};
1583     Float_t zoptfib[2] = { 14.,      8.    };
1584     Float_t woptfib[2] = {  1.,      2.    };
1585     Float_t doptfib    = 2.55;
1586
1587     // Tetrafluorethylene-Perfluorpropylene (FEP) - 08 Mar 10
1588     Float_t aFEP[2] = { 12.0107, 18.9984};
1589     Float_t zFEP[2] = {  6.    ,  9.    };
1590     Float_t wFEP[2] = {  1.    ,  2.    };
1591     Float_t dFEP    = 2.15;
1592
1593     // PVC (C2H3Cl)n - 08 Jul 10
1594     Float_t aPVC[3] = { 12.0107, 1.00794, 35.4527};
1595     Float_t zPVC[3] = {  6.    , 1.     , 35.   };
1596     Float_t wPVC[3] = {  2.    , 3.     ,  1.   };
1597     Float_t dPVC    = 1.3;
1598
1599     //SSD NiSn capacitor ends
1600     Float_t aNiSn[2]  = { 56.6934,118.710};
1601     Float_t zNiSn[2]  = {     28.,     50.};
1602     Float_t wNiSn[2]  = {0.33, 0.67};
1603     Float_t dNiSn     = wNiSn[0]*8.908 + wNiSn[1]*7.310;
1604
1605     AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1606     AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1607
1608     AliMaterial(2,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1609     AliMedium(2,"SPD SI CHIP$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1610
1611     AliMaterial(3,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1612     AliMedium(3,"SPD SI BUS$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1613
1614     AliMixture(4,"C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1615     AliMedium(4,"C (M55J)$",4,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1616
1617     AliMixture(5,"AIR$",aAir,zAir,dAir,4,wAir);
1618     AliMedium(5,"AIR$",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1619
1620     AliMixture(6,"GEN AIR$",aAir,zAir,dAir,4,wAir);
1621     AliMedium(6,"GEN AIR$",6,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1622
1623     AliMixture(7,"SDD SI CHIP$",aSICHIP,zSICHIP,dSICHIP,6,wSICHIP);
1624     AliMedium(7,"SDD SI CHIP$",7,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1625
1626     AliMixture(9,"SDD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1627     AliMedium(9,"SDD C (M55J)$",9,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1628
1629     AliMixture(10,"SDD AIR$",aAir,zAir,dAir,4,wAir);
1630     AliMedium(10,"SDD AIR$",10,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1631
1632     AliMaterial(11,"AL$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
1633     AliMedium(11,"AL$",11,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1634
1635     AliMixture(12, "Water$",aWater,zWater,dWater,2,wWater);
1636     AliMedium(12,"WATER$",12,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1637
1638     AliMixture(13,"Freon$",afre,zfre,densfre,-2,wfre);
1639     AliMedium(13,"Freon$",13,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1640
1641     AliMaterial(14,"COPPER$",0.63546E+02,0.29000E+02,0.89600E+01,0.14300E+01,0.99900E+03);
1642     AliMedium(14,"COPPER$",14,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1643     AliMixture(15,"CERAMICS$",acer,zcer,denscer,5,wcer);
1644     AliMedium(15,"CERAMICS$",15,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1645
1646     AliMixture(20,"SSD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1647     AliMedium(20,"SSD C (M55J)$",20,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1648
1649     AliMixture(21,"SSD AIR$",aAir,zAir,dAir,4,wAir);
1650     AliMedium(21,"SSD AIR$",21,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1651
1652     AliMixture(25,"G10FR4$",aG10FR4,zG10FR4,densG10FR4,14,wG10FR4);
1653     AliMedium(25,"G10FR4$",25,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1654
1655      AliMixture(26,"GEN C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1656     AliMedium(26,"GEN C (M55J)$",26,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1657
1658     AliMixture(27,"GEN Air$",aAir,zAir,dAir,4,wAir);
1659     AliMedium(27,"GEN Air$",27,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1660
1661     AliMixture(47,"PVC$",aPVC,zPVC,dPVC,-3,wPVC);
1662     AliMedium(47,"PVC$",47,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1663
1664     Double_t cuFrac = 0.56;
1665     Double_t kFrac  = 1.0 - cuFrac;
1666     Double_t cuDens = 8.96;
1667     Float_t dKaptonCuBus   = cuFrac * cuDens + kFrac * dKapton;
1668     for (Int_t j=0; j<4; j++)
1669       wKaptonCuBus[j] = wKapton[j]*kFrac;
1670     wKaptonCuBus[4] = cuFrac;
1671     AliMixture(48, "SPD-BUS CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuBus, 5, wKaptonCuBus);
1672     AliMedium(48,"SPD-BUS CU KAPTON$",48,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1673     
1674     cuFrac = 0.5;
1675     kFrac  = 1.0 - cuFrac;
1676     Float_t dKaptonCuMCM   = cuFrac * cuDens + kFrac * dKapton;
1677     for (Int_t j=0; j<4; j++)
1678       wKaptonCuMCM[j] = wKapton[j]*kFrac;
1679     wKaptonCuMCM[4] = cuFrac;
1680     AliMixture(49, "SPD-MCM CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMCM, 5, wKaptonCuMCM);
1681     AliMedium(49,"SPD-MCM CU KAPTON$",49,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1682     
1683     cuFrac = (0.56 + 0.5) / 2.0;
1684     kFrac  = 1.0 - cuFrac;
1685     Float_t dKaptonCuMix   = cuFrac * cuDens + kFrac * dKapton;
1686     for (Int_t j=0; j<4; j++)
1687       wKaptonCuMix[j] = wKapton[j]*kFrac;
1688     wKaptonCuMix[4] = cuFrac;
1689     AliMixture(50, "SPD-MIX CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMix, 5, wKaptonCuMix);
1690     AliMedium(50,"SPD-MIX CU KAPTON$",50,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1691
1692     AliMaterial(51,"SPD SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1693     AliMedium(51,"SPD SI$",51,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1694
1695     AliMaterial(52,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1696     AliMedium(52,"SPD SI CHIP$",52,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1697
1698     AliMaterial(53,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1699     AliMedium(53,"SPD SI BUS$",53,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1700
1701     AliMixture(54,"SPD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1702     AliMedium(54,"SPD C (M55J)$",54,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1703
1704     AliMixture(55,"SPD AIR$",aAir,zAir,dAir,4,wAir);
1705     AliMedium(55,"SPD AIR$",55,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1706
1707     AliMixture(56, "SPD KAPTON(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
1708     AliMedium(56,"SPD KAPTON(POLYCH2)$",56,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1709
1710     // Gaseous Freon has same chemical composition but air density at 1.7 atm
1711     AliMixture(59,"GASEOUS FREON$",afre,zfre,1.7*dAir,-2,wfre);
1712     AliMedium(59,"GASEOUS FREON$",59,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1713
1714     AliMixture(61,"EPOXY$",aEpoxy,zEpoxy,dEpoxy,-3,wEpoxy);
1715     AliMedium(61,"EPOXY$",61,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1716
1717     AliMaterial(62,"SILICON$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1718     AliMedium(62,"SILICON$",62,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1719
1720     AliMixture(63, "KAPTONH(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
1721     AliMedium(63,"KAPTONH(POLYCH2)$",63,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1722
1723     AliMaterial(64,"ALUMINUM$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
1724     AliMedium(64,"ALUMINUM$",64,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1725
1726     AliMixture(65,"INOX$",aINOX,zINOX,dINOX,9,wINOX);
1727     AliMedium(65,"INOX$",65,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1728
1729     AliMixture(66,"NiSn$",aNiSn,zNiSn,dNiSn,2,wNiSn);
1730     AliMedium(66,"NiSn$",66,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1731
1732     AliMaterial(67,"Sn$", 118.710, 50., 7.310, 1.206, 999.);
1733     AliMedium(67,"Sn$",67,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1734
1735     AliMixture(68,"ROHACELL$",arohac,zrohac,drohac,-4,wrohac);
1736     AliMedium(68,"ROHACELL$",68,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1737
1738      AliMixture(69,"SDD C AL (M55J)$",aALCM55J,zALCM55J,dALCM55J,5,wALCM55J);
1739     AliMedium(69,"SDD C AL (M55J)$",69,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1740   
1741     AliMixture(70, "SDDKAPTON (POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
1742     AliMedium(70,"SDDKAPTON (POLYCH2)$",70,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1743
1744      AliMaterial(71,"ITS SANDW A$",0.12011E+02,0.60000E+01,0.2115E+00,0.17479E+03,0.99900E+03);
1745     AliMedium(71,"ITS SANDW A$",71,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1746
1747     AliMaterial(72,"ITS SANDW B$",0.12011E+02,0.60000E+01,0.27000E+00,0.18956E+03,0.99900E+03);
1748     AliMedium(72,"ITS SANDW B$",72,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1749
1750     AliMaterial(73,"ITS SANDW C$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1751     AliMedium(73,"ITS SANDW C$",73,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1752
1753     AliMaterial(74,"HEAT COND GLUE$",0.12011E+02,0.60000E+01,0.1930E+01,0.22100E+02,0.99900E+03);
1754     AliMedium(74,"HEAT COND GLUE$",74,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1755
1756     AliMaterial(75,"ELASTO SIL$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1757     AliMedium(75,"ELASTO SIL$",75,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1758
1759     // SPD bus (data from Petra Riedler)
1760     Float_t aSPDbus[5] = {1.00794,12.0107,14.01,15.9994,26.982 };
1761     Float_t zSPDbus[5] = {1.,6.,7.,8.,13.};
1762     Float_t wSPDbus[5] = {0.023523,0.318053,0.009776,0.078057,0.570591};
1763     Float_t dSPDbus    = 2.128505;
1764
1765     //   AliMaterial(76,"SPDBUS(AL+KPT+EPOX)$",0.19509E+02,0.96502E+01,0.19060E+01,0.15413E+02,0.99900E+03);
1766     AliMixture(76,"SPDBUS(AL+KPT+EPOX)$",aSPDbus,zSPDbus,dSPDbus,5,wSPDbus);
1767     AliMedium(76,"SPDBUS(AL+KPT+EPOX)$",76,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1768                
1769     AliMixture(77,"SDD X7R capacitors$",aX7R,zX7R,dX7R,7,wX7R);
1770     AliMedium(77,"SDD X7R capacitors$",77,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1771
1772     AliMixture(78,"SDD ruby sph. Al2O3$",aAlOxide,zAlOxide,dAlOxide,2,wAlOxide);
1773     AliMedium(78,"SDD ruby sph. Al2O3$",78,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1774
1775     AliMaterial(79,"SDD SI insensitive$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1776     AliMedium(79,"SDD SI insensitive$",79,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1777
1778     AliMixture(80,"SDD HV microcable$",aHVm,zHVm,dHVm,5,wHVm);
1779     AliMedium(80,"SDD HV microcable$",80,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1780
1781     AliMixture(81,"SDD LV+signal cable$",aLVm,zLVm,dLVm,5,wLVm);
1782     AliMedium(81,"SDD LV+signal cable$",81,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1783
1784     AliMixture(82,"SDD hybrid microcab$",aHLVm, zHLVm,dHLVm,5,wHLVm);
1785     AliMedium(82,"SDD hybrid microcab$",82,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1786
1787     AliMixture(83,"SDD anode microcab$",aALVm,zALVm,dALVm,5,wALVm);
1788     AliMedium(83,"SDD anode microcab$",83,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1789     Float_t aDSring[4]={12.0107,      1.00794,     14.0067,      15.9994};
1790     Float_t zDSring[4]={ 6.,          1.,           7.,           8.};
1791     Float_t wDSring[4]={ 0.854323888, 0.026408778,  0.023050265,  0.096217069};
1792     Float_t dDSring = 0.2875;
1793     AliMixture(84,"SDD/SSD rings$",aDSring,zDSring,dDSring,4,wDSring);
1794     AliMedium(84,"SDD/SSD rings$",84,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1795
1796     AliMixture(85,"inox/alum$",aInAl,zInAl,dInAl,5,wInAl);
1797     AliMedium(85,"inox/alum$",85,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1798
1799     // special media to take into account services in the SDD and SSD 
1800     // cones for the FMD
1801     //Begin_Html
1802     /*
1803       <A HREF="http://www.Physics.ohio-state.edu/~nilsen/ITS/ITS_MatBudget_4B.xls">
1804       </pre>
1805       <br clear=left>
1806       <font size=+2 color=blue>
1807       <p> The Exel spread sheet from which these density number come from.
1808       </font></A>
1809     */
1810     //End_Html
1811
1812     //  AliMaterial(86,"AIRFMDSDD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
1813     Float_t aA[13],zZ[13],wW[13],den;
1814     // From Pierluigi Barberis calculations of 2SPD+1SDD October 2 2002.
1815     zZ[0] = 1.0; aA[0] = 1.00794; // Hydrogen
1816     zZ[1] = 6.0; aA[1] = 12.011; // Carbon
1817     zZ[2] = 7.0; aA[2] = 14.00674; // Nitrogen
1818     zZ[3] = 8.0; aA[3] = 15.9994; // Oxigen
1819     zZ[4] = 14.0; aA[4] = 28.0855; // Silicon
1820     zZ[5] = 24.0; aA[5] = 51.9961; //Cromium
1821     zZ[6] = 25.0; aA[6] = 54.938049; // Manganese
1822     zZ[7] = 26.0; aA[7] = 55.845; // Iron
1823     zZ[8] = 28.0; aA[8] = 58.6934; // Nickle
1824     zZ[9] = 29.0; aA[9] = 63.546; // Copper
1825     zZ[10] = 13.0; aA[10] = 26.981539; // Alulminum
1826     zZ[11] = 47.0; aA[11] = 107.8682; // Silver
1827     zZ[12] = 27.0; aA[12] = 58.9332; // Cobolt
1828     wW[0] = 0.019965;
1829     wW[1] = 0.340961;
1830     wW[2] = 0.041225;
1831     wW[3] = 0.200352;
1832     wW[4] = 0.000386;
1833     wW[5] = 0.001467;
1834     wW[6] = 0.000155;
1835     wW[7] = 0.005113;
1836     wW[8] = 0.000993;
1837     wW[9] = 0.381262;
1838     wW[10] = 0.008121;
1839     wW[11] = 0.000000;
1840     wW[12] = 0.000000;
1841     if(fByThick){// New values seeITS_MatBudget_4B.xls
1842         den = 1.5253276; // g/cm^3  Cell O370
1843     }else{
1844         den = 2.58423412; // g/cm^3 Cell L370
1845     } // end if fByThick
1846     //den = 6161.7/(3671.58978);//g/cm^3 Volume does not exclude holes
1847     AliMixture(86,"AIRFMDSDD$",aA,zZ,den,+11,wW);
1848     AliMedium(86,"AIRFMDSDD$",86,0,ifield,fieldm,tmaxfdAir,stemaxAir,
1849               deemaxAir,epsilAir,stminAir);
1850
1851     //AliMaterial(87,"AIRFMDSSD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
1852     // From Pierluigi Barberis calculations of SSD October 2 2002.
1853     wW[0] = 0.019777;
1854     wW[1] = 0.325901;
1855     wW[2] = 0.031848;
1856     wW[3] = 0.147668;
1857     wW[4] = 0.030609;
1858     wW[5] = 0.013993;
1859     wW[6] = 0.001479;
1860     wW[7] = 0.048792;
1861     wW[8] = 0.009477;
1862     wW[9] = 0.350697;
1863     wW[10] = 0.014546;
1864     wW[11] = 0.005213;
1865     wW[12] = 0.000000;
1866     if(fByThick){// New values seeITS_MatBudget_4B.xls
1867         den = 1.2464275; // g/cm^3   Cell O403
1868     }else{
1869         den = 1.28134409; // g/cm^3  Cell L403
1870     } // end if fByThick
1871     //den = 7666.3/(9753.553259); // volume does not exclude holes
1872     AliMixture(87,"AIRFMDSSD$",aA,zZ,den,+12,wW); 
1873     AliMedium(87,"AIRFMDSSD$",87,0,ifield,fieldm,tmaxfdAir,stemaxAir,
1874               deemaxAir,epsilAir,stminAir);
1875
1876     //AliMaterial(88,"ITS SANDW CFMDSDD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1877     // From Pierluigi Barberis calculations of 1SDD+Carbon fiber October 2 2002
1878     wW[0] = 0.016302;
1879     wW[1] = 0.461870;
1880     wW[2] = 0.033662;
1881     wW[3] = 0.163595;
1882     wW[4] = 0.000315;
1883     wW[5] = 0.001197;
1884     wW[6] = 0.000127;
1885     wW[7] = 0.004175;
1886     wW[8] = 0.000811;
1887     wW[9] = 0.311315;
1888     wW[10] = 0.006631;
1889     wW[11] = 0.000000;
1890     wW[12] = 0.000000;
1891     if(fByThick){// New values seeITS_MatBudget_4B.xls
1892         den = 1.9353276; // g/cm^3  Cell N370
1893     }else{
1894         den = 3.2788626; // g/cm^3 Cell F370
1895     } // end if fByThick
1896     //den = 7667.1/(3671.58978); // Volume does not excludeholes
1897     AliMixture(88,"ITS SANDW CFMDSDD$",aA,zZ,den,+11,wW); 
1898     AliMedium(88,"ITS SANDW CFMDSDD$",88,0,ifield,fieldm,tmaxfd,stemax,
1899               deemax,epsil,stmin);
1900
1901     //AliMaterial(89,"ITS SANDW CFMDSSD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1902     // From Pierluigi Barberis calculations of SSD+Carbon fiber October 2 2002.
1903     wW[0] = 0.014065;
1904     wW[1] = 0.520598;
1905     wW[2] = 0.022650;
1906     wW[3] = 0.105018;
1907     wW[4] = 0.021768;
1908     wW[5] = 0.009952;
1909     wW[6] = 0.001051;
1910     wW[7] = 0.034700;
1911     wW[8] = 0.006740;
1912     wW[9] = 0.249406;
1913     wW[10] = 0.010345;
1914     wW[11] = 0.0003707;
1915     wW[12] = 0.000000;
1916     if(fByThick){// New values seeITS_MatBudget_4B.xls
1917         den = 1.6564275; // g/cm^3  Cell N304
1918     }else{
1919         den = 1.7028296; // g/cm^3  Cell F304
1920     } // end if fByThick
1921     //den = 1166.5/(3671.58978); // Volume does not exclude holes
1922     AliMixture(89,"ITS SANDW CFMDSSD$",aA,zZ,den,+12,wW); 
1923     AliMedium(89,"ITS SANDW CFMDSSD$",89,0,ifield,fieldm,tmaxfd,stemax,
1924               deemax,epsil,stmin);
1925
1926     //AliMaterial(97,"SPD SERVICES$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1927     // From Pierluigi Barberis calculations of 1SPD October 2 2002.
1928     wW[0] = 0.005970;
1929     wW[1] = 0.304704;
1930     wW[2] = 0.042510;
1931     wW[3] = 0.121715;
1932     wW[4] = 0.001118;
1933     wW[5] = 0.030948;
1934     wW[6] = 0.003270;
1935     wW[7] = 0.107910;
1936     wW[8] = 0.020960;
1937     wW[9] = 0.360895;
1938     wW[10] = 0.000000;
1939     wW[11] = 0.000000;
1940     wW[12] = 0.000000;
1941     if(fByThick){// New values seeITS_MatBudget_4B.xls
1942         den = 80.31136576; // g/cm^3 Cell H329
1943     }else{
1944         den = 87.13062; // g/cm^3  Cell G329
1945     } // end if fByThick
1946     //den = 1251.3/(0.05*2.0*TMath::Pi()*(7.75*7.75 - 3.7*3.7)); // g/cm^3
1947     AliMixture(97,"SPD SERVICES$",aA,zZ,den,+10,wW); 
1948     AliMedium(97,"SPD SERVICES$",97,0,ifield,fieldm,tmaxfd,stemax,
1949               deemax,epsil,stmin);
1950
1951
1952     // Special media
1953
1954     AliMaterial(90,"SPD shield$", 12.011, 6., 1.93 , 22.36, 999);
1955     AliMedium(90,"SPD shield$",90,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1956
1957     // SPD End Ladder (data from Petra Riedler)
1958     Float_t aSPDel[5] = {1.00794,12.0107,14.01,15.9994,63.54 };
1959     Float_t zSPDel[5] = {1.,6.,7.,8.,29.};
1960     Float_t wSPDel[5] = {0.004092,0.107274,0.011438,0.032476,0.844719};
1961     Float_t dSPDel    = 3.903403;
1962
1963     //   AliMaterial(91, "SPD End ladder$", 47.0447, 21.7963, 3.6374, 4.4711, 999); 
1964     AliMixture(91,"SPD End ladder$",aSPDel,zSPDel,dSPDel,5,wSPDel);
1965     AliMedium(91,"SPD End ladder$",91,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1966
1967     AliMaterial(92, "SPD cone$",28.0855, 14., 2.33, 9.36, 999);    
1968     AliMedium(92,"SPD cone$",92,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1969     /*  Material with fractional Z not actually used
1970     AliMaterial(93, "SDD End ladder$", 69.9298, 29.8246, 0.3824, 36.5103, 999);
1971     AliMedium(93,"SDD End ladder$",93,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1972     */
1973     AliMaterial(94, "SDD cone$",63.546, 29., 1.15, 1.265, 999);
1974     AliMedium(94,"SDD cone$",94,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1975     /* Material with fractional Z not actually used
1976     AliMaterial(95, "SSD End ladder$", 32.0988, 15.4021, 0.68, 35.3238, 999); 
1977     AliMedium(95,"SSD End ladder$",95,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1978     */
1979     AliMaterial(96, "SSD cone$",63.546, 29., 1.15, 1.265, 999);
1980     AliMedium(96,"SSD cone$",96,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1981
1982     AliMixture(98,"SDD OPTICFIB$",aoptfib,zoptfib,doptfib,-2,woptfib);
1983     AliMedium(98,"SDD OPTICFIB$",98,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1984
1985     AliMixture(95,"SSD FEP$",aFEP,zFEP,dFEP,-2,wFEP);
1986     AliMedium(95,"SSD FEP$",95,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1987
1988     // Mean material for low-voltage cables on SPD trays Side A
1989     // (Copper + PolyEthylene (C2-H4)) (D.Elia for cable number and
1990     // cross-section area, M.Sitta for elemental computation) - 26 Feb 10
1991     wW[0] = 0.323024;//H
1992     wW[2] = 0.515464;//Cu
1993     wW[1] = 0.161512;//C
1994     wW[3] = 0.000000;//O
1995     wW[4] = 0.000000;//S
1996     wW[5] = 0.000000;//F
1997     wW[6] = 0.000000;//Sn
1998     wW[7] = 0.000000;//Pb
1999     wW[8] = 0.000000;//Cr
2000     wW[9] = 0.000000;//Si
2001     wW[10] = 0.000000;//Ni
2002     wW[11] = 0.000000;//Ca
2003
2004     den = 5.078866;
2005     AliMixture(60,"SPD_LOWCABLES$",aA,zZ,den,+3,wW);
2006     AliMedium(60,"SPD_LOWCABLES$",60,0,ifield,fieldm,tmaxfd,stemax,
2007               deemax,epsil,stmin);
2008
2009     // Mean material for high-voltage cables on SPD trays Side A & C
2010     // (Copper + HD PolyEthylene (C2-H2)) (D.Elia for cable number and
2011     // cross-section area, M.Sitta for elemental computation) - 10 Jun 10
2012     wW[0] = 0.083766;//H
2013     wW[2] = 0.417136;//Cu
2014     wW[1] = 0.499098;//C
2015     wW[3] = 0.000000;//O
2016     wW[4] = 0.000000;//S
2017     wW[5] = 0.000000;//F
2018     wW[6] = 0.000000;//Sn
2019     wW[7] = 0.000000;//Pb
2020     wW[8] = 0.000000;//Cr
2021     wW[9] = 0.000000;//Si
2022     wW[10] = 0.000000;//Ni
2023     wW[11] = 0.000000;//Ca
2024
2025     den = 1.514930;
2026     AliMixture(58,"SPD_HICABLES$",aA,zZ,den,+3,wW);
2027     AliMedium(58,"SPD_HICABLES$",58,0,ifield,fieldm,tmaxfd,stemax,
2028               deemax,epsil,stmin);
2029
2030     // PolyUrethane [C25-H42-N2-O6] - 07 Mar 10
2031     zZ[2] =  7.0; aA[2] =  14.0067; // Nitrogen - From Root TGeoElementTable
2032
2033     wW[0] = 0.090724;//H
2034     wW[2] = 0.060035;//N
2035     wW[1] = 0.643513;//C
2036     wW[3] = 0.205728;//O
2037     wW[4] = 0.000000;//S
2038     wW[5] = 0.000000;//F
2039     wW[6] = 0.000000;//Sn
2040     wW[7] = 0.000000;//Pb
2041     wW[8] = 0.000000;//Cr
2042     wW[9] = 0.000000;//Si
2043     wW[10] = 0.000000;//Ni
2044     wW[11] = 0.000000;//Ca
2045
2046     den = 1.158910;
2047     AliMixture(67,"POLYURETHANE$",aA,zZ,den,+4,wW);
2048     AliMedium(67,"POLYURETHANE$",67,0,ifield,fieldm,tmaxfd,stemax,
2049               deemax,epsil,stmin);
2050
2051     //  POM (Polyoxymethylene = (CH2O)n ) - 02 May 10
2052     zZ[2] =  8.0; aA[2] =  15.9994; // Oxigen
2053
2054     wW[0] = 0.067137;//H
2055     wW[1] = 0.400016;//C
2056     wW[2] = 0.532847;//O
2057     wW[3] = 0.000000;//O
2058     wW[4] = 0.000000;//S
2059     wW[5] = 0.000000;//F
2060     wW[6] = 0.000000;//Sn
2061     wW[7] = 0.000000;//Pb
2062     wW[8] = 0.000000;//Cr
2063     wW[9] = 0.000000;//Si
2064     wW[10] = 0.000000;//Ni
2065     wW[11] = 0.000000;//Ca
2066
2067     den = 1.4200;
2068     AliMixture(57,"POLYOXYMETHYLENE$",aA,zZ,den,+3,wW);
2069     AliMedium(57,"POLYOXYMETHYLENE$",57,0,ifield,fieldm,tmaxfd,stemax,
2070               deemax,epsil,stmin);
2071
2072
2073     // Anticorodal: Aliminum alloy for tray ring support on Side A
2074     den = 2.710301;
2075     AliMaterial(93,"ANTICORODAL$",0.26982E+02,0.13000E+02,den,0.89000E+01,0.99900E+03);
2076     AliMedium(93,"ANTICORODAL$",93,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
2077     
2078 }
2079
2080 //_____________________________________________________________________________
2081 void AliMaterial(Int_t imat, const char* name, Float_t a, 
2082                  Float_t z, Float_t dens, Float_t radl,
2083                  Float_t absl) {
2084
2085   TString uniquename = "ITS";
2086   uniquename.Append("_");
2087   uniquename.Append(name);
2088
2089   gGeoManager->Material(uniquename.Data(), a, z, dens, imat, radl, absl);
2090
2091 }
2092
2093 //_____________________________________________________________________________
2094 void AliMedium(Int_t numed, const char *name, Int_t nmat,
2095                Int_t isvol, Int_t ifield, Float_t fieldm,
2096                Float_t tmaxfd, Float_t stemax, Float_t deemax,
2097                Float_t epsil, Float_t stmin){
2098
2099   TString uniquename = "ITS";
2100   uniquename.Append("_");
2101   uniquename.Append(name);
2102
2103   gGeoManager->Medium(uniquename.Data(),numed,nmat, isvol, ifield, fieldm, 
2104                       tmaxfd, stemax,deemax, epsil, stmin);
2105
2106 }
2107
2108 //_____________________________________________________________________________
2109 void AliMixture(Int_t kmat, const char* name, Float_t* a, Float_t* z,
2110                     Double_t dens, Int_t nlmat, Float_t* wmat)
2111 {
2112   //
2113   // Defines mixture OR COMPOUND IMAT as composed by
2114   // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
2115   //
2116   // If NLMAT > 0 then wmat contains the proportion by
2117   // weights of each basic material in the mixture.
2118   //
2119   // If nlmat < 0 then WMAT contains the number of atoms
2120   // of a given kind into the molecule of the COMPOUND
2121   // In this case, WMAT in output is changed to relative
2122   // weigths.
2123   //
2124
2125   TString uniquename = "ITS";
2126   uniquename.Append("_");
2127   uniquename.Append(name);
2128
2129
2130    Double_t* da = CreateDoubleArray(a, TMath::Abs(nlmat));
2131    Double_t* dz = CreateDoubleArray(z, TMath::Abs(nlmat));
2132    Double_t* dwmat = CreateDoubleArray(wmat, TMath::Abs(nlmat));
2133
2134    Mixture(kmat, uniquename.Data(), da, dz, dens, nlmat, dwmat);
2135    for (Int_t i=0; i<nlmat; i++) {
2136       a[i] = da[i]; z[i] = dz[i]; wmat[i] = dwmat[i];
2137    }
2138
2139    delete [] da;
2140    delete [] dz;
2141    delete [] dwmat;
2142 }
2143
2144 //_____________________________________________________________________________
2145 void Mixture(Int_t& kmat, const char* name, Double_t* a, Double_t* z,
2146              Double_t dens, Int_t nlmat, Double_t* wmat)
2147 {
2148   //
2149   // Defines mixture OR COMPOUND IMAT as composed by
2150   // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
2151   //
2152   // If NLMAT > 0 then wmat contains the proportion by
2153   // weights of each basic material in the mixture.
2154   //
2155   // If nlmat < 0 then WMAT contains the number of atoms
2156   // of a given kind into the molecule of the COMPOUND
2157   // In this case, WMAT in output is changed to relative
2158   // weigths.
2159   //
2160
2161    if (nlmat < 0) {
2162       nlmat = - nlmat;
2163       Double_t amol = 0;
2164       Int_t i;
2165       for (i=0;i<nlmat;i++) {
2166          amol += a[i]*wmat[i];
2167       }
2168       for (i=0;i<nlmat;i++) {
2169          wmat[i] *= a[i]/amol;
2170       }
2171    }
2172    gGeoManager->Mixture(name, a, z, dens, nlmat, wmat, kmat);
2173 }
2174
2175 //_____________________________________________________________________________
2176 Double_t* CreateDoubleArray(Float_t* array, Int_t size)
2177 {
2178 // Converts Float_t* array to Double_t*,
2179 // !! The new array has to be deleted by user.
2180 // ---
2181
2182    Double_t* doubleArray;
2183    if (size>0) {
2184       doubleArray = new Double_t[size];
2185       for (Int_t i=0; i<size; i++) doubleArray[i] = array[i];
2186    } else {
2187       //doubleArray = 0;
2188       doubleArray = new Double_t[1];
2189    }
2190    return doubleArray;
2191 }
2192
2193 //______________________________________________________________________
2194 Bool_t Make2DCrossSections(TPolyLine &a0,TPolyLine &a1,
2195                            TPolyLine &b0,TPolyLine &b1,TPolyMarker &p)
2196 {
2197     //
2198     // Fill the objects with the points representing
2199     // a0 the outer carbon fiber SPD sector shape Cross Section A
2200     // a1 the inner carbon fiber SPD sector shape Cross Section A
2201     // b0 the outer carbon fiber SPD sector shape Cross Section B
2202     // b1 the inner carbon fiber SPD sector shape Cross Section B
2203     //
2204     // Inputs:
2205     //   TPolyLine &a0   The outer carbon fiber SPD sector shape
2206     //   TPolyLine &a1   The Inner carbon fiber SPD sector shape
2207     //   TPolyLine &b0   The outer carbon fiber SPD sector shape
2208     //   TPolyLine &b1   The Inner carbon fiber SPD sector shape
2209     //   TPolyMarker &p  The points where the ladders are to be placed
2210     // Outputs:
2211     //   TPolyLine &a0   The shape filled with the points
2212     //   TPolyLine &a1   The shape filled with the points
2213     //   TPolyLine &b0   The shape filled with the points
2214     //   TPolyLine &b1   The shape filled with the points
2215     //   TPolyMarker &p  The filled array of points
2216     // Return:
2217     //     An error flag.
2218     //
2219     Int_t n0,n1,i;
2220     Double_t x,y;
2221     TGeoVolume *a0V,*a1V,*b0V,*b1V;
2222     TGeoXtru *a0S,*a1S,*b0S,*b1S;
2223     TGeoManager *mgr = gGeoManager;
2224
2225     a0V = mgr->GetVolume("ITSSPDCarbonFiberSupportSectorA0");
2226     a0S = dynamic_cast<TGeoXtru*>(a0V->GetShape());
2227     n0 = a0S->GetNvert();
2228     a0.SetPolyLine(n0+1);
2229     //for(i=0;i<fSPDsectorPoints0.GetSize();i++)
2230     //  printf("%d %d %d\n",i,fSPDsectorPoints0[i],fSPDsectorPoints1[i]);
2231     for(i=0;i<n0;i++){
2232         x = a0S->GetX(i);
2233           y = a0S->GetY(i);
2234           //printf("%d %g %g\n",i,x,y);
2235         a0.SetPoint(i,x,y);
2236           if(i==0) a0.SetPoint(n0,x,y);
2237     } // end for i
2238     a1V = mgr->GetVolume("ITSSPDCarbonFiberSupportSectorAirA1");
2239     a1S = dynamic_cast<TGeoXtru*>(a1V->GetShape());
2240     n1 = a1S->GetNvert();
2241     a1.SetPolyLine(n1+1);
2242     for(i=0;i<n1;i++){
2243         x = a1S->GetX(i);
2244           y = a1S->GetY(i);
2245         a1.SetPoint(i,x,y);
2246           if(i==0) a1.SetPoint(n1,x,y);
2247     } // end for i
2248     // Cross Section B
2249     b0V = mgr->GetVolume("ITSSPDCarbonFiberSupportSectorEndB0");
2250     b0S = dynamic_cast<TGeoXtru*>(b0V->GetShape());
2251     n0 = b0S->GetNvert();
2252     b0.SetPolyLine(n0+1);
2253     for(i=0;i<n0;i++){
2254         x = b0S->GetX(i);
2255           y = b0S->GetY(i);
2256         b0.SetPoint(i,x,y);
2257           if(i==0) b0.SetPoint(n0,x,y);
2258     } // end for i
2259     b1V = mgr->GetVolume("ITSSPDCarbonFiberSupportSectorEndAirB1");
2260     b1S = dynamic_cast<TGeoXtru*>(b1V->GetShape());
2261     n1 = b1S->GetNvert();
2262     b1.SetPolyLine(n1+1);
2263     for(i=0;i<n1;i++){
2264         x = b1S->GetX(i);
2265           y = b1S->GetY(i);
2266         b1.SetPoint(i,x,y);
2267           if(i==0) b1.SetPoint(n1,x,y);
2268     } // end for i
2269     //
2270     Double_t x0,y0,x1,y1;
2271     p.SetPolyMarker(2*gspd->GetSPDsectorX0Size());
2272     for(i=0;i<gspd->GetSPDsectorX0Size();i++){
2273           gspd->GetSectorMountingPoints(i,x0,y0,x1,y1);
2274           p.SetPoint(2*i,x0,y0);
2275           p.SetPoint(2*i+1,x1,y1);
2276     } // end for i
2277     return kTRUE;
2278 }