-TNode *AliEMCALv0::BuildGeometryOfWSUC()
-{ // June 8, 2005; see directory geant3/TGeant3/G3toRoot.cxx
- // enum EColor { kWhite, kBlack, kRed, kGreen, kBlue, kYellow, kMagenta, kCyan } - see $ROOTSYS/include/Gtypes.h
- AliEMCALGeometry * g = GetGeometry();
- TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
- top->cd();
-
- TNode *envelopNode = 0;
- char *name = "";
- /*
- name = "WSUC";
- new TBRIK(name, "WSUC(XEN1 in Geant)","void",ENVELOP1[0],ENVELOP1[1],ENVELOP1[2]);
- envelopNode = new TNode(name, "envelope for WSUC", name, 0., 0., 0., "");
- envelopNode->SetVisibility(0);
- */
-
- TNode *emod=0, *scmx=0;
- name = "SMOD"; // super module
- new TBRIK(name, "SMOD(SMOD in Geant)","void", smodPar0,smodPar1,smodPar2);
- if(envelopNode) envelopNode->cd();
- TNode *smod = new TNode(name, "SMOD", name, 0., 0., 0., "");
- smod->SetLineColor(kBlue) ;
- if(envelopNode==0) envelopNode = smod;
-
- name = "EMOD"; // see CreateEMOD
- TTRD1 *EMOD = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(parEMOD[0]),
- float(parEMOD[1]),float(parEMOD[2]),float(parEMOD[3]));
-
- // SCMX = EMOD/4 for simplicity of drawing
- name = "SCMX";
- Float_t dz=0.,theta=0.,phi=0.,h1=0.,bl1=0.,tl1=0.,alpha1=0.,h2=0.,bl2=0.,tl2=0.,alpha2=0.;
- h1 = EMOD->GetDy()/2.;
- bl1 = EMOD->GetDx()/2.;
- tl1 = bl1;
- alpha1 = 0.;
- h2 = EMOD->GetDy()/2.;
- bl2 = EMOD->GetDx2()/2.;
- tl2 = bl2;
- alpha2 = 0.;
-
- dz = EMOD->GetDz();
- double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
- theta = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg();
- phi = 180.;
-
- TTRAP *SCMX = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
- dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
- // SCMX->Dump();
- Float_t xShiftSCMX = (EMOD->GetDx() + EMOD->GetDx2())/4.;
- Float_t yShiftSCMX = EMOD->GetDy()/2.;
- printf(" xShiftSCMX %7.4f yShiftSCMX %7.4f \n",xShiftSCMX,yShiftSCMX);
-
- name = "EMOD"; // see CreateEMOD
- smod->cd();
-
- AliEMCALShishKebabTrd1Module *mod=0;
- Double_t angle=90., xpos=0.,ypos=0.,zpos=0., xposSCMX=0.,yposSCMX=0.,zposSCMX=0.;
- char rtmn[100], rtmt[100];
- TRotMatrix *rtm=0, *rtmSCMX=0;
- int numEmod=0;
- for(int iz=0; iz<g->GetNZ(); iz++) {
- mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
- zpos = mod->GetPosZ() - smodPar2;
- ypos = mod->GetPosXfromR() - smodPar1;
-
- angle = mod->GetThetaInDegree();
- sprintf(rtmn,"rmEmod%5.1f",angle);
- sprintf(rtmt,"rotation matrix for EMOD, iz=%i, angle = %6.3f",iz, angle);
- if(iz==0) rtm = new TRotMatrix(rtmn, rtmt,0.,0., 90.,0., 90.,90.); // z'(x); y'(y); x'(z)
- else rtm = new TRotMatrix(rtmn, rtmt,90.-angle,270., 90.0,0.0, angle,90.);
-
- TGeometry *tg = gAlice->GetGeometry();
- for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
- xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
- sprintf(rtmt,"EMOD, iz %i, ix %i, angle %6.3f",iz,ix, angle);
- TString namNode=name;
- namNode += numEmod++;
- smod->cd();
- emod = new TNode(namNode.Data(), rtmt, (TShape*)EMOD, xpos,ypos,zpos,rtm);
- // emod->SetLineColor(kGreen) ;
- emod->SetVisibility(0); // SCMX will bi visible
- if(SCMX) { // 4(2x2) sensetive volume inside EMOD
- emod->cd();
- zposSCMX = 0.;
- for(int jy=0; jy<2; jy++){ // division on y
- yposSCMX = yShiftSCMX *(2*jy - 1);
- for(int jx=0; jx<2; jx++){ // division on x
- Double_t theta1=90.,phi1=0., theta2=90.,phi2=90., theta3=0.,phi3=0 ;
- xposSCMX = xShiftSCMX *(2*jx - 1);
- namNode = "SCMX";
- namNode += jy;
- namNode += jx;
- sprintf(rtmn,"rm%s",namNode.Data());
- sprintf(rtmt,"rotation matrix for %s inside EMOD",namNode.Data());
- rtmSCMX = tg->GetRotMatrix(rtmn);
- if(jx == 1) {
- phi1 = 180.; // x' = -x
- phi2 = 270.; // y' = -y
- }
- if(rtmSCMX == 0) rtmSCMX = new TRotMatrix(rtmn,rtmt, theta1,phi1, theta2,phi2, theta3,phi3);
- sprintf(rtmt,"%s inside %s", namNode.Data(), emod->GetName());
- scmx = new TNode(namNode.Data(), rtmt, (TShape*)SCMX, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);
- scmx->SetLineColor(kMagenta);
- }
- }
- }
- }
- }
- // emod->Draw(); // for testing
-
- return envelopNode;