]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv0.cxx
correct previous non intended commit, but leaving some new things
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
index 169f3154b5186d9da844c3fedf216b7118e81d76..f95609f472c6c9b902f01c6bb76a238f8c1966c4 100644 (file)
 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx                 
 //*-- Author: Yves Schutz (SUBATECH)
 //*-- and   : Sahal Yacoob (LBL / UCT)
-//          : Aleksei Pavlinov (WSU)     SHASHLYK
+//          : Alexei Pavlinov (WSU)     SHASHLYK
 
 // --- 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>
 #include <TVector2.h>
 #include <cassert>
 
-#include "AliEMCALShishKebabModule.h"
-#include "AliEMCALShishKebabTrd1Module.h"
-
 // --- Standard library ---
 
 //#include <stdio.h>
 
 // --- AliRoot header files ---
-
-#include "AliEMCALv0.h"
-#include "AliEMCALGeometry.h"
 #include "AliRun.h"
 #include "AliLog.h"
 #include "AliGeomManager.h"
+
+//--- EMCAL system---
+#include "AliEMCALShishKebabTrd1Module.h"
+#include "AliEMCALv0.h"
+#include "AliEMCALGeometry.h"
 #include "AliEMCALSpaceFrame.h"
 
+
+
 ClassImp(AliEMCALv0)
 
-// EMCAL material
+// EMCAL material: look to the AliEMCAL.cxx
 enum
  {
   kIdAIR   = 1599, 
   kIdPB    = 1600, 
   kIdSC    = 1601, 
-  kIdSTEEL = 1603
+  kIdAL    = 1602, 
+  kIdSTEEL = 1603,
+  kIdPAPER = 1604
  };
 
 
@@ -78,183 +75,35 @@ AliEMCALv0::AliEMCALv0()
     fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0)
 {
   //default ctor
+  for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0;
 }
 
 //______________________________________________________________________
-AliEMCALv0::AliEMCALv0(const char *name, const char *title)
-  : AliEMCAL(name,title),
+AliEMCALv0::AliEMCALv0(const char *name, const char *title, 
+                       const Bool_t checkGeoAndRun)
+  : AliEMCAL(name,title,checkGeoAndRun),
     fShishKebabModules(),fEnvelop1(0),fIdRotm(0),fIdTmedArr(0),
     fSampleWidth(0),fSmodPar0(0),fSmodPar1(0),fSmodPar2(0),fCalFrame(0)
 {
   // ctor : title is used to identify the layout
   // Apr 25, 2006
   // Nov 22, 2006 - case of 1X1  
+  
+  for(Int_t i = 0; i < 5 ; i++) fParEMOD[i]=0.0;
   TString ntmp(GetTitle());
   ntmp.ToUpper();
 
-  AliEMCALGeometry *geom = GetGeometry() ; 
-  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;
-  const 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] = -geom->GetEnvelop(2)/2.; //zmin
-      fEnvelop1[5] = geom->GetEnvelop(0) ; // rmin at z1
-      fEnvelop1[6] = geom->GetEnvelop(1) ; // rmax at z1
-      fEnvelop1[7] = geom->GetEnvelop(2)/2.; //zmax
-      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;
-  const 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;
+  AliEMCALGeometry *g = GetGeometry() ; 
+  TString gn(g->GetName()); gn.ToUpper();
+  fShishKebabModules = g->GetShishKebabTrd1Modules(); 
+  fGeometry = g;
+  fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
+  if(gn.Contains("V1")) fSampleWidth += 2.*g->GetTrd1BondPaperThick();
+  AliDebug(2,Form("fGeometry %p : gMC %p : fSampleWidth %5.4f\n", 
+        fGeometry, gMC, fSampleWidth));
+  //Set geometry name again, in case it was changed during the initialization of the geometry.
+  SetTitle(fGeometry->GetEMCGeometry()->GetName());
 
-    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;
 }
 
 //______________________________________________________________________
