]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv0.cxx
Treatment of default recoparameters is corrected.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
index c9927237699792fc7f1243cd9c570a2635b01f5d..a7900282cea4bc204bc3970b04d5fec87f74d3c2 100644 (file)
 // --- ROOT system ---
 #include <cassert>
 
-#include <TNode.h>
-#include <TBRIK.h>
-#include <TTRD1.h>
-#include <TTRAP.h>
-#include <TPGON.h>
-#include <TTUBS.h>
 #include <TGeometry.h>
 #include <TGeoPhysicalNode.h>
 #include <TGeoManager.h>
@@ -57,6 +51,7 @@
 #include "AliRun.h"
 #include "AliLog.h"
 #include "AliGeomManager.h"
+#include "AliEMCALSpaceFrame.h"
 
 ClassImp(AliEMCALv0)
 
@@ -74,7 +69,7 @@ enum
 AliEMCALv0::AliEMCALv0()
   : AliEMCAL(),
     fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
-    fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
+    fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0)
 {
   //default ctor
 }
@@ -83,7 +78,7 @@ AliEMCALv0::AliEMCALv0()
 AliEMCALv0::AliEMCALv0(const char *name, const char *title)
   : AliEMCAL(name,title),
     fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
-    fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0)
+    fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0)
 {
   // ctor : title is used to identify the layout
   // Apr 25, 2006
@@ -95,167 +90,6 @@ AliEMCALv0::AliEMCALv0(const char *name, const char *title)
   fShishKebabModules = geom->GetShishKebabTrd1Modules(); 
 }
 
-//______________________________________________________________________
-void AliEMCALv0::BuildGeometry()
-{
-  // Display Geometry for display.C
-  
-  const Int_t kColorArm1   = kBlue ;
-
-  AliEMCALGeometry * geom = GetGeometry();
-  
-  TString gn(geom->GetName());
-  gn.ToUpper(); 
-  
-  // Define the shape of the Calorimeter 
-  TNode * top = gAlice->GetGeometry()->GetNode("alice") ; // See AliceGeom/Nodes
-  TNode * envelopNode = 0;
-  char *envn = "Envelop1";
-  if(gn.Contains("WSUC")) {
-    envelopNode = BuildGeometryOfWSUC();
-  } else { // Shish-kebab now for compact and TRD1 cases (ALIC)
-    envn="Envelop2";
-    TPGON *pgon = new TPGON(envn, "PGON that contains arm 1", "void", 
-                           geom->GetArm1PhiMin(),geom->GetArm1PhiMax()-geom->GetArm1PhiMin(),geom->GetNPhiSuperModule(), 2);
-    // define section
-    if (fEnvelop1.GetSize()<8) {
-      fEnvelop1.Set(10);
-      fEnvelop1[0] = geom->GetArm1PhiMin(); // minimum phi angle
-      fEnvelop1[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
-      fEnvelop1[2] = geom->GetNPhiSuperModule();
-      fEnvelop1[3] = 2; // 2 z coordinates
-      fEnvelop1[4] = -350.;
-      fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1
-      fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1
-      fEnvelop1[7] = 350.;
-      fEnvelop1[8] = fEnvelop1[5] ;        // radii are the same.
-      fEnvelop1[9] = fEnvelop1[6] ;        // radii are the same.      
-    }
-    pgon->DefineSection(0, fEnvelop1[4],  fEnvelop1[5], fEnvelop1[6]);
-    pgon->DefineSection(1, fEnvelop1[7],  fEnvelop1[5], fEnvelop1[6]);
-    top->cd();
-    envelopNode = new TNode(envn, "Arm1 Envelop2", envn, 0., 0., 0., "") ;
-  }                            
-
-  envelopNode->SetLineColor(kColorArm1) ;
-  fNodes->Add(envelopNode);
-}
-
-//______________________________________________________________________
-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",fEnvelop1[0],fEnvelop1[1],fEnvelop1[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", fSmodPar0,fSmodPar1,fSmodPar2);
-  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 *emodTrd1 = new TTRD1(name, "EMOD(EMOD in Geant)","void", float(fParEMOD[0]),
-                             float(fParEMOD[1]),float(fParEMOD[2]),float(fParEMOD[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     = emodTrd1->GetDy()/2.;
-  bl1    = emodTrd1->GetDx()/2.;
-  tl1    = bl1;
-  alpha1 = 0.;
-  h2     = emodTrd1->GetDy()/2.;
-  bl2    = emodTrd1->GetDx2()/2.;
-  tl2    = bl2;
-  alpha2 = 0.;
-
-  dz       = emodTrd1->GetDz();
-  double dr = TMath::Sqrt((h2-h1)*(h2-h1)+(bl2-bl1)*(bl2-bl1));
-  theta    = TMath::ATan2(dr,2.*dz) * TMath::RadToDeg(); 
-  phi      = 180.;
-
-  TTRAP *scmxTrap = new TTRAP(name, "SCMX(SCMX as in Geant)","void",
-                             dz,theta,phi, h1,bl1,tl1,alpha1, h2,bl2,tl2,alpha2);
-  //   scmxTrap->Dump();
-  Float_t xShiftSCMX = (emodTrd1->GetDx() + emodTrd1->GetDx2())/4.;
-  Float_t yShiftSCMX = emodTrd1->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()      - fSmodPar2;
-    ypos = mod->GetPosXfromR() - fSmodPar1;
-
-    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*)emodTrd1, xpos,ypos,zpos,rtm);   
-      //       emod->SetLineColor(kGreen) ;
-      emod->SetVisibility(0); // SCMX will bi visible 
-      if(scmxTrap) { // 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*)scmxTrap, xposSCMX,yposSCMX,zposSCMX,rtmSCMX);   
-           scmx->SetLineColor(kMagenta);
-         }
-       }
-      }
-    }
-  }
-  //   emod->Draw(); // for testing
-  
-  return envelopNode;
-}
-
 //______________________________________________________________________
 void AliEMCALv0::CreateGeometry()
 {
@@ -295,16 +129,10 @@ void AliEMCALv0::CreateGeometry()
     envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
     envelopA[2] = geom->GetNPhiSuperModule();                    // number of sections in phi
     envelopA[3] = 2;                                             // 2 z coordinates
-    // envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
-    //geom->GetArm1EtaMin());       // z coordinate 1
-    envelopA[4] = -350.; // AM 30/5/2006
-    
-    //add some padding for mother volume
-    envelopA[5] = geom->GetEnvelop(0) ;                          // rmin at z1
-    envelopA[6] = geom->GetEnvelop(1) ;                          // rmax at z1
-    //      envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
-    //                           geom->GetArm1EtaMax());        // z coordinate 2
-    envelopA[7] = 350.; // AM 30/5/2006
+    envelopA[4] = -geom->GetEnvelop(2)/2.;                       // zmin - includes padding
+    envelopA[5] = geom->GetEnvelop(0) ;                          // rmin at z1 - includes padding
+    envelopA[6] = geom->GetEnvelop(1) ;                          // rmax at z1 - includes padding
+    envelopA[7] = geom->GetEnvelop(2)/2.;                        // zmax includes padding
     
     envelopA[8] = envelopA[5] ;                                  // radii are the same.
     envelopA[9] = envelopA[6] ;                                  // radii are the same.
@@ -323,6 +151,11 @@ void AliEMCALv0::CreateGeometry()
   AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle())); 
   CreateShishKebabGeometry();
 
