1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.5 2000/07/12 08:56:32 fca
19 Coding convention correction and warning removal
21 Revision 1.4 1999/09/29 09:24:31 fca
22 Introduction of the Copyright and cvs Log
26 ///////////////////////////////////////////////////////////////////////////////
28 // Interface to the HIGZ package for the GEANT drawing package //
32 <img src="picts/THIGZClass.gif">
37 ///////////////////////////////////////////////////////////////////////////////
45 #include "TPolyLine.h"
46 #include "TPolyMarker.h"
47 #include "TPaveLabel.h"
50 #include "AliCallf77.h"
51 #include "TPaveTree.h"
56 # define hplint hplint_
57 # define hplend hplend_
58 # define hplfra hplfra_
59 # define igmeta igmeta_
60 # define iselnt iselnt_
61 # define igiwty igiwty_
65 # define iclrwk iclrwk_
70 # define ightor ightor_
71 # define igpave igpave_
77 # define igterm igterm_
83 # define isfaci isfaci_
84 # define isfais isfais_
87 # define islwsc islwsc_
88 # define isplci isplci_
89 # define ispmci ispmci_
90 # define istxci istxci_
97 # define iclrwk ICLRWK
102 # define ightor IGHTOR
103 # define igpave IGPAVE
109 # define igterm IGTERM
115 # define isfaci ISFACI
116 # define isfais ISFAIS
119 # define islwsc ISLWSC
120 # define isplci ISPLCI
121 # define ispmci ISPMCI
122 # define istxci ISTXCI
128 // static Int_t sNpid = 0;
129 static char sCpar[1200];
130 static TGeant3 *geant3=(TGeant3*)gMC;
136 //_______________________________________________________________
140 // Default constructor
144 //_______________________________________________________________
145 THIGZ::THIGZ(Int_t size)
146 :TCanvas("higz","higz",size,size)
149 // Standard Constructor
155 //_______________________________________________________________
162 //_______________________________________________________________
163 Float_t THIGZ::Get(const char *name)
168 if (!strcmp(name,"FAIS")) return fFAIS;
169 if (!strcmp(name,"FASI")) return fFASI;
170 if (!strcmp(name,"LTYP")) return fLTYP;
171 if (!strcmp(name,"BASL")) return fBASL;
172 if (!strcmp(name,"LWID")) return fLWID;
173 if (!strcmp(name,"MTYP")) return fMTYP;
174 if (!strcmp(name,"MSCF")) return fMSCF;
175 if (!strcmp(name,"PLCI")) return fPLCI;
176 if (!strcmp(name,"PMCI")) return fPMCI;
177 if (!strcmp(name,"FACI")) return fFACI;
178 if (!strcmp(name,"TXCI")) return fTXCI;
179 if (!strcmp(name,"TXAL")) return fTXAL;
180 if (!strcmp(name,"CHHE")) return fCHHE*fY2;
181 if (!strcmp(name,"TANG")) return fTANG;
182 if (!strcmp(name,"TXFP")) return fTXFP;
183 if (!strcmp(name,"BORD")) return fBORD;
184 if (!strcmp(name,"NCOL")) return fNCOL;
185 if (!strcmp(name,"DRMD")) return fDRMD;
186 if (!strcmp(name,"SYNC")) return fSYNC;
187 if (!strcmp(name,"CLIP")) return fCLIP;
188 if (!strcmp(name,"2BUF")) return f2BUF;
191 //_______________________________________________________________
192 void THIGZ::Set(const char *name, Float_t val)
197 if (!strcmp(name,"FAIS")) {fFAIS = Int_t(val); return;}
198 if (!strcmp(name,"FASI")) {fFASI = Int_t(val); return;}
199 if (!strcmp(name,"LTYP")) {fLTYP = Int_t(val); return;}
200 if (!strcmp(name,"BASL")) {fBASL = val; return;}
201 if (!strcmp(name,"LWID")) {fLWID = val; if (val <= 0) fLWID=1; return;}
202 if (!strcmp(name,"MTYP")) {fMTYP = Int_t(val); return;}
203 if (!strcmp(name,"MSCF")) {fMSCF = val; return;}
204 if (!strcmp(name,"PLCI")) {fPLCI = Int_t(val); return;}
205 if (!strcmp(name,"PMCI")) {fPMCI = Int_t(val); return;}
206 if (!strcmp(name,"FACI")) {fFACI = Int_t(val)%1000; return;}
207 if (!strcmp(name,"TXCI")) {fTXCI = Int_t(val); return;}
208 if (!strcmp(name,"TXAL")) {
209 Int_t align = Int_t(val);
210 Int_t aligh = align/10;
211 Int_t aligv = align%10;
214 if (aligh == 0) ah = 1;
215 if (aligv == 1 || aligh == 2) av = 3;
216 if (aligv == 3) av = 2;
217 if (aligv == 0) av = 1;
221 if (!strcmp(name,"CHHE")) {fCHHE = val/fY2; if (fCHHE <= 0) fCHHE = 0.03; return;}
222 if (!strcmp(name,"TANG")) {fTANG = val; return;}
223 if (!strcmp(name,"TXFP")) {fTXFP = Int_t(val); return;}
224 if (!strcmp(name,"BORD")) {fBORD = Int_t(val); return;}
225 if (!strcmp(name,"NCOL")) {fNCOL = Int_t(val); return;}
226 if (!strcmp(name,"DRMD")) {fDRMD = Int_t(val); return;}
227 if (!strcmp(name,"SYNC")) {fSYNC = Int_t(val); return;}
228 if (!strcmp(name,"CLIP")) {fCLIP = Int_t(val); return;}
229 if (!strcmp(name,"2BUF")) {f2BUF = Int_t(val); return;}
231 //_______________________________________________________________
232 void THIGZ::Reset(Option_t *)
235 // Reset all attributes
261 //___________________________________________
262 void THIGZ::Gsatt(const char *name, const char *att, Int_t val)
265 // IOPT Name of the attribute to be set
266 // IVAL Value to which the attribute is to be set
268 // name= "*" stands for all the volumes.
269 // iopt can be chosen among the following :
270 // see TGeant3::Gsatt for more details
273 gMC->Gsatt(name,att,val);
276 //___________________________________________
277 void THIGZ::Gdopt(const char *name,const char *value)
280 // VALUE Option value
282 // To set/modify the drawing options.
283 // see TGeant3::Gdopt for more details
285 gMC->Gdopt(name,value);
289 //___________________________________________
290 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)
294 // THETA Viewing angle theta (for 3D projection)
295 // PHI Viewing angle phi (for 3D projection)
296 // PSI Viewing angle psi (for 2D rotation)
297 // U0 U-coord. (horizontal) of volume origin
298 // V0 V-coord. (vertical) of volume origin
299 // SU Scale factor for U-coord.
300 // SV Scale factor for V-coord.
301 // see TGeant3::Gdraw for more details
304 gMC->Gdraw(name,theta,phi,psi,u0,v0,ul,vl);
308 //___________________________________________
309 void THIGZ::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,Float_t v0,Float_t ul,Float_t vl)
313 // CUTVAL Cut plane distance from the origin along the axis
315 // U0 U-coord. (horizontal) of volume origin
316 // V0 V-coord. (vertical) of volume origin
317 // SU Scale factor for U-coord.
318 // SV Scale factor for V-coord.
319 // see TGeant3::Gdrawc for more details
322 geant3->Gdrawc(name,axis,cut,u0,v0,ul,vl);
326 //___________________________________________
327 void THIGZ::Gdspec(const char *name)
331 // Shows 3 views of the volume (two cut-views and a 3D view), together with
332 // its geometrical specifications. The 3D drawing will
333 // be performed according the current values of the options HIDE and
334 // SHAD and according the current CVOL clipping parameters for that
336 // see TGeant3::Gdspec for more details
339 geant3->Gdspec(name);
343 //___________________________________________
344 void THIGZ::Gdtree(const char *name,Int_t levmax, Int_t isel)
347 // LEVMAX Depth level
350 // This function draws the logical tree,
351 // Each volume in the tree is represented by a TPaveTree object.
352 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
353 // Use TPaveTree pop-up menu to select:
356 // - drawing tree of parent
359 geant3->Gdtree(name,levmax,isel);
363 //______________________________________________________________________________
364 void THIGZ::SetBOMB(Float_t boom)
366 // BOOM : Exploding factor for volumes position
368 // To 'explode' the detector. If BOOM is positive (values smaller
369 // than 1. are suggested, but any value is possible)
370 // all the volumes are shifted by a distance
371 // proportional to BOOM along the direction between their centre
372 // and the origin of the MARS; the volumes which are symmetric
373 // with respect to this origin are simply not shown.
374 // BOOM equal to 0 resets the normal mode.
375 // A negative (greater than -1.) value of
376 // BOOM will cause an 'implosion'; for even lower values of BOOM
377 // the volumes' positions will be reflected respect to the origin.
378 // This command can be useful to improve the 3D effect for very
379 // complex detectors. The following commands will make explode the
382 geant3->SetBOMB(boom);
385 //_______________________________________________________________
386 extern "C" void type_of_call iacwk(Int_t &)
388 // printf("iacwk called,wid=%d\n",wid);
391 //_______________________________________________________________
392 extern "C" void type_of_call iclrwk(Int_t &,Int_t &)
394 // printf("iclrwk called\n");
398 //_______________________________________________________________
399 extern "C" void type_of_call iclwk(Int_t &,Int_t &)
401 // printf("iclwk called\n");
405 //_______________________________________________________________
406 extern "C" void type_of_call idawk(Int_t &)
408 // printf("idawk called\n");
411 //_______________________________________________________________
412 extern "C" void type_of_call ifa(Int_t &n,Float_t *x, Float_t *y)
414 // printf("ifa called, n=%d, pname=%s, pid=%d, x1=%f, y1=%f,x2=%f, y2=%f, x3=%f, y3=%f\n",n,gHigz->Pname().Data(),gHigz->PID(),x[0],y[0],x[1],y[1],x[2],y[2]);
415 TGraph *gr = new TGraph(n,x,y);
416 gr->SetFillColor(gHigz->FACI());
420 //_______________________________________________________________
421 extern "C" void type_of_call igbox(Float_t &x1,Float_t &x2,Float_t &y1,Float_t &y2)
426 printf("igbox called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2);
427 TBox *box = new TBox(x1,y1,x2,y2);
428 box->SetLineColor(gHigz->PLCI());
429 box->SetFillColor(gHigz->FACI());
430 box->SetFillStyle(gHigz->FASI());
434 //_______________________________________________________________
435 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)
437 // printf("ightor called\n");
438 TColor *col1 = gROOT->GetColor(1);
439 if (col1) col1->HLStoRGB(h,l,s,r,g,b);
442 //_______________________________________________________________
443 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)
449 Int_t pid=gHigz->PID();
450 strncpy(text,(char*)&pid,4);
454 if (y1 > y2) { y1 = yy2; y2 = yy1;}
455 Float_t y = 0.5*(y1+y2);
456 Float_t dymax = 0.06*(gHigz->GetY2()-gHigz->GetY1());
457 Float_t dymin = -gHigz->PixeltoY(12);
466 TPaveTree *pt = new TPaveTree(x1,y1,x2,y2,text);
468 pt->SetFillColor(isbox%1000);
469 pt->SetLineColor(isfram%1000);
471 // printf("igpave called, text=%s, Pname=%s, x1=%f, y1=%f, x2=%f, y2=%f, isbox=%d, isfram=%d\n",text,gHigz->Pname().Data(),x1,y1,x2,y2,isbox,isfram);
474 //_______________________________________________________________
476 extern "C" void type_of_call igpid(Int_t &,const char *name,Int_t &pid,const char *, const Int_t l1, const Int_t)
478 extern "C" void type_of_call igpid(Int_t &,const char *name,const Int_t l1, Int_t &pid,const char *, const Int_t)
482 // if(sNpid&100 == 0) printf("igpid called, sNpid=%d\n",sNpid);
483 strncpy(sCpar,name,l1); sCpar[l1] = 0;
484 gHigz->SetPname(sCpar);
488 // strncpy(text,(char*)&gHigz->PID(),4);
490 // printf("igpid called, level=%d, name=%s, pid=%d, cpid=%s\n",level,sCpar,pid,text);
493 //_______________________________________________________________
495 extern "C" void type_of_call igq(const char *name,Float_t &rval, const Int_t l1)
497 extern "C" void type_of_call igq(const char *name,const Int_t l1, Float_t &rval)
500 strncpy(sCpar,name,l1); sCpar[l1] = 0;
501 // printf("igq called, name=%s\n",sCpar);
502 rval = gHigz->Get(sCpar);
505 //_______________________________________________________________
506 extern "C" void type_of_call igrng(Float_t &xsize,Float_t &ysize)
508 // printf("igrng called, xsize=%f, ysize=%f\n",xsize,ysize);
509 gHigz->Range(0,0,xsize,ysize);
512 //_______________________________________________________________
513 extern "C" void type_of_call igsa(Int_t &)
515 // printf("igsa called, iwk=%d\n",iwk);
518 //_______________________________________________________________
520 extern "C" void type_of_call igset(const char *name,Float_t &rval, const Int_t l1)
522 extern "C" void type_of_call igset(const char *name, const Int_t l1,Float_t &rval)
525 strncpy(sCpar,name,l1); sCpar[l1] = 0;
526 // printf("igset called, name=%s, rval=%f\n",sCpar,rval);
527 gHigz->Set(sCpar,rval);
530 //_______________________________________________________________
531 extern "C" void type_of_call igterm()
533 printf("igterm called\n");
536 //_______________________________________________________________
537 extern "C" void type_of_call iopwk(Int_t &iwkid,Int_t &iconid,Int_t &iwtypi)
539 printf("iopwk called, iwkid=%d, iconid=%d, iwtypi=%d\n",iwkid,iconid,iwtypi);
542 //_______________________________________________________________
543 extern "C" void type_of_call ipl(Int_t &n,Float_t *x,Float_t *y)
545 // 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]);
547 TLine *l = new TLine(x[0],y[0],x[1],y[1]);
548 l->SetLineColor(gHigz->PLCI());
549 l->SetLineStyle(gHigz->LTYP());
550 l->SetLineWidth(Short_t(gHigz->LWID()));
553 TPolyLine *pl = new TPolyLine(n,x,y);
554 pl->SetLineColor(gHigz->PLCI());
555 pl->SetLineStyle(gHigz->LTYP());
556 pl->SetLineWidth(Short_t(gHigz->LWID()));
561 //_______________________________________________________________
562 extern "C" void type_of_call ipm(Int_t &n,Float_t *x,Float_t *y)
567 printf("ipm called, n=%d\n",n);
568 TPolyMarker *pm = new TPolyMarker(n,x,y);
569 pm->SetMarkerColor(gHigz->PMCI());
570 pm->SetMarkerStyle(gHigz->MTYP());
571 pm->SetMarkerSize(gHigz->MSCF());
575 //_______________________________________________________________
576 extern "C" void type_of_call irqlc(Int_t&, Int_t&, Int_t&, Int_t&, Float_t&, Float_t&)
579 printf("irqlc called\n");
582 //_______________________________________________________________
583 extern "C" void type_of_call iscr(Int_t &,Int_t &ici,Float_t &r,Float_t &g,Float_t &b)
585 // printf("iscr called, ici=%d, r=%f, g=%f, b=%f\n",ici,r,g,b);
587 // if (color > 10) color += 35;
588 TColor *col = gROOT->GetColor(color);
590 col = new TColor(color,r,g,b);
597 //_______________________________________________________________
598 extern "C" void type_of_call isfaci(Int_t &col)
600 // printf("isfaci called, col=%d\n",col);
601 Int_t color = col%1000;
602 // if (color > 10) color += 35;
603 gHigz->SetFACI(color);
606 //_______________________________________________________________
607 extern "C" void type_of_call isfais(Int_t &is)
609 // printf("isfais called, is=%d\n",is);
613 //_______________________________________________________________
614 extern "C" void type_of_call isln(Int_t &ln)
616 // printf("isln called, ln=%d\n",ln);
620 //_______________________________________________________________
621 extern "C" void type_of_call ismk(Int_t &mk)
623 // printf("ismk called, mk=%d\n",mk);
627 //_______________________________________________________________
628 extern "C" void type_of_call islwsc(Float_t &wl)
630 // printf("islwsc called, wl=%f\n",wl);
634 //_______________________________________________________________
635 extern "C" void type_of_call isplci(Int_t &col)
637 // printf("isplci called, col=%d\n",col);
638 Int_t color = col%1000;
639 // if (color > 10) color += 35;
640 gHigz->SetPLCI(color);
643 //_______________________________________________________________
644 extern "C" void type_of_call ispmci(Int_t &col)
646 // printf("ispmci called, col=%d\n",col);
647 Int_t color = col%1000;
648 // if (color > 10) color += 35;
649 gHigz->SetPMCI(color);
652 //_______________________________________________________________
653 extern "C" void type_of_call istxci(Int_t &col)
655 // printf("istxci called, col=%d\n",col);
656 Int_t color = col%1000;
657 // if (color > 10) color += 35;
658 gHigz->SetTXCI(color);
661 //_______________________________________________________________
662 extern "C" void type_of_call isvp(Int_t &,Float_t &,Float_t &,Float_t &,Float_t &)
664 // printf("isvp called, nt=%d, x1=%f, y1=%f, x2=%f, y2=%f\n",nt,x1,y1,x2,y2);
667 //_______________________________________________________________
668 extern "C" void type_of_call iswn(Int_t &,Float_t &x1,Float_t &x2,Float_t &y1,Float_t &y2)
671 // printf("iswn called, nt=%d, x1=%f, y1=%f, x2=%f, y2=%f\n",nt,x1,y1,x2,y2);
672 gHigz->Range(x1,y1,x2,y2);
675 //_______________________________________________________________
676 extern "C" void type_of_call itx(Float_t &x,Float_t &y,const char *ptext, const Int_t l1p)
678 if (gHigz->Pname() == "Tree") return;
680 strncpy(sCpar,ptext,l1); sCpar[l1] = 0;
681 //printf("itx called, x=%f, y=%f, text=%s, l1=%d\n",x,y,sCpar,l1);
683 if (sCpar[l1-1] != ' ' && sCpar[l1-1] != '$') break;
687 char *small = strstr(sCpar,"<");
688 while(small && *small) {
689 small[0] = tolower(small[1]);
692 TText *text = new TText(x,y,sCpar);
693 text->SetTextColor(gHigz->TXCI());
694 text->SetTextSize(gHigz->CHHE());
695 text->SetTextFont(gHigz->TXFP());
696 text->SetTextAlign(gHigz->TXAL());
697 text->SetTextAngle(gHigz->TANG());
701 //_______________________________________________________________
702 extern "C" void type_of_call hplint(Int_t &)
707 printf("hplint called\n");
711 //_______________________________________________________________
712 extern "C" void type_of_call hplend()
717 printf("hplend called\n");
720 //_______________________________________________________________
721 extern "C" void type_of_call hplfra(Float_t &x1,Float_t &x2,Float_t &y1, Float_t &y2,const char *, const Int_t)
723 // printf("hplfra called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2);
725 gHigz->Range(x1,y1,x2,y2);
728 //_______________________________________________________________
729 extern "C" void type_of_call igmeta(Int_t &, Int_t &)
734 printf("igmeta called\n");
737 //_______________________________________________________________
738 extern "C" void type_of_call iselnt(Int_t &)
740 // printf("iselnt called, nt=%d\n",nt);
743 //_______________________________________________________________
744 extern "C" Int_t type_of_call igiwty(Int_t &)
746 // printf("igiwty called, wid=%d\n",wid);
750 //_______________________________________________________________
751 extern "C" void type_of_call igqwk(Int_t &, const char *name, Float_t &rval, const Int_t l1)
754 // Query Workstation type
756 strncpy(sCpar,name,l1); sCpar[l1] = 0;
757 // printf("igqwk called, wid=%d, pname=%s\n",wid,sCpar);
758 rval = gHigz->Get(sCpar);