@@ -282,15 +131,16 @@ void AliEMCALv0::CreateGeometry()
   
   Float_t envelopA[10];
   if(gn.Contains("WSUC") ) { // TRD1 for WSUC facility
-    // 17-may-05 - just BOX
-    envelopA[0] = 26;
-    envelopA[1] = 15;
-    envelopA[2] = 30;
+    // Nov 25,2010
+    envelopA[0] = 30.;
+    envelopA[1] = 30;
+    envelopA[2] = 20;
     gMC->Gsvolu("XEN1", "BOX", fIdTmedArr[kIdSC], envelopA, 3) ;
     fEnvelop1.Set(3);
     for(int i=0; i<3; i++) fEnvelop1[i] = envelopA[i]; // 23-may-05  
-    // Position the EMCAL Mother Volume (XEN1) in WSUC  
-    gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, 0.0, fIdRotm, "ONLY") ;
+    // Position the EMCAL Mother Volume (XEN1) in WSUC.
+    // Look to AliEMCALWsuCosmicRaySetUp.  
+    gMC->Gspos("XEN1", 1, "WSUC", 0.0, 0.0, + 265., fIdRotm, "ONLY") ;
   } else { 
     envelopA[0] = geom->GetArm1PhiMin();                         // minimum phi angle
     envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
@@ -318,11 +168,12 @@ void AliEMCALv0::CreateGeometry()
   AliDebug(2,Form("Shish-Kebab geometry : %s", GetTitle())); 
   CreateShishKebabGeometry();
 
+  if(gn.Contains("WSUC")==0) { // Nov 24,2010 for TB
   //Space Frame
-  AliDebug(2,"Creating EMCAL Space Frame");
-  fCalFrame = new AliEMCALSpaceFrame();
-  fCalFrame->CreateGeometry();
-
+    AliDebug(2,"Creating EMCAL Space Frame");
+    fCalFrame = new AliEMCALSpaceFrame();
+    fCalFrame->CreateGeometry();
+  }
 }
 
 //______________________________________________________________________
@@ -350,7 +201,7 @@ void AliEMCALv0::Init(void)
       message += "EMCAL geometry initialization failed !" ; 
     }
     message += "\n*****************************************" ;
-    printf(message.Data() ) ; 
+    printf("%s",message.Data() ) ; 
   }
 }
 
