1 ///////////////////////////////////////////////////////////////////////////////
3 // Interface to the HIGZ package for the GEANT drawing package //
7 <img src="gif/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];
110 //_______________________________________________________________
116 //_______________________________________________________________
117 THIGZ::THIGZ(Int_t size)
118 :TCanvas("higz","higz",size,size)
124 //_______________________________________________________________
128 //_______________________________________________________________
129 Float_t THIGZ::Get(const char *name)
131 if (!strcmp(name,"FAIS")) return fFAIS;
132 if (!strcmp(name,"FASI")) return fFASI;
133 if (!strcmp(name,"LTYP")) return fLTYP;
134 if (!strcmp(name,"BASL")) return fBASL;
135 if (!strcmp(name,"LWID")) return fLWID;
136 if (!strcmp(name,"MTYP")) return fMTYP;
137 if (!strcmp(name,"MSCF")) return fMSCF;
138 if (!strcmp(name,"PLCI")) return fPLCI;
139 if (!strcmp(name,"PMCI")) return fPMCI;
140 if (!strcmp(name,"FACI")) return fFACI;
141 if (!strcmp(name,"TXCI")) return fTXCI;
142 if (!strcmp(name,"TXAL")) return fTXAL;
143 if (!strcmp(name,"CHHE")) return fCHHE*fY2;
144 if (!strcmp(name,"TANG")) return fTANG;
145 if (!strcmp(name,"TXFP")) return fTXFP;
146 if (!strcmp(name,"BORD")) return fBORD;
147 if (!strcmp(name,"NCOL")) return fNCOL;
148 if (!strcmp(name,"DRMD")) return fDRMD;
149 if (!strcmp(name,"SYNC")) return fSYNC;
150 if (!strcmp(name,"CLIP")) return fCLIP;
151 if (!strcmp(name,"2BUF")) return f2BUF;
154 //_______________________________________________________________
155 void THIGZ::Set(const char *name, Float_t val)
157 if (!strcmp(name,"FAIS")) {fFAIS = Int_t(val); return;}
158 if (!strcmp(name,"FASI")) {fFASI = Int_t(val); return;}
159 if (!strcmp(name,"LTYP")) {fLTYP = Int_t(val); return;}
160 if (!strcmp(name,"BASL")) {fBASL = val; return;}
161 if (!strcmp(name,"LWID")) {fLWID = val; if (val <= 0) fLWID=1; return;}
162 if (!strcmp(name,"MTYP")) {fMTYP = Int_t(val); return;}
163 if (!strcmp(name,"MSCF")) {fMSCF = val; return;}
164 if (!strcmp(name,"PLCI")) {fPLCI = Int_t(val); return;}
165 if (!strcmp(name,"PMCI")) {fPMCI = Int_t(val); return;}
166 if (!strcmp(name,"FACI")) {fFACI = Int_t(val)%1000; return;}
167 if (!strcmp(name,"TXCI")) {fTXCI = Int_t(val); return;}
168 if (!strcmp(name,"TXAL")) {
169 Int_t align = Int_t(val);
170 Int_t aligh = align/10;
171 Int_t aligv = align%10;
174 if (aligh == 0) ah = 1;
175 if (aligv == 1 || aligh == 2) av = 3;
176 if (aligv == 3) av = 2;
177 if (aligv == 0) av = 1;
181 if (!strcmp(name,"CHHE")) {fCHHE = val/fY2; if (fCHHE <= 0) fCHHE = 0.03; return;}
182 if (!strcmp(name,"TANG")) {fTANG = val; return;}
183 if (!strcmp(name,"TXFP")) {fTXFP = Int_t(val); return;}
184 if (!strcmp(name,"BORD")) {fBORD = Int_t(val); return;}
185 if (!strcmp(name,"NCOL")) {fNCOL = Int_t(val); return;}
186 if (!strcmp(name,"DRMD")) {fDRMD = Int_t(val); return;}
187 if (!strcmp(name,"SYNC")) {fSYNC = Int_t(val); return;}
188 if (!strcmp(name,"CLIP")) {fCLIP = Int_t(val); return;}
189 if (!strcmp(name,"2BUF")) {f2BUF = Int_t(val); return;}
191 //_______________________________________________________________
192 void THIGZ::Reset(Option_t *)
218 //___________________________________________
219 void THIGZ::Gsatt(const char *name, const char *att, Int_t val)
222 // IOPT Name of the attribute to be set
223 // IVAL Value to which the attribute is to be set
225 // name= "*" stands for all the volumes.
226 // iopt can be chosen among the following :
227 // see TGeant3::Gsatt for more details
230 AliMC* pMC = AliMC::GetMC();
231 pMC->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 AliMC* pMC = AliMC::GetMC();
244 pMC->Gdopt(name,value);
248 //___________________________________________
249 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)
253 // THETA Viewing angle theta (for 3D projection)
254 // PHI Viewing angle phi (for 3D projection)
255 // PSI Viewing angle psi (for 2D rotation)
256 // U0 U-coord. (horizontal) of volume origin
257 // V0 V-coord. (vertical) of volume origin
258 // SU Scale factor for U-coord.
259 // SV Scale factor for V-coord.
260 // see TGeant3::Gdraw for more details
263 AliMC* pMC = AliMC::GetMC();
264 pMC->Gdraw(name,theta,phi,psi,u0,v0,ul,vl);
268 //___________________________________________
269 void THIGZ::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,Float_t v0,Float_t ul,Float_t vl)
273 // CUTVAL Cut plane distance from the origin along the axis
275 // U0 U-coord. (horizontal) of volume origin
276 // V0 V-coord. (vertical) of volume origin
277 // SU Scale factor for U-coord.
278 // SV Scale factor for V-coord.
279 // see TGeant3::Gdrawc for more details
282 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
283 geant3->Gdrawc(name,axis,cut,u0,v0,ul,vl);
287 //___________________________________________
288 void THIGZ::Gdspec(const char *name)
292 // Shows 3 views of the volume (two cut-views and a 3D view), together with
293 // its geometrical specifications. The 3D drawing will
294 // be performed according the current values of the options HIDE and
295 // SHAD and according the current CVOL clipping parameters for that
297 // see TGeant3::Gdspec for more details
300 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
301 geant3->Gdspec(name);
305 //___________________________________________
306 void THIGZ::Gdtree(const char *name,Int_t levmax, Int_t isel)
309 // LEVMAX Depth level
312 // This function draws the logical tree,
313 // Each volume in the tree is represented by a TPaveTree object.
314 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
315 // Use TPaveTree pop-up menu to select:
318 // - drawing tree of parent
321 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
322 geant3->Gdtree(name,levmax,isel);
326 //______________________________________________________________________________
327 void THIGZ::SetBOMB(Float_t boom)
329 // BOOM : Exploding factor for volumes position
331 // To 'explode' the detector. If BOOM is positive (values smaller
332 // than 1. are suggested, but any value is possible)
333 // all the volumes are shifted by a distance
334 // proportional to BOOM along the direction between their centre
335 // and the origin of the MARS; the volumes which are symmetric
336 // with respect to this origin are simply not shown.
337 // BOOM equal to 0 resets the normal mode.
338 // A negative (greater than -1.) value of
339 // BOOM will cause an 'implosion'; for even lower values of BOOM
340 // the volumes' positions will be reflected respect to the origin.
341 // This command can be useful to improve the 3D effect for very
342 // complex detectors. The following commands will make explode the
345 TGeant3 *geant3=(TGeant3*)AliMC::GetMC();
346 geant3->SetBOMB(boom);
349 //_______________________________________________________________
350 extern "C" void type_of_call iacwk(Int_t &)
352 // printf("iacwk called,wid=%d\n",wid);
355 //_______________________________________________________________
356 extern "C" void type_of_call iclrwk(Int_t &,Int_t &)
358 // printf("iclrwk called\n");
362 //_______________________________________________________________
363 extern "C" void type_of_call iclwk(Int_t &,Int_t &)
365 // printf("iclwk called\n");
369 //_______________________________________________________________
370 extern "C" void type_of_call idawk(Int_t &)
372 // printf("idawk called\n");
375 //_______________________________________________________________
376 extern "C" void type_of_call ifa(Int_t &n,Float_t *x, Float_t *y)
378 // 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]);
379 TGraph *gr = new TGraph(n,x,y);
380 gr->SetFillColor(higz->fFACI);
384 //_______________________________________________________________
385 extern "C" void type_of_call igbox(Float_t &x1,Float_t &x2,Float_t &y1,Float_t &y2)
387 printf("igbox called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2);
388 TBox *box = new TBox(x1,y1,x2,y2);
389 box->SetLineColor(higz->fPLCI);
390 box->SetFillColor(higz->fFACI);
391 box->SetFillStyle(higz->fFASI);
395 //_______________________________________________________________
396 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)
398 // printf("ightor called\n");
399 TColor *col1 = gROOT->GetColor(1);
400 if (col1) col1->HLStoRGB(h,l,s,r,g,b);
403 //_______________________________________________________________
404 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)
407 strncpy(text,(char*)&higz->fPID,4);
411 if (y1 > y2) { y1 = yy2; y2 = yy1;}
412 Float_t y = 0.5*(y1+y2);
413 Float_t dymax = 0.06*(higz->GetY2()-higz->GetY1());
414 Float_t dymin = -higz->PixeltoY(12);
423 TPaveTree *pt = new TPaveTree(x1,y1,x2,y2,text);
425 pt->SetFillColor(isbox%1000);
426 pt->SetLineColor(isfram%1000);
428 // 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);
431 //_______________________________________________________________
433 extern "C" void type_of_call igpid(Int_t &,const char *name,Int_t &pid,const char *, const Int_t l1, const Int_t)
435 extern "C" void type_of_call igpid(Int_t &,const char *name,const Int_t l1, Int_t &pid,const char *, const Int_t)
439 // if(npid&100 == 0) printf("igpid called, npid=%d\n",npid);
440 strncpy(cpar,name,l1); cpar[l1] = 0;
445 // strncpy(text,(char*)&higz->fPID,4);
447 // printf("igpid called, level=%d, name=%s, pid=%d, cpid=%s\n",level,cpar,pid,text);
450 //_______________________________________________________________
452 extern "C" void type_of_call igq(const char *name,Float_t &rval, const Int_t l1)
454 extern "C" void type_of_call igq(const char *name,const Int_t l1, Float_t &rval)
457 strncpy(cpar,name,l1); cpar[l1] = 0;
458 // printf("igq called, name=%s\n",cpar);
459 rval = higz->Get(cpar);
462 //_______________________________________________________________
463 extern "C" void type_of_call igrng(Float_t &xsize,Float_t &ysize)
465 // printf("igrng called, xsize=%f, ysize=%f\n",xsize,ysize);
466 higz->Range(0,0,xsize,ysize);
469 //_______________________________________________________________
470 extern "C" void type_of_call igsa(Int_t &)
472 // printf("igsa called, iwk=%d\n",iwk);
475 //_______________________________________________________________
477 extern "C" void type_of_call igset(const char *name,Float_t &rval, const Int_t l1)
479 extern "C" void type_of_call igset(const char *name, const Int_t l1,Float_t &rval)
482 strncpy(cpar,name,l1); cpar[l1] = 0;
483 // printf("igset called, name=%s, rval=%f\n",cpar,rval);
484 higz->Set(cpar,rval);
487 //_______________________________________________________________
488 extern "C" void type_of_call igterm()
490 printf("igterm called\n");
493 //_______________________________________________________________
494 extern "C" void type_of_call iopwk(Int_t &iwkid,Int_t &iconid,Int_t &iwtypi)
496 printf("iopwk called, iwkid=%d, iconid=%d, iwtypi=%d\n",iwkid,iconid,iwtypi);
499 //_______________________________________________________________
500 extern "C" void type_of_call ipl(Int_t &n,Float_t *x,Float_t *y)
502 // 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]);
504 TLine *l = new TLine(x[0],y[0],x[1],y[1]);
505 l->SetLineColor(higz->fPLCI);
506 l->SetLineStyle(higz->fLTYP);
507 l->SetLineWidth(Short_t(higz->fLWID));
510 TPolyLine *pl = new TPolyLine(n,x,y);
511 pl->SetLineColor(higz->fPLCI);
512 pl->SetLineStyle(higz->fLTYP);
513 pl->SetLineWidth(Short_t(higz->fLWID));
518 //_______________________________________________________________
519 extern "C" void type_of_call ipm(Int_t &n,Float_t *x,Float_t *y)
521 printf("ipm called, n=%d\n",n);
522 TPolyMarker *pm = new TPolyMarker(n,x,y);
523 pm->SetMarkerColor(higz->fPMCI);
524 pm->SetMarkerStyle(higz->fMTYP);
525 pm->SetMarkerSize(higz->fMSCF);
529 //_______________________________________________________________
530 extern "C" void type_of_call irqlc(Int_t&, Int_t&, Int_t&, Int_t&, Float_t&, Float_t&)
533 printf("irqlc called\n");
536 //_______________________________________________________________
537 extern "C" void type_of_call iscr(Int_t &,Int_t &ici,Float_t &r,Float_t &g,Float_t &b)
539 // printf("iscr called, ici=%d, r=%f, g=%f, b=%f\n",ici,r,g,b);
541 // if (color > 10) color += 35;
542 TColor *col = gROOT->GetColor(color);
544 col = new TColor(color,r,g,b);
551 //_______________________________________________________________
552 extern "C" void type_of_call isfaci(Int_t &col)
554 // printf("isfaci called, col=%d\n",col);
555 Int_t color = col%1000;
556 // if (color > 10) color += 35;
560 //_______________________________________________________________
561 extern "C" void type_of_call isfais(Int_t &is)
563 // printf("isfais called, is=%d\n",is);
567 //_______________________________________________________________
568 extern "C" void type_of_call isln(Int_t &ln)
570 // printf("isln called, ln=%d\n",ln);
574 //_______________________________________________________________
575 extern "C" void type_of_call ismk(Int_t &mk)
577 // printf("ismk called, mk=%d\n",mk);
581 //_______________________________________________________________
582 extern "C" void type_of_call islwsc(Float_t &wl)
584 // printf("islwsc called, wl=%f\n",wl);
588 //_______________________________________________________________
589 extern "C" void type_of_call isplci(Int_t &col)
591 // printf("isplci called, col=%d\n",col);
592 Int_t color = col%1000;
593 // if (color > 10) color += 35;
597 //_______________________________________________________________
598 extern "C" void type_of_call ispmci(Int_t &col)
600 // printf("ispmci called, col=%d\n",col);
601 Int_t color = col%1000;
602 // if (color > 10) color += 35;
606 //_______________________________________________________________
607 extern "C" void type_of_call istxci(Int_t &col)
609 // printf("istxci called, col=%d\n",col);
610 Int_t color = col%1000;
611 // if (color > 10) color += 35;
615 //_______________________________________________________________
616 extern "C" void type_of_call isvp(Int_t &,Float_t &,Float_t &,Float_t &,Float_t &)
618 // printf("isvp called, nt=%d, x1=%f, y1=%f, x2=%f, y2=%f\n",nt,x1,y1,x2,y2);
621 //_______________________________________________________________
622 extern "C" void type_of_call iswn(Int_t &,Float_t &x1,Float_t &x2,Float_t &y1,Float_t &y2)
625 // printf("iswn called, nt=%d, x1=%f, y1=%f, x2=%f, y2=%f\n",nt,x1,y1,x2,y2);
626 higz->Range(x1,y1,x2,y2);
629 //_______________________________________________________________
630 extern "C" void type_of_call itx(Float_t &x,Float_t &y,const char *ptext, const Int_t l1p)
632 if (higz->fPname == "Tree") return;
634 strncpy(cpar,ptext,l1); cpar[l1] = 0;
635 //printf("itx called, x=%f, y=%f, text=%s, l1=%d\n",x,y,cpar,l1);
637 if (cpar[l1-1] != ' ' && cpar[l1-1] != '$') break;
641 char *small = strstr(cpar,"<");
642 while(small && *small) {
643 small[0] = tolower(small[1]);
646 TText *text = new TText(x,y,cpar);
647 text->SetTextColor(higz->fTXCI);
648 text->SetTextSize(higz->fCHHE);
649 text->SetTextFont(higz->fTXFP);
650 text->SetTextAlign(higz->fTXAL);
651 text->SetTextAngle(higz->fTANG);
655 //_______________________________________________________________
656 extern "C" void type_of_call hplint(Int_t &)
658 printf("hplint called\n");
662 //_______________________________________________________________
663 extern "C" void type_of_call hplend()
665 printf("hplend called\n");
668 //_______________________________________________________________
669 extern "C" void type_of_call hplfra(Float_t &x1,Float_t &x2,Float_t &y1, Float_t &y2,const char *, const Int_t)
671 // printf("hplfra called, x1=%f, y1=%f, x2=%f, y2=%f\n",x1,y1,x2,y2);
673 higz->Range(x1,y1,x2,y2);
676 //_______________________________________________________________
677 extern "C" void type_of_call igmeta(Int_t &, Int_t &)
679 printf("igmeta called\n");
682 //_______________________________________________________________
683 extern "C" void type_of_call iselnt(Int_t &)
685 // printf("iselnt called, nt=%d\n",nt);
688 //_______________________________________________________________
689 extern "C" Int_t type_of_call igiwty(Int_t &)
691 // printf("igiwty called, wid=%d\n",wid);
695 //_______________________________________________________________
696 extern "C" void type_of_call igqwk(Int_t &, const char *name, Float_t &rval, const Int_t l1)
698 strncpy(cpar,name,l1); cpar[l1] = 0;
699 // printf("igqwk called, wid=%d, pname=%s\n",wid,cpar);
700 rval = higz->Get(cpar);