1 ///////////////////////////////////////////////////////////////////////////////
3 // Interface to the HIGZ package for the GEANT drawing package //
7 <img src="picts/THIGZClass.gif">
12 ///////////////////////////////////////////////////////////////////////////////
20 #include "TPolyLine.h"
21 #include "TPolyMarker.h"
22 #include "TPaveLabel.h"
25 #include "AliCallf77.h"
26 #include "TPaveTree.h"
31 # define hplint hplint_
32 # define hplend hplend_
33 # define hplfra hplfra_
34 # define igmeta igmeta_
35 # define iselnt iselnt_
36 # define igiwty igiwty_
40 # define iclrwk iclrwk_
45 # define ightor ightor_
46 # define igpave igpave_
52 # define igterm igterm_
58 # define isfaci isfaci_
59 # define isfais isfais_
62 # define islwsc islwsc_
63 # define isplci isplci_
64 # define ispmci ispmci_
65 # define istxci istxci_
72 # define iclrwk ICLRWK
77 # define ightor IGHTOR
78 # define igpave IGPAVE
84 # define igterm IGTERM
90 # define isfaci ISFACI
91 # define isfais ISFAIS
94 # define islwsc ISLWSC
95 # define isplci ISPLCI
96 # define ispmci ISPMCI
97 # define istxci ISTXCI
103 static Int_t npid = 0;
104 static char cpar[1200];
105 static TGeant3 *geant3=(TGeant3*)gMC;
111 //_______________________________________________________________
117 //_______________________________________________________________
118 THIGZ::THIGZ(Int_t size)
119 :TCanvas("higz","higz",size,size)
125 //_______________________________________________________________
129 //_______________________________________________________________
130 Float_t THIGZ::Get(const char *name)
132 if (!strcmp(name,"FAIS")) return fFAIS;
133 if (!strcmp(name,"FASI")) return fFASI;
134 if (!strcmp(name,"LTYP")) return fLTYP;
135 if (!strcmp(name,"BASL")) return fBASL;
136 if (!strcmp(name,"LWID")) return fLWID;
137 if (!strcmp(name,"MTYP")) return fMTYP;
138 if (!strcmp(name,"MSCF")) return fMSCF;
139 if (!strcmp(name,"PLCI")) return fPLCI;
140 if (!strcmp(name,"PMCI")) return fPMCI;
141 if (!strcmp(name,"FACI")) return fFACI;
142 if (!strcmp(name,"TXCI")) return fTXCI;
143 if (!strcmp(name,"TXAL")) return fTXAL;
144 if (!strcmp(name,"CHHE")) return fCHHE*fY2;
145 if (!strcmp(name,"TANG")) return fTANG;
146 if (!strcmp(name,"TXFP")) return fTXFP;
147 if (!strcmp(name,"BORD")) return fBORD;
148 if (!strcmp(name,"NCOL")) return fNCOL;
149 if (!strcmp(name,"DRMD")) return fDRMD;
150 if (!strcmp(name,"SYNC")) return fSYNC;
151 if (!strcmp(name,"CLIP")) return fCLIP;
152 if (!strcmp(name,"2BUF")) return f2BUF;
155 //_______________________________________________________________
156 void THIGZ::Set(const char *name, Float_t val)
158 if (!strcmp(name,"FAIS")) {fFAIS = Int_t(val); return;}
159 if (!strcmp(name,"FASI")) {fFASI = Int_t(val); return;}
160 if (!strcmp(name,"LTYP")) {fLTYP = Int_t(val); return;}
161 if (!strcmp(name,"BASL")) {fBASL = val; return;}
162 if (!strcmp(name,"LWID")) {fLWID = val; if (val <= 0) fLWID=1; return;}
163 if (!strcmp(name,"MTYP")) {fMTYP = Int_t(val); return;}
164 if (!strcmp(name,"MSCF")) {fMSCF = val; return;}
165 if (!strcmp(name,"PLCI")) {fPLCI = Int_t(val); return;}
166 if (!strcmp(name,"PMCI")) {fPMCI = Int_t(val); return;}
167 if (!strcmp(name,"FACI")) {fFACI = Int_t(val)%1000; return;}
168 if (!strcmp(name,"TXCI")) {fTXCI = Int_t(val); return;}
169 if (!strcmp(name,"TXAL")) {
170 Int_t align = Int_t(val);
171 Int_t aligh = align/10;
172 Int_t aligv = align%10;
175 if (aligh == 0) ah = 1;
176 if (aligv == 1 || aligh == 2) av = 3;
177 if (aligv == 3) av = 2;
178 if (aligv == 0) av = 1;
182 if (!strcmp(name,"CHHE")) {fCHHE = val/fY2; if (fCHHE <= 0) fCHHE = 0.03; return;}
183 if (!strcmp(name,"TANG")) {fTANG = val; return;}
184 if (!strcmp(name,"TXFP")) {fTXFP = Int_t(val); return;}
185 if (!strcmp(name,"BORD")) {fBORD = Int_t(val); return;}
186 if (!strcmp(name,"NCOL")) {fNCOL = Int_t(val); return;}
187 if (!strcmp(name,"DRMD")) {fDRMD = Int_t(val); return;}
188 if (!strcmp(name,"SYNC")) {fSYNC = Int_t(val); return;}
189 if (!strcmp(name,"CLIP")) {fCLIP = Int_t(val); return;}
190 if (!strcmp(name,"2BUF")) {f2BUF = Int_t(val); return;}
192 //_______________________________________________________________
193 void THIGZ::Reset(Option_t *)
219 //___________________________________________
220 void THIGZ::Gsatt(const char *name, const char *att, Int_t val)
223 // IOPT Name of the attribute to be set
224 // IVAL Value to which the attribute is to be set
226 // name= "*" stands for all the volumes.
227 // iopt can be chosen among the following :
228 // see TGeant3::Gsatt for more details
231 gMC->Gsatt(name,att,val);
234 //___________________________________________
235 void THIGZ::Gdopt(const char *name,const char *value)
238 // VALUE Option value
240 // To set/modify the drawing options.
241 // see TGeant3::Gdopt for more details
243 gMC->Gdopt(name,value);
247 //___________________________________________
248 void THIGZ::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,Float_t u0,Float_t v0,Float_t ul,Float_t vl)
252 // THETA Viewing angle theta (for 3D projection)
253 // PHI Viewing angle phi (for 3D projection)
254 // PSI Viewing angle psi (for 2D rotation)
255 // U0 U-coord. (horizontal) of volume origin
256 // V0 V-coord. (vertical) of volume origin
257 // SU Scale factor for U-coord.
258 // SV Scale factor for V-coord.
259 // see TGeant3::Gdraw for more details
262 gMC->Gdraw(name,theta,phi,psi,u0,v0,ul,vl);
266 //___________________________________________
267 void THIGZ::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,Float_t v0,Float_t ul,Float_t vl)
271 // CUTVAL Cut plane distance from the origin along the axis
273 // U0 U-coord. (horizontal) of volume origin
274 // V0 V-coord. (vertical) of volume origin
275 // SU Scale factor for U-coord.
276 // SV Scale factor for V-coord.
277 // see TGeant3::Gdrawc for more details
280 geant3->Gdrawc(name,axis,cut,u0,v0,ul,vl);
284 //___________________________________________
285 void THIGZ::Gdspec(const char *name)
289 // Shows 3 views of the volume (two cut-views and a 3D view), together with
290 // its geometrical specifications. The 3D drawing will
291 // be performed according the current values of the options HIDE and
292 // SHAD and according the current CVOL clipping parameters for that
294 // see TGeant3::Gdspec for more details
297 geant3->Gdspec(name);
301 //___________________________________________
302 void THIGZ::Gdtree(const char *name,Int_t levmax, Int_t isel)
305 // LEVMAX Depth level
308 // This function draws the logical tree,
309 // Each volume in the tree is represented by a TPaveTree object.
310 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
311 // Use TPaveTree pop-up menu to select:
314 // - drawing tree of parent
317 geant3->Gdtree(name,levmax,isel);
321 //______________________________________________________________________________
322 void THIGZ::SetBOMB(Float_t boom)
324 // BOOM : Exploding factor for volumes position
326 // To 'explode' the detector. If BOOM is positive (values smaller
327 // than 1. are suggested, but any value is possible)
328 // all the volumes are shifted by a distance
329 // proportional to BOOM along the direction between their centre
330 // and the origin of the MARS; the volumes which are symmetric
331 // with respect to this origin are simply not shown.
332 // BOOM equal to 0 resets the normal mode.
333 // A negative (greater than -1.) value of
334 // BOOM will cause an 'implosion'; for even lower values of BOOM
335 // the volumes' positions will be reflected respect to the origin.
336 // This command can be useful to improve the 3D effect for very
337 // complex detectors. The following commands will make explode the
340 geant3->SetBOMB(boom);
343 //_______________________________________________________________
344 extern "C" void type_of_call iacwk(Int_t &)
346 // printf("iacwk called,wid=%d\n",wid);
349 //_______________________________________________________________
350 extern "C" void type_of_call iclrwk(Int_t &,Int_t &)
352 // printf("iclrwk called\n");
356 //_______________________________________________________________
357 extern "C" void type_of_call iclwk(Int_t &,Int_t &)
359 // printf("iclwk called\n");
363 //_______________________________________________________________
364 extern "C" void type_of_call idawk(Int_t &)
366 // printf("idawk called\n");
369 //_______________________________________________________________
370 extern "C" void type_of_call ifa(Int_t &n,Float_t *x, Float_t *y)
372 // printf("ifa called, n=%d, pname=%s, pid=%d, x1=%f, y1=%f,x2=%f, y2=%f, x3=%f, y3=%f\n",n,higz->fPname.Data(),higz->fPID,x[0],y[0],x[1],y[1],x[2],y[2]);
373 TGraph *gr = new TGraph(n,x,y);
374 gr->SetFillColor(higz->fFACI);
378 //_______________________________________________________________
379 extern "C" void type_of_call igbox(Float_t &x1,Float_t &x2,Float_t &y1,Float_t &y2)
381 printf("igbox called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2);
382 TBox *box = new TBox(x1,y1,x2,y2);
383 box->SetLineColor(higz->fPLCI);
384 box->SetFillColor(higz->fFACI);
385 box->SetFillStyle(higz->fFASI);
389 //_______________________________________________________________
390 extern "C" void type_of_call ightor(Float_t &h,Float_t &l,Float_t &s,Float_t &r,Float_t &g,Float_t &b)
392 // printf("ightor called\n");
393 TColor *col1 = gROOT->GetColor(1);
394 if (col1) col1->HLStoRGB(h,l,s,r,g,b);
397 //_______________________________________________________________
398 extern "C" void type_of_call igpave(Float_t &x1,Float_t &x2,Float_t &yy1,Float_t &yy2,Float_t &,Int_t &isbox,Int_t &isfram,const char *, const Int_t)
401 strncpy(text,(char*)&higz->fPID,4);
405 if (y1 > y2) { y1 = yy2; y2 = yy1;}
406 Float_t y = 0.5*(y1+y2);
407 Float_t dymax = 0.06*(higz->GetY2()-higz->GetY1());
408 Float_t dymin = -higz->PixeltoY(12);
417 TPaveTree *pt = new TPaveTree(x1,y1,x2,y2,text);
419 pt->SetFillColor(isbox%1000);
420 pt->SetLineColor(isfram%1000);
422 // printf("igpave called, text=%s, Pname=%s, x1=%f, y1=%f, x2=%f, y2=%f, isbox=%d, isfram=%d\n",text,higz->fPname.Data(),x1,y1,x2,y2,isbox,isfram);
425 //_______________________________________________________________
427 extern "C" void type_of_call igpid(Int_t &,const char *name,Int_t &pid,const char *, const Int_t l1, const Int_t)
429 extern "C" void type_of_call igpid(Int_t &,const char *name,const Int_t l1, Int_t &pid,const char *, const Int_t)
433 // if(npid&100 == 0) printf("igpid called, npid=%d\n",npid);
434 strncpy(cpar,name,l1); cpar[l1] = 0;
439 // strncpy(text,(char*)&higz->fPID,4);
441 // printf("igpid called, level=%d, name=%s, pid=%d, cpid=%s\n",level,cpar,pid,text);
444 //_______________________________________________________________
446 extern "C" void type_of_call igq(const char *name,Float_t &rval, const Int_t l1)
448 extern "C" void type_of_call igq(const char *name,const Int_t l1, Float_t &rval)
451 strncpy(cpar,name,l1); cpar[l1] = 0;
452 // printf("igq called, name=%s\n",cpar);
453 rval = higz->Get(cpar);
456 //_______________________________________________________________
457 extern "C" void type_of_call igrng(Float_t &xsize,Float_t &ysize)
459 // printf("igrng called, xsize=%f, ysize=%f\n",xsize,ysize);
460 higz->Range(0,0,xsize,ysize);
463 //_______________________________________________________________
464 extern "C" void type_of_call igsa(Int_t &)
466 // printf("igsa called, iwk=%d\n",iwk);
469 //_______________________________________________________________
471 extern "C" void type_of_call igset(const char *name,Float_t &rval, const Int_t l1)
473 extern "C" void type_of_call igset(const char *name, const Int_t l1,Float_t &rval)
476 strncpy(cpar,name,l1); cpar[l1] = 0;
477 // printf("igset called, name=%s, rval=%f\n",cpar,rval);
478 higz->Set(cpar,rval);
481 //_______________________________________________________________
482 extern "C" void type_of_call igterm()
484 printf("igterm called\n");
487 //_______________________________________________________________
488 extern "C" void type_of_call iopwk(Int_t &iwkid,Int_t &iconid,Int_t &iwtypi)
490 printf("iopwk called, iwkid=%d, iconid=%d, iwtypi=%d\n",iwkid,iconid,iwtypi);
493 //_______________________________________________________________
494 extern "C" void type_of_call ipl(Int_t &n,Float_t *x,Float_t *y)
496 // printf("ipl called, n=%d, x[0]=%f,y[0]=%f, x[1]=%f, y[1]=%f\n",n,x[0],y[0],x[1],y[1]);
498 TLine *l = new TLine(x[0],y[0],x[1],y[1]);
499 l->SetLineColor(higz->fPLCI);
500 l->SetLineStyle(higz->fLTYP);
501 l->SetLineWidth(Short_t(higz->fLWID));
504 TPolyLine *pl = new TPolyLine(n,x,y);
505 pl->SetLineColor(higz->fPLCI);
506 pl->SetLineStyle(higz->fLTYP);
507 pl->SetLineWidth(Short_t(higz->fLWID));
512 //_______________________________________________________________
513 extern "C" void type_of_call ipm(Int_t &n,Float_t *x,Float_t *y)
515 printf("ipm called, n=%d\n",n);
516 TPolyMarker *pm = new TPolyMarker(n,x,y);
517 pm->SetMarkerColor(higz->fPMCI);
518 pm->SetMarkerStyle(higz->fMTYP);
519 pm->SetMarkerSize(higz->fMSCF);
523 //_______________________________________________________________
524 extern "C" void type_of_call irqlc(Int_t&, Int_t&, Int_t&, Int_t&, Float_t&, Float_t&)
527 printf("irqlc called\n");
530 //_______________________________________________________________
531 extern "C" void type_of_call iscr(Int_t &,Int_t &ici,Float_t &r,Float_t &g,Float_t &b)
533 // printf("iscr called, ici=%d, r=%f, g=%f, b=%f\n",ici,r,g,b);
535 // if (color > 10) color += 35;
536 TColor *col = gROOT->GetColor(color);
538 col = new TColor(color,r,g,b);
545 //_______________________________________________________________
546 extern "C" void type_of_call isfaci(Int_t &col)
548 // printf("isfaci called, col=%d\n",col);
549 Int_t color = col%1000;
550 // if (color > 10) color += 35;
554 //_______________________________________________________________
555 extern "C" void type_of_call isfais(Int_t &is)
557 // printf("isfais called, is=%d\n",is);
561 //_______________________________________________________________
562 extern "C" void type_of_call isln(Int_t &ln)
564 // printf("isln called, ln=%d\n",ln);
568 //_______________________________________________________________
569 extern "C" void type_of_call ismk(Int_t &mk)
571 // printf("ismk called, mk=%d\n",mk);
575 //_______________________________________________________________
576 extern "C" void type_of_call islwsc(Float_t &wl)
578 // printf("islwsc called, wl=%f\n",wl);
582 //_______________________________________________________________
583 extern "C" void type_of_call isplci(Int_t &col)
585 // printf("isplci called, col=%d\n",col);
586 Int_t color = col%1000;
587 // if (color > 10) color += 35;
591 //_______________________________________________________________
592 extern "C" void type_of_call ispmci(Int_t &col)
594 // printf("ispmci called, col=%d\n",col);
595 Int_t color = col%1000;
596 // if (color > 10) color += 35;
600 //_______________________________________________________________
601 extern "C" void type_of_call istxci(Int_t &col)
603 // printf("istxci called, col=%d\n",col);
604 Int_t color = col%1000;
605 // if (color > 10) color += 35;
609 //_______________________________________________________________
610 extern "C" void type_of_call isvp(Int_t &,Float_t &,Float_t &,Float_t &,Float_t &)
612 // printf("isvp called, nt=%d, x1=%f, y1=%f, x2=%f, y2=%f\n",nt,x1,y1,x2,y2);
615 //_______________________________________________________________
616 extern "C" void type_of_call iswn(Int_t &,Float_t &x1,Float_t &x2,Float_t &y1,Float_t &y2)
619 // printf("iswn called, nt=%d, x1=%f, y1=%f, x2=%f, y2=%f\n",nt,x1,y1,x2,y2);
620 higz->Range(x1,y1,x2,y2);
623 //_______________________________________________________________
624 extern "C" void type_of_call itx(Float_t &x,Float_t &y,const char *ptext, const Int_t l1p)
626 if (higz->fPname == "Tree") return;
628 strncpy(cpar,ptext,l1); cpar[l1] = 0;
629 //printf("itx called, x=%f, y=%f, text=%s, l1=%d\n",x,y,cpar,l1);
631 if (cpar[l1-1] != ' ' && cpar[l1-1] != '$') break;
635 char *small = strstr(cpar,"<");
636 while(small && *small) {
637 small[0] = tolower(small[1]);
640 TText *text = new TText(x,y,cpar);
641 text->SetTextColor(higz->fTXCI);
642 text->SetTextSize(higz->fCHHE);
643 text->SetTextFont(higz->fTXFP);
644 text->SetTextAlign(higz->fTXAL);
645 text->SetTextAngle(higz->fTANG);
649 //_______________________________________________________________
650 extern "C" void type_of_call hplint(Int_t &)
652 printf("hplint called\n");
656 //_______________________________________________________________
657 extern "C" void type_of_call hplend()
659 printf("hplend called\n");
662 //_______________________________________________________________
663 extern "C" void type_of_call hplfra(Float_t &x1,Float_t &x2,Float_t &y1, Float_t &y2,const char *, const Int_t)
665 // printf("hplfra called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2);
667 higz->Range(x1,y1,x2,y2);
670 //_______________________________________________________________
671 extern "C" void type_of_call igmeta(Int_t &, Int_t &)
673 printf("igmeta called\n");
676 //_______________________________________________________________
677 extern "C" void type_of_call iselnt(Int_t &)
679 // printf("iselnt called, nt=%d\n",nt);
682 //_______________________________________________________________
683 extern "C" Int_t type_of_call igiwty(Int_t &)
685 // printf("igiwty called, wid=%d\n",wid);
689 //_______________________________________________________________
690 extern "C" void type_of_call igqwk(Int_t &, const char *name, Float_t &rval, const Int_t l1)
692 strncpy(cpar,name,l1); cpar[l1] = 0;
693 // printf("igqwk called, wid=%d, pname=%s\n",wid,cpar);
694 rval = higz->Get(cpar);