@@ -358,9 +209,11 @@ void AliEMCALv0::Init(void)
 //______________________________________________________________________
 void AliEMCALv0::CreateShishKebabGeometry()
 {  
+  // Oct 26,2010
   // TRD1
   AliEMCALGeometry * g = GetGeometry(); 
   TString gn(g->GetName()); gn.ToUpper(); 
+  Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
   // see AliModule::fFIdTmedArr
   //  fIdTmedArr = fIdtmed->GetArray() - 1599 ; // see AliEMCAL::::CreateMaterials()
   //  int kIdAIR=1599, kIdPB = 1600, kIdSC = 1601, kIdSTEEL = 1603;
@@ -371,17 +224,30 @@ void AliEMCALv0::CreateShishKebabGeometry()
 
   CreateEmod("SMOD","EMOD"); // 18-may-05
 
-  if(g->GetKey110DEG()) CreateEmod("SM10","EMOD"); // Nov 1,2006 
-
+  if(g->GetKey110DEG() && !gn.Contains("12SMV1")) { CreateEmod("SM10","EMOD");} // Nov 1,2006 1/2 SM
+  if(g->GetKey110DEG() && gn.Contains("12SMV1")) { CreateEmod("SM3rd","EMOD");  }  // Feb 1,2012 1/3 SM
+    
   // Sensitive SC  (2x2 tiles)
   double parSCM0[5]={0,0,0,0}, *dummy = 0, parTRAP[11];
 
-  //      double wallThickness = g->GetPhiModuleSize()/2. -  g->GetPhiTileSize(); // Need check
-  double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() -  g->GetPhiTileSize();
-  for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
-  parSCM0[3] = fParEMOD[3];
-  gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
-  gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
+  if(!gn.Contains("V1")) {
+    double wallThickness = g->GetPhiModuleSize()/g->GetNPHIdiv() -  g->GetPhiTileSize();
+    for(int i=0; i<3; i++) parSCM0[i] = fParEMOD[i] - wallThickness;
+    parSCM0[3] = fParEMOD[3];
+    gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
+    gMC->Gspos("SCM0", 1, "EMOD", 0., 0., 0., 0, "ONLY") ;
+  } else {
+    double wTh = g->GetLateralSteelStrip();
+    parSCM0[0] = fParEMOD[0] - wTh + tanTrd1*g->GetTrd1AlFrontThick();
+    parSCM0[1] = fParEMOD[1] - wTh;
+    parSCM0[2] = fParEMOD[2] - wTh;
+    parSCM0[3] = fParEMOD[3] - g->GetTrd1AlFrontThick()/2.;
+    gMC->Gsvolu("SCM0", "TRD1", fIdTmedArr[kIdAIR], parSCM0, 4);
+    double zshift = g->GetTrd1AlFrontThick()/2.;
+    gMC->Gspos("SCM0", 1, "EMOD", 0., 0., zshift, 0, "ONLY");
+    // 
+    CreateAlFrontPlate("EMOD","ALFP");
+  }
 
   if(g->GetNPHIdiv()==2 && g->GetNETAdiv()==2) {
     // Division to tile size - 1-oct-04
@@ -414,24 +280,53 @@ void AliEMCALv0::CreateShishKebabGeometry()
     gMC->Gspos("SCMX", 2, "SCMY", xpos, 0.0, 0.0, fIdRotm, "ONLY");
     // put LED to the SCM0 
     AliEMCALShishKebabTrd1Module *mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(0);
-    gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
-    
-    par[1] = parSCM0[2]/2;            // y 
-    par[2] = g->GetECPbRadThick()/2.; // z
+    Double_t tanBetta = mod->GetTanBetta();
 
-    int nr=0;
+    int nr=0; 
     ypos = 0.0; 
-    zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
     double xCenterSCMX =  (parTRAP[4] +  parTRAP[8])/2.;
-    AliDebug(2,Form(" Pb tiles \n"));
-    for(int iz=0; iz<g->GetNECLayers(); iz++){
-      par[0] = (parSCM0[0] + mod->GetTanBetta()*fSampleWidth*iz)/2.;
-      xpos   = par[0] - xCenterSCMX;
-      gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
-      AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
-      zpos += fSampleWidth;
-    } 
-    AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
+    if(!gn.Contains("V1")) {
+      par[1] = parSCM0[2]/2;            // y 
+      par[2] = g->GetECPbRadThick()/2.; // z
+      gMC->Gsvolu("PBTI", "BOX", fIdTmedArr[kIdPB], dummy, 0);
+      zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
+      AliDebug(2,Form(" Pb tiles \n"));
+      for(int iz=0; iz<g->GetNECLayers(); iz++){
+        par[0] = (parSCM0[0] + tanBetta*fSampleWidth*iz)/2.;
+        xpos   = par[0] - xCenterSCMX;
+        gMC->Gsposp("PBTI", ++nr, "SCMX", xpos, ypos, zpos, 0, "ONLY", par, 3) ;
+        AliDebug(3,Form(" %i xpos %f zpos %f par[0] %f \n", iz+1, xpos, zpos, par[0]));
+        zpos += fSampleWidth;
+      } 
+      AliDebug(2,Form(" Number of Pb tiles in SCMX %i \n", nr));
+    } else {
+      // Oct 26, 2010
+      // First sheet of paper
+      par[1] = parSCM0[2]/2.;                 // y 
+      par[2] = g->GetTrd1BondPaperThick()/2.; // z
+      par[0] = parSCM0[0]/2.;                 // x 
+      gMC->Gsvolu("PAP1", "BOX", fIdTmedArr[kIdPAPER], par, 3);
+      xpos = par[0] - xCenterSCMX;
+      zpos = -parSCM0[3] + g->GetTrd1BondPaperThick()/2.;
+      gMC->Gspos("PAP1", 1, "SCMX", xpos, ypos, zpos, 0, "ONLY");
+      for(int iz=0; iz<g->GetNECLayers()-1; iz++){
+        nr = iz + 1;
+        Double_t dz = g->GetECScintThick() + g->GetTrd1BondPaperThick() + fSampleWidth*iz;
+       // PB + 2 paper sheets
+        par[2] = g->GetECPbRadThick()/2. + g->GetTrd1BondPaperThick(); // z
+        par[0] = (parSCM0[0] + tanBetta*dz)/2.;
+        TString pa(Form("PA%2.2i",nr));
+       gMC->Gsvolu(pa.Data(), "BOX", fIdTmedArr[kIdPAPER], par, 3);
+        xpos   = par[0] - xCenterSCMX;
+        zpos   = -parSCM0[3] + dz + par[2];
+        gMC->Gspos(pa.Data(), 1, "SCMX", xpos, ypos, zpos, 0, "ONLY") ;
+       // Pb
+        TString pb(Form("PB%2.2i",nr));
+        par[2] = g->GetECPbRadThick()/2.; // z
+       gMC->Gsvolu(pb.Data(), "BOX", fIdTmedArr[kIdPB], par, 3);
+        gMC->Gspos(pb.Data(), 1, pa.Data(), 0.0, 0.0, 0.0, 0, "ONLY") ;
+      } 
+    }
     
   } else if(g->GetNPHIdiv()==3 && g->GetNETAdiv()==3) {
     printf(" before AliEMCALv0::Trd1Tower3X3() : parSCM0");
@@ -458,7 +353,6 @@ void AliEMCALv0::CreateSmod(const char* mother)
   Double_t par[3], xpos=0., ypos=0., zpos=0., rpos=0., dphi=0., phi=0.0, phiRad=0.;
   Double_t par1C = 0.;
   //  ===== define Super Module from air - 14x30 module ==== ;
-  fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
   AliDebug(2,Form("\n ## Super Module | fSampleWidth %5.3f ## %s \n", fSampleWidth, gn.Data()));
   par[0] = g->GetShellThickness()/2.;
   par[1] = g->GetPhiModuleSize()*g->GetNPhi()/2.; 
@@ -488,7 +382,7 @@ void AliEMCALv0::CreateSmod(const char* mother)
   } else {
     par[2]  = 350./2.; // 11-oct-04 - for 26 division
     AliDebug(2,Form(" par[0] %7.2f (old) \n",  par[0]));
-    Float_t *parSM = g->GetSuperModulesPars(); 
+    Float_t parSM[] = {g->GetSuperModulesPar(0),g->GetSuperModulesPar(1),g->GetSuperModulesPar(2)};
     for(int i=0; i<3; i++) par[i] = parSM[i];
   }
   gMC->Gsvolu("SMOD", "BOX", fIdTmedArr[kIdAIR], par, 3);
@@ -496,13 +390,21 @@ void AliEMCALv0::CreateSmod(const char* mother)
                  fIdTmedArr[kIdAIR], par[0],par[1],par[2]));
   fSmodPar0 = par[0]; 
   fSmodPar2 = par[2];
-  if(g->GetKey110DEG()) { // 12-oct-05
+  if(g->GetKey110DEG() && !gn.Contains("12SMV1") ) { // 12-oct-05
     par1C = par[1];
     par[1] /= 2.;
     gMC->Gsvolu("SM10", "BOX", fIdTmedArr[kIdAIR], par, 3);
     AliDebug(2,Form(" Super module with name \"SM10\" was created too par[1] = %f\n", par[1]));
     par[1] = par1C;
   }
+   if(g->GetKey110DEG() && gn.Contains("12SMV1")) { // 1-feb-12, one third (installed in 2012) case
+    par1C = par[1];
+    par[1] /= 3.;
+    gMC->Gsvolu("SM3rd", "BOX", fIdTmedArr[kIdAIR], par, 3);
+    AliDebug(2,Form(" Super module with name \"SM3rd\" was created too par[1] = %f\n", par[1]));
+    par[1] = par1C;
+   }
+  
   // Steel plate
   if(g->GetSteelFrontThickness() > 0.0) { // 28-mar-05
     par[0] = g->GetSteelFrontThickness()/2.;
@@ -525,11 +427,16 @@ void AliEMCALv0::CreateSmod(const char* mother)
       nr++;
     } else { // TRD1 
       TString smName("SMOD"); // 12-oct-05
-      if(i==5 && g->GetKey110DEG()) {
+      if(i==5 && g->GetKey110DEG() && !gn.Contains("12SMV1")) {
         smName = "SM10";
         nrsmod = nr;
         nr     = 0;
       }
+      if(i==5 && g->GetKey110DEG() && gn.Contains("12SMV1")) {
+        smName = "SM3rd";
+        nrsmod = nr;
+        nr     = 0;
+      }
       phi    = g->GetArm1PhiMin() + dphi*(2*i+1)/2.; // phi= 70, 90, 110, 130, 150, 170
       phiRad = phi*TMath::Pi()/180.;
 
@@ -538,10 +445,14 @@ void AliEMCALv0::CreateSmod(const char* mother)
       xpos = rpos * TMath::Cos(phiRad);
       ypos = rpos * TMath::Sin(phiRad);
       zpos = fSmodPar2; // 21-sep-04
-      if(i==5 && g->GetKey110DEG()) {
+      if(i==5 && g->GetKey110DEG() && !gn.Contains("12SMV1") ) {
         xpos += (par1C/2. * TMath::Sin(phiRad)); 
         ypos -= (par1C/2. * TMath::Cos(phiRad)); 
       }
+      if(i==5 && g->GetKey110DEG() && gn.Contains("12SMV1") ) {
+        xpos += (2.*par1C/3. * TMath::Sin(phiRad)); 
+        ypos -= (2.*par1C/3. * TMath::Cos(phiRad)); 
+      }
       
       // 1th module in z-direction;
       gMC->Gspos(smName.Data(), ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
@@ -565,33 +476,23 @@ void AliEMCALv0::CreateSmod(const char* mother)
 void AliEMCALv0::CreateEmod(const char* mother, const char* child)
 { 
   // 17-may-05; mother="SMOD"; child="EMOD"
+  // Oct 26,2010 
   AliEMCALGeometry * g = GetGeometry(); 
   TString gn(g->GetName()); gn.ToUpper(); 
   // Module definition
   Double_t xpos=0., ypos=0., zpos=0.;
-  Double_t parSCPA[5], zposSCPA=0.; // passive SC - 13-MAY-05, TRD1 case
-  Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
-  int nr=0;
-  fIdRotm=0;
+  //Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad();tanTrd1 = TMath::Tan(trd1Angle/2.);
+
   if(strcmp(mother,"SMOD")==0) {
     fParEMOD[0] = g->GetEtaModuleSize()/2.;   // dx1
     fParEMOD[1] = g->Get2Trd1Dx2()/2.;        // dx2
     fParEMOD[2] = g->GetPhiModuleSize()/2.;;  // dy
     fParEMOD[3] = g->GetLongModuleSize()/2.;  // dz
     gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdSTEEL], fParEMOD, 4);
-    //      if(gn.Contains("WSUC") || gn.Contains("MAY05")){
-    if(0){ // Jul 12 - should be checked
-      parSCPA[0] = g->GetEtaModuleSize()/2. + tanTrd1*g->GetFrontSteelStrip();   // dx1
-      parSCPA[1] = parSCPA[0]               + tanTrd1*g->GetPassiveScintThick(); // dx2
-      parSCPA[2] = g->GetPhiModuleSize()/2.;     // dy
-      parSCPA[3] = g->GetPassiveScintThick()/2.; // dz
-      gMC->Gsvolu("SCPA", "TRD1", fIdTmedArr[kIdSC], parSCPA, 4);
-      zposSCPA   = -fParEMOD[3] + g->GetFrontSteelStrip() + g->GetPassiveScintThick()/2.;
-      gMC->Gspos ("SCPA", ++nr, child, 0.0, 0.0, zposSCPA, 0, "ONLY");
-    }
   }
   
-  nr   = 0;
+  int nr=0;
+  fIdRotm=0;
   // X->Z(0, 0); Y->Y(90, 90); Z->X(90, 0)
   AliEMCALShishKebabTrd1Module *mod=0; // current module
 
@@ -600,8 +501,7 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
     mod = (AliEMCALShishKebabTrd1Module*)fShishKebabModules->At(iz);
     angle = mod->GetThetaInDegree();
     if(!gn.Contains("WSUC")) { // ALICE 
-      if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,90., 90.,0.); // z'(x); y'(y); x'(z)
-      else      AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
+      AliMatrix(fIdRotm, 90.-angle,180., 90.0,90.0, angle, 0.);
       phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); 
       //          printf(" %2i | angle | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", 
       //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
@@ -609,29 +509,34 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
       zpos = mod->GetPosZ() - fSmodPar2;
       
       int iyMax = g->GetNPhi();
-      if(strcmp(mother,"SMOD") && g->GetKey110DEG()) {
-       iyMax /= 2;
+      if(strcmp(mother,"SMOD") && g->GetKey110DEG() && !gn.Contains("12SMV1")  ) {
+         iyMax /= 2;
+      }
+       if(strcmp(mother,"SMOD") && g->GetKey110DEG() && gn.Contains("12SMV1")  ) {
+         iyMax /= 3;
       }
       for(int iy=0; iy<iyMax; iy++) { // flat in phi
-       ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
-       gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
-       //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
-       AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
+         ypos = g->GetPhiModuleSize()*(2*iy+1 - iyMax)/2.;
+         gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
+         //
+         //printf(" %2i xpos %7.2f ypos %7.2f zpos %7.2f fIdRotm %i\n", nr, xpos, ypos, zpos, fIdRotm);
+         AliDebug(3,Form("%3.3i(%2.2i,%2.2i) ", nr,iy+1,iz+1));
       }
       //PH          printf("\n");
     } else { //WSUC
       if(iz==0) AliMatrix(fIdRotm, 0.,0., 90.,0., 90.,90.); // (x')z; y'(x); z'(y)
       else      AliMatrix(fIdRotm, 90-angle,270., 90.0,0.0, angle,90.);
       phiOK = mod->GetCenterOfModule().Phi()*180./TMath::Pi(); 
-      printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n", 
-            iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
+      //printf(" %2i | angle -phiOK | %6.3f - %6.3f = %6.3f(eta %5.3f)\n",
+      //iz+1, angle, phiOK, angle-phiOK, mod->GetEtaOfCenterOfModule());
       zpos = mod->GetPosZ()      - fSmodPar2;
       ypos = mod->GetPosXfromR() - fSmodPar1;
-      printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
-      for(int ix=0; ix<g->GetNPhi(); ix++) { // flat in phi
-       xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
-       gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
-       printf(" %7.2f ", xpos);
+      //printf(" zpos %7.2f ypos %7.2f fIdRotm %i\n xpos ", zpos, xpos, fIdRotm);
+      for(int ix=0; ix<g->GetNPhi(); ix++) 
+      { // flat in phi
+         xpos = g->GetPhiModuleSize()*(2*ix+1 - g->GetNPhi())/2.;
+         gMC->Gspos(child, ++nr, mother, xpos, ypos, zpos, fIdRotm, "ONLY") ;
+         printf(" %7.2f ", xpos);
       }
       printf("\n");
     }
@@ -639,6 +544,23 @@ void AliEMCALv0::CreateEmod(const char* mother, const char* child)
   AliDebug(2,Form(" Number of modules in Super Module(%s) %i \n", mother, nr));
 }
 
+void AliEMCALv0::CreateAlFrontPlate(const char* mother, const char* child)
+{
+  // Oct 26,2010 : Al front plate : ALFP
+  AliEMCALGeometry * g = GetGeometry(); 
+  TString gn(g->GetName()); gn.ToUpper(); 
+  Double_t trd1Angle = g->GetTrd1Angle()*TMath::DegToRad(), tanTrd1 = TMath::Tan(trd1Angle/2.);
+  Double_t parALFP[5], zposALFP=0.;
+
+  parALFP[0] = g->GetEtaModuleSize()/2. - g->GetLateralSteelStrip();    // dx1
+  parALFP[1] = parALFP[0]               + tanTrd1*g->GetTrd1AlFrontThick(); // dx2
+  parALFP[2] = g->GetPhiModuleSize()/2. - g->GetLateralSteelStrip();    // dy
+  parALFP[3] = g->GetTrd1AlFrontThick()/2.; // dz
+  gMC->Gsvolu(child, "TRD1", fIdTmedArr[kIdAL], parALFP, 4);
+  zposALFP   = -fParEMOD[3] + g->GetTrd1AlFrontThick()/2.;
+  gMC->Gspos (child, 1, mother, 0.0, 0.0, zposALFP, 0, "ONLY");
+}
+
 //______________________________________________________________________
 void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
 {
@@ -697,7 +619,7 @@ void AliEMCALv0::Trd1Tower3X3(const double *parSCM0)
 
     PbInTrap(parTRAP, scmx);
   }
-  AliDebug(2,Form("Trd1Tower3X3()", "Ver. 1.0 : was tested."));
+  AliDebug(2,"Trd1Tower3X3 - Ver. 1.0 : was tested.");
 }
 
 // 8-dec-04 by PAI
@@ -710,7 +632,6 @@ void AliEMCALv0::PbInTrap(const double parTRAP[11], TString n)
   AliEMCALGeometry * g = GetGeometry(); 
 
   double par[3];
-  //  double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
   double xpos = 0.0, ypos = 0.0;
   double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
 
@@ -736,7 +657,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 +689,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;
@@ -776,7 +697,6 @@ void AliEMCALv0::PbInTrd1(double *parTrd1, TString n)
   AliEMCALGeometry * g = GetGeometry(); 
 
   double par[3];
-  //  double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
   double xpos = 0.0, ypos = 0.0;
   double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
   double coef = (parTrd1[1] -  parTrd1[0]) / (2.*parTrd1[3]);
@@ -919,7 +839,6 @@ void AliEMCALv0::PbInTrapForTrd2(const double *parTRAP, TString name)
   AliEMCALGeometry * g = GetGeometry(); 
 
   double par[5], parPB[5], parSC[5];
-  //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
   double xpos = 0.0, ypos = 0.0;
   double zpos = -fSampleWidth*g->GetNECLayers()/2. + g->GetECPbRadThick()/2.;
   if(name == "SCMX") { // common trapezoid - 11 parameters
@@ -1009,11 +928,11 @@ void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t pa
   //  gMC->Gsvolu("SCTI", "BOX", fIdTmedArr[kIdSC], dummy, 0);
 
   double parSC[3];
-  //double fSampleWidth = double(g->GetECPbRadThick()+g->GetECScintThick());
   double xpos = 0.0, ypos = 0.0, zpos = 0.0, ztmp=0;;
   double tanx = (parPBMO[1] -  parPBMO[0]) / (2.*parPBMO[4]); //  tanx =  tany now
   double tany = (parPBMO[3] -  parPBMO[2]) / (2.*parPBMO[4]);
-  char name[10], named[10], named2[10];
+  const Int_t buffersize = 10;
+  char name[buffersize], named[buffersize], named2[buffersize];
 
   AliDebug(2,Form(" PBMO par = "));
   for(int i=0; i<5; i++) AliDebug(2,Form(" %9.5f ", parPBMO[i]));
@@ -1027,17 +946,17 @@ void AliEMCALv0::Division2X2InPbmo(const AliEMCALGeometry * g, const Double_t pa
     parSC[0] =  parPBMO[0] + tanx*ztmp;
     parSC[1] =  parPBMO[2] + tany*ztmp;
 
-    sprintf(name,"SC%2.2i", iz+1);
+    snprintf(name,buffersize,"SC%2.2i", iz+1);
     gMC->Gsvolu(name, "BOX", fIdTmedArr[kIdSC], parSC, 3);
     gMC->Gspos(name, 1, "PBMO", xpos, ypos, zpos, 0, "ONLY") ;
     AliDebug(2,Form("%s | zpos %6.3f | parSC[0,1]=(%7.5f,%7.5f) -> ", 
                    name, zpos, parSC[0], parSC[1]));
     
-    sprintf(named,"SY%2.2i", iz+1);
+    snprintf(named,buffersize,"SY%2.2i", iz+1);
     printf(" %s -> ", named);
     gMC->Gsdvn(named,name, 2, 2);
 
-    sprintf(named2,"SX%2.2i", iz+1);
+    snprintf(named2,buffersize,"SX%2.2i", iz+1);
     printf(" %s \n", named2);
     gMC->Gsdvn(named2,named, 2, 1);
 
@@ -1059,6 +978,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")) {
@@ -1077,7 +997,7 @@ void AliEMCALv0::AddAlignableVolumesInALICE() const
   // eventual changes in the geometry.
   //
 
-  Float_t * pars = GetGeometry()->GetSuperModulesPars();
+  Float_t pars[] = {GetGeometry()->GetSuperModulesPar(0),GetGeometry()->GetSuperModulesPar(1),GetGeometry()->GetSuperModulesPar(2)};
   double rpos = (GetGeometry()->GetEnvelop(0) + GetGeometry()->GetEnvelop(1))/2.;
   double phi, phiRad, xpos, ypos, zpos;
 
@@ -1093,12 +1013,21 @@ void AliEMCALv0::AddAlignableVolumesInALICE() const
     symname = "EMCAL/FullSupermodule";
     symname += (smodnum+1);
 
-    if(GetGeometry()->GetKey110DEG() && smodnum>=10) {
+    if(GetGeometry()->GetKey110DEG() && smodnum>=10 && !( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")) )
+    {
       volpath = "ALIC_1/XEN1_1/SM10_";
       volpath += (smodnum-10+1);
       symname = "EMCAL/HalfSupermodule";    
       symname += (smodnum-10+1);
     }
+    
+    if(GetGeometry()->GetKey110DEG() && smodnum>=10 && ( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")) )
+    {
+      volpath = "ALIC_1/XEN1_1/SM3rd_";
+      volpath += (smodnum-10+1);
+      symname = "EMCAL/OneThrdSupermodule";    
+      symname += (smodnum-10+1);
+    }
 
     if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
       AliFatal("AliEMCALv0::Unable to set alignable entry!!");
@@ -1112,10 +1041,21 @@ void AliEMCALv0::AddAlignableVolumesInALICE() const
     xpos = rpos * TMath::Cos(phiRad);
     ypos = rpos * TMath::Sin(phiRad);
     zpos = pars[2];
-    if(GetGeometry()->GetKey110DEG() && smodnum >= 10) {
-      xpos += (pars[1]/2. * TMath::Sin(phiRad));
+    if(GetGeometry()->GetKey110DEG() && smodnum >= 10 && !( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")))
+    {
+       AliDebug(3, Form("  fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : smodnum %i \n", 
+                        fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
+      xpos += (pars[1]/2. * TMath::Sin(phiRad));  //  half SM!
       ypos -= (pars[1]/2. * TMath::Cos(phiRad));
     }
+    
+    if(GetGeometry()->GetKey110DEG() && smodnum >= 10 && ( ( GetGeometry()->GetEMCGeometry()->GetGeoName()).Contains("12SMV1")))
+    {
+       AliDebug(3, Form("  fIdRotm %3i phi %6.1f(%5.3f) xpos %7.2f ypos %7.2f zpos %7.2f : smodnum %i \n", 
+                        fIdRotm, phi, phiRad, xpos, ypos, zpos, smodnum));
+      xpos += (pars[1]/3. * TMath::Sin(phiRad));  // one_third SM !
+      ypos -= (pars[1]/3. * TMath::Cos(phiRad));
+    }
 
     TGeoHMatrix *matTtoL;
     TGeoHMatrix *globMatrix = alignableEntry->GetGlobalOrig();