+  //Space Frame
+  AliDebug(2,"Creating EMCAL Space Frame");
+  fCalFrame = new AliEMCALSpaceFrame();
+  fCalFrame->CreateGeometry();
+
 }
 
 //______________________________________________________________________
@@ -350,7 +183,7 @@ void AliEMCALv0::Init(void)
       message += "EMCAL geometry initialization failed !" ; 
     }
     message += "\n*****************************************" ;
-    printf(message.Data() ) ; 
+    printf("%s",message.Data() ) ; 
   }
 }
 
@@ -736,7 +569,7 @@ void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
 
 // 8-dec-04 by PAI
 //______________________________________________________________________
-void AliEMCALv0::Trd1Tower4X4()
+void AliEMCALv0::Trd1Tower4X4() const
 {
  // Not ready yet
 }
@@ -768,7 +601,7 @@ void AliEMCALv0::Trd1Tower1X1(double *parSCM0)
 }
 
 //______________________________________________________________________
-void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
+void AliEMCALv0::PbInTrd1(const double *parTrd1, TString n)
 {
  // see PbInTrap(const double parTrd1[11], TString n)
   static int nr=0, ndeb=2;
@@ -1059,6 +892,7 @@ AliEMCALShishKebabTrd1Module* AliEMCALv0::GetShishKebabModule(Int_t neta)
 //_____________________________________________________________________________
 void AliEMCALv0::AddAlignableVolumes() const
 {
+  //Add volumes which are alignable (?)
   TString ntmp(GetTitle()); // name of EMCAL geometry
 
   if(ntmp.Contains("WSUC